diff --git a/Packages/Acornima.dll b/Packages/Acornima.dll new file mode 100644 index 0000000..2d1f439 Binary files /dev/null and b/Packages/Acornima.dll differ diff --git a/Packages/Acornima.dll.meta b/Packages/Acornima.dll.meta new file mode 100644 index 0000000..4a89b5c --- /dev/null +++ b/Packages/Acornima.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b31976e14b83449cc912034b6c8822a1 \ No newline at end of file diff --git a/Packages/Esprima.dll b/Packages/Esprima.dll deleted file mode 100644 index 2f864f9..0000000 Binary files a/Packages/Esprima.dll and /dev/null differ diff --git a/Packages/Esprima.dll.meta b/Packages/Esprima.dll.meta deleted file mode 100644 index 4dce516..0000000 --- a/Packages/Esprima.dll.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 6e1e13409aff144fa8e999269962d593 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 1 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/Jint.dll b/Packages/Jint.dll index 694c3d4..9c40f77 100644 Binary files a/Packages/Jint.dll and b/Packages/Jint.dll differ diff --git a/Packages/Jint.dll.meta b/Packages/Jint.dll.meta index 070884f..bf768f0 100644 --- a/Packages/Jint.dll.meta +++ b/Packages/Jint.dll.meta @@ -1,33 +1,2 @@ fileFormatVersion: 2 -guid: 3459bb84dd0484cdd88988fffa22fb8e -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 1 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: +guid: 3459bb84dd0484cdd88988fffa22fb8e \ No newline at end of file diff --git a/Packages/System.Runtime.CompilerServices.Unsafe.dll b/Packages/System.Runtime.CompilerServices.Unsafe.dll new file mode 100644 index 0000000..c5ba4e4 Binary files /dev/null and b/Packages/System.Runtime.CompilerServices.Unsafe.dll differ diff --git a/Packages/System.Runtime.CompilerServices.Unsafe.dll.meta b/Packages/System.Runtime.CompilerServices.Unsafe.dll.meta new file mode 100644 index 0000000..250d8dd --- /dev/null +++ b/Packages/System.Runtime.CompilerServices.Unsafe.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f2044ec14c1094321a845380ec78a647 \ No newline at end of file diff --git a/Resources/JSUnityWrapper.txt b/Resources/JSUnityWrapper.txt index d05b022..a91c232 100644 --- a/Resources/JSUnityWrapper.txt +++ b/Resources/JSUnityWrapper.txt @@ -1,6242 +1,186929 @@ -/* - * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ var JSUnityWrapper; /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ "./node_modules/@ethersproject/abi/lib.esm/_version.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/_version.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 3877: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"abi/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/_version.js?"); +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(8677).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert(false, 'Invalid character in ' + string); + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this._strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; + + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this._strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + + BN.prototype._move = function _move (dest) { + move(dest, this); + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; + } + + function inspect () { + return (this.red ? ''; + } + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; + + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; + } + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); + + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; + + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position < res.length) { + res[position++] = carry; + + while (position < res.length) { + res[position++] = 0; + } + } + }; + + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position >= 0) { + res[position--] = carry; + + while (position >= 0) { + res[position--] = 0; + } + } + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] >>> wbit) & 0x01; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this._strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this._strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this._strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this._strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this._strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this._strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out._strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out._strip(); + } + + function jumboMulTo (self, num, out) { + // Temporary disable, see https://github.com/indutny/bn.js/issues/211 + // var fftm = new FFTM(); + // return fftm.mulp(self, num, out); + return bigMulTo(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; -/***/ }), + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this._strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this._strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this._strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this._strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this._strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a._strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modrn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modrn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modrn = function modrn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return isNegNum ? -acc : acc; + }; + + // WARNING: DEPRECATED + BN.prototype.modn = function modn (num) { + return this.modrn(num); + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + this._strip(); + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this._strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is a BN v4 instance + r.strip(); + } else { + // r is a BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + + move(a, a.umod(this.m)._forceRed(this)); + return a; + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 3737: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ "./node_modules/@ethersproject/abi/lib.esm/abi-coder.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(2808).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert(false, 'Invalid character in ' + string); + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this._strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; + + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this._strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + + BN.prototype._move = function _move (dest) { + move(dest, this); + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; + } + + function inspect () { + return (this.red ? ''; + } + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; + + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; + } + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); + + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; + + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position < res.length) { + res[position++] = carry; + + while (position < res.length) { + res[position++] = 0; + } + } + }; + + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position >= 0) { + res[position--] = carry; + + while (position >= 0) { + res[position--] = 0; + } + } + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] >>> wbit) & 0x01; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this._strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this._strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this._strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this._strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this._strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this._strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out._strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out._strip(); + } + + function jumboMulTo (self, num, out) { + // Temporary disable, see https://github.com/indutny/bn.js/issues/211 + // var fftm = new FFTM(); + // return fftm.mulp(self, num, out); + return bigMulTo(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AbiCoder\": function() { return /* binding */ AbiCoder; },\n/* harmony export */ \"defaultAbiCoder\": function() { return /* binding */ defaultAbiCoder; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/abi/lib.esm/_version.js\");\n/* harmony import */ var _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./coders/abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n/* harmony import */ var _coders_address__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./coders/address */ \"./node_modules/@ethersproject/abi/lib.esm/coders/address.js\");\n/* harmony import */ var _coders_array__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./coders/array */ \"./node_modules/@ethersproject/abi/lib.esm/coders/array.js\");\n/* harmony import */ var _coders_boolean__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./coders/boolean */ \"./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js\");\n/* harmony import */ var _coders_bytes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./coders/bytes */ \"./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js\");\n/* harmony import */ var _coders_fixed_bytes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./coders/fixed-bytes */ \"./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js\");\n/* harmony import */ var _coders_null__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./coders/null */ \"./node_modules/@ethersproject/abi/lib.esm/coders/null.js\");\n/* harmony import */ var _coders_number__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./coders/number */ \"./node_modules/@ethersproject/abi/lib.esm/coders/number.js\");\n/* harmony import */ var _coders_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./coders/string */ \"./node_modules/@ethersproject/abi/lib.esm/coders/string.js\");\n/* harmony import */ var _coders_tuple__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./coders/tuple */ \"./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js\");\n/* harmony import */ var _fragments__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./fragments */ \"./node_modules/@ethersproject/abi/lib.esm/fragments.js\");\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n\n\n\n\n\n\n\n\n\n\n\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nclass AbiCoder {\n constructor(coerceFunc) {\n logger.checkNew(new.target, AbiCoder);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"coerceFunc\", coerceFunc || null);\n }\n _getCoder(param) {\n switch (param.baseType) {\n case \"address\":\n return new _coders_address__WEBPACK_IMPORTED_MODULE_3__.AddressCoder(param.name);\n case \"bool\":\n return new _coders_boolean__WEBPACK_IMPORTED_MODULE_4__.BooleanCoder(param.name);\n case \"string\":\n return new _coders_string__WEBPACK_IMPORTED_MODULE_5__.StringCoder(param.name);\n case \"bytes\":\n return new _coders_bytes__WEBPACK_IMPORTED_MODULE_6__.BytesCoder(param.name);\n case \"array\":\n return new _coders_array__WEBPACK_IMPORTED_MODULE_7__.ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name);\n case \"tuple\":\n return new _coders_tuple__WEBPACK_IMPORTED_MODULE_8__.TupleCoder((param.components || []).map((component) => {\n return this._getCoder(component);\n }), param.name);\n case \"\":\n return new _coders_null__WEBPACK_IMPORTED_MODULE_9__.NullCoder(param.name);\n }\n // u?int[0-9]*\n let match = param.type.match(paramTypeNumber);\n if (match) {\n let size = parseInt(match[2] || \"256\");\n if (size === 0 || size > 256 || (size % 8) !== 0) {\n logger.throwArgumentError(\"invalid \" + match[1] + \" bit length\", \"param\", param);\n }\n return new _coders_number__WEBPACK_IMPORTED_MODULE_10__.NumberCoder(size / 8, (match[1] === \"int\"), param.name);\n }\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n if (size === 0 || size > 32) {\n logger.throwArgumentError(\"invalid bytes length\", \"param\", param);\n }\n return new _coders_fixed_bytes__WEBPACK_IMPORTED_MODULE_11__.FixedBytesCoder(size, param.name);\n }\n return logger.throwArgumentError(\"invalid type\", \"type\", param.type);\n }\n _getWordSize() { return 32; }\n _getReader(data, allowLoose) {\n return new _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_12__.Reader(data, this._getWordSize(), this.coerceFunc, allowLoose);\n }\n _getWriter() {\n return new _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_12__.Writer(this._getWordSize());\n }\n getDefaultValue(types) {\n const coders = types.map((type) => this._getCoder(_fragments__WEBPACK_IMPORTED_MODULE_13__.ParamType.from(type)));\n const coder = new _coders_tuple__WEBPACK_IMPORTED_MODULE_8__.TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n encode(types, values) {\n if (types.length !== values.length) {\n logger.throwError(\"types/values length mismatch\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INVALID_ARGUMENT, {\n count: { types: types.length, values: values.length },\n value: { types: types, values: values }\n });\n }\n const coders = types.map((type) => this._getCoder(_fragments__WEBPACK_IMPORTED_MODULE_13__.ParamType.from(type)));\n const coder = (new _coders_tuple__WEBPACK_IMPORTED_MODULE_8__.TupleCoder(coders, \"_\"));\n const writer = this._getWriter();\n coder.encode(writer, values);\n return writer.data;\n }\n decode(types, data, loose) {\n const coders = types.map((type) => this._getCoder(_fragments__WEBPACK_IMPORTED_MODULE_13__.ParamType.from(type)));\n const coder = new _coders_tuple__WEBPACK_IMPORTED_MODULE_8__.TupleCoder(coders, \"_\");\n return coder.decode(this._getReader((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_14__.arrayify)(data), loose));\n }\n}\nconst defaultAbiCoder = new AbiCoder();\n//# sourceMappingURL=abi-coder.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/abi-coder.js?"); + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this._strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this._strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this._strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this._strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this._strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a._strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modrn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modrn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modrn = function modrn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return isNegNum ? -acc : acc; + }; + + // WARNING: DEPRECATED + BN.prototype.modn = function modn (num) { + return this.modrn(num); + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + this._strip(); + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this._strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is a BN v4 instance + r.strip(); + } else { + // r is a BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + + move(a, a.umod(this.m)._forceRed(this)); + return a; + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 1058: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ }), +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(8188).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert(false, 'Invalid character in ' + string); + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this._strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; + + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this._strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + + BN.prototype._move = function _move (dest) { + move(dest, this); + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; + } + + function inspect () { + return (this.red ? ''; + } + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; + + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; + } + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); + + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; + + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position < res.length) { + res[position++] = carry; + + while (position < res.length) { + res[position++] = 0; + } + } + }; + + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position >= 0) { + res[position--] = carry; + + while (position >= 0) { + res[position--] = 0; + } + } + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] >>> wbit) & 0x01; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this._strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this._strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this._strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this._strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this._strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this._strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out._strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out._strip(); + } + + function jumboMulTo (self, num, out) { + // Temporary disable, see https://github.com/indutny/bn.js/issues/211 + // var fftm = new FFTM(); + // return fftm.mulp(self, num, out); + return bigMulTo(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this._strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this._strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this._strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this._strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this._strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a._strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modrn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modrn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modrn = function modrn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return isNegNum ? -acc : acc; + }; + + // WARNING: DEPRECATED + BN.prototype.modn = function modn (num) { + return this.modrn(num); + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + this._strip(); + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this._strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is a BN v4 instance + r.strip(); + } else { + // r is a BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + + move(a, a.umod(this.m)._forceRed(this)); + return a; + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 2864: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Coder\": function() { return /* binding */ Coder; },\n/* harmony export */ \"Reader\": function() { return /* binding */ Reader; },\n/* harmony export */ \"Writer\": function() { return /* binding */ Writer; },\n/* harmony export */ \"checkResultErrors\": function() { return /* binding */ checkResultErrors; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_version */ \"./node_modules/@ethersproject/abi/lib.esm/_version.js\");\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction checkResultErrors(result) {\n // Find the first error (if any)\n const errors = [];\n const checkErrors = function (path, object) {\n if (!Array.isArray(object)) {\n return;\n }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n try {\n checkErrors(childPath, object[key]);\n }\n catch (error) {\n errors.push({ path: childPath, error: error });\n }\n }\n };\n checkErrors([], result);\n return errors;\n}\nclass Coder {\n constructor(name, type, localName, dynamic) {\n // @TODO: defineReadOnly these\n this.name = name;\n this.type = type;\n this.localName = localName;\n this.dynamic = dynamic;\n }\n _throwError(message, value) {\n logger.throwArgumentError(message, this.localName, value);\n }\n}\nclass Writer {\n constructor(wordSize) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"wordSize\", wordSize || 32);\n this._data = [];\n this._dataLength = 0;\n this._padding = new Uint8Array(wordSize);\n }\n get data() {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(this._data);\n }\n get length() { return this._dataLength; }\n _writeData(data) {\n this._data.push(data);\n this._dataLength += data.length;\n return data.length;\n }\n appendWriter(writer) {\n return this._writeData((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)(writer._data));\n }\n // Arrayish items; padded on the right to wordSize\n writeBytes(value) {\n let bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value);\n const paddingOffset = bytes.length % this.wordSize;\n if (paddingOffset) {\n bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([bytes, this._padding.slice(paddingOffset)]);\n }\n return this._writeData(bytes);\n }\n _getValue(value) {\n let bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(value));\n if (bytes.length > this.wordSize) {\n logger.throwError(\"value out-of-bounds\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {\n length: this.wordSize,\n offset: bytes.length\n });\n }\n if (bytes.length % this.wordSize) {\n bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([this._padding.slice(bytes.length % this.wordSize), bytes]);\n }\n return bytes;\n }\n // BigNumberish items; padded on the left to wordSize\n writeValue(value) {\n return this._writeData(this._getValue(value));\n }\n writeUpdatableValue() {\n const offset = this._data.length;\n this._data.push(this._padding);\n this._dataLength += this.wordSize;\n return (value) => {\n this._data[offset] = this._getValue(value);\n };\n }\n}\nclass Reader {\n constructor(data, wordSize, coerceFunc, allowLoose) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"_data\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"wordSize\", wordSize || 32);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"_coerceFunc\", coerceFunc);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"allowLoose\", allowLoose);\n this._offset = 0;\n }\n get data() { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(this._data); }\n get consumed() { return this._offset; }\n // The default Coerce function\n static coerce(name, value) {\n let match = name.match(\"^u?int([0-9]+)$\");\n if (match && parseInt(match[1]) <= 48) {\n value = value.toNumber();\n }\n return value;\n }\n coerce(name, value) {\n if (this._coerceFunc) {\n return this._coerceFunc(name, value);\n }\n return Reader.coerce(name, value);\n }\n _peekBytes(offset, length, loose) {\n let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize;\n if (this._offset + alignedLength > this._data.length) {\n if (this.allowLoose && loose && this._offset + length <= this._data.length) {\n alignedLength = length;\n }\n else {\n logger.throwError(\"data out-of-bounds\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {\n length: this._data.length,\n offset: this._offset + alignedLength\n });\n }\n }\n return this._data.slice(this._offset, this._offset + alignedLength);\n }\n subReader(offset) {\n return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose);\n }\n readBytes(length, loose) {\n let bytes = this._peekBytes(0, length, !!loose);\n this._offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n readValue() {\n return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(this.readBytes(this.wordSize));\n }\n}\n//# sourceMappingURL=abstract-coder.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js?"); +var __webpack_unused_export__; +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + + + +const base64 = __webpack_require__(9742) +const ieee754 = __webpack_require__(645) +const customInspectSymbol = + (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation + ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation + : null + +exports.lW = Buffer +__webpack_unused_export__ = SlowBuffer +exports.h2 = 50 + +const K_MAX_LENGTH = 0x7fffffff +__webpack_unused_export__ = K_MAX_LENGTH + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Print warning and recommend using `buffer` v4.x which has an Object + * implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * We report that the browser does not support typed arrays if the are not subclassable + * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` + * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support + * for __proto__ and has a buggy typed array implementation. + */ +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() + +if (!Buffer.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 typedArraySupport () { + // Can typed array instances can be augmented? + try { + const arr = new Uint8Array(1) + const proto = { foo: function () { return 42 } } + Object.setPrototypeOf(proto, Uint8Array.prototype) + Object.setPrototypeOf(arr, proto) + return arr.foo() === 42 + } catch (e) { + return false + } +} + +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) + +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + const buf = new Uint8Array(length) + Object.setPrototypeOf(buf, Buffer.prototype) + return buf +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ -/***/ }), +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + if (ArrayBuffer.isView(value)) { + return fromArrayView(value) + } + + if (value == null) { + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof SharedArrayBuffer !== 'undefined' && + (isInstance(value, SharedArrayBuffer) || + (value && isInstance(value.buffer, SharedArrayBuffer)))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } + + const valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } + + const b = fromObject(value) + if (b) return b + + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) + } + + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length) +} + +// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: +// https://github.com/feross/buffer/pull/148 +Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) +Object.setPrototypeOf(Buffer, Uint8Array) + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } +} + +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpreted as a start offset. + return typeof encoding === 'string' + ? createBuffer(size).fill(fill, encoding) + : createBuffer(size).fill(fill) + } + return createBuffer(size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} + +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(size) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + const length = byteLength(string, encoding) | 0 + let buf = createBuffer(length) + + const actual = buf.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual) + } + + return buf +} + +function fromArrayLike (array) { + const length = array.length < 0 ? 0 : checked(array.length) | 0 + const buf = createBuffer(length) + for (let i = 0; i < length; i += 1) { + buf[i] = array[i] & 255 + } + return buf +} + +function fromArrayView (arrayView) { + if (isInstance(arrayView, Uint8Array)) { + const copy = new Uint8Array(arrayView) + return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) + } + return fromArrayLike(arrayView) +} + +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } + + let buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) + } else { + buf = new Uint8Array(array, byteOffset, length) + } + + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(buf, Buffer.prototype) + + return buf +} + +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + const len = checked(obj.length) | 0 + const buf = createBuffer(len) + + if (buf.length === 0) { + return buf + } + + obj.copy(buf, 0, 0, len) + return buf + } + + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) + } + return fromArrayLike(obj) + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } +} + +function checked (length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + if (a === b) return 0 + + let x = a.length + let y = b.length + + for (let i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).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 true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + let i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + const buffer = Buffer.allocUnsafe(length) + let pos = 0 + for (i = 0; i < list.length; ++i) { + let buf = list[i] + if (isInstance(buf, Uint8Array)) { + if (pos + buf.length > buffer.length) { + if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + buf.copy(buffer, pos) + } else { + Uint8Array.prototype.set.call( + buffer, + buf, + pos + ) + } + } else if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } else { + buf.copy(buffer, pos) + } + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + const len = string.length + const mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 + + // Use a for loop to avoid recursion + let loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + let loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coercion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) +// to detect a Buffer instance. It's not possible to use `instanceof Buffer` +// reliably in a browserify context because there could be multiple different +// copies of the 'buffer' package in use. This method works even for Buffer +// instances that were created from another copy of the `buffer` package. +// See: https://github.com/feross/buffer/issues/154 +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + const i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + const len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (let i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + const len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (let i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + const len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (let i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + const length = this.length + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.toLocaleString = Buffer.prototype.toString + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + let str = '' + const max = exports.h2 + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} +if (customInspectSymbol) { + Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + let x = thisEnd - thisStart + let y = end - start + const len = Math.min(x, y) + + const thisCopy = this.slice(thisStart, thisEnd) + const targetCopy = target.slice(start, end) + + for (let i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (numberIsNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + let indexSize = 1 + let arrLength = arr.length + let valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + let i + if (dir) { + let foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + let found = true + for (let j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + const remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + const strLen = string.length + + if (length > strLen / 2) { + length = strLen / 2 + } + let i + for (i = 0; i < length; ++i) { + const parsed = parseInt(string.substr(i * 2, 2), 16) + if (numberIsNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset >>> 0 + if (isFinite(length)) { + length = length >>> 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + const remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + let loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + case 'latin1': + case 'binary': + return asciiWrite(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + const res = [] + + let i = start + while (i < end) { + const firstByte = buf[i] + let codePoint = null + let bytesPerSequence = (firstByte > 0xEF) + ? 4 + : (firstByte > 0xDF) + ? 3 + : (firstByte > 0xBF) + ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + let secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +const MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + const len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + let res = '' + let i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + const len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + let out = '' + for (let i = start; i < end; ++i) { + out += hexSliceLookupTable[buf[i]] + } + return out +} + +function utf16leSlice (buf, start, end) { + const bytes = buf.slice(start, end) + let res = '' + // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) + for (let i = 0; i < bytes.length - 1; i += 2) { + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + const len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + const newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(newBuf, Buffer.prototype) + + return newBuf +} -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/address.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/address.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUintLE = +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUintBE = +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + let val = this[offset + --byteLength] + let mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUint8 = +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUint16LE = +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUint16BE = +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUint32LE = +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUint32BE = +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const lo = first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24 + + const hi = this[++offset] + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + last * 2 ** 24 + + return BigInt(lo) + (BigInt(hi) << BigInt(32)) +}) + +Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const hi = first * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + const lo = this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last + + return (BigInt(hi) << BigInt(32)) + BigInt(lo) +}) + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let i = byteLength + let mul = 1 + let val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = this[offset + 4] + + this[offset + 5] * 2 ** 8 + + this[offset + 6] * 2 ** 16 + + (last << 24) // Overflow + + return (BigInt(val) << BigInt(32)) + + BigInt(first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24) +}) + +Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = (first << 24) + // Overflow + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + return (BigInt(val) << BigInt(32)) + + BigInt(this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last) +}) + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUintLE = +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let mul = 1 + let i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUintBE = +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let i = byteLength - 1 + let mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUint8 = +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeUint16LE = +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeUint16BE = +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeUint32LE = +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeUint32BE = +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +function wrtBigUInt64LE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + return offset +} + +function wrtBigUInt64BE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset + 7] = lo + lo = lo >> 8 + buf[offset + 6] = lo + lo = lo >> 8 + buf[offset + 5] = lo + lo = lo >> 8 + buf[offset + 4] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset + 3] = hi + hi = hi >> 8 + buf[offset + 2] = hi + hi = hi >> 8 + buf[offset + 1] = hi + hi = hi >> 8 + buf[offset] = hi + return offset + 8 +} + +Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = 0 + let mul = 1 + let sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = byteLength - 1 + let mul = 1 + let sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + const len = end - start + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + if (val.length === 1) { + const code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } else if (typeof val === 'boolean') { + val = Number(val) + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + let i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + const bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + const len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// CUSTOM ERRORS +// ============= + +// Simplified versions from Node, changed for Buffer-only usage +const errors = {} +function E (sym, getMessage, Base) { + errors[sym] = class NodeError extends Base { + constructor () { + super() + + Object.defineProperty(this, 'message', { + value: getMessage.apply(this, arguments), + writable: true, + configurable: true + }) + + // Add the error code to the name to include it in the stack trace. + this.name = `${this.name} [${sym}]` + // Access the stack to generate the error message including the error code + // from the name. + this.stack // eslint-disable-line no-unused-expressions + // Reset the name to the actual name. + delete this.name + } + + get code () { + return sym + } + + set code (value) { + Object.defineProperty(this, 'code', { + configurable: true, + enumerable: true, + value, + writable: true + }) + } + + toString () { + return `${this.name} [${sym}]: ${this.message}` + } + } +} + +E('ERR_BUFFER_OUT_OF_BOUNDS', + function (name) { + if (name) { + return `${name} is outside of buffer bounds` + } + + return 'Attempt to access memory outside buffer bounds' + }, RangeError) +E('ERR_INVALID_ARG_TYPE', + function (name, actual) { + return `The "${name}" argument must be of type number. Received type ${typeof actual}` + }, TypeError) +E('ERR_OUT_OF_RANGE', + function (str, range, input) { + let msg = `The value of "${str}" is out of range.` + let received = input + if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { + received = addNumericalSeparator(String(input)) + } else if (typeof input === 'bigint') { + received = String(input) + if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { + received = addNumericalSeparator(received) + } + received += 'n' + } + msg += ` It must be ${range}. Received ${received}` + return msg + }, RangeError) + +function addNumericalSeparator (val) { + let res = '' + let i = val.length + const start = val[0] === '-' ? 1 : 0 + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}` + } + return `${val.slice(0, i)}${res}` +} + +// CHECK FUNCTIONS +// =============== + +function checkBounds (buf, offset, byteLength) { + validateNumber(offset, 'offset') + if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { + boundsError(offset, buf.length - (byteLength + 1)) + } +} + +function checkIntBI (value, min, max, buf, offset, byteLength) { + if (value > max || value < min) { + const n = typeof min === 'bigint' ? 'n' : '' + let range + if (byteLength > 3) { + if (min === 0 || min === BigInt(0)) { + range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` + } else { + range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + + `${(byteLength + 1) * 8 - 1}${n}` + } + } else { + range = `>= ${min}${n} and <= ${max}${n}` + } + throw new errors.ERR_OUT_OF_RANGE('value', range, value) + } + checkBounds(buf, offset, byteLength) +} + +function validateNumber (value, name) { + if (typeof value !== 'number') { + throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) + } +} + +function boundsError (value, length, type) { + if (Math.floor(value) !== value) { + validateNumber(value, type) + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) + } + + if (length < 0) { + throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() + } + + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', + `>= ${type ? 1 : 0} and <= ${length}`, + value) +} + +// HELPER FUNCTIONS +// ================ + +const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = str.trim().replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function utf8ToBytes (string, units) { + units = units || Infinity + let codePoint + const length = string.length + let leadSurrogate = null + const bytes = [] + + for (let i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + let c, hi, lo + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + let i + for (i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +// Create lookup table for `toString('hex')` +// See: https://github.com/feross/buffer/issues/219 +const hexSliceLookupTable = (function () { + const alphabet = '0123456789abcdef' + const table = new Array(256) + for (let i = 0; i < 16; ++i) { + const i16 = i * 16 + for (let j = 0; j < 16; ++j) { + table[i16 + j] = alphabet[i] + alphabet[j] + } + } + return table +})() + +// Return not function with Error if BigInt not supported +function defineBigIntMethod (fn) { + return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn +} + +function BufferBigIntNotDefined () { + throw new Error('BigInt not supported') +} + + +/***/ }), + +/***/ 6854: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AddressCoder\": function() { return /* binding */ AddressCoder; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/address */ \"./node_modules/@ethersproject/address/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n\n\n\n\nclass AddressCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(localName) {\n super(\"address\", \"address\", localName, false);\n }\n defaultValue() {\n return \"0x0000000000000000000000000000000000000000\";\n }\n encode(writer, value) {\n try {\n value = (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_1__.getAddress)(value);\n }\n catch (error) {\n this._throwError(error.message, value);\n }\n return writer.writeValue(value);\n }\n decode(reader) {\n return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_1__.getAddress)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexZeroPad)(reader.readValue().toHexString(), 20));\n }\n}\n//# sourceMappingURL=address.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/address.js?"); +Object.defineProperty(exports, "__esModule", ({value:!0})),exports.proto=exports.google=exports.com=exports.Writer=exports.Reader=void 0;var $protobuf=_interopRequireWildcard(__webpack_require__(2100)),_long=_interopRequireDefault(__webpack_require__(3720)),$proto=_interopRequireWildcard(__webpack_require__(7403));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&Object.prototype.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e.default=b,d&&d.set(b,e),e}(()=>{var a=$protobuf.util;null==a.Long&&(console.log(`Patching Protobuf Long.js instance...`),a.Long=_long.default,null!=$protobuf.Reader._configure&&$protobuf.Reader._configure($protobuf.BufferReader))})();const Reader=$protobuf.Reader;exports.Reader=Reader;const Writer=$protobuf.Writer;exports.Writer=Writer;const proto=$proto.proto;exports.proto=proto;const com=$proto.com;exports.com=com;const google=$proto.google;exports.google=google; /***/ }), -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 7403: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AnonymousCoder\": function() { return /* binding */ AnonymousCoder; }\n/* harmony export */ });\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n\n\n// Clones the functionality of an existing Coder, but without a localName\nclass AnonymousCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(coder) {\n super(coder.name, coder.type, undefined, coder.dynamic);\n this.coder = coder;\n }\n defaultValue() {\n return this.coder.defaultValue();\n }\n encode(writer, value) {\n return this.coder.encode(writer, value);\n }\n decode(reader) {\n return this.coder.decode(reader);\n }\n}\n//# sourceMappingURL=anonymous.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js?"); +var $protobuf=_interopRequireWildcard(__webpack_require__(2100));Object.defineProperty(exports, "__esModule", ({value:!0})),exports.proto=exports.google=exports["default"]=exports.com=void 0;function _getRequireWildcardCache(o){if("function"!=typeof WeakMap)return null;var n=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(o){return o?r:n})(o)}function _interopRequireWildcard(o,e){if(!e&&o&&o.__esModule)return o;if(null===o||"object"!=typeof o&&"function"!=typeof o)return{default:o};var r=_getRequireWildcardCache(e);if(r&&r.has(o))return r.get(o);var t={__proto__:null},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in o)if("default"!=d&&Object.prototype.hasOwnProperty.call(o,d)){var a=n?Object.getOwnPropertyDescriptor(o,d):null;a&&(a.get||a.set)?Object.defineProperty(t,d,a):t[d]=o[d]}return t.default=o,r&&r.set(o,t),t}const $Reader=$protobuf.Reader,$Writer=$protobuf.Writer,$util=$protobuf.util,$root=$protobuf.roots.hashgraph||($protobuf.roots.hashgraph={});exports["default"]=$root;const com=$root.com=(()=>{const e={hedera:function(){const e={mirror:function(){const e={api:function(){const e={proto:function(){const e={ConsensusTopicQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 2:{d.consensusStartTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{d.consensusEndTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{d.limit=e.uint64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/com.hedera.mirror.api.proto.ConsensusTopicQuery"},e}(),ConsensusTopicResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{d.message=e.bytes();break}case 3:{d.runningHash=e.bytes();break}case 4:{d.sequenceNumber=e.uint64();break}case 5:{d.runningHashVersion=e.uint64();break}case 6:{d.chunkInfo=$root.proto.ConsensusMessageChunkInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/com.hedera.mirror.api.proto.ConsensusTopicResponse"},e}(),ConsensusService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.subscribeTopic=function t(e,o){return this.rpcCall(t,$root.com.hedera.mirror.api.proto.ConsensusTopicQuery,$root.com.hedera.mirror.api.proto.ConsensusTopicResponse,e,o)},"name",{value:"subscribeTopic"}),e}(),AddressBookQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileId=$root.proto.FileID.decode(e,e.uint32());break}case 2:{d.limit=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/com.hedera.mirror.api.proto.AddressBookQuery"},e}(),NetworkService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.getNodes=function t(e,o){return this.rpcCall(t,$root.com.hedera.mirror.api.proto.AddressBookQuery,$root.proto.NodeAddress,e,o)},"name",{value:"getNodes"}),e}()};return e}()};return e}()};return e}(),hapi:function(){const e={node:function(){const e={addressbook:function(){const e={NodeCreateTransactionBody:function(){function e(e){if(this.gossipEndpoint=[],this.serviceEndpoint=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountId=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.description=e.string();break}case 3:{d.gossipEndpoint&&d.gossipEndpoint.length||(d.gossipEndpoint=[]),d.gossipEndpoint.push($root.proto.ServiceEndpoint.decode(e,e.uint32()));break}case 4:{d.serviceEndpoint&&d.serviceEndpoint.length||(d.serviceEndpoint=[]),d.serviceEndpoint.push($root.proto.ServiceEndpoint.decode(e,e.uint32()));break}case 5:{d.gossipCaCertificate=e.bytes();break}case 6:{d.grpcCertificateHash=e.bytes();break}case 7:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/com.hedera.hapi.node.addressbook.NodeCreateTransactionBody"},e}(),NodeUpdateTransactionBody:function(){function e(e){if(this.gossipEndpoint=[],this.serviceEndpoint=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nodeId=e.uint64();break}case 2:{d.accountId=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.description=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 4:{d.gossipEndpoint&&d.gossipEndpoint.length||(d.gossipEndpoint=[]),d.gossipEndpoint.push($root.proto.ServiceEndpoint.decode(e,e.uint32()));break}case 5:{d.serviceEndpoint&&d.serviceEndpoint.length||(d.serviceEndpoint=[]),d.serviceEndpoint.push($root.proto.ServiceEndpoint.decode(e,e.uint32()));break}case 6:{d.gossipCaCertificate=$root.google.protobuf.BytesValue.decode(e,e.uint32());break}case 7:{d.grpcCertificateHash=$root.google.protobuf.BytesValue.decode(e,e.uint32());break}case 8:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/com.hedera.hapi.node.addressbook.NodeUpdateTransactionBody"},e}(),NodeDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nodeId=e.uint64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/com.hedera.hapi.node.addressbook.NodeDeleteTransactionBody"},e}()};return e}()};return e}()};return e}()};return e}()};return e})();exports.com=com;const proto=$root.proto=(()=>{const e={TransactionList:function(){function e(e){if(this.transactionList=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transactionList&&d.transactionList.length||(d.transactionList=[]),d.transactionList.push($root.proto.Transaction.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionList"},e}(),AddressBookService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createNode=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"createNode"}),Object.defineProperty(e.prototype.deleteNode=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteNode"}),Object.defineProperty(e.prototype.updateNode=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateNode"}),e}(),Query:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.getByKey=$root.proto.GetByKeyQuery.decode(e,e.uint32());break}case 2:{d.getBySolidityID=$root.proto.GetBySolidityIDQuery.decode(e,e.uint32());break}case 3:{d.contractCallLocal=$root.proto.ContractCallLocalQuery.decode(e,e.uint32());break}case 4:{d.contractGetInfo=$root.proto.ContractGetInfoQuery.decode(e,e.uint32());break}case 5:{d.contractGetBytecode=$root.proto.ContractGetBytecodeQuery.decode(e,e.uint32());break}case 6:{d.ContractGetRecords=$root.proto.ContractGetRecordsQuery.decode(e,e.uint32());break}case 7:{d.cryptogetAccountBalance=$root.proto.CryptoGetAccountBalanceQuery.decode(e,e.uint32());break}case 8:{d.cryptoGetAccountRecords=$root.proto.CryptoGetAccountRecordsQuery.decode(e,e.uint32());break}case 9:{d.cryptoGetInfo=$root.proto.CryptoGetInfoQuery.decode(e,e.uint32());break}case 10:{d.cryptoGetLiveHash=$root.proto.CryptoGetLiveHashQuery.decode(e,e.uint32());break}case 11:{d.cryptoGetProxyStakers=$root.proto.CryptoGetStakersQuery.decode(e,e.uint32());break}case 12:{d.fileGetContents=$root.proto.FileGetContentsQuery.decode(e,e.uint32());break}case 13:{d.fileGetInfo=$root.proto.FileGetInfoQuery.decode(e,e.uint32());break}case 14:{d.transactionGetReceipt=$root.proto.TransactionGetReceiptQuery.decode(e,e.uint32());break}case 15:{d.transactionGetRecord=$root.proto.TransactionGetRecordQuery.decode(e,e.uint32());break}case 16:{d.transactionGetFastRecord=$root.proto.TransactionGetFastRecordQuery.decode(e,e.uint32());break}case 50:{d.consensusGetTopicInfo=$root.proto.ConsensusGetTopicInfoQuery.decode(e,e.uint32());break}case 51:{d.networkGetVersionInfo=$root.proto.NetworkGetVersionInfoQuery.decode(e,e.uint32());break}case 52:{d.tokenGetInfo=$root.proto.TokenGetInfoQuery.decode(e,e.uint32());break}case 53:{d.scheduleGetInfo=$root.proto.ScheduleGetInfoQuery.decode(e,e.uint32());break}case 54:{d.tokenGetAccountNftInfos=$root.proto.TokenGetAccountNftInfosQuery.decode(e,e.uint32());break}case 55:{d.tokenGetNftInfo=$root.proto.TokenGetNftInfoQuery.decode(e,e.uint32());break}case 56:{d.tokenGetNftInfos=$root.proto.TokenGetNftInfosQuery.decode(e,e.uint32());break}case 57:{d.networkGetExecutionTime=$root.proto.NetworkGetExecutionTimeQuery.decode(e,e.uint32());break}case 58:{d.accountDetails=$root.proto.GetAccountDetailsQuery.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Query"},e}(),GetByKeyQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.key=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GetByKeyQuery"},e}(),EntityID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break}case 3:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.EntityID"},e}(),GetByKeyResponse:function(){function e(e){if(this.entities=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.entities&&d.entities.length||(d.entities=[]),d.entities.push($root.proto.EntityID.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GetByKeyResponse"},e}(),ShardID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ShardID"},e}(),RealmID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}case 2:{d.realmNum=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.RealmID"},e}(),AccountID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}case 2:{d.realmNum=e.int64();break}case 3:{d.accountNum=e.int64();break}case 4:{d.alias=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.AccountID"},e}(),NftID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token_ID=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.serialNumber=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NftID"},e}(),FileID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}case 2:{d.realmNum=e.int64();break}case 3:{d.fileNum=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileID"},e}(),ContractID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}case 2:{d.realmNum=e.int64();break}case 3:{d.contractNum=e.int64();break}case 4:{d.evmAddress=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractID"},e}(),TransactionID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transactionValidStart=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.scheduled=e.bool();break}case 4:{d.nonce=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionID"},e}(),AccountAmount:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.amount=e.sint64();break}case 3:{d.isApproval=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.AccountAmount"},e}(),TransferList:function(){function e(e){if(this.accountAmounts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountAmounts&&d.accountAmounts.length||(d.accountAmounts=[]),d.accountAmounts.push($root.proto.AccountAmount.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransferList"},e}(),NftTransfer:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.senderAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.receiverAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.serialNumber=e.int64();break}case 4:{d.isApproval=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NftTransfer"},e}(),TokenTransferList:function(){function e(e){if(this.transfers=[],this.nftTransfers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.transfers&&d.transfers.length||(d.transfers=[]),d.transfers.push($root.proto.AccountAmount.decode(e,e.uint32()));break}case 3:{d.nftTransfers&&d.nftTransfers.length||(d.nftTransfers=[]),d.nftTransfers.push($root.proto.NftTransfer.decode(e,e.uint32()));break}case 4:{d.expectedDecimals=$root.google.protobuf.UInt32Value.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenTransferList"},e}(),Fraction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.numerator=e.int64();break}case 2:{d.denominator=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Fraction"},e}(),TopicID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}case 2:{d.realmNum=e.int64();break}case 3:{d.topicNum=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TopicID"},e}(),TokenID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}case 2:{d.realmNum=e.int64();break}case 3:{d.tokenNum=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenID"},e}(),ScheduleID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.shardNum=e.int64();break}case 2:{d.realmNum=e.int64();break}case 3:{d.scheduleNum=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ScheduleID"},e}(),TokenType:function(){const e={},o=Object.create(e);return o[e[0]="FUNGIBLE_COMMON"]=0,o[e[1]="NON_FUNGIBLE_UNIQUE"]=1,o}(),SubType:function(){const e={},o=Object.create(e);return o[e[0]="DEFAULT"]=0,o[e[1]="TOKEN_FUNGIBLE_COMMON"]=1,o[e[2]="TOKEN_NON_FUNGIBLE_UNIQUE"]=2,o[e[3]="TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES"]=3,o[e[4]="TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES"]=4,o[e[5]="SCHEDULE_CREATE_CONTRACT_CALL"]=5,o}(),TokenSupplyType:function(){const e={},o=Object.create(e);return o[e[0]="INFINITE"]=0,o[e[1]="FINITE"]=1,o}(),TokenKeyValidation:function(){const e={},o=Object.create(e);return o[e[0]="FULL_VALIDATION"]=0,o[e[1]="NO_VALIDATION"]=1,o}(),TokenFreezeStatus:function(){const e={},o=Object.create(e);return o[e[0]="FreezeNotApplicable"]=0,o[e[1]="Frozen"]=1,o[e[2]="Unfrozen"]=2,o}(),TokenKycStatus:function(){const e={},o=Object.create(e);return o[e[0]="KycNotApplicable"]=0,o[e[1]="Granted"]=1,o[e[2]="Revoked"]=2,o}(),TokenPauseStatus:function(){const e={},o=Object.create(e);return o[e[0]="PauseNotApplicable"]=0,o[e[1]="Paused"]=1,o[e[2]="Unpaused"]=2,o}(),Key:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.ed25519=e.bytes();break}case 3:{d.RSA_3072=e.bytes();break}case 4:{d.ECDSA_384=e.bytes();break}case 5:{d.thresholdKey=$root.proto.ThresholdKey.decode(e,e.uint32());break}case 6:{d.keyList=$root.proto.KeyList.decode(e,e.uint32());break}case 7:{d.ECDSASecp256k1=e.bytes();break}case 8:{d.delegatableContractId=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Key"},e}(),ThresholdKey:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.threshold=e.uint32();break}case 2:{d.keys=$root.proto.KeyList.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ThresholdKey"},e}(),KeyList:function(){function e(e){if(this.keys=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.keys&&d.keys.length||(d.keys=[]),d.keys.push($root.proto.Key.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.KeyList"},e}(),Signature:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contract=e.bytes();break}case 2:{d.ed25519=e.bytes();break}case 3:{d.RSA_3072=e.bytes();break}case 4:{d.ECDSA_384=e.bytes();break}case 5:{d.thresholdSignature=$root.proto.ThresholdSignature.decode(e,e.uint32());break}case 6:{d.signatureList=$root.proto.SignatureList.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Signature"},e}(),ThresholdSignature:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{d.sigs=$root.proto.SignatureList.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ThresholdSignature"},e}(),SignatureList:function(){function e(e){if(this.sigs=[],e)for(var o=Object.keys(e),t=0;t>>3){case 2:{d.sigs&&d.sigs.length||(d.sigs=[]),d.sigs.push($root.proto.Signature.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SignatureList"},e}(),SignaturePair:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.pubKeyPrefix=e.bytes();break}case 2:{d.contract=e.bytes();break}case 3:{d.ed25519=e.bytes();break}case 4:{d.RSA_3072=e.bytes();break}case 5:{d.ECDSA_384=e.bytes();break}case 6:{d.ECDSASecp256k1=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SignaturePair"},e}(),SignatureMap:function(){function e(e){if(this.sigPair=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.sigPair&&d.sigPair.length||(d.sigPair=[]),d.sigPair.push($root.proto.SignaturePair.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SignatureMap"},e}(),HederaFunctionality:function(){const e={},o=Object.create(e);return o[e[0]="NONE"]=0,o[e[1]="CryptoTransfer"]=1,o[e[2]="CryptoUpdate"]=2,o[e[3]="CryptoDelete"]=3,o[e[4]="CryptoAddLiveHash"]=4,o[e[5]="CryptoDeleteLiveHash"]=5,o[e[6]="ContractCall"]=6,o[e[7]="ContractCreate"]=7,o[e[8]="ContractUpdate"]=8,o[e[9]="FileCreate"]=9,o[e[10]="FileAppend"]=10,o[e[11]="FileUpdate"]=11,o[e[12]="FileDelete"]=12,o[e[13]="CryptoGetAccountBalance"]=13,o[e[14]="CryptoGetAccountRecords"]=14,o[e[15]="CryptoGetInfo"]=15,o[e[16]="ContractCallLocal"]=16,o[e[17]="ContractGetInfo"]=17,o[e[18]="ContractGetBytecode"]=18,o[e[19]="GetBySolidityID"]=19,o[e[20]="GetByKey"]=20,o[e[21]="CryptoGetLiveHash"]=21,o[e[22]="CryptoGetStakers"]=22,o[e[23]="FileGetContents"]=23,o[e[24]="FileGetInfo"]=24,o[e[25]="TransactionGetRecord"]=25,o[e[26]="ContractGetRecords"]=26,o[e[27]="CryptoCreate"]=27,o[e[28]="SystemDelete"]=28,o[e[29]="SystemUndelete"]=29,o[e[30]="ContractDelete"]=30,o[e[31]="Freeze"]=31,o[e[32]="CreateTransactionRecord"]=32,o[e[33]="CryptoAccountAutoRenew"]=33,o[e[34]="ContractAutoRenew"]=34,o[e[35]="GetVersionInfo"]=35,o[e[36]="TransactionGetReceipt"]=36,o[e[50]="ConsensusCreateTopic"]=50,o[e[51]="ConsensusUpdateTopic"]=51,o[e[52]="ConsensusDeleteTopic"]=52,o[e[53]="ConsensusGetTopicInfo"]=53,o[e[54]="ConsensusSubmitMessage"]=54,o[e[55]="UncheckedSubmit"]=55,o[e[56]="TokenCreate"]=56,o[e[58]="TokenGetInfo"]=58,o[e[59]="TokenFreezeAccount"]=59,o[e[60]="TokenUnfreezeAccount"]=60,o[e[61]="TokenGrantKycToAccount"]=61,o[e[62]="TokenRevokeKycFromAccount"]=62,o[e[63]="TokenDelete"]=63,o[e[64]="TokenUpdate"]=64,o[e[65]="TokenMint"]=65,o[e[66]="TokenBurn"]=66,o[e[67]="TokenAccountWipe"]=67,o[e[68]="TokenAssociateToAccount"]=68,o[e[69]="TokenDissociateFromAccount"]=69,o[e[70]="ScheduleCreate"]=70,o[e[71]="ScheduleDelete"]=71,o[e[72]="ScheduleSign"]=72,o[e[73]="ScheduleGetInfo"]=73,o[e[74]="TokenGetAccountNftInfos"]=74,o[e[75]="TokenGetNftInfo"]=75,o[e[76]="TokenGetNftInfos"]=76,o[e[77]="TokenFeeScheduleUpdate"]=77,o[e[78]="NetworkGetExecutionTime"]=78,o[e[79]="TokenPause"]=79,o[e[80]="TokenUnpause"]=80,o[e[81]="CryptoApproveAllowance"]=81,o[e[82]="CryptoDeleteAllowance"]=82,o[e[83]="GetAccountDetails"]=83,o[e[84]="EthereumTransaction"]=84,o[e[85]="NodeStakeUpdate"]=85,o[e[86]="UtilPrng"]=86,o[e[87]="TransactionGetFastRecord"]=87,o[e[88]="TokenUpdateNfts"]=88,o[e[89]="NodeCreate"]=89,o[e[90]="NodeUpdate"]=90,o[e[91]="NodeDelete"]=91,o[e[92]="TokenReject"]=92,o[e[93]="TokenAirdrop"]=93,o[e[94]="TokenCancelAirdrop"]=94,o[e[95]="TokenClaimAirdrop"]=95,o}(),FeeComponents:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.min=e.int64();break}case 2:{d.max=e.int64();break}case 3:{d.constant=e.int64();break}case 4:{d.bpt=e.int64();break}case 5:{d.vpt=e.int64();break}case 6:{d.rbh=e.int64();break}case 7:{d.sbh=e.int64();break}case 8:{d.gas=e.int64();break}case 9:{d.tv=e.int64();break}case 10:{d.bpr=e.int64();break}case 11:{d.sbpr=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FeeComponents"},e}(),TransactionFeeSchedule:function(){function e(e){if(this.fees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.hederaFunctionality=e.int32();break}case 2:{d.feeData=$root.proto.FeeData.decode(e,e.uint32());break}case 3:{d.fees&&d.fees.length||(d.fees=[]),d.fees.push($root.proto.FeeData.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionFeeSchedule"},e}(),FeeData:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nodedata=$root.proto.FeeComponents.decode(e,e.uint32());break}case 2:{d.networkdata=$root.proto.FeeComponents.decode(e,e.uint32());break}case 3:{d.servicedata=$root.proto.FeeComponents.decode(e,e.uint32());break}case 4:{d.subType=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FeeData"},e}(),FeeSchedule:function(){function e(e){if(this.transactionFeeSchedule=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transactionFeeSchedule&&d.transactionFeeSchedule.length||(d.transactionFeeSchedule=[]),d.transactionFeeSchedule.push($root.proto.TransactionFeeSchedule.decode(e,e.uint32()));break}case 2:{d.expiryTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FeeSchedule"},e}(),CurrentAndNextFeeSchedule:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.currentFeeSchedule=$root.proto.FeeSchedule.decode(e,e.uint32());break}case 2:{d.nextFeeSchedule=$root.proto.FeeSchedule.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CurrentAndNextFeeSchedule"},e}(),ServiceEndpoint:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.ipAddressV4=e.bytes();break}case 2:{d.port=e.int32();break}case 3:{d.domainName=e.string();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ServiceEndpoint"},e}(),NodeAddress:function(){function e(e){if(this.serviceEndpoint=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.ipAddress=e.bytes();break}case 2:{d.portno=e.int32();break}case 3:{d.memo=e.bytes();break}case 4:{d.RSA_PubKey=e.string();break}case 5:{d.nodeId=e.int64();break}case 6:{d.nodeAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{d.nodeCertHash=e.bytes();break}case 8:{d.serviceEndpoint&&d.serviceEndpoint.length||(d.serviceEndpoint=[]),d.serviceEndpoint.push($root.proto.ServiceEndpoint.decode(e,e.uint32()));break}case 9:{d.description=e.string();break}case 10:{d.stake=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NodeAddress"},e}(),NodeAddressBook:function(){function e(e){if(this.nodeAddress=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nodeAddress&&d.nodeAddress.length||(d.nodeAddress=[]),d.nodeAddress.push($root.proto.NodeAddress.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NodeAddressBook"},e}(),SemanticVersion:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.major=e.int32();break}case 2:{d.minor=e.int32();break}case 3:{d.patch=e.int32();break}case 4:{d.pre=e.string();break}case 5:{d.build=e.string();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SemanticVersion"},e}(),Setting:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.name=e.string();break}case 2:{d.value=e.string();break}case 3:{d.data=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Setting"},e}(),ServicesConfigurationList:function(){function e(e){if(this.nameValue=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nameValue&&d.nameValue.length||(d.nameValue=[]),d.nameValue.push($root.proto.Setting.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ServicesConfigurationList"},e}(),TokenRelationship:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.symbol=e.string();break}case 3:{d.balance=e.uint64();break}case 4:{d.kycStatus=e.int32();break}case 5:{d.freezeStatus=e.int32();break}case 6:{d.decimals=e.uint32();break}case 7:{d.automaticAssociation=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenRelationship"},e}(),TokenBalance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.balance=e.uint64();break}case 3:{d.decimals=e.uint32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenBalance"},e}(),TokenBalances:function(){function e(e){if(this.tokenBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenBalances&&d.tokenBalances.length||(d.tokenBalances=[]),d.tokenBalances.push($root.proto.TokenBalance.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenBalances"},e}(),TokenAssociation:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.accountId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenAssociation"},e}(),StakingInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.declineReward=e.bool();break}case 2:{d.stakePeriodStart=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{d.pendingReward=e.int64();break}case 4:{d.stakedToMe=e.int64();break}case 5:{d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{d.stakedNodeId=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.StakingInfo"},e}(),PendingAirdropId:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.senderId=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.receiverId=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.fungibleTokenType=$root.proto.TokenID.decode(e,e.uint32());break}case 4:{d.nonFungibleToken=$root.proto.NftID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.PendingAirdropId"},e}(),PendingAirdropValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.amount=e.uint64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.PendingAirdropValue"},e}(),Timestamp:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.seconds=e.int64();break}case 2:{d.nanos=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Timestamp"},e}(),TimestampSeconds:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.seconds=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TimestampSeconds"},e}(),ResponseType:function(){const e={},o=Object.create(e);return o[e[0]="ANSWER_ONLY"]=0,o[e[1]="ANSWER_STATE_PROOF"]=1,o[e[2]="COST_ANSWER"]=2,o[e[3]="COST_ANSWER_STATE_PROOF"]=3,o}(),QueryHeader:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.payment=$root.proto.Transaction.decode(e,e.uint32());break}case 2:{d.responseType=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.QueryHeader"},e}(),Transaction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.body=$root.proto.TransactionBody.decode(e,e.uint32());break}case 2:{d.sigs=$root.proto.SignatureList.decode(e,e.uint32());break}case 3:{d.sigMap=$root.proto.SignatureMap.decode(e,e.uint32());break}case 4:{d.bodyBytes=e.bytes();break}case 5:{d.signedTransactionBytes=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Transaction"},e}(),TransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 2:{d.nodeAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.transactionFee=e.uint64();break}case 4:{d.transactionValidDuration=$root.proto.Duration.decode(e,e.uint32());break}case 5:{d.generateRecord=e.bool();break}case 6:{d.memo=e.string();break}case 7:{d.contractCall=$root.proto.ContractCallTransactionBody.decode(e,e.uint32());break}case 8:{d.contractCreateInstance=$root.proto.ContractCreateTransactionBody.decode(e,e.uint32());break}case 9:{d.contractUpdateInstance=$root.proto.ContractUpdateTransactionBody.decode(e,e.uint32());break}case 10:{d.cryptoAddLiveHash=$root.proto.CryptoAddLiveHashTransactionBody.decode(e,e.uint32());break}case 11:{d.cryptoCreateAccount=$root.proto.CryptoCreateTransactionBody.decode(e,e.uint32());break}case 12:{d.cryptoDelete=$root.proto.CryptoDeleteTransactionBody.decode(e,e.uint32());break}case 13:{d.cryptoDeleteLiveHash=$root.proto.CryptoDeleteLiveHashTransactionBody.decode(e,e.uint32());break}case 14:{d.cryptoTransfer=$root.proto.CryptoTransferTransactionBody.decode(e,e.uint32());break}case 15:{d.cryptoUpdateAccount=$root.proto.CryptoUpdateTransactionBody.decode(e,e.uint32());break}case 16:{d.fileAppend=$root.proto.FileAppendTransactionBody.decode(e,e.uint32());break}case 17:{d.fileCreate=$root.proto.FileCreateTransactionBody.decode(e,e.uint32());break}case 18:{d.fileDelete=$root.proto.FileDeleteTransactionBody.decode(e,e.uint32());break}case 19:{d.fileUpdate=$root.proto.FileUpdateTransactionBody.decode(e,e.uint32());break}case 20:{d.systemDelete=$root.proto.SystemDeleteTransactionBody.decode(e,e.uint32());break}case 21:{d.systemUndelete=$root.proto.SystemUndeleteTransactionBody.decode(e,e.uint32());break}case 22:{d.contractDeleteInstance=$root.proto.ContractDeleteTransactionBody.decode(e,e.uint32());break}case 23:{d.freeze=$root.proto.FreezeTransactionBody.decode(e,e.uint32());break}case 24:{d.consensusCreateTopic=$root.proto.ConsensusCreateTopicTransactionBody.decode(e,e.uint32());break}case 25:{d.consensusUpdateTopic=$root.proto.ConsensusUpdateTopicTransactionBody.decode(e,e.uint32());break}case 26:{d.consensusDeleteTopic=$root.proto.ConsensusDeleteTopicTransactionBody.decode(e,e.uint32());break}case 27:{d.consensusSubmitMessage=$root.proto.ConsensusSubmitMessageTransactionBody.decode(e,e.uint32());break}case 28:{d.uncheckedSubmit=$root.proto.UncheckedSubmitBody.decode(e,e.uint32());break}case 29:{d.tokenCreation=$root.proto.TokenCreateTransactionBody.decode(e,e.uint32());break}case 31:{d.tokenFreeze=$root.proto.TokenFreezeAccountTransactionBody.decode(e,e.uint32());break}case 32:{d.tokenUnfreeze=$root.proto.TokenUnfreezeAccountTransactionBody.decode(e,e.uint32());break}case 33:{d.tokenGrantKyc=$root.proto.TokenGrantKycTransactionBody.decode(e,e.uint32());break}case 34:{d.tokenRevokeKyc=$root.proto.TokenRevokeKycTransactionBody.decode(e,e.uint32());break}case 35:{d.tokenDeletion=$root.proto.TokenDeleteTransactionBody.decode(e,e.uint32());break}case 36:{d.tokenUpdate=$root.proto.TokenUpdateTransactionBody.decode(e,e.uint32());break}case 37:{d.tokenMint=$root.proto.TokenMintTransactionBody.decode(e,e.uint32());break}case 38:{d.tokenBurn=$root.proto.TokenBurnTransactionBody.decode(e,e.uint32());break}case 39:{d.tokenWipe=$root.proto.TokenWipeAccountTransactionBody.decode(e,e.uint32());break}case 40:{d.tokenAssociate=$root.proto.TokenAssociateTransactionBody.decode(e,e.uint32());break}case 41:{d.tokenDissociate=$root.proto.TokenDissociateTransactionBody.decode(e,e.uint32());break}case 42:{d.scheduleCreate=$root.proto.ScheduleCreateTransactionBody.decode(e,e.uint32());break}case 43:{d.scheduleDelete=$root.proto.ScheduleDeleteTransactionBody.decode(e,e.uint32());break}case 44:{d.scheduleSign=$root.proto.ScheduleSignTransactionBody.decode(e,e.uint32());break}case 45:{d.tokenFeeScheduleUpdate=$root.proto.TokenFeeScheduleUpdateTransactionBody.decode(e,e.uint32());break}case 46:{d.tokenPause=$root.proto.TokenPauseTransactionBody.decode(e,e.uint32());break}case 47:{d.tokenUnpause=$root.proto.TokenUnpauseTransactionBody.decode(e,e.uint32());break}case 48:{d.cryptoApproveAllowance=$root.proto.CryptoApproveAllowanceTransactionBody.decode(e,e.uint32());break}case 49:{d.cryptoDeleteAllowance=$root.proto.CryptoDeleteAllowanceTransactionBody.decode(e,e.uint32());break}case 50:{d.ethereumTransaction=$root.proto.EthereumTransactionBody.decode(e,e.uint32());break}case 51:{d.nodeStakeUpdate=$root.proto.NodeStakeUpdateTransactionBody.decode(e,e.uint32());break}case 52:{d.utilPrng=$root.proto.UtilPrngTransactionBody.decode(e,e.uint32());break}case 53:{d.tokenUpdateNfts=$root.proto.TokenUpdateNftsTransactionBody.decode(e,e.uint32());break}case 54:{d.nodeCreate=$root.com.hedera.hapi.node.addressbook.NodeCreateTransactionBody.decode(e,e.uint32());break}case 55:{d.nodeUpdate=$root.com.hedera.hapi.node.addressbook.NodeUpdateTransactionBody.decode(e,e.uint32());break}case 56:{d.nodeDelete=$root.com.hedera.hapi.node.addressbook.NodeDeleteTransactionBody.decode(e,e.uint32());break}case 57:{d.tokenReject=$root.proto.TokenRejectTransactionBody.decode(e,e.uint32());break}case 58:{d.tokenAirdrop=$root.proto.TokenAirdropTransactionBody.decode(e,e.uint32());break}case 59:{d.tokenCancelAirdrop=$root.proto.TokenCancelAirdropTransactionBody.decode(e,e.uint32());break}case 60:{d.tokenClaimAirdrop=$root.proto.TokenClaimAirdropTransactionBody.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionBody"},e}(),SystemDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 3:{d.expirationTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SystemDeleteTransactionBody"},e}(),SystemUndeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SystemUndeleteTransactionBody"},e}(),FreezeTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.startHour=e.int32();break}case 2:{d.startMin=e.int32();break}case 3:{d.endHour=e.int32();break}case 4:{d.endMin=e.int32();break}case 5:{d.updateFile=$root.proto.FileID.decode(e,e.uint32());break}case 6:{d.fileHash=e.bytes();break}case 7:{d.startTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 8:{d.freezeType=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FreezeTransactionBody"},e}(),FreezeType:function(){const e={},o=Object.create(e);return o[e[0]="UNKNOWN_FREEZE_TYPE"]=0,o[e[1]="FREEZE_ONLY"]=1,o[e[2]="PREPARE_UPGRADE"]=2,o[e[3]="FREEZE_UPGRADE"]=3,o[e[4]="FREEZE_ABORT"]=4,o[e[5]="TELEMETRY_UPGRADE"]=5,o}(),ContractCallTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.gas=e.int64();break}case 3:{d.amount=e.int64();break}case 4:{d.functionParameters=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractCallTransactionBody"},e}(),ContractCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 16:{d.initcode=e.bytes();break}case 3:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 4:{d.gas=e.int64();break}case 5:{d.initialBalance=e.int64();break}case 6:{d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 8:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 9:{d.constructorParameters=e.bytes();break}case 10:{d.shardID=$root.proto.ShardID.decode(e,e.uint32());break}case 11:{d.realmID=$root.proto.RealmID.decode(e,e.uint32());break}case 12:{d.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break}case 13:{d.memo=e.string();break}case 14:{d.maxAutomaticTokenAssociations=e.int32();break}case 15:{d.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 17:{d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 18:{d.stakedNodeId=e.int64();break}case 19:{d.declineReward=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractCreateTransactionBody"},e}(),Duration:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.seconds=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Duration"},e}(),ContractUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 8:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 9:{d.memo=e.string();break}case 10:{d.memoWrapper=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 11:{d.maxAutomaticTokenAssociations=$root.google.protobuf.Int32Value.decode(e,e.uint32());break}case 12:{d.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 13:{d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 14:{d.stakedNodeId=e.int64();break}case 15:{d.declineReward=$root.google.protobuf.BoolValue.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractUpdateTransactionBody"},e}(),LiveHash:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountId=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.hash=e.bytes();break}case 3:{d.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 5:{d.duration=$root.proto.Duration.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.LiveHash"},e}(),CryptoAddLiveHashTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 3:{d.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoAddLiveHashTransactionBody"},e}(),CryptoCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.key=$root.proto.Key.decode(e,e.uint32());break}case 2:{d.initialBalance=e.uint64();break}case 3:{d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{d.sendRecordThreshold=e.uint64();break}case 7:{d.receiveRecordThreshold=e.uint64();break}case 8:{d.receiverSigRequired=e.bool();break}case 9:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 10:{d.shardID=$root.proto.ShardID.decode(e,e.uint32());break}case 11:{d.realmID=$root.proto.RealmID.decode(e,e.uint32());break}case 12:{d.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break}case 13:{d.memo=e.string();break}case 14:{d.maxAutomaticTokenAssociations=e.int32();break}case 15:{d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 16:{d.stakedNodeId=e.int64();break}case 17:{d.declineReward=e.bool();break}case 18:{d.alias=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoCreateTransactionBody"},e}(),CryptoDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transferAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.deleteAccountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoDeleteTransactionBody"},e}(),CryptoDeleteLiveHashTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountOfLiveHash=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.liveHashToDelete=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoDeleteLiveHashTransactionBody"},e}(),CryptoTransferTransactionBody:function(){function e(e){if(this.tokenTransfers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transfers=$root.proto.TransferList.decode(e,e.uint32());break}case 2:{d.tokenTransfers&&d.tokenTransfers.length||(d.tokenTransfers=[]),d.tokenTransfers.push($root.proto.TokenTransferList.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoTransferTransactionBody"},e}(),CryptoUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{d.accountIDToUpdate=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.key=$root.proto.Key.decode(e,e.uint32());break}case 4:{d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{d.proxyFraction=e.int32();break}case 6:{d.sendRecordThreshold=e.uint64();break}case 11:{d.sendRecordThresholdWrapper=$root.google.protobuf.UInt64Value.decode(e,e.uint32());break}case 7:{d.receiveRecordThreshold=e.uint64();break}case 12:{d.receiveRecordThresholdWrapper=$root.google.protobuf.UInt64Value.decode(e,e.uint32());break}case 8:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 9:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 10:{d.receiverSigRequired=e.bool();break}case 13:{d.receiverSigRequiredWrapper=$root.google.protobuf.BoolValue.decode(e,e.uint32());break}case 14:{d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 15:{d.maxAutomaticTokenAssociations=$root.google.protobuf.Int32Value.decode(e,e.uint32());break}case 16:{d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 17:{d.stakedNodeId=e.int64();break}case 18:{d.declineReward=$root.google.protobuf.BoolValue.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoUpdateTransactionBody"},e}(),CryptoApproveAllowanceTransactionBody:function(){function e(e){if(this.cryptoAllowances=[],this.nftAllowances=[],this.tokenAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.cryptoAllowances&&d.cryptoAllowances.length||(d.cryptoAllowances=[]),d.cryptoAllowances.push($root.proto.CryptoAllowance.decode(e,e.uint32()));break}case 2:{d.nftAllowances&&d.nftAllowances.length||(d.nftAllowances=[]),d.nftAllowances.push($root.proto.NftAllowance.decode(e,e.uint32()));break}case 3:{d.tokenAllowances&&d.tokenAllowances.length||(d.tokenAllowances=[]),d.tokenAllowances.push($root.proto.TokenAllowance.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoApproveAllowanceTransactionBody"},e}(),CryptoAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.amount=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoAllowance"},e}(),NftAllowance:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 4:{if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 4:{d.amount=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenAllowance"},e}(),CryptoDeleteAllowanceTransactionBody:function(){function e(e){if(this.nftAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 2:{d.nftAllowances&&d.nftAllowances.length||(d.nftAllowances=[]),d.nftAllowances.push($root.proto.NftRemoveAllowance.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoDeleteAllowanceTransactionBody"},e}(),NftRemoveAllowance:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.ethereumData=e.bytes();break}case 2:{d.callData=$root.proto.FileID.decode(e,e.uint32());break}case 3:{d.maxGasAllowance=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.EthereumTransactionBody"},e}(),FileAppendTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{d.contents=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileAppendTransactionBody"},e}(),FileCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{d.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 4:{d.contents=e.bytes();break}case 5:{d.shardID=$root.proto.ShardID.decode(e,e.uint32());break}case 6:{d.realmID=$root.proto.RealmID.decode(e,e.uint32());break}case 7:{d.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{d.memo=e.string();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileCreateTransactionBody"},e}(),FileDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileDeleteTransactionBody"},e}(),FileUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{d.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 4:{d.contents=e.bytes();break}case 5:{d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileUpdateTransactionBody"},e}(),ContractDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.transferAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.transferContractID=$root.proto.ContractID.decode(e,e.uint32());break}case 4:{d.permanentRemoval=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractDeleteTransactionBody"},e}(),ConsensusCreateTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.memo=e.string();break}case 2:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 3:{d.submitKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 7:{d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusCreateTopicTransactionBody"},e}(),ConsensusUpdateTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 2:{d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 4:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 6:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{d.submitKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 9:{d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusUpdateTopicTransactionBody"},e}(),ConsensusDeleteTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.topicID=$root.proto.TopicID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusDeleteTopicTransactionBody"},e}(),ConsensusMessageChunkInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.initialTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 2:{d.total=e.int32();break}case 3:{d.number=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusMessageChunkInfo"},e}(),ConsensusSubmitMessageTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 2:{d.message=e.bytes();break}case 3:{d.chunkInfo=$root.proto.ConsensusMessageChunkInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusSubmitMessageTransactionBody"},e}(),UncheckedSubmitBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transactionBytes=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.UncheckedSubmitBody"},e}(),TokenCreateTransactionBody:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.name=e.string();break}case 2:{d.symbol=e.string();break}case 3:{d.decimals=e.uint32();break}case 4:{d.initialSupply=e.uint64();break}case 5:{d.treasury=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{d.kycKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{d.freezeKey=$root.proto.Key.decode(e,e.uint32());break}case 9:{d.wipeKey=$root.proto.Key.decode(e,e.uint32());break}case 10:{d.supplyKey=$root.proto.Key.decode(e,e.uint32());break}case 11:{d.freezeDefault=e.bool();break}case 13:{d.expiry=$root.proto.Timestamp.decode(e,e.uint32());break}case 14:{d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 15:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 16:{d.memo=e.string();break}case 17:{d.tokenType=e.int32();break}case 18:{d.supplyType=e.int32();break}case 19:{d.maxSupply=e.int64();break}case 20:{d.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break}case 21:{d.customFees&&d.customFees.length||(d.customFees=[]),d.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break}case 22:{d.pauseKey=$root.proto.Key.decode(e,e.uint32());break}case 23:{d.metadata=e.bytes();break}case 24:{d.metadataKey=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenCreateTransactionBody"},e}(),FractionalFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fractionalAmount=$root.proto.Fraction.decode(e,e.uint32());break}case 2:{d.minimumAmount=e.int64();break}case 3:{d.maximumAmount=e.int64();break}case 4:{d.netOfTransfers=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FractionalFee"},e}(),FixedFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.amount=e.int64();break}case 2:{d.denominatingTokenId=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FixedFee"},e}(),RoyaltyFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.exchangeValueFraction=$root.proto.Fraction.decode(e,e.uint32());break}case 2:{d.fallbackFee=$root.proto.FixedFee.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.RoyaltyFee"},e}(),CustomFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fixedFee=$root.proto.FixedFee.decode(e,e.uint32());break}case 2:{d.fractionalFee=$root.proto.FractionalFee.decode(e,e.uint32());break}case 4:{d.royaltyFee=$root.proto.RoyaltyFee.decode(e,e.uint32());break}case 3:{d.feeCollectorAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{d.allCollectorsAreExempt=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CustomFee"},e}(),AssessedCustomFee:function(){function e(e){if(this.effectivePayerAccountId=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.amount=e.int64();break}case 2:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 3:{d.feeCollectorAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 4:{d.effectivePayerAccountId&&d.effectivePayerAccountId.length||(d.effectivePayerAccountId=[]),d.effectivePayerAccountId.push($root.proto.AccountID.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.AssessedCustomFee"},e}(),TokenFreezeAccountTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenFreezeAccountTransactionBody"},e}(),TokenUnfreezeAccountTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenUnfreezeAccountTransactionBody"},e}(),TokenGrantKycTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGrantKycTransactionBody"},e}(),TokenRevokeKycTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenRevokeKycTransactionBody"},e}(),TokenDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenDeleteTransactionBody"},e}(),TokenUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.symbol=e.string();break}case 3:{d.name=e.string();break}case 4:{d.treasury=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{d.kycKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{d.freezeKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{d.wipeKey=$root.proto.Key.decode(e,e.uint32());break}case 9:{d.supplyKey=$root.proto.Key.decode(e,e.uint32());break}case 10:{d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 11:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 12:{d.expiry=$root.proto.Timestamp.decode(e,e.uint32());break}case 13:{d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 14:{d.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break}case 15:{d.pauseKey=$root.proto.Key.decode(e,e.uint32());break}case 16:{d.metadata=$root.google.protobuf.BytesValue.decode(e,e.uint32());break}case 17:{d.metadataKey=$root.proto.Key.decode(e,e.uint32());break}case 18:{d.keyVerificationMode=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenUpdateTransactionBody"},e}(),TokenMintTransactionBody:function(){function e(e){if(this.metadata=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.amount=e.uint64();break}case 3:{d.metadata&&d.metadata.length||(d.metadata=[]),d.metadata.push(e.bytes());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenMintTransactionBody"},e}(),TokenBurnTransactionBody:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.amount=e.uint64();break}case 3:{if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.account=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.amount=e.uint64();break}case 4:{if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.account=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.tokens&&d.tokens.length||(d.tokens=[]),d.tokens.push($root.proto.TokenID.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenAssociateTransactionBody"},e}(),TokenDissociateTransactionBody:function(){function e(e){if(this.tokens=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.account=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.tokens&&d.tokens.length||(d.tokens=[]),d.tokens.push($root.proto.TokenID.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenDissociateTransactionBody"},e}(),TokenFeeScheduleUpdateTransactionBody:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.customFees&&d.customFees.length||(d.customFees=[]),d.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenFeeScheduleUpdateTransactionBody"},e}(),TokenPauseTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenPauseTransactionBody"},e}(),TokenUnpauseTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenUnpauseTransactionBody"},e}(),TokenUpdateNftsTransactionBody:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.rejections&&d.rejections.length||(d.rejections=[]),d.rejections.push($root.proto.TokenReference.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenRejectTransactionBody"},e}(),TokenReference:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fungibleToken=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.nft=$root.proto.NftID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenReference"},e}(),TokenAirdropTransactionBody:function(){function e(e){if(this.tokenTransfers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenTransfers&&d.tokenTransfers.length||(d.tokenTransfers=[]),d.tokenTransfers.push($root.proto.TokenTransferList.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenAirdropTransactionBody"},e}(),TokenCancelAirdropTransactionBody:function(){function e(e){if(this.pendingAirdrops=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.pendingAirdrops&&d.pendingAirdrops.length||(d.pendingAirdrops=[]),d.pendingAirdrops.push($root.proto.PendingAirdropId.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenCancelAirdropTransactionBody"},e}(),TokenClaimAirdropTransactionBody:function(){function e(e){if(this.pendingAirdrops=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.pendingAirdrops&&d.pendingAirdrops.length||(d.pendingAirdrops=[]),d.pendingAirdrops.push($root.proto.PendingAirdropId.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenClaimAirdropTransactionBody"},e}(),ScheduleCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.scheduledTransactionBody=$root.proto.SchedulableTransactionBody.decode(e,e.uint32());break}case 2:{d.memo=e.string();break}case 3:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 4:{d.payerAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 13:{d.waitForExpiry=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ScheduleCreateTransactionBody"},e}(),SchedulableTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transactionFee=e.uint64();break}case 2:{d.memo=e.string();break}case 3:{d.contractCall=$root.proto.ContractCallTransactionBody.decode(e,e.uint32());break}case 4:{d.contractCreateInstance=$root.proto.ContractCreateTransactionBody.decode(e,e.uint32());break}case 5:{d.contractUpdateInstance=$root.proto.ContractUpdateTransactionBody.decode(e,e.uint32());break}case 6:{d.contractDeleteInstance=$root.proto.ContractDeleteTransactionBody.decode(e,e.uint32());break}case 37:{d.cryptoApproveAllowance=$root.proto.CryptoApproveAllowanceTransactionBody.decode(e,e.uint32());break}case 38:{d.cryptoDeleteAllowance=$root.proto.CryptoDeleteAllowanceTransactionBody.decode(e,e.uint32());break}case 7:{d.cryptoCreateAccount=$root.proto.CryptoCreateTransactionBody.decode(e,e.uint32());break}case 8:{d.cryptoDelete=$root.proto.CryptoDeleteTransactionBody.decode(e,e.uint32());break}case 9:{d.cryptoTransfer=$root.proto.CryptoTransferTransactionBody.decode(e,e.uint32());break}case 10:{d.cryptoUpdateAccount=$root.proto.CryptoUpdateTransactionBody.decode(e,e.uint32());break}case 11:{d.fileAppend=$root.proto.FileAppendTransactionBody.decode(e,e.uint32());break}case 12:{d.fileCreate=$root.proto.FileCreateTransactionBody.decode(e,e.uint32());break}case 13:{d.fileDelete=$root.proto.FileDeleteTransactionBody.decode(e,e.uint32());break}case 14:{d.fileUpdate=$root.proto.FileUpdateTransactionBody.decode(e,e.uint32());break}case 15:{d.systemDelete=$root.proto.SystemDeleteTransactionBody.decode(e,e.uint32());break}case 16:{d.systemUndelete=$root.proto.SystemUndeleteTransactionBody.decode(e,e.uint32());break}case 17:{d.freeze=$root.proto.FreezeTransactionBody.decode(e,e.uint32());break}case 18:{d.consensusCreateTopic=$root.proto.ConsensusCreateTopicTransactionBody.decode(e,e.uint32());break}case 19:{d.consensusUpdateTopic=$root.proto.ConsensusUpdateTopicTransactionBody.decode(e,e.uint32());break}case 20:{d.consensusDeleteTopic=$root.proto.ConsensusDeleteTopicTransactionBody.decode(e,e.uint32());break}case 21:{d.consensusSubmitMessage=$root.proto.ConsensusSubmitMessageTransactionBody.decode(e,e.uint32());break}case 22:{d.tokenCreation=$root.proto.TokenCreateTransactionBody.decode(e,e.uint32());break}case 23:{d.tokenFreeze=$root.proto.TokenFreezeAccountTransactionBody.decode(e,e.uint32());break}case 24:{d.tokenUnfreeze=$root.proto.TokenUnfreezeAccountTransactionBody.decode(e,e.uint32());break}case 25:{d.tokenGrantKyc=$root.proto.TokenGrantKycTransactionBody.decode(e,e.uint32());break}case 26:{d.tokenRevokeKyc=$root.proto.TokenRevokeKycTransactionBody.decode(e,e.uint32());break}case 27:{d.tokenDeletion=$root.proto.TokenDeleteTransactionBody.decode(e,e.uint32());break}case 28:{d.tokenUpdate=$root.proto.TokenUpdateTransactionBody.decode(e,e.uint32());break}case 29:{d.tokenMint=$root.proto.TokenMintTransactionBody.decode(e,e.uint32());break}case 30:{d.tokenBurn=$root.proto.TokenBurnTransactionBody.decode(e,e.uint32());break}case 31:{d.tokenWipe=$root.proto.TokenWipeAccountTransactionBody.decode(e,e.uint32());break}case 32:{d.tokenAssociate=$root.proto.TokenAssociateTransactionBody.decode(e,e.uint32());break}case 33:{d.tokenDissociate=$root.proto.TokenDissociateTransactionBody.decode(e,e.uint32());break}case 39:{d.tokenFeeScheduleUpdate=$root.proto.TokenFeeScheduleUpdateTransactionBody.decode(e,e.uint32());break}case 35:{d.tokenPause=$root.proto.TokenPauseTransactionBody.decode(e,e.uint32());break}case 36:{d.tokenUnpause=$root.proto.TokenUnpauseTransactionBody.decode(e,e.uint32());break}case 34:{d.scheduleDelete=$root.proto.ScheduleDeleteTransactionBody.decode(e,e.uint32());break}case 40:{d.utilPrng=$root.proto.UtilPrngTransactionBody.decode(e,e.uint32());break}case 41:{d.tokenUpdateNfts=$root.proto.TokenUpdateNftsTransactionBody.decode(e,e.uint32());break}case 42:{d.nodeCreate=$root.com.hedera.hapi.node.addressbook.NodeCreateTransactionBody.decode(e,e.uint32());break}case 43:{d.nodeUpdate=$root.com.hedera.hapi.node.addressbook.NodeUpdateTransactionBody.decode(e,e.uint32());break}case 44:{d.nodeDelete=$root.com.hedera.hapi.node.addressbook.NodeDeleteTransactionBody.decode(e,e.uint32());break}case 45:{d.tokenReject=$root.proto.TokenRejectTransactionBody.decode(e,e.uint32());break}case 46:{d.tokenCancelAirdrop=$root.proto.TokenCancelAirdropTransactionBody.decode(e,e.uint32());break}case 47:{d.tokenClaimAirdrop=$root.proto.TokenClaimAirdropTransactionBody.decode(e,e.uint32());break}case 48:{d.tokenAirdrop=$root.proto.TokenAirdropTransactionBody.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SchedulableTransactionBody"},e}(),ScheduleDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ScheduleDeleteTransactionBody"},e}(),UtilPrngTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.range=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.UtilPrngTransactionBody"},e}(),ScheduleSignTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ScheduleSignTransactionBody"},e}(),NodeStakeUpdateTransactionBody:function(){function e(e){if(this.nodeStake=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.endOfStakingPeriod=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{d.nodeStake&&d.nodeStake.length||(d.nodeStake=[]),d.nodeStake.push($root.proto.NodeStake.decode(e,e.uint32()));break}case 3:{d.maxStakingRewardRatePerHbar=e.int64();break}case 4:{d.nodeRewardFeeFraction=$root.proto.Fraction.decode(e,e.uint32());break}case 5:{d.stakingPeriodsStored=e.int64();break}case 6:{d.stakingPeriod=e.int64();break}case 7:{d.stakingRewardFeeFraction=$root.proto.Fraction.decode(e,e.uint32());break}case 8:{d.stakingStartThreshold=e.int64();break}case 9:{d.stakingRewardRate=e.int64();break}case 10:{d.reservedStakingRewards=e.int64();break}case 11:{d.unreservedStakingRewardBalance=e.int64();break}case 12:{d.rewardBalanceThreshold=e.int64();break}case 13:{d.maxStakeRewarded=e.int64();break}case 14:{d.maxTotalReward=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NodeStakeUpdateTransactionBody"},e}(),NodeStake:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.maxStake=e.int64();break}case 2:{d.minStake=e.int64();break}case 3:{d.nodeId=e.int64();break}case 4:{d.rewardRate=e.int64();break}case 5:{d.stake=e.int64();break}case 6:{d.stakeNotRewarded=e.int64();break}case 7:{d.stakeRewarded=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NodeStake"},e}(),ResponseHeader:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nodeTransactionPrecheckCode=e.int32();break}case 2:{d.responseType=e.int32();break}case 3:{d.cost=e.uint64();break}case 4:{d.stateProof=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ResponseHeader"},e}(),ResponseCodeEnum:function(){const e={},o=Object.create(e);return o[e[0]="OK"]=0,o[e[1]="INVALID_TRANSACTION"]=1,o[e[2]="PAYER_ACCOUNT_NOT_FOUND"]=2,o[e[3]="INVALID_NODE_ACCOUNT"]=3,o[e[4]="TRANSACTION_EXPIRED"]=4,o[e[5]="INVALID_TRANSACTION_START"]=5,o[e[6]="INVALID_TRANSACTION_DURATION"]=6,o[e[7]="INVALID_SIGNATURE"]=7,o[e[8]="MEMO_TOO_LONG"]=8,o[e[9]="INSUFFICIENT_TX_FEE"]=9,o[e[10]="INSUFFICIENT_PAYER_BALANCE"]=10,o[e[11]="DUPLICATE_TRANSACTION"]=11,o[e[12]="BUSY"]=12,o[e[13]="NOT_SUPPORTED"]=13,o[e[14]="INVALID_FILE_ID"]=14,o[e[15]="INVALID_ACCOUNT_ID"]=15,o[e[16]="INVALID_CONTRACT_ID"]=16,o[e[17]="INVALID_TRANSACTION_ID"]=17,o[e[18]="RECEIPT_NOT_FOUND"]=18,o[e[19]="RECORD_NOT_FOUND"]=19,o[e[20]="INVALID_SOLIDITY_ID"]=20,o[e[21]="UNKNOWN"]=21,o[e[22]="SUCCESS"]=22,o[e[23]="FAIL_INVALID"]=23,o[e[24]="FAIL_FEE"]=24,o[e[25]="FAIL_BALANCE"]=25,o[e[26]="KEY_REQUIRED"]=26,o[e[27]="BAD_ENCODING"]=27,o[e[28]="INSUFFICIENT_ACCOUNT_BALANCE"]=28,o[e[29]="INVALID_SOLIDITY_ADDRESS"]=29,o[e[30]="INSUFFICIENT_GAS"]=30,o[e[31]="CONTRACT_SIZE_LIMIT_EXCEEDED"]=31,o[e[32]="LOCAL_CALL_MODIFICATION_EXCEPTION"]=32,o[e[33]="CONTRACT_REVERT_EXECUTED"]=33,o[e[34]="CONTRACT_EXECUTION_EXCEPTION"]=34,o[e[35]="INVALID_RECEIVING_NODE_ACCOUNT"]=35,o[e[36]="MISSING_QUERY_HEADER"]=36,o[e[37]="ACCOUNT_UPDATE_FAILED"]=37,o[e[38]="INVALID_KEY_ENCODING"]=38,o[e[39]="NULL_SOLIDITY_ADDRESS"]=39,o[e[40]="CONTRACT_UPDATE_FAILED"]=40,o[e[41]="INVALID_QUERY_HEADER"]=41,o[e[42]="INVALID_FEE_SUBMITTED"]=42,o[e[43]="INVALID_PAYER_SIGNATURE"]=43,o[e[44]="KEY_NOT_PROVIDED"]=44,o[e[45]="INVALID_EXPIRATION_TIME"]=45,o[e[46]="NO_WACL_KEY"]=46,o[e[47]="FILE_CONTENT_EMPTY"]=47,o[e[48]="INVALID_ACCOUNT_AMOUNTS"]=48,o[e[49]="EMPTY_TRANSACTION_BODY"]=49,o[e[50]="INVALID_TRANSACTION_BODY"]=50,o[e[51]="INVALID_SIGNATURE_TYPE_MISMATCHING_KEY"]=51,o[e[52]="INVALID_SIGNATURE_COUNT_MISMATCHING_KEY"]=52,o[e[53]="EMPTY_LIVE_HASH_BODY"]=53,o[e[54]="EMPTY_LIVE_HASH"]=54,o[e[55]="EMPTY_LIVE_HASH_KEYS"]=55,o[e[56]="INVALID_LIVE_HASH_SIZE"]=56,o[e[57]="EMPTY_QUERY_BODY"]=57,o[e[58]="EMPTY_LIVE_HASH_QUERY"]=58,o[e[59]="LIVE_HASH_NOT_FOUND"]=59,o[e[60]="ACCOUNT_ID_DOES_NOT_EXIST"]=60,o[e[61]="LIVE_HASH_ALREADY_EXISTS"]=61,o[e[62]="INVALID_FILE_WACL"]=62,o[e[63]="SERIALIZATION_FAILED"]=63,o[e[64]="TRANSACTION_OVERSIZE"]=64,o[e[65]="TRANSACTION_TOO_MANY_LAYERS"]=65,o[e[66]="CONTRACT_DELETED"]=66,o[e[67]="PLATFORM_NOT_ACTIVE"]=67,o[e[68]="KEY_PREFIX_MISMATCH"]=68,o[e[69]="PLATFORM_TRANSACTION_NOT_CREATED"]=69,o[e[70]="INVALID_RENEWAL_PERIOD"]=70,o[e[71]="INVALID_PAYER_ACCOUNT_ID"]=71,o[e[72]="ACCOUNT_DELETED"]=72,o[e[73]="FILE_DELETED"]=73,o[e[74]="ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS"]=74,o[e[75]="SETTING_NEGATIVE_ACCOUNT_BALANCE"]=75,o[e[76]="OBTAINER_REQUIRED"]=76,o[e[77]="OBTAINER_SAME_CONTRACT_ID"]=77,o[e[78]="OBTAINER_DOES_NOT_EXIST"]=78,o[e[79]="MODIFYING_IMMUTABLE_CONTRACT"]=79,o[e[80]="FILE_SYSTEM_EXCEPTION"]=80,o[e[81]="AUTORENEW_DURATION_NOT_IN_RANGE"]=81,o[e[82]="ERROR_DECODING_BYTESTRING"]=82,o[e[83]="CONTRACT_FILE_EMPTY"]=83,o[e[84]="CONTRACT_BYTECODE_EMPTY"]=84,o[e[85]="INVALID_INITIAL_BALANCE"]=85,o[e[86]="INVALID_RECEIVE_RECORD_THRESHOLD"]=86,o[e[87]="INVALID_SEND_RECORD_THRESHOLD"]=87,o[e[88]="ACCOUNT_IS_NOT_GENESIS_ACCOUNT"]=88,o[e[89]="PAYER_ACCOUNT_UNAUTHORIZED"]=89,o[e[90]="INVALID_FREEZE_TRANSACTION_BODY"]=90,o[e[91]="FREEZE_TRANSACTION_BODY_NOT_FOUND"]=91,o[e[92]="TRANSFER_LIST_SIZE_LIMIT_EXCEEDED"]=92,o[e[93]="RESULT_SIZE_LIMIT_EXCEEDED"]=93,o[e[94]="NOT_SPECIAL_ACCOUNT"]=94,o[e[95]="CONTRACT_NEGATIVE_GAS"]=95,o[e[96]="CONTRACT_NEGATIVE_VALUE"]=96,o[e[97]="INVALID_FEE_FILE"]=97,o[e[98]="INVALID_EXCHANGE_RATE_FILE"]=98,o[e[99]="INSUFFICIENT_LOCAL_CALL_GAS"]=99,o[e[100]="ENTITY_NOT_ALLOWED_TO_DELETE"]=100,o[e[101]="AUTHORIZATION_FAILED"]=101,o[e[102]="FILE_UPLOADED_PROTO_INVALID"]=102,o[e[103]="FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK"]=103,o[e[104]="FEE_SCHEDULE_FILE_PART_UPLOADED"]=104,o[e[105]="EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED"]=105,o[e[106]="MAX_CONTRACT_STORAGE_EXCEEDED"]=106,o[e[107]="TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT"]=107,o[e[108]="TOTAL_LEDGER_BALANCE_INVALID"]=108,o[e[110]="EXPIRATION_REDUCTION_NOT_ALLOWED"]=110,o[e[111]="MAX_GAS_LIMIT_EXCEEDED"]=111,o[e[112]="MAX_FILE_SIZE_EXCEEDED"]=112,o[e[113]="RECEIVER_SIG_REQUIRED"]=113,o[e[150]="INVALID_TOPIC_ID"]=150,o[e[155]="INVALID_ADMIN_KEY"]=155,o[e[156]="INVALID_SUBMIT_KEY"]=156,o[e[157]="UNAUTHORIZED"]=157,o[e[158]="INVALID_TOPIC_MESSAGE"]=158,o[e[159]="INVALID_AUTORENEW_ACCOUNT"]=159,o[e[160]="AUTORENEW_ACCOUNT_NOT_ALLOWED"]=160,o[e[162]="TOPIC_EXPIRED"]=162,o[e[163]="INVALID_CHUNK_NUMBER"]=163,o[e[164]="INVALID_CHUNK_TRANSACTION_ID"]=164,o[e[165]="ACCOUNT_FROZEN_FOR_TOKEN"]=165,o[e[166]="TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED"]=166,o[e[167]="INVALID_TOKEN_ID"]=167,o[e[168]="INVALID_TOKEN_DECIMALS"]=168,o[e[169]="INVALID_TOKEN_INITIAL_SUPPLY"]=169,o[e[170]="INVALID_TREASURY_ACCOUNT_FOR_TOKEN"]=170,o[e[171]="INVALID_TOKEN_SYMBOL"]=171,o[e[172]="TOKEN_HAS_NO_FREEZE_KEY"]=172,o[e[173]="TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN"]=173,o[e[174]="MISSING_TOKEN_SYMBOL"]=174,o[e[175]="TOKEN_SYMBOL_TOO_LONG"]=175,o[e[176]="ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN"]=176,o[e[177]="TOKEN_HAS_NO_KYC_KEY"]=177,o[e[178]="INSUFFICIENT_TOKEN_BALANCE"]=178,o[e[179]="TOKEN_WAS_DELETED"]=179,o[e[180]="TOKEN_HAS_NO_SUPPLY_KEY"]=180,o[e[181]="TOKEN_HAS_NO_WIPE_KEY"]=181,o[e[182]="INVALID_TOKEN_MINT_AMOUNT"]=182,o[e[183]="INVALID_TOKEN_BURN_AMOUNT"]=183,o[e[184]="TOKEN_NOT_ASSOCIATED_TO_ACCOUNT"]=184,o[e[185]="CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT"]=185,o[e[186]="INVALID_KYC_KEY"]=186,o[e[187]="INVALID_WIPE_KEY"]=187,o[e[188]="INVALID_FREEZE_KEY"]=188,o[e[189]="INVALID_SUPPLY_KEY"]=189,o[e[190]="MISSING_TOKEN_NAME"]=190,o[e[191]="TOKEN_NAME_TOO_LONG"]=191,o[e[192]="INVALID_WIPING_AMOUNT"]=192,o[e[193]="TOKEN_IS_IMMUTABLE"]=193,o[e[194]="TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT"]=194,o[e[195]="TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES"]=195,o[e[196]="ACCOUNT_IS_TREASURY"]=196,o[e[197]="TOKEN_ID_REPEATED_IN_TOKEN_LIST"]=197,o[e[198]="TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED"]=198,o[e[199]="EMPTY_TOKEN_TRANSFER_BODY"]=199,o[e[200]="EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS"]=200,o[e[201]="INVALID_SCHEDULE_ID"]=201,o[e[202]="SCHEDULE_IS_IMMUTABLE"]=202,o[e[203]="INVALID_SCHEDULE_PAYER_ID"]=203,o[e[204]="INVALID_SCHEDULE_ACCOUNT_ID"]=204,o[e[205]="NO_NEW_VALID_SIGNATURES"]=205,o[e[206]="UNRESOLVABLE_REQUIRED_SIGNERS"]=206,o[e[207]="SCHEDULED_TRANSACTION_NOT_IN_WHITELIST"]=207,o[e[208]="SOME_SIGNATURES_WERE_INVALID"]=208,o[e[209]="TRANSACTION_ID_FIELD_NOT_ALLOWED"]=209,o[e[210]="IDENTICAL_SCHEDULE_ALREADY_CREATED"]=210,o[e[211]="INVALID_ZERO_BYTE_IN_STRING"]=211,o[e[212]="SCHEDULE_ALREADY_DELETED"]=212,o[e[213]="SCHEDULE_ALREADY_EXECUTED"]=213,o[e[214]="MESSAGE_SIZE_TOO_LARGE"]=214,o[e[215]="OPERATION_REPEATED_IN_BUCKET_GROUPS"]=215,o[e[216]="BUCKET_CAPACITY_OVERFLOW"]=216,o[e[217]="NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION"]=217,o[e[218]="BUCKET_HAS_NO_THROTTLE_GROUPS"]=218,o[e[219]="THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC"]=219,o[e[220]="SUCCESS_BUT_MISSING_EXPECTED_OPERATION"]=220,o[e[221]="UNPARSEABLE_THROTTLE_DEFINITIONS"]=221,o[e[222]="INVALID_THROTTLE_DEFINITIONS"]=222,o[e[223]="ACCOUNT_EXPIRED_AND_PENDING_REMOVAL"]=223,o[e[224]="INVALID_TOKEN_MAX_SUPPLY"]=224,o[e[225]="INVALID_TOKEN_NFT_SERIAL_NUMBER"]=225,o[e[226]="INVALID_NFT_ID"]=226,o[e[227]="METADATA_TOO_LONG"]=227,o[e[228]="BATCH_SIZE_LIMIT_EXCEEDED"]=228,o[e[229]="INVALID_QUERY_RANGE"]=229,o[e[230]="FRACTION_DIVIDES_BY_ZERO"]=230,o[e[231]="INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE"]=231,o[e[232]="CUSTOM_FEES_LIST_TOO_LONG"]=232,o[e[233]="INVALID_CUSTOM_FEE_COLLECTOR"]=233,o[e[234]="INVALID_TOKEN_ID_IN_CUSTOM_FEES"]=234,o[e[235]="TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR"]=235,o[e[236]="TOKEN_MAX_SUPPLY_REACHED"]=236,o[e[237]="SENDER_DOES_NOT_OWN_NFT_SERIAL_NO"]=237,o[e[238]="CUSTOM_FEE_NOT_FULLY_SPECIFIED"]=238,o[e[239]="CUSTOM_FEE_MUST_BE_POSITIVE"]=239,o[e[240]="TOKEN_HAS_NO_FEE_SCHEDULE_KEY"]=240,o[e[241]="CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE"]=241,o[e[242]="ROYALTY_FRACTION_CANNOT_EXCEED_ONE"]=242,o[e[243]="FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT"]=243,o[e[244]="CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES"]=244,o[e[245]="CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON"]=245,o[e[246]="CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON"]=246,o[e[247]="INVALID_CUSTOM_FEE_SCHEDULE_KEY"]=247,o[e[248]="INVALID_TOKEN_MINT_METADATA"]=248,o[e[249]="INVALID_TOKEN_BURN_METADATA"]=249,o[e[250]="CURRENT_TREASURY_STILL_OWNS_NFTS"]=250,o[e[251]="ACCOUNT_STILL_OWNS_NFTS"]=251,o[e[252]="TREASURY_MUST_OWN_BURNED_NFT"]=252,o[e[253]="ACCOUNT_DOES_NOT_OWN_WIPED_NFT"]=253,o[e[254]="ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON"]=254,o[e[255]="MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED"]=255,o[e[256]="PAYER_ACCOUNT_DELETED"]=256,o[e[257]="CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH"]=257,o[e[258]="CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS"]=258,o[e[259]="INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE"]=259,o[e[260]="SERIAL_NUMBER_LIMIT_REACHED"]=260,o[e[261]="CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE"]=261,o[e[262]="NO_REMAINING_AUTOMATIC_ASSOCIATIONS"]=262,o[e[263]="EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT"]=263,o[e[264]="REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT"]=264,o[e[265]="TOKEN_IS_PAUSED"]=265,o[e[266]="TOKEN_HAS_NO_PAUSE_KEY"]=266,o[e[267]="INVALID_PAUSE_KEY"]=267,o[e[268]="FREEZE_UPDATE_FILE_DOES_NOT_EXIST"]=268,o[e[269]="FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH"]=269,o[e[270]="NO_UPGRADE_HAS_BEEN_PREPARED"]=270,o[e[271]="NO_FREEZE_IS_SCHEDULED"]=271,o[e[272]="UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE"]=272,o[e[273]="FREEZE_START_TIME_MUST_BE_FUTURE"]=273,o[e[274]="PREPARED_UPDATE_FILE_IS_IMMUTABLE"]=274,o[e[275]="FREEZE_ALREADY_SCHEDULED"]=275,o[e[276]="FREEZE_UPGRADE_IN_PROGRESS"]=276,o[e[277]="UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED"]=277,o[e[278]="UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED"]=278,o[e[279]="CONSENSUS_GAS_EXHAUSTED"]=279,o[e[280]="REVERTED_SUCCESS"]=280,o[e[281]="MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED"]=281,o[e[282]="INVALID_ALIAS_KEY"]=282,o[e[283]="UNEXPECTED_TOKEN_DECIMALS"]=283,o[e[284]="INVALID_PROXY_ACCOUNT_ID"]=284,o[e[285]="INVALID_TRANSFER_ACCOUNT_ID"]=285,o[e[286]="INVALID_FEE_COLLECTOR_ACCOUNT_ID"]=286,o[e[287]="ALIAS_IS_IMMUTABLE"]=287,o[e[288]="SPENDER_ACCOUNT_SAME_AS_OWNER"]=288,o[e[289]="AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY"]=289,o[e[290]="NEGATIVE_ALLOWANCE_AMOUNT"]=290,o[e[291]="CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON"]=291,o[e[292]="SPENDER_DOES_NOT_HAVE_ALLOWANCE"]=292,o[e[293]="AMOUNT_EXCEEDS_ALLOWANCE"]=293,o[e[294]="MAX_ALLOWANCES_EXCEEDED"]=294,o[e[295]="EMPTY_ALLOWANCES"]=295,o[e[296]="SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES"]=296,o[e[297]="REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES"]=297,o[e[298]="FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES"]=298,o[e[299]="NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES"]=299,o[e[300]="INVALID_ALLOWANCE_OWNER_ID"]=300,o[e[301]="INVALID_ALLOWANCE_SPENDER_ID"]=301,o[e[302]="REPEATED_ALLOWANCES_TO_DELETE"]=302,o[e[303]="INVALID_DELEGATING_SPENDER"]=303,o[e[304]="DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL"]=304,o[e[305]="DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL"]=305,o[e[306]="SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE"]=306,o[e[307]="SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME"]=307,o[e[308]="SCHEDULE_FUTURE_THROTTLE_EXCEEDED"]=308,o[e[309]="SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED"]=309,o[e[310]="INVALID_ETHEREUM_TRANSACTION"]=310,o[e[311]="WRONG_CHAIN_ID"]=311,o[e[312]="WRONG_NONCE"]=312,o[e[313]="ACCESS_LIST_UNSUPPORTED"]=313,o[e[314]="SCHEDULE_PENDING_EXPIRATION"]=314,o[e[315]="CONTRACT_IS_TOKEN_TREASURY"]=315,o[e[316]="CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES"]=316,o[e[317]="CONTRACT_EXPIRED_AND_PENDING_REMOVAL"]=317,o[e[318]="CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT"]=318,o[e[319]="PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION"]=319,o[e[320]="PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED"]=320,o[e[321]="SELF_STAKING_IS_NOT_ALLOWED"]=321,o[e[322]="INVALID_STAKING_ID"]=322,o[e[323]="STAKING_NOT_ENABLED"]=323,o[e[324]="INVALID_PRNG_RANGE"]=324,o[e[325]="MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED"]=325,o[e[326]="INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE"]=326,o[e[327]="INSUFFICIENT_BALANCES_FOR_STORAGE_RENT"]=327,o[e[328]="MAX_CHILD_RECORDS_EXCEEDED"]=328,o[e[329]="INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES"]=329,o[e[330]="TRANSACTION_HAS_UNKNOWN_FIELDS"]=330,o[e[331]="ACCOUNT_IS_IMMUTABLE"]=331,o[e[332]="ALIAS_ALREADY_ASSIGNED"]=332,o[e[333]="INVALID_METADATA_KEY"]=333,o[e[334]="TOKEN_HAS_NO_METADATA_KEY"]=334,o[e[335]="MISSING_TOKEN_METADATA"]=335,o[e[336]="MISSING_SERIAL_NUMBERS"]=336,o[e[337]="TOKEN_HAS_NO_ADMIN_KEY"]=337,o[e[338]="NODE_DELETED"]=338,o[e[339]="INVALID_NODE_ID"]=339,o[e[340]="INVALID_GOSSIP_ENDPOINT"]=340,o[e[341]="INVALID_NODE_ACCOUNT_ID"]=341,o[e[342]="INVALID_NODE_DESCRIPTION"]=342,o[e[343]="INVALID_SERVICE_ENDPOINT"]=343,o[e[344]="INVALID_GOSSIP_CA_CERTIFICATE"]=344,o[e[345]="INVALID_GRPC_CERTIFICATE"]=345,o[e[346]="INVALID_MAX_AUTO_ASSOCIATIONS"]=346,o[e[347]="MAX_NODES_CREATED"]=347,o[e[348]="IP_FQDN_CANNOT_BE_SET_FOR_SAME_ENDPOINT"]=348,o[e[349]="GOSSIP_ENDPOINT_CANNOT_HAVE_FQDN"]=349,o[e[350]="FQDN_SIZE_TOO_LARGE"]=350,o[e[351]="INVALID_ENDPOINT"]=351,o[e[352]="GOSSIP_ENDPOINTS_EXCEEDED_LIMIT"]=352,o[e[353]="TOKEN_REFERENCE_REPEATED"]=353,o[e[354]="INVALID_OWNER_ID"]=354,o[e[355]="TOKEN_REFERENCE_LIST_SIZE_LIMIT_EXCEEDED"]=355,o[e[356]="SERVICE_ENDPOINTS_EXCEEDED_LIMIT"]=356,o[e[357]="INVALID_IPV4_ADDRESS"]=357,o[e[358]="EMPTY_TOKEN_REFERENCE_LIST"]=358,o[e[359]="UPDATE_NODE_ACCOUNT_NOT_ALLOWED"]=359,o[e[360]="TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY"]=360,o[e[361]="EMPTY_PENDING_AIRDROP_ID_LIST"]=361,o[e[362]="PENDING_AIRDROP_ID_REPEATED"]=362,o[e[363]="MAX_PENDING_AIRDROP_ID_EXCEEDED"]=363,o[e[364]="PENDING_NFT_AIRDROP_ALREADY_EXISTS"]=364,o[e[365]="ACCOUNT_HAS_PENDING_AIRDROPS"]=365,o}(),GetBySolidityIDQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.solidityID=e.string();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GetBySolidityIDQuery"},e}(),GetBySolidityIDResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GetBySolidityIDResponse"},e}(),ContractLoginfo:function(){function e(e){if(this.topic=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.bloom=e.bytes();break}case 3:{d.topic&&d.topic.length||(d.topic=[]),d.topic.push(e.bytes());break}case 4:{d.data=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractLoginfo"},e}(),ContractFunctionResult:function(){function e(e){if(this.logInfo=[],this.createdContractIDs=[],this.contractNonces=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.contractCallResult=e.bytes();break}case 3:{d.errorMessage=e.string();break}case 4:{d.bloom=e.bytes();break}case 5:{d.gasUsed=e.uint64();break}case 6:{d.logInfo&&d.logInfo.length||(d.logInfo=[]),d.logInfo.push($root.proto.ContractLoginfo.decode(e,e.uint32()));break}case 7:{d.createdContractIDs&&d.createdContractIDs.length||(d.createdContractIDs=[]),d.createdContractIDs.push($root.proto.ContractID.decode(e,e.uint32()));break}case 9:{d.evmAddress=$root.google.protobuf.BytesValue.decode(e,e.uint32());break}case 10:{d.gas=e.int64();break}case 11:{d.amount=e.int64();break}case 12:{d.functionParameters=e.bytes();break}case 13:{d.senderId=$root.proto.AccountID.decode(e,e.uint32());break}case 14:{d.contractNonces&&d.contractNonces.length||(d.contractNonces=[]),d.contractNonces.push($root.proto.ContractNonceInfo.decode(e,e.uint32()));break}case 15:{d.signerNonce=$root.google.protobuf.Int64Value.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractFunctionResult"},e}(),ContractCallLocalQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 3:{d.gas=e.int64();break}case 4:{d.functionParameters=e.bytes();break}case 5:{d.maxResultSize=e.int64();break}case 6:{d.senderId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractCallLocalQuery"},e}(),ContractCallLocalResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.functionResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractCallLocalResponse"},e}(),ContractNonceInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractId=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.nonce=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractNonceInfo"},e}(),ContractGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractGetInfoQuery"},e}(),ContractGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.contractInfo=$root.proto.ContractGetInfoResponse.ContractInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractGetInfoResponse"},e.ContractInfo=function(){function e(e){if(this.tokenRelationships=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.contractAccountID=e.string();break}case 4:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 5:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 6:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 7:{d.storage=e.int64();break}case 8:{d.memo=e.string();break}case 9:{d.balance=e.uint64();break}case 10:{d.deleted=e.bool();break}case 11:{d.tokenRelationships&&d.tokenRelationships.length||(d.tokenRelationships=[]),d.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break}case 12:{d.ledgerId=e.bytes();break}case 13:{d.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 14:{d.maxAutomaticTokenAssociations=e.int32();break}case 15:{d.stakingInfo=$root.proto.StakingInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractGetInfoResponse.ContractInfo"},e}(),e}(),ContractGetBytecodeQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractGetBytecodeQuery"},e}(),ContractGetBytecodeResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 6:{d.bytecode=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractGetBytecodeResponse"},e}(),ContractGetRecordsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractGetRecordsQuery"},e}(),ContractGetRecordsResponse:function(){function e(e){if(this.records=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 3:{d.records&&d.records.length||(d.records=[]),d.records.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractGetRecordsResponse"},e}(),TransactionRecord:function(){function e(e){if(this.tokenTransferLists=[],this.assessedCustomFees=[],this.automaticTokenAssociations=[],this.paidStakingRewards=[],this.newPendingAirdrops=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.receipt=$root.proto.TransactionReceipt.decode(e,e.uint32());break}case 2:{d.transactionHash=e.bytes();break}case 3:{d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 5:{d.memo=e.string();break}case 6:{d.transactionFee=e.uint64();break}case 7:{d.contractCallResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break}case 8:{d.contractCreateResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break}case 10:{d.transferList=$root.proto.TransferList.decode(e,e.uint32());break}case 11:{d.tokenTransferLists&&d.tokenTransferLists.length||(d.tokenTransferLists=[]),d.tokenTransferLists.push($root.proto.TokenTransferList.decode(e,e.uint32()));break}case 12:{d.scheduleRef=$root.proto.ScheduleID.decode(e,e.uint32());break}case 13:{d.assessedCustomFees&&d.assessedCustomFees.length||(d.assessedCustomFees=[]),d.assessedCustomFees.push($root.proto.AssessedCustomFee.decode(e,e.uint32()));break}case 14:{d.automaticTokenAssociations&&d.automaticTokenAssociations.length||(d.automaticTokenAssociations=[]),d.automaticTokenAssociations.push($root.proto.TokenAssociation.decode(e,e.uint32()));break}case 15:{d.parentConsensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 16:{d.alias=e.bytes();break}case 17:{d.ethereumHash=e.bytes();break}case 18:{d.paidStakingRewards&&d.paidStakingRewards.length||(d.paidStakingRewards=[]),d.paidStakingRewards.push($root.proto.AccountAmount.decode(e,e.uint32()));break}case 19:{d.prngBytes=e.bytes();break}case 20:{d.prngNumber=e.int32();break}case 21:{d.evmAddress=e.bytes();break}case 22:{d.newPendingAirdrops&&d.newPendingAirdrops.length||(d.newPendingAirdrops=[]),d.newPendingAirdrops.push($root.proto.PendingAirdropRecord.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionRecord"},e}(),PendingAirdropRecord:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.pendingAirdropId=$root.proto.PendingAirdropId.decode(e,e.uint32());break}case 2:{d.pendingAirdropValue=$root.proto.PendingAirdropValue.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.PendingAirdropRecord"},e}(),TransactionReceipt:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.status=e.int32();break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 5:{d.exchangeRate=$root.proto.ExchangeRateSet.decode(e,e.uint32());break}case 6:{d.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 7:{d.topicSequenceNumber=e.uint64();break}case 8:{d.topicRunningHash=e.bytes();break}case 9:{d.topicRunningHashVersion=e.uint64();break}case 10:{d.tokenID=$root.proto.TokenID.decode(e,e.uint32());break}case 11:{d.newTotalSupply=e.uint64();break}case 12:{d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}case 13:{d.scheduledTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 14:{if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.hbarEquiv=e.int32();break}case 2:{d.centEquiv=e.int32();break}case 3:{d.expirationTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ExchangeRate"},e}(),ExchangeRateSet:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.currentRate=$root.proto.ExchangeRate.decode(e,e.uint32());break}case 2:{d.nextRate=$root.proto.ExchangeRate.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ExchangeRateSet"},e}(),CryptoGetAccountBalanceQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetAccountBalanceQuery"},e}(),CryptoGetAccountBalanceResponse:function(){function e(e){if(this.tokenBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.balance=e.uint64();break}case 4:{d.tokenBalances&&d.tokenBalances.length||(d.tokenBalances=[]),d.tokenBalances.push($root.proto.TokenBalance.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetAccountBalanceResponse"},e}(),CryptoGetAccountRecordsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetAccountRecordsQuery"},e}(),CryptoGetAccountRecordsResponse:function(){function e(e){if(this.records=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.records&&d.records.length||(d.records=[]),d.records.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetAccountRecordsResponse"},e}(),CryptoGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetInfoQuery"},e}(),CryptoGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.accountInfo=$root.proto.CryptoGetInfoResponse.AccountInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetInfoResponse"},e.AccountInfo=function(){function e(e){if(this.liveHashes=[],this.tokenRelationships=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.contractAccountID=e.string();break}case 3:{d.deleted=e.bool();break}case 4:{d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{d.proxyReceived=e.int64();break}case 7:{d.key=$root.proto.Key.decode(e,e.uint32());break}case 8:{d.balance=e.uint64();break}case 9:{d.generateSendRecordThreshold=e.uint64();break}case 10:{d.generateReceiveRecordThreshold=e.uint64();break}case 11:{d.receiverSigRequired=e.bool();break}case 12:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 13:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 14:{d.liveHashes&&d.liveHashes.length||(d.liveHashes=[]),d.liveHashes.push($root.proto.LiveHash.decode(e,e.uint32()));break}case 15:{d.tokenRelationships&&d.tokenRelationships.length||(d.tokenRelationships=[]),d.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break}case 16:{d.memo=e.string();break}case 17:{d.ownedNfts=e.int64();break}case 18:{d.maxAutomaticTokenAssociations=e.int32();break}case 19:{d.alias=e.bytes();break}case 20:{d.ledgerId=e.bytes();break}case 21:{d.ethereumNonce=e.int64();break}case 22:{d.stakingInfo=$root.proto.StakingInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetInfoResponse.AccountInfo"},e}(),e}(),CryptoGetLiveHashQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.hash=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetLiveHashQuery"},e}(),CryptoGetLiveHashResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetLiveHashResponse"},e}(),CryptoGetStakersQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetStakersQuery"},e}(),ProxyStaker:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.amount=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ProxyStaker"},e}(),AllProxyStakers:function(){function e(e){if(this.proxyStaker=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.proxyStaker&&d.proxyStaker.length||(d.proxyStaker=[]),d.proxyStaker.push($root.proto.ProxyStaker.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.AllProxyStakers"},e}(),CryptoGetStakersResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 3:{d.stakers=$root.proto.AllProxyStakers.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.CryptoGetStakersResponse"},e}(),FileGetContentsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileGetContentsQuery"},e}(),FileGetContentsResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.fileContents=$root.proto.FileGetContentsResponse.FileContents.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileGetContentsResponse"},e.FileContents=function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{d.contents=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileGetContentsResponse.FileContents"},e}(),e}(),FileGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileGetInfoQuery"},e}(),FileGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.fileInfo=$root.proto.FileGetInfoResponse.FileInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileGetInfoResponse"},e.FileInfo=function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{d.size=e.int64();break}case 3:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{d.deleted=e.bool();break}case 5:{d.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 6:{d.memo=e.string();break}case 7:{d.ledgerId=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.FileGetInfoResponse.FileInfo"},e}(),e}(),TransactionGetReceiptQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 3:{d.includeDuplicates=e.bool();break}case 4:{d.includeChildReceipts=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionGetReceiptQuery"},e}(),TransactionGetReceiptResponse:function(){function e(e){if(this.duplicateTransactionReceipts=[],this.childTransactionReceipts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.receipt=$root.proto.TransactionReceipt.decode(e,e.uint32());break}case 4:{d.duplicateTransactionReceipts&&d.duplicateTransactionReceipts.length||(d.duplicateTransactionReceipts=[]),d.duplicateTransactionReceipts.push($root.proto.TransactionReceipt.decode(e,e.uint32()));break}case 5:{d.childTransactionReceipts&&d.childTransactionReceipts.length||(d.childTransactionReceipts=[]),d.childTransactionReceipts.push($root.proto.TransactionReceipt.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionGetReceiptResponse"},e}(),TransactionGetRecordQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 3:{d.includeDuplicates=e.bool();break}case 4:{d.includeChildRecords=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionGetRecordQuery"},e}(),TransactionGetRecordResponse:function(){function e(e){if(this.duplicateTransactionRecords=[],this.childTransactionRecords=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 3:{d.transactionRecord=$root.proto.TransactionRecord.decode(e,e.uint32());break}case 4:{d.duplicateTransactionRecords&&d.duplicateTransactionRecords.length||(d.duplicateTransactionRecords=[]),d.duplicateTransactionRecords.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}case 5:{d.childTransactionRecords&&d.childTransactionRecords.length||(d.childTransactionRecords=[]),d.childTransactionRecords.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionGetRecordResponse"},e}(),TransactionGetFastRecordQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionGetFastRecordQuery"},e}(),TransactionGetFastRecordResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.transactionRecord=$root.proto.TransactionRecord.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionGetFastRecordResponse"},e}(),ConsensusGetTopicInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.topicID=$root.proto.TopicID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusGetTopicInfoQuery"},e}(),ConsensusGetTopicInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 5:{d.topicInfo=$root.proto.ConsensusTopicInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusGetTopicInfoResponse"},e}(),ConsensusTopicInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.memo=e.string();break}case 2:{d.runningHash=e.bytes();break}case 3:{d.sequenceNumber=e.uint64();break}case 4:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 5:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{d.submitKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 8:{d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 9:{d.ledgerId=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ConsensusTopicInfo"},e}(),NetworkGetVersionInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NetworkGetVersionInfoQuery"},e}(),NetworkGetVersionInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.hapiProtoVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break}case 3:{d.hederaServicesVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NetworkGetVersionInfoResponse"},e}(),NetworkGetExecutionTimeQuery:function(){function e(e){if(this.transactionIds=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.transactionIds&&d.transactionIds.length||(d.transactionIds=[]),d.transactionIds.push($root.proto.TransactionID.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.NetworkGetExecutionTimeQuery"},e}(),NetworkGetExecutionTimeResponse:function(){function e(e){if(this.executionTimes=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{if(d.executionTimes&&d.executionTimes.length||(d.executionTimes=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetInfoQuery"},e}(),TokenInfo:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.name=e.string();break}case 3:{d.symbol=e.string();break}case 4:{d.decimals=e.uint32();break}case 5:{d.totalSupply=e.uint64();break}case 6:{d.treasury=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{d.kycKey=$root.proto.Key.decode(e,e.uint32());break}case 9:{d.freezeKey=$root.proto.Key.decode(e,e.uint32());break}case 10:{d.wipeKey=$root.proto.Key.decode(e,e.uint32());break}case 11:{d.supplyKey=$root.proto.Key.decode(e,e.uint32());break}case 12:{d.defaultFreezeStatus=e.int32();break}case 13:{d.defaultKycStatus=e.int32();break}case 14:{d.deleted=e.bool();break}case 15:{d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 16:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 17:{d.expiry=$root.proto.Timestamp.decode(e,e.uint32());break}case 18:{d.memo=e.string();break}case 19:{d.tokenType=e.int32();break}case 20:{d.supplyType=e.int32();break}case 21:{d.maxSupply=e.int64();break}case 22:{d.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break}case 23:{d.customFees&&d.customFees.length||(d.customFees=[]),d.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break}case 24:{d.pauseKey=$root.proto.Key.decode(e,e.uint32());break}case 25:{d.pauseStatus=e.int32();break}case 26:{d.ledgerId=e.bytes();break}case 27:{d.metadata=e.bytes();break}case 28:{d.metadataKey=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenInfo"},e}(),TokenGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.tokenInfo=$root.proto.TokenInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetInfoResponse"},e}(),ScheduleGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ScheduleGetInfoQuery"},e}(),ScheduleInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}case 2:{d.deletionTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{d.executionTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 5:{d.scheduledTransactionBody=$root.proto.SchedulableTransactionBody.decode(e,e.uint32());break}case 6:{d.memo=e.string();break}case 7:{d.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{d.signers=$root.proto.KeyList.decode(e,e.uint32());break}case 9:{d.creatorAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 10:{d.payerAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 11:{d.scheduledTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 12:{d.ledgerId=e.bytes();break}case 13:{d.waitForExpiry=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ScheduleInfo"},e}(),ScheduleGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.scheduleInfo=$root.proto.ScheduleInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ScheduleGetInfoResponse"},e}(),TokenGetAccountNftInfosQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.start=e.int64();break}case 4:{d.end=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetAccountNftInfosQuery"},e}(),TokenGetAccountNftInfosResponse:function(){function e(e){if(this.nfts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.nfts&&d.nfts.length||(d.nfts=[]),d.nfts.push($root.proto.TokenNftInfo.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetAccountNftInfosResponse"},e}(),TokenGetNftInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.nftID=$root.proto.NftID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetNftInfoQuery"},e}(),TokenNftInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nftID=$root.proto.NftID.decode(e,e.uint32());break}case 2:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.creationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{d.metadata=e.bytes();break}case 5:{d.ledgerId=e.bytes();break}case 6:{d.spenderId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenNftInfo"},e}(),TokenGetNftInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.nft=$root.proto.TokenNftInfo.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetNftInfoResponse"},e}(),TokenGetNftInfosQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.tokenID=$root.proto.TokenID.decode(e,e.uint32());break}case 3:{d.start=e.int64();break}case 4:{d.end=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetNftInfosQuery"},e}(),TokenGetNftInfosResponse:function(){function e(e){if(this.nfts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.tokenID=$root.proto.TokenID.decode(e,e.uint32());break}case 3:{d.nfts&&d.nfts.length||(d.nfts=[]),d.nfts.push($root.proto.TokenNftInfo.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenGetNftInfosResponse"},e}(),GetAccountDetailsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{d.accountId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GetAccountDetailsQuery"},e}(),GetAccountDetailsResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{d.accountDetails=$root.proto.GetAccountDetailsResponse.AccountDetails.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GetAccountDetailsResponse"},e.AccountDetails=function(){function e(e){if(this.tokenRelationships=[],this.grantedCryptoAllowances=[],this.grantedNftAllowances=[],this.grantedTokenAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountId=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.contractAccountId=e.string();break}case 3:{d.deleted=e.bool();break}case 4:{d.proxyAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{d.proxyReceived=e.int64();break}case 6:{d.key=$root.proto.Key.decode(e,e.uint32());break}case 7:{d.balance=e.uint64();break}case 8:{d.receiverSigRequired=e.bool();break}case 9:{d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 10:{d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 11:{d.tokenRelationships&&d.tokenRelationships.length||(d.tokenRelationships=[]),d.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break}case 12:{d.memo=e.string();break}case 13:{d.ownedNfts=e.int64();break}case 14:{d.maxAutomaticTokenAssociations=e.int32();break}case 15:{d.alias=e.bytes();break}case 16:{d.ledgerId=e.bytes();break}case 17:{d.grantedCryptoAllowances&&d.grantedCryptoAllowances.length||(d.grantedCryptoAllowances=[]),d.grantedCryptoAllowances.push($root.proto.GrantedCryptoAllowance.decode(e,e.uint32()));break}case 18:{d.grantedNftAllowances&&d.grantedNftAllowances.length||(d.grantedNftAllowances=[]),d.grantedNftAllowances.push($root.proto.GrantedNftAllowance.decode(e,e.uint32()));break}case 19:{d.grantedTokenAllowances&&d.grantedTokenAllowances.length||(d.grantedTokenAllowances=[]),d.grantedTokenAllowances.push($root.proto.GrantedTokenAllowance.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GetAccountDetailsResponse.AccountDetails"},e}(),e}(),GrantedCryptoAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.amount=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GrantedCryptoAllowance"},e}(),GrantedNftAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.spender=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GrantedNftAllowance"},e}(),GrantedTokenAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.amount=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.GrantedTokenAllowance"},e}(),Response:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.getByKey=$root.proto.GetByKeyResponse.decode(e,e.uint32());break}case 2:{d.getBySolidityID=$root.proto.GetBySolidityIDResponse.decode(e,e.uint32());break}case 3:{d.contractCallLocal=$root.proto.ContractCallLocalResponse.decode(e,e.uint32());break}case 5:{d.contractGetBytecodeResponse=$root.proto.ContractGetBytecodeResponse.decode(e,e.uint32());break}case 4:{d.contractGetInfo=$root.proto.ContractGetInfoResponse.decode(e,e.uint32());break}case 6:{d.contractGetRecordsResponse=$root.proto.ContractGetRecordsResponse.decode(e,e.uint32());break}case 7:{d.cryptogetAccountBalance=$root.proto.CryptoGetAccountBalanceResponse.decode(e,e.uint32());break}case 8:{d.cryptoGetAccountRecords=$root.proto.CryptoGetAccountRecordsResponse.decode(e,e.uint32());break}case 9:{d.cryptoGetInfo=$root.proto.CryptoGetInfoResponse.decode(e,e.uint32());break}case 10:{d.cryptoGetLiveHash=$root.proto.CryptoGetLiveHashResponse.decode(e,e.uint32());break}case 11:{d.cryptoGetProxyStakers=$root.proto.CryptoGetStakersResponse.decode(e,e.uint32());break}case 12:{d.fileGetContents=$root.proto.FileGetContentsResponse.decode(e,e.uint32());break}case 13:{d.fileGetInfo=$root.proto.FileGetInfoResponse.decode(e,e.uint32());break}case 14:{d.transactionGetReceipt=$root.proto.TransactionGetReceiptResponse.decode(e,e.uint32());break}case 15:{d.transactionGetRecord=$root.proto.TransactionGetRecordResponse.decode(e,e.uint32());break}case 16:{d.transactionGetFastRecord=$root.proto.TransactionGetFastRecordResponse.decode(e,e.uint32());break}case 150:{d.consensusGetTopicInfo=$root.proto.ConsensusGetTopicInfoResponse.decode(e,e.uint32());break}case 151:{d.networkGetVersionInfo=$root.proto.NetworkGetVersionInfoResponse.decode(e,e.uint32());break}case 152:{d.tokenGetInfo=$root.proto.TokenGetInfoResponse.decode(e,e.uint32());break}case 153:{d.scheduleGetInfo=$root.proto.ScheduleGetInfoResponse.decode(e,e.uint32());break}case 154:{d.tokenGetAccountNftInfos=$root.proto.TokenGetAccountNftInfosResponse.decode(e,e.uint32());break}case 155:{d.tokenGetNftInfo=$root.proto.TokenGetNftInfoResponse.decode(e,e.uint32());break}case 156:{d.tokenGetNftInfos=$root.proto.TokenGetNftInfosResponse.decode(e,e.uint32());break}case 157:{d.networkGetExecutionTime=$root.proto.NetworkGetExecutionTimeResponse.decode(e,e.uint32());break}case 158:{d.accountDetails=$root.proto.GetAccountDetailsResponse.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.Response"},e}(),TransactionResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.nodeTransactionPrecheckCode=e.int32();break}case 2:{d.cost=e.uint64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionResponse"},e}(),ConsensusService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"createTopic"}),Object.defineProperty(e.prototype.updateTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateTopic"}),Object.defineProperty(e.prototype.deleteTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteTopic"}),Object.defineProperty(e.prototype.getTopicInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getTopicInfo"}),Object.defineProperty(e.prototype.submitMessage=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"submitMessage"}),e}(),CryptoService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"createAccount"}),Object.defineProperty(e.prototype.updateAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateAccount"}),Object.defineProperty(e.prototype.cryptoTransfer=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"cryptoTransfer"}),Object.defineProperty(e.prototype.cryptoDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"cryptoDelete"}),Object.defineProperty(e.prototype.approveAllowances=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"approveAllowances"}),Object.defineProperty(e.prototype.deleteAllowances=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteAllowances"}),Object.defineProperty(e.prototype.addLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"addLiveHash"}),Object.defineProperty(e.prototype.deleteLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteLiveHash"}),Object.defineProperty(e.prototype.getLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getLiveHash"}),Object.defineProperty(e.prototype.getAccountRecords=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getAccountRecords"}),Object.defineProperty(e.prototype.cryptoGetBalance=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"cryptoGetBalance"}),Object.defineProperty(e.prototype.getAccountInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getAccountInfo"}),Object.defineProperty(e.prototype.getTransactionReceipts=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getTransactionReceipts"}),Object.defineProperty(e.prototype.getFastTransactionRecord=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getFastTransactionRecord"}),Object.defineProperty(e.prototype.getTxRecordByTxID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getTxRecordByTxID"}),Object.defineProperty(e.prototype.getStakersByAccountID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getStakersByAccountID"}),e}(),FileService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"createFile"}),Object.defineProperty(e.prototype.updateFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateFile"}),Object.defineProperty(e.prototype.deleteFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteFile"}),Object.defineProperty(e.prototype.appendContent=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"appendContent"}),Object.defineProperty(e.prototype.getFileContent=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getFileContent"}),Object.defineProperty(e.prototype.getFileInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getFileInfo"}),Object.defineProperty(e.prototype.systemDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"systemDelete"}),Object.defineProperty(e.prototype.systemUndelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"systemUndelete"}),e}(),FreezeService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.freeze=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"freeze"}),e}(),NetworkService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.getVersionInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getVersionInfo"}),Object.defineProperty(e.prototype.getExecutionTime=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getExecutionTime"}),Object.defineProperty(e.prototype.uncheckedSubmit=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"uncheckedSubmit"}),Object.defineProperty(e.prototype.getAccountDetails=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getAccountDetails"}),e}(),ScheduleService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"createSchedule"}),Object.defineProperty(e.prototype.signSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"signSchedule"}),Object.defineProperty(e.prototype.deleteSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteSchedule"}),Object.defineProperty(e.prototype.getScheduleInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getScheduleInfo"}),e}(),SmartContractService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"createContract"}),Object.defineProperty(e.prototype.updateContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateContract"}),Object.defineProperty(e.prototype.contractCallMethod=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"contractCallMethod"}),Object.defineProperty(e.prototype.getContractInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getContractInfo"}),Object.defineProperty(e.prototype.contractCallLocalMethod=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"contractCallLocalMethod"}),Object.defineProperty(e.prototype.contractGetBytecode=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"ContractGetBytecode"}),Object.defineProperty(e.prototype.getBySolidityID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getBySolidityID"}),Object.defineProperty(e.prototype.getTxRecordByContractID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getTxRecordByContractID"}),Object.defineProperty(e.prototype.deleteContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteContract"}),Object.defineProperty(e.prototype.systemDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"systemDelete"}),Object.defineProperty(e.prototype.systemUndelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"systemUndelete"}),Object.defineProperty(e.prototype.callEthereum=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"callEthereum"}),e}(),ThrottleGroup:function(){function e(e){if(this.operations=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{if(d.operations&&d.operations.length||(d.operations=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.name=e.string();break}case 2:{d.burstPeriodMs=e.uint64();break}case 3:{d.throttleGroups&&d.throttleGroups.length||(d.throttleGroups=[]),d.throttleGroups.push($root.proto.ThrottleGroup.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ThrottleBucket"},e}(),ThrottleDefinitions:function(){function e(e){if(this.throttleBuckets=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.throttleBuckets&&d.throttleBuckets.length||(d.throttleBuckets=[]),d.throttleBuckets.push($root.proto.ThrottleBucket.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ThrottleDefinitions"},e}(),TokenService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"createToken"}),Object.defineProperty(e.prototype.updateToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateToken"}),Object.defineProperty(e.prototype.mintToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"mintToken"}),Object.defineProperty(e.prototype.burnToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"burnToken"}),Object.defineProperty(e.prototype.deleteToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"deleteToken"}),Object.defineProperty(e.prototype.wipeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"wipeTokenAccount"}),Object.defineProperty(e.prototype.freezeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"freezeTokenAccount"}),Object.defineProperty(e.prototype.unfreezeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"unfreezeTokenAccount"}),Object.defineProperty(e.prototype.grantKycToTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"grantKycToTokenAccount"}),Object.defineProperty(e.prototype.revokeKycFromTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"revokeKycFromTokenAccount"}),Object.defineProperty(e.prototype.associateTokens=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"associateTokens"}),Object.defineProperty(e.prototype.dissociateTokens=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"dissociateTokens"}),Object.defineProperty(e.prototype.updateTokenFeeSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateTokenFeeSchedule"}),Object.defineProperty(e.prototype.getTokenInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getTokenInfo"}),Object.defineProperty(e.prototype.getAccountNftInfos=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getAccountNftInfos"}),Object.defineProperty(e.prototype.getTokenNftInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getTokenNftInfo"}),Object.defineProperty(e.prototype.getTokenNftInfos=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},"name",{value:"getTokenNftInfos"}),Object.defineProperty(e.prototype.pauseToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"pauseToken"}),Object.defineProperty(e.prototype.unpauseToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"unpauseToken"}),Object.defineProperty(e.prototype.updateNfts=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"updateNfts"}),Object.defineProperty(e.prototype.rejectToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"rejectToken"}),Object.defineProperty(e.prototype.airdropTokens=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"airdropTokens"}),Object.defineProperty(e.prototype.cancelAirdrop=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"cancelAirdrop"}),Object.defineProperty(e.prototype.claimAirdrop=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"claimAirdrop"}),e}(),SignedTransaction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.bodyBytes=e.bytes();break}case 2:{d.sigMap=$root.proto.SignatureMap.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SignedTransaction"},e}(),UtilService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.prng=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},"name",{value:"prng"}),e}(),TokenUnitBalance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{d.balance=e.uint64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TokenUnitBalance"},e}(),SingleAccountBalances:function(){function e(e){if(this.tokenUnitBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{d.hbarBalance=e.uint64();break}case 3:{d.tokenUnitBalances&&d.tokenUnitBalances.length||(d.tokenUnitBalances=[]),d.tokenUnitBalances.push($root.proto.TokenUnitBalance.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SingleAccountBalances"},e}(),AllAccountBalances:function(){function e(e){if(this.allAccounts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{d.allAccounts&&d.allAccounts.length||(d.allAccounts=[]),d.allAccounts.push($root.proto.SingleAccountBalances.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.AllAccountBalances"},e}(),ContractActions:function(){function e(e){if(this.contractActions=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractActions&&d.contractActions.length||(d.contractActions=[]),d.contractActions.push($root.proto.ContractAction.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractActions"},e}(),ContractActionType:function(){const e={},o=Object.create(e);return o[e[0]="NO_ACTION"]=0,o[e[1]="CALL"]=1,o[e[2]="CREATE"]=2,o[e[3]="PRECOMPILE"]=3,o[e[4]="SYSTEM"]=4,o}(),CallOperationType:function(){const e={},o=Object.create(e);return o[e[0]="OP_UNKNOWN"]=0,o[e[1]="OP_CALL"]=1,o[e[2]="OP_CALLCODE"]=2,o[e[3]="OP_DELEGATECALL"]=3,o[e[4]="OP_STATICCALL"]=4,o[e[5]="OP_CREATE"]=5,o[e[6]="OP_CREATE2"]=6,o}(),ContractAction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.callType=e.int32();break}case 2:{d.callingAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{d.callingContract=$root.proto.ContractID.decode(e,e.uint32());break}case 4:{d.gas=e.int64();break}case 5:{d.input=e.bytes();break}case 6:{d.recipientAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{d.recipientContract=$root.proto.ContractID.decode(e,e.uint32());break}case 8:{d.targetedAddress=e.bytes();break}case 9:{d.value=e.int64();break}case 10:{d.gasUsed=e.int64();break}case 11:{d.output=e.bytes();break}case 12:{d.revertReason=e.bytes();break}case 13:{d.error=e.bytes();break}case 14:{d.callDepth=e.int32();break}case 15:{d.callOperationType=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractAction"},e}(),ContractBytecode:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractId=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.initcode=e.bytes();break}case 3:{d.runtimeBytecode=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractBytecode"},e}(),ContractStateChanges:function(){function e(e){if(this.contractStateChanges=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractStateChanges&&d.contractStateChanges.length||(d.contractStateChanges=[]),d.contractStateChanges.push($root.proto.ContractStateChange.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractStateChanges"},e}(),ContractStateChange:function(){function e(e){if(this.storageChanges=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.contractId=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{d.storageChanges&&d.storageChanges.length||(d.storageChanges=[]),d.storageChanges.push($root.proto.StorageChange.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.ContractStateChange"},e}(),StorageChange:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.slot=e.bytes();break}case 2:{d.valueRead=e.bytes();break}case 3:{d.valueWritten=$root.google.protobuf.BytesValue.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.StorageChange"},e}(),HashAlgorithm:function(){const e={},o=Object.create(e);return o[e[0]="HASH_ALGORITHM_UNKNOWN"]=0,o[e[1]="SHA_384"]=1,o}(),HashObject:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.algorithm=e.int32();break}case 2:{d.length=e.int32();break}case 3:{d.hash=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.HashObject"},e}(),RecordStreamFile:function(){function e(e){if(this.recordStreamItems=[],this.sidecars=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.hapiProtoVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break}case 2:{d.startObjectRunningHash=$root.proto.HashObject.decode(e,e.uint32());break}case 3:{d.recordStreamItems&&d.recordStreamItems.length||(d.recordStreamItems=[]),d.recordStreamItems.push($root.proto.RecordStreamItem.decode(e,e.uint32()));break}case 4:{d.endObjectRunningHash=$root.proto.HashObject.decode(e,e.uint32());break}case 5:{d.blockNumber=e.int64();break}case 6:{d.sidecars&&d.sidecars.length||(d.sidecars=[]),d.sidecars.push($root.proto.SidecarMetadata.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.RecordStreamFile"},e}(),RecordStreamItem:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.transaction=$root.proto.Transaction.decode(e,e.uint32());break}case 2:{d.record=$root.proto.TransactionRecord.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.RecordStreamItem"},e}(),SidecarMetadata:function(){function e(e){if(this.types=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.hash=$root.proto.HashObject.decode(e,e.uint32());break}case 2:{d.id=e.int32();break}case 3:{if(d.types&&d.types.length||(d.types=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{d.sidecarRecords&&d.sidecarRecords.length||(d.sidecarRecords=[]),d.sidecarRecords.push($root.proto.TransactionSidecarRecord.decode(e,e.uint32()));break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SidecarFile"},e}(),TransactionSidecarRecord:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{d.migration=e.bool();break}case 3:{d.stateChanges=$root.proto.ContractStateChanges.decode(e,e.uint32());break}case 4:{d.actions=$root.proto.ContractActions.decode(e,e.uint32());break}case 5:{d.bytecode=$root.proto.ContractBytecode.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.TransactionSidecarRecord"},e}(),SignatureFile:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.fileSignature=$root.proto.SignatureObject.decode(e,e.uint32());break}case 2:{d.metadataSignature=$root.proto.SignatureObject.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SignatureFile"},e}(),SignatureObject:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.type=e.int32();break}case 2:{d.length=e.int32();break}case 3:{d.checksum=e.int32();break}case 4:{d.signature=e.bytes();break}case 5:{d.hashObject=$root.proto.HashObject.decode(e,e.uint32());break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/proto.SignatureObject"},e}(),SignatureType:function(){const e={},o=Object.create(e);return o[e[0]="SIGNATURE_TYPE_UNKNOWN"]=0,o[e[1]="SHA_384_WITH_RSA"]=1,o}()};return e})();exports.proto=proto;const google=$root.google=(()=>{const e={protobuf:function(){const e={DoubleValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.double();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.DoubleValue"},e}(),FloatValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.float();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.FloatValue"},e}(),Int64Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.int64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.Int64Value"},e}(),UInt64Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.uint64();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.UInt64Value"},e}(),Int32Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.int32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.Int32Value"},e}(),UInt32Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.uint32();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.UInt32Value"},e}(),BoolValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.bool();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.BoolValue"},e}(),StringValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.string();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.StringValue"},e}(),BytesValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{d.value=e.bytes();break}default:e.skipType(7&i)}return d},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.BytesValue"},e}()};return e}()};return e})();exports.google=google; /***/ }), -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/array.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/array.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 4537: +/***/ (function(module) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ArrayCoder\": function() { return /* binding */ ArrayCoder; },\n/* harmony export */ \"pack\": function() { return /* binding */ pack; },\n/* harmony export */ \"unpack\": function() { return /* binding */ unpack; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_version */ \"./node_modules/@ethersproject/abi/lib.esm/_version.js\");\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n/* harmony import */ var _anonymous__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./anonymous */ \"./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n\n\nfunction pack(writer, coders, values) {\n let arrayValues = null;\n if (Array.isArray(values)) {\n arrayValues = values;\n }\n else if (values && typeof (values) === \"object\") {\n let unique = {};\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n if (!name) {\n logger.throwError(\"cannot encode object for signature with missing names\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INVALID_ARGUMENT, {\n argument: \"values\",\n coder: coder,\n value: values\n });\n }\n if (unique[name]) {\n logger.throwError(\"cannot encode object for signature with duplicate names\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INVALID_ARGUMENT, {\n argument: \"values\",\n coder: coder,\n value: values\n });\n }\n unique[name] = true;\n return values[name];\n });\n }\n else {\n logger.throwArgumentError(\"invalid tuple value\", \"tuple\", values);\n }\n if (coders.length !== arrayValues.length) {\n logger.throwArgumentError(\"types/value length mismatch\", \"tuple\", values);\n }\n let staticWriter = new _abstract_coder__WEBPACK_IMPORTED_MODULE_2__.Writer(writer.wordSize);\n let dynamicWriter = new _abstract_coder__WEBPACK_IMPORTED_MODULE_2__.Writer(writer.wordSize);\n let updateFuncs = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n }\n else {\n coder.encode(staticWriter, value);\n }\n });\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => { func(staticWriter.length); });\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\nfunction unpack(reader, coders) {\n let values = [];\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n coders.forEach((coder) => {\n let value = null;\n if (coder.dynamic) {\n let offset = reader.readValue();\n let offsetReader = baseReader.subReader(offset.toNumber());\n try {\n value = coder.decode(offsetReader);\n }\n catch (error) {\n // Cannot recover from this\n if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n else {\n try {\n value = coder.decode(reader);\n }\n catch (error) {\n // Cannot recover from this\n if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN) {\n throw error;\n }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n if (value != undefined) {\n values.push(value);\n }\n });\n // We only output named properties for uniquely named coders\n const uniqueNames = coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) {\n accum[name] = 0;\n }\n accum[name]++;\n }\n return accum;\n }, {});\n // Add any named parameters (i.e. tuples)\n coders.forEach((coder, index) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) {\n return;\n }\n if (name === \"length\") {\n name = \"_length\";\n }\n if (values[name] != null) {\n return;\n }\n const value = values[index];\n if (value instanceof Error) {\n Object.defineProperty(values, name, {\n enumerable: true,\n get: () => { throw value; }\n });\n }\n else {\n values[name] = value;\n }\n });\n for (let i = 0; i < values.length; i++) {\n const value = values[i];\n if (value instanceof Error) {\n Object.defineProperty(values, i, {\n enumerable: true,\n get: () => { throw value; }\n });\n }\n }\n return Object.freeze(values);\n}\nclass ArrayCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_2__.Coder {\n constructor(coder, length, localName) {\n const type = (coder.type + \"[\" + (length >= 0 ? length : \"\") + \"]\");\n const dynamic = (length === -1 || coder.dynamic);\n super(\"array\", type, localName, dynamic);\n this.coder = coder;\n this.length = length;\n }\n defaultValue() {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n const result = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n encode(writer, value) {\n if (!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n let count = this.length;\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n logger.checkArgumentCount(value.length, count, \"coder array\" + (this.localName ? (\" \" + this.localName) : \"\"));\n let coders = [];\n for (let i = 0; i < value.length; i++) {\n coders.push(this.coder);\n }\n return pack(writer, coders, value);\n }\n decode(reader) {\n let count = this.length;\n if (count === -1) {\n count = reader.readValue().toNumber();\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n if (count * 32 > reader._data.length) {\n logger.throwError(\"insufficient data length\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {\n length: reader._data.length,\n count: count\n });\n }\n }\n let coders = [];\n for (let i = 0; i < count; i++) {\n coders.push(new _anonymous__WEBPACK_IMPORTED_MODULE_3__.AnonymousCoder(this.coder));\n }\n return reader.coerce(this.name, unpack(reader, coders));\n }\n}\n//# sourceMappingURL=array.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/array.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +module.exports = asPromise; + +/** + * Callback as used by {@link util.asPromise}. + * @typedef asPromiseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {...*} params Additional arguments + * @returns {undefined} + */ + +/** + * Returns a promise from a node-style callback function. + * @memberof util + * @param {asPromiseCallback} fn Function to call + * @param {*} ctx Function context + * @param {...*} params Function arguments + * @returns {Promise<*>} Promisified function + */ +function asPromise(fn, ctx/*, varargs */) { + var params = new Array(arguments.length - 1), + offset = 0, + index = 2, + pending = true; + while (index < arguments.length) + params[offset++] = arguments[index++]; + return new Promise(function executor(resolve, reject) { + params[offset] = function callback(err/*, varargs */) { + if (pending) { + pending = false; + if (err) + reject(err); + else { + var params = new Array(arguments.length - 1), + offset = 0; + while (offset < params.length) + params[offset++] = arguments[offset]; + resolve.apply(null, params); + } + } + }; + try { + fn.apply(ctx || null, params); + } catch (err) { + if (pending) { + pending = false; + reject(err); + } + } + }); +} + + +/***/ }), + +/***/ 7419: +/***/ (function(__unused_webpack_module, exports) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BooleanCoder\": function() { return /* binding */ BooleanCoder; }\n/* harmony export */ });\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n\n\nclass BooleanCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(localName) {\n super(\"bool\", \"bool\", localName, false);\n }\n defaultValue() {\n return false;\n }\n encode(writer, value) {\n return writer.writeValue(value ? 1 : 0);\n }\n decode(reader) {\n return reader.coerce(this.type, !reader.readValue().isZero());\n }\n}\n//# sourceMappingURL=boolean.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + + +/** + * A minimal base64 implementation for number arrays. + * @memberof util + * @namespace + */ +var base64 = exports; + +/** + * Calculates the byte length of a base64 encoded string. + * @param {string} string Base64 encoded string + * @returns {number} Byte length + */ +base64.length = function length(string) { + var p = string.length; + if (!p) + return 0; + var n = 0; + while (--p % 4 > 1 && string.charAt(p) === "=") + ++n; + return Math.ceil(string.length * 3) / 4 - n; +}; + +// Base64 encoding table +var b64 = new Array(64); + +// Base64 decoding table +var s64 = new Array(123); + +// 65..90, 97..122, 48..57, 43, 47 +for (var i = 0; i < 64;) + s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; + +/** + * Encodes a buffer to a base64 encoded string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} Base64 encoded string + */ +base64.encode = function encode(buffer, start, end) { + var parts = null, + chunk = []; + var i = 0, // output index + j = 0, // goto index + t; // temporary + while (start < end) { + var b = buffer[start++]; + switch (j) { + case 0: + chunk[i++] = b64[b >> 2]; + t = (b & 3) << 4; + j = 1; + break; + case 1: + chunk[i++] = b64[t | b >> 4]; + t = (b & 15) << 2; + j = 2; + break; + case 2: + chunk[i++] = b64[t | b >> 6]; + chunk[i++] = b64[b & 63]; + j = 0; + break; + } + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + i = 0; + } + } + if (j) { + chunk[i++] = b64[t]; + chunk[i++] = 61; + if (j === 1) + chunk[i++] = 61; + } + if (parts) { + if (i) + parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode.apply(String, chunk.slice(0, i)); +}; + +var invalidEncoding = "invalid encoding"; + +/** + * Decodes a base64 encoded string to a buffer. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Number of bytes written + * @throws {Error} If encoding is invalid + */ +base64.decode = function decode(string, buffer, offset) { + var start = offset; + var j = 0, // goto index + t; // temporary + for (var i = 0; i < string.length;) { + var c = string.charCodeAt(i++); + if (c === 61 && j > 1) + break; + if ((c = s64[c]) === undefined) + throw Error(invalidEncoding); + switch (j) { + case 0: + t = c; + j = 1; + break; + case 1: + buffer[offset++] = t << 2 | (c & 48) >> 4; + t = c; + j = 2; + break; + case 2: + buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; + t = c; + j = 3; + break; + case 3: + buffer[offset++] = (t & 3) << 6 | c; + j = 0; + break; + } + } + if (j === 1) + throw Error(invalidEncoding); + return offset - start; +}; + +/** + * Tests if the specified string appears to be base64 encoded. + * @param {string} string String to test + * @returns {boolean} `true` if probably base64 encoded, otherwise false + */ +base64.test = function test(string) { + return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); +}; + + +/***/ }), + +/***/ 9211: +/***/ (function(module) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BytesCoder\": function() { return /* binding */ BytesCoder; },\n/* harmony export */ \"DynamicBytesCoder\": function() { return /* binding */ DynamicBytesCoder; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n\n\n\nclass DynamicBytesCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(type, localName) {\n super(type, type, localName, true);\n }\n defaultValue() {\n return \"0x\";\n }\n encode(writer, value) {\n value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n decode(reader) {\n return reader.readBytes(reader.readValue().toNumber(), true);\n }\n}\nclass BytesCoder extends DynamicBytesCoder {\n constructor(localName) {\n super(\"bytes\", localName);\n }\n decode(reader) {\n return reader.coerce(this.name, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.hexlify)(super.decode(reader)));\n }\n}\n//# sourceMappingURL=bytes.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js?"); - -/***/ }), + +module.exports = EventEmitter; + +/** + * Constructs a new event emitter instance. + * @classdesc A minimal event emitter. + * @memberof util + * @constructor + */ +function EventEmitter() { + + /** + * Registered listeners. + * @type {Object.} + * @private + */ + this._listeners = {}; +} + +/** + * Registers an event listener. + * @param {string} evt Event name + * @param {function} fn Listener + * @param {*} [ctx] Listener context + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.on = function on(evt, fn, ctx) { + (this._listeners[evt] || (this._listeners[evt] = [])).push({ + fn : fn, + ctx : ctx || this + }); + return this; +}; + +/** + * Removes an event listener or any matching listeners if arguments are omitted. + * @param {string} [evt] Event name. Removes all listeners if omitted. + * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.off = function off(evt, fn) { + if (evt === undefined) + this._listeners = {}; + else { + if (fn === undefined) + this._listeners[evt] = []; + else { + var listeners = this._listeners[evt]; + for (var i = 0; i < listeners.length;) + if (listeners[i].fn === fn) + listeners.splice(i, 1); + else + ++i; + } + } + return this; +}; + +/** + * Emits an event by calling its listeners with the specified arguments. + * @param {string} evt Event name + * @param {...*} args Arguments + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.emit = function emit(evt) { + var listeners = this._listeners[evt]; + if (listeners) { + var args = [], + i = 1; + for (; i < arguments.length;) + args.push(arguments[i++]); + for (i = 0; i < listeners.length;) + listeners[i].fn.apply(listeners[i++].ctx, args); + } + return this; +}; + + +/***/ }), + +/***/ 945: +/***/ (function(module) { -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +"use strict"; + + +module.exports = factory(factory); + +/** + * Reads / writes floats / doubles from / to buffers. + * @name util.float + * @namespace + */ + +/** + * Writes a 32 bit float to a buffer using little endian byte order. + * @name util.float.writeFloatLE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Writes a 32 bit float to a buffer using big endian byte order. + * @name util.float.writeFloatBE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Reads a 32 bit float from a buffer using little endian byte order. + * @name util.float.readFloatLE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Reads a 32 bit float from a buffer using big endian byte order. + * @name util.float.readFloatBE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Writes a 64 bit double to a buffer using little endian byte order. + * @name util.float.writeDoubleLE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Writes a 64 bit double to a buffer using big endian byte order. + * @name util.float.writeDoubleBE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Reads a 64 bit double from a buffer using little endian byte order. + * @name util.float.readDoubleLE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Reads a 64 bit double from a buffer using big endian byte order. + * @name util.float.readDoubleBE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +// Factory function for the purpose of node-based testing in modified global environments +function factory(exports) { + + // float: typed array + if (typeof Float32Array !== "undefined") (function() { + + var f32 = new Float32Array([ -0 ]), + f8b = new Uint8Array(f32.buffer), + le = f8b[3] === 128; + + function writeFloat_f32_cpy(val, buf, pos) { + f32[0] = val; + buf[pos ] = f8b[0]; + buf[pos + 1] = f8b[1]; + buf[pos + 2] = f8b[2]; + buf[pos + 3] = f8b[3]; + } + + function writeFloat_f32_rev(val, buf, pos) { + f32[0] = val; + buf[pos ] = f8b[3]; + buf[pos + 1] = f8b[2]; + buf[pos + 2] = f8b[1]; + buf[pos + 3] = f8b[0]; + } + + /* istanbul ignore next */ + exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; + /* istanbul ignore next */ + exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; + + function readFloat_f32_cpy(buf, pos) { + f8b[0] = buf[pos ]; + f8b[1] = buf[pos + 1]; + f8b[2] = buf[pos + 2]; + f8b[3] = buf[pos + 3]; + return f32[0]; + } + + function readFloat_f32_rev(buf, pos) { + f8b[3] = buf[pos ]; + f8b[2] = buf[pos + 1]; + f8b[1] = buf[pos + 2]; + f8b[0] = buf[pos + 3]; + return f32[0]; + } + + /* istanbul ignore next */ + exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; + /* istanbul ignore next */ + exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; + + // float: ieee754 + })(); else (function() { + + function writeFloat_ieee754(writeUint, val, buf, pos) { + var sign = val < 0 ? 1 : 0; + if (sign) + val = -val; + if (val === 0) + writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); + else if (isNaN(val)) + writeUint(2143289344, buf, pos); + else if (val > 3.4028234663852886e+38) // +-Infinity + writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); + else if (val < 1.1754943508222875e-38) // denormal + writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); + else { + var exponent = Math.floor(Math.log(val) / Math.LN2), + mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; + writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); + } + } + + exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); + exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); + + function readFloat_ieee754(readUint, buf, pos) { + var uint = readUint(buf, pos), + sign = (uint >> 31) * 2 + 1, + exponent = uint >>> 23 & 255, + mantissa = uint & 8388607; + return exponent === 255 + ? mantissa + ? NaN + : sign * Infinity + : exponent === 0 // denormal + ? sign * 1.401298464324817e-45 * mantissa + : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); + } + + exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); + exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); + + })(); + + // double: typed array + if (typeof Float64Array !== "undefined") (function() { + + var f64 = new Float64Array([-0]), + f8b = new Uint8Array(f64.buffer), + le = f8b[7] === 128; + + function writeDouble_f64_cpy(val, buf, pos) { + f64[0] = val; + buf[pos ] = f8b[0]; + buf[pos + 1] = f8b[1]; + buf[pos + 2] = f8b[2]; + buf[pos + 3] = f8b[3]; + buf[pos + 4] = f8b[4]; + buf[pos + 5] = f8b[5]; + buf[pos + 6] = f8b[6]; + buf[pos + 7] = f8b[7]; + } + + function writeDouble_f64_rev(val, buf, pos) { + f64[0] = val; + buf[pos ] = f8b[7]; + buf[pos + 1] = f8b[6]; + buf[pos + 2] = f8b[5]; + buf[pos + 3] = f8b[4]; + buf[pos + 4] = f8b[3]; + buf[pos + 5] = f8b[2]; + buf[pos + 6] = f8b[1]; + buf[pos + 7] = f8b[0]; + } + + /* istanbul ignore next */ + exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; + /* istanbul ignore next */ + exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; + + function readDouble_f64_cpy(buf, pos) { + f8b[0] = buf[pos ]; + f8b[1] = buf[pos + 1]; + f8b[2] = buf[pos + 2]; + f8b[3] = buf[pos + 3]; + f8b[4] = buf[pos + 4]; + f8b[5] = buf[pos + 5]; + f8b[6] = buf[pos + 6]; + f8b[7] = buf[pos + 7]; + return f64[0]; + } + + function readDouble_f64_rev(buf, pos) { + f8b[7] = buf[pos ]; + f8b[6] = buf[pos + 1]; + f8b[5] = buf[pos + 2]; + f8b[4] = buf[pos + 3]; + f8b[3] = buf[pos + 4]; + f8b[2] = buf[pos + 5]; + f8b[1] = buf[pos + 6]; + f8b[0] = buf[pos + 7]; + return f64[0]; + } + + /* istanbul ignore next */ + exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; + /* istanbul ignore next */ + exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; + + // double: ieee754 + })(); else (function() { + + function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { + var sign = val < 0 ? 1 : 0; + if (sign) + val = -val; + if (val === 0) { + writeUint(0, buf, pos + off0); + writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); + } else if (isNaN(val)) { + writeUint(0, buf, pos + off0); + writeUint(2146959360, buf, pos + off1); + } else if (val > 1.7976931348623157e+308) { // +-Infinity + writeUint(0, buf, pos + off0); + writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); + } else { + var mantissa; + if (val < 2.2250738585072014e-308) { // denormal + mantissa = val / 5e-324; + writeUint(mantissa >>> 0, buf, pos + off0); + writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); + } else { + var exponent = Math.floor(Math.log(val) / Math.LN2); + if (exponent === 1024) + exponent = 1023; + mantissa = val * Math.pow(2, -exponent); + writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); + writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); + } + } + } + + exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); + exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); + + function readDouble_ieee754(readUint, off0, off1, buf, pos) { + var lo = readUint(buf, pos + off0), + hi = readUint(buf, pos + off1); + var sign = (hi >> 31) * 2 + 1, + exponent = hi >>> 20 & 2047, + mantissa = 4294967296 * (hi & 1048575) + lo; + return exponent === 2047 + ? mantissa + ? NaN + : sign * Infinity + : exponent === 0 // denormal + ? sign * 5e-324 * mantissa + : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); + } + + exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); + exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); + + })(); + + return exports; +} + +// uint helpers + +function writeUintLE(val, buf, pos) { + buf[pos ] = val & 255; + buf[pos + 1] = val >>> 8 & 255; + buf[pos + 2] = val >>> 16 & 255; + buf[pos + 3] = val >>> 24; +} + +function writeUintBE(val, buf, pos) { + buf[pos ] = val >>> 24; + buf[pos + 1] = val >>> 16 & 255; + buf[pos + 2] = val >>> 8 & 255; + buf[pos + 3] = val & 255; +} + +function readUintLE(buf, pos) { + return (buf[pos ] + | buf[pos + 1] << 8 + | buf[pos + 2] << 16 + | buf[pos + 3] << 24) >>> 0; +} + +function readUintBE(buf, pos) { + return (buf[pos ] << 24 + | buf[pos + 1] << 16 + | buf[pos + 2] << 8 + | buf[pos + 3]) >>> 0; +} + + +/***/ }), + +/***/ 7199: +/***/ (function(module) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FixedBytesCoder\": function() { return /* binding */ FixedBytesCoder; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n\n\n\n// @TODO: Merge this with bytes\nclass FixedBytesCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(size, localName) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n this.size = size;\n }\n defaultValue() {\n return (\"0x0000000000000000000000000000000000000000000000000000000000000000\").substring(0, 2 + this.size * 2);\n }\n encode(writer, value) {\n let data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(value);\n if (data.length !== this.size) {\n this._throwError(\"incorrect data length\", value);\n }\n return writer.writeBytes(data);\n }\n decode(reader) {\n return reader.coerce(this.name, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.hexlify)(reader.readBytes(this.size)));\n }\n}\n//# sourceMappingURL=fixed-bytes.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js?"); + +module.exports = inquire; + +/** + * Requires a module only if available. + * @memberof util + * @param {string} moduleName Module to require + * @returns {?Object} Required module if available and not empty, otherwise `null` + */ +function inquire(moduleName) { + try { + var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval + if (mod && (mod.length || Object.keys(mod).length)) + return mod; + } catch (e) {} // eslint-disable-line no-empty + return null; +} + + +/***/ }), + +/***/ 6662: +/***/ (function(module) { -/***/ }), +"use strict"; + +module.exports = pool; + +/** + * An allocator as used by {@link util.pool}. + * @typedef PoolAllocator + * @type {function} + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ + +/** + * A slicer as used by {@link util.pool}. + * @typedef PoolSlicer + * @type {function} + * @param {number} start Start offset + * @param {number} end End offset + * @returns {Uint8Array} Buffer slice + * @this {Uint8Array} + */ + +/** + * A general purpose buffer pool. + * @memberof util + * @function + * @param {PoolAllocator} alloc Allocator + * @param {PoolSlicer} slice Slicer + * @param {number} [size=8192] Slab size + * @returns {PoolAllocator} Pooled allocator + */ +function pool(alloc, slice, size) { + var SIZE = size || 8192; + var MAX = SIZE >>> 1; + var slab = null; + var offset = SIZE; + return function pool_alloc(size) { + if (size < 1 || size > MAX) + return alloc(size); + if (offset + size > SIZE) { + slab = alloc(SIZE); + offset = 0; + } + var buf = slice.call(slab, offset, offset += size); + if (offset & 7) // align to 32 bit + offset = (offset | 7) + 1; + return buf; + }; +} + + +/***/ }), + +/***/ 4997: +/***/ (function(__unused_webpack_module, exports) { -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/null.js": -/*!****************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/null.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +"use strict"; + + +/** + * A minimal UTF8 implementation for number arrays. + * @memberof util + * @namespace + */ +var utf8 = exports; + +/** + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length + */ +utf8.length = function utf8_length(string) { + var len = 0, + c = 0; + for (var i = 0; i < string.length; ++i) { + c = string.charCodeAt(i); + if (c < 128) + len += 1; + else if (c < 2048) + len += 2; + else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { + ++i; + len += 4; + } else + len += 3; + } + return len; +}; + +/** + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read + */ +utf8.read = function utf8_read(buffer, start, end) { + var len = end - start; + if (len < 1) + return ""; + var parts = null, + chunk = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) + chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; + else if (t > 239 && t < 365) { + t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; + chunk[i++] = 0xD800 + (t >> 10); + chunk[i++] = 0xDC00 + (t & 1023); + } else + chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + i = 0; + } + } + if (parts) { + if (i) + parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode.apply(String, chunk.slice(0, i)); +}; + +/** + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written + */ +utf8.write = function utf8_write(string, buffer, offset) { + var start = offset, + c1, // character 1 + c2; // character 2 + for (var i = 0; i < string.length; ++i) { + c1 = string.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = c1 >> 6 | 192; + buffer[offset++] = c1 & 63 | 128; + } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { + c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); + ++i; + buffer[offset++] = c1 >> 18 | 240; + buffer[offset++] = c1 >> 12 & 63 | 128; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; + } else { + buffer[offset++] = c1 >> 12 | 224; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; + } + } + return offset - start; +}; + + +/***/ }), + +/***/ 8826: +/***/ (function(module) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"NullCoder\": function() { return /* binding */ NullCoder; }\n/* harmony export */ });\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n\n\nclass NullCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(localName) {\n super(\"null\", \"\", localName, false);\n }\n defaultValue() {\n return null;\n }\n encode(writer, value) {\n if (value != null) {\n this._throwError(\"not null\", value);\n }\n return writer.writeBytes([]);\n }\n decode(reader) {\n reader.readBytes(0);\n return reader.coerce(this.name, null);\n }\n}\n//# sourceMappingURL=null.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/null.js?"); -/***/ }), -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/number.js": -/*!******************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/number.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +(function(root) { + + function checkInt(value) { + return (parseInt(value) === value); + } + + function checkInts(arrayish) { + if (!checkInt(arrayish.length)) { return false; } + + for (var i = 0; i < arrayish.length; i++) { + if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) { + return false; + } + } + + return true; + } + + function coerceArray(arg, copy) { + + // ArrayBuffer view + if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === 'Uint8Array') { + + if (copy) { + if (arg.slice) { + arg = arg.slice(); + } else { + arg = Array.prototype.slice.call(arg); + } + } + + return arg; + } + + // It's an array; check it is a valid representation of a byte + if (Array.isArray(arg)) { + if (!checkInts(arg)) { + throw new Error('Array contains invalid value: ' + arg); + } + + return new Uint8Array(arg); + } + + // Something else, but behaves like an array (maybe a Buffer? Arguments?) + if (checkInt(arg.length) && checkInts(arg)) { + return new Uint8Array(arg); + } + + throw new Error('unsupported array-like object'); + } + + function createArray(length) { + return new Uint8Array(length); + } + + function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) { + if (sourceStart != null || sourceEnd != null) { + if (sourceArray.slice) { + sourceArray = sourceArray.slice(sourceStart, sourceEnd); + } else { + sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd); + } + } + targetArray.set(sourceArray, targetStart); + } + + + + var convertUtf8 = (function() { + function toBytes(text) { + var result = [], i = 0; + text = encodeURI(text); + while (i < text.length) { + var c = text.charCodeAt(i++); + + // if it is a % sign, encode the following 2 bytes as a hex value + if (c === 37) { + result.push(parseInt(text.substr(i, 2), 16)) + i += 2; + + // otherwise, just the actual byte + } else { + result.push(c) + } + } + + return coerceArray(result); + } + + function fromBytes(bytes) { + var result = [], i = 0; + + while (i < bytes.length) { + var c = bytes[i]; + + if (c < 128) { + result.push(String.fromCharCode(c)); + i++; + } else if (c > 191 && c < 224) { + result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f))); + i += 2; + } else { + result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f))); + i += 3; + } + } + + return result.join(''); + } + + return { + toBytes: toBytes, + fromBytes: fromBytes, + } + })(); + + var convertHex = (function() { + function toBytes(text) { + var result = []; + for (var i = 0; i < text.length; i += 2) { + result.push(parseInt(text.substr(i, 2), 16)); + } + + return result; + } + + // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html + var Hex = '0123456789abcdef'; + + function fromBytes(bytes) { + var result = []; + for (var i = 0; i < bytes.length; i++) { + var v = bytes[i]; + result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]); + } + return result.join(''); + } + + return { + toBytes: toBytes, + fromBytes: fromBytes, + } + })(); + + + // Number of rounds by keysize + var numberOfRounds = {16: 10, 24: 12, 32: 14} + + // Round constant words + var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; + + // S-box and Inverse S-box (S is for Substitution) + var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]; + var Si =[0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; + + // Transformations for encryption + var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; + var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; + var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; + var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; + + // Transformations for decryption + var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; + var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; + var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; + var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; + + // Transformations for decryption key expansion + var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; + var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; + var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; + var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; + + function convertToInt32(bytes) { + var result = []; + for (var i = 0; i < bytes.length; i += 4) { + result.push( + (bytes[i ] << 24) | + (bytes[i + 1] << 16) | + (bytes[i + 2] << 8) | + bytes[i + 3] + ); + } + return result; + } + + var AES = function(key) { + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + + Object.defineProperty(this, 'key', { + value: coerceArray(key, true) + }); + + this._prepare(); + } + + + AES.prototype._prepare = function() { + + var rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new Error('invalid key size (must be 16, 24 or 32 bytes)'); + } + + // encryption round keys + this._Ke = []; + + // decryption round keys + this._Kd = []; + + for (var i = 0; i <= rounds; i++) { + this._Ke.push([0, 0, 0, 0]); + this._Kd.push([0, 0, 0, 0]); + } + + var roundKeyCount = (rounds + 1) * 4; + var KC = this.key.length / 4; + + // convert the key into ints + var tk = convertToInt32(this.key); + + // copy values into round key arrays + var index; + for (var i = 0; i < KC; i++) { + index = i >> 2; + this._Ke[index][i % 4] = tk[i]; + this._Kd[rounds - index][i % 4] = tk[i]; + } + + // key expansion (fips-197 section 5.2) + var rconpointer = 0; + var t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ + (S[(tt >> 8) & 0xFF] << 16) ^ + (S[ tt & 0xFF] << 8) ^ + S[(tt >> 24) & 0xFF] ^ + (rcon[rconpointer] << 24)); + rconpointer += 1; + + // key expansion (for non-256 bit) + if (KC != 8) { + for (var i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + + // key expansion for 256-bit keys is "slightly different" (fips-197) + } else { + for (var i = 1; i < (KC / 2); i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[(KC / 2) - 1]; + + tk[KC / 2] ^= (S[ tt & 0xFF] ^ + (S[(tt >> 8) & 0xFF] << 8) ^ + (S[(tt >> 16) & 0xFF] << 16) ^ + (S[(tt >> 24) & 0xFF] << 24)); + + for (var i = (KC / 2) + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + + // copy values into round key arrays + var i = 0, r, c; + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + this._Ke[r][c] = tk[i]; + this._Kd[rounds - r][c] = tk[i++]; + t++; + } + } + + // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + for (var r = 1; r < rounds; r++) { + for (var c = 0; c < 4; c++) { + tt = this._Kd[r][c]; + this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^ + U2[(tt >> 16) & 0xFF] ^ + U3[(tt >> 8) & 0xFF] ^ + U4[ tt & 0xFF]); + } + } + } + + AES.prototype.encrypt = function(plaintext) { + if (plaintext.length != 16) { + throw new Error('invalid plaintext size (must be 16 bytes)'); + } + + var rounds = this._Ke.length - 1; + var a = [0, 0, 0, 0]; + + // convert plaintext to (ints ^ key) + var t = convertToInt32(plaintext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Ke[0][i]; + } + + // apply round transforms + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = (T1[(t[ i ] >> 24) & 0xff] ^ + T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ + T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T4[ t[(i + 3) % 4] & 0xff] ^ + this._Ke[r][i]); + } + t = a.slice(); + } + + // the last round is special + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Ke[rounds][i]; + result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff; + } + + return result; + } + + AES.prototype.decrypt = function(ciphertext) { + if (ciphertext.length != 16) { + throw new Error('invalid ciphertext size (must be 16 bytes)'); + } + + var rounds = this._Kd.length - 1; + var a = [0, 0, 0, 0]; + + // convert plaintext to (ints ^ key) + var t = convertToInt32(ciphertext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Kd[0][i]; + } + + // apply round transforms + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = (T5[(t[ i ] >> 24) & 0xff] ^ + T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ + T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ + T8[ t[(i + 1) % 4] & 0xff] ^ + this._Kd[r][i]); + } + t = a.slice(); + } + + // the last round is special + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Kd[rounds][i]; + result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; + result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; + result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; + result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff; + } + + return result; + } + + + /** + * Mode Of Operation - Electonic Codebook (ECB) + */ + var ModeOfOperationECB = function(key) { + if (!(this instanceof ModeOfOperationECB)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Electronic Code Block"; + this.name = "ecb"; + + this._aes = new AES(key); + } + + ModeOfOperationECB.prototype.encrypt = function(plaintext) { + plaintext = coerceArray(plaintext); + + if ((plaintext.length % 16) !== 0) { + throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); + } + + var ciphertext = createArray(plaintext.length); + var block = createArray(16); + + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); + block = this._aes.encrypt(block); + copyArray(block, ciphertext, i); + } + + return ciphertext; + } + + ModeOfOperationECB.prototype.decrypt = function(ciphertext) { + ciphertext = coerceArray(ciphertext); + + if ((ciphertext.length % 16) !== 0) { + throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); + } + + var plaintext = createArray(ciphertext.length); + var block = createArray(16); + + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); + block = this._aes.decrypt(block); + copyArray(block, plaintext, i); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"NumberCoder\": function() { return /* binding */ NumberCoder; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/constants */ \"./node_modules/@ethersproject/constants/lib.esm/bignumbers.js\");\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n\n\n\n\nclass NumberCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(size, signed, localName) {\n const name = ((signed ? \"int\" : \"uint\") + (size * 8));\n super(name, name, localName, false);\n this.size = size;\n this.signed = signed;\n }\n defaultValue() {\n return 0;\n }\n encode(writer, value) {\n let v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__.BigNumber.from(value);\n // Check bounds are safe for encoding\n let maxUintValue = _ethersproject_constants__WEBPACK_IMPORTED_MODULE_2__.MaxUint256.mask(writer.wordSize * 8);\n if (this.signed) {\n let bounds = maxUintValue.mask(this.size * 8 - 1);\n if (v.gt(bounds) || v.lt(bounds.add(_ethersproject_constants__WEBPACK_IMPORTED_MODULE_2__.One).mul(_ethersproject_constants__WEBPACK_IMPORTED_MODULE_2__.NegativeOne))) {\n this._throwError(\"value out-of-bounds\", value);\n }\n }\n else if (v.lt(_ethersproject_constants__WEBPACK_IMPORTED_MODULE_2__.Zero) || v.gt(maxUintValue.mask(this.size * 8))) {\n this._throwError(\"value out-of-bounds\", value);\n }\n v = v.toTwos(this.size * 8).mask(this.size * 8);\n if (this.signed) {\n v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize);\n }\n return writer.writeValue(v);\n }\n decode(reader) {\n let value = reader.readValue().mask(this.size * 8);\n if (this.signed) {\n value = value.fromTwos(this.size * 8);\n }\n return reader.coerce(this.name, value);\n }\n}\n//# sourceMappingURL=number.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/number.js?"); + return plaintext; + } -/***/ }), -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/string.js": -/*!******************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/string.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + /** + * Mode Of Operation - Cipher Block Chaining (CBC) + */ + var ModeOfOperationCBC = function(key, iv) { + if (!(this instanceof ModeOfOperationCBC)) { + throw Error('AES must be instanitated with `new`'); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"StringCoder\": function() { return /* binding */ StringCoder; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/strings */ \"./node_modules/@ethersproject/strings/lib.esm/utf8.js\");\n/* harmony import */ var _bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bytes */ \"./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js\");\n\n\n\nclass StringCoder extends _bytes__WEBPACK_IMPORTED_MODULE_0__.DynamicBytesCoder {\n constructor(localName) {\n super(\"string\", localName);\n }\n defaultValue() {\n return \"\";\n }\n encode(writer, value) {\n return super.encode(writer, (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__.toUtf8Bytes)(value));\n }\n decode(reader) {\n return (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__.toUtf8String)(super.decode(reader));\n }\n}\n//# sourceMappingURL=string.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/string.js?"); + this.description = "Cipher Block Chaining"; + this.name = "cbc"; -/***/ }), + if (!iv) { + iv = createArray(16); -/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 bytes)'); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TupleCoder\": function() { return /* binding */ TupleCoder; }\n/* harmony export */ });\n/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n/* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./array */ \"./node_modules/@ethersproject/abi/lib.esm/coders/array.js\");\n\n\n\nclass TupleCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__.Coder {\n constructor(coders, localName) {\n let dynamic = false;\n const types = [];\n coders.forEach((coder) => {\n if (coder.dynamic) {\n dynamic = true;\n }\n types.push(coder.type);\n });\n const type = (\"tuple(\" + types.join(\",\") + \")\");\n super(\"tuple\", type, localName, dynamic);\n this.coders = coders;\n }\n defaultValue() {\n const values = [];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) {\n accum[name] = 0;\n }\n accum[name]++;\n }\n return accum;\n }, {});\n // Add named values\n this.coders.forEach((coder, index) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) {\n return;\n }\n if (name === \"length\") {\n name = \"_length\";\n }\n if (values[name] != null) {\n return;\n }\n values[name] = values[index];\n });\n return Object.freeze(values);\n }\n encode(writer, value) {\n return (0,_array__WEBPACK_IMPORTED_MODULE_1__.pack)(writer, this.coders, value);\n }\n decode(reader) {\n return reader.coerce(this.name, (0,_array__WEBPACK_IMPORTED_MODULE_1__.unpack)(reader, this.coders));\n }\n}\n//# sourceMappingURL=tuple.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js?"); + this._lastCipherblock = coerceArray(iv, true); -/***/ }), + this._aes = new AES(key); + } -/***/ "./node_modules/@ethersproject/abi/lib.esm/fragments.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/fragments.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + ModeOfOperationCBC.prototype.encrypt = function(plaintext) { + plaintext = coerceArray(plaintext); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ConstructorFragment\": function() { return /* binding */ ConstructorFragment; },\n/* harmony export */ \"ErrorFragment\": function() { return /* binding */ ErrorFragment; },\n/* harmony export */ \"EventFragment\": function() { return /* binding */ EventFragment; },\n/* harmony export */ \"FormatTypes\": function() { return /* binding */ FormatTypes; },\n/* harmony export */ \"Fragment\": function() { return /* binding */ Fragment; },\n/* harmony export */ \"FunctionFragment\": function() { return /* binding */ FunctionFragment; },\n/* harmony export */ \"ParamType\": function() { return /* binding */ ParamType; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/abi/lib.esm/_version.js\");\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n;\nconst _constructorGuard = {};\nlet ModifiersBytes = { calldata: true, memory: true, storage: true };\nlet ModifiersNest = { calldata: true, memory: true };\nfunction checkModifier(type, name) {\n if (type === \"bytes\" || type === \"string\") {\n if (ModifiersBytes[name]) {\n return true;\n }\n }\n else if (type === \"address\") {\n if (name === \"payable\") {\n return true;\n }\n }\n else if (type.indexOf(\"[\") >= 0 || type === \"tuple\") {\n if (ModifiersNest[name]) {\n return true;\n }\n }\n if (ModifiersBytes[name] || name === \"payable\") {\n logger.throwArgumentError(\"invalid modifier\", \"name\", name);\n }\n return false;\n}\n// @TODO: Make sure that children of an indexed tuple are marked with a null indexed\nfunction parseParamType(param, allowIndexed) {\n let originalParam = param;\n function throwError(i) {\n logger.throwArgumentError(`unexpected character at position ${i}`, \"param\", param);\n }\n param = param.replace(/\\s/g, \" \");\n function newNode(parent) {\n let node = { type: \"\", name: \"\", parent: parent, state: { allowType: true } };\n if (allowIndexed) {\n node.indexed = false;\n }\n return node;\n }\n let parent = { type: \"\", name: \"\", state: { allowType: true } };\n let node = parent;\n for (let i = 0; i < param.length; i++) {\n let c = param[i];\n switch (c) {\n case \"(\":\n if (node.state.allowType && node.type === \"\") {\n node.type = \"tuple\";\n }\n else if (!node.state.allowParams) {\n throwError(i);\n }\n node.state.allowType = false;\n node.type = verifyType(node.type);\n node.components = [newNode(node)];\n node = node.components[0];\n break;\n case \")\":\n delete node.state;\n if (node.name === \"indexed\") {\n if (!allowIndexed) {\n throwError(i);\n }\n node.indexed = true;\n node.name = \"\";\n }\n if (checkModifier(node.type, node.name)) {\n node.name = \"\";\n }\n node.type = verifyType(node.type);\n let child = node;\n node = node.parent;\n if (!node) {\n throwError(i);\n }\n delete child.parent;\n node.state.allowParams = false;\n node.state.allowName = true;\n node.state.allowArray = true;\n break;\n case \",\":\n delete node.state;\n if (node.name === \"indexed\") {\n if (!allowIndexed) {\n throwError(i);\n }\n node.indexed = true;\n node.name = \"\";\n }\n if (checkModifier(node.type, node.name)) {\n node.name = \"\";\n }\n node.type = verifyType(node.type);\n let sibling = newNode(node.parent);\n //{ type: \"\", name: \"\", parent: node.parent, state: { allowType: true } };\n node.parent.components.push(sibling);\n delete node.parent;\n node = sibling;\n break;\n // Hit a space...\n case \" \":\n // If reading type, the type is done and may read a param or name\n if (node.state.allowType) {\n if (node.type !== \"\") {\n node.type = verifyType(node.type);\n delete node.state.allowType;\n node.state.allowName = true;\n node.state.allowParams = true;\n }\n }\n // If reading name, the name is done\n if (node.state.allowName) {\n if (node.name !== \"\") {\n if (node.name === \"indexed\") {\n if (!allowIndexed) {\n throwError(i);\n }\n if (node.indexed) {\n throwError(i);\n }\n node.indexed = true;\n node.name = \"\";\n }\n else if (checkModifier(node.type, node.name)) {\n node.name = \"\";\n }\n else {\n node.state.allowName = false;\n }\n }\n }\n break;\n case \"[\":\n if (!node.state.allowArray) {\n throwError(i);\n }\n node.type += c;\n node.state.allowArray = false;\n node.state.allowName = false;\n node.state.readArray = true;\n break;\n case \"]\":\n if (!node.state.readArray) {\n throwError(i);\n }\n node.type += c;\n node.state.readArray = false;\n node.state.allowArray = true;\n node.state.allowName = true;\n break;\n default:\n if (node.state.allowType) {\n node.type += c;\n node.state.allowParams = true;\n node.state.allowArray = true;\n }\n else if (node.state.allowName) {\n node.name += c;\n delete node.state.allowArray;\n }\n else if (node.state.readArray) {\n node.type += c;\n }\n else {\n throwError(i);\n }\n }\n }\n if (node.parent) {\n logger.throwArgumentError(\"unexpected eof\", \"param\", param);\n }\n delete parent.state;\n if (node.name === \"indexed\") {\n if (!allowIndexed) {\n throwError(originalParam.length - 7);\n }\n if (node.indexed) {\n throwError(originalParam.length - 7);\n }\n node.indexed = true;\n node.name = \"\";\n }\n else if (checkModifier(node.type, node.name)) {\n node.name = \"\";\n }\n parent.type = verifyType(parent.type);\n return parent;\n}\nfunction populate(object, params) {\n for (let key in params) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(object, key, params[key]);\n }\n}\nconst FormatTypes = Object.freeze({\n // Bare formatting, as is needed for computing a sighash of an event or function\n sighash: \"sighash\",\n // Human-Readable with Minimal spacing and without names (compact human-readable)\n minimal: \"minimal\",\n // Human-Readable with nice spacing, including all names\n full: \"full\",\n // JSON-format a la Solidity\n json: \"json\"\n});\nconst paramTypeArray = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\nclass ParamType {\n constructor(constructorGuard, params) {\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"use fromString\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new ParamType()\"\n });\n }\n populate(this, params);\n let match = this.type.match(paramTypeArray);\n if (match) {\n populate(this, {\n arrayLength: parseInt(match[2] || \"-1\"),\n arrayChildren: ParamType.fromObject({\n type: match[1],\n components: this.components\n }),\n baseType: \"array\"\n });\n }\n else {\n populate(this, {\n arrayLength: null,\n arrayChildren: null,\n baseType: ((this.components != null) ? \"tuple\" : this.type)\n });\n }\n this._isParamType = true;\n Object.freeze(this);\n }\n // Format the parameter fragment\n // - sighash: \"(uint256,address)\"\n // - minimal: \"tuple(uint256,address) indexed\"\n // - full: \"tuple(uint256 foo, address bar) indexed baz\"\n format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n if (format === FormatTypes.json) {\n let result = {\n type: ((this.baseType === \"tuple\") ? \"tuple\" : this.type),\n name: (this.name || undefined)\n };\n if (typeof (this.indexed) === \"boolean\") {\n result.indexed = this.indexed;\n }\n if (this.components) {\n result.components = this.components.map((comp) => JSON.parse(comp.format(format)));\n }\n return JSON.stringify(result);\n }\n let result = \"\";\n // Array\n if (this.baseType === \"array\") {\n result += this.arrayChildren.format(format);\n result += \"[\" + (this.arrayLength < 0 ? \"\" : String(this.arrayLength)) + \"]\";\n }\n else {\n if (this.baseType === \"tuple\") {\n if (format !== FormatTypes.sighash) {\n result += this.type;\n }\n result += \"(\" + this.components.map((comp) => comp.format(format)).join((format === FormatTypes.full) ? \", \" : \",\") + \")\";\n }\n else {\n result += this.type;\n }\n }\n if (format !== FormatTypes.sighash) {\n if (this.indexed === true) {\n result += \" indexed\";\n }\n if (format === FormatTypes.full && this.name) {\n result += \" \" + this.name;\n }\n }\n return result;\n }\n static from(value, allowIndexed) {\n if (typeof (value) === \"string\") {\n return ParamType.fromString(value, allowIndexed);\n }\n return ParamType.fromObject(value);\n }\n static fromObject(value) {\n if (ParamType.isParamType(value)) {\n return value;\n }\n return new ParamType(_constructorGuard, {\n name: (value.name || null),\n type: verifyType(value.type),\n indexed: ((value.indexed == null) ? null : !!value.indexed),\n components: (value.components ? value.components.map(ParamType.fromObject) : null)\n });\n }\n static fromString(value, allowIndexed) {\n function ParamTypify(node) {\n return ParamType.fromObject({\n name: node.name,\n type: node.type,\n indexed: node.indexed,\n components: node.components\n });\n }\n return ParamTypify(parseParamType(value, !!allowIndexed));\n }\n static isParamType(value) {\n return !!(value != null && value._isParamType);\n }\n}\n;\nfunction parseParams(value, allowIndex) {\n return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex));\n}\nclass Fragment {\n constructor(constructorGuard, params) {\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"use a static from method\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new Fragment()\"\n });\n }\n populate(this, params);\n this._isFragment = true;\n Object.freeze(this);\n }\n static from(value) {\n if (Fragment.isFragment(value)) {\n return value;\n }\n if (typeof (value) === \"string\") {\n return Fragment.fromString(value);\n }\n return Fragment.fromObject(value);\n }\n static fromObject(value) {\n if (Fragment.isFragment(value)) {\n return value;\n }\n switch (value.type) {\n case \"function\":\n return FunctionFragment.fromObject(value);\n case \"event\":\n return EventFragment.fromObject(value);\n case \"constructor\":\n return ConstructorFragment.fromObject(value);\n case \"error\":\n return ErrorFragment.fromObject(value);\n case \"fallback\":\n case \"receive\":\n // @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?\n return null;\n }\n return logger.throwArgumentError(\"invalid fragment object\", \"value\", value);\n }\n static fromString(value) {\n // Make sure the \"returns\" is surrounded by a space and all whitespace is exactly one space\n value = value.replace(/\\s/g, \" \");\n value = value.replace(/\\(/g, \" (\").replace(/\\)/g, \") \").replace(/\\s+/g, \" \");\n value = value.trim();\n if (value.split(\" \")[0] === \"event\") {\n return EventFragment.fromString(value.substring(5).trim());\n }\n else if (value.split(\" \")[0] === \"function\") {\n return FunctionFragment.fromString(value.substring(8).trim());\n }\n else if (value.split(\"(\")[0].trim() === \"constructor\") {\n return ConstructorFragment.fromString(value.trim());\n }\n else if (value.split(\" \")[0] === \"error\") {\n return ErrorFragment.fromString(value.substring(5).trim());\n }\n return logger.throwArgumentError(\"unsupported fragment\", \"value\", value);\n }\n static isFragment(value) {\n return !!(value && value._isFragment);\n }\n}\nclass EventFragment extends Fragment {\n format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format)))\n });\n }\n let result = \"\";\n if (format !== FormatTypes.sighash) {\n result += \"event \";\n }\n result += this.name + \"(\" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? \", \" : \",\") + \") \";\n if (format !== FormatTypes.sighash) {\n if (this.anonymous) {\n result += \"anonymous \";\n }\n }\n return result.trim();\n }\n static from(value) {\n if (typeof (value) === \"string\") {\n return EventFragment.fromString(value);\n }\n return EventFragment.fromObject(value);\n }\n static fromObject(value) {\n if (EventFragment.isEventFragment(value)) {\n return value;\n }\n if (value.type !== \"event\") {\n logger.throwArgumentError(\"invalid event object\", \"value\", value);\n }\n const params = {\n name: verifyIdentifier(value.name),\n anonymous: value.anonymous,\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),\n type: \"event\"\n };\n return new EventFragment(_constructorGuard, params);\n }\n static fromString(value) {\n let match = value.match(regexParen);\n if (!match) {\n logger.throwArgumentError(\"invalid event string\", \"value\", value);\n }\n let anonymous = false;\n match[3].split(\" \").forEach((modifier) => {\n switch (modifier.trim()) {\n case \"anonymous\":\n anonymous = true;\n break;\n case \"\":\n break;\n default:\n logger.warn(\"unknown modifier: \" + modifier);\n }\n });\n return EventFragment.fromObject({\n name: match[1].trim(),\n anonymous: anonymous,\n inputs: parseParams(match[2], true),\n type: \"event\"\n });\n }\n static isEventFragment(value) {\n return (value && value._isFragment && value.type === \"event\");\n }\n}\nfunction parseGas(value, params) {\n params.gas = null;\n let comps = value.split(\"@\");\n if (comps.length !== 1) {\n if (comps.length > 2) {\n logger.throwArgumentError(\"invalid human-readable ABI signature\", \"value\", value);\n }\n if (!comps[1].match(/^[0-9]+$/)) {\n logger.throwArgumentError(\"invalid human-readable ABI signature gas\", \"value\", value);\n }\n params.gas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(comps[1]);\n return comps[0];\n }\n return value;\n}\nfunction parseModifiers(value, params) {\n params.constant = false;\n params.payable = false;\n params.stateMutability = \"nonpayable\";\n value.split(\" \").forEach((modifier) => {\n switch (modifier.trim()) {\n case \"constant\":\n params.constant = true;\n break;\n case \"payable\":\n params.payable = true;\n params.stateMutability = \"payable\";\n break;\n case \"nonpayable\":\n params.payable = false;\n params.stateMutability = \"nonpayable\";\n break;\n case \"pure\":\n params.constant = true;\n params.stateMutability = \"pure\";\n break;\n case \"view\":\n params.constant = true;\n params.stateMutability = \"view\";\n break;\n case \"external\":\n case \"public\":\n case \"\":\n break;\n default:\n console.log(\"unknown modifier: \" + modifier);\n }\n });\n}\nfunction verifyState(value) {\n let result = {\n constant: false,\n payable: true,\n stateMutability: \"payable\"\n };\n if (value.stateMutability != null) {\n result.stateMutability = value.stateMutability;\n // Set (and check things are consistent) the constant property\n result.constant = (result.stateMutability === \"view\" || result.stateMutability === \"pure\");\n if (value.constant != null) {\n if ((!!value.constant) !== result.constant) {\n logger.throwArgumentError(\"cannot have constant function with mutability \" + result.stateMutability, \"value\", value);\n }\n }\n // Set (and check things are consistent) the payable property\n result.payable = (result.stateMutability === \"payable\");\n if (value.payable != null) {\n if ((!!value.payable) !== result.payable) {\n logger.throwArgumentError(\"cannot have payable function with mutability \" + result.stateMutability, \"value\", value);\n }\n }\n }\n else if (value.payable != null) {\n result.payable = !!value.payable;\n // If payable we can assume non-constant; otherwise we can't assume\n if (value.constant == null && !result.payable && value.type !== \"constructor\") {\n logger.throwArgumentError(\"unable to determine stateMutability\", \"value\", value);\n }\n result.constant = !!value.constant;\n if (result.constant) {\n result.stateMutability = \"view\";\n }\n else {\n result.stateMutability = (result.payable ? \"payable\" : \"nonpayable\");\n }\n if (result.payable && result.constant) {\n logger.throwArgumentError(\"cannot have constant payable function\", \"value\", value);\n }\n }\n else if (value.constant != null) {\n result.constant = !!value.constant;\n result.payable = !result.constant;\n result.stateMutability = (result.constant ? \"view\" : \"payable\");\n }\n else if (value.type !== \"constructor\") {\n logger.throwArgumentError(\"unable to determine stateMutability\", \"value\", value);\n }\n return result;\n}\nclass ConstructorFragment extends Fragment {\n format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability : undefined),\n payable: this.payable,\n gas: (this.gas ? this.gas.toNumber() : undefined),\n inputs: this.inputs.map((input) => JSON.parse(input.format(format)))\n });\n }\n if (format === FormatTypes.sighash) {\n logger.throwError(\"cannot format a constructor for sighash\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"format(sighash)\"\n });\n }\n let result = \"constructor(\" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? \", \" : \",\") + \") \";\n if (this.stateMutability && this.stateMutability !== \"nonpayable\") {\n result += this.stateMutability + \" \";\n }\n return result.trim();\n }\n static from(value) {\n if (typeof (value) === \"string\") {\n return ConstructorFragment.fromString(value);\n }\n return ConstructorFragment.fromObject(value);\n }\n static fromObject(value) {\n if (ConstructorFragment.isConstructorFragment(value)) {\n return value;\n }\n if (value.type !== \"constructor\") {\n logger.throwArgumentError(\"invalid constructor object\", \"value\", value);\n }\n let state = verifyState(value);\n if (state.constant) {\n logger.throwArgumentError(\"constructor cannot be constant\", \"value\", value);\n }\n const params = {\n name: null,\n type: value.type,\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),\n payable: state.payable,\n stateMutability: state.stateMutability,\n gas: (value.gas ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(value.gas) : null)\n };\n return new ConstructorFragment(_constructorGuard, params);\n }\n static fromString(value) {\n let params = { type: \"constructor\" };\n value = parseGas(value, params);\n let parens = value.match(regexParen);\n if (!parens || parens[1].trim() !== \"constructor\") {\n logger.throwArgumentError(\"invalid constructor string\", \"value\", value);\n }\n params.inputs = parseParams(parens[2].trim(), false);\n parseModifiers(parens[3].trim(), params);\n return ConstructorFragment.fromObject(params);\n }\n static isConstructorFragment(value) {\n return (value && value._isFragment && value.type === \"constructor\");\n }\n}\nclass FunctionFragment extends ConstructorFragment {\n format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability : undefined),\n payable: this.payable,\n gas: (this.gas ? this.gas.toNumber() : undefined),\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n outputs: this.outputs.map((output) => JSON.parse(output.format(format))),\n });\n }\n let result = \"\";\n if (format !== FormatTypes.sighash) {\n result += \"function \";\n }\n result += this.name + \"(\" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? \", \" : \",\") + \") \";\n if (format !== FormatTypes.sighash) {\n if (this.stateMutability) {\n if (this.stateMutability !== \"nonpayable\") {\n result += (this.stateMutability + \" \");\n }\n }\n else if (this.constant) {\n result += \"view \";\n }\n if (this.outputs && this.outputs.length) {\n result += \"returns (\" + this.outputs.map((output) => output.format(format)).join(\", \") + \") \";\n }\n if (this.gas != null) {\n result += \"@\" + this.gas.toString() + \" \";\n }\n }\n return result.trim();\n }\n static from(value) {\n if (typeof (value) === \"string\") {\n return FunctionFragment.fromString(value);\n }\n return FunctionFragment.fromObject(value);\n }\n static fromObject(value) {\n if (FunctionFragment.isFunctionFragment(value)) {\n return value;\n }\n if (value.type !== \"function\") {\n logger.throwArgumentError(\"invalid function object\", \"value\", value);\n }\n let state = verifyState(value);\n const params = {\n type: value.type,\n name: verifyIdentifier(value.name),\n constant: state.constant,\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),\n outputs: (value.outputs ? value.outputs.map(ParamType.fromObject) : []),\n payable: state.payable,\n stateMutability: state.stateMutability,\n gas: (value.gas ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__.BigNumber.from(value.gas) : null)\n };\n return new FunctionFragment(_constructorGuard, params);\n }\n static fromString(value) {\n let params = { type: \"function\" };\n value = parseGas(value, params);\n let comps = value.split(\" returns \");\n if (comps.length > 2) {\n logger.throwArgumentError(\"invalid function string\", \"value\", value);\n }\n let parens = comps[0].match(regexParen);\n if (!parens) {\n logger.throwArgumentError(\"invalid function signature\", \"value\", value);\n }\n params.name = parens[1].trim();\n if (params.name) {\n verifyIdentifier(params.name);\n }\n params.inputs = parseParams(parens[2], false);\n parseModifiers(parens[3].trim(), params);\n // We have outputs\n if (comps.length > 1) {\n let returns = comps[1].match(regexParen);\n if (returns[1].trim() != \"\" || returns[3].trim() != \"\") {\n logger.throwArgumentError(\"unexpected tokens\", \"value\", value);\n }\n params.outputs = parseParams(returns[2], false);\n }\n else {\n params.outputs = [];\n }\n return FunctionFragment.fromObject(params);\n }\n static isFunctionFragment(value) {\n return (value && value._isFragment && value.type === \"function\");\n }\n}\n//export class StructFragment extends Fragment {\n//}\nfunction checkForbidden(fragment) {\n const sig = fragment.format();\n if (sig === \"Error(string)\" || sig === \"Panic(uint256)\") {\n logger.throwArgumentError(`cannot specify user defined ${sig} error`, \"fragment\", fragment);\n }\n return fragment;\n}\nclass ErrorFragment extends Fragment {\n format(format) {\n if (!format) {\n format = FormatTypes.sighash;\n }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n let result = \"\";\n if (format !== FormatTypes.sighash) {\n result += \"error \";\n }\n result += this.name + \"(\" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? \", \" : \",\") + \") \";\n return result.trim();\n }\n static from(value) {\n if (typeof (value) === \"string\") {\n return ErrorFragment.fromString(value);\n }\n return ErrorFragment.fromObject(value);\n }\n static fromObject(value) {\n if (ErrorFragment.isErrorFragment(value)) {\n return value;\n }\n if (value.type !== \"error\") {\n logger.throwArgumentError(\"invalid error object\", \"value\", value);\n }\n const params = {\n type: value.type,\n name: verifyIdentifier(value.name),\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : [])\n };\n return checkForbidden(new ErrorFragment(_constructorGuard, params));\n }\n static fromString(value) {\n let params = { type: \"error\" };\n let parens = value.match(regexParen);\n if (!parens) {\n logger.throwArgumentError(\"invalid error signature\", \"value\", value);\n }\n params.name = parens[1].trim();\n if (params.name) {\n verifyIdentifier(params.name);\n }\n params.inputs = parseParams(parens[2], false);\n return checkForbidden(ErrorFragment.fromObject(params));\n }\n static isErrorFragment(value) {\n return (value && value._isFragment && value.type === \"error\");\n }\n}\nfunction verifyType(type) {\n // These need to be transformed to their full description\n if (type.match(/^uint($|[^1-9])/)) {\n type = \"uint256\" + type.substring(4);\n }\n else if (type.match(/^int($|[^1-9])/)) {\n type = \"int256\" + type.substring(3);\n }\n // @TODO: more verification\n return type;\n}\n// See: https://github.com/ethereum/solidity/blob/1f8f1a3db93a548d0555e3e14cfc55a10e25b60e/docs/grammar/SolidityLexer.g4#L234\nconst regexIdentifier = new RegExp(\"^[a-zA-Z$_][a-zA-Z0-9$_]*$\");\nfunction verifyIdentifier(value) {\n if (!value || !value.match(regexIdentifier)) {\n logger.throwArgumentError(`invalid identifier \"${value}\"`, \"value\", value);\n }\n return value;\n}\nconst regexParen = new RegExp(\"^([^)(]*)\\\\((.*)\\\\)([^)(]*)$\");\nfunction splitNesting(value) {\n value = value.trim();\n let result = [];\n let accum = \"\";\n let depth = 0;\n for (let offset = 0; offset < value.length; offset++) {\n let c = value[offset];\n if (c === \",\" && depth === 0) {\n result.push(accum);\n accum = \"\";\n }\n else {\n accum += c;\n if (c === \"(\") {\n depth++;\n }\n else if (c === \")\") {\n depth--;\n if (depth === -1) {\n logger.throwArgumentError(\"unbalanced parenthesis\", \"value\", value);\n }\n }\n }\n }\n if (accum) {\n result.push(accum);\n }\n return result;\n}\n//# sourceMappingURL=fragments.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/fragments.js?"); + if ((plaintext.length % 16) !== 0) { + throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); + } -/***/ }), + var ciphertext = createArray(plaintext.length); + var block = createArray(16); -/***/ "./node_modules/@ethersproject/abi/lib.esm/interface.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/abi/lib.esm/interface.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ErrorDescription\": function() { return /* binding */ ErrorDescription; },\n/* harmony export */ \"Indexed\": function() { return /* binding */ Indexed; },\n/* harmony export */ \"Interface\": function() { return /* binding */ Interface; },\n/* harmony export */ \"LogDescription\": function() { return /* binding */ LogDescription; },\n/* harmony export */ \"TransactionDescription\": function() { return /* binding */ TransactionDescription; },\n/* harmony export */ \"checkResultErrors\": function() { return /* reexport safe */ _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_2__.checkResultErrors; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/address */ \"./node_modules/@ethersproject/address/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/hash */ \"./node_modules/@ethersproject/hash/lib.esm/id.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _abi_coder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./abi-coder */ \"./node_modules/@ethersproject/abi/lib.esm/abi-coder.js\");\n/* harmony import */ var _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./coders/abstract-coder */ \"./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js\");\n/* harmony import */ var _fragments__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fragments */ \"./node_modules/@ethersproject/abi/lib.esm/fragments.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/abi/lib.esm/_version.js\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n\nclass LogDescription extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.Description {\n}\nclass TransactionDescription extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.Description {\n}\nclass ErrorDescription extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.Description {\n}\nclass Indexed extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.Description {\n static isIndexed(value) {\n return !!(value && value._isIndexed);\n }\n}\nconst BuiltinErrors = {\n \"0x08c379a0\": { signature: \"Error(string)\", name: \"Error\", inputs: [\"string\"], reason: true },\n \"0x4e487b71\": { signature: \"Panic(uint256)\", name: \"Panic\", inputs: [\"uint256\"] }\n};\nfunction wrapAccessError(property, error) {\n const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);\n wrap.error = error;\n return wrap;\n}\n/*\nfunction checkNames(fragment: Fragment, type: \"input\" | \"output\", params: Array): void {\n params.reduce((accum, param) => {\n if (param.name) {\n if (accum[param.name]) {\n logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format(\"full\") }`, \"fragment\", fragment);\n }\n accum[param.name] = true;\n }\n return accum;\n }, <{ [ name: string ]: boolean }>{ });\n}\n*/\nclass Interface {\n constructor(fragments) {\n logger.checkNew(new.target, Interface);\n let abi = [];\n if (typeof (fragments) === \"string\") {\n abi = JSON.parse(fragments);\n }\n else {\n abi = fragments;\n }\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"fragments\", abi.map((fragment) => {\n return _fragments__WEBPACK_IMPORTED_MODULE_4__.Fragment.from(fragment);\n }).filter((fragment) => (fragment != null)));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"_abiCoder\", (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.getStatic)(new.target, \"getAbiCoder\")());\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"functions\", {});\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"errors\", {});\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"events\", {});\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"structs\", {});\n // Add all fragments by their signature\n this.fragments.forEach((fragment) => {\n let bucket = null;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n logger.warn(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"deploy\", fragment);\n return;\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (fragment).outputs);\n bucket = this.functions;\n break;\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.events;\n break;\n case \"error\":\n bucket = this.errors;\n break;\n default:\n return;\n }\n let signature = fragment.format();\n if (bucket[signature]) {\n logger.warn(\"duplicate definition - \" + signature);\n return;\n }\n bucket[signature] = fragment;\n });\n // If we do not have a constructor add a default\n if (!this.deploy) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"deploy\", _fragments__WEBPACK_IMPORTED_MODULE_4__.ConstructorFragment.from({\n payable: false,\n type: \"constructor\"\n }));\n }\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"_isInterface\", true);\n }\n format(format) {\n if (!format) {\n format = _fragments__WEBPACK_IMPORTED_MODULE_4__.FormatTypes.full;\n }\n if (format === _fragments__WEBPACK_IMPORTED_MODULE_4__.FormatTypes.sighash) {\n logger.throwArgumentError(\"interface does not support formatting sighash\", \"format\", format);\n }\n const abi = this.fragments.map((fragment) => fragment.format(format));\n // We need to re-bundle the JSON fragments a bit\n if (format === _fragments__WEBPACK_IMPORTED_MODULE_4__.FormatTypes.json) {\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n return abi;\n }\n // Sub-classes can override these to handle other blockchains\n static getAbiCoder() {\n return _abi_coder__WEBPACK_IMPORTED_MODULE_5__.defaultAbiCoder;\n }\n static getAddress(address) {\n return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_6__.getAddress)(address);\n }\n static getSighash(fragment) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexDataSlice)((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__.id)(fragment.format()), 0, 4);\n }\n static getEventTopic(eventFragment) {\n return (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__.id)(eventFragment.format());\n }\n // Find a function definition by any means necessary (unless it is ambiguous)\n getFunction(nameOrSignatureOrSighash) {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.isHexString)(nameOrSignatureOrSighash)) {\n for (const name in this.functions) {\n if (nameOrSignatureOrSighash === this.getSighash(name)) {\n return this.functions[name];\n }\n }\n logger.throwArgumentError(\"no matching function\", \"sighash\", nameOrSignatureOrSighash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrSighash.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrSighash.trim();\n const matching = Object.keys(this.functions).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching function\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching functions\", \"name\", name);\n }\n return this.functions[matching[0]];\n }\n // Normalize the signature and lookup the function\n const result = this.functions[_fragments__WEBPACK_IMPORTED_MODULE_4__.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching function\", \"signature\", nameOrSignatureOrSighash);\n }\n return result;\n }\n // Find an event definition by any means necessary (unless it is ambiguous)\n getEvent(nameOrSignatureOrTopic) {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.isHexString)(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normalize the signature and lookup the function\n const result = this.events[_fragments__WEBPACK_IMPORTED_MODULE_4__.EventFragment.fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }\n // Find a function definition by any means necessary (unless it is ambiguous)\n getError(nameOrSignatureOrSighash) {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.isHexString)(nameOrSignatureOrSighash)) {\n const getSighash = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.getStatic)(this.constructor, \"getSighash\");\n for (const name in this.errors) {\n const error = this.errors[name];\n if (nameOrSignatureOrSighash === getSighash(error)) {\n return this.errors[name];\n }\n }\n logger.throwArgumentError(\"no matching error\", \"sighash\", nameOrSignatureOrSighash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrSighash.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrSighash.trim();\n const matching = Object.keys(this.errors).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching error\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching errors\", \"name\", name);\n }\n return this.errors[matching[0]];\n }\n // Normalize the signature and lookup the function\n const result = this.errors[_fragments__WEBPACK_IMPORTED_MODULE_4__.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching error\", \"signature\", nameOrSignatureOrSighash);\n }\n return result;\n }\n // Get the sighash (the bytes4 selector) used by Solidity to identify a function\n getSighash(fragment) {\n if (typeof (fragment) === \"string\") {\n try {\n fragment = this.getFunction(fragment);\n }\n catch (error) {\n try {\n fragment = this.getError(fragment);\n }\n catch (_) {\n throw error;\n }\n }\n }\n return (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.getStatic)(this.constructor, \"getSighash\")(fragment);\n }\n // Get the topic (the bytes32 hash) used by Solidity to identify an event\n getEventTopic(eventFragment) {\n if (typeof (eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n return (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.getStatic)(this.constructor, \"getEventTopic\")(eventFragment);\n }\n _decodeParams(params, data) {\n return this._abiCoder.decode(params, data);\n }\n _encodeParams(params, values) {\n return this._abiCoder.encode(params, values);\n }\n encodeDeploy(values) {\n return this._encodeParams(this.deploy.inputs, values || []);\n }\n decodeErrorResult(fragment, data) {\n if (typeof (fragment) === \"string\") {\n fragment = this.getError(fragment);\n }\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.arrayify)(data);\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(bytes.slice(0, 4)) !== this.getSighash(fragment)) {\n logger.throwArgumentError(`data signature does not match error ${fragment.name}.`, \"data\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(bytes));\n }\n return this._decodeParams(fragment.inputs, bytes.slice(4));\n }\n encodeErrorResult(fragment, values) {\n if (typeof (fragment) === \"string\") {\n fragment = this.getError(fragment);\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.concat)([\n this.getSighash(fragment),\n this._encodeParams(fragment.inputs, values || [])\n ]));\n }\n // Decode the data for a function call (e.g. tx.data)\n decodeFunctionData(functionFragment, data) {\n if (typeof (functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.arrayify)(data);\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {\n logger.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, \"data\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(bytes));\n }\n return this._decodeParams(functionFragment.inputs, bytes.slice(4));\n }\n // Encode the data for a function call (e.g. tx.data)\n encodeFunctionData(functionFragment, values) {\n if (typeof (functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.concat)([\n this.getSighash(functionFragment),\n this._encodeParams(functionFragment.inputs, values || [])\n ]));\n }\n // Decode the result from a function call (e.g. from eth_call)\n decodeFunctionResult(functionFragment, data) {\n if (typeof (functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n let bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.arrayify)(data);\n let reason = null;\n let errorArgs = null;\n let errorName = null;\n let errorSignature = null;\n switch (bytes.length % this._abiCoder._getWordSize()) {\n case 0:\n try {\n return this._abiCoder.decode(functionFragment.outputs, bytes);\n }\n catch (error) { }\n break;\n case 4: {\n const selector = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(bytes.slice(0, 4));\n const builtin = BuiltinErrors[selector];\n if (builtin) {\n errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));\n errorName = builtin.name;\n errorSignature = builtin.signature;\n if (builtin.reason) {\n reason = errorArgs[0];\n }\n }\n else {\n try {\n const error = this.getError(selector);\n errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));\n errorName = error.name;\n errorSignature = error.format();\n }\n catch (error) {\n console.log(error);\n }\n }\n break;\n }\n }\n return logger.throwError(\"call revert exception\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.CALL_EXCEPTION, {\n method: functionFragment.format(),\n errorArgs, errorName, errorSignature, reason\n });\n }\n // Encode the result for a function call (e.g. for eth_call)\n encodeFunctionResult(functionFragment, values) {\n if (typeof (functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(this._abiCoder.encode(functionFragment.outputs, values || []));\n }\n // Create the filter for the event with search criteria (e.g. for eth_filterLog)\n encodeFilterTopics(eventFragment, values) {\n if (typeof (eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n if (values.length > eventFragment.inputs.length) {\n logger.throwError(\"too many arguments for \" + eventFragment.format(), _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNEXPECTED_ARGUMENT, {\n argument: \"values\",\n value: values\n });\n }\n let topics = [];\n if (!eventFragment.anonymous) {\n topics.push(this.getEventTopic(eventFragment));\n }\n const encodeTopic = (param, value) => {\n if (param.type === \"string\") {\n return (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__.id)(value);\n }\n else if (param.type === \"bytes\") {\n return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_9__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(value));\n }\n // Check addresses are valid\n if (param.type === \"address\") {\n this._abiCoder.encode([\"address\"], [value]);\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexZeroPad)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(value), 32);\n };\n values.forEach((value, index) => {\n let param = eventFragment.inputs[index];\n if (!param.indexed) {\n if (value != null) {\n logger.throwArgumentError(\"cannot filter non-indexed parameters; must be null\", (\"contract.\" + param.name), value);\n }\n return;\n }\n if (value == null) {\n topics.push(null);\n }\n else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n }\n else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n }\n else {\n topics.push(encodeTopic(param, value));\n }\n });\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n return topics;\n }\n encodeEventLog(eventFragment, values) {\n if (typeof (eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n const topics = [];\n const dataTypes = [];\n const dataValues = [];\n if (!eventFragment.anonymous) {\n topics.push(this.getEventTopic(eventFragment));\n }\n if (values.length !== eventFragment.inputs.length) {\n logger.throwArgumentError(\"event arguments/values mismatch\", \"values\", values);\n }\n eventFragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__.id)(value));\n }\n else if (param.type === \"bytes\") {\n topics.push((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_9__.keccak256)(value));\n }\n else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n }\n else {\n topics.push(this._abiCoder.encode([param.type], [value]));\n }\n }\n else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n return {\n data: this._abiCoder.encode(dataTypes, dataValues),\n topics: topics\n };\n }\n // Decode a filter for the event and the search criteria\n decodeEventLog(eventFragment, data, topics) {\n if (typeof (eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n if (topics != null && !eventFragment.anonymous) {\n let topicHash = this.getEventTopic(eventFragment);\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.isHexString)(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {\n logger.throwError(\"fragment/topic mismatch\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INVALID_ARGUMENT, { argument: \"topics[0]\", expected: topicHash, value: topics[0] });\n }\n topics = topics.slice(1);\n }\n let indexed = [];\n let nonIndexed = [];\n let dynamic = [];\n eventFragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" || param.type === \"bytes\" || param.baseType === \"tuple\" || param.baseType === \"array\") {\n indexed.push(_fragments__WEBPACK_IMPORTED_MODULE_4__.ParamType.fromObject({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n }\n else {\n indexed.push(param);\n dynamic.push(false);\n }\n }\n else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n let resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.concat)(topics)) : null;\n let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true);\n let result = [];\n let nonIndexedIndex = 0, indexedIndex = 0;\n eventFragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (resultIndexed == null) {\n result[index] = new Indexed({ _isIndexed: true, hash: null });\n }\n else if (dynamic[index]) {\n result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });\n }\n else {\n try {\n result[index] = resultIndexed[indexedIndex++];\n }\n catch (error) {\n result[index] = error;\n }\n }\n }\n else {\n try {\n result[index] = resultNonIndexed[nonIndexedIndex++];\n }\n catch (error) {\n result[index] = error;\n }\n }\n // Add the keyword argument if named and safe\n if (param.name && result[param.name] == null) {\n const value = result[index];\n // Make error named values throw on access\n if (value instanceof Error) {\n Object.defineProperty(result, param.name, {\n enumerable: true,\n get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); }\n });\n }\n else {\n result[param.name] = value;\n }\n }\n });\n // Make all error indexed values throw on access\n for (let i = 0; i < result.length; i++) {\n const value = result[i];\n if (value instanceof Error) {\n Object.defineProperty(result, i, {\n enumerable: true,\n get: () => { throw wrapAccessError(`index ${i}`, value); }\n });\n }\n }\n return Object.freeze(result);\n }\n // Given a transaction, find the matching function fragment (if any) and\n // determine all its properties and call parameters\n parseTransaction(tx) {\n let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase());\n if (!fragment) {\n return null;\n }\n return new TransactionDescription({\n args: this._abiCoder.decode(fragment.inputs, \"0x\" + tx.data.substring(10)),\n functionFragment: fragment,\n name: fragment.name,\n signature: fragment.format(),\n sighash: this.getSighash(fragment),\n value: _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_10__.BigNumber.from(tx.value || \"0\"),\n });\n }\n // @TODO\n //parseCallResult(data: BytesLike): ??\n // Given an event log, find the matching event fragment (if any) and\n // determine all its properties and values\n parseLog(log) {\n let fragment = this.getEvent(log.topics[0]);\n if (!fragment || fragment.anonymous) {\n return null;\n }\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n return new LogDescription({\n eventFragment: fragment,\n name: fragment.name,\n signature: fragment.format(),\n topic: this.getEventTopic(fragment),\n args: this.decodeEventLog(fragment, log.data, log.topics)\n });\n }\n parseError(data) {\n const hexData = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(data);\n let fragment = this.getError(hexData.substring(0, 10).toLowerCase());\n if (!fragment) {\n return null;\n }\n return new ErrorDescription({\n args: this._abiCoder.decode(fragment.inputs, \"0x\" + hexData.substring(10)),\n errorFragment: fragment,\n name: fragment.name,\n signature: fragment.format(),\n sighash: this.getSighash(fragment),\n });\n }\n /*\n static from(value: Array | string | Interface) {\n if (Interface.isInterface(value)) {\n return value;\n }\n if (typeof(value) === \"string\") {\n return new Interface(JSON.parse(value));\n }\n return new Interface(value);\n }\n */\n static isInterface(value) {\n return !!(value && value._isInterface);\n }\n}\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/abi/lib.esm/interface.js?"); + for (var j = 0; j < 16; j++) { + block[j] ^= this._lastCipherblock[j]; + } -/***/ }), + this._lastCipherblock = this._aes.encrypt(block); + copyArray(this._lastCipherblock, ciphertext, i); + } -/***/ "./node_modules/@ethersproject/address/lib.esm/_version.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/address/lib.esm/_version.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return ciphertext; + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"address/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/address/lib.esm/_version.js?"); + ModeOfOperationCBC.prototype.decrypt = function(ciphertext) { + ciphertext = coerceArray(ciphertext); -/***/ }), + if ((ciphertext.length % 16) !== 0) { + throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); + } -/***/ "./node_modules/@ethersproject/address/lib.esm/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/address/lib.esm/index.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + var plaintext = createArray(ciphertext.length); + var block = createArray(16); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"getAddress\": function() { return /* binding */ getAddress; },\n/* harmony export */ \"getContractAddress\": function() { return /* binding */ getContractAddress; },\n/* harmony export */ \"getCreate2Address\": function() { return /* binding */ getCreate2Address; },\n/* harmony export */ \"getIcapAddress\": function() { return /* binding */ getIcapAddress; },\n/* harmony export */ \"isAddress\": function() { return /* binding */ isAddress; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/address/lib.esm/_version.js\");\n\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction getChecksumAddress(address) {\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isHexString)(address, 20)) {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n address = address.toLowerCase();\n const chars = address.substring(2).split(\"\");\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n const hashed = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)(expanded));\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return \"0x\" + chars.join(\"\");\n}\n// Shims for environments that are missing some required constants and functions\nconst MAX_SAFE_INTEGER = 0x1fffffffffffff;\nfunction log10(x) {\n if (Math.log10) {\n return Math.log10(x);\n }\n return Math.log(x) / Math.LN10;\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\nconst safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\n;\nfunction getAddress(address) {\n let result = null;\n if (typeof (address) !== \"string\") {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (address.substring(0, 2) !== \"0x\") {\n address = \"0x\" + address;\n }\n result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {\n logger.throwArgumentError(\"bad address checksum\", \"address\", address);\n }\n // Maybe ICAP? (we only support direct mode)\n }\n else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n if (address.substring(2, 4) !== ibanChecksum(address)) {\n logger.throwArgumentError(\"bad icap checksum\", \"address\", address);\n }\n result = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base36To16)(address.substring(4));\n while (result.length < 40) {\n result = \"0\" + result;\n }\n result = getChecksumAddress(\"0x\" + result);\n }\n else {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n return result;\n}\nfunction isAddress(address) {\n try {\n getAddress(address);\n return true;\n }\n catch (error) { }\n return false;\n}\nfunction getIcapAddress(address) {\n let base36 = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base16To36)(getAddress(address).substring(2)).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\" + base36;\n }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\nfunction getContractAddress(transaction) {\n let from = null;\n try {\n from = getAddress(transaction.from);\n }\n catch (error) {\n logger.throwArgumentError(\"missing from address\", \"transaction\", transaction);\n }\n const nonce = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction.nonce).toHexString()));\n return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_5__.encode)([from, nonce])), 12));\n}\nfunction getCreate2Address(from, salt, initCodeHash) {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(salt) !== 32) {\n logger.throwArgumentError(\"salt must be 32 bytes\", \"salt\", salt);\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(initCodeHash) !== 32) {\n logger.throwArgumentError(\"initCodeHash must be 32 bytes\", \"initCodeHash\", initCodeHash);\n }\n return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.concat)([\"0xff\", getAddress(from), salt, initCodeHash])), 12));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/address/lib.esm/index.js?"); + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); + block = this._aes.decrypt(block); -/***/ }), + for (var j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ this._lastCipherblock[j]; + } -/***/ "./node_modules/@ethersproject/basex/lib.esm/index.js": -/*!************************************************************!*\ - !*** ./node_modules/@ethersproject/basex/lib.esm/index.js ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Base32\": function() { return /* binding */ Base32; },\n/* harmony export */ \"Base58\": function() { return /* binding */ Base58; },\n/* harmony export */ \"BaseX\": function() { return /* binding */ BaseX; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/**\n * var basex = require(\"base-x\");\n *\n * This implementation is heavily based on base-x. The main reason to\n * deviate was to prevent the dependency of Buffer.\n *\n * Contributors:\n *\n * base-x encoding\n * Forked from https://github.com/cryptocoinjs/bs58\n * Originally written by Mike Hearn for BitcoinJ\n * Copyright (c) 2011 Google Inc\n * Ported to JavaScript by Stefan Thomas\n * Merged Buffer refactorings from base58-native by Stephen Pair\n * Copyright (c) 2013 BitPay Inc\n *\n * The MIT License (MIT)\n *\n * Copyright base-x contributors (c) 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n *\n */\n\n\nclass BaseX {\n constructor(alphabet) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, \"alphabet\", alphabet);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, \"base\", alphabet.length);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, \"_alphabetMap\", {});\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, \"_leader\", alphabet.charAt(0));\n // pre-compute lookup table\n for (let i = 0; i < alphabet.length; i++) {\n this._alphabetMap[alphabet.charAt(i)] = i;\n }\n }\n encode(value) {\n let source = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(value);\n if (source.length === 0) {\n return \"\";\n }\n let digits = [0];\n for (let i = 0; i < source.length; ++i) {\n let carry = source[i];\n for (let j = 0; j < digits.length; ++j) {\n carry += digits[j] << 8;\n digits[j] = carry % this.base;\n carry = (carry / this.base) | 0;\n }\n while (carry > 0) {\n digits.push(carry % this.base);\n carry = (carry / this.base) | 0;\n }\n }\n let string = \"\";\n // deal with leading zeros\n for (let k = 0; source[k] === 0 && k < source.length - 1; ++k) {\n string += this._leader;\n }\n // convert digits to a string\n for (let q = digits.length - 1; q >= 0; --q) {\n string += this.alphabet[digits[q]];\n }\n return string;\n }\n decode(value) {\n if (typeof (value) !== \"string\") {\n throw new TypeError(\"Expected String\");\n }\n let bytes = [];\n if (value.length === 0) {\n return new Uint8Array(bytes);\n }\n bytes.push(0);\n for (let i = 0; i < value.length; i++) {\n let byte = this._alphabetMap[value[i]];\n if (byte === undefined) {\n throw new Error(\"Non-base\" + this.base + \" character\");\n }\n let carry = byte;\n for (let j = 0; j < bytes.length; ++j) {\n carry += bytes[j] * this.base;\n bytes[j] = carry & 0xff;\n carry >>= 8;\n }\n while (carry > 0) {\n bytes.push(carry & 0xff);\n carry >>= 8;\n }\n }\n // deal with leading zeros\n for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) {\n bytes.push(0);\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(new Uint8Array(bytes.reverse()));\n }\n}\nconst Base32 = new BaseX(\"abcdefghijklmnopqrstuvwxyz234567\");\nconst Base58 = new BaseX(\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\");\n\n//console.log(Base58.decode(\"Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj\"))\n//console.log(Base58.encode(Base58.decode(\"Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj\")))\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/basex/lib.esm/index.js?"); + return plaintext; + } -/***/ }), -/***/ "./node_modules/@ethersproject/bignumber/lib.esm/_version.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + /** + * Mode Of Operation - Cipher Feedback (CFB) + */ + var ModeOfOperationCFB = function(key, iv, segmentSize) { + if (!(this instanceof ModeOfOperationCFB)) { + throw Error('AES must be instanitated with `new`'); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bignumber/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/bignumber/lib.esm/_version.js?"); + this.description = "Cipher Feedback"; + this.name = "cfb"; -/***/ }), + if (!iv) { + iv = createArray(16); -/***/ "./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": -/*!********************************************************************!*\ - !*** ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 size)'); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigNumber\": function() { return /* binding */ BigNumber; },\n/* harmony export */ \"_base16To36\": function() { return /* binding */ _base16To36; },\n/* harmony export */ \"_base36To16\": function() { return /* binding */ _base36To16; },\n/* harmony export */ \"isBigNumberish\": function() { return /* binding */ isBigNumberish; }\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/@ethersproject/bignumber/node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/bignumber/lib.esm/_version.js\");\n\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\n\nvar BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN);\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nfunction isBigNumberish(value) {\n return (value != null) && (BigNumber.isBigNumber(value) ||\n (typeof (value) === \"number\" && (value % 1) === 0) ||\n (typeof (value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) ||\n (typeof (value) === \"bigint\") ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nclass BigNumber {\n constructor(constructorGuard, hex) {\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division-by-zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"division-by-zero\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"negative-power\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return (this._hex[0] === \"-\");\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof (value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof (value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof (anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) {\n return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof (hex) === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof (hex) === \"string\") {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === \"-\" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof (value) !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nfunction _base36To16(value) {\n return (new BN(value, 36)).toString(16);\n}\n// value should have no prefix\nfunction _base16To36(value) {\n return (new BN(value, 16)).toString(36);\n}\n//# sourceMappingURL=bignumber.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js?"); + if (!segmentSize) { segmentSize = 1; } -/***/ }), + this.segmentSize = segmentSize; -/***/ "./node_modules/@ethersproject/bignumber/node_modules/bn.js/lib/bn.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@ethersproject/bignumber/node_modules/bn.js/lib/bn.js ***! - \****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this._shiftRegister = coerceArray(iv, true); -eval("/* module decorator */ module = __webpack_require__.nmd(module);\n(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = (__webpack_require__(/*! buffer */ \"?ff28\").Buffer);\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})( false || module, this);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/bignumber/node_modules/bn.js/lib/bn.js?"); + this._aes = new AES(key); + } -/***/ }), + ModeOfOperationCFB.prototype.encrypt = function(plaintext) { + if ((plaintext.length % this.segmentSize) != 0) { + throw new Error('invalid plaintext size (must be segmentSize bytes)'); + } -/***/ "./node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!***************************************************************!*\ - !*** ./node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + var encrypted = coerceArray(plaintext, true); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/bytes/lib.esm/_version.js?"); + var xorSegment; + for (var i = 0; i < encrypted.length; i += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); + for (var j = 0; j < this.segmentSize; j++) { + encrypted[i + j] ^= xorSegment[j]; + } -/***/ }), + // Shift the register + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } -/***/ "./node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!************************************************************!*\ - !*** ./node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return encrypted; + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0\" + hex;\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0,\n yParityAndS: \"0x\",\n compact: \"0x\"\n };\n if (isBytesLike(signature)) {\n let bytes = arrayify(signature);\n // Get the r, s and v\n if (bytes.length === 64) {\n // EIP-2098; pull the v from the top bit of s and clear it\n result.v = 27 + (bytes[32] >> 7);\n bytes[32] &= 0x7f;\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n }\n else if (bytes.length === 65) {\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n }\n else {\n logger.throwArgumentError(\"invalid signature string\", \"signature\", signature);\n }\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n result.yParityAndS = result._vs;\n result.compact = result.r + result.yParityAndS.substring(2);\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/bytes/lib.esm/index.js?"); + ModeOfOperationCFB.prototype.decrypt = function(ciphertext) { + if ((ciphertext.length % this.segmentSize) != 0) { + throw new Error('invalid ciphertext size (must be segmentSize bytes)'); + } -/***/ }), + var plaintext = coerceArray(ciphertext, true); -/***/ "./node_modules/@ethersproject/constants/lib.esm/bignumbers.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@ethersproject/constants/lib.esm/bignumbers.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + var xorSegment; + for (var i = 0; i < plaintext.length; i += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MaxInt256\": function() { return /* binding */ MaxInt256; },\n/* harmony export */ \"MaxUint256\": function() { return /* binding */ MaxUint256; },\n/* harmony export */ \"MinInt256\": function() { return /* binding */ MinInt256; },\n/* harmony export */ \"NegativeOne\": function() { return /* binding */ NegativeOne; },\n/* harmony export */ \"One\": function() { return /* binding */ One; },\n/* harmony export */ \"Two\": function() { return /* binding */ Two; },\n/* harmony export */ \"WeiPerEther\": function() { return /* binding */ WeiPerEther; },\n/* harmony export */ \"Zero\": function() { return /* binding */ Zero; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n\nconst NegativeOne = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(-1));\nconst Zero = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(0));\nconst One = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(1));\nconst Two = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(2));\nconst WeiPerEther = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"1000000000000000000\"));\nconst MaxUint256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\nconst MinInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"-0x8000000000000000000000000000000000000000000000000000000000000000\"));\nconst MaxInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\n\n//# sourceMappingURL=bignumbers.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/constants/lib.esm/bignumbers.js?"); + for (var j = 0; j < this.segmentSize; j++) { + plaintext[i + j] ^= xorSegment[j]; + } -/***/ }), + // Shift the register + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } -/***/ "./node_modules/@ethersproject/hash/lib.esm/id.js": -/*!********************************************************!*\ - !*** ./node_modules/@ethersproject/hash/lib.esm/id.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return plaintext; + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"id\": function() { return /* binding */ id; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/strings */ \"./node_modules/@ethersproject/strings/lib.esm/utf8.js\");\n\n\nfunction id(text) {\n return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_0__.keccak256)((0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__.toUtf8Bytes)(text));\n}\n//# sourceMappingURL=id.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/hash/lib.esm/id.js?"); + /** + * Mode Of Operation - Output Feedback (OFB) + */ + var ModeOfOperationOFB = function(key, iv) { + if (!(this instanceof ModeOfOperationOFB)) { + throw Error('AES must be instanitated with `new`'); + } -/***/ }), + this.description = "Output Feedback"; + this.name = "ofb"; -/***/ "./node_modules/@ethersproject/keccak256/lib.esm/index.js": -/*!****************************************************************!*\ - !*** ./node_modules/@ethersproject/keccak256/lib.esm/index.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + if (!iv) { + iv = createArray(16); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"keccak256\": function() { return /* binding */ keccak256; }\n/* harmony export */ });\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ \"./node_modules/js-sha3/src/sha3.js\");\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n\n\n\nfunction keccak256(data) {\n return '0x' + js_sha3__WEBPACK_IMPORTED_MODULE_0___default().keccak_256((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(data));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/keccak256/lib.esm/index.js?"); + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 bytes)'); + } -/***/ }), + this._lastPrecipher = coerceArray(iv, true); + this._lastPrecipherIndex = 16; -/***/ "./node_modules/@ethersproject/logger/lib.esm/_version.js": -/*!****************************************************************!*\ - !*** ./node_modules/@ethersproject/logger/lib.esm/_version.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + this._aes = new AES(key); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"logger/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/logger/lib.esm/_version.js?"); + ModeOfOperationOFB.prototype.encrypt = function(plaintext) { + var encrypted = coerceArray(plaintext, true); -/***/ }), + for (var i = 0; i < encrypted.length; i++) { + if (this._lastPrecipherIndex === 16) { + this._lastPrecipher = this._aes.encrypt(this._lastPrecipher); + this._lastPrecipherIndex = 0; + } + encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++]; + } -/***/ "./node_modules/@ethersproject/logger/lib.esm/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/logger/lib.esm/index.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return encrypted; + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ErrorCode\": function() { return /* binding */ ErrorCode; },\n/* harmony export */ \"LogLevel\": function() { return /* binding */ LogLevel; },\n/* harmony export */ \"Logger\": function() { return /* binding */ Logger; }\n/* harmony export */ });\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/logger/lib.esm/_version.js\");\n\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = { debug: 1, \"default\": 2, info: 2, warning: 3, error: 4, off: 5 };\nlet _logLevel = LogLevels[\"default\"];\n\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n ;\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nvar LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nvar ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Ethereum Network, such as an invalid chain ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + gasLimit * gasPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // Nonce has already been used\n // - transaction: the transaction attempted\n ErrorCode[\"NONCE_EXPIRED\"] = \"NONCE_EXPIRED\";\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n ErrorCode[\"REPLACEMENT_UNDERPRICED\"] = \"REPLACEMENT_UNDERPRICED\";\n // The gas limit could not be estimated\n // - transaction: the transaction passed to estimateGas\n ErrorCode[\"UNPREDICTABLE_GAS_LIMIT\"] = \"UNPREDICTABLE_GAS_LIMIT\";\n // The transaction was replaced by one with a higher gas price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n ErrorCode[\"TRANSACTION_REPLACED\"] = \"TRANSACTION_REPLACED\";\n ///////////////////\n // Interaction Errors\n // The user rejected the action, such as signing a message or sending\n // a transaction\n ErrorCode[\"ACTION_REJECTED\"] = \"ACTION_REJECTED\";\n})(ErrorCode || (ErrorCode = {}));\n;\nconst HEX = \"0123456789abcdef\";\nclass Logger {\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n let url = \"\";\n switch (code) {\n case ErrorCode.NUMERIC_FAULT: {\n url = \"NUMERIC_FAULT\";\n const fault = message;\n switch (fault) {\n case \"overflow\":\n case \"underflow\":\n case \"division-by-zero\":\n url += \"-\" + fault;\n break;\n case \"negative-power\":\n case \"negative-width\":\n url += \"-unsupported\";\n break;\n case \"unbound-bitwise-result\":\n url += \"-unbound-result\";\n break;\n }\n break;\n }\n case ErrorCode.CALL_EXCEPTION:\n case ErrorCode.INSUFFICIENT_FUNDS:\n case ErrorCode.MISSING_NEW:\n case ErrorCode.NONCE_EXPIRED:\n case ErrorCode.REPLACEMENT_UNDERPRICED:\n case ErrorCode.TRANSACTION_REPLACED:\n case ErrorCode.UNPREDICTABLE_GAS_LIMIT:\n url = code;\n break;\n }\n if (url) {\n message += \" [ See: https:/\\/links.ethers.org/v5-errors-\" + url + \" ]\";\n }\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\", form: _normalizeError\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof (value) !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" + JSON.stringify(kind.name) + \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__.version);\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\nLogger.errors = ErrorCode;\nLogger.levels = LogLevel;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/logger/lib.esm/index.js?"); + // Decryption is symetric + ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; -/***/ }), -/***/ "./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + /** + * Counter object for CTR common mode of operation + */ + var Counter = function(initialValue) { + if (!(this instanceof Counter)) { + throw Error('Counter must be instanitated with `new`'); + } + + // We allow 0, but anything false-ish uses the default 1 + if (initialValue !== 0 && !initialValue) { initialValue = 1; } + + if (typeof(initialValue) === 'number') { + this._counter = createArray(16); + this.setValue(initialValue); + + } else { + this.setBytes(initialValue); + } + } + + Counter.prototype.setValue = function(value) { + if (typeof(value) !== 'number' || parseInt(value) != value) { + throw new Error('invalid counter value (must be an integer)'); + } + + for (var index = 15; index >= 0; --index) { + this._counter[index] = value % 256; + value = value >> 8; + } + } + + Counter.prototype.setBytes = function(bytes) { + bytes = coerceArray(bytes, true); + + if (bytes.length != 16) { + throw new Error('invalid counter bytes size (must be 16 bytes)'); + } + + this._counter = bytes; + }; + + Counter.prototype.increment = function() { + for (var i = 15; i >= 0; i--) { + if (this._counter[i] === 255) { + this._counter[i] = 0; + } else { + this._counter[i]++; + break; + } + } + } + + + /** + * Mode Of Operation - Counter (CTR) + */ + var ModeOfOperationCTR = function(key, counter) { + if (!(this instanceof ModeOfOperationCTR)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Counter"; + this.name = "ctr"; + + if (!(counter instanceof Counter)) { + counter = new Counter(counter) + } + + this._counter = counter; + + this._remainingCounter = null; + this._remainingCounterIndex = 16; + + this._aes = new AES(key); + } + + ModeOfOperationCTR.prototype.encrypt = function(plaintext) { + var encrypted = coerceArray(plaintext, true); + + for (var i = 0; i < encrypted.length; i++) { + if (this._remainingCounterIndex === 16) { + this._remainingCounter = this._aes.encrypt(this._counter._counter); + this._remainingCounterIndex = 0; + this._counter.increment(); + } + encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; + } + + return encrypted; + } + + // Decryption is symetric + ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; + + + /////////////////////// + // Padding + + // See:https://tools.ietf.org/html/rfc2315 + function pkcs7pad(data) { + data = coerceArray(data, true); + var padder = 16 - (data.length % 16); + var result = createArray(data.length + padder); + copyArray(data, result); + for (var i = data.length; i < result.length; i++) { + result[i] = padder; + } + return result; + } + + function pkcs7strip(data) { + data = coerceArray(data, true); + if (data.length < 16) { throw new Error('PKCS#7 invalid length'); } + + var padder = data[data.length - 1]; + if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); } + + var length = data.length - padder; + for (var i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new Error('PKCS#7 invalid padding byte'); + } + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"pbkdf2\": function() { return /* binding */ pbkdf2; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/sha2 */ \"./node_modules/@ethersproject/sha2/lib.esm/sha2.js\");\n\n\n\nfunction pbkdf2(password, salt, iterations, keylen, hashAlgorithm) {\n password = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(password);\n salt = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(salt);\n let hLen;\n let l = 1;\n const DK = new Uint8Array(keylen);\n const block1 = new Uint8Array(salt.length + 4);\n block1.set(salt);\n //salt.copy(block1, 0, 0, salt.length)\n let r;\n let T;\n for (let i = 1; i <= l; i++) {\n //block1.writeUInt32BE(i, salt.length)\n block1[salt.length] = (i >> 24) & 0xff;\n block1[salt.length + 1] = (i >> 16) & 0xff;\n block1[salt.length + 2] = (i >> 8) & 0xff;\n block1[salt.length + 3] = i & 0xff;\n //let U = createHmac(password).update(block1).digest();\n let U = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__.computeHmac)(hashAlgorithm, password, block1));\n if (!hLen) {\n hLen = U.length;\n T = new Uint8Array(hLen);\n l = Math.ceil(keylen / hLen);\n r = keylen - (l - 1) * hLen;\n }\n //U.copy(T, 0, 0, hLen)\n T.set(U);\n for (let j = 1; j < iterations; j++) {\n //U = createHmac(password).update(U).digest();\n U = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__.computeHmac)(hashAlgorithm, password, U));\n for (let k = 0; k < hLen; k++)\n T[k] ^= U[k];\n }\n const destPos = (i - 1) * hLen;\n const len = (i === l ? r : hLen);\n //T.copy(DK, destPos, 0, len)\n DK.set((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(T).slice(0, len), destPos);\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexlify)(DK);\n}\n//# sourceMappingURL=pbkdf2.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js?"); + var result = createArray(length); + copyArray(data, result, 0, 0, length); + return result; + } -/***/ }), + /////////////////////// + // Exporting -/***/ "./node_modules/@ethersproject/properties/lib.esm/_version.js": -/*!********************************************************************!*\ - !*** ./node_modules/@ethersproject/properties/lib.esm/_version.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"properties/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/properties/lib.esm/_version.js?"); + // The block cipher + var aesjs = { + AES: AES, + Counter: Counter, -/***/ }), + ModeOfOperation: { + ecb: ModeOfOperationECB, + cbc: ModeOfOperationCBC, + cfb: ModeOfOperationCFB, + ofb: ModeOfOperationOFB, + ctr: ModeOfOperationCTR + }, -/***/ "./node_modules/@ethersproject/properties/lib.esm/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/properties/lib.esm/index.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + utils: { + hex: convertHex, + utf8: convertUtf8 + }, -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Description\": function() { return /* binding */ Description; },\n/* harmony export */ \"checkProperties\": function() { return /* binding */ checkProperties; },\n/* harmony export */ \"deepCopy\": function() { return /* binding */ deepCopy; },\n/* harmony export */ \"defineReadOnly\": function() { return /* binding */ defineReadOnly; },\n/* harmony export */ \"getStatic\": function() { return /* binding */ getStatic; },\n/* harmony export */ \"resolveProperties\": function() { return /* binding */ resolveProperties; },\n/* harmony export */ \"shallowCopy\": function() { return /* binding */ shallowCopy; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/properties/lib.esm/_version.js\");\n\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n// Crawl up the constructor chain to find a static method\nfunction getStatic(ctor, key) {\n for (let i = 0; i < 32; i++) {\n if (ctor[key]) {\n return ctor[key];\n }\n if (!ctor.prototype || typeof (ctor.prototype) !== \"object\") {\n break;\n }\n ctor = Object.getPrototypeOf(ctor.prototype).constructor;\n }\n return null;\n}\nfunction resolveProperties(object) {\n return __awaiter(this, void 0, void 0, function* () {\n const promises = Object.keys(object).map((key) => {\n const value = object[key];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n const results = yield Promise.all(promises);\n return results.reduce((accum, result) => {\n accum[(result.key)] = result.value;\n return accum;\n }, {});\n });\n}\nfunction checkProperties(object, properties) {\n if (!object || typeof (object) !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\nfunction shallowCopy(object) {\n const result = {};\n for (const key in object) {\n result[key] = object[key];\n }\n return result;\n}\nconst opaque = { bigint: true, boolean: true, \"function\": true, number: true, string: true };\nfunction _isFrozen(object) {\n // Opaque objects are not mutable, so safe to copy by assignment\n if (object === undefined || object === null || opaque[typeof (object)]) {\n return true;\n }\n if (Array.isArray(object) || typeof (object) === \"object\") {\n if (!Object.isFrozen(object)) {\n return false;\n }\n const keys = Object.keys(object);\n for (let i = 0; i < keys.length; i++) {\n let value = null;\n try {\n value = object[keys[i]];\n }\n catch (error) {\n // If accessing a value triggers an error, it is a getter\n // designed to do so (e.g. Result) and is therefore \"frozen\"\n continue;\n }\n if (!_isFrozen(value)) {\n return false;\n }\n }\n return true;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\n// Returns a new copy of object, such that no properties may be replaced.\n// New properties may be added only to objects.\nfunction _deepCopy(object) {\n if (_isFrozen(object)) {\n return object;\n }\n // Arrays are mutable, so we need to create a copy\n if (Array.isArray(object)) {\n return Object.freeze(object.map((item) => deepCopy(item)));\n }\n if (typeof (object) === \"object\") {\n const result = {};\n for (const key in object) {\n const value = object[key];\n if (value === undefined) {\n continue;\n }\n defineReadOnly(result, key, deepCopy(value));\n }\n return result;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\nfunction deepCopy(object) {\n return _deepCopy(object);\n}\nclass Description {\n constructor(info) {\n for (const key in info) {\n this[key] = deepCopy(info[key]);\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/properties/lib.esm/index.js?"); + padding: { + pkcs7: { + pad: pkcs7pad, + strip: pkcs7strip + } + }, -/***/ }), + _arrayTest: { + coerceArray: coerceArray, + createArray: createArray, + copyArray: copyArray, + } + }; -/***/ "./node_modules/@ethersproject/random/lib.esm/_version.js": -/*!****************************************************************!*\ - !*** ./node_modules/@ethersproject/random/lib.esm/_version.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"random/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/random/lib.esm/_version.js?"); + // node.js + if (true) { + module.exports = aesjs -/***/ }), + // RequireJS/AMD + // http://www.requirejs.org/docs/api.html + // https://github.com/amdjs/amdjs-api/wiki/AMD + } else {} -/***/ "./node_modules/@ethersproject/random/lib.esm/random.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/random/lib.esm/random.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"randomBytes\": function() { return /* binding */ randomBytes; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/random/lib.esm/_version.js\");\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n// Debugging line for testing browser lib in node\n//const window = { crypto: { getRandomValues: () => { } } };\nlet anyGlobal = null;\ntry {\n anyGlobal = window;\n if (anyGlobal == null) {\n throw new Error(\"try next\");\n }\n}\ncatch (error) {\n try {\n anyGlobal = __webpack_require__.g;\n if (anyGlobal == null) {\n throw new Error(\"try next\");\n }\n }\n catch (error) {\n anyGlobal = {};\n }\n}\nlet crypto = anyGlobal.crypto || anyGlobal.msCrypto;\nif (!crypto || !crypto.getRandomValues) {\n logger.warn(\"WARNING: Missing strong random number source\");\n crypto = {\n getRandomValues: function (buffer) {\n return logger.throwError(\"no secure random source avaialble\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"crypto.getRandomValues\"\n });\n }\n };\n}\nfunction randomBytes(length) {\n if (length <= 0 || length > 1024 || (length % 1) || length != length) {\n logger.throwArgumentError(\"invalid length\", \"length\", length);\n }\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(result);\n}\n;\n//# sourceMappingURL=random.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/random/lib.esm/random.js?"); +})(this); + /***/ }), -/***/ "./node_modules/@ethersproject/rlp/lib.esm/_version.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/rlp/lib.esm/_version.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 9809: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"rlp/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/rlp/lib.esm/_version.js?"); +var asn1 = exports; -/***/ }), +asn1.bignum = __webpack_require__(3550); -/***/ "./node_modules/@ethersproject/rlp/lib.esm/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/@ethersproject/rlp/lib.esm/index.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +asn1.define = (__webpack_require__(2500).define); +asn1.base = __webpack_require__(1979); +asn1.constants = __webpack_require__(6826); +asn1.decoders = __webpack_require__(8307); +asn1.encoders = __webpack_require__(6579); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; },\n/* harmony export */ \"encode\": function() { return /* binding */ encode; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/rlp/lib.esm/_version.js\");\n\n//See: https://github.com/ethereum/wiki/wiki/RLP\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isBytesLike)(object)) {\n logger.throwArgumentError(\"RLP object must be BytesLike\", \"object\", object);\n }\n const data = Array.prototype.slice.call((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nfunction encode(object) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(_encode(object));\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n logger.throwError(\"child data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data short segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data long segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data[offset]) };\n}\nfunction decode(data) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(data);\n const decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n logger.throwArgumentError(\"invalid rlp data\", \"data\", data);\n }\n return decoded.result;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/rlp/lib.esm/index.js?"); /***/ }), -/***/ "./node_modules/@ethersproject/sha2/lib.esm/_version.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/sha2/lib.esm/_version.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 2500: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"sha2/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/sha2/lib.esm/_version.js?"); +var asn1 = __webpack_require__(9809); +var inherits = __webpack_require__(5717); + +var api = exports; + +api.define = function define(name, body) { + return new Entity(name, body); +}; + +function Entity(name, body) { + this.name = name; + this.body = body; + + this.decoders = {}; + this.encoders = {}; +}; + +Entity.prototype._createNamed = function createNamed(base) { + var named; + try { + named = (__webpack_require__(5140).runInThisContext)( + '(function ' + this.name + '(entity) {\n' + + ' this._initNamed(entity);\n' + + '})' + ); + } catch (e) { + named = function (entity) { + this._initNamed(entity); + }; + } + inherits(named, base); + named.prototype._initNamed = function initnamed(entity) { + base.call(this, entity); + }; + + return new named(this); +}; + +Entity.prototype._getDecoder = function _getDecoder(enc) { + enc = enc || 'der'; + // Lazily create decoder + if (!this.decoders.hasOwnProperty(enc)) + this.decoders[enc] = this._createNamed(asn1.decoders[enc]); + return this.decoders[enc]; +}; + +Entity.prototype.decode = function decode(data, enc, options) { + return this._getDecoder(enc).decode(data, options); +}; + +Entity.prototype._getEncoder = function _getEncoder(enc) { + enc = enc || 'der'; + // Lazily create encoder + if (!this.encoders.hasOwnProperty(enc)) + this.encoders[enc] = this._createNamed(asn1.encoders[enc]); + return this.encoders[enc]; +}; + +Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { + return this._getEncoder(enc).encode(data, reporter); +}; + + +/***/ }), + +/***/ 6625: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +var inherits = __webpack_require__(5717); +var Reporter = (__webpack_require__(1979).Reporter); +var Buffer = (__webpack_require__(8764).Buffer); + +function DecoderBuffer(base, options) { + Reporter.call(this, options); + if (!Buffer.isBuffer(base)) { + this.error('Input not Buffer'); + return; + } + + this.base = base; + this.offset = 0; + this.length = base.length; +} +inherits(DecoderBuffer, Reporter); +exports.C = DecoderBuffer; + +DecoderBuffer.prototype.save = function save() { + return { offset: this.offset, reporter: Reporter.prototype.save.call(this) }; +}; + +DecoderBuffer.prototype.restore = function restore(save) { + // Return skipped data + var res = new DecoderBuffer(this.base); + res.offset = save.offset; + res.length = this.offset; + + this.offset = save.offset; + Reporter.prototype.restore.call(this, save.reporter); + + return res; +}; + +DecoderBuffer.prototype.isEmpty = function isEmpty() { + return this.offset === this.length; +}; + +DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) { + if (this.offset + 1 <= this.length) + return this.base.readUInt8(this.offset++, true); + else + return this.error(fail || 'DecoderBuffer overrun'); +} + +DecoderBuffer.prototype.skip = function skip(bytes, fail) { + if (!(this.offset + bytes <= this.length)) + return this.error(fail || 'DecoderBuffer overrun'); + + var res = new DecoderBuffer(this.base); + + // Share reporter state + res._reporterState = this._reporterState; + + res.offset = this.offset; + res.length = this.offset + bytes; + this.offset += bytes; + return res; +} + +DecoderBuffer.prototype.raw = function raw(save) { + return this.base.slice(save ? save.offset : this.offset, this.length); +} + +function EncoderBuffer(value, reporter) { + if (Array.isArray(value)) { + this.length = 0; + this.value = value.map(function(item) { + if (!(item instanceof EncoderBuffer)) + item = new EncoderBuffer(item, reporter); + this.length += item.length; + return item; + }, this); + } else if (typeof value === 'number') { + if (!(0 <= value && value <= 0xff)) + return reporter.error('non-byte EncoderBuffer value'); + this.value = value; + this.length = 1; + } else if (typeof value === 'string') { + this.value = value; + this.length = Buffer.byteLength(value); + } else if (Buffer.isBuffer(value)) { + this.value = value; + this.length = value.length; + } else { + return reporter.error('Unsupported type: ' + typeof value); + } +} +exports.R = EncoderBuffer; + +EncoderBuffer.prototype.join = function join(out, offset) { + if (!out) + out = new Buffer(this.length); + if (!offset) + offset = 0; + + if (this.length === 0) + return out; + + if (Array.isArray(this.value)) { + this.value.forEach(function(item) { + item.join(out, offset); + offset += item.length; + }); + } else { + if (typeof this.value === 'number') + out[offset] = this.value; + else if (typeof this.value === 'string') + out.write(this.value, offset); + else if (Buffer.isBuffer(this.value)) + this.value.copy(out, offset); + offset += this.length; + } + + return out; +}; + + +/***/ }), + +/***/ 1979: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ "./node_modules/@ethersproject/sha2/lib.esm/sha2.js": -/*!**********************************************************!*\ - !*** ./node_modules/@ethersproject/sha2/lib.esm/sha2.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var base = exports; + +base.Reporter = (__webpack_require__(8465)/* .Reporter */ .b); +base.DecoderBuffer = (__webpack_require__(6625)/* .DecoderBuffer */ .C); +base.EncoderBuffer = (__webpack_require__(6625)/* .EncoderBuffer */ .R); +base.Node = __webpack_require__(1949); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"computeHmac\": function() { return /* binding */ computeHmac; },\n/* harmony export */ \"ripemd160\": function() { return /* binding */ ripemd160; },\n/* harmony export */ \"sha256\": function() { return /* binding */ sha256; },\n/* harmony export */ \"sha512\": function() { return /* binding */ sha512; }\n/* harmony export */ });\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! hash.js */ \"./node_modules/hash.js/lib/hash.js\");\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(hash_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./types */ \"./node_modules/@ethersproject/sha2/lib.esm/types.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/sha2/lib.esm/_version.js\");\n\n\n//const _ripemd160 = _hash.ripemd160;\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nfunction ripemd160(data) {\n return \"0x\" + (hash_js__WEBPACK_IMPORTED_MODULE_0___default().ripemd160().update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\"));\n}\nfunction sha256(data) {\n return \"0x\" + (hash_js__WEBPACK_IMPORTED_MODULE_0___default().sha256().update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\"));\n}\nfunction sha512(data) {\n return \"0x\" + (hash_js__WEBPACK_IMPORTED_MODULE_0___default().sha512().update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\"));\n}\nfunction computeHmac(algorithm, key, data) {\n if (!_types__WEBPACK_IMPORTED_MODULE_4__.SupportedAlgorithm[algorithm]) {\n logger.throwError(\"unsupported algorithm \" + algorithm, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"hmac\",\n algorithm: algorithm\n });\n }\n return \"0x\" + hash_js__WEBPACK_IMPORTED_MODULE_0___default().hmac((hash_js__WEBPACK_IMPORTED_MODULE_0___default())[algorithm], (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(key)).update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\");\n}\n//# sourceMappingURL=sha2.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/sha2/lib.esm/sha2.js?"); /***/ }), -/***/ "./node_modules/@ethersproject/sha2/lib.esm/types.js": -/*!***********************************************************!*\ - !*** ./node_modules/@ethersproject/sha2/lib.esm/types.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 1949: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SupportedAlgorithm\": function() { return /* binding */ SupportedAlgorithm; }\n/* harmony export */ });\nvar SupportedAlgorithm;\n(function (SupportedAlgorithm) {\n SupportedAlgorithm[\"sha256\"] = \"sha256\";\n SupportedAlgorithm[\"sha512\"] = \"sha512\";\n})(SupportedAlgorithm || (SupportedAlgorithm = {}));\n;\n//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/sha2/lib.esm/types.js?"); +var Reporter = (__webpack_require__(1979).Reporter); +var EncoderBuffer = (__webpack_require__(1979).EncoderBuffer); +var DecoderBuffer = (__webpack_require__(1979).DecoderBuffer); +var assert = __webpack_require__(9746); + +// Supported tags +var tags = [ + 'seq', 'seqof', 'set', 'setof', 'objid', 'bool', + 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc', + 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str', + 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr' +]; + +// Public methods list +var methods = [ + 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', + 'any', 'contains' +].concat(tags); + +// Overrided methods list +var overrided = [ + '_peekTag', '_decodeTag', '_use', + '_decodeStr', '_decodeObjid', '_decodeTime', + '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', + + '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', + '_encodeNull', '_encodeInt', '_encodeBool' +]; + +function Node(enc, parent) { + var state = {}; + this._baseState = state; + + state.enc = enc; + + state.parent = parent || null; + state.children = null; + + // State + state.tag = null; + state.args = null; + state.reverseArgs = null; + state.choice = null; + state.optional = false; + state.any = false; + state.obj = false; + state.use = null; + state.useDecoder = null; + state.key = null; + state['default'] = null; + state.explicit = null; + state.implicit = null; + state.contains = null; + + // Should create new instance on each method + if (!state.parent) { + state.children = []; + this._wrap(); + } +} +module.exports = Node; + +var stateProps = [ + 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', + 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', + 'implicit', 'contains' +]; + +Node.prototype.clone = function clone() { + var state = this._baseState; + var cstate = {}; + stateProps.forEach(function(prop) { + cstate[prop] = state[prop]; + }); + var res = new this.constructor(cstate.parent); + res._baseState = cstate; + return res; +}; + +Node.prototype._wrap = function wrap() { + var state = this._baseState; + methods.forEach(function(method) { + this[method] = function _wrappedMethod() { + var clone = new this.constructor(this); + state.children.push(clone); + return clone[method].apply(clone, arguments); + }; + }, this); +}; + +Node.prototype._init = function init(body) { + var state = this._baseState; + + assert(state.parent === null); + body.call(this); + + // Filter children + state.children = state.children.filter(function(child) { + return child._baseState.parent === this; + }, this); + assert.equal(state.children.length, 1, 'Root node can have only one child'); +}; + +Node.prototype._useArgs = function useArgs(args) { + var state = this._baseState; + + // Filter children and args + var children = args.filter(function(arg) { + return arg instanceof this.constructor; + }, this); + args = args.filter(function(arg) { + return !(arg instanceof this.constructor); + }, this); + + if (children.length !== 0) { + assert(state.children === null); + state.children = children; + + // Replace parent to maintain backward link + children.forEach(function(child) { + child._baseState.parent = this; + }, this); + } + if (args.length !== 0) { + assert(state.args === null); + state.args = args; + state.reverseArgs = args.map(function(arg) { + if (typeof arg !== 'object' || arg.constructor !== Object) + return arg; + + var res = {}; + Object.keys(arg).forEach(function(key) { + if (key == (key | 0)) + key |= 0; + var value = arg[key]; + res[value] = key; + }); + return res; + }); + } +}; + +// +// Overrided methods +// + +overrided.forEach(function(method) { + Node.prototype[method] = function _overrided() { + var state = this._baseState; + throw new Error(method + ' not implemented for encoding: ' + state.enc); + }; +}); + +// +// Public methods +// + +tags.forEach(function(tag) { + Node.prototype[tag] = function _tagMethod() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + assert(state.tag === null); + state.tag = tag; + + this._useArgs(args); + + return this; + }; +}); + +Node.prototype.use = function use(item) { + assert(item); + var state = this._baseState; -/***/ }), + assert(state.use === null); + state.use = item; -/***/ "./node_modules/@ethersproject/signing-key/lib.esm/_version.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/lib.esm/_version.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return this; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"signing-key/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/signing-key/lib.esm/_version.js?"); +Node.prototype.optional = function optional() { + var state = this._baseState; -/***/ }), + state.optional = true; -/***/ "./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return this; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"EC\": function() { return /* binding */ EC$1; }\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hash.js */ \"./node_modules/hash.js/lib/hash.js\");\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(hash_js__WEBPACK_IMPORTED_MODULE_1__);\n\n\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nfunction createCommonjsModule(fn, basedir, module) {\n\treturn module = {\n\t\tpath: basedir,\n\t\texports: {},\n\t\trequire: function (path, base) {\n\t\t\treturn commonjsRequire(path, (base === undefined || base === null) ? module.path : base);\n\t\t}\n\t}, fn(module, module.exports), module.exports;\n}\n\nfunction getDefaultExportFromNamespaceIfPresent (n) {\n\treturn n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;\n}\n\nfunction getDefaultExportFromNamespaceIfNotNamed (n) {\n\treturn n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;\n}\n\nfunction getAugmentedNamespace(n) {\n\tif (n.__esModule) return n;\n\tvar a = Object.defineProperty({}, '__esModule', {value: true});\n\tObject.keys(n).forEach(function (k) {\n\t\tvar d = Object.getOwnPropertyDescriptor(n, k);\n\t\tObject.defineProperty(a, k, d.get ? d : {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\treturn n[k];\n\t\t\t}\n\t\t});\n\t});\n\treturn a;\n}\n\nfunction commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');\n}\n\nvar minimalisticAssert = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\nvar utils_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar utils = exports;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n});\n\nvar utils_1$1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar utils = exports;\n\n\n\n\nutils.assert = minimalisticAssert;\nutils.toArray = utils_1.toArray;\nutils.zero2 = utils_1.zero2;\nutils.toHex = utils_1.toHex;\nutils.encode = utils_1.encode;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w, bits) {\n var naf = new Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n\n var ws = 1 << (w + 1);\n var k = num.clone();\n\n for (var i = 0; i < naf.length; i++) {\n var z;\n var mod = k.andln(ws - 1);\n if (k.isOdd()) {\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n\n naf[i] = z;\n k.iushrn(1);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n [],\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n var m8;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.iushrn(1);\n k2.iushrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\nfunction cachedProperty(obj, name, computer) {\n var key = '_' + name;\n obj.prototype[name] = function cachedProperty() {\n return this[key] !== undefined ? this[key] :\n this[key] = computer.call(this);\n };\n}\nutils.cachedProperty = cachedProperty;\n\nfunction parseBytes(bytes) {\n return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :\n bytes;\n}\nutils.parseBytes = parseBytes;\n\nfunction intFromLE(bytes) {\n return new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(bytes, 'hex', 'le');\n}\nutils.intFromLE = intFromLE;\n});\n\n'use strict';\n\n\n\nvar getNAF = utils_1$1.getNAF;\nvar getJSF = utils_1$1.getJSF;\nvar assert$1 = utils_1$1.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? bn_js__WEBPACK_IMPORTED_MODULE_0___default().red(conf.prime) : bn_js__WEBPACK_IMPORTED_MODULE_0___default().mont(this.p);\n\n // Useful for many curves\n this.zero = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0).toRed(this.red);\n this.one = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1).toRed(this.red);\n this.two = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n\n this._bitLength = this.n ? this.n.bitLength() : 0;\n\n // Generalized Greg Maxwell's trick\n var adjustCount = this.n && this.p.div(this.n);\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\nvar base = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert$1(p.precomputed);\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1, this._bitLength);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n var j;\n var nafW;\n for (j = 0; j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1; l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (j = 0; j < repr.length; j++) {\n nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w, this._bitLength);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var l = 0; i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0)\n l++;\n acc = acc.dblp(l);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert$1(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len,\n jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n var i;\n var j;\n var p;\n for (i = 0; i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);\n naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b], /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3, /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (j = 0; j < len; j++) {\n var z = tmp[j];\n p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (i = 0; i < len; i++)\n wnd[i] = null;\n\n if (jacobianResult)\n return acc;\n else\n return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq(/*other*/) {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils_1$1.toArray(bytes, enc);\n\n var len = this.p.byteLength();\n\n // uncompressed, hybrid-odd, hybrid-even\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&\n bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06)\n assert$1(bytes[bytes.length - 1] % 2 === 0);\n else if (bytes[0] === 0x07)\n assert$1(bytes[bytes.length - 1] % 2 === 1);\n\n var res = this.point(bytes.slice(1, 1 + len),\n bytes.slice(1 + len, 1 + 2 * len));\n\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&\n bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n\n if (compact)\n return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n\n return [ 0x04 ].concat(x, this.getY().toArray('be', len));\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils_1$1.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null,\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed)\n return false;\n\n var doubles = this.precomputed.doubles;\n if (!doubles)\n return false;\n\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles,\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res,\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n\nvar inherits_browser = createCommonjsModule(function (module) {\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n}\n});\n\n'use strict';\n\n\n\n\n\n\nvar assert$2 = utils_1$1.assert;\n\nfunction ShortCurve(conf) {\n base.call(this, 'short', conf);\n\n this.a = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.a, 16).toRed(this.red);\n this.b = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits_browser(ShortCurve, base);\nvar short_1 = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert$2(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(vec.a, 16),\n b: new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(vec.b, 16),\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis,\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : bn_js__WEBPACK_IMPORTED_MODULE_0___default().mont(num);\n var tinv = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n\n var s = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1);\n var y1 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0);\n var x2 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0);\n var y2 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n var r;\n var x;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n r = v.sub(q.mul(u));\n x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.negative) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.negative) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 },\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd =\n function _endoWnafMulAdd(points, coeffs, jacobianResult) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.negative) {\n split.k1.ineg();\n p = p.neg(true);\n }\n if (split.k2.negative) {\n split.k2.ineg();\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n };\n\nfunction Point(curve, x, y, isRed) {\n base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(x, 16);\n this.y = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits_browser(Point, base.BasePoint);\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n var endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul),\n },\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1),\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1),\n },\n } ];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point)),\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point)),\n },\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(k, 16);\n if (this.isInfinity())\n return this;\n else if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs, true);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2, true);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n var negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate),\n },\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0);\n } else {\n this.x = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(x, 16);\n this.y = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(y, 16);\n this.z = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits_browser(JPoint, base.BasePoint);\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.eqXToP = function eqXToP(x) {\n var zs = this.z.redSqr();\n var rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(zs);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\nvar curve_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar curve = exports;\n\ncurve.base = base;\ncurve.short = short_1;\ncurve.mont = /*RicMoo:ethers:require(./mont)*/(null);\ncurve.edwards = /*RicMoo:ethers:require(./edwards)*/(null);\n});\n\nvar curves_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar curves = exports;\n\n\n\n\n\nvar assert = utils_1$1.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new curve_1.short(options);\n else if (options.type === 'edwards')\n this.curve = new curve_1.edwards(options);\n else\n this.curve = new curve_1.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve,\n });\n return curve;\n },\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',\n ],\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34',\n ],\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5',\n ],\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha384),\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f',\n ],\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha512),\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650',\n ],\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '9',\n ],\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658',\n ],\n});\n\nvar pre;\ntry {\n pre = /*RicMoo:ethers:require(./precomputed/secp256k1)*/(null).crash();\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3',\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15',\n },\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre,\n ],\n});\n});\n\n'use strict';\n\n\n\n\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this._reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils_1.toArray(options.entropy, options.entropyEnc || 'hex');\n var nonce = utils_1.toArray(options.nonce, options.nonceEnc || 'hex');\n var pers = utils_1.toArray(options.pers, options.persEnc || 'hex');\n minimalisticAssert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nvar hmacDrbg = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this._reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new (hash_js__WEBPACK_IMPORTED_MODULE_1___default().hmac)(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils_1.toArray(entropy, entropyEnc);\n add = utils_1.toArray(add, addEnc);\n\n minimalisticAssert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this._reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this._reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils_1.toArray(add, addEnc || 'hex');\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this._reseed++;\n return utils_1.encode(res, enc);\n};\n\n'use strict';\n\n\n\nvar assert$3 = utils_1$1.assert;\n\nfunction KeyPair(ec, options) {\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(ec, { priv: ..., pub: ... })\n if (options.priv)\n this._importPrivate(options.priv, options.privEnc);\n if (options.pub)\n this._importPublic(options.pub, options.pubEnc);\n}\nvar key = KeyPair;\n\nKeyPair.fromPublic = function fromPublic(ec, pub, enc) {\n if (pub instanceof KeyPair)\n return pub;\n\n return new KeyPair(ec, {\n pub: pub,\n pubEnc: enc,\n });\n};\n\nKeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {\n if (priv instanceof KeyPair)\n return priv;\n\n return new KeyPair(ec, {\n priv: priv,\n privEnc: enc,\n });\n};\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n if (!enc)\n return this.pub;\n\n return this.pub.encode(enc, compact);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key, enc) {\n this.priv = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(key, enc || 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.umod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key, enc) {\n if (key.x || key.y) {\n // Montgomery points only have an `x` coordinate.\n // Weierstrass/Edwards points on the other hand have both `x` and\n // `y` coordinates.\n if (this.ec.curve.type === 'mont') {\n assert$3(key.x, 'Need x coordinate');\n } else if (this.ec.curve.type === 'short' ||\n this.ec.curve.type === 'edwards') {\n assert$3(key.x && key.y, 'Need both x and y coordinate');\n }\n this.pub = this.ec.curve.point(key.x, key.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key, enc);\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n if(!pub.validate()) {\n assert$3(pub.validate(), 'public point not validated');\n }\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n\n'use strict';\n\n\n\n\nvar assert$4 = utils_1$1.assert;\n\nfunction Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n\n if (this._importDER(options, enc))\n return;\n\n assert$4(options.r && options.s, 'Signature without r or s');\n this.r = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(options.r, 16);\n this.s = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(options.s, 16);\n if (options.recoveryParam === undefined)\n this.recoveryParam = null;\n else\n this.recoveryParam = options.recoveryParam;\n}\nvar signature = Signature;\n\nfunction Position() {\n this.place = 0;\n}\n\nfunction getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 0x80)) {\n return initial;\n }\n var octetLen = initial & 0xf;\n\n // Indefinite length or overflow\n if (octetLen === 0 || octetLen > 4) {\n return false;\n }\n\n var val = 0;\n for (var i = 0, off = p.place; i < octetLen; i++, off++) {\n val <<= 8;\n val |= buf[off];\n val >>>= 0;\n }\n\n // Leading zeroes\n if (val <= 0x7f) {\n return false;\n }\n\n p.place = off;\n return val;\n}\n\nfunction rmPadding(buf) {\n var i = 0;\n var len = buf.length - 1;\n while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {\n i++;\n }\n if (i === 0) {\n return buf;\n }\n return buf.slice(i);\n}\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils_1$1.toArray(data, enc);\n var p = new Position();\n if (data[p.place++] !== 0x30) {\n return false;\n }\n var len = getLength(data, p);\n if (len === false) {\n return false;\n }\n if ((len + p.place) !== data.length) {\n return false;\n }\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var rlen = getLength(data, p);\n if (rlen === false) {\n return false;\n }\n var r = data.slice(p.place, rlen + p.place);\n p.place += rlen;\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var slen = getLength(data, p);\n if (slen === false) {\n return false;\n }\n if (data.length !== slen + p.place) {\n return false;\n }\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0) {\n if (r[1] & 0x80) {\n r = r.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n if (s[0] === 0) {\n if (s[1] & 0x80) {\n s = s.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n\n this.r = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(r);\n this.s = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(s);\n this.recoveryParam = null;\n\n return true;\n};\n\nfunction constructLength(arr, len) {\n if (len < 0x80) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n arr.push(octets | 0x80);\n while (--octets) {\n arr.push((len >>> (octets << 3)) & 0xff);\n }\n arr.push(len);\n}\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n r = rmPadding(r);\n s = rmPadding(s);\n\n while (!s[0] && !(s[1] & 0x80)) {\n s = s.slice(1);\n }\n var arr = [ 0x02 ];\n constructLength(arr, r.length);\n arr = arr.concat(r);\n arr.push(0x02);\n constructLength(arr, s.length);\n var backHalf = arr.concat(s);\n var res = [ 0x30 ];\n constructLength(res, backHalf.length);\n res = res.concat(backHalf);\n return utils_1$1.encode(res, enc);\n};\n\n'use strict';\n\n\n\n\n\nvar rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); });\nvar assert$5 = utils_1$1.assert;\n\n\n\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert$5(Object.prototype.hasOwnProperty.call(curves_1, options),\n 'Unknown curve ' + options);\n\n options = curves_1[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof curves_1.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.ushrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nvar ec = EC;\n\nEC.prototype.keyPair = function keyPair(options) {\n return new key(this, options);\n};\n\nEC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {\n return key.fromPrivate(this, priv, enc);\n};\n\nEC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {\n return key.fromPublic(this, pub, enc);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new hmacDrbg({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || 'utf8',\n nonce: this.n.toArray(),\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(2));\n for (;;) {\n var priv = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyFromPrivate(priv);\n }\n};\n\nEC.prototype._truncateToN = function _truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.ushrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, enc, options) {\n if (typeof enc === 'object') {\n options = enc;\n enc = null;\n }\n if (!options)\n options = {};\n\n key = this.keyFromPrivate(key, enc);\n msg = this._truncateToN(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(msg, 16));\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray('be', bytes);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray('be', bytes);\n\n // Instantiate Hmac_DRBG\n var drbg = new hmacDrbg({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1));\n\n for (var iter = 0; ; iter++) {\n var k = options.k ?\n options.k(iter) :\n new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var kpX = kp.getX();\n var r = kpX.umod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));\n s = s.umod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |\n (kpX.cmp(r) !== 0 ? 2 : 0);\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0) {\n s = this.n.sub(s);\n recoveryParam ^= 1;\n }\n\n return new signature({ r: r, s: s, recoveryParam: recoveryParam });\n }\n};\n\nEC.prototype.verify = function verify(msg, signature$1, key, enc) {\n msg = this._truncateToN(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(msg, 16));\n key = this.keyFromPublic(key, enc);\n signature$1 = new signature(signature$1, 'hex');\n\n // Perform primitive values validation\n var r = signature$1.r;\n var s = signature$1.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).umod(this.n);\n var u2 = sinv.mul(r).umod(this.n);\n var p;\n\n if (!this.curve._maxwellTrick) {\n p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().umod(this.n).cmp(r) === 0;\n }\n\n // NOTE: Greg Maxwell's trick, inspired by:\n // https://git.io/vad3K\n\n p = this.g.jmulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n // Compare `p.x` of Jacobian point with `r`,\n // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the\n // inverse of `p.z^2`\n return p.eqXToP(r);\n};\n\nEC.prototype.recoverPubKey = function(msg, signature$1, j, enc) {\n assert$5((3 & j) === j, 'The recovery param is more than two bits');\n signature$1 = new signature(signature$1, enc);\n\n var n = this.n;\n var e = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(msg);\n var r = signature$1.r;\n var s = signature$1.s;\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = j & 1;\n var isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error('Unable to find sencond key candinate');\n\n // 1.1. Let x = r + jn.\n if (isSecondKey)\n r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);\n else\n r = this.curve.pointFromX(r, isYOdd);\n\n var rInv = signature$1.r.invm(n);\n var s1 = n.sub(e).mul(rInv).umod(n);\n var s2 = s.mul(rInv).umod(n);\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n return this.g.mulAdd(s1, r, s2);\n};\n\nEC.prototype.getKeyRecoveryParam = function(e, signature$1, Q, enc) {\n signature$1 = new signature(signature$1, enc);\n if (signature$1.recoveryParam !== null)\n return signature$1.recoveryParam;\n\n for (var i = 0; i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature$1, i);\n } catch (e) {\n continue;\n }\n\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error('Unable to find valid recovery factor');\n};\n\nvar elliptic_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar elliptic = exports;\n\nelliptic.version = /*RicMoo:ethers*/{ version: \"6.5.4\" }.version;\nelliptic.utils = utils_1$1;\nelliptic.rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); });\nelliptic.curve = curve_1;\nelliptic.curves = curves_1;\n\n// Protocols\nelliptic.ec = ec;\nelliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null);\n});\n\nvar EC$1 = elliptic_1.ec;\n\n\n//# sourceMappingURL=elliptic.js.map\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js?"); +Node.prototype.def = function def(val) { + var state = this._baseState; -/***/ }), + assert(state['default'] === null); + state['default'] = val; + state.optional = true; -/***/ "./node_modules/@ethersproject/signing-key/lib.esm/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/lib.esm/index.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return this; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SigningKey\": function() { return /* binding */ SigningKey; },\n/* harmony export */ \"computePublicKey\": function() { return /* binding */ computePublicKey; },\n/* harmony export */ \"recoverPublicKey\": function() { return /* binding */ recoverPublicKey; }\n/* harmony export */ });\n/* harmony import */ var _elliptic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./elliptic */ \"./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/signing-key/lib.esm/_version.js\");\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nlet _curve = null;\nfunction getCurve() {\n if (!_curve) {\n _curve = new _elliptic__WEBPACK_IMPORTED_MODULE_2__.EC(\"secp256k1\");\n }\n return _curve;\n}\nclass SigningKey {\n constructor(privateKey) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"curve\", \"secp256k1\");\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"privateKey\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(privateKey));\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexDataLength)(this.privateKey) !== 32) {\n logger.throwArgumentError(\"invalid private key\", \"privateKey\", \"[[ REDACTED ]]\");\n }\n const keyPair = getCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"publicKey\", \"0x\" + keyPair.getPublic(false, \"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"compressedPublicKey\", \"0x\" + keyPair.getPublic(true, \"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"_isSigningKey\", true);\n }\n _addPoint(other) {\n const p0 = getCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.publicKey));\n const p1 = getCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(other));\n return \"0x\" + p0.pub.add(p1.pub).encodeCompressed(\"hex\");\n }\n signDigest(digest) {\n console.log(`no1 signDigest(${digest})`);\n const keyPair = getCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n const digestBytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(digest);\n if (digestBytes.length !== 32) {\n logger.throwArgumentError(\"bad digest length\", \"digest\", digest);\n }\n const signature = keyPair.sign(digestBytes, { canonical: true });\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.splitSignature)({\n recoveryParam: signature.recoveryParam,\n r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + signature.r.toString(16), 32),\n s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + signature.s.toString(16), 32),\n });\n }\n computeSharedSecret(otherKey) {\n const keyPair = getCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n const otherKeyPair = getCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(computePublicKey(otherKey)));\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);\n }\n static isSigningKey(value) {\n return !!(value && value._isSigningKey);\n }\n}\nfunction recoverPublicKey(digest, signature) {\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.splitSignature)(signature);\n const rs = { r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(sig.r), s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(sig.s) };\n return \"0x\" + getCurve().recoverPubKey((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(digest), rs, sig.recoveryParam).encode(\"hex\", false);\n}\nfunction computePublicKey(key, compressed) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(key);\n if (bytes.length === 32) {\n const signingKey = new SigningKey(bytes);\n if (compressed) {\n return \"0x\" + getCurve().keyFromPrivate(bytes).getPublic(true, \"hex\");\n }\n return signingKey.publicKey;\n }\n else if (bytes.length === 33) {\n if (compressed) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes);\n }\n return \"0x\" + getCurve().keyFromPublic(bytes).getPublic(false, \"hex\");\n }\n else if (bytes.length === 65) {\n if (!compressed) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes);\n }\n return \"0x\" + getCurve().keyFromPublic(bytes).getPublic(true, \"hex\");\n }\n return logger.throwArgumentError(\"invalid public or private key\", \"key\", \"[REDACTED]\");\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/signing-key/lib.esm/index.js?"); +Node.prototype.explicit = function explicit(num) { + var state = this._baseState; -/***/ }), + assert(state.explicit === null && state.implicit === null); + state.explicit = num; + + return this; +}; + +Node.prototype.implicit = function implicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.implicit = num; + + return this; +}; + +Node.prototype.obj = function obj() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + state.obj = true; + + if (args.length !== 0) + this._useArgs(args); + + return this; +}; + +Node.prototype.key = function key(newKey) { + var state = this._baseState; -/***/ "./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/_version.js": -/*!************************************************************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/_version.js ***! - \************************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + assert(state.key === null); + state.key = newKey; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"properties/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/_version.js?"); + return this; +}; -/***/ }), +Node.prototype.any = function any() { + var state = this._baseState; -/***/ "./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/index.js": -/*!*********************************************************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/index.js ***! - \*********************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + state.any = true; + + return this; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Description\": function() { return /* binding */ Description; },\n/* harmony export */ \"checkProperties\": function() { return /* binding */ checkProperties; },\n/* harmony export */ \"deepCopy\": function() { return /* binding */ deepCopy; },\n/* harmony export */ \"defineReadOnly\": function() { return /* binding */ defineReadOnly; },\n/* harmony export */ \"getStatic\": function() { return /* binding */ getStatic; },\n/* harmony export */ \"resolveProperties\": function() { return /* binding */ resolveProperties; },\n/* harmony export */ \"shallowCopy\": function() { return /* binding */ shallowCopy; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/_version.js\");\n\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n// Crawl up the constructor chain to find a static method\nfunction getStatic(ctor, key) {\n for (let i = 0; i < 32; i++) {\n if (ctor[key]) {\n return ctor[key];\n }\n if (!ctor.prototype || typeof (ctor.prototype) !== \"object\") {\n break;\n }\n ctor = Object.getPrototypeOf(ctor.prototype).constructor;\n }\n return null;\n}\nfunction resolveProperties(object) {\n return __awaiter(this, void 0, void 0, function* () {\n const promises = Object.keys(object).map((key) => {\n const value = object[key];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n const results = yield Promise.all(promises);\n return results.reduce((accum, result) => {\n accum[(result.key)] = result.value;\n return accum;\n }, {});\n });\n}\nfunction checkProperties(object, properties) {\n if (!object || typeof (object) !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\nfunction shallowCopy(object) {\n const result = {};\n for (const key in object) {\n result[key] = object[key];\n }\n return result;\n}\nconst opaque = { bigint: true, boolean: true, \"function\": true, number: true, string: true };\nfunction _isFrozen(object) {\n // Opaque objects are not mutable, so safe to copy by assignment\n if (object === undefined || object === null || opaque[typeof (object)]) {\n return true;\n }\n if (Array.isArray(object) || typeof (object) === \"object\") {\n if (!Object.isFrozen(object)) {\n return false;\n }\n const keys = Object.keys(object);\n for (let i = 0; i < keys.length; i++) {\n let value = null;\n try {\n value = object[keys[i]];\n }\n catch (error) {\n // If accessing a value triggers an error, it is a getter\n // designed to do so (e.g. Result) and is therefore \"frozen\"\n continue;\n }\n if (!_isFrozen(value)) {\n return false;\n }\n }\n return true;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\n// Returns a new copy of object, such that no properties may be replaced.\n// New properties may be added only to objects.\nfunction _deepCopy(object) {\n if (_isFrozen(object)) {\n return object;\n }\n // Arrays are mutable, so we need to create a copy\n if (Array.isArray(object)) {\n return Object.freeze(object.map((item) => deepCopy(item)));\n }\n if (typeof (object) === \"object\") {\n const result = {};\n for (const key in object) {\n const value = object[key];\n if (value === undefined) {\n continue;\n }\n defineReadOnly(result, key, deepCopy(value));\n }\n return result;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\nfunction deepCopy(object) {\n return _deepCopy(object);\n}\nclass Description {\n constructor(info) {\n for (const key in info) {\n this[key] = deepCopy(info[key]);\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/signing-key/node_modules/@ethersproject/properties/lib.esm/index.js?"); +Node.prototype.choice = function choice(obj) { + var state = this._baseState; + + assert(state.choice === null); + state.choice = obj; + this._useArgs(Object.keys(obj).map(function(key) { + return obj[key]; + })); -/***/ }), + return this; +}; -/***/ "./node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js ***! - \******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +Node.prototype.contains = function contains(item) { + var state = this._baseState; -eval("/* module decorator */ module = __webpack_require__.nmd(module);\n(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = (__webpack_require__(/*! buffer */ \"?0707\").Buffer);\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})( false || module, this);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js?"); + assert(state.use === null); + state.contains = item; -/***/ }), + return this; +}; -/***/ "./node_modules/@ethersproject/strings/lib.esm/_version.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/strings/lib.esm/_version.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +// +// Decoding +// + +Node.prototype._decode = function decode(input, options) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return input.wrapResult(state.children[0]._decode(input, options)); + + var result = state['default']; + var present = true; + + var prevKey = null; + if (state.key !== null) + prevKey = input.enterKey(state.key); + + // Check if tag is there + if (state.optional) { + var tag = null; + if (state.explicit !== null) + tag = state.explicit; + else if (state.implicit !== null) + tag = state.implicit; + else if (state.tag !== null) + tag = state.tag; + + if (tag === null && !state.any) { + // Trial and Error + var save = input.save(); + try { + if (state.choice === null) + this._decodeGeneric(state.tag, input, options); + else + this._decodeChoice(input, options); + present = true; + } catch (e) { + present = false; + } + input.restore(save); + } else { + present = this._peekTag(input, tag, state.any); + + if (input.isError(present)) + return present; + } + } + + // Push object on stack + var prevObj; + if (state.obj && present) + prevObj = input.enterObject(); + + if (present) { + // Unwrap explicit values + if (state.explicit !== null) { + var explicit = this._decodeTag(input, state.explicit); + if (input.isError(explicit)) + return explicit; + input = explicit; + } + + var start = input.offset; + + // Unwrap implicit and normal values + if (state.use === null && state.choice === null) { + if (state.any) + var save = input.save(); + var body = this._decodeTag( + input, + state.implicit !== null ? state.implicit : state.tag, + state.any + ); + if (input.isError(body)) + return body; + + if (state.any) + result = input.raw(save); + else + input = body; + } + + if (options && options.track && state.tag !== null) + options.track(input.path(), start, input.length, 'tagged'); + + if (options && options.track && state.tag !== null) + options.track(input.path(), input.offset, input.length, 'content'); + + // Select proper method for tag + if (state.any) + result = result; + else if (state.choice === null) + result = this._decodeGeneric(state.tag, input, options); + else + result = this._decodeChoice(input, options); + + if (input.isError(result)) + return result; + + // Decode children + if (!state.any && state.choice === null && state.children !== null) { + state.children.forEach(function decodeChildren(child) { + // NOTE: We are ignoring errors here, to let parser continue with other + // parts of encoded data + child._decode(input, options); + }); + } + + // Decode contained/encoded by schema, only in bit or octet strings + if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) { + var data = new DecoderBuffer(result); + result = this._getUse(state.contains, input._reporterState.obj) + ._decode(data, options); + } + } + + // Pop object + if (state.obj && present) + result = input.leaveObject(prevObj); + + // Set key + if (state.key !== null && (result !== null || present === true)) + input.leaveKey(prevKey, state.key, result); + else if (prevKey !== null) + input.exitKey(prevKey); + + return result; +}; + +Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) { + var state = this._baseState; + + if (tag === 'seq' || tag === 'set') + return null; + if (tag === 'seqof' || tag === 'setof') + return this._decodeList(input, tag, state.args[0], options); + else if (/str$/.test(tag)) + return this._decodeStr(input, tag, options); + else if (tag === 'objid' && state.args) + return this._decodeObjid(input, state.args[0], state.args[1], options); + else if (tag === 'objid') + return this._decodeObjid(input, null, null, options); + else if (tag === 'gentime' || tag === 'utctime') + return this._decodeTime(input, tag, options); + else if (tag === 'null_') + return this._decodeNull(input, options); + else if (tag === 'bool') + return this._decodeBool(input, options); + else if (tag === 'objDesc') + return this._decodeStr(input, tag, options); + else if (tag === 'int' || tag === 'enum') + return this._decodeInt(input, state.args && state.args[0], options); + + if (state.use !== null) { + return this._getUse(state.use, input._reporterState.obj) + ._decode(input, options); + } else { + return input.error('unknown tag: ' + tag); + } +}; + +Node.prototype._getUse = function _getUse(entity, obj) { + + var state = this._baseState; + // Create altered use decoder if implicit is set + state.useDecoder = this._use(entity, obj); + assert(state.useDecoder._baseState.parent === null); + state.useDecoder = state.useDecoder._baseState.children[0]; + if (state.implicit !== state.useDecoder._baseState.implicit) { + state.useDecoder = state.useDecoder.clone(); + state.useDecoder._baseState.implicit = state.implicit; + } + return state.useDecoder; +}; + +Node.prototype._decodeChoice = function decodeChoice(input, options) { + var state = this._baseState; + var result = null; + var match = false; + + Object.keys(state.choice).some(function(key) { + var save = input.save(); + var node = state.choice[key]; + try { + var value = node._decode(input, options); + if (input.isError(value)) + return false; + + result = { type: key, value: value }; + match = true; + } catch (e) { + input.restore(save); + return false; + } + return true; + }, this); + + if (!match) + return input.error('Choice not matched'); + + return result; +}; + +// +// Encoding +// + +Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) { + return new EncoderBuffer(data, this.reporter); +}; + +Node.prototype._encode = function encode(data, reporter, parent) { + var state = this._baseState; + if (state['default'] !== null && state['default'] === data) + return; + + var result = this._encodeValue(data, reporter, parent); + if (result === undefined) + return; + + if (this._skipDefault(result, reporter, parent)) + return; + + return result; +}; + +Node.prototype._encodeValue = function encode(data, reporter, parent) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return state.children[0]._encode(data, reporter || new Reporter()); + + var result = null; + + // Set reporter to share it with a child class + this.reporter = reporter; + + // Check if data is there + if (state.optional && data === undefined) { + if (state['default'] !== null) + data = state['default'] + else + return; + } + + // Encode children first + var content = null; + var primitive = false; + if (state.any) { + // Anything that was given is translated to buffer + result = this._createEncoderBuffer(data); + } else if (state.choice) { + result = this._encodeChoice(data, reporter); + } else if (state.contains) { + content = this._getUse(state.contains, parent)._encode(data, reporter); + primitive = true; + } else if (state.children) { + content = state.children.map(function(child) { + if (child._baseState.tag === 'null_') + return child._encode(null, reporter, data); + + if (child._baseState.key === null) + return reporter.error('Child should have a key'); + var prevKey = reporter.enterKey(child._baseState.key); + + if (typeof data !== 'object') + return reporter.error('Child expected, but input is not object'); + + var res = child._encode(data[child._baseState.key], reporter, data); + reporter.leaveKey(prevKey); + + return res; + }, this).filter(function(child) { + return child; + }); + content = this._createEncoderBuffer(content); + } else { + if (state.tag === 'seqof' || state.tag === 'setof') { + // TODO(indutny): this should be thrown on DSL level + if (!(state.args && state.args.length === 1)) + return reporter.error('Too many args for : ' + state.tag); + + if (!Array.isArray(data)) + return reporter.error('seqof/setof, but data is not Array'); + + var child = this.clone(); + child._baseState.implicit = null; + content = this._createEncoderBuffer(data.map(function(item) { + var state = this._baseState; + + return this._getUse(state.args[0], data)._encode(item, reporter); + }, child)); + } else if (state.use !== null) { + result = this._getUse(state.use, parent)._encode(data, reporter); + } else { + content = this._encodePrimitive(state.tag, data); + primitive = true; + } + } + + // Encode data itself + var result; + if (!state.any && state.choice === null) { + var tag = state.implicit !== null ? state.implicit : state.tag; + var cls = state.implicit === null ? 'universal' : 'context'; + + if (tag === null) { + if (state.use === null) + reporter.error('Tag could be omitted only for .use()'); + } else { + if (state.use === null) + result = this._encodeComposite(tag, primitive, cls, content); + } + } + + // Wrap in explicit + if (state.explicit !== null) + result = this._encodeComposite(state.explicit, false, 'context', result); + + return result; +}; + +Node.prototype._encodeChoice = function encodeChoice(data, reporter) { + var state = this._baseState; + + var node = state.choice[data.type]; + if (!node) { + assert( + false, + data.type + ' not found in ' + + JSON.stringify(Object.keys(state.choice))); + } + return node._encode(data.value, reporter); +}; + +Node.prototype._encodePrimitive = function encodePrimitive(tag, data) { + var state = this._baseState; + + if (/str$/.test(tag)) + return this._encodeStr(data, tag); + else if (tag === 'objid' && state.args) + return this._encodeObjid(data, state.reverseArgs[0], state.args[1]); + else if (tag === 'objid') + return this._encodeObjid(data, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._encodeTime(data, tag); + else if (tag === 'null_') + return this._encodeNull(); + else if (tag === 'int' || tag === 'enum') + return this._encodeInt(data, state.args && state.reverseArgs[0]); + else if (tag === 'bool') + return this._encodeBool(data); + else if (tag === 'objDesc') + return this._encodeStr(data, tag); + else + throw new Error('Unsupported tag: ' + tag); +}; + +Node.prototype._isNumstr = function isNumstr(str) { + return /^[0-9 ]*$/.test(str); +}; + +Node.prototype._isPrintstr = function isPrintstr(str) { + return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str); +}; + + +/***/ }), + +/***/ 8465: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"strings/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/strings/lib.esm/_version.js?"); +var inherits = __webpack_require__(5717); -/***/ }), +function Reporter(options) { + this._reporterState = { + obj: null, + path: [], + options: options || {}, + errors: [] + }; +} +exports.b = Reporter; + +Reporter.prototype.isError = function isError(obj) { + return obj instanceof ReporterError; +}; + +Reporter.prototype.save = function save() { + var state = this._reporterState; + + return { obj: state.obj, pathLen: state.path.length }; +}; + +Reporter.prototype.restore = function restore(data) { + var state = this._reporterState; -/***/ "./node_modules/@ethersproject/strings/lib.esm/utf8.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/strings/lib.esm/utf8.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + state.obj = data.obj; + state.path = state.path.slice(0, data.pathLen); +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"UnicodeNormalizationForm\": function() { return /* binding */ UnicodeNormalizationForm; },\n/* harmony export */ \"Utf8ErrorFuncs\": function() { return /* binding */ Utf8ErrorFuncs; },\n/* harmony export */ \"Utf8ErrorReason\": function() { return /* binding */ Utf8ErrorReason; },\n/* harmony export */ \"_toEscapedUtf8String\": function() { return /* binding */ _toEscapedUtf8String; },\n/* harmony export */ \"_toUtf8String\": function() { return /* binding */ _toUtf8String; },\n/* harmony export */ \"toUtf8Bytes\": function() { return /* binding */ toUtf8Bytes; },\n/* harmony export */ \"toUtf8CodePoints\": function() { return /* binding */ toUtf8CodePoints; },\n/* harmony export */ \"toUtf8String\": function() { return /* binding */ toUtf8String; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/strings/lib.esm/_version.js\");\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nvar UnicodeNormalizationForm;\n(function (UnicodeNormalizationForm) {\n UnicodeNormalizationForm[\"current\"] = \"\";\n UnicodeNormalizationForm[\"NFC\"] = \"NFC\";\n UnicodeNormalizationForm[\"NFD\"] = \"NFD\";\n UnicodeNormalizationForm[\"NFKC\"] = \"NFKC\";\n UnicodeNormalizationForm[\"NFKD\"] = \"NFKD\";\n})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {}));\n;\nvar Utf8ErrorReason;\n(function (Utf8ErrorReason) {\n // A continuation byte was present where there was nothing to continue\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"UNEXPECTED_CONTINUE\"] = \"unexpected continuation byte\";\n // An invalid (non-continuation) byte to start a UTF-8 codepoint was found\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"BAD_PREFIX\"] = \"bad codepoint prefix\";\n // The string is too short to process the expected codepoint\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"OVERRUN\"] = \"string overrun\";\n // A missing continuation byte was expected but not found\n // - offset = the index the continuation byte was expected at\n Utf8ErrorReason[\"MISSING_CONTINUE\"] = \"missing continuation byte\";\n // The computed code point is outside the range for UTF-8\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; outside the UTF-8 range\n Utf8ErrorReason[\"OUT_OF_RANGE\"] = \"out of UTF-8 range\";\n // UTF-8 strings may not contain UTF-16 surrogate pairs\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range\n Utf8ErrorReason[\"UTF16_SURROGATE\"] = \"UTF-16 surrogate\";\n // The string is an overlong representation\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; already bounds checked\n Utf8ErrorReason[\"OVERLONG\"] = \"overlong representation\";\n})(Utf8ErrorReason || (Utf8ErrorReason = {}));\n;\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n return logger.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === Utf8ErrorReason.OVERRUN) {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === Utf8ErrorReason.OVERLONG) {\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n// Common error handing strategies\nconst Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(bytes);\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);\n }\n else {\n i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nfunction toUtf8Bytes(str, form = UnicodeNormalizationForm.current) {\n if (form != UnicodeNormalizationForm.current) {\n logger.checkNormalize();\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) {\n throw new Error(\"invalid utf-8 string\");\n }\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(result);\n}\n;\nfunction escapeChar(value) {\n const hex = (\"0000\" + value.toString(16));\n return \"\\\\u\" + hex.substring(hex.length - 4);\n}\nfunction _toEscapedUtf8String(bytes, onError) {\n return '\"' + getUtf8CodePoints(bytes, onError).map((codePoint) => {\n if (codePoint < 256) {\n switch (codePoint) {\n case 8: return \"\\\\b\";\n case 9: return \"\\\\t\";\n case 10: return \"\\\\n\";\n case 13: return \"\\\\r\";\n case 34: return \"\\\\\\\"\";\n case 92: return \"\\\\\\\\\";\n }\n if (codePoint >= 32 && codePoint < 127) {\n return String.fromCharCode(codePoint);\n }\n }\n if (codePoint <= 0xffff) {\n return escapeChar(codePoint);\n }\n codePoint -= 0x10000;\n return escapeChar(((codePoint >> 10) & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00);\n }).join(\"\") + '\"';\n}\nfunction _toUtf8String(codePoints) {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));\n }).join(\"\");\n}\nfunction toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\nfunction toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/strings/lib.esm/utf8.js?"); +Reporter.prototype.enterKey = function enterKey(key) { + return this._reporterState.path.push(key); +}; -/***/ }), +Reporter.prototype.exitKey = function exitKey(index) { + var state = this._reporterState; -/***/ "./node_modules/@ethersproject/transactions/lib.esm/_version.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@ethersproject/transactions/lib.esm/_version.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + state.path = state.path.slice(0, index - 1); +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"transactions/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/transactions/lib.esm/_version.js?"); +Reporter.prototype.leaveKey = function leaveKey(index, key, value) { + var state = this._reporterState; -/***/ }), + this.exitKey(index); + if (state.obj !== null) + state.obj[key] = value; +}; -/***/ "./node_modules/@ethersproject/transactions/lib.esm/index.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/transactions/lib.esm/index.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +Reporter.prototype.path = function path() { + return this._reporterState.path.join('/'); +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TransactionTypes\": function() { return /* binding */ TransactionTypes; },\n/* harmony export */ \"accessListify\": function() { return /* binding */ accessListify; },\n/* harmony export */ \"computeAddress\": function() { return /* binding */ computeAddress; },\n/* harmony export */ \"parse\": function() { return /* binding */ parse; },\n/* harmony export */ \"recoverAddress\": function() { return /* binding */ recoverAddress; },\n/* harmony export */ \"serialize\": function() { return /* binding */ serialize; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/address */ \"./node_modules/@ethersproject/address/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/constants */ \"./node_modules/@ethersproject/constants/lib.esm/bignumbers.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/signing-key */ \"./node_modules/@ethersproject/signing-key/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/transactions/lib.esm/_version.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nvar TransactionTypes;\n(function (TransactionTypes) {\n TransactionTypes[TransactionTypes[\"legacy\"] = 0] = \"legacy\";\n TransactionTypes[TransactionTypes[\"eip2930\"] = 1] = \"eip2930\";\n TransactionTypes[TransactionTypes[\"eip1559\"] = 2] = \"eip1559\";\n})(TransactionTypes || (TransactionTypes = {}));\n;\n///////////////////////////////\nfunction handleAddress(value) {\n if (value === \"0x\") {\n return null;\n }\n return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(value);\n}\nfunction handleNumber(value) {\n if (value === \"0x\") {\n return _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__.Zero;\n }\n return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(value);\n}\n// Legacy Transaction Fields\nconst transactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"gasPrice\", maxLength: 32, numeric: true },\n { name: \"gasLimit\", maxLength: 32, numeric: true },\n { name: \"to\", length: 20 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n];\nconst allowedTransactionKeys = {\n chainId: true, data: true, gasLimit: true, gasPrice: true, nonce: true, to: true, type: true, value: true\n};\nfunction computeAddress(key) {\n const publicKey = (0,_ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_5__.computePublicKey)(key);\n return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexDataSlice)(publicKey, 1)), 12));\n}\nfunction recoverAddress(digest, signature) {\n return computeAddress((0,_ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_5__.recoverPublicKey)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(digest), signature));\n}\nfunction formatNumber(value, name) {\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(value).toHexString());\n if (result.length > 32) {\n logger.throwArgumentError(\"invalid length for \" + name, (\"transaction:\" + name), value);\n }\n return result;\n}\nfunction accessSetify(addr, storageKeys) {\n return {\n address: (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(addr),\n storageKeys: (storageKeys || []).map((storageKey, index) => {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexDataLength)(storageKey) !== 32) {\n logger.throwArgumentError(\"invalid access list storageKey\", `accessList[${addr}:${index}]`, storageKey);\n }\n return storageKey.toLowerCase();\n })\n };\n}\nfunction accessListify(value) {\n if (Array.isArray(value)) {\n return value.map((set, index) => {\n if (Array.isArray(set)) {\n if (set.length > 2) {\n logger.throwArgumentError(\"access list expected to be [ address, storageKeys[] ]\", `value[${index}]`, set);\n }\n return accessSetify(set[0], set[1]);\n }\n return accessSetify(set.address, set.storageKeys);\n });\n }\n const result = Object.keys(value).map((addr) => {\n const storageKeys = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, {});\n return accessSetify(addr, Object.keys(storageKeys).sort());\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\nfunction formatAccessList(value) {\n return accessListify(value).map((set) => [set.address, set.storageKeys]);\n}\nfunction _serializeEip1559(transaction, signature) {\n // If there is an explicit gasPrice, make sure it matches the\n // EIP-1559 fees; otherwise they may not understand what they\n // think they are setting in terms of fee.\n if (transaction.gasPrice != null) {\n const gasPrice = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction.gasPrice);\n const maxFeePerGas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction.maxFeePerGas || 0);\n if (!gasPrice.eq(maxFeePerGas)) {\n logger.throwArgumentError(\"mismatch EIP-1559 gasPrice != maxFeePerGas\", \"tx\", {\n gasPrice, maxFeePerGas\n });\n }\n }\n const fields = [\n formatNumber(transaction.chainId || 0, \"chainId\"),\n formatNumber(transaction.nonce || 0, \"nonce\"),\n formatNumber(transaction.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(transaction.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(transaction.gasLimit || 0, \"gasLimit\"),\n ((transaction.to != null) ? (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(transaction.to) : \"0x\"),\n formatNumber(transaction.value || 0, \"value\"),\n (transaction.data || \"0x\"),\n (formatAccessList(transaction.accessList || []))\n ];\n if (signature) {\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.splitSignature)(signature);\n fields.push(formatNumber(sig.recoveryParam, \"recoveryParam\"));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.r));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.s));\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexConcat)([\"0x02\", _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(fields)]);\n}\nfunction _serializeEip2930(transaction, signature) {\n const fields = [\n formatNumber(transaction.chainId || 0, \"chainId\"),\n formatNumber(transaction.nonce || 0, \"nonce\"),\n formatNumber(transaction.gasPrice || 0, \"gasPrice\"),\n formatNumber(transaction.gasLimit || 0, \"gasLimit\"),\n ((transaction.to != null) ? (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(transaction.to) : \"0x\"),\n formatNumber(transaction.value || 0, \"value\"),\n (transaction.data || \"0x\"),\n (formatAccessList(transaction.accessList || []))\n ];\n if (signature) {\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.splitSignature)(signature);\n fields.push(formatNumber(sig.recoveryParam, \"recoveryParam\"));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.r));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.s));\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexConcat)([\"0x01\", _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(fields)]);\n}\n// Legacy Transactions and EIP-155\nfunction _serialize(transaction, signature) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_9__.checkProperties)(transaction, allowedTransactionKeys);\n const raw = [];\n transactionFields.forEach(function (fieldInfo) {\n let value = transaction[fieldInfo.name] || ([]);\n const options = {};\n if (fieldInfo.numeric) {\n options.hexPad = \"left\";\n }\n value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(value, options));\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value);\n }\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(value);\n if (value.length > fieldInfo.maxLength) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value);\n }\n }\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(value));\n });\n let chainId = 0;\n if (transaction.chainId != null) {\n // A chainId was provided; if non-zero we'll use EIP-155\n chainId = transaction.chainId;\n if (typeof (chainId) !== \"number\") {\n logger.throwArgumentError(\"invalid transaction.chainId\", \"transaction\", transaction);\n }\n }\n else if (signature && !(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.isBytesLike)(signature) && signature.v > 28) {\n // No chainId provided, but the signature is signing with EIP-155; derive chainId\n chainId = Math.floor((signature.v - 35) / 2);\n }\n // We have an EIP-155 transaction (chainId was specified and non-zero)\n if (chainId !== 0) {\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(chainId)); // @TODO: hexValue?\n raw.push(\"0x\");\n raw.push(\"0x\");\n }\n // Requesting an unsigned transaction\n if (!signature) {\n return _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(raw);\n }\n // The splitSignature will ensure the transaction has a recoveryParam in the\n // case that the signTransaction function only adds a v.\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.splitSignature)(signature);\n // We pushed a chainId and null r, s on for hashing only; remove those\n let v = 27 + sig.recoveryParam;\n if (chainId !== 0) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += chainId * 2 + 8;\n // If an EIP-155 v (directly or indirectly; maybe _vs) was provided, check it!\n if (sig.v > 28 && sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n }\n else if (sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(v));\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(sig.r)));\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(sig.s)));\n return _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(raw);\n}\nfunction serialize(transaction, signature) {\n // Legacy and EIP-155 Transactions\n if (transaction.type == null || transaction.type === 0) {\n if (transaction.accessList != null) {\n logger.throwArgumentError(\"untyped transactions do not support accessList; include type: 1\", \"transaction\", transaction);\n }\n return _serialize(transaction, signature);\n }\n // Typed Transactions (EIP-2718)\n switch (transaction.type) {\n case 1:\n return _serializeEip2930(transaction, signature);\n case 2:\n return _serializeEip1559(transaction, signature);\n default:\n break;\n }\n return logger.throwError(`unsupported transaction type: ${transaction.type}`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"serializeTransaction\",\n transactionType: transaction.type\n });\n}\nfunction _parseEipSignature(tx, fields, serialize) {\n try {\n const recid = handleNumber(fields[0]).toNumber();\n if (recid !== 0 && recid !== 1) {\n throw new Error(\"bad recid\");\n }\n tx.v = recid;\n }\n catch (error) {\n logger.throwArgumentError(\"invalid v for transaction type: 1\", \"v\", fields[0]);\n }\n tx.r = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(fields[1], 32);\n tx.s = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(fields[2], 32);\n try {\n const digest = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(serialize(tx));\n tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v });\n }\n catch (error) { }\n}\nfunction _parseEip1559(payload) {\n const transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.decode(payload.slice(1));\n if (transaction.length !== 9 && transaction.length !== 12) {\n logger.throwArgumentError(\"invalid component count for transaction type: 2\", \"payload\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(payload));\n }\n const maxPriorityFeePerGas = handleNumber(transaction[2]);\n const maxFeePerGas = handleNumber(transaction[3]);\n const tx = {\n type: 2,\n chainId: handleNumber(transaction[0]).toNumber(),\n nonce: handleNumber(transaction[1]).toNumber(),\n maxPriorityFeePerGas: maxPriorityFeePerGas,\n maxFeePerGas: maxFeePerGas,\n gasPrice: null,\n gasLimit: handleNumber(transaction[4]),\n to: handleAddress(transaction[5]),\n value: handleNumber(transaction[6]),\n data: transaction[7],\n accessList: accessListify(transaction[8]),\n };\n // Unsigned EIP-1559 Transaction\n if (transaction.length === 9) {\n return tx;\n }\n tx.hash = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(payload);\n _parseEipSignature(tx, transaction.slice(9), _serializeEip1559);\n return tx;\n}\nfunction _parseEip2930(payload) {\n const transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.decode(payload.slice(1));\n if (transaction.length !== 8 && transaction.length !== 11) {\n logger.throwArgumentError(\"invalid component count for transaction type: 1\", \"payload\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(payload));\n }\n const tx = {\n type: 1,\n chainId: handleNumber(transaction[0]).toNumber(),\n nonce: handleNumber(transaction[1]).toNumber(),\n gasPrice: handleNumber(transaction[2]),\n gasLimit: handleNumber(transaction[3]),\n to: handleAddress(transaction[4]),\n value: handleNumber(transaction[5]),\n data: transaction[6],\n accessList: accessListify(transaction[7])\n };\n // Unsigned EIP-2930 Transaction\n if (transaction.length === 8) {\n return tx;\n }\n tx.hash = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(payload);\n _parseEipSignature(tx, transaction.slice(8), _serializeEip2930);\n return tx;\n}\n// Legacy Transactions and EIP-155\nfunction _parse(rawTransaction) {\n const transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.decode(rawTransaction);\n if (transaction.length !== 9 && transaction.length !== 6) {\n logger.throwArgumentError(\"invalid raw transaction\", \"rawTransaction\", rawTransaction);\n }\n const tx = {\n nonce: handleNumber(transaction[0]).toNumber(),\n gasPrice: handleNumber(transaction[1]),\n gasLimit: handleNumber(transaction[2]),\n to: handleAddress(transaction[3]),\n value: handleNumber(transaction[4]),\n data: transaction[5],\n chainId: 0\n };\n // Legacy unsigned transaction\n if (transaction.length === 6) {\n return tx;\n }\n try {\n tx.v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction[6]).toNumber();\n }\n catch (error) {\n // @TODO: What makes snese to do? The v is too big\n return tx;\n }\n tx.r = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(transaction[7], 32);\n tx.s = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(transaction[8], 32);\n if (_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(tx.r).isZero() && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(tx.s).isZero()) {\n // EIP-155 unsigned transaction\n tx.chainId = tx.v;\n tx.v = 0;\n }\n else {\n // Signed Transaction\n tx.chainId = Math.floor((tx.v - 35) / 2);\n if (tx.chainId < 0) {\n tx.chainId = 0;\n }\n let recoveryParam = tx.v - 27;\n const raw = transaction.slice(0, 6);\n if (tx.chainId !== 0) {\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(tx.chainId));\n raw.push(\"0x\");\n raw.push(\"0x\");\n recoveryParam -= tx.chainId * 2 + 8;\n }\n const digest = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(raw));\n try {\n tx.from = recoverAddress(digest, { r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(tx.r), s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(tx.s), recoveryParam: recoveryParam });\n }\n catch (error) { }\n tx.hash = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(rawTransaction);\n }\n tx.type = null;\n return tx;\n}\nfunction parse(rawTransaction) {\n const payload = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(rawTransaction);\n // Legacy and EIP-155 Transactions\n if (payload[0] > 0x7f) {\n return _parse(payload);\n }\n // Typed Transaction (EIP-2718)\n switch (payload[0]) {\n case 1:\n return _parseEip2930(payload);\n case 2:\n return _parseEip1559(payload);\n default:\n break;\n }\n return logger.throwError(`unsupported transaction type: ${payload[0]}`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"parseTransaction\",\n transactionType: payload[0]\n });\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/transactions/lib.esm/index.js?"); +Reporter.prototype.enterObject = function enterObject() { + var state = this._reporterState; -/***/ }), + var prev = state.obj; + state.obj = {}; + return prev; +}; -/***/ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/_version.js": -/*!*************************************************************************************************************!*\ - !*** ./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/_version.js ***! - \*************************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +Reporter.prototype.leaveObject = function leaveObject(prev) { + var state = this._reporterState; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"properties/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/_version.js?"); + var now = state.obj; + state.obj = prev; + return now; +}; -/***/ }), +Reporter.prototype.error = function error(msg) { + var err; + var state = this._reporterState; -/***/ "./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/index.js": -/*!**********************************************************************************************************!*\ - !*** ./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/index.js ***! - \**********************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + var inherited = msg instanceof ReporterError; + if (inherited) { + err = msg; + } else { + err = new ReporterError(state.path.map(function(elem) { + return '[' + JSON.stringify(elem) + ']'; + }).join(''), msg.message || msg, msg.stack); + } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Description\": function() { return /* binding */ Description; },\n/* harmony export */ \"checkProperties\": function() { return /* binding */ checkProperties; },\n/* harmony export */ \"deepCopy\": function() { return /* binding */ deepCopy; },\n/* harmony export */ \"defineReadOnly\": function() { return /* binding */ defineReadOnly; },\n/* harmony export */ \"getStatic\": function() { return /* binding */ getStatic; },\n/* harmony export */ \"resolveProperties\": function() { return /* binding */ resolveProperties; },\n/* harmony export */ \"shallowCopy\": function() { return /* binding */ shallowCopy; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/_version.js\");\n\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n// Crawl up the constructor chain to find a static method\nfunction getStatic(ctor, key) {\n for (let i = 0; i < 32; i++) {\n if (ctor[key]) {\n return ctor[key];\n }\n if (!ctor.prototype || typeof (ctor.prototype) !== \"object\") {\n break;\n }\n ctor = Object.getPrototypeOf(ctor.prototype).constructor;\n }\n return null;\n}\nfunction resolveProperties(object) {\n return __awaiter(this, void 0, void 0, function* () {\n const promises = Object.keys(object).map((key) => {\n const value = object[key];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n const results = yield Promise.all(promises);\n return results.reduce((accum, result) => {\n accum[(result.key)] = result.value;\n return accum;\n }, {});\n });\n}\nfunction checkProperties(object, properties) {\n if (!object || typeof (object) !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\nfunction shallowCopy(object) {\n const result = {};\n for (const key in object) {\n result[key] = object[key];\n }\n return result;\n}\nconst opaque = { bigint: true, boolean: true, \"function\": true, number: true, string: true };\nfunction _isFrozen(object) {\n // Opaque objects are not mutable, so safe to copy by assignment\n if (object === undefined || object === null || opaque[typeof (object)]) {\n return true;\n }\n if (Array.isArray(object) || typeof (object) === \"object\") {\n if (!Object.isFrozen(object)) {\n return false;\n }\n const keys = Object.keys(object);\n for (let i = 0; i < keys.length; i++) {\n let value = null;\n try {\n value = object[keys[i]];\n }\n catch (error) {\n // If accessing a value triggers an error, it is a getter\n // designed to do so (e.g. Result) and is therefore \"frozen\"\n continue;\n }\n if (!_isFrozen(value)) {\n return false;\n }\n }\n return true;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\n// Returns a new copy of object, such that no properties may be replaced.\n// New properties may be added only to objects.\nfunction _deepCopy(object) {\n if (_isFrozen(object)) {\n return object;\n }\n // Arrays are mutable, so we need to create a copy\n if (Array.isArray(object)) {\n return Object.freeze(object.map((item) => deepCopy(item)));\n }\n if (typeof (object) === \"object\") {\n const result = {};\n for (const key in object) {\n const value = object[key];\n if (value === undefined) {\n continue;\n }\n defineReadOnly(result, key, deepCopy(value));\n }\n return result;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\nfunction deepCopy(object) {\n return _deepCopy(object);\n}\nclass Description {\n constructor(info) {\n for (const key in info) {\n this[key] = deepCopy(info[key]);\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/transactions/node_modules/@ethersproject/properties/lib.esm/index.js?"); + if (!state.options.partial) + throw err; -/***/ }), + if (!inherited) + state.errors.push(err); -/***/ "./node_modules/@ethersproject/wordlists/lib.esm/_version.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/wordlists/lib.esm/_version.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return err; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"wordlists/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/wordlists/lib.esm/_version.js?"); +Reporter.prototype.wrapResult = function wrapResult(result) { + var state = this._reporterState; + if (!state.options.partial) + return result; -/***/ }), + return { + result: this.isError(result) ? null : result, + errors: state.errors + }; +}; -/***/ "./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js": -/*!******************************************************************!*\ - !*** ./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +function ReporterError(path, msg) { + this.path = path; + this.rethrow(msg); +}; +inherits(ReporterError, Error); + +ReporterError.prototype.rethrow = function rethrow(msg) { + this.message = msg + ' at: ' + (this.path || '(shallow)'); + if (Error.captureStackTrace) + Error.captureStackTrace(this, ReporterError); + + if (!this.stack) { + try { + // IE only adds stack when thrown + throw new Error(this.message); + } catch (e) { + this.stack = e.stack; + } + } + return this; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"langEn\": function() { return /* binding */ langEn; }\n/* harmony export */ });\n/* harmony import */ var _wordlist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wordlist */ \"./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js\");\n\n\nconst words = \"AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo\";\nlet wordlist = null;\nfunction loadWords(lang) {\n if (wordlist != null) {\n return;\n }\n wordlist = words.replace(/([A-Z])/g, \" $1\").toLowerCase().substring(1).split(\" \");\n // Verify the computed list matches the official list\n /* istanbul ignore if */\n if (_wordlist__WEBPACK_IMPORTED_MODULE_0__.Wordlist.check(lang) !== \"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60\") {\n wordlist = null;\n throw new Error(\"BIP39 Wordlist for en (English) FAILED\");\n }\n}\nclass LangEn extends _wordlist__WEBPACK_IMPORTED_MODULE_0__.Wordlist {\n constructor() {\n super(\"en\");\n }\n getWord(index) {\n loadWords(this);\n return wordlist[index];\n }\n getWordIndex(word) {\n loadWords(this);\n return wordlist.indexOf(word);\n }\n}\nconst langEn = new LangEn();\n_wordlist__WEBPACK_IMPORTED_MODULE_0__.Wordlist.register(langEn);\n\n//# sourceMappingURL=lang-en.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js?"); /***/ }), -/***/ "./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 160: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Wordlist\": function() { return /* binding */ Wordlist; },\n/* harmony export */ \"logger\": function() { return /* binding */ logger; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/hash */ \"./node_modules/@ethersproject/hash/lib.esm/id.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/wordlists/lib.esm/_version.js\");\n\n// This gets overridden by rollup\nconst exportWordlist = false;\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nclass Wordlist {\n constructor(locale) {\n logger.checkAbstract(new.target, Wordlist);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"locale\", locale);\n }\n // Subclasses may override this\n split(mnemonic) {\n return mnemonic.toLowerCase().split(/ +/g);\n }\n // Subclasses may override this\n join(words) {\n return words.join(\" \");\n }\n static check(wordlist) {\n const words = [];\n for (let i = 0; i < 2048; i++) {\n const word = wordlist.getWord(i);\n /* istanbul ignore if */\n if (i !== wordlist.getWordIndex(word)) {\n return \"0x\";\n }\n words.push(word);\n }\n return (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__.id)(words.join(\"\\n\") + \"\\n\");\n }\n static register(lang, name) {\n if (!name) {\n name = lang.locale;\n }\n /* istanbul ignore if */\n if (exportWordlist) {\n try {\n const anyGlobal = window;\n if (anyGlobal._ethers && anyGlobal._ethers.wordlists) {\n if (!anyGlobal._ethers.wordlists[name]) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(anyGlobal._ethers.wordlists, name, lang);\n }\n }\n }\n catch (error) { }\n }\n }\n}\n//# sourceMappingURL=wordlist.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js?"); +var constants = __webpack_require__(6826); + +exports.tagClass = { + 0: 'universal', + 1: 'application', + 2: 'context', + 3: 'private' +}; +exports.tagClassByName = constants._reverse(exports.tagClass); + +exports.tag = { + 0x00: 'end', + 0x01: 'bool', + 0x02: 'int', + 0x03: 'bitstr', + 0x04: 'octstr', + 0x05: 'null_', + 0x06: 'objid', + 0x07: 'objDesc', + 0x08: 'external', + 0x09: 'real', + 0x0a: 'enum', + 0x0b: 'embed', + 0x0c: 'utf8str', + 0x0d: 'relativeOid', + 0x10: 'seq', + 0x11: 'set', + 0x12: 'numstr', + 0x13: 'printstr', + 0x14: 't61str', + 0x15: 'videostr', + 0x16: 'ia5str', + 0x17: 'utctime', + 0x18: 'gentime', + 0x19: 'graphstr', + 0x1a: 'iso646str', + 0x1b: 'genstr', + 0x1c: 'unistr', + 0x1d: 'charstr', + 0x1e: 'bmpstr' +}; +exports.tagByName = constants._reverse(exports.tag); + + +/***/ }), + +/***/ 6826: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +var constants = exports; -/***/ "./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js": -/*!********************************************************************!*\ - !*** ./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +// Helper +constants._reverse = function reverse(map) { + var res = {}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"wordlists\": function() { return /* binding */ wordlists; }\n/* harmony export */ });\n/* harmony import */ var _lang_en__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lang-en */ \"./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js\");\n\n\nconst wordlists = {\n en: _lang_en__WEBPACK_IMPORTED_MODULE_0__.langEn\n};\n//# sourceMappingURL=wordlists.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js?"); + Object.keys(map).forEach(function(key) { + // Convert key to integer if it is stringified + if ((key | 0) == key) + key = key | 0; -/***/ }), + var value = map[key]; + res[value] = key; + }); -/***/ "./node_modules/@hashgraph/proto/lib/index.js": -/*!****************************************************!*\ - !*** ./node_modules/@hashgraph/proto/lib/index.js ***! - \****************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + return res; +}; + +constants.der = __webpack_require__(160); -"use strict"; -eval("Object.defineProperty(exports, \"__esModule\", ({value:!0})),exports.proto=exports.google=exports.com=exports.Writer=exports.Reader=void 0;var $protobuf=_interopRequireWildcard(__webpack_require__(/*! protobufjs/minimal.js */ \"./node_modules/protobufjs/minimal.js\")),_long=_interopRequireDefault(__webpack_require__(/*! long */ \"./node_modules/long/src/long.js\")),$proto=_interopRequireWildcard(__webpack_require__(/*! ./proto.js */ \"./node_modules/@hashgraph/proto/lib/proto.js\"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if(\"function\"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||\"object\"!=typeof a&&\"function\"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if(\"default\"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}(()=>{var a=$protobuf.util;null==a.Long&&(console.log(`Patching Protobuf Long.js instance...`),a.Long=_long.default,null!=$protobuf.Reader._configure&&$protobuf.Reader._configure($protobuf.BufferReader))})();const Reader=$protobuf.Reader;exports.Reader=Reader;const Writer=$protobuf.Writer;exports.Writer=Writer;const proto=$proto.proto;exports.proto=proto;const com=$proto.com;exports.com=com;const google=$proto.google;exports.google=google;\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/proto/lib/index.js?"); /***/ }), -/***/ "./node_modules/@hashgraph/proto/lib/proto.js": -/*!****************************************************!*\ - !*** ./node_modules/@hashgraph/proto/lib/proto.js ***! - \****************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 1671: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("var $protobuf=_interopRequireWildcard(__webpack_require__(/*! protobufjs/minimal */ \"./node_modules/protobufjs/minimal.js\"));Object.defineProperty(exports, \"__esModule\", ({value:!0})),exports.proto=exports.google=exports[\"default\"]=exports.com=void 0;function _getRequireWildcardCache(e){if(\"function\"!=typeof WeakMap)return null;var o=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:o})(e)}function _interopRequireWildcard(e,o){if(!o&&e&&e.__esModule)return e;if(null===e||\"object\"!=typeof e&&\"function\"!=typeof e)return{default:e};var t=_getRequireWildcardCache(o);if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in e)if(\"default\"!=d&&Object.prototype.hasOwnProperty.call(e,d)){var i=r?Object.getOwnPropertyDescriptor(e,d):null;i&&(i.get||i.set)?Object.defineProperty(n,d,i):n[d]=e[d]}return n.default=e,t&&t.set(e,n),n}const $Reader=$protobuf.Reader,$Writer=$protobuf.Writer,$util=$protobuf.util,$root=$protobuf.roots.hashgraph||($protobuf.roots.hashgraph={});exports[\"default\"]=$root;const com=$root.com=(()=>{const e={hedera:function(){const e={mirror:function(){const e={api:function(){const e={proto:function(){const e={ConsensusTopicQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.topicID=$root.proto.TopicID.decode(e,e.uint32());break;case 2:d.consensusStartTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 3:d.consensusEndTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 4:d.limit=e.uint64();break;default:e.skipType(7&i);}return d},e}(),ConsensusTopicResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break;case 2:d.message=e.bytes();break;case 3:d.runningHash=e.bytes();break;case 4:d.sequenceNumber=e.uint64();break;case 5:d.runningHashVersion=e.uint64();break;case 6:d.chunkInfo=$root.proto.ConsensusMessageChunkInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ConsensusService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.subscribeTopic=function t(e,o){return this.rpcCall(t,$root.com.hedera.mirror.api.proto.ConsensusTopicQuery,$root.com.hedera.mirror.api.proto.ConsensusTopicResponse,e,o)},\"name\",{value:\"subscribeTopic\"}),e}(),AddressBookQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileId=$root.proto.FileID.decode(e,e.uint32());break;case 2:d.limit=e.int32();break;default:e.skipType(7&i);}return d},e}(),NetworkService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.getNodes=function t(e,o){return this.rpcCall(t,$root.com.hedera.mirror.api.proto.AddressBookQuery,$root.proto.NodeAddress,e,o)},\"name\",{value:\"getNodes\"}),e}()};return e}()};return e}()};return e}()};return e}()};return e})();exports.com=com;const proto=$root.proto=(()=>{const e={TransactionList:function(){function e(e){if(this.transactionList=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transactionList&&d.transactionList.length||(d.transactionList=[]),d.transactionList.push($root.proto.Transaction.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),ShardID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;default:e.skipType(7&i);}return d},e}(),RealmID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;case 2:d.realmNum=e.int64();break;default:e.skipType(7&i);}return d},e}(),AccountID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;case 2:d.realmNum=e.int64();break;case 3:d.accountNum=e.int64();break;case 4:d.alias=e.bytes();break;default:e.skipType(7&i);}return d},e}(),FileID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;case 2:d.realmNum=e.int64();break;case 3:d.fileNum=e.int64();break;default:e.skipType(7&i);}return d},e}(),ContractID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;case 2:d.realmNum=e.int64();break;case 3:d.contractNum=e.int64();break;case 4:d.evmAddress=e.bytes();break;default:e.skipType(7&i);}return d},e}(),TransactionID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transactionValidStart=$root.proto.Timestamp.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.scheduled=e.bool();break;case 4:d.nonce=e.int32();break;default:e.skipType(7&i);}return d},e}(),AccountAmount:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.amount=e.sint64();break;case 3:d.isApproval=e.bool();break;default:e.skipType(7&i);}return d},e}(),TransferList:function(){function e(e){if(this.accountAmounts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountAmounts&&d.accountAmounts.length||(d.accountAmounts=[]),d.accountAmounts.push($root.proto.AccountAmount.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),NftTransfer:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.senderAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.receiverAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.serialNumber=e.int64();break;case 4:d.isApproval=e.bool();break;default:e.skipType(7&i);}return d},e}(),TokenTransferList:function(){function e(e){if(this.transfers=[],this.nftTransfers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.transfers&&d.transfers.length||(d.transfers=[]),d.transfers.push($root.proto.AccountAmount.decode(e,e.uint32()));break;case 3:d.nftTransfers&&d.nftTransfers.length||(d.nftTransfers=[]),d.nftTransfers.push($root.proto.NftTransfer.decode(e,e.uint32()));break;case 4:d.expectedDecimals=$root.google.protobuf.UInt32Value.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),Fraction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.numerator=e.int64();break;case 2:d.denominator=e.int64();break;default:e.skipType(7&i);}return d},e}(),TopicID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;case 2:d.realmNum=e.int64();break;case 3:d.topicNum=e.int64();break;default:e.skipType(7&i);}return d},e}(),TokenID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;case 2:d.realmNum=e.int64();break;case 3:d.tokenNum=e.int64();break;default:e.skipType(7&i);}return d},e}(),ScheduleID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.shardNum=e.int64();break;case 2:d.realmNum=e.int64();break;case 3:d.scheduleNum=e.int64();break;default:e.skipType(7&i);}return d},e}(),TokenType:function(){const e={},o=Object.create(e);return o[e[0]=\"FUNGIBLE_COMMON\"]=0,o[e[1]=\"NON_FUNGIBLE_UNIQUE\"]=1,o}(),SubType:function(){const e={},o=Object.create(e);return o[e[0]=\"DEFAULT\"]=0,o[e[1]=\"TOKEN_FUNGIBLE_COMMON\"]=1,o[e[2]=\"TOKEN_NON_FUNGIBLE_UNIQUE\"]=2,o[e[3]=\"TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES\"]=3,o[e[4]=\"TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES\"]=4,o[e[5]=\"SCHEDULE_CREATE_CONTRACT_CALL\"]=5,o}(),TokenSupplyType:function(){const e={},o=Object.create(e);return o[e[0]=\"INFINITE\"]=0,o[e[1]=\"FINITE\"]=1,o}(),TokenFreezeStatus:function(){const e={},o=Object.create(e);return o[e[0]=\"FreezeNotApplicable\"]=0,o[e[1]=\"Frozen\"]=1,o[e[2]=\"Unfrozen\"]=2,o}(),TokenKycStatus:function(){const e={},o=Object.create(e);return o[e[0]=\"KycNotApplicable\"]=0,o[e[1]=\"Granted\"]=1,o[e[2]=\"Revoked\"]=2,o}(),TokenPauseStatus:function(){const e={},o=Object.create(e);return o[e[0]=\"PauseNotApplicable\"]=0,o[e[1]=\"Paused\"]=1,o[e[2]=\"Unpaused\"]=2,o}(),Key:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.ed25519=e.bytes();break;case 3:d.RSA_3072=e.bytes();break;case 4:d.ECDSA_384=e.bytes();break;case 5:d.thresholdKey=$root.proto.ThresholdKey.decode(e,e.uint32());break;case 6:d.keyList=$root.proto.KeyList.decode(e,e.uint32());break;case 7:d.ECDSASecp256k1=e.bytes();break;case 8:d.delegatableContractId=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ThresholdKey:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.threshold=e.uint32();break;case 2:d.keys=$root.proto.KeyList.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),KeyList:function(){function e(e){if(this.keys=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.keys&&d.keys.length||(d.keys=[]),d.keys.push($root.proto.Key.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),Signature:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contract=e.bytes();break;case 2:d.ed25519=e.bytes();break;case 3:d.RSA_3072=e.bytes();break;case 4:d.ECDSA_384=e.bytes();break;case 5:d.thresholdSignature=$root.proto.ThresholdSignature.decode(e,e.uint32());break;case 6:d.signatureList=$root.proto.SignatureList.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ThresholdSignature:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:d.sigs=$root.proto.SignatureList.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),SignatureList:function(){function e(e){if(this.sigs=[],e)for(var o=Object.keys(e),t=0;t>>3){case 2:d.sigs&&d.sigs.length||(d.sigs=[]),d.sigs.push($root.proto.Signature.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),SignaturePair:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.pubKeyPrefix=e.bytes();break;case 2:d.contract=e.bytes();break;case 3:d.ed25519=e.bytes();break;case 4:d.RSA_3072=e.bytes();break;case 5:d.ECDSA_384=e.bytes();break;case 6:d.ECDSASecp256k1=e.bytes();break;default:e.skipType(7&i);}return d},e}(),SignatureMap:function(){function e(e){if(this.sigPair=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.sigPair&&d.sigPair.length||(d.sigPair=[]),d.sigPair.push($root.proto.SignaturePair.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),HederaFunctionality:function(){const e={},o=Object.create(e);return o[e[0]=\"NONE\"]=0,o[e[1]=\"CryptoTransfer\"]=1,o[e[2]=\"CryptoUpdate\"]=2,o[e[3]=\"CryptoDelete\"]=3,o[e[4]=\"CryptoAddLiveHash\"]=4,o[e[5]=\"CryptoDeleteLiveHash\"]=5,o[e[6]=\"ContractCall\"]=6,o[e[7]=\"ContractCreate\"]=7,o[e[8]=\"ContractUpdate\"]=8,o[e[9]=\"FileCreate\"]=9,o[e[10]=\"FileAppend\"]=10,o[e[11]=\"FileUpdate\"]=11,o[e[12]=\"FileDelete\"]=12,o[e[13]=\"CryptoGetAccountBalance\"]=13,o[e[14]=\"CryptoGetAccountRecords\"]=14,o[e[15]=\"CryptoGetInfo\"]=15,o[e[16]=\"ContractCallLocal\"]=16,o[e[17]=\"ContractGetInfo\"]=17,o[e[18]=\"ContractGetBytecode\"]=18,o[e[19]=\"GetBySolidityID\"]=19,o[e[20]=\"GetByKey\"]=20,o[e[21]=\"CryptoGetLiveHash\"]=21,o[e[22]=\"CryptoGetStakers\"]=22,o[e[23]=\"FileGetContents\"]=23,o[e[24]=\"FileGetInfo\"]=24,o[e[25]=\"TransactionGetRecord\"]=25,o[e[26]=\"ContractGetRecords\"]=26,o[e[27]=\"CryptoCreate\"]=27,o[e[28]=\"SystemDelete\"]=28,o[e[29]=\"SystemUndelete\"]=29,o[e[30]=\"ContractDelete\"]=30,o[e[31]=\"Freeze\"]=31,o[e[32]=\"CreateTransactionRecord\"]=32,o[e[33]=\"CryptoAccountAutoRenew\"]=33,o[e[34]=\"ContractAutoRenew\"]=34,o[e[35]=\"GetVersionInfo\"]=35,o[e[36]=\"TransactionGetReceipt\"]=36,o[e[50]=\"ConsensusCreateTopic\"]=50,o[e[51]=\"ConsensusUpdateTopic\"]=51,o[e[52]=\"ConsensusDeleteTopic\"]=52,o[e[53]=\"ConsensusGetTopicInfo\"]=53,o[e[54]=\"ConsensusSubmitMessage\"]=54,o[e[55]=\"UncheckedSubmit\"]=55,o[e[56]=\"TokenCreate\"]=56,o[e[58]=\"TokenGetInfo\"]=58,o[e[59]=\"TokenFreezeAccount\"]=59,o[e[60]=\"TokenUnfreezeAccount\"]=60,o[e[61]=\"TokenGrantKycToAccount\"]=61,o[e[62]=\"TokenRevokeKycFromAccount\"]=62,o[e[63]=\"TokenDelete\"]=63,o[e[64]=\"TokenUpdate\"]=64,o[e[65]=\"TokenMint\"]=65,o[e[66]=\"TokenBurn\"]=66,o[e[67]=\"TokenAccountWipe\"]=67,o[e[68]=\"TokenAssociateToAccount\"]=68,o[e[69]=\"TokenDissociateFromAccount\"]=69,o[e[70]=\"ScheduleCreate\"]=70,o[e[71]=\"ScheduleDelete\"]=71,o[e[72]=\"ScheduleSign\"]=72,o[e[73]=\"ScheduleGetInfo\"]=73,o[e[74]=\"TokenGetAccountNftInfos\"]=74,o[e[75]=\"TokenGetNftInfo\"]=75,o[e[76]=\"TokenGetNftInfos\"]=76,o[e[77]=\"TokenFeeScheduleUpdate\"]=77,o[e[78]=\"NetworkGetExecutionTime\"]=78,o[e[79]=\"TokenPause\"]=79,o[e[80]=\"TokenUnpause\"]=80,o[e[81]=\"CryptoApproveAllowance\"]=81,o[e[82]=\"CryptoDeleteAllowance\"]=82,o[e[83]=\"GetAccountDetails\"]=83,o[e[84]=\"EthereumTransaction\"]=84,o[e[85]=\"NodeStakeUpdate\"]=85,o[e[86]=\"UtilPrng\"]=86,o}(),FeeComponents:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.min=e.int64();break;case 2:d.max=e.int64();break;case 3:d.constant=e.int64();break;case 4:d.bpt=e.int64();break;case 5:d.vpt=e.int64();break;case 6:d.rbh=e.int64();break;case 7:d.sbh=e.int64();break;case 8:d.gas=e.int64();break;case 9:d.tv=e.int64();break;case 10:d.bpr=e.int64();break;case 11:d.sbpr=e.int64();break;default:e.skipType(7&i);}return d},e}(),TransactionFeeSchedule:function(){function e(e){if(this.fees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.hederaFunctionality=e.int32();break;case 2:d.feeData=$root.proto.FeeData.decode(e,e.uint32());break;case 3:d.fees&&d.fees.length||(d.fees=[]),d.fees.push($root.proto.FeeData.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),FeeData:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.nodedata=$root.proto.FeeComponents.decode(e,e.uint32());break;case 2:d.networkdata=$root.proto.FeeComponents.decode(e,e.uint32());break;case 3:d.servicedata=$root.proto.FeeComponents.decode(e,e.uint32());break;case 4:d.subType=e.int32();break;default:e.skipType(7&i);}return d},e}(),FeeSchedule:function(){function e(e){if(this.transactionFeeSchedule=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transactionFeeSchedule&&d.transactionFeeSchedule.length||(d.transactionFeeSchedule=[]),d.transactionFeeSchedule.push($root.proto.TransactionFeeSchedule.decode(e,e.uint32()));break;case 2:d.expiryTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CurrentAndNextFeeSchedule:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.currentFeeSchedule=$root.proto.FeeSchedule.decode(e,e.uint32());break;case 2:d.nextFeeSchedule=$root.proto.FeeSchedule.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ServiceEndpoint:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.ipAddressV4=e.bytes();break;case 2:d.port=e.int32();break;default:e.skipType(7&i);}return d},e}(),NodeAddress:function(){function e(e){if(this.serviceEndpoint=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.ipAddress=e.bytes();break;case 2:d.portno=e.int32();break;case 3:d.memo=e.bytes();break;case 4:d.RSA_PubKey=e.string();break;case 5:d.nodeId=e.int64();break;case 6:d.nodeAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 7:d.nodeCertHash=e.bytes();break;case 8:d.serviceEndpoint&&d.serviceEndpoint.length||(d.serviceEndpoint=[]),d.serviceEndpoint.push($root.proto.ServiceEndpoint.decode(e,e.uint32()));break;case 9:d.description=e.string();break;case 10:d.stake=e.int64();break;default:e.skipType(7&i);}return d},e}(),NodeAddressBook:function(){function e(e){if(this.nodeAddress=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.nodeAddress&&d.nodeAddress.length||(d.nodeAddress=[]),d.nodeAddress.push($root.proto.NodeAddress.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),SemanticVersion:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.major=e.int32();break;case 2:d.minor=e.int32();break;case 3:d.patch=e.int32();break;case 4:d.pre=e.string();break;case 5:d.build=e.string();break;default:e.skipType(7&i);}return d},e}(),Setting:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.name=e.string();break;case 2:d.value=e.string();break;case 3:d.data=e.bytes();break;default:e.skipType(7&i);}return d},e}(),ServicesConfigurationList:function(){function e(e){if(this.nameValue=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.nameValue&&d.nameValue.length||(d.nameValue=[]),d.nameValue.push($root.proto.Setting.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TokenRelationship:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.symbol=e.string();break;case 3:d.balance=e.uint64();break;case 4:d.kycStatus=e.int32();break;case 5:d.freezeStatus=e.int32();break;case 6:d.decimals=e.uint32();break;case 7:d.automaticAssociation=e.bool();break;default:e.skipType(7&i);}return d},e}(),TokenBalance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.balance=e.uint64();break;case 3:d.decimals=e.uint32();break;default:e.skipType(7&i);}return d},e}(),TokenBalances:function(){function e(e){if(this.tokenBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenBalances&&d.tokenBalances.length||(d.tokenBalances=[]),d.tokenBalances.push($root.proto.TokenBalance.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TokenAssociation:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.accountId=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),StakingInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.declineReward=e.bool();break;case 2:d.stakePeriodStart=$root.proto.Timestamp.decode(e,e.uint32());break;case 3:d.pendingReward=e.int64();break;case 4:d.stakedToMe=e.int64();break;case 5:d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 6:d.stakedNodeId=e.int64();break;default:e.skipType(7&i);}return d},e}(),Timestamp:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.seconds=e.int64();break;case 2:d.nanos=e.int32();break;default:e.skipType(7&i);}return d},e}(),TimestampSeconds:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.seconds=e.int64();break;default:e.skipType(7&i);}return d},e}(),ConsensusCreateTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.memo=e.string();break;case 2:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 3:d.submitKey=$root.proto.Key.decode(e,e.uint32());break;case 6:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 7:d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),Duration:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.seconds=e.int64();break;default:e.skipType(7&i);}return d},e}(),ConsensusDeleteTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.topicID=$root.proto.TopicID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ConsensusGetTopicInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.topicID=$root.proto.TopicID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ConsensusGetTopicInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.topicID=$root.proto.TopicID.decode(e,e.uint32());break;case 5:d.topicInfo=$root.proto.ConsensusTopicInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ResponseType:function(){const e={},o=Object.create(e);return o[e[0]=\"ANSWER_ONLY\"]=0,o[e[1]=\"ANSWER_STATE_PROOF\"]=1,o[e[2]=\"COST_ANSWER\"]=2,o[e[3]=\"COST_ANSWER_STATE_PROOF\"]=3,o}(),QueryHeader:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.payment=$root.proto.Transaction.decode(e,e.uint32());break;case 2:d.responseType=e.int32();break;default:e.skipType(7&i);}return d},e}(),Transaction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.body=$root.proto.TransactionBody.decode(e,e.uint32());break;case 2:d.sigs=$root.proto.SignatureList.decode(e,e.uint32());break;case 3:d.sigMap=$root.proto.SignatureMap.decode(e,e.uint32());break;case 4:d.bodyBytes=e.bytes();break;case 5:d.signedTransactionBytes=e.bytes();break;default:e.skipType(7&i);}return d},e}(),TransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break;case 2:d.nodeAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.transactionFee=e.uint64();break;case 4:d.transactionValidDuration=$root.proto.Duration.decode(e,e.uint32());break;case 5:d.generateRecord=e.bool();break;case 6:d.memo=e.string();break;case 7:d.contractCall=$root.proto.ContractCallTransactionBody.decode(e,e.uint32());break;case 8:d.contractCreateInstance=$root.proto.ContractCreateTransactionBody.decode(e,e.uint32());break;case 9:d.contractUpdateInstance=$root.proto.ContractUpdateTransactionBody.decode(e,e.uint32());break;case 22:d.contractDeleteInstance=$root.proto.ContractDeleteTransactionBody.decode(e,e.uint32());break;case 50:d.ethereumTransaction=$root.proto.EthereumTransactionBody.decode(e,e.uint32());break;case 10:d.cryptoAddLiveHash=$root.proto.CryptoAddLiveHashTransactionBody.decode(e,e.uint32());break;case 48:d.cryptoApproveAllowance=$root.proto.CryptoApproveAllowanceTransactionBody.decode(e,e.uint32());break;case 49:d.cryptoDeleteAllowance=$root.proto.CryptoDeleteAllowanceTransactionBody.decode(e,e.uint32());break;case 11:d.cryptoCreateAccount=$root.proto.CryptoCreateTransactionBody.decode(e,e.uint32());break;case 12:d.cryptoDelete=$root.proto.CryptoDeleteTransactionBody.decode(e,e.uint32());break;case 13:d.cryptoDeleteLiveHash=$root.proto.CryptoDeleteLiveHashTransactionBody.decode(e,e.uint32());break;case 14:d.cryptoTransfer=$root.proto.CryptoTransferTransactionBody.decode(e,e.uint32());break;case 15:d.cryptoUpdateAccount=$root.proto.CryptoUpdateTransactionBody.decode(e,e.uint32());break;case 16:d.fileAppend=$root.proto.FileAppendTransactionBody.decode(e,e.uint32());break;case 17:d.fileCreate=$root.proto.FileCreateTransactionBody.decode(e,e.uint32());break;case 18:d.fileDelete=$root.proto.FileDeleteTransactionBody.decode(e,e.uint32());break;case 19:d.fileUpdate=$root.proto.FileUpdateTransactionBody.decode(e,e.uint32());break;case 20:d.systemDelete=$root.proto.SystemDeleteTransactionBody.decode(e,e.uint32());break;case 21:d.systemUndelete=$root.proto.SystemUndeleteTransactionBody.decode(e,e.uint32());break;case 23:d.freeze=$root.proto.FreezeTransactionBody.decode(e,e.uint32());break;case 24:d.consensusCreateTopic=$root.proto.ConsensusCreateTopicTransactionBody.decode(e,e.uint32());break;case 25:d.consensusUpdateTopic=$root.proto.ConsensusUpdateTopicTransactionBody.decode(e,e.uint32());break;case 26:d.consensusDeleteTopic=$root.proto.ConsensusDeleteTopicTransactionBody.decode(e,e.uint32());break;case 27:d.consensusSubmitMessage=$root.proto.ConsensusSubmitMessageTransactionBody.decode(e,e.uint32());break;case 28:d.uncheckedSubmit=$root.proto.UncheckedSubmitBody.decode(e,e.uint32());break;case 29:d.tokenCreation=$root.proto.TokenCreateTransactionBody.decode(e,e.uint32());break;case 31:d.tokenFreeze=$root.proto.TokenFreezeAccountTransactionBody.decode(e,e.uint32());break;case 32:d.tokenUnfreeze=$root.proto.TokenUnfreezeAccountTransactionBody.decode(e,e.uint32());break;case 33:d.tokenGrantKyc=$root.proto.TokenGrantKycTransactionBody.decode(e,e.uint32());break;case 34:d.tokenRevokeKyc=$root.proto.TokenRevokeKycTransactionBody.decode(e,e.uint32());break;case 35:d.tokenDeletion=$root.proto.TokenDeleteTransactionBody.decode(e,e.uint32());break;case 36:d.tokenUpdate=$root.proto.TokenUpdateTransactionBody.decode(e,e.uint32());break;case 37:d.tokenMint=$root.proto.TokenMintTransactionBody.decode(e,e.uint32());break;case 38:d.tokenBurn=$root.proto.TokenBurnTransactionBody.decode(e,e.uint32());break;case 39:d.tokenWipe=$root.proto.TokenWipeAccountTransactionBody.decode(e,e.uint32());break;case 40:d.tokenAssociate=$root.proto.TokenAssociateTransactionBody.decode(e,e.uint32());break;case 41:d.tokenDissociate=$root.proto.TokenDissociateTransactionBody.decode(e,e.uint32());break;case 45:d.tokenFeeScheduleUpdate=$root.proto.TokenFeeScheduleUpdateTransactionBody.decode(e,e.uint32());break;case 46:d.tokenPause=$root.proto.TokenPauseTransactionBody.decode(e,e.uint32());break;case 47:d.tokenUnpause=$root.proto.TokenUnpauseTransactionBody.decode(e,e.uint32());break;case 42:d.scheduleCreate=$root.proto.ScheduleCreateTransactionBody.decode(e,e.uint32());break;case 43:d.scheduleDelete=$root.proto.ScheduleDeleteTransactionBody.decode(e,e.uint32());break;case 44:d.scheduleSign=$root.proto.ScheduleSignTransactionBody.decode(e,e.uint32());break;case 51:d.nodeStakeUpdate=$root.proto.NodeStakeUpdateTransactionBody.decode(e,e.uint32());break;case 52:d.utilPrng=$root.proto.UtilPrngTransactionBody.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),SystemDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 2:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 3:d.expirationTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),SystemUndeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 2:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),FreezeTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.startHour=e.int32();break;case 2:d.startMin=e.int32();break;case 3:d.endHour=e.int32();break;case 4:d.endMin=e.int32();break;case 5:d.updateFile=$root.proto.FileID.decode(e,e.uint32());break;case 6:d.fileHash=e.bytes();break;case 7:d.startTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 8:d.freezeType=e.int32();break;default:e.skipType(7&i);}return d},e}(),FreezeType:function(){const e={},o=Object.create(e);return o[e[0]=\"UNKNOWN_FREEZE_TYPE\"]=0,o[e[1]=\"FREEZE_ONLY\"]=1,o[e[2]=\"PREPARE_UPGRADE\"]=2,o[e[3]=\"FREEZE_UPGRADE\"]=3,o[e[4]=\"FREEZE_ABORT\"]=4,o[e[5]=\"TELEMETRY_UPGRADE\"]=5,o}(),ContractCallTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.gas=e.int64();break;case 3:d.amount=e.int64();break;case 4:d.functionParameters=e.bytes();break;default:e.skipType(7&i);}return d},e}(),ContractCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 16:d.initcode=e.bytes();break;case 3:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 4:d.gas=e.int64();break;case 5:d.initialBalance=e.int64();break;case 6:d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 8:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 9:d.constructorParameters=e.bytes();break;case 10:d.shardID=$root.proto.ShardID.decode(e,e.uint32());break;case 11:d.realmID=$root.proto.RealmID.decode(e,e.uint32());break;case 12:d.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break;case 13:d.memo=e.string();break;case 14:d.maxAutomaticTokenAssociations=e.int32();break;case 15:d.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 17:d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 18:d.stakedNodeId=e.int64();break;case 19:d.declineReward=e.bool();break;default:e.skipType(7&i);}return d},e}(),ContractUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 3:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 6:d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 7:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 8:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 9:d.memo=e.string();break;case 10:d.memoWrapper=$root.google.protobuf.StringValue.decode(e,e.uint32());break;case 11:d.maxAutomaticTokenAssociations=$root.google.protobuf.Int32Value.decode(e,e.uint32());break;case 12:d.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 13:d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 14:d.stakedNodeId=e.int64();break;case 15:d.declineReward=$root.google.protobuf.BoolValue.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),LiveHash:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountId=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.hash=e.bytes();break;case 3:d.keys=$root.proto.KeyList.decode(e,e.uint32());break;case 5:d.duration=$root.proto.Duration.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoAddLiveHashTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 3:d.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.key=$root.proto.Key.decode(e,e.uint32());break;case 2:d.initialBalance=e.uint64();break;case 3:d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 6:d.sendRecordThreshold=e.uint64();break;case 7:d.receiveRecordThreshold=e.uint64();break;case 8:d.receiverSigRequired=e.bool();break;case 9:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 10:d.shardID=$root.proto.ShardID.decode(e,e.uint32());break;case 11:d.realmID=$root.proto.RealmID.decode(e,e.uint32());break;case 12:d.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break;case 13:d.memo=e.string();break;case 14:d.maxAutomaticTokenAssociations=e.int32();break;case 15:d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 16:d.stakedNodeId=e.int64();break;case 17:d.declineReward=e.bool();break;default:e.skipType(7&i);}return d},e}(),CryptoDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transferAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.deleteAccountID=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoDeleteLiveHashTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountOfLiveHash=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.liveHashToDelete=e.bytes();break;default:e.skipType(7&i);}return d},e}(),CryptoTransferTransactionBody:function(){function e(e){if(this.tokenTransfers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transfers=$root.proto.TransferList.decode(e,e.uint32());break;case 2:d.tokenTransfers&&d.tokenTransfers.length||(d.tokenTransfers=[]),d.tokenTransfers.push($root.proto.TokenTransferList.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),CryptoUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:d.accountIDToUpdate=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.key=$root.proto.Key.decode(e,e.uint32());break;case 4:d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 5:d.proxyFraction=e.int32();break;case 6:d.sendRecordThreshold=e.uint64();break;case 11:d.sendRecordThresholdWrapper=$root.google.protobuf.UInt64Value.decode(e,e.uint32());break;case 7:d.receiveRecordThreshold=e.uint64();break;case 12:d.receiveRecordThresholdWrapper=$root.google.protobuf.UInt64Value.decode(e,e.uint32());break;case 8:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 9:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 10:d.receiverSigRequired=e.bool();break;case 13:d.receiverSigRequiredWrapper=$root.google.protobuf.BoolValue.decode(e,e.uint32());break;case 14:d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break;case 15:d.maxAutomaticTokenAssociations=$root.google.protobuf.Int32Value.decode(e,e.uint32());break;case 16:d.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 17:d.stakedNodeId=e.int64();break;case 18:d.declineReward=$root.google.protobuf.BoolValue.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoApproveAllowanceTransactionBody:function(){function e(e){if(this.cryptoAllowances=[],this.nftAllowances=[],this.tokenAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.cryptoAllowances&&d.cryptoAllowances.length||(d.cryptoAllowances=[]),d.cryptoAllowances.push($root.proto.CryptoAllowance.decode(e,e.uint32()));break;case 2:d.nftAllowances&&d.nftAllowances.length||(d.nftAllowances=[]),d.nftAllowances.push($root.proto.NftAllowance.decode(e,e.uint32()));break;case 3:d.tokenAllowances&&d.tokenAllowances.length||(d.tokenAllowances=[]),d.tokenAllowances.push($root.proto.TokenAllowance.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),CryptoAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.owner=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.spender=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.amount=e.int64();break;default:e.skipType(7&i);}return d},e}(),NftAllowance:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.owner=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.spender=$root.proto.AccountID.decode(e,e.uint32());break;case 4:if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.owner=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.spender=$root.proto.AccountID.decode(e,e.uint32());break;case 4:d.amount=e.int64();break;default:e.skipType(7&i);}return d},e}(),CryptoDeleteAllowanceTransactionBody:function(){function e(e){if(this.nftAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 2:d.nftAllowances&&d.nftAllowances.length||(d.nftAllowances=[]),d.nftAllowances.push($root.proto.NftRemoveAllowance.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),NftRemoveAllowance:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.owner=$root.proto.AccountID.decode(e,e.uint32());break;case 3:if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.ethereumData=e.bytes();break;case 2:d.callData=$root.proto.FileID.decode(e,e.uint32());break;case 3:d.maxGasAllowance=e.int64();break;default:e.skipType(7&i);}return d},e}(),FileAppendTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 4:d.contents=e.bytes();break;default:e.skipType(7&i);}return d},e}(),FileCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 3:d.keys=$root.proto.KeyList.decode(e,e.uint32());break;case 4:d.contents=e.bytes();break;case 5:d.shardID=$root.proto.ShardID.decode(e,e.uint32());break;case 6:d.realmID=$root.proto.RealmID.decode(e,e.uint32());break;case 7:d.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break;case 8:d.memo=e.string();break;default:e.skipType(7&i);}return d},e}(),FileDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),FileUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 2:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 3:d.keys=$root.proto.KeyList.decode(e,e.uint32());break;case 4:d.contents=e.bytes();break;case 5:d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.transferAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.transferContractID=$root.proto.ContractID.decode(e,e.uint32());break;case 4:d.permanentRemoval=e.bool();break;default:e.skipType(7&i);}return d},e}(),ConsensusUpdateTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.topicID=$root.proto.TopicID.decode(e,e.uint32());break;case 2:d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break;case 4:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 6:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 7:d.submitKey=$root.proto.Key.decode(e,e.uint32());break;case 8:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 9:d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ConsensusMessageChunkInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.initialTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break;case 2:d.total=e.int32();break;case 3:d.number=e.int32();break;default:e.skipType(7&i);}return d},e}(),ConsensusSubmitMessageTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.topicID=$root.proto.TopicID.decode(e,e.uint32());break;case 2:d.message=e.bytes();break;case 3:d.chunkInfo=$root.proto.ConsensusMessageChunkInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),UncheckedSubmitBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transactionBytes=e.bytes();break;default:e.skipType(7&i);}return d},e}(),TokenCreateTransactionBody:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.name=e.string();break;case 2:d.symbol=e.string();break;case 3:d.decimals=e.uint32();break;case 4:d.initialSupply=e.uint64();break;case 5:d.treasury=$root.proto.AccountID.decode(e,e.uint32());break;case 6:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 7:d.kycKey=$root.proto.Key.decode(e,e.uint32());break;case 8:d.freezeKey=$root.proto.Key.decode(e,e.uint32());break;case 9:d.wipeKey=$root.proto.Key.decode(e,e.uint32());break;case 10:d.supplyKey=$root.proto.Key.decode(e,e.uint32());break;case 11:d.freezeDefault=e.bool();break;case 13:d.expiry=$root.proto.Timestamp.decode(e,e.uint32());break;case 14:d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break;case 15:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 16:d.memo=e.string();break;case 17:d.tokenType=e.int32();break;case 18:d.supplyType=e.int32();break;case 19:d.maxSupply=e.int64();break;case 20:d.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break;case 21:d.customFees&&d.customFees.length||(d.customFees=[]),d.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break;case 22:d.pauseKey=$root.proto.Key.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),FractionalFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fractionalAmount=$root.proto.Fraction.decode(e,e.uint32());break;case 2:d.minimumAmount=e.int64();break;case 3:d.maximumAmount=e.int64();break;case 4:d.netOfTransfers=e.bool();break;default:e.skipType(7&i);}return d},e}(),FixedFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.amount=e.int64();break;case 2:d.denominatingTokenId=$root.proto.TokenID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),RoyaltyFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.exchangeValueFraction=$root.proto.Fraction.decode(e,e.uint32());break;case 2:d.fallbackFee=$root.proto.FixedFee.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CustomFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fixedFee=$root.proto.FixedFee.decode(e,e.uint32());break;case 2:d.fractionalFee=$root.proto.FractionalFee.decode(e,e.uint32());break;case 4:d.royaltyFee=$root.proto.RoyaltyFee.decode(e,e.uint32());break;case 3:d.feeCollectorAccountId=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),AssessedCustomFee:function(){function e(e){if(this.effectivePayerAccountId=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.amount=e.int64();break;case 2:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 3:d.feeCollectorAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 4:d.effectivePayerAccountId&&d.effectivePayerAccountId.length||(d.effectivePayerAccountId=[]),d.effectivePayerAccountId.push($root.proto.AccountID.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TokenFreezeAccountTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.account=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenUnfreezeAccountTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.account=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenGrantKycTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.account=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenRevokeKycTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.account=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.symbol=e.string();break;case 3:d.name=e.string();break;case 4:d.treasury=$root.proto.AccountID.decode(e,e.uint32());break;case 5:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 6:d.kycKey=$root.proto.Key.decode(e,e.uint32());break;case 7:d.freezeKey=$root.proto.Key.decode(e,e.uint32());break;case 8:d.wipeKey=$root.proto.Key.decode(e,e.uint32());break;case 9:d.supplyKey=$root.proto.Key.decode(e,e.uint32());break;case 10:d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break;case 11:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 12:d.expiry=$root.proto.Timestamp.decode(e,e.uint32());break;case 13:d.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break;case 14:d.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break;case 15:d.pauseKey=$root.proto.Key.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenMintTransactionBody:function(){function e(e){if(this.metadata=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.amount=e.uint64();break;case 3:d.metadata&&d.metadata.length||(d.metadata=[]),d.metadata.push(e.bytes());break;default:e.skipType(7&i);}return d},e}(),TokenBurnTransactionBody:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.amount=e.uint64();break;case 3:if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.account=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.amount=e.uint64();break;case 4:if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.account=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.tokens&&d.tokens.length||(d.tokens=[]),d.tokens.push($root.proto.TokenID.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TokenDissociateTransactionBody:function(){function e(e){if(this.tokens=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.account=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.tokens&&d.tokens.length||(d.tokens=[]),d.tokens.push($root.proto.TokenID.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TokenFeeScheduleUpdateTransactionBody:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.customFees&&d.customFees.length||(d.customFees=[]),d.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TokenPauseTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenUnpauseTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.token=$root.proto.TokenID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ScheduleCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.scheduledTransactionBody=$root.proto.SchedulableTransactionBody.decode(e,e.uint32());break;case 2:d.memo=e.string();break;case 3:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 4:d.payerAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 5:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 13:d.waitForExpiry=e.bool();break;default:e.skipType(7&i);}return d},e}(),SchedulableTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transactionFee=e.uint64();break;case 2:d.memo=e.string();break;case 3:d.contractCall=$root.proto.ContractCallTransactionBody.decode(e,e.uint32());break;case 4:d.contractCreateInstance=$root.proto.ContractCreateTransactionBody.decode(e,e.uint32());break;case 5:d.contractUpdateInstance=$root.proto.ContractUpdateTransactionBody.decode(e,e.uint32());break;case 6:d.contractDeleteInstance=$root.proto.ContractDeleteTransactionBody.decode(e,e.uint32());break;case 37:d.cryptoApproveAllowance=$root.proto.CryptoApproveAllowanceTransactionBody.decode(e,e.uint32());break;case 38:d.cryptoDeleteAllowance=$root.proto.CryptoDeleteAllowanceTransactionBody.decode(e,e.uint32());break;case 7:d.cryptoCreateAccount=$root.proto.CryptoCreateTransactionBody.decode(e,e.uint32());break;case 8:d.cryptoDelete=$root.proto.CryptoDeleteTransactionBody.decode(e,e.uint32());break;case 9:d.cryptoTransfer=$root.proto.CryptoTransferTransactionBody.decode(e,e.uint32());break;case 10:d.cryptoUpdateAccount=$root.proto.CryptoUpdateTransactionBody.decode(e,e.uint32());break;case 11:d.fileAppend=$root.proto.FileAppendTransactionBody.decode(e,e.uint32());break;case 12:d.fileCreate=$root.proto.FileCreateTransactionBody.decode(e,e.uint32());break;case 13:d.fileDelete=$root.proto.FileDeleteTransactionBody.decode(e,e.uint32());break;case 14:d.fileUpdate=$root.proto.FileUpdateTransactionBody.decode(e,e.uint32());break;case 15:d.systemDelete=$root.proto.SystemDeleteTransactionBody.decode(e,e.uint32());break;case 16:d.systemUndelete=$root.proto.SystemUndeleteTransactionBody.decode(e,e.uint32());break;case 17:d.freeze=$root.proto.FreezeTransactionBody.decode(e,e.uint32());break;case 18:d.consensusCreateTopic=$root.proto.ConsensusCreateTopicTransactionBody.decode(e,e.uint32());break;case 19:d.consensusUpdateTopic=$root.proto.ConsensusUpdateTopicTransactionBody.decode(e,e.uint32());break;case 20:d.consensusDeleteTopic=$root.proto.ConsensusDeleteTopicTransactionBody.decode(e,e.uint32());break;case 21:d.consensusSubmitMessage=$root.proto.ConsensusSubmitMessageTransactionBody.decode(e,e.uint32());break;case 22:d.tokenCreation=$root.proto.TokenCreateTransactionBody.decode(e,e.uint32());break;case 23:d.tokenFreeze=$root.proto.TokenFreezeAccountTransactionBody.decode(e,e.uint32());break;case 24:d.tokenUnfreeze=$root.proto.TokenUnfreezeAccountTransactionBody.decode(e,e.uint32());break;case 25:d.tokenGrantKyc=$root.proto.TokenGrantKycTransactionBody.decode(e,e.uint32());break;case 26:d.tokenRevokeKyc=$root.proto.TokenRevokeKycTransactionBody.decode(e,e.uint32());break;case 27:d.tokenDeletion=$root.proto.TokenDeleteTransactionBody.decode(e,e.uint32());break;case 28:d.tokenUpdate=$root.proto.TokenUpdateTransactionBody.decode(e,e.uint32());break;case 29:d.tokenMint=$root.proto.TokenMintTransactionBody.decode(e,e.uint32());break;case 30:d.tokenBurn=$root.proto.TokenBurnTransactionBody.decode(e,e.uint32());break;case 31:d.tokenWipe=$root.proto.TokenWipeAccountTransactionBody.decode(e,e.uint32());break;case 32:d.tokenAssociate=$root.proto.TokenAssociateTransactionBody.decode(e,e.uint32());break;case 33:d.tokenDissociate=$root.proto.TokenDissociateTransactionBody.decode(e,e.uint32());break;case 39:d.tokenFeeScheduleUpdate=$root.proto.TokenFeeScheduleUpdateTransactionBody.decode(e,e.uint32());break;case 35:d.tokenPause=$root.proto.TokenPauseTransactionBody.decode(e,e.uint32());break;case 36:d.tokenUnpause=$root.proto.TokenUnpauseTransactionBody.decode(e,e.uint32());break;case 34:d.scheduleDelete=$root.proto.ScheduleDeleteTransactionBody.decode(e,e.uint32());break;case 40:d.utilPrng=$root.proto.UtilPrngTransactionBody.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ScheduleDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),UtilPrngTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.range=e.int32();break;default:e.skipType(7&i);}return d},e}(),ScheduleSignTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),NodeStakeUpdateTransactionBody:function(){function e(e){if(this.nodeStake=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.endOfStakingPeriod=$root.proto.Timestamp.decode(e,e.uint32());break;case 2:d.nodeStake&&d.nodeStake.length||(d.nodeStake=[]),d.nodeStake.push($root.proto.NodeStake.decode(e,e.uint32()));break;case 3:d.maxStakingRewardRatePerHbar=e.int64();break;case 4:d.nodeRewardFeeFraction=$root.proto.Fraction.decode(e,e.uint32());break;case 5:d.stakingPeriodsStored=e.int64();break;case 6:d.stakingPeriod=e.int64();break;case 7:d.stakingRewardFeeFraction=$root.proto.Fraction.decode(e,e.uint32());break;case 8:d.stakingStartThreshold=e.int64();break;case 9:d.stakingRewardRate=e.int64();break;default:e.skipType(7&i);}return d},e}(),NodeStake:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.maxStake=e.int64();break;case 2:d.minStake=e.int64();break;case 3:d.nodeId=e.int64();break;case 4:d.rewardRate=e.int64();break;case 5:d.stake=e.int64();break;case 6:d.stakeNotRewarded=e.int64();break;case 7:d.stakeRewarded=e.int64();break;default:e.skipType(7&i);}return d},e}(),ResponseHeader:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.nodeTransactionPrecheckCode=e.int32();break;case 2:d.responseType=e.int32();break;case 3:d.cost=e.uint64();break;case 4:d.stateProof=e.bytes();break;default:e.skipType(7&i);}return d},e}(),TransactionResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.nodeTransactionPrecheckCode=e.int32();break;case 2:d.cost=e.uint64();break;default:e.skipType(7&i);}return d},e}(),ResponseCodeEnum:function(){const e={},o=Object.create(e);return o[e[0]=\"OK\"]=0,o[e[1]=\"INVALID_TRANSACTION\"]=1,o[e[2]=\"PAYER_ACCOUNT_NOT_FOUND\"]=2,o[e[3]=\"INVALID_NODE_ACCOUNT\"]=3,o[e[4]=\"TRANSACTION_EXPIRED\"]=4,o[e[5]=\"INVALID_TRANSACTION_START\"]=5,o[e[6]=\"INVALID_TRANSACTION_DURATION\"]=6,o[e[7]=\"INVALID_SIGNATURE\"]=7,o[e[8]=\"MEMO_TOO_LONG\"]=8,o[e[9]=\"INSUFFICIENT_TX_FEE\"]=9,o[e[10]=\"INSUFFICIENT_PAYER_BALANCE\"]=10,o[e[11]=\"DUPLICATE_TRANSACTION\"]=11,o[e[12]=\"BUSY\"]=12,o[e[13]=\"NOT_SUPPORTED\"]=13,o[e[14]=\"INVALID_FILE_ID\"]=14,o[e[15]=\"INVALID_ACCOUNT_ID\"]=15,o[e[16]=\"INVALID_CONTRACT_ID\"]=16,o[e[17]=\"INVALID_TRANSACTION_ID\"]=17,o[e[18]=\"RECEIPT_NOT_FOUND\"]=18,o[e[19]=\"RECORD_NOT_FOUND\"]=19,o[e[20]=\"INVALID_SOLIDITY_ID\"]=20,o[e[21]=\"UNKNOWN\"]=21,o[e[22]=\"SUCCESS\"]=22,o[e[23]=\"FAIL_INVALID\"]=23,o[e[24]=\"FAIL_FEE\"]=24,o[e[25]=\"FAIL_BALANCE\"]=25,o[e[26]=\"KEY_REQUIRED\"]=26,o[e[27]=\"BAD_ENCODING\"]=27,o[e[28]=\"INSUFFICIENT_ACCOUNT_BALANCE\"]=28,o[e[29]=\"INVALID_SOLIDITY_ADDRESS\"]=29,o[e[30]=\"INSUFFICIENT_GAS\"]=30,o[e[31]=\"CONTRACT_SIZE_LIMIT_EXCEEDED\"]=31,o[e[32]=\"LOCAL_CALL_MODIFICATION_EXCEPTION\"]=32,o[e[33]=\"CONTRACT_REVERT_EXECUTED\"]=33,o[e[34]=\"CONTRACT_EXECUTION_EXCEPTION\"]=34,o[e[35]=\"INVALID_RECEIVING_NODE_ACCOUNT\"]=35,o[e[36]=\"MISSING_QUERY_HEADER\"]=36,o[e[37]=\"ACCOUNT_UPDATE_FAILED\"]=37,o[e[38]=\"INVALID_KEY_ENCODING\"]=38,o[e[39]=\"NULL_SOLIDITY_ADDRESS\"]=39,o[e[40]=\"CONTRACT_UPDATE_FAILED\"]=40,o[e[41]=\"INVALID_QUERY_HEADER\"]=41,o[e[42]=\"INVALID_FEE_SUBMITTED\"]=42,o[e[43]=\"INVALID_PAYER_SIGNATURE\"]=43,o[e[44]=\"KEY_NOT_PROVIDED\"]=44,o[e[45]=\"INVALID_EXPIRATION_TIME\"]=45,o[e[46]=\"NO_WACL_KEY\"]=46,o[e[47]=\"FILE_CONTENT_EMPTY\"]=47,o[e[48]=\"INVALID_ACCOUNT_AMOUNTS\"]=48,o[e[49]=\"EMPTY_TRANSACTION_BODY\"]=49,o[e[50]=\"INVALID_TRANSACTION_BODY\"]=50,o[e[51]=\"INVALID_SIGNATURE_TYPE_MISMATCHING_KEY\"]=51,o[e[52]=\"INVALID_SIGNATURE_COUNT_MISMATCHING_KEY\"]=52,o[e[53]=\"EMPTY_LIVE_HASH_BODY\"]=53,o[e[54]=\"EMPTY_LIVE_HASH\"]=54,o[e[55]=\"EMPTY_LIVE_HASH_KEYS\"]=55,o[e[56]=\"INVALID_LIVE_HASH_SIZE\"]=56,o[e[57]=\"EMPTY_QUERY_BODY\"]=57,o[e[58]=\"EMPTY_LIVE_HASH_QUERY\"]=58,o[e[59]=\"LIVE_HASH_NOT_FOUND\"]=59,o[e[60]=\"ACCOUNT_ID_DOES_NOT_EXIST\"]=60,o[e[61]=\"LIVE_HASH_ALREADY_EXISTS\"]=61,o[e[62]=\"INVALID_FILE_WACL\"]=62,o[e[63]=\"SERIALIZATION_FAILED\"]=63,o[e[64]=\"TRANSACTION_OVERSIZE\"]=64,o[e[65]=\"TRANSACTION_TOO_MANY_LAYERS\"]=65,o[e[66]=\"CONTRACT_DELETED\"]=66,o[e[67]=\"PLATFORM_NOT_ACTIVE\"]=67,o[e[68]=\"KEY_PREFIX_MISMATCH\"]=68,o[e[69]=\"PLATFORM_TRANSACTION_NOT_CREATED\"]=69,o[e[70]=\"INVALID_RENEWAL_PERIOD\"]=70,o[e[71]=\"INVALID_PAYER_ACCOUNT_ID\"]=71,o[e[72]=\"ACCOUNT_DELETED\"]=72,o[e[73]=\"FILE_DELETED\"]=73,o[e[74]=\"ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS\"]=74,o[e[75]=\"SETTING_NEGATIVE_ACCOUNT_BALANCE\"]=75,o[e[76]=\"OBTAINER_REQUIRED\"]=76,o[e[77]=\"OBTAINER_SAME_CONTRACT_ID\"]=77,o[e[78]=\"OBTAINER_DOES_NOT_EXIST\"]=78,o[e[79]=\"MODIFYING_IMMUTABLE_CONTRACT\"]=79,o[e[80]=\"FILE_SYSTEM_EXCEPTION\"]=80,o[e[81]=\"AUTORENEW_DURATION_NOT_IN_RANGE\"]=81,o[e[82]=\"ERROR_DECODING_BYTESTRING\"]=82,o[e[83]=\"CONTRACT_FILE_EMPTY\"]=83,o[e[84]=\"CONTRACT_BYTECODE_EMPTY\"]=84,o[e[85]=\"INVALID_INITIAL_BALANCE\"]=85,o[e[86]=\"INVALID_RECEIVE_RECORD_THRESHOLD\"]=86,o[e[87]=\"INVALID_SEND_RECORD_THRESHOLD\"]=87,o[e[88]=\"ACCOUNT_IS_NOT_GENESIS_ACCOUNT\"]=88,o[e[89]=\"PAYER_ACCOUNT_UNAUTHORIZED\"]=89,o[e[90]=\"INVALID_FREEZE_TRANSACTION_BODY\"]=90,o[e[91]=\"FREEZE_TRANSACTION_BODY_NOT_FOUND\"]=91,o[e[92]=\"TRANSFER_LIST_SIZE_LIMIT_EXCEEDED\"]=92,o[e[93]=\"RESULT_SIZE_LIMIT_EXCEEDED\"]=93,o[e[94]=\"NOT_SPECIAL_ACCOUNT\"]=94,o[e[95]=\"CONTRACT_NEGATIVE_GAS\"]=95,o[e[96]=\"CONTRACT_NEGATIVE_VALUE\"]=96,o[e[97]=\"INVALID_FEE_FILE\"]=97,o[e[98]=\"INVALID_EXCHANGE_RATE_FILE\"]=98,o[e[99]=\"INSUFFICIENT_LOCAL_CALL_GAS\"]=99,o[e[100]=\"ENTITY_NOT_ALLOWED_TO_DELETE\"]=100,o[e[101]=\"AUTHORIZATION_FAILED\"]=101,o[e[102]=\"FILE_UPLOADED_PROTO_INVALID\"]=102,o[e[103]=\"FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK\"]=103,o[e[104]=\"FEE_SCHEDULE_FILE_PART_UPLOADED\"]=104,o[e[105]=\"EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED\"]=105,o[e[106]=\"MAX_CONTRACT_STORAGE_EXCEEDED\"]=106,o[e[107]=\"TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT\"]=107,o[e[108]=\"TOTAL_LEDGER_BALANCE_INVALID\"]=108,o[e[110]=\"EXPIRATION_REDUCTION_NOT_ALLOWED\"]=110,o[e[111]=\"MAX_GAS_LIMIT_EXCEEDED\"]=111,o[e[112]=\"MAX_FILE_SIZE_EXCEEDED\"]=112,o[e[113]=\"RECEIVER_SIG_REQUIRED\"]=113,o[e[150]=\"INVALID_TOPIC_ID\"]=150,o[e[155]=\"INVALID_ADMIN_KEY\"]=155,o[e[156]=\"INVALID_SUBMIT_KEY\"]=156,o[e[157]=\"UNAUTHORIZED\"]=157,o[e[158]=\"INVALID_TOPIC_MESSAGE\"]=158,o[e[159]=\"INVALID_AUTORENEW_ACCOUNT\"]=159,o[e[160]=\"AUTORENEW_ACCOUNT_NOT_ALLOWED\"]=160,o[e[162]=\"TOPIC_EXPIRED\"]=162,o[e[163]=\"INVALID_CHUNK_NUMBER\"]=163,o[e[164]=\"INVALID_CHUNK_TRANSACTION_ID\"]=164,o[e[165]=\"ACCOUNT_FROZEN_FOR_TOKEN\"]=165,o[e[166]=\"TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED\"]=166,o[e[167]=\"INVALID_TOKEN_ID\"]=167,o[e[168]=\"INVALID_TOKEN_DECIMALS\"]=168,o[e[169]=\"INVALID_TOKEN_INITIAL_SUPPLY\"]=169,o[e[170]=\"INVALID_TREASURY_ACCOUNT_FOR_TOKEN\"]=170,o[e[171]=\"INVALID_TOKEN_SYMBOL\"]=171,o[e[172]=\"TOKEN_HAS_NO_FREEZE_KEY\"]=172,o[e[173]=\"TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN\"]=173,o[e[174]=\"MISSING_TOKEN_SYMBOL\"]=174,o[e[175]=\"TOKEN_SYMBOL_TOO_LONG\"]=175,o[e[176]=\"ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN\"]=176,o[e[177]=\"TOKEN_HAS_NO_KYC_KEY\"]=177,o[e[178]=\"INSUFFICIENT_TOKEN_BALANCE\"]=178,o[e[179]=\"TOKEN_WAS_DELETED\"]=179,o[e[180]=\"TOKEN_HAS_NO_SUPPLY_KEY\"]=180,o[e[181]=\"TOKEN_HAS_NO_WIPE_KEY\"]=181,o[e[182]=\"INVALID_TOKEN_MINT_AMOUNT\"]=182,o[e[183]=\"INVALID_TOKEN_BURN_AMOUNT\"]=183,o[e[184]=\"TOKEN_NOT_ASSOCIATED_TO_ACCOUNT\"]=184,o[e[185]=\"CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT\"]=185,o[e[186]=\"INVALID_KYC_KEY\"]=186,o[e[187]=\"INVALID_WIPE_KEY\"]=187,o[e[188]=\"INVALID_FREEZE_KEY\"]=188,o[e[189]=\"INVALID_SUPPLY_KEY\"]=189,o[e[190]=\"MISSING_TOKEN_NAME\"]=190,o[e[191]=\"TOKEN_NAME_TOO_LONG\"]=191,o[e[192]=\"INVALID_WIPING_AMOUNT\"]=192,o[e[193]=\"TOKEN_IS_IMMUTABLE\"]=193,o[e[194]=\"TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT\"]=194,o[e[195]=\"TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES\"]=195,o[e[196]=\"ACCOUNT_IS_TREASURY\"]=196,o[e[197]=\"TOKEN_ID_REPEATED_IN_TOKEN_LIST\"]=197,o[e[198]=\"TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED\"]=198,o[e[199]=\"EMPTY_TOKEN_TRANSFER_BODY\"]=199,o[e[200]=\"EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS\"]=200,o[e[201]=\"INVALID_SCHEDULE_ID\"]=201,o[e[202]=\"SCHEDULE_IS_IMMUTABLE\"]=202,o[e[203]=\"INVALID_SCHEDULE_PAYER_ID\"]=203,o[e[204]=\"INVALID_SCHEDULE_ACCOUNT_ID\"]=204,o[e[205]=\"NO_NEW_VALID_SIGNATURES\"]=205,o[e[206]=\"UNRESOLVABLE_REQUIRED_SIGNERS\"]=206,o[e[207]=\"SCHEDULED_TRANSACTION_NOT_IN_WHITELIST\"]=207,o[e[208]=\"SOME_SIGNATURES_WERE_INVALID\"]=208,o[e[209]=\"TRANSACTION_ID_FIELD_NOT_ALLOWED\"]=209,o[e[210]=\"IDENTICAL_SCHEDULE_ALREADY_CREATED\"]=210,o[e[211]=\"INVALID_ZERO_BYTE_IN_STRING\"]=211,o[e[212]=\"SCHEDULE_ALREADY_DELETED\"]=212,o[e[213]=\"SCHEDULE_ALREADY_EXECUTED\"]=213,o[e[214]=\"MESSAGE_SIZE_TOO_LARGE\"]=214,o[e[215]=\"OPERATION_REPEATED_IN_BUCKET_GROUPS\"]=215,o[e[216]=\"BUCKET_CAPACITY_OVERFLOW\"]=216,o[e[217]=\"NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION\"]=217,o[e[218]=\"BUCKET_HAS_NO_THROTTLE_GROUPS\"]=218,o[e[219]=\"THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC\"]=219,o[e[220]=\"SUCCESS_BUT_MISSING_EXPECTED_OPERATION\"]=220,o[e[221]=\"UNPARSEABLE_THROTTLE_DEFINITIONS\"]=221,o[e[222]=\"INVALID_THROTTLE_DEFINITIONS\"]=222,o[e[223]=\"ACCOUNT_EXPIRED_AND_PENDING_REMOVAL\"]=223,o[e[224]=\"INVALID_TOKEN_MAX_SUPPLY\"]=224,o[e[225]=\"INVALID_TOKEN_NFT_SERIAL_NUMBER\"]=225,o[e[226]=\"INVALID_NFT_ID\"]=226,o[e[227]=\"METADATA_TOO_LONG\"]=227,o[e[228]=\"BATCH_SIZE_LIMIT_EXCEEDED\"]=228,o[e[229]=\"INVALID_QUERY_RANGE\"]=229,o[e[230]=\"FRACTION_DIVIDES_BY_ZERO\"]=230,o[e[231]=\"INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE\"]=231,o[e[232]=\"CUSTOM_FEES_LIST_TOO_LONG\"]=232,o[e[233]=\"INVALID_CUSTOM_FEE_COLLECTOR\"]=233,o[e[234]=\"INVALID_TOKEN_ID_IN_CUSTOM_FEES\"]=234,o[e[235]=\"TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR\"]=235,o[e[236]=\"TOKEN_MAX_SUPPLY_REACHED\"]=236,o[e[237]=\"SENDER_DOES_NOT_OWN_NFT_SERIAL_NO\"]=237,o[e[238]=\"CUSTOM_FEE_NOT_FULLY_SPECIFIED\"]=238,o[e[239]=\"CUSTOM_FEE_MUST_BE_POSITIVE\"]=239,o[e[240]=\"TOKEN_HAS_NO_FEE_SCHEDULE_KEY\"]=240,o[e[241]=\"CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE\"]=241,o[e[242]=\"ROYALTY_FRACTION_CANNOT_EXCEED_ONE\"]=242,o[e[243]=\"FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT\"]=243,o[e[244]=\"CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES\"]=244,o[e[245]=\"CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON\"]=245,o[e[246]=\"CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON\"]=246,o[e[247]=\"INVALID_CUSTOM_FEE_SCHEDULE_KEY\"]=247,o[e[248]=\"INVALID_TOKEN_MINT_METADATA\"]=248,o[e[249]=\"INVALID_TOKEN_BURN_METADATA\"]=249,o[e[250]=\"CURRENT_TREASURY_STILL_OWNS_NFTS\"]=250,o[e[251]=\"ACCOUNT_STILL_OWNS_NFTS\"]=251,o[e[252]=\"TREASURY_MUST_OWN_BURNED_NFT\"]=252,o[e[253]=\"ACCOUNT_DOES_NOT_OWN_WIPED_NFT\"]=253,o[e[254]=\"ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON\"]=254,o[e[255]=\"MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED\"]=255,o[e[256]=\"PAYER_ACCOUNT_DELETED\"]=256,o[e[257]=\"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH\"]=257,o[e[258]=\"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS\"]=258,o[e[259]=\"INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE\"]=259,o[e[260]=\"SERIAL_NUMBER_LIMIT_REACHED\"]=260,o[e[261]=\"CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE\"]=261,o[e[262]=\"NO_REMAINING_AUTOMATIC_ASSOCIATIONS\"]=262,o[e[263]=\"EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT\"]=263,o[e[264]=\"REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT\"]=264,o[e[265]=\"TOKEN_IS_PAUSED\"]=265,o[e[266]=\"TOKEN_HAS_NO_PAUSE_KEY\"]=266,o[e[267]=\"INVALID_PAUSE_KEY\"]=267,o[e[268]=\"FREEZE_UPDATE_FILE_DOES_NOT_EXIST\"]=268,o[e[269]=\"FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH\"]=269,o[e[270]=\"NO_UPGRADE_HAS_BEEN_PREPARED\"]=270,o[e[271]=\"NO_FREEZE_IS_SCHEDULED\"]=271,o[e[272]=\"UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE\"]=272,o[e[273]=\"FREEZE_START_TIME_MUST_BE_FUTURE\"]=273,o[e[274]=\"PREPARED_UPDATE_FILE_IS_IMMUTABLE\"]=274,o[e[275]=\"FREEZE_ALREADY_SCHEDULED\"]=275,o[e[276]=\"FREEZE_UPGRADE_IN_PROGRESS\"]=276,o[e[277]=\"UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED\"]=277,o[e[278]=\"UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED\"]=278,o[e[279]=\"CONSENSUS_GAS_EXHAUSTED\"]=279,o[e[280]=\"REVERTED_SUCCESS\"]=280,o[e[281]=\"MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED\"]=281,o[e[282]=\"INVALID_ALIAS_KEY\"]=282,o[e[283]=\"UNEXPECTED_TOKEN_DECIMALS\"]=283,o[e[284]=\"INVALID_PROXY_ACCOUNT_ID\"]=284,o[e[285]=\"INVALID_TRANSFER_ACCOUNT_ID\"]=285,o[e[286]=\"INVALID_FEE_COLLECTOR_ACCOUNT_ID\"]=286,o[e[287]=\"ALIAS_IS_IMMUTABLE\"]=287,o[e[288]=\"SPENDER_ACCOUNT_SAME_AS_OWNER\"]=288,o[e[289]=\"AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY\"]=289,o[e[290]=\"NEGATIVE_ALLOWANCE_AMOUNT\"]=290,o[e[291]=\"CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON\"]=291,o[e[292]=\"SPENDER_DOES_NOT_HAVE_ALLOWANCE\"]=292,o[e[293]=\"AMOUNT_EXCEEDS_ALLOWANCE\"]=293,o[e[294]=\"MAX_ALLOWANCES_EXCEEDED\"]=294,o[e[295]=\"EMPTY_ALLOWANCES\"]=295,o[e[296]=\"SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES\"]=296,o[e[297]=\"REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES\"]=297,o[e[298]=\"FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES\"]=298,o[e[299]=\"NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES\"]=299,o[e[300]=\"INVALID_ALLOWANCE_OWNER_ID\"]=300,o[e[301]=\"INVALID_ALLOWANCE_SPENDER_ID\"]=301,o[e[302]=\"REPEATED_ALLOWANCES_TO_DELETE\"]=302,o[e[303]=\"INVALID_DELEGATING_SPENDER\"]=303,o[e[304]=\"DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL\"]=304,o[e[305]=\"DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL\"]=305,o[e[306]=\"SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE\"]=306,o[e[307]=\"SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME\"]=307,o[e[308]=\"SCHEDULE_FUTURE_THROTTLE_EXCEEDED\"]=308,o[e[309]=\"SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED\"]=309,o[e[310]=\"INVALID_ETHEREUM_TRANSACTION\"]=310,o[e[311]=\"WRONG_CHAIN_ID\"]=311,o[e[312]=\"WRONG_NONCE\"]=312,o[e[313]=\"ACCESS_LIST_UNSUPPORTED\"]=313,o[e[314]=\"SCHEDULE_PENDING_EXPIRATION\"]=314,o[e[315]=\"CONTRACT_IS_TOKEN_TREASURY\"]=315,o[e[316]=\"CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES\"]=316,o[e[317]=\"CONTRACT_EXPIRED_AND_PENDING_REMOVAL\"]=317,o[e[318]=\"CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT\"]=318,o[e[319]=\"PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION\"]=319,o[e[320]=\"PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED\"]=320,o[e[321]=\"SELF_STAKING_IS_NOT_ALLOWED\"]=321,o[e[322]=\"INVALID_STAKING_ID\"]=322,o[e[323]=\"STAKING_NOT_ENABLED\"]=323,o[e[324]=\"INVALID_PRNG_RANGE\"]=324,o[e[325]=\"MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED\"]=325,o[e[326]=\"INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE\"]=326,o}(),ConsensusTopicInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.memo=e.string();break;case 2:d.runningHash=e.bytes();break;case 3:d.sequenceNumber=e.uint64();break;case 4:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 5:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 6:d.submitKey=$root.proto.Key.decode(e,e.uint32());break;case 7:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 8:d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break;case 9:d.ledgerId=e.bytes();break;default:e.skipType(7&i);}return d},e}(),ConsensusService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createTopic\"}),Object.defineProperty(e.prototype.updateTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateTopic\"}),Object.defineProperty(e.prototype.deleteTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteTopic\"}),Object.defineProperty(e.prototype.getTopicInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTopicInfo\"}),Object.defineProperty(e.prototype.submitMessage=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"submitMessage\"}),e}(),Query:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.getByKey=$root.proto.GetByKeyQuery.decode(e,e.uint32());break;case 2:d.getBySolidityID=$root.proto.GetBySolidityIDQuery.decode(e,e.uint32());break;case 3:d.contractCallLocal=$root.proto.ContractCallLocalQuery.decode(e,e.uint32());break;case 4:d.contractGetInfo=$root.proto.ContractGetInfoQuery.decode(e,e.uint32());break;case 5:d.contractGetBytecode=$root.proto.ContractGetBytecodeQuery.decode(e,e.uint32());break;case 6:d.ContractGetRecords=$root.proto.ContractGetRecordsQuery.decode(e,e.uint32());break;case 7:d.cryptogetAccountBalance=$root.proto.CryptoGetAccountBalanceQuery.decode(e,e.uint32());break;case 8:d.cryptoGetAccountRecords=$root.proto.CryptoGetAccountRecordsQuery.decode(e,e.uint32());break;case 9:d.cryptoGetInfo=$root.proto.CryptoGetInfoQuery.decode(e,e.uint32());break;case 10:d.cryptoGetLiveHash=$root.proto.CryptoGetLiveHashQuery.decode(e,e.uint32());break;case 11:d.cryptoGetProxyStakers=$root.proto.CryptoGetStakersQuery.decode(e,e.uint32());break;case 12:d.fileGetContents=$root.proto.FileGetContentsQuery.decode(e,e.uint32());break;case 13:d.fileGetInfo=$root.proto.FileGetInfoQuery.decode(e,e.uint32());break;case 14:d.transactionGetReceipt=$root.proto.TransactionGetReceiptQuery.decode(e,e.uint32());break;case 15:d.transactionGetRecord=$root.proto.TransactionGetRecordQuery.decode(e,e.uint32());break;case 16:d.transactionGetFastRecord=$root.proto.TransactionGetFastRecordQuery.decode(e,e.uint32());break;case 50:d.consensusGetTopicInfo=$root.proto.ConsensusGetTopicInfoQuery.decode(e,e.uint32());break;case 51:d.networkGetVersionInfo=$root.proto.NetworkGetVersionInfoQuery.decode(e,e.uint32());break;case 52:d.tokenGetInfo=$root.proto.TokenGetInfoQuery.decode(e,e.uint32());break;case 53:d.scheduleGetInfo=$root.proto.ScheduleGetInfoQuery.decode(e,e.uint32());break;case 54:d.tokenGetAccountNftInfos=$root.proto.TokenGetAccountNftInfosQuery.decode(e,e.uint32());break;case 55:d.tokenGetNftInfo=$root.proto.TokenGetNftInfoQuery.decode(e,e.uint32());break;case 56:d.tokenGetNftInfos=$root.proto.TokenGetNftInfosQuery.decode(e,e.uint32());break;case 57:d.networkGetExecutionTime=$root.proto.NetworkGetExecutionTimeQuery.decode(e,e.uint32());break;case 58:d.accountDetails=$root.proto.GetAccountDetailsQuery.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),GetByKeyQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.key=$root.proto.Key.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),EntityID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break;case 3:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 4:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),GetByKeyResponse:function(){function e(e){if(this.entities=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.entities&&d.entities.length||(d.entities=[]),d.entities.push($root.proto.EntityID.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),GetBySolidityIDQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.solidityID=e.string();break;default:e.skipType(7&i);}return d},e}(),GetBySolidityIDResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 4:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractLoginfo:function(){function e(e){if(this.topic=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.bloom=e.bytes();break;case 3:d.topic&&d.topic.length||(d.topic=[]),d.topic.push(e.bytes());break;case 4:d.data=e.bytes();break;default:e.skipType(7&i);}return d},e}(),ContractFunctionResult:function(){function e(e){if(this.logInfo=[],this.createdContractIDs=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.contractCallResult=e.bytes();break;case 3:d.errorMessage=e.string();break;case 4:d.bloom=e.bytes();break;case 5:d.gasUsed=e.uint64();break;case 6:d.logInfo&&d.logInfo.length||(d.logInfo=[]),d.logInfo.push($root.proto.ContractLoginfo.decode(e,e.uint32()));break;case 7:d.createdContractIDs&&d.createdContractIDs.length||(d.createdContractIDs=[]),d.createdContractIDs.push($root.proto.ContractID.decode(e,e.uint32()));break;case 9:d.evmAddress=$root.google.protobuf.BytesValue.decode(e,e.uint32());break;case 10:d.gas=e.int64();break;case 11:d.amount=e.int64();break;case 12:d.functionParameters=e.bytes();break;case 13:d.senderId=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractCallLocalQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 3:d.gas=e.int64();break;case 4:d.functionParameters=e.bytes();break;case 5:d.maxResultSize=e.int64();break;case 6:d.senderId=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractCallLocalResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.functionResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.contractInfo=$root.proto.ContractGetInfoResponse.ContractInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e.ContractInfo=function(){function e(e){if(this.tokenRelationships=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.contractAccountID=e.string();break;case 4:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 5:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 6:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 7:d.storage=e.int64();break;case 8:d.memo=e.string();break;case 9:d.balance=e.uint64();break;case 10:d.deleted=e.bool();break;case 11:d.tokenRelationships&&d.tokenRelationships.length||(d.tokenRelationships=[]),d.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break;case 12:d.ledgerId=e.bytes();break;case 13:d.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 14:d.maxAutomaticTokenAssociations=e.int32();break;case 15:d.stakingInfo=$root.proto.StakingInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),e}(),ContractGetBytecodeQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractGetBytecodeResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 6:d.bytecode=e.bytes();break;default:e.skipType(7&i);}return d},e}(),ContractGetRecordsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ContractGetRecordsResponse:function(){function e(e){if(this.records=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 3:d.records&&d.records.length||(d.records=[]),d.records.push($root.proto.TransactionRecord.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TransactionRecord:function(){function e(e){if(this.tokenTransferLists=[],this.assessedCustomFees=[],this.automaticTokenAssociations=[],this.paidStakingRewards=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.receipt=$root.proto.TransactionReceipt.decode(e,e.uint32());break;case 2:d.transactionHash=e.bytes();break;case 3:d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break;case 4:d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break;case 5:d.memo=e.string();break;case 6:d.transactionFee=e.uint64();break;case 7:d.contractCallResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break;case 8:d.contractCreateResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break;case 10:d.transferList=$root.proto.TransferList.decode(e,e.uint32());break;case 11:d.tokenTransferLists&&d.tokenTransferLists.length||(d.tokenTransferLists=[]),d.tokenTransferLists.push($root.proto.TokenTransferList.decode(e,e.uint32()));break;case 12:d.scheduleRef=$root.proto.ScheduleID.decode(e,e.uint32());break;case 13:d.assessedCustomFees&&d.assessedCustomFees.length||(d.assessedCustomFees=[]),d.assessedCustomFees.push($root.proto.AssessedCustomFee.decode(e,e.uint32()));break;case 14:d.automaticTokenAssociations&&d.automaticTokenAssociations.length||(d.automaticTokenAssociations=[]),d.automaticTokenAssociations.push($root.proto.TokenAssociation.decode(e,e.uint32()));break;case 15:d.parentConsensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break;case 16:d.alias=e.bytes();break;case 17:d.ethereumHash=e.bytes();break;case 18:d.paidStakingRewards&&d.paidStakingRewards.length||(d.paidStakingRewards=[]),d.paidStakingRewards.push($root.proto.AccountAmount.decode(e,e.uint32()));break;case 19:d.prngBytes=e.bytes();break;case 20:d.prngNumber=e.int32();break;default:e.skipType(7&i);}return d},e}(),TransactionReceipt:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.status=e.int32();break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 4:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;case 5:d.exchangeRate=$root.proto.ExchangeRateSet.decode(e,e.uint32());break;case 6:d.topicID=$root.proto.TopicID.decode(e,e.uint32());break;case 7:d.topicSequenceNumber=e.uint64();break;case 8:d.topicRunningHash=e.bytes();break;case 9:d.topicRunningHashVersion=e.uint64();break;case 10:d.tokenID=$root.proto.TokenID.decode(e,e.uint32());break;case 11:d.newTotalSupply=e.uint64();break;case 12:d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break;case 13:d.scheduledTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break;case 14:if(d.serialNumbers&&d.serialNumbers.length||(d.serialNumbers=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.hbarEquiv=e.int32();break;case 2:d.centEquiv=e.int32();break;case 3:d.expirationTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ExchangeRateSet:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.currentRate=$root.proto.ExchangeRate.decode(e,e.uint32());break;case 2:d.nextRate=$root.proto.ExchangeRate.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoGetAccountBalanceQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.contractID=$root.proto.ContractID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoGetAccountBalanceResponse:function(){function e(e){if(this.tokenBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.balance=e.uint64();break;case 4:d.tokenBalances&&d.tokenBalances.length||(d.tokenBalances=[]),d.tokenBalances.push($root.proto.TokenBalance.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),CryptoGetAccountRecordsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoGetAccountRecordsResponse:function(){function e(e){if(this.records=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.records&&d.records.length||(d.records=[]),d.records.push($root.proto.TransactionRecord.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),CryptoGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.accountInfo=$root.proto.CryptoGetInfoResponse.AccountInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e.AccountInfo=function(){function e(e){if(this.liveHashes=[],this.tokenRelationships=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.contractAccountID=e.string();break;case 3:d.deleted=e.bool();break;case 4:d.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 6:d.proxyReceived=e.int64();break;case 7:d.key=$root.proto.Key.decode(e,e.uint32());break;case 8:d.balance=e.uint64();break;case 9:d.generateSendRecordThreshold=e.uint64();break;case 10:d.generateReceiveRecordThreshold=e.uint64();break;case 11:d.receiverSigRequired=e.bool();break;case 12:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 13:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 14:d.liveHashes&&d.liveHashes.length||(d.liveHashes=[]),d.liveHashes.push($root.proto.LiveHash.decode(e,e.uint32()));break;case 15:d.tokenRelationships&&d.tokenRelationships.length||(d.tokenRelationships=[]),d.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break;case 16:d.memo=e.string();break;case 17:d.ownedNfts=e.int64();break;case 18:d.maxAutomaticTokenAssociations=e.int32();break;case 19:d.alias=e.bytes();break;case 20:d.ledgerId=e.bytes();break;case 21:d.ethereumNonce=e.int64();break;case 22:d.stakingInfo=$root.proto.StakingInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),e}(),CryptoGetLiveHashQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.hash=e.bytes();break;default:e.skipType(7&i);}return d},e}(),CryptoGetLiveHashResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoGetStakersQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ProxyStaker:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.amount=e.int64();break;default:e.skipType(7&i);}return d},e}(),AllProxyStakers:function(){function e(e){if(this.proxyStaker=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.proxyStaker&&d.proxyStaker.length||(d.proxyStaker=[]),d.proxyStaker.push($root.proto.ProxyStaker.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),CryptoGetStakersResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 3:d.stakers=$root.proto.AllProxyStakers.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),FileGetContentsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),FileGetContentsResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.fileContents=$root.proto.FileGetContentsResponse.FileContents.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e.FileContents=function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 2:d.contents=e.bytes();break;default:e.skipType(7&i);}return d},e}(),e}(),FileGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),FileGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.fileInfo=$root.proto.FileGetInfoResponse.FileInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e.FileInfo=function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileID=$root.proto.FileID.decode(e,e.uint32());break;case 2:d.size=e.int64();break;case 3:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 4:d.deleted=e.bool();break;case 5:d.keys=$root.proto.KeyList.decode(e,e.uint32());break;case 6:d.memo=e.string();break;case 7:d.ledgerId=e.bytes();break;default:e.skipType(7&i);}return d},e}(),e}(),TransactionGetReceiptQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break;case 3:d.includeDuplicates=e.bool();break;case 4:d.includeChildReceipts=e.bool();break;default:e.skipType(7&i);}return d},e}(),TransactionGetReceiptResponse:function(){function e(e){if(this.duplicateTransactionReceipts=[],this.childTransactionReceipts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.receipt=$root.proto.TransactionReceipt.decode(e,e.uint32());break;case 4:d.duplicateTransactionReceipts&&d.duplicateTransactionReceipts.length||(d.duplicateTransactionReceipts=[]),d.duplicateTransactionReceipts.push($root.proto.TransactionReceipt.decode(e,e.uint32()));break;case 5:d.childTransactionReceipts&&d.childTransactionReceipts.length||(d.childTransactionReceipts=[]),d.childTransactionReceipts.push($root.proto.TransactionReceipt.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TransactionGetRecordQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break;case 3:d.includeDuplicates=e.bool();break;case 4:d.includeChildRecords=e.bool();break;default:e.skipType(7&i);}return d},e}(),TransactionGetRecordResponse:function(){function e(e){if(this.duplicateTransactionRecords=[],this.childTransactionRecords=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 3:d.transactionRecord=$root.proto.TransactionRecord.decode(e,e.uint32());break;case 4:d.duplicateTransactionRecords&&d.duplicateTransactionRecords.length||(d.duplicateTransactionRecords=[]),d.duplicateTransactionRecords.push($root.proto.TransactionRecord.decode(e,e.uint32()));break;case 5:d.childTransactionRecords&&d.childTransactionRecords.length||(d.childTransactionRecords=[]),d.childTransactionRecords.push($root.proto.TransactionRecord.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TransactionGetFastRecordQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TransactionGetFastRecordResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.transactionRecord=$root.proto.TransactionRecord.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),NetworkGetVersionInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),NetworkGetVersionInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.hapiProtoVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break;case 3:d.hederaServicesVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),NetworkGetExecutionTimeQuery:function(){function e(e){if(this.transactionIds=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.transactionIds&&d.transactionIds.length||(d.transactionIds=[]),d.transactionIds.push($root.proto.TransactionID.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),NetworkGetExecutionTimeResponse:function(){function e(e){if(this.executionTimes=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:if(d.executionTimes&&d.executionTimes.length||(d.executionTimes=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.token=$root.proto.TokenID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenInfo:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.name=e.string();break;case 3:d.symbol=e.string();break;case 4:d.decimals=e.uint32();break;case 5:d.totalSupply=e.uint64();break;case 6:d.treasury=$root.proto.AccountID.decode(e,e.uint32());break;case 7:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 8:d.kycKey=$root.proto.Key.decode(e,e.uint32());break;case 9:d.freezeKey=$root.proto.Key.decode(e,e.uint32());break;case 10:d.wipeKey=$root.proto.Key.decode(e,e.uint32());break;case 11:d.supplyKey=$root.proto.Key.decode(e,e.uint32());break;case 12:d.defaultFreezeStatus=e.int32();break;case 13:d.defaultKycStatus=e.int32();break;case 14:d.deleted=e.bool();break;case 15:d.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break;case 16:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 17:d.expiry=$root.proto.Timestamp.decode(e,e.uint32());break;case 18:d.memo=e.string();break;case 19:d.tokenType=e.int32();break;case 20:d.supplyType=e.int32();break;case 21:d.maxSupply=e.int64();break;case 22:d.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break;case 23:d.customFees&&d.customFees.length||(d.customFees=[]),d.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break;case 24:d.pauseKey=$root.proto.Key.decode(e,e.uint32());break;case 25:d.pauseStatus=e.int32();break;case 26:d.ledgerId=e.bytes();break;default:e.skipType(7&i);}return d},e}(),TokenGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.tokenInfo=$root.proto.TokenInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ScheduleGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),ScheduleInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break;case 2:d.deletionTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 3:d.executionTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 4:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 5:d.scheduledTransactionBody=$root.proto.SchedulableTransactionBody.decode(e,e.uint32());break;case 6:d.memo=e.string();break;case 7:d.adminKey=$root.proto.Key.decode(e,e.uint32());break;case 8:d.signers=$root.proto.KeyList.decode(e,e.uint32());break;case 9:d.creatorAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 10:d.payerAccountID=$root.proto.AccountID.decode(e,e.uint32());break;case 11:d.scheduledTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break;case 12:d.ledgerId=e.bytes();break;case 13:d.waitForExpiry=e.bool();break;default:e.skipType(7&i);}return d},e}(),ScheduleGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.scheduleInfo=$root.proto.ScheduleInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenGetAccountNftInfosQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.start=e.int64();break;case 4:d.end=e.int64();break;default:e.skipType(7&i);}return d},e}(),TokenGetAccountNftInfosResponse:function(){function e(e){if(this.nfts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.nfts&&d.nfts.length||(d.nfts=[]),d.nfts.push($root.proto.TokenNftInfo.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),NftID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenID=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.serialNumber=e.int64();break;default:e.skipType(7&i);}return d},e}(),TokenGetNftInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.nftID=$root.proto.NftID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenNftInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.nftID=$root.proto.NftID.decode(e,e.uint32());break;case 2:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.creationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 4:d.metadata=e.bytes();break;case 5:d.ledgerId=e.bytes();break;case 6:d.spenderId=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenGetNftInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.nft=$root.proto.TokenNftInfo.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),TokenGetNftInfosQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.tokenID=$root.proto.TokenID.decode(e,e.uint32());break;case 3:d.start=e.int64();break;case 4:d.end=e.int64();break;default:e.skipType(7&i);}return d},e}(),TokenGetNftInfosResponse:function(){function e(e){if(this.nfts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.tokenID=$root.proto.TokenID.decode(e,e.uint32());break;case 3:d.nfts&&d.nfts.length||(d.nfts=[]),d.nfts.push($root.proto.TokenNftInfo.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),GetAccountDetailsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.QueryHeader.decode(e,e.uint32());break;case 2:d.accountId=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),GetAccountDetailsResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.header=$root.proto.ResponseHeader.decode(e,e.uint32());break;case 2:d.accountDetails=$root.proto.GetAccountDetailsResponse.AccountDetails.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e.AccountDetails=function(){function e(e){if(this.tokenRelationships=[],this.grantedCryptoAllowances=[],this.grantedNftAllowances=[],this.grantedTokenAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountId=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.contractAccountId=e.string();break;case 3:d.deleted=e.bool();break;case 4:d.proxyAccountId=$root.proto.AccountID.decode(e,e.uint32());break;case 5:d.proxyReceived=e.int64();break;case 6:d.key=$root.proto.Key.decode(e,e.uint32());break;case 7:d.balance=e.uint64();break;case 8:d.receiverSigRequired=e.bool();break;case 9:d.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break;case 10:d.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break;case 11:d.tokenRelationships&&d.tokenRelationships.length||(d.tokenRelationships=[]),d.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break;case 12:d.memo=e.string();break;case 13:d.ownedNfts=e.int64();break;case 14:d.maxAutomaticTokenAssociations=e.int32();break;case 15:d.alias=e.bytes();break;case 16:d.ledgerId=e.bytes();break;case 17:d.grantedCryptoAllowances&&d.grantedCryptoAllowances.length||(d.grantedCryptoAllowances=[]),d.grantedCryptoAllowances.push($root.proto.GrantedCryptoAllowance.decode(e,e.uint32()));break;case 18:d.grantedNftAllowances&&d.grantedNftAllowances.length||(d.grantedNftAllowances=[]),d.grantedNftAllowances.push($root.proto.GrantedNftAllowance.decode(e,e.uint32()));break;case 19:d.grantedTokenAllowances&&d.grantedTokenAllowances.length||(d.grantedTokenAllowances=[]),d.grantedTokenAllowances.push($root.proto.GrantedTokenAllowance.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),e}(),GrantedCryptoAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.spender=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.amount=e.int64();break;default:e.skipType(7&i);}return d},e}(),GrantedNftAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.spender=$root.proto.AccountID.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),GrantedTokenAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.spender=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.amount=e.int64();break;default:e.skipType(7&i);}return d},e}(),Response:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.getByKey=$root.proto.GetByKeyResponse.decode(e,e.uint32());break;case 2:d.getBySolidityID=$root.proto.GetBySolidityIDResponse.decode(e,e.uint32());break;case 3:d.contractCallLocal=$root.proto.ContractCallLocalResponse.decode(e,e.uint32());break;case 5:d.contractGetBytecodeResponse=$root.proto.ContractGetBytecodeResponse.decode(e,e.uint32());break;case 4:d.contractGetInfo=$root.proto.ContractGetInfoResponse.decode(e,e.uint32());break;case 6:d.contractGetRecordsResponse=$root.proto.ContractGetRecordsResponse.decode(e,e.uint32());break;case 7:d.cryptogetAccountBalance=$root.proto.CryptoGetAccountBalanceResponse.decode(e,e.uint32());break;case 8:d.cryptoGetAccountRecords=$root.proto.CryptoGetAccountRecordsResponse.decode(e,e.uint32());break;case 9:d.cryptoGetInfo=$root.proto.CryptoGetInfoResponse.decode(e,e.uint32());break;case 10:d.cryptoGetLiveHash=$root.proto.CryptoGetLiveHashResponse.decode(e,e.uint32());break;case 11:d.cryptoGetProxyStakers=$root.proto.CryptoGetStakersResponse.decode(e,e.uint32());break;case 12:d.fileGetContents=$root.proto.FileGetContentsResponse.decode(e,e.uint32());break;case 13:d.fileGetInfo=$root.proto.FileGetInfoResponse.decode(e,e.uint32());break;case 14:d.transactionGetReceipt=$root.proto.TransactionGetReceiptResponse.decode(e,e.uint32());break;case 15:d.transactionGetRecord=$root.proto.TransactionGetRecordResponse.decode(e,e.uint32());break;case 16:d.transactionGetFastRecord=$root.proto.TransactionGetFastRecordResponse.decode(e,e.uint32());break;case 150:d.consensusGetTopicInfo=$root.proto.ConsensusGetTopicInfoResponse.decode(e,e.uint32());break;case 151:d.networkGetVersionInfo=$root.proto.NetworkGetVersionInfoResponse.decode(e,e.uint32());break;case 152:d.tokenGetInfo=$root.proto.TokenGetInfoResponse.decode(e,e.uint32());break;case 153:d.scheduleGetInfo=$root.proto.ScheduleGetInfoResponse.decode(e,e.uint32());break;case 154:d.tokenGetAccountNftInfos=$root.proto.TokenGetAccountNftInfosResponse.decode(e,e.uint32());break;case 155:d.tokenGetNftInfo=$root.proto.TokenGetNftInfoResponse.decode(e,e.uint32());break;case 156:d.tokenGetNftInfos=$root.proto.TokenGetNftInfosResponse.decode(e,e.uint32());break;case 157:d.networkGetExecutionTime=$root.proto.NetworkGetExecutionTimeResponse.decode(e,e.uint32());break;case 158:d.accountDetails=$root.proto.GetAccountDetailsResponse.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),CryptoService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createAccount\"}),Object.defineProperty(e.prototype.updateAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateAccount\"}),Object.defineProperty(e.prototype.cryptoTransfer=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"cryptoTransfer\"}),Object.defineProperty(e.prototype.cryptoDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"cryptoDelete\"}),Object.defineProperty(e.prototype.approveAllowances=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"approveAllowances\"}),Object.defineProperty(e.prototype.deleteAllowances=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteAllowances\"}),Object.defineProperty(e.prototype.addLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"addLiveHash\"}),Object.defineProperty(e.prototype.deleteLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteLiveHash\"}),Object.defineProperty(e.prototype.getLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getLiveHash\"}),Object.defineProperty(e.prototype.getAccountRecords=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountRecords\"}),Object.defineProperty(e.prototype.cryptoGetBalance=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"cryptoGetBalance\"}),Object.defineProperty(e.prototype.getAccountInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountInfo\"}),Object.defineProperty(e.prototype.getTransactionReceipts=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTransactionReceipts\"}),Object.defineProperty(e.prototype.getFastTransactionRecord=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getFastTransactionRecord\"}),Object.defineProperty(e.prototype.getTxRecordByTxID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTxRecordByTxID\"}),Object.defineProperty(e.prototype.getStakersByAccountID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getStakersByAccountID\"}),e}(),FileService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createFile\"}),Object.defineProperty(e.prototype.updateFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateFile\"}),Object.defineProperty(e.prototype.deleteFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteFile\"}),Object.defineProperty(e.prototype.appendContent=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"appendContent\"}),Object.defineProperty(e.prototype.getFileContent=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getFileContent\"}),Object.defineProperty(e.prototype.getFileInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getFileInfo\"}),Object.defineProperty(e.prototype.systemDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemDelete\"}),Object.defineProperty(e.prototype.systemUndelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemUndelete\"}),e}(),FreezeService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.freeze=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"freeze\"}),e}(),NetworkService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.getVersionInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getVersionInfo\"}),Object.defineProperty(e.prototype.getExecutionTime=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getExecutionTime\"}),Object.defineProperty(e.prototype.uncheckedSubmit=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"uncheckedSubmit\"}),Object.defineProperty(e.prototype.getAccountDetails=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountDetails\"}),e}(),ScheduleService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createSchedule\"}),Object.defineProperty(e.prototype.signSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"signSchedule\"}),Object.defineProperty(e.prototype.deleteSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteSchedule\"}),Object.defineProperty(e.prototype.getScheduleInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getScheduleInfo\"}),e}(),SmartContractService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createContract\"}),Object.defineProperty(e.prototype.updateContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateContract\"}),Object.defineProperty(e.prototype.contractCallMethod=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"contractCallMethod\"}),Object.defineProperty(e.prototype.getContractInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getContractInfo\"}),Object.defineProperty(e.prototype.contractCallLocalMethod=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"contractCallLocalMethod\"}),Object.defineProperty(e.prototype.contractGetBytecode=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"ContractGetBytecode\"}),Object.defineProperty(e.prototype.getBySolidityID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getBySolidityID\"}),Object.defineProperty(e.prototype.getTxRecordByContractID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTxRecordByContractID\"}),Object.defineProperty(e.prototype.deleteContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteContract\"}),Object.defineProperty(e.prototype.systemDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemDelete\"}),Object.defineProperty(e.prototype.systemUndelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemUndelete\"}),Object.defineProperty(e.prototype.callEthereum=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"callEthereum\"}),e}(),ThrottleGroup:function(){function e(e){if(this.operations=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:if(d.operations&&d.operations.length||(d.operations=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.name=e.string();break;case 2:d.burstPeriodMs=e.uint64();break;case 3:d.throttleGroups&&d.throttleGroups.length||(d.throttleGroups=[]),d.throttleGroups.push($root.proto.ThrottleGroup.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),ThrottleDefinitions:function(){function e(e){if(this.throttleBuckets=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.throttleBuckets&&d.throttleBuckets.length||(d.throttleBuckets=[]),d.throttleBuckets.push($root.proto.ThrottleBucket.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TokenService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createToken\"}),Object.defineProperty(e.prototype.updateToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateToken\"}),Object.defineProperty(e.prototype.mintToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"mintToken\"}),Object.defineProperty(e.prototype.burnToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"burnToken\"}),Object.defineProperty(e.prototype.deleteToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteToken\"}),Object.defineProperty(e.prototype.wipeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"wipeTokenAccount\"}),Object.defineProperty(e.prototype.freezeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"freezeTokenAccount\"}),Object.defineProperty(e.prototype.unfreezeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"unfreezeTokenAccount\"}),Object.defineProperty(e.prototype.grantKycToTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"grantKycToTokenAccount\"}),Object.defineProperty(e.prototype.revokeKycFromTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"revokeKycFromTokenAccount\"}),Object.defineProperty(e.prototype.associateTokens=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"associateTokens\"}),Object.defineProperty(e.prototype.dissociateTokens=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"dissociateTokens\"}),Object.defineProperty(e.prototype.updateTokenFeeSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateTokenFeeSchedule\"}),Object.defineProperty(e.prototype.getTokenInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTokenInfo\"}),Object.defineProperty(e.prototype.getAccountNftInfos=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountNftInfos\"}),Object.defineProperty(e.prototype.getTokenNftInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTokenNftInfo\"}),Object.defineProperty(e.prototype.getTokenNftInfos=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTokenNftInfos\"}),Object.defineProperty(e.prototype.pauseToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"pauseToken\"}),Object.defineProperty(e.prototype.unpauseToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"unpauseToken\"}),e}(),SignedTransaction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.bodyBytes=e.bytes();break;case 2:d.sigMap=$root.proto.SignatureMap.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),UtilService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.prng=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"prng\"}),e}(),TokenUnitBalance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.tokenId=$root.proto.TokenID.decode(e,e.uint32());break;case 2:d.balance=e.uint64();break;default:e.skipType(7&i);}return d},e}(),SingleAccountBalances:function(){function e(e){if(this.tokenUnitBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.accountID=$root.proto.AccountID.decode(e,e.uint32());break;case 2:d.hbarBalance=e.uint64();break;case 3:d.tokenUnitBalances&&d.tokenUnitBalances.length||(d.tokenUnitBalances=[]),d.tokenUnitBalances.push($root.proto.TokenUnitBalance.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),AllAccountBalances:function(){function e(e){if(this.allAccounts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break;case 2:d.allAccounts&&d.allAccounts.length||(d.allAccounts=[]),d.allAccounts.push($root.proto.SingleAccountBalances.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),ContractActions:function(){function e(e){if(this.contractActions=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractActions&&d.contractActions.length||(d.contractActions=[]),d.contractActions.push($root.proto.ContractAction.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),ContractActionType:function(){const e={},o=Object.create(e);return o[e[0]=\"NO_ACTION\"]=0,o[e[1]=\"CALL\"]=1,o[e[2]=\"CREATE\"]=2,o[e[3]=\"PRECOMPILE\"]=3,o[e[4]=\"SYSTEM\"]=4,o}(),ContractAction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.callType=e.int32();break;case 2:d.callingAccount=$root.proto.AccountID.decode(e,e.uint32());break;case 3:d.callingContract=$root.proto.ContractID.decode(e,e.uint32());break;case 4:d.gas=e.int64();break;case 5:d.input=e.bytes();break;case 6:d.recipientAccount=$root.proto.AccountID.decode(e,e.uint32());break;case 7:d.recipientContract=$root.proto.ContractID.decode(e,e.uint32());break;case 8:d.invalidSolidityAddress=e.bytes();break;case 9:d.value=e.int64();break;case 10:d.gasUsed=e.int64();break;case 11:d.output=e.bytes();break;case 12:d.revertReason=e.bytes();break;case 13:d.error=e.bytes();break;case 14:d.callDepth=e.int32();break;default:e.skipType(7&i);}return d},e}(),ContractBytecode:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractId=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.initcode=e.bytes();break;case 3:d.runtimeBytecode=e.bytes();break;default:e.skipType(7&i);}return d},e}(),ContractStateChanges:function(){function e(e){if(this.contractStateChanges=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractStateChanges&&d.contractStateChanges.length||(d.contractStateChanges=[]),d.contractStateChanges.push($root.proto.ContractStateChange.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),ContractStateChange:function(){function e(e){if(this.storageChanges=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.contractId=$root.proto.ContractID.decode(e,e.uint32());break;case 2:d.storageChanges&&d.storageChanges.length||(d.storageChanges=[]),d.storageChanges.push($root.proto.StorageChange.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),StorageChange:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.slot=e.bytes();break;case 2:d.valueRead=e.bytes();break;case 3:d.valueWritten=$root.google.protobuf.BytesValue.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),HashAlgorithm:function(){const e={},o=Object.create(e);return o[e[0]=\"HASH_ALGORITHM_UNKNOWN\"]=0,o[e[1]=\"SHA_384\"]=1,o}(),HashObject:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.algorithm=e.int32();break;case 2:d.length=e.int32();break;case 3:d.hash=e.bytes();break;default:e.skipType(7&i);}return d},e}(),RecordStreamFile:function(){function e(e){if(this.recordStreamItems=[],this.sidecars=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.hapiProtoVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break;case 2:d.startObjectRunningHash=$root.proto.HashObject.decode(e,e.uint32());break;case 3:d.recordStreamItems&&d.recordStreamItems.length||(d.recordStreamItems=[]),d.recordStreamItems.push($root.proto.RecordStreamItem.decode(e,e.uint32()));break;case 4:d.endObjectRunningHash=$root.proto.HashObject.decode(e,e.uint32());break;case 5:d.blockNumber=e.int64();break;case 6:d.sidecars&&d.sidecars.length||(d.sidecars=[]),d.sidecars.push($root.proto.SidecarMetadata.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),RecordStreamItem:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.transaction=$root.proto.Transaction.decode(e,e.uint32());break;case 2:d.record=$root.proto.TransactionRecord.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),SidecarMetadata:function(){function e(e){if(this.types=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.hash=$root.proto.HashObject.decode(e,e.uint32());break;case 2:d.id=e.int32();break;case 3:if(d.types&&d.types.length||(d.types=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:d.sidecarRecords&&d.sidecarRecords.length||(d.sidecarRecords=[]),d.sidecarRecords.push($root.proto.TransactionSidecarRecord.decode(e,e.uint32()));break;default:e.skipType(7&i);}return d},e}(),TransactionSidecarRecord:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break;case 2:d.migration=e.bool();break;case 3:d.stateChanges=$root.proto.ContractStateChanges.decode(e,e.uint32());break;case 4:d.actions=$root.proto.ContractActions.decode(e,e.uint32());break;case 5:d.bytecode=$root.proto.ContractBytecode.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),SignatureFile:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.fileSignature=$root.proto.SignatureObject.decode(e,e.uint32());break;case 2:d.metadataSignature=$root.proto.SignatureObject.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),SignatureObject:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.type=e.int32();break;case 2:d.length=e.int32();break;case 3:d.checksum=e.int32();break;case 4:d.signature=e.bytes();break;case 5:d.hashObject=$root.proto.HashObject.decode(e,e.uint32());break;default:e.skipType(7&i);}return d},e}(),SignatureType:function(){const e={},o=Object.create(e);return o[e[0]=\"SIGNATURE_TYPE_UNKNOWN\"]=0,o[e[1]=\"SHA_384_WITH_RSA\"]=1,o}()};return e})();exports.proto=proto;const google=$root.google=(()=>{const e={protobuf:function(){const e={DoubleValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.double();break;default:e.skipType(7&i);}return d},e}(),FloatValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.float();break;default:e.skipType(7&i);}return d},e}(),Int64Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.int64();break;default:e.skipType(7&i);}return d},e}(),UInt64Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.uint64();break;default:e.skipType(7&i);}return d},e}(),Int32Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.int32();break;default:e.skipType(7&i);}return d},e}(),UInt32Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.uint32();break;default:e.skipType(7&i);}return d},e}(),BoolValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.bool();break;default:e.skipType(7&i);}return d},e}(),StringValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.string();break;default:e.skipType(7&i);}return d},e}(),BytesValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:d.value=e.bytes();break;default:e.skipType(7&i);}return d},e}()};return e}()};return e})();exports.google=google;\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/proto/lib/proto.js?"); +var inherits = __webpack_require__(5717); + +var asn1 = __webpack_require__(9809); +var base = asn1.base; +var bignum = asn1.bignum; + +// Import DER constants +var der = asn1.constants.der; + +function DERDecoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DERDecoder; + +DERDecoder.prototype.decode = function decode(data, options) { + if (!(data instanceof base.DecoderBuffer)) + data = new base.DecoderBuffer(data, options); + + return this.tree._decode(data, options); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._peekTag = function peekTag(buffer, tag, any) { + if (buffer.isEmpty()) + return false; + + var state = buffer.save(); + var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + buffer.restore(state); + + return decodedTag.tag === tag || decodedTag.tagStr === tag || + (decodedTag.tagStr + 'of') === tag || any; +}; + +DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) { + var decodedTag = derDecodeTag(buffer, + 'Failed to decode tag of "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + var len = derDecodeLen(buffer, + decodedTag.primitive, + 'Failed to get length of "' + tag + '"'); + + // Failure + if (buffer.isError(len)) + return len; + + if (!any && + decodedTag.tag !== tag && + decodedTag.tagStr !== tag && + decodedTag.tagStr + 'of' !== tag) { + return buffer.error('Failed to match tag: "' + tag + '"'); + } + + if (decodedTag.primitive || len !== null) + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); + + // Indefinite length... find END tag + var state = buffer.save(); + var res = this._skipUntilEnd( + buffer, + 'Failed to skip indefinite length body: "' + this.tag + '"'); + if (buffer.isError(res)) + return res; + + len = buffer.offset - state.offset; + buffer.restore(state); + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); +}; + +DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) { + while (true) { + var tag = derDecodeTag(buffer, fail); + if (buffer.isError(tag)) + return tag; + var len = derDecodeLen(buffer, tag.primitive, fail); + if (buffer.isError(len)) + return len; + + var res; + if (tag.primitive || len !== null) + res = buffer.skip(len) + else + res = this._skipUntilEnd(buffer, fail); + + // Failure + if (buffer.isError(res)) + return res; + + if (tag.tagStr === 'end') + break; + } +}; + +DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, + options) { + var result = []; + while (!buffer.isEmpty()) { + var possibleEnd = this._peekTag(buffer, 'end'); + if (buffer.isError(possibleEnd)) + return possibleEnd; + + var res = decoder.decode(buffer, 'der', options); + if (buffer.isError(res) && possibleEnd) + break; + result.push(res); + } + return result; +}; + +DERNode.prototype._decodeStr = function decodeStr(buffer, tag) { + if (tag === 'bitstr') { + var unused = buffer.readUInt8(); + if (buffer.isError(unused)) + return unused; + return { unused: unused, data: buffer.raw() }; + } else if (tag === 'bmpstr') { + var raw = buffer.raw(); + if (raw.length % 2 === 1) + return buffer.error('Decoding of string type: bmpstr length mismatch'); + + var str = ''; + for (var i = 0; i < raw.length / 2; i++) { + str += String.fromCharCode(raw.readUInt16BE(i * 2)); + } + return str; + } else if (tag === 'numstr') { + var numstr = buffer.raw().toString('ascii'); + if (!this._isNumstr(numstr)) { + return buffer.error('Decoding of string type: ' + + 'numstr unsupported characters'); + } + return numstr; + } else if (tag === 'octstr') { + return buffer.raw(); + } else if (tag === 'objDesc') { + return buffer.raw(); + } else if (tag === 'printstr') { + var printstr = buffer.raw().toString('ascii'); + if (!this._isPrintstr(printstr)) { + return buffer.error('Decoding of string type: ' + + 'printstr unsupported characters'); + } + return printstr; + } else if (/str$/.test(tag)) { + return buffer.raw().toString(); + } else { + return buffer.error('Decoding of string type: ' + tag + ' unsupported'); + } +}; + +DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) { + var result; + var identifiers = []; + var ident = 0; + while (!buffer.isEmpty()) { + var subident = buffer.readUInt8(); + ident <<= 7; + ident |= subident & 0x7f; + if ((subident & 0x80) === 0) { + identifiers.push(ident); + ident = 0; + } + } + if (subident & 0x80) + identifiers.push(ident); + + var first = (identifiers[0] / 40) | 0; + var second = identifiers[0] % 40; + + if (relative) + result = identifiers; + else + result = [first, second].concat(identifiers.slice(1)); + + if (values) { + var tmp = values[result.join(' ')]; + if (tmp === undefined) + tmp = values[result.join('.')]; + if (tmp !== undefined) + result = tmp; + } + + return result; +}; + +DERNode.prototype._decodeTime = function decodeTime(buffer, tag) { + var str = buffer.raw().toString(); + if (tag === 'gentime') { + var year = str.slice(0, 4) | 0; + var mon = str.slice(4, 6) | 0; + var day = str.slice(6, 8) | 0; + var hour = str.slice(8, 10) | 0; + var min = str.slice(10, 12) | 0; + var sec = str.slice(12, 14) | 0; + } else if (tag === 'utctime') { + var year = str.slice(0, 2) | 0; + var mon = str.slice(2, 4) | 0; + var day = str.slice(4, 6) | 0; + var hour = str.slice(6, 8) | 0; + var min = str.slice(8, 10) | 0; + var sec = str.slice(10, 12) | 0; + if (year < 70) + year = 2000 + year; + else + year = 1900 + year; + } else { + return buffer.error('Decoding ' + tag + ' time is not supported yet'); + } + + return Date.UTC(year, mon - 1, day, hour, min, sec, 0); +}; + +DERNode.prototype._decodeNull = function decodeNull(buffer) { + return null; +}; + +DERNode.prototype._decodeBool = function decodeBool(buffer) { + var res = buffer.readUInt8(); + if (buffer.isError(res)) + return res; + else + return res !== 0; +}; + +DERNode.prototype._decodeInt = function decodeInt(buffer, values) { + // Bigint, return as it is (assume big endian) + var raw = buffer.raw(); + var res = new bignum(raw); + + if (values) + res = values[res.toString(10)] || res; + + return res; +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getDecoder('der').tree; +}; + +// Utility methods + +function derDecodeTag(buf, fail) { + var tag = buf.readUInt8(fail); + if (buf.isError(tag)) + return tag; + + var cls = der.tagClass[tag >> 6]; + var primitive = (tag & 0x20) === 0; + + // Multi-octet tag - load + if ((tag & 0x1f) === 0x1f) { + var oct = tag; + tag = 0; + while ((oct & 0x80) === 0x80) { + oct = buf.readUInt8(fail); + if (buf.isError(oct)) + return oct; + + tag <<= 7; + tag |= oct & 0x7f; + } + } else { + tag &= 0x1f; + } + var tagStr = der.tag[tag]; + + return { + cls: cls, + primitive: primitive, + tag: tag, + tagStr: tagStr + }; +} + +function derDecodeLen(buf, primitive, fail) { + var len = buf.readUInt8(fail); + if (buf.isError(len)) + return len; + + // Indefinite form + if (!primitive && len === 0x80) + return null; + + // Definite form + if ((len & 0x80) === 0) { + // Short form + return len; + } + + // Long form + var num = len & 0x7f; + if (num > 4) + return buf.error('length octect is too long'); + + len = 0; + for (var i = 0; i < num; i++) { + len <<= 8; + var j = buf.readUInt8(fail); + if (buf.isError(j)) + return j; + len |= j; + } + + return len; +} + + +/***/ }), + +/***/ 8307: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +var decoders = exports; -/***/ "./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js ***! - \********************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +decoders.der = __webpack_require__(1671); +decoders.pem = __webpack_require__(9631); -"use strict"; -eval("Object.defineProperty(exports, \"__esModule\", ({value:!0})),exports.proto=exports.google=exports.com=exports.Writer=exports.Reader=void 0;var $protobuf=_interopRequireWildcard(__webpack_require__(/*! protobufjs/minimal.js */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/minimal.js\")),_long=_interopRequireDefault(__webpack_require__(/*! long */ \"./node_modules/long/src/long.js\")),$proto=_interopRequireWildcard(__webpack_require__(/*! ./proto.js */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/proto.js\"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if(\"function\"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||\"object\"!=typeof a&&\"function\"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if(\"default\"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}(()=>{var a=$protobuf.util;null==a.Long&&(console.log(`Patching Protobuf Long.js instance...`),a.Long=_long.default,null!=$protobuf.Reader._configure&&$protobuf.Reader._configure($protobuf.BufferReader))})();const Reader=$protobuf.Reader;exports.Reader=Reader;const Writer=$protobuf.Writer;exports.Writer=Writer;const proto=$proto.proto;exports.proto=proto;const com=$proto.com;exports.com=com;const google=$proto.google;exports.google=google;\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js?"); /***/ }), -/***/ "./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/proto.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/proto.js ***! - \********************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 9631: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("var $protobuf=_interopRequireWildcard(__webpack_require__(/*! protobufjs/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/minimal.js\"));Object.defineProperty(exports, \"__esModule\", ({value:!0})),exports.proto=exports.google=exports[\"default\"]=exports.com=void 0;function _getRequireWildcardCache(e){if(\"function\"!=typeof WeakMap)return null;var o=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:o})(e)}function _interopRequireWildcard(e,o){if(!o&&e&&e.__esModule)return e;if(null===e||\"object\"!=typeof e&&\"function\"!=typeof e)return{default:e};var t=_getRequireWildcardCache(o);if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(\"default\"!=i&&Object.prototype.hasOwnProperty.call(e,i)){var d=r?Object.getOwnPropertyDescriptor(e,i):null;d&&(d.get||d.set)?Object.defineProperty(n,i,d):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}const $Reader=$protobuf.Reader,$Writer=$protobuf.Writer,$util=$protobuf.util,$root=$protobuf.roots.hashgraph||($protobuf.roots.hashgraph={});exports[\"default\"]=$root;const com=$root.com=(()=>{const e={hedera:function(){const e={mirror:function(){const e={api:function(){const e={proto:function(){const e={ConsensusTopicQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 2:{i.consensusStartTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{i.consensusEndTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{i.limit=e.uint64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/com.hedera.mirror.api.proto.ConsensusTopicQuery\"},e}(),ConsensusTopicResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{i.message=e.bytes();break}case 3:{i.runningHash=e.bytes();break}case 4:{i.sequenceNumber=e.uint64();break}case 5:{i.runningHashVersion=e.uint64();break}case 6:{i.chunkInfo=$root.proto.ConsensusMessageChunkInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/com.hedera.mirror.api.proto.ConsensusTopicResponse\"},e}(),ConsensusService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.subscribeTopic=function t(e,o){return this.rpcCall(t,$root.com.hedera.mirror.api.proto.ConsensusTopicQuery,$root.com.hedera.mirror.api.proto.ConsensusTopicResponse,e,o)},\"name\",{value:\"subscribeTopic\"}),e}(),AddressBookQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileId=$root.proto.FileID.decode(e,e.uint32());break}case 2:{i.limit=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/com.hedera.mirror.api.proto.AddressBookQuery\"},e}(),NetworkService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.getNodes=function t(e,o){return this.rpcCall(t,$root.com.hedera.mirror.api.proto.AddressBookQuery,$root.proto.NodeAddress,e,o)},\"name\",{value:\"getNodes\"}),e}()};return e}()};return e}()};return e}()};return e}()};return e})();exports.com=com;const proto=$root.proto=(()=>{const e={TransactionList:function(){function e(e){if(this.transactionList=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transactionList&&i.transactionList.length||(i.transactionList=[]),i.transactionList.push($root.proto.Transaction.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionList\"},e}(),ShardID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ShardID\"},e}(),RealmID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}case 2:{i.realmNum=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.RealmID\"},e}(),AccountID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}case 2:{i.realmNum=e.int64();break}case 3:{i.accountNum=e.int64();break}case 4:{i.alias=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.AccountID\"},e}(),FileID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}case 2:{i.realmNum=e.int64();break}case 3:{i.fileNum=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileID\"},e}(),ContractID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}case 2:{i.realmNum=e.int64();break}case 3:{i.contractNum=e.int64();break}case 4:{i.evmAddress=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractID\"},e}(),TransactionID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transactionValidStart=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.scheduled=e.bool();break}case 4:{i.nonce=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionID\"},e}(),AccountAmount:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.amount=e.sint64();break}case 3:{i.isApproval=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.AccountAmount\"},e}(),TransferList:function(){function e(e){if(this.accountAmounts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountAmounts&&i.accountAmounts.length||(i.accountAmounts=[]),i.accountAmounts.push($root.proto.AccountAmount.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransferList\"},e}(),NftTransfer:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.senderAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.receiverAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.serialNumber=e.int64();break}case 4:{i.isApproval=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NftTransfer\"},e}(),TokenTransferList:function(){function e(e){if(this.transfers=[],this.nftTransfers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.transfers&&i.transfers.length||(i.transfers=[]),i.transfers.push($root.proto.AccountAmount.decode(e,e.uint32()));break}case 3:{i.nftTransfers&&i.nftTransfers.length||(i.nftTransfers=[]),i.nftTransfers.push($root.proto.NftTransfer.decode(e,e.uint32()));break}case 4:{i.expectedDecimals=$root.google.protobuf.UInt32Value.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenTransferList\"},e}(),Fraction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.numerator=e.int64();break}case 2:{i.denominator=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Fraction\"},e}(),TopicID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}case 2:{i.realmNum=e.int64();break}case 3:{i.topicNum=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TopicID\"},e}(),TokenID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}case 2:{i.realmNum=e.int64();break}case 3:{i.tokenNum=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenID\"},e}(),ScheduleID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.shardNum=e.int64();break}case 2:{i.realmNum=e.int64();break}case 3:{i.scheduleNum=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ScheduleID\"},e}(),TokenType:function(){const e={},o=Object.create(e);return o[e[0]=\"FUNGIBLE_COMMON\"]=0,o[e[1]=\"NON_FUNGIBLE_UNIQUE\"]=1,o}(),SubType:function(){const e={},o=Object.create(e);return o[e[0]=\"DEFAULT\"]=0,o[e[1]=\"TOKEN_FUNGIBLE_COMMON\"]=1,o[e[2]=\"TOKEN_NON_FUNGIBLE_UNIQUE\"]=2,o[e[3]=\"TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES\"]=3,o[e[4]=\"TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES\"]=4,o[e[5]=\"SCHEDULE_CREATE_CONTRACT_CALL\"]=5,o}(),TokenSupplyType:function(){const e={},o=Object.create(e);return o[e[0]=\"INFINITE\"]=0,o[e[1]=\"FINITE\"]=1,o}(),TokenFreezeStatus:function(){const e={},o=Object.create(e);return o[e[0]=\"FreezeNotApplicable\"]=0,o[e[1]=\"Frozen\"]=1,o[e[2]=\"Unfrozen\"]=2,o}(),TokenKycStatus:function(){const e={},o=Object.create(e);return o[e[0]=\"KycNotApplicable\"]=0,o[e[1]=\"Granted\"]=1,o[e[2]=\"Revoked\"]=2,o}(),TokenPauseStatus:function(){const e={},o=Object.create(e);return o[e[0]=\"PauseNotApplicable\"]=0,o[e[1]=\"Paused\"]=1,o[e[2]=\"Unpaused\"]=2,o}(),Key:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.ed25519=e.bytes();break}case 3:{i.RSA_3072=e.bytes();break}case 4:{i.ECDSA_384=e.bytes();break}case 5:{i.thresholdKey=$root.proto.ThresholdKey.decode(e,e.uint32());break}case 6:{i.keyList=$root.proto.KeyList.decode(e,e.uint32());break}case 7:{i.ECDSASecp256k1=e.bytes();break}case 8:{i.delegatableContractId=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Key\"},e}(),ThresholdKey:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.threshold=e.uint32();break}case 2:{i.keys=$root.proto.KeyList.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ThresholdKey\"},e}(),KeyList:function(){function e(e){if(this.keys=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.keys&&i.keys.length||(i.keys=[]),i.keys.push($root.proto.Key.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.KeyList\"},e}(),Signature:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contract=e.bytes();break}case 2:{i.ed25519=e.bytes();break}case 3:{i.RSA_3072=e.bytes();break}case 4:{i.ECDSA_384=e.bytes();break}case 5:{i.thresholdSignature=$root.proto.ThresholdSignature.decode(e,e.uint32());break}case 6:{i.signatureList=$root.proto.SignatureList.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Signature\"},e}(),ThresholdSignature:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{i.sigs=$root.proto.SignatureList.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ThresholdSignature\"},e}(),SignatureList:function(){function e(e){if(this.sigs=[],e)for(var o=Object.keys(e),t=0;t>>3){case 2:{i.sigs&&i.sigs.length||(i.sigs=[]),i.sigs.push($root.proto.Signature.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SignatureList\"},e}(),SignaturePair:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.pubKeyPrefix=e.bytes();break}case 2:{i.contract=e.bytes();break}case 3:{i.ed25519=e.bytes();break}case 4:{i.RSA_3072=e.bytes();break}case 5:{i.ECDSA_384=e.bytes();break}case 6:{i.ECDSASecp256k1=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SignaturePair\"},e}(),SignatureMap:function(){function e(e){if(this.sigPair=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.sigPair&&i.sigPair.length||(i.sigPair=[]),i.sigPair.push($root.proto.SignaturePair.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SignatureMap\"},e}(),HederaFunctionality:function(){const e={},o=Object.create(e);return o[e[0]=\"NONE\"]=0,o[e[1]=\"CryptoTransfer\"]=1,o[e[2]=\"CryptoUpdate\"]=2,o[e[3]=\"CryptoDelete\"]=3,o[e[4]=\"CryptoAddLiveHash\"]=4,o[e[5]=\"CryptoDeleteLiveHash\"]=5,o[e[6]=\"ContractCall\"]=6,o[e[7]=\"ContractCreate\"]=7,o[e[8]=\"ContractUpdate\"]=8,o[e[9]=\"FileCreate\"]=9,o[e[10]=\"FileAppend\"]=10,o[e[11]=\"FileUpdate\"]=11,o[e[12]=\"FileDelete\"]=12,o[e[13]=\"CryptoGetAccountBalance\"]=13,o[e[14]=\"CryptoGetAccountRecords\"]=14,o[e[15]=\"CryptoGetInfo\"]=15,o[e[16]=\"ContractCallLocal\"]=16,o[e[17]=\"ContractGetInfo\"]=17,o[e[18]=\"ContractGetBytecode\"]=18,o[e[19]=\"GetBySolidityID\"]=19,o[e[20]=\"GetByKey\"]=20,o[e[21]=\"CryptoGetLiveHash\"]=21,o[e[22]=\"CryptoGetStakers\"]=22,o[e[23]=\"FileGetContents\"]=23,o[e[24]=\"FileGetInfo\"]=24,o[e[25]=\"TransactionGetRecord\"]=25,o[e[26]=\"ContractGetRecords\"]=26,o[e[27]=\"CryptoCreate\"]=27,o[e[28]=\"SystemDelete\"]=28,o[e[29]=\"SystemUndelete\"]=29,o[e[30]=\"ContractDelete\"]=30,o[e[31]=\"Freeze\"]=31,o[e[32]=\"CreateTransactionRecord\"]=32,o[e[33]=\"CryptoAccountAutoRenew\"]=33,o[e[34]=\"ContractAutoRenew\"]=34,o[e[35]=\"GetVersionInfo\"]=35,o[e[36]=\"TransactionGetReceipt\"]=36,o[e[50]=\"ConsensusCreateTopic\"]=50,o[e[51]=\"ConsensusUpdateTopic\"]=51,o[e[52]=\"ConsensusDeleteTopic\"]=52,o[e[53]=\"ConsensusGetTopicInfo\"]=53,o[e[54]=\"ConsensusSubmitMessage\"]=54,o[e[55]=\"UncheckedSubmit\"]=55,o[e[56]=\"TokenCreate\"]=56,o[e[58]=\"TokenGetInfo\"]=58,o[e[59]=\"TokenFreezeAccount\"]=59,o[e[60]=\"TokenUnfreezeAccount\"]=60,o[e[61]=\"TokenGrantKycToAccount\"]=61,o[e[62]=\"TokenRevokeKycFromAccount\"]=62,o[e[63]=\"TokenDelete\"]=63,o[e[64]=\"TokenUpdate\"]=64,o[e[65]=\"TokenMint\"]=65,o[e[66]=\"TokenBurn\"]=66,o[e[67]=\"TokenAccountWipe\"]=67,o[e[68]=\"TokenAssociateToAccount\"]=68,o[e[69]=\"TokenDissociateFromAccount\"]=69,o[e[70]=\"ScheduleCreate\"]=70,o[e[71]=\"ScheduleDelete\"]=71,o[e[72]=\"ScheduleSign\"]=72,o[e[73]=\"ScheduleGetInfo\"]=73,o[e[74]=\"TokenGetAccountNftInfos\"]=74,o[e[75]=\"TokenGetNftInfo\"]=75,o[e[76]=\"TokenGetNftInfos\"]=76,o[e[77]=\"TokenFeeScheduleUpdate\"]=77,o[e[78]=\"NetworkGetExecutionTime\"]=78,o[e[79]=\"TokenPause\"]=79,o[e[80]=\"TokenUnpause\"]=80,o[e[81]=\"CryptoApproveAllowance\"]=81,o[e[82]=\"CryptoDeleteAllowance\"]=82,o[e[83]=\"GetAccountDetails\"]=83,o[e[84]=\"EthereumTransaction\"]=84,o[e[85]=\"NodeStakeUpdate\"]=85,o[e[86]=\"UtilPrng\"]=86,o}(),FeeComponents:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.min=e.int64();break}case 2:{i.max=e.int64();break}case 3:{i.constant=e.int64();break}case 4:{i.bpt=e.int64();break}case 5:{i.vpt=e.int64();break}case 6:{i.rbh=e.int64();break}case 7:{i.sbh=e.int64();break}case 8:{i.gas=e.int64();break}case 9:{i.tv=e.int64();break}case 10:{i.bpr=e.int64();break}case 11:{i.sbpr=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FeeComponents\"},e}(),TransactionFeeSchedule:function(){function e(e){if(this.fees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.hederaFunctionality=e.int32();break}case 2:{i.feeData=$root.proto.FeeData.decode(e,e.uint32());break}case 3:{i.fees&&i.fees.length||(i.fees=[]),i.fees.push($root.proto.FeeData.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionFeeSchedule\"},e}(),FeeData:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.nodedata=$root.proto.FeeComponents.decode(e,e.uint32());break}case 2:{i.networkdata=$root.proto.FeeComponents.decode(e,e.uint32());break}case 3:{i.servicedata=$root.proto.FeeComponents.decode(e,e.uint32());break}case 4:{i.subType=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FeeData\"},e}(),FeeSchedule:function(){function e(e){if(this.transactionFeeSchedule=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transactionFeeSchedule&&i.transactionFeeSchedule.length||(i.transactionFeeSchedule=[]),i.transactionFeeSchedule.push($root.proto.TransactionFeeSchedule.decode(e,e.uint32()));break}case 2:{i.expiryTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FeeSchedule\"},e}(),CurrentAndNextFeeSchedule:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.currentFeeSchedule=$root.proto.FeeSchedule.decode(e,e.uint32());break}case 2:{i.nextFeeSchedule=$root.proto.FeeSchedule.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CurrentAndNextFeeSchedule\"},e}(),ServiceEndpoint:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.ipAddressV4=e.bytes();break}case 2:{i.port=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ServiceEndpoint\"},e}(),NodeAddress:function(){function e(e){if(this.serviceEndpoint=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.ipAddress=e.bytes();break}case 2:{i.portno=e.int32();break}case 3:{i.memo=e.bytes();break}case 4:{i.RSA_PubKey=e.string();break}case 5:{i.nodeId=e.int64();break}case 6:{i.nodeAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{i.nodeCertHash=e.bytes();break}case 8:{i.serviceEndpoint&&i.serviceEndpoint.length||(i.serviceEndpoint=[]),i.serviceEndpoint.push($root.proto.ServiceEndpoint.decode(e,e.uint32()));break}case 9:{i.description=e.string();break}case 10:{i.stake=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NodeAddress\"},e}(),NodeAddressBook:function(){function e(e){if(this.nodeAddress=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.nodeAddress&&i.nodeAddress.length||(i.nodeAddress=[]),i.nodeAddress.push($root.proto.NodeAddress.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NodeAddressBook\"},e}(),SemanticVersion:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.major=e.int32();break}case 2:{i.minor=e.int32();break}case 3:{i.patch=e.int32();break}case 4:{i.pre=e.string();break}case 5:{i.build=e.string();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SemanticVersion\"},e}(),Setting:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.name=e.string();break}case 2:{i.value=e.string();break}case 3:{i.data=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Setting\"},e}(),ServicesConfigurationList:function(){function e(e){if(this.nameValue=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.nameValue&&i.nameValue.length||(i.nameValue=[]),i.nameValue.push($root.proto.Setting.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ServicesConfigurationList\"},e}(),TokenRelationship:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.symbol=e.string();break}case 3:{i.balance=e.uint64();break}case 4:{i.kycStatus=e.int32();break}case 5:{i.freezeStatus=e.int32();break}case 6:{i.decimals=e.uint32();break}case 7:{i.automaticAssociation=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenRelationship\"},e}(),TokenBalance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.balance=e.uint64();break}case 3:{i.decimals=e.uint32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenBalance\"},e}(),TokenBalances:function(){function e(e){if(this.tokenBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenBalances&&i.tokenBalances.length||(i.tokenBalances=[]),i.tokenBalances.push($root.proto.TokenBalance.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenBalances\"},e}(),TokenAssociation:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.accountId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenAssociation\"},e}(),StakingInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.declineReward=e.bool();break}case 2:{i.stakePeriodStart=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{i.pendingReward=e.int64();break}case 4:{i.stakedToMe=e.int64();break}case 5:{i.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{i.stakedNodeId=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.StakingInfo\"},e}(),Timestamp:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.seconds=e.int64();break}case 2:{i.nanos=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Timestamp\"},e}(),TimestampSeconds:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.seconds=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TimestampSeconds\"},e}(),ConsensusCreateTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.memo=e.string();break}case 2:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 3:{i.submitKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 7:{i.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusCreateTopicTransactionBody\"},e}(),Duration:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.seconds=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Duration\"},e}(),ConsensusDeleteTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.topicID=$root.proto.TopicID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusDeleteTopicTransactionBody\"},e}(),ConsensusGetTopicInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.topicID=$root.proto.TopicID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusGetTopicInfoQuery\"},e}(),ConsensusGetTopicInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 5:{i.topicInfo=$root.proto.ConsensusTopicInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusGetTopicInfoResponse\"},e}(),ResponseType:function(){const e={},o=Object.create(e);return o[e[0]=\"ANSWER_ONLY\"]=0,o[e[1]=\"ANSWER_STATE_PROOF\"]=1,o[e[2]=\"COST_ANSWER\"]=2,o[e[3]=\"COST_ANSWER_STATE_PROOF\"]=3,o}(),QueryHeader:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.payment=$root.proto.Transaction.decode(e,e.uint32());break}case 2:{i.responseType=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.QueryHeader\"},e}(),Transaction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.body=$root.proto.TransactionBody.decode(e,e.uint32());break}case 2:{i.sigs=$root.proto.SignatureList.decode(e,e.uint32());break}case 3:{i.sigMap=$root.proto.SignatureMap.decode(e,e.uint32());break}case 4:{i.bodyBytes=e.bytes();break}case 5:{i.signedTransactionBytes=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Transaction\"},e}(),TransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 2:{i.nodeAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.transactionFee=e.uint64();break}case 4:{i.transactionValidDuration=$root.proto.Duration.decode(e,e.uint32());break}case 5:{i.generateRecord=e.bool();break}case 6:{i.memo=e.string();break}case 7:{i.contractCall=$root.proto.ContractCallTransactionBody.decode(e,e.uint32());break}case 8:{i.contractCreateInstance=$root.proto.ContractCreateTransactionBody.decode(e,e.uint32());break}case 9:{i.contractUpdateInstance=$root.proto.ContractUpdateTransactionBody.decode(e,e.uint32());break}case 22:{i.contractDeleteInstance=$root.proto.ContractDeleteTransactionBody.decode(e,e.uint32());break}case 50:{i.ethereumTransaction=$root.proto.EthereumTransactionBody.decode(e,e.uint32());break}case 10:{i.cryptoAddLiveHash=$root.proto.CryptoAddLiveHashTransactionBody.decode(e,e.uint32());break}case 48:{i.cryptoApproveAllowance=$root.proto.CryptoApproveAllowanceTransactionBody.decode(e,e.uint32());break}case 49:{i.cryptoDeleteAllowance=$root.proto.CryptoDeleteAllowanceTransactionBody.decode(e,e.uint32());break}case 11:{i.cryptoCreateAccount=$root.proto.CryptoCreateTransactionBody.decode(e,e.uint32());break}case 12:{i.cryptoDelete=$root.proto.CryptoDeleteTransactionBody.decode(e,e.uint32());break}case 13:{i.cryptoDeleteLiveHash=$root.proto.CryptoDeleteLiveHashTransactionBody.decode(e,e.uint32());break}case 14:{i.cryptoTransfer=$root.proto.CryptoTransferTransactionBody.decode(e,e.uint32());break}case 15:{i.cryptoUpdateAccount=$root.proto.CryptoUpdateTransactionBody.decode(e,e.uint32());break}case 16:{i.fileAppend=$root.proto.FileAppendTransactionBody.decode(e,e.uint32());break}case 17:{i.fileCreate=$root.proto.FileCreateTransactionBody.decode(e,e.uint32());break}case 18:{i.fileDelete=$root.proto.FileDeleteTransactionBody.decode(e,e.uint32());break}case 19:{i.fileUpdate=$root.proto.FileUpdateTransactionBody.decode(e,e.uint32());break}case 20:{i.systemDelete=$root.proto.SystemDeleteTransactionBody.decode(e,e.uint32());break}case 21:{i.systemUndelete=$root.proto.SystemUndeleteTransactionBody.decode(e,e.uint32());break}case 23:{i.freeze=$root.proto.FreezeTransactionBody.decode(e,e.uint32());break}case 24:{i.consensusCreateTopic=$root.proto.ConsensusCreateTopicTransactionBody.decode(e,e.uint32());break}case 25:{i.consensusUpdateTopic=$root.proto.ConsensusUpdateTopicTransactionBody.decode(e,e.uint32());break}case 26:{i.consensusDeleteTopic=$root.proto.ConsensusDeleteTopicTransactionBody.decode(e,e.uint32());break}case 27:{i.consensusSubmitMessage=$root.proto.ConsensusSubmitMessageTransactionBody.decode(e,e.uint32());break}case 28:{i.uncheckedSubmit=$root.proto.UncheckedSubmitBody.decode(e,e.uint32());break}case 29:{i.tokenCreation=$root.proto.TokenCreateTransactionBody.decode(e,e.uint32());break}case 31:{i.tokenFreeze=$root.proto.TokenFreezeAccountTransactionBody.decode(e,e.uint32());break}case 32:{i.tokenUnfreeze=$root.proto.TokenUnfreezeAccountTransactionBody.decode(e,e.uint32());break}case 33:{i.tokenGrantKyc=$root.proto.TokenGrantKycTransactionBody.decode(e,e.uint32());break}case 34:{i.tokenRevokeKyc=$root.proto.TokenRevokeKycTransactionBody.decode(e,e.uint32());break}case 35:{i.tokenDeletion=$root.proto.TokenDeleteTransactionBody.decode(e,e.uint32());break}case 36:{i.tokenUpdate=$root.proto.TokenUpdateTransactionBody.decode(e,e.uint32());break}case 37:{i.tokenMint=$root.proto.TokenMintTransactionBody.decode(e,e.uint32());break}case 38:{i.tokenBurn=$root.proto.TokenBurnTransactionBody.decode(e,e.uint32());break}case 39:{i.tokenWipe=$root.proto.TokenWipeAccountTransactionBody.decode(e,e.uint32());break}case 40:{i.tokenAssociate=$root.proto.TokenAssociateTransactionBody.decode(e,e.uint32());break}case 41:{i.tokenDissociate=$root.proto.TokenDissociateTransactionBody.decode(e,e.uint32());break}case 45:{i.tokenFeeScheduleUpdate=$root.proto.TokenFeeScheduleUpdateTransactionBody.decode(e,e.uint32());break}case 46:{i.tokenPause=$root.proto.TokenPauseTransactionBody.decode(e,e.uint32());break}case 47:{i.tokenUnpause=$root.proto.TokenUnpauseTransactionBody.decode(e,e.uint32());break}case 42:{i.scheduleCreate=$root.proto.ScheduleCreateTransactionBody.decode(e,e.uint32());break}case 43:{i.scheduleDelete=$root.proto.ScheduleDeleteTransactionBody.decode(e,e.uint32());break}case 44:{i.scheduleSign=$root.proto.ScheduleSignTransactionBody.decode(e,e.uint32());break}case 51:{i.nodeStakeUpdate=$root.proto.NodeStakeUpdateTransactionBody.decode(e,e.uint32());break}case 52:{i.utilPrng=$root.proto.UtilPrngTransactionBody.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionBody\"},e}(),SystemDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 3:{i.expirationTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SystemDeleteTransactionBody\"},e}(),SystemUndeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SystemUndeleteTransactionBody\"},e}(),FreezeTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.startHour=e.int32();break}case 2:{i.startMin=e.int32();break}case 3:{i.endHour=e.int32();break}case 4:{i.endMin=e.int32();break}case 5:{i.updateFile=$root.proto.FileID.decode(e,e.uint32());break}case 6:{i.fileHash=e.bytes();break}case 7:{i.startTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 8:{i.freezeType=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FreezeTransactionBody\"},e}(),FreezeType:function(){const e={},o=Object.create(e);return o[e[0]=\"UNKNOWN_FREEZE_TYPE\"]=0,o[e[1]=\"FREEZE_ONLY\"]=1,o[e[2]=\"PREPARE_UPGRADE\"]=2,o[e[3]=\"FREEZE_UPGRADE\"]=3,o[e[4]=\"FREEZE_ABORT\"]=4,o[e[5]=\"TELEMETRY_UPGRADE\"]=5,o}(),ContractCallTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.gas=e.int64();break}case 3:{i.amount=e.int64();break}case 4:{i.functionParameters=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractCallTransactionBody\"},e}(),ContractCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 16:{i.initcode=e.bytes();break}case 3:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 4:{i.gas=e.int64();break}case 5:{i.initialBalance=e.int64();break}case 6:{i.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 8:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 9:{i.constructorParameters=e.bytes();break}case 10:{i.shardID=$root.proto.ShardID.decode(e,e.uint32());break}case 11:{i.realmID=$root.proto.RealmID.decode(e,e.uint32());break}case 12:{i.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break}case 13:{i.memo=e.string();break}case 14:{i.maxAutomaticTokenAssociations=e.int32();break}case 15:{i.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 17:{i.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 18:{i.stakedNodeId=e.int64();break}case 19:{i.declineReward=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractCreateTransactionBody\"},e}(),ContractUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{i.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 8:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 9:{i.memo=e.string();break}case 10:{i.memoWrapper=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 11:{i.maxAutomaticTokenAssociations=$root.google.protobuf.Int32Value.decode(e,e.uint32());break}case 12:{i.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 13:{i.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 14:{i.stakedNodeId=e.int64();break}case 15:{i.declineReward=$root.google.protobuf.BoolValue.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractUpdateTransactionBody\"},e}(),LiveHash:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountId=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.hash=e.bytes();break}case 3:{i.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 5:{i.duration=$root.proto.Duration.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.LiveHash\"},e}(),CryptoAddLiveHashTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 3:{i.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoAddLiveHashTransactionBody\"},e}(),CryptoCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.key=$root.proto.Key.decode(e,e.uint32());break}case 2:{i.initialBalance=e.uint64();break}case 3:{i.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{i.sendRecordThreshold=e.uint64();break}case 7:{i.receiveRecordThreshold=e.uint64();break}case 8:{i.receiverSigRequired=e.bool();break}case 9:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 10:{i.shardID=$root.proto.ShardID.decode(e,e.uint32());break}case 11:{i.realmID=$root.proto.RealmID.decode(e,e.uint32());break}case 12:{i.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break}case 13:{i.memo=e.string();break}case 14:{i.maxAutomaticTokenAssociations=e.int32();break}case 15:{i.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 16:{i.stakedNodeId=e.int64();break}case 17:{i.declineReward=e.bool();break}case 18:{i.alias=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoCreateTransactionBody\"},e}(),CryptoDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transferAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.deleteAccountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoDeleteTransactionBody\"},e}(),CryptoDeleteLiveHashTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountOfLiveHash=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.liveHashToDelete=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoDeleteLiveHashTransactionBody\"},e}(),CryptoTransferTransactionBody:function(){function e(e){if(this.tokenTransfers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transfers=$root.proto.TransferList.decode(e,e.uint32());break}case 2:{i.tokenTransfers&&i.tokenTransfers.length||(i.tokenTransfers=[]),i.tokenTransfers.push($root.proto.TokenTransferList.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoTransferTransactionBody\"},e}(),CryptoUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{i.accountIDToUpdate=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.key=$root.proto.Key.decode(e,e.uint32());break}case 4:{i.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{i.proxyFraction=e.int32();break}case 6:{i.sendRecordThreshold=e.uint64();break}case 11:{i.sendRecordThresholdWrapper=$root.google.protobuf.UInt64Value.decode(e,e.uint32());break}case 7:{i.receiveRecordThreshold=e.uint64();break}case 12:{i.receiveRecordThresholdWrapper=$root.google.protobuf.UInt64Value.decode(e,e.uint32());break}case 8:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 9:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 10:{i.receiverSigRequired=e.bool();break}case 13:{i.receiverSigRequiredWrapper=$root.google.protobuf.BoolValue.decode(e,e.uint32());break}case 14:{i.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 15:{i.maxAutomaticTokenAssociations=$root.google.protobuf.Int32Value.decode(e,e.uint32());break}case 16:{i.stakedAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 17:{i.stakedNodeId=e.int64();break}case 18:{i.declineReward=$root.google.protobuf.BoolValue.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoUpdateTransactionBody\"},e}(),CryptoApproveAllowanceTransactionBody:function(){function e(e){if(this.cryptoAllowances=[],this.nftAllowances=[],this.tokenAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.cryptoAllowances&&i.cryptoAllowances.length||(i.cryptoAllowances=[]),i.cryptoAllowances.push($root.proto.CryptoAllowance.decode(e,e.uint32()));break}case 2:{i.nftAllowances&&i.nftAllowances.length||(i.nftAllowances=[]),i.nftAllowances.push($root.proto.NftAllowance.decode(e,e.uint32()));break}case 3:{i.tokenAllowances&&i.tokenAllowances.length||(i.tokenAllowances=[]),i.tokenAllowances.push($root.proto.TokenAllowance.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoApproveAllowanceTransactionBody\"},e}(),CryptoAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.amount=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoAllowance\"},e}(),NftAllowance:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 4:{if(i.serialNumbers&&i.serialNumbers.length||(i.serialNumbers=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 4:{i.amount=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenAllowance\"},e}(),CryptoDeleteAllowanceTransactionBody:function(){function e(e){if(this.nftAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 2:{i.nftAllowances&&i.nftAllowances.length||(i.nftAllowances=[]),i.nftAllowances.push($root.proto.NftRemoveAllowance.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoDeleteAllowanceTransactionBody\"},e}(),NftRemoveAllowance:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.owner=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{if(i.serialNumbers&&i.serialNumbers.length||(i.serialNumbers=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.ethereumData=e.bytes();break}case 2:{i.callData=$root.proto.FileID.decode(e,e.uint32());break}case 3:{i.maxGasAllowance=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.EthereumTransactionBody\"},e}(),FileAppendTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{i.contents=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileAppendTransactionBody\"},e}(),FileCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{i.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 4:{i.contents=e.bytes();break}case 5:{i.shardID=$root.proto.ShardID.decode(e,e.uint32());break}case 6:{i.realmID=$root.proto.RealmID.decode(e,e.uint32());break}case 7:{i.newRealmAdminKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{i.memo=e.string();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileCreateTransactionBody\"},e}(),FileDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 2:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileDeleteTransactionBody\"},e}(),FileUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{i.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 4:{i.contents=e.bytes();break}case 5:{i.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileUpdateTransactionBody\"},e}(),ContractDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.transferAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.transferContractID=$root.proto.ContractID.decode(e,e.uint32());break}case 4:{i.permanentRemoval=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractDeleteTransactionBody\"},e}(),ConsensusUpdateTopicTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 2:{i.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 4:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 6:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{i.submitKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 9:{i.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusUpdateTopicTransactionBody\"},e}(),ConsensusMessageChunkInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.initialTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 2:{i.total=e.int32();break}case 3:{i.number=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusMessageChunkInfo\"},e}(),ConsensusSubmitMessageTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 2:{i.message=e.bytes();break}case 3:{i.chunkInfo=$root.proto.ConsensusMessageChunkInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusSubmitMessageTransactionBody\"},e}(),UncheckedSubmitBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transactionBytes=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.UncheckedSubmitBody\"},e}(),TokenCreateTransactionBody:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.name=e.string();break}case 2:{i.symbol=e.string();break}case 3:{i.decimals=e.uint32();break}case 4:{i.initialSupply=e.uint64();break}case 5:{i.treasury=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{i.kycKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{i.freezeKey=$root.proto.Key.decode(e,e.uint32());break}case 9:{i.wipeKey=$root.proto.Key.decode(e,e.uint32());break}case 10:{i.supplyKey=$root.proto.Key.decode(e,e.uint32());break}case 11:{i.freezeDefault=e.bool();break}case 13:{i.expiry=$root.proto.Timestamp.decode(e,e.uint32());break}case 14:{i.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 15:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 16:{i.memo=e.string();break}case 17:{i.tokenType=e.int32();break}case 18:{i.supplyType=e.int32();break}case 19:{i.maxSupply=e.int64();break}case 20:{i.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break}case 21:{i.customFees&&i.customFees.length||(i.customFees=[]),i.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break}case 22:{i.pauseKey=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenCreateTransactionBody\"},e}(),FractionalFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fractionalAmount=$root.proto.Fraction.decode(e,e.uint32());break}case 2:{i.minimumAmount=e.int64();break}case 3:{i.maximumAmount=e.int64();break}case 4:{i.netOfTransfers=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FractionalFee\"},e}(),FixedFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.amount=e.int64();break}case 2:{i.denominatingTokenId=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FixedFee\"},e}(),RoyaltyFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.exchangeValueFraction=$root.proto.Fraction.decode(e,e.uint32());break}case 2:{i.fallbackFee=$root.proto.FixedFee.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.RoyaltyFee\"},e}(),CustomFee:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fixedFee=$root.proto.FixedFee.decode(e,e.uint32());break}case 2:{i.fractionalFee=$root.proto.FractionalFee.decode(e,e.uint32());break}case 4:{i.royaltyFee=$root.proto.RoyaltyFee.decode(e,e.uint32());break}case 3:{i.feeCollectorAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{i.allCollectorsAreExempt=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CustomFee\"},e}(),AssessedCustomFee:function(){function e(e){if(this.effectivePayerAccountId=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.amount=e.int64();break}case 2:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 3:{i.feeCollectorAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 4:{i.effectivePayerAccountId&&i.effectivePayerAccountId.length||(i.effectivePayerAccountId=[]),i.effectivePayerAccountId.push($root.proto.AccountID.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.AssessedCustomFee\"},e}(),TokenFreezeAccountTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenFreezeAccountTransactionBody\"},e}(),TokenUnfreezeAccountTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenUnfreezeAccountTransactionBody\"},e}(),TokenGrantKycTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGrantKycTransactionBody\"},e}(),TokenRevokeKycTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.account=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenRevokeKycTransactionBody\"},e}(),TokenDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenDeleteTransactionBody\"},e}(),TokenUpdateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.symbol=e.string();break}case 3:{i.name=e.string();break}case 4:{i.treasury=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{i.kycKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{i.freezeKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{i.wipeKey=$root.proto.Key.decode(e,e.uint32());break}case 9:{i.supplyKey=$root.proto.Key.decode(e,e.uint32());break}case 10:{i.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 11:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 12:{i.expiry=$root.proto.Timestamp.decode(e,e.uint32());break}case 13:{i.memo=$root.google.protobuf.StringValue.decode(e,e.uint32());break}case 14:{i.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break}case 15:{i.pauseKey=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenUpdateTransactionBody\"},e}(),TokenMintTransactionBody:function(){function e(e){if(this.metadata=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.amount=e.uint64();break}case 3:{i.metadata&&i.metadata.length||(i.metadata=[]),i.metadata.push(e.bytes());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenMintTransactionBody\"},e}(),TokenBurnTransactionBody:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.amount=e.uint64();break}case 3:{if(i.serialNumbers&&i.serialNumbers.length||(i.serialNumbers=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.account=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.amount=e.uint64();break}case 4:{if(i.serialNumbers&&i.serialNumbers.length||(i.serialNumbers=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.account=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.tokens&&i.tokens.length||(i.tokens=[]),i.tokens.push($root.proto.TokenID.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenAssociateTransactionBody\"},e}(),TokenDissociateTransactionBody:function(){function e(e){if(this.tokens=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.account=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.tokens&&i.tokens.length||(i.tokens=[]),i.tokens.push($root.proto.TokenID.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenDissociateTransactionBody\"},e}(),TokenFeeScheduleUpdateTransactionBody:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.customFees&&i.customFees.length||(i.customFees=[]),i.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenFeeScheduleUpdateTransactionBody\"},e}(),TokenPauseTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenPauseTransactionBody\"},e}(),TokenUnpauseTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenUnpauseTransactionBody\"},e}(),ScheduleCreateTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.scheduledTransactionBody=$root.proto.SchedulableTransactionBody.decode(e,e.uint32());break}case 2:{i.memo=e.string();break}case 3:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 4:{i.payerAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 13:{i.waitForExpiry=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ScheduleCreateTransactionBody\"},e}(),SchedulableTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transactionFee=e.uint64();break}case 2:{i.memo=e.string();break}case 3:{i.contractCall=$root.proto.ContractCallTransactionBody.decode(e,e.uint32());break}case 4:{i.contractCreateInstance=$root.proto.ContractCreateTransactionBody.decode(e,e.uint32());break}case 5:{i.contractUpdateInstance=$root.proto.ContractUpdateTransactionBody.decode(e,e.uint32());break}case 6:{i.contractDeleteInstance=$root.proto.ContractDeleteTransactionBody.decode(e,e.uint32());break}case 37:{i.cryptoApproveAllowance=$root.proto.CryptoApproveAllowanceTransactionBody.decode(e,e.uint32());break}case 38:{i.cryptoDeleteAllowance=$root.proto.CryptoDeleteAllowanceTransactionBody.decode(e,e.uint32());break}case 7:{i.cryptoCreateAccount=$root.proto.CryptoCreateTransactionBody.decode(e,e.uint32());break}case 8:{i.cryptoDelete=$root.proto.CryptoDeleteTransactionBody.decode(e,e.uint32());break}case 9:{i.cryptoTransfer=$root.proto.CryptoTransferTransactionBody.decode(e,e.uint32());break}case 10:{i.cryptoUpdateAccount=$root.proto.CryptoUpdateTransactionBody.decode(e,e.uint32());break}case 11:{i.fileAppend=$root.proto.FileAppendTransactionBody.decode(e,e.uint32());break}case 12:{i.fileCreate=$root.proto.FileCreateTransactionBody.decode(e,e.uint32());break}case 13:{i.fileDelete=$root.proto.FileDeleteTransactionBody.decode(e,e.uint32());break}case 14:{i.fileUpdate=$root.proto.FileUpdateTransactionBody.decode(e,e.uint32());break}case 15:{i.systemDelete=$root.proto.SystemDeleteTransactionBody.decode(e,e.uint32());break}case 16:{i.systemUndelete=$root.proto.SystemUndeleteTransactionBody.decode(e,e.uint32());break}case 17:{i.freeze=$root.proto.FreezeTransactionBody.decode(e,e.uint32());break}case 18:{i.consensusCreateTopic=$root.proto.ConsensusCreateTopicTransactionBody.decode(e,e.uint32());break}case 19:{i.consensusUpdateTopic=$root.proto.ConsensusUpdateTopicTransactionBody.decode(e,e.uint32());break}case 20:{i.consensusDeleteTopic=$root.proto.ConsensusDeleteTopicTransactionBody.decode(e,e.uint32());break}case 21:{i.consensusSubmitMessage=$root.proto.ConsensusSubmitMessageTransactionBody.decode(e,e.uint32());break}case 22:{i.tokenCreation=$root.proto.TokenCreateTransactionBody.decode(e,e.uint32());break}case 23:{i.tokenFreeze=$root.proto.TokenFreezeAccountTransactionBody.decode(e,e.uint32());break}case 24:{i.tokenUnfreeze=$root.proto.TokenUnfreezeAccountTransactionBody.decode(e,e.uint32());break}case 25:{i.tokenGrantKyc=$root.proto.TokenGrantKycTransactionBody.decode(e,e.uint32());break}case 26:{i.tokenRevokeKyc=$root.proto.TokenRevokeKycTransactionBody.decode(e,e.uint32());break}case 27:{i.tokenDeletion=$root.proto.TokenDeleteTransactionBody.decode(e,e.uint32());break}case 28:{i.tokenUpdate=$root.proto.TokenUpdateTransactionBody.decode(e,e.uint32());break}case 29:{i.tokenMint=$root.proto.TokenMintTransactionBody.decode(e,e.uint32());break}case 30:{i.tokenBurn=$root.proto.TokenBurnTransactionBody.decode(e,e.uint32());break}case 31:{i.tokenWipe=$root.proto.TokenWipeAccountTransactionBody.decode(e,e.uint32());break}case 32:{i.tokenAssociate=$root.proto.TokenAssociateTransactionBody.decode(e,e.uint32());break}case 33:{i.tokenDissociate=$root.proto.TokenDissociateTransactionBody.decode(e,e.uint32());break}case 39:{i.tokenFeeScheduleUpdate=$root.proto.TokenFeeScheduleUpdateTransactionBody.decode(e,e.uint32());break}case 35:{i.tokenPause=$root.proto.TokenPauseTransactionBody.decode(e,e.uint32());break}case 36:{i.tokenUnpause=$root.proto.TokenUnpauseTransactionBody.decode(e,e.uint32());break}case 34:{i.scheduleDelete=$root.proto.ScheduleDeleteTransactionBody.decode(e,e.uint32());break}case 40:{i.utilPrng=$root.proto.UtilPrngTransactionBody.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SchedulableTransactionBody\"},e}(),ScheduleDeleteTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ScheduleDeleteTransactionBody\"},e}(),UtilPrngTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.range=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.UtilPrngTransactionBody\"},e}(),ScheduleSignTransactionBody:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ScheduleSignTransactionBody\"},e}(),NodeStakeUpdateTransactionBody:function(){function e(e){if(this.nodeStake=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.endOfStakingPeriod=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{i.nodeStake&&i.nodeStake.length||(i.nodeStake=[]),i.nodeStake.push($root.proto.NodeStake.decode(e,e.uint32()));break}case 3:{i.maxStakingRewardRatePerHbar=e.int64();break}case 4:{i.nodeRewardFeeFraction=$root.proto.Fraction.decode(e,e.uint32());break}case 5:{i.stakingPeriodsStored=e.int64();break}case 6:{i.stakingPeriod=e.int64();break}case 7:{i.stakingRewardFeeFraction=$root.proto.Fraction.decode(e,e.uint32());break}case 8:{i.stakingStartThreshold=e.int64();break}case 9:{i.stakingRewardRate=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NodeStakeUpdateTransactionBody\"},e}(),NodeStake:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.maxStake=e.int64();break}case 2:{i.minStake=e.int64();break}case 3:{i.nodeId=e.int64();break}case 4:{i.rewardRate=e.int64();break}case 5:{i.stake=e.int64();break}case 6:{i.stakeNotRewarded=e.int64();break}case 7:{i.stakeRewarded=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NodeStake\"},e}(),ResponseHeader:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.nodeTransactionPrecheckCode=e.int32();break}case 2:{i.responseType=e.int32();break}case 3:{i.cost=e.uint64();break}case 4:{i.stateProof=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ResponseHeader\"},e}(),TransactionResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.nodeTransactionPrecheckCode=e.int32();break}case 2:{i.cost=e.uint64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionResponse\"},e}(),ResponseCodeEnum:function(){const e={},o=Object.create(e);return o[e[0]=\"OK\"]=0,o[e[1]=\"INVALID_TRANSACTION\"]=1,o[e[2]=\"PAYER_ACCOUNT_NOT_FOUND\"]=2,o[e[3]=\"INVALID_NODE_ACCOUNT\"]=3,o[e[4]=\"TRANSACTION_EXPIRED\"]=4,o[e[5]=\"INVALID_TRANSACTION_START\"]=5,o[e[6]=\"INVALID_TRANSACTION_DURATION\"]=6,o[e[7]=\"INVALID_SIGNATURE\"]=7,o[e[8]=\"MEMO_TOO_LONG\"]=8,o[e[9]=\"INSUFFICIENT_TX_FEE\"]=9,o[e[10]=\"INSUFFICIENT_PAYER_BALANCE\"]=10,o[e[11]=\"DUPLICATE_TRANSACTION\"]=11,o[e[12]=\"BUSY\"]=12,o[e[13]=\"NOT_SUPPORTED\"]=13,o[e[14]=\"INVALID_FILE_ID\"]=14,o[e[15]=\"INVALID_ACCOUNT_ID\"]=15,o[e[16]=\"INVALID_CONTRACT_ID\"]=16,o[e[17]=\"INVALID_TRANSACTION_ID\"]=17,o[e[18]=\"RECEIPT_NOT_FOUND\"]=18,o[e[19]=\"RECORD_NOT_FOUND\"]=19,o[e[20]=\"INVALID_SOLIDITY_ID\"]=20,o[e[21]=\"UNKNOWN\"]=21,o[e[22]=\"SUCCESS\"]=22,o[e[23]=\"FAIL_INVALID\"]=23,o[e[24]=\"FAIL_FEE\"]=24,o[e[25]=\"FAIL_BALANCE\"]=25,o[e[26]=\"KEY_REQUIRED\"]=26,o[e[27]=\"BAD_ENCODING\"]=27,o[e[28]=\"INSUFFICIENT_ACCOUNT_BALANCE\"]=28,o[e[29]=\"INVALID_SOLIDITY_ADDRESS\"]=29,o[e[30]=\"INSUFFICIENT_GAS\"]=30,o[e[31]=\"CONTRACT_SIZE_LIMIT_EXCEEDED\"]=31,o[e[32]=\"LOCAL_CALL_MODIFICATION_EXCEPTION\"]=32,o[e[33]=\"CONTRACT_REVERT_EXECUTED\"]=33,o[e[34]=\"CONTRACT_EXECUTION_EXCEPTION\"]=34,o[e[35]=\"INVALID_RECEIVING_NODE_ACCOUNT\"]=35,o[e[36]=\"MISSING_QUERY_HEADER\"]=36,o[e[37]=\"ACCOUNT_UPDATE_FAILED\"]=37,o[e[38]=\"INVALID_KEY_ENCODING\"]=38,o[e[39]=\"NULL_SOLIDITY_ADDRESS\"]=39,o[e[40]=\"CONTRACT_UPDATE_FAILED\"]=40,o[e[41]=\"INVALID_QUERY_HEADER\"]=41,o[e[42]=\"INVALID_FEE_SUBMITTED\"]=42,o[e[43]=\"INVALID_PAYER_SIGNATURE\"]=43,o[e[44]=\"KEY_NOT_PROVIDED\"]=44,o[e[45]=\"INVALID_EXPIRATION_TIME\"]=45,o[e[46]=\"NO_WACL_KEY\"]=46,o[e[47]=\"FILE_CONTENT_EMPTY\"]=47,o[e[48]=\"INVALID_ACCOUNT_AMOUNTS\"]=48,o[e[49]=\"EMPTY_TRANSACTION_BODY\"]=49,o[e[50]=\"INVALID_TRANSACTION_BODY\"]=50,o[e[51]=\"INVALID_SIGNATURE_TYPE_MISMATCHING_KEY\"]=51,o[e[52]=\"INVALID_SIGNATURE_COUNT_MISMATCHING_KEY\"]=52,o[e[53]=\"EMPTY_LIVE_HASH_BODY\"]=53,o[e[54]=\"EMPTY_LIVE_HASH\"]=54,o[e[55]=\"EMPTY_LIVE_HASH_KEYS\"]=55,o[e[56]=\"INVALID_LIVE_HASH_SIZE\"]=56,o[e[57]=\"EMPTY_QUERY_BODY\"]=57,o[e[58]=\"EMPTY_LIVE_HASH_QUERY\"]=58,o[e[59]=\"LIVE_HASH_NOT_FOUND\"]=59,o[e[60]=\"ACCOUNT_ID_DOES_NOT_EXIST\"]=60,o[e[61]=\"LIVE_HASH_ALREADY_EXISTS\"]=61,o[e[62]=\"INVALID_FILE_WACL\"]=62,o[e[63]=\"SERIALIZATION_FAILED\"]=63,o[e[64]=\"TRANSACTION_OVERSIZE\"]=64,o[e[65]=\"TRANSACTION_TOO_MANY_LAYERS\"]=65,o[e[66]=\"CONTRACT_DELETED\"]=66,o[e[67]=\"PLATFORM_NOT_ACTIVE\"]=67,o[e[68]=\"KEY_PREFIX_MISMATCH\"]=68,o[e[69]=\"PLATFORM_TRANSACTION_NOT_CREATED\"]=69,o[e[70]=\"INVALID_RENEWAL_PERIOD\"]=70,o[e[71]=\"INVALID_PAYER_ACCOUNT_ID\"]=71,o[e[72]=\"ACCOUNT_DELETED\"]=72,o[e[73]=\"FILE_DELETED\"]=73,o[e[74]=\"ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS\"]=74,o[e[75]=\"SETTING_NEGATIVE_ACCOUNT_BALANCE\"]=75,o[e[76]=\"OBTAINER_REQUIRED\"]=76,o[e[77]=\"OBTAINER_SAME_CONTRACT_ID\"]=77,o[e[78]=\"OBTAINER_DOES_NOT_EXIST\"]=78,o[e[79]=\"MODIFYING_IMMUTABLE_CONTRACT\"]=79,o[e[80]=\"FILE_SYSTEM_EXCEPTION\"]=80,o[e[81]=\"AUTORENEW_DURATION_NOT_IN_RANGE\"]=81,o[e[82]=\"ERROR_DECODING_BYTESTRING\"]=82,o[e[83]=\"CONTRACT_FILE_EMPTY\"]=83,o[e[84]=\"CONTRACT_BYTECODE_EMPTY\"]=84,o[e[85]=\"INVALID_INITIAL_BALANCE\"]=85,o[e[86]=\"INVALID_RECEIVE_RECORD_THRESHOLD\"]=86,o[e[87]=\"INVALID_SEND_RECORD_THRESHOLD\"]=87,o[e[88]=\"ACCOUNT_IS_NOT_GENESIS_ACCOUNT\"]=88,o[e[89]=\"PAYER_ACCOUNT_UNAUTHORIZED\"]=89,o[e[90]=\"INVALID_FREEZE_TRANSACTION_BODY\"]=90,o[e[91]=\"FREEZE_TRANSACTION_BODY_NOT_FOUND\"]=91,o[e[92]=\"TRANSFER_LIST_SIZE_LIMIT_EXCEEDED\"]=92,o[e[93]=\"RESULT_SIZE_LIMIT_EXCEEDED\"]=93,o[e[94]=\"NOT_SPECIAL_ACCOUNT\"]=94,o[e[95]=\"CONTRACT_NEGATIVE_GAS\"]=95,o[e[96]=\"CONTRACT_NEGATIVE_VALUE\"]=96,o[e[97]=\"INVALID_FEE_FILE\"]=97,o[e[98]=\"INVALID_EXCHANGE_RATE_FILE\"]=98,o[e[99]=\"INSUFFICIENT_LOCAL_CALL_GAS\"]=99,o[e[100]=\"ENTITY_NOT_ALLOWED_TO_DELETE\"]=100,o[e[101]=\"AUTHORIZATION_FAILED\"]=101,o[e[102]=\"FILE_UPLOADED_PROTO_INVALID\"]=102,o[e[103]=\"FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK\"]=103,o[e[104]=\"FEE_SCHEDULE_FILE_PART_UPLOADED\"]=104,o[e[105]=\"EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED\"]=105,o[e[106]=\"MAX_CONTRACT_STORAGE_EXCEEDED\"]=106,o[e[107]=\"TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT\"]=107,o[e[108]=\"TOTAL_LEDGER_BALANCE_INVALID\"]=108,o[e[110]=\"EXPIRATION_REDUCTION_NOT_ALLOWED\"]=110,o[e[111]=\"MAX_GAS_LIMIT_EXCEEDED\"]=111,o[e[112]=\"MAX_FILE_SIZE_EXCEEDED\"]=112,o[e[113]=\"RECEIVER_SIG_REQUIRED\"]=113,o[e[150]=\"INVALID_TOPIC_ID\"]=150,o[e[155]=\"INVALID_ADMIN_KEY\"]=155,o[e[156]=\"INVALID_SUBMIT_KEY\"]=156,o[e[157]=\"UNAUTHORIZED\"]=157,o[e[158]=\"INVALID_TOPIC_MESSAGE\"]=158,o[e[159]=\"INVALID_AUTORENEW_ACCOUNT\"]=159,o[e[160]=\"AUTORENEW_ACCOUNT_NOT_ALLOWED\"]=160,o[e[162]=\"TOPIC_EXPIRED\"]=162,o[e[163]=\"INVALID_CHUNK_NUMBER\"]=163,o[e[164]=\"INVALID_CHUNK_TRANSACTION_ID\"]=164,o[e[165]=\"ACCOUNT_FROZEN_FOR_TOKEN\"]=165,o[e[166]=\"TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED\"]=166,o[e[167]=\"INVALID_TOKEN_ID\"]=167,o[e[168]=\"INVALID_TOKEN_DECIMALS\"]=168,o[e[169]=\"INVALID_TOKEN_INITIAL_SUPPLY\"]=169,o[e[170]=\"INVALID_TREASURY_ACCOUNT_FOR_TOKEN\"]=170,o[e[171]=\"INVALID_TOKEN_SYMBOL\"]=171,o[e[172]=\"TOKEN_HAS_NO_FREEZE_KEY\"]=172,o[e[173]=\"TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN\"]=173,o[e[174]=\"MISSING_TOKEN_SYMBOL\"]=174,o[e[175]=\"TOKEN_SYMBOL_TOO_LONG\"]=175,o[e[176]=\"ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN\"]=176,o[e[177]=\"TOKEN_HAS_NO_KYC_KEY\"]=177,o[e[178]=\"INSUFFICIENT_TOKEN_BALANCE\"]=178,o[e[179]=\"TOKEN_WAS_DELETED\"]=179,o[e[180]=\"TOKEN_HAS_NO_SUPPLY_KEY\"]=180,o[e[181]=\"TOKEN_HAS_NO_WIPE_KEY\"]=181,o[e[182]=\"INVALID_TOKEN_MINT_AMOUNT\"]=182,o[e[183]=\"INVALID_TOKEN_BURN_AMOUNT\"]=183,o[e[184]=\"TOKEN_NOT_ASSOCIATED_TO_ACCOUNT\"]=184,o[e[185]=\"CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT\"]=185,o[e[186]=\"INVALID_KYC_KEY\"]=186,o[e[187]=\"INVALID_WIPE_KEY\"]=187,o[e[188]=\"INVALID_FREEZE_KEY\"]=188,o[e[189]=\"INVALID_SUPPLY_KEY\"]=189,o[e[190]=\"MISSING_TOKEN_NAME\"]=190,o[e[191]=\"TOKEN_NAME_TOO_LONG\"]=191,o[e[192]=\"INVALID_WIPING_AMOUNT\"]=192,o[e[193]=\"TOKEN_IS_IMMUTABLE\"]=193,o[e[194]=\"TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT\"]=194,o[e[195]=\"TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES\"]=195,o[e[196]=\"ACCOUNT_IS_TREASURY\"]=196,o[e[197]=\"TOKEN_ID_REPEATED_IN_TOKEN_LIST\"]=197,o[e[198]=\"TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED\"]=198,o[e[199]=\"EMPTY_TOKEN_TRANSFER_BODY\"]=199,o[e[200]=\"EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS\"]=200,o[e[201]=\"INVALID_SCHEDULE_ID\"]=201,o[e[202]=\"SCHEDULE_IS_IMMUTABLE\"]=202,o[e[203]=\"INVALID_SCHEDULE_PAYER_ID\"]=203,o[e[204]=\"INVALID_SCHEDULE_ACCOUNT_ID\"]=204,o[e[205]=\"NO_NEW_VALID_SIGNATURES\"]=205,o[e[206]=\"UNRESOLVABLE_REQUIRED_SIGNERS\"]=206,o[e[207]=\"SCHEDULED_TRANSACTION_NOT_IN_WHITELIST\"]=207,o[e[208]=\"SOME_SIGNATURES_WERE_INVALID\"]=208,o[e[209]=\"TRANSACTION_ID_FIELD_NOT_ALLOWED\"]=209,o[e[210]=\"IDENTICAL_SCHEDULE_ALREADY_CREATED\"]=210,o[e[211]=\"INVALID_ZERO_BYTE_IN_STRING\"]=211,o[e[212]=\"SCHEDULE_ALREADY_DELETED\"]=212,o[e[213]=\"SCHEDULE_ALREADY_EXECUTED\"]=213,o[e[214]=\"MESSAGE_SIZE_TOO_LARGE\"]=214,o[e[215]=\"OPERATION_REPEATED_IN_BUCKET_GROUPS\"]=215,o[e[216]=\"BUCKET_CAPACITY_OVERFLOW\"]=216,o[e[217]=\"NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION\"]=217,o[e[218]=\"BUCKET_HAS_NO_THROTTLE_GROUPS\"]=218,o[e[219]=\"THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC\"]=219,o[e[220]=\"SUCCESS_BUT_MISSING_EXPECTED_OPERATION\"]=220,o[e[221]=\"UNPARSEABLE_THROTTLE_DEFINITIONS\"]=221,o[e[222]=\"INVALID_THROTTLE_DEFINITIONS\"]=222,o[e[223]=\"ACCOUNT_EXPIRED_AND_PENDING_REMOVAL\"]=223,o[e[224]=\"INVALID_TOKEN_MAX_SUPPLY\"]=224,o[e[225]=\"INVALID_TOKEN_NFT_SERIAL_NUMBER\"]=225,o[e[226]=\"INVALID_NFT_ID\"]=226,o[e[227]=\"METADATA_TOO_LONG\"]=227,o[e[228]=\"BATCH_SIZE_LIMIT_EXCEEDED\"]=228,o[e[229]=\"INVALID_QUERY_RANGE\"]=229,o[e[230]=\"FRACTION_DIVIDES_BY_ZERO\"]=230,o[e[231]=\"INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE\"]=231,o[e[232]=\"CUSTOM_FEES_LIST_TOO_LONG\"]=232,o[e[233]=\"INVALID_CUSTOM_FEE_COLLECTOR\"]=233,o[e[234]=\"INVALID_TOKEN_ID_IN_CUSTOM_FEES\"]=234,o[e[235]=\"TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR\"]=235,o[e[236]=\"TOKEN_MAX_SUPPLY_REACHED\"]=236,o[e[237]=\"SENDER_DOES_NOT_OWN_NFT_SERIAL_NO\"]=237,o[e[238]=\"CUSTOM_FEE_NOT_FULLY_SPECIFIED\"]=238,o[e[239]=\"CUSTOM_FEE_MUST_BE_POSITIVE\"]=239,o[e[240]=\"TOKEN_HAS_NO_FEE_SCHEDULE_KEY\"]=240,o[e[241]=\"CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE\"]=241,o[e[242]=\"ROYALTY_FRACTION_CANNOT_EXCEED_ONE\"]=242,o[e[243]=\"FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT\"]=243,o[e[244]=\"CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES\"]=244,o[e[245]=\"CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON\"]=245,o[e[246]=\"CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON\"]=246,o[e[247]=\"INVALID_CUSTOM_FEE_SCHEDULE_KEY\"]=247,o[e[248]=\"INVALID_TOKEN_MINT_METADATA\"]=248,o[e[249]=\"INVALID_TOKEN_BURN_METADATA\"]=249,o[e[250]=\"CURRENT_TREASURY_STILL_OWNS_NFTS\"]=250,o[e[251]=\"ACCOUNT_STILL_OWNS_NFTS\"]=251,o[e[252]=\"TREASURY_MUST_OWN_BURNED_NFT\"]=252,o[e[253]=\"ACCOUNT_DOES_NOT_OWN_WIPED_NFT\"]=253,o[e[254]=\"ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON\"]=254,o[e[255]=\"MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED\"]=255,o[e[256]=\"PAYER_ACCOUNT_DELETED\"]=256,o[e[257]=\"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH\"]=257,o[e[258]=\"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS\"]=258,o[e[259]=\"INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE\"]=259,o[e[260]=\"SERIAL_NUMBER_LIMIT_REACHED\"]=260,o[e[261]=\"CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE\"]=261,o[e[262]=\"NO_REMAINING_AUTOMATIC_ASSOCIATIONS\"]=262,o[e[263]=\"EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT\"]=263,o[e[264]=\"REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT\"]=264,o[e[265]=\"TOKEN_IS_PAUSED\"]=265,o[e[266]=\"TOKEN_HAS_NO_PAUSE_KEY\"]=266,o[e[267]=\"INVALID_PAUSE_KEY\"]=267,o[e[268]=\"FREEZE_UPDATE_FILE_DOES_NOT_EXIST\"]=268,o[e[269]=\"FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH\"]=269,o[e[270]=\"NO_UPGRADE_HAS_BEEN_PREPARED\"]=270,o[e[271]=\"NO_FREEZE_IS_SCHEDULED\"]=271,o[e[272]=\"UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE\"]=272,o[e[273]=\"FREEZE_START_TIME_MUST_BE_FUTURE\"]=273,o[e[274]=\"PREPARED_UPDATE_FILE_IS_IMMUTABLE\"]=274,o[e[275]=\"FREEZE_ALREADY_SCHEDULED\"]=275,o[e[276]=\"FREEZE_UPGRADE_IN_PROGRESS\"]=276,o[e[277]=\"UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED\"]=277,o[e[278]=\"UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED\"]=278,o[e[279]=\"CONSENSUS_GAS_EXHAUSTED\"]=279,o[e[280]=\"REVERTED_SUCCESS\"]=280,o[e[281]=\"MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED\"]=281,o[e[282]=\"INVALID_ALIAS_KEY\"]=282,o[e[283]=\"UNEXPECTED_TOKEN_DECIMALS\"]=283,o[e[284]=\"INVALID_PROXY_ACCOUNT_ID\"]=284,o[e[285]=\"INVALID_TRANSFER_ACCOUNT_ID\"]=285,o[e[286]=\"INVALID_FEE_COLLECTOR_ACCOUNT_ID\"]=286,o[e[287]=\"ALIAS_IS_IMMUTABLE\"]=287,o[e[288]=\"SPENDER_ACCOUNT_SAME_AS_OWNER\"]=288,o[e[289]=\"AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY\"]=289,o[e[290]=\"NEGATIVE_ALLOWANCE_AMOUNT\"]=290,o[e[291]=\"CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON\"]=291,o[e[292]=\"SPENDER_DOES_NOT_HAVE_ALLOWANCE\"]=292,o[e[293]=\"AMOUNT_EXCEEDS_ALLOWANCE\"]=293,o[e[294]=\"MAX_ALLOWANCES_EXCEEDED\"]=294,o[e[295]=\"EMPTY_ALLOWANCES\"]=295,o[e[296]=\"SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES\"]=296,o[e[297]=\"REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES\"]=297,o[e[298]=\"FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES\"]=298,o[e[299]=\"NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES\"]=299,o[e[300]=\"INVALID_ALLOWANCE_OWNER_ID\"]=300,o[e[301]=\"INVALID_ALLOWANCE_SPENDER_ID\"]=301,o[e[302]=\"REPEATED_ALLOWANCES_TO_DELETE\"]=302,o[e[303]=\"INVALID_DELEGATING_SPENDER\"]=303,o[e[304]=\"DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL\"]=304,o[e[305]=\"DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL\"]=305,o[e[306]=\"SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE\"]=306,o[e[307]=\"SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME\"]=307,o[e[308]=\"SCHEDULE_FUTURE_THROTTLE_EXCEEDED\"]=308,o[e[309]=\"SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED\"]=309,o[e[310]=\"INVALID_ETHEREUM_TRANSACTION\"]=310,o[e[311]=\"WRONG_CHAIN_ID\"]=311,o[e[312]=\"WRONG_NONCE\"]=312,o[e[313]=\"ACCESS_LIST_UNSUPPORTED\"]=313,o[e[314]=\"SCHEDULE_PENDING_EXPIRATION\"]=314,o[e[315]=\"CONTRACT_IS_TOKEN_TREASURY\"]=315,o[e[316]=\"CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES\"]=316,o[e[317]=\"CONTRACT_EXPIRED_AND_PENDING_REMOVAL\"]=317,o[e[318]=\"CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT\"]=318,o[e[319]=\"PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION\"]=319,o[e[320]=\"PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED\"]=320,o[e[321]=\"SELF_STAKING_IS_NOT_ALLOWED\"]=321,o[e[322]=\"INVALID_STAKING_ID\"]=322,o[e[323]=\"STAKING_NOT_ENABLED\"]=323,o[e[324]=\"INVALID_PRNG_RANGE\"]=324,o[e[325]=\"MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED\"]=325,o[e[326]=\"INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE\"]=326,o[e[327]=\"INSUFFICIENT_BALANCES_FOR_STORAGE_RENT\"]=327,o[e[328]=\"MAX_CHILD_RECORDS_EXCEEDED\"]=328,o[e[329]=\"INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES\"]=329,o[e[330]=\"TRANSACTION_HAS_UNKNOWN_FIELDS\"]=330,o[e[331]=\"ACCOUNT_IS_IMMUTABLE\"]=331,o[e[332]=\"ALIAS_ALREADY_ASSIGNED\"]=332,o}(),ConsensusTopicInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.memo=e.string();break}case 2:{i.runningHash=e.bytes();break}case 3:{i.sequenceNumber=e.uint64();break}case 4:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 5:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 6:{i.submitKey=$root.proto.Key.decode(e,e.uint32());break}case 7:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 8:{i.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 9:{i.ledgerId=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ConsensusTopicInfo\"},e}(),ConsensusService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createTopic\"}),Object.defineProperty(e.prototype.updateTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateTopic\"}),Object.defineProperty(e.prototype.deleteTopic=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteTopic\"}),Object.defineProperty(e.prototype.getTopicInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTopicInfo\"}),Object.defineProperty(e.prototype.submitMessage=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"submitMessage\"}),e}(),Query:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.getByKey=$root.proto.GetByKeyQuery.decode(e,e.uint32());break}case 2:{i.getBySolidityID=$root.proto.GetBySolidityIDQuery.decode(e,e.uint32());break}case 3:{i.contractCallLocal=$root.proto.ContractCallLocalQuery.decode(e,e.uint32());break}case 4:{i.contractGetInfo=$root.proto.ContractGetInfoQuery.decode(e,e.uint32());break}case 5:{i.contractGetBytecode=$root.proto.ContractGetBytecodeQuery.decode(e,e.uint32());break}case 6:{i.ContractGetRecords=$root.proto.ContractGetRecordsQuery.decode(e,e.uint32());break}case 7:{i.cryptogetAccountBalance=$root.proto.CryptoGetAccountBalanceQuery.decode(e,e.uint32());break}case 8:{i.cryptoGetAccountRecords=$root.proto.CryptoGetAccountRecordsQuery.decode(e,e.uint32());break}case 9:{i.cryptoGetInfo=$root.proto.CryptoGetInfoQuery.decode(e,e.uint32());break}case 10:{i.cryptoGetLiveHash=$root.proto.CryptoGetLiveHashQuery.decode(e,e.uint32());break}case 11:{i.cryptoGetProxyStakers=$root.proto.CryptoGetStakersQuery.decode(e,e.uint32());break}case 12:{i.fileGetContents=$root.proto.FileGetContentsQuery.decode(e,e.uint32());break}case 13:{i.fileGetInfo=$root.proto.FileGetInfoQuery.decode(e,e.uint32());break}case 14:{i.transactionGetReceipt=$root.proto.TransactionGetReceiptQuery.decode(e,e.uint32());break}case 15:{i.transactionGetRecord=$root.proto.TransactionGetRecordQuery.decode(e,e.uint32());break}case 16:{i.transactionGetFastRecord=$root.proto.TransactionGetFastRecordQuery.decode(e,e.uint32());break}case 50:{i.consensusGetTopicInfo=$root.proto.ConsensusGetTopicInfoQuery.decode(e,e.uint32());break}case 51:{i.networkGetVersionInfo=$root.proto.NetworkGetVersionInfoQuery.decode(e,e.uint32());break}case 52:{i.tokenGetInfo=$root.proto.TokenGetInfoQuery.decode(e,e.uint32());break}case 53:{i.scheduleGetInfo=$root.proto.ScheduleGetInfoQuery.decode(e,e.uint32());break}case 54:{i.tokenGetAccountNftInfos=$root.proto.TokenGetAccountNftInfosQuery.decode(e,e.uint32());break}case 55:{i.tokenGetNftInfo=$root.proto.TokenGetNftInfoQuery.decode(e,e.uint32());break}case 56:{i.tokenGetNftInfos=$root.proto.TokenGetNftInfosQuery.decode(e,e.uint32());break}case 57:{i.networkGetExecutionTime=$root.proto.NetworkGetExecutionTimeQuery.decode(e,e.uint32());break}case 58:{i.accountDetails=$root.proto.GetAccountDetailsQuery.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Query\"},e}(),GetByKeyQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.key=$root.proto.Key.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GetByKeyQuery\"},e}(),EntityID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break}case 3:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.EntityID\"},e}(),GetByKeyResponse:function(){function e(e){if(this.entities=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.entities&&i.entities.length||(i.entities=[]),i.entities.push($root.proto.EntityID.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GetByKeyResponse\"},e}(),GetBySolidityIDQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.solidityID=e.string();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GetBySolidityIDQuery\"},e}(),GetBySolidityIDResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GetBySolidityIDResponse\"},e}(),ContractLoginfo:function(){function e(e){if(this.topic=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.bloom=e.bytes();break}case 3:{i.topic&&i.topic.length||(i.topic=[]),i.topic.push(e.bytes());break}case 4:{i.data=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractLoginfo\"},e}(),ContractFunctionResult:function(){function e(e){if(this.logInfo=[],this.createdContractIDs=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.contractCallResult=e.bytes();break}case 3:{i.errorMessage=e.string();break}case 4:{i.bloom=e.bytes();break}case 5:{i.gasUsed=e.uint64();break}case 6:{i.logInfo&&i.logInfo.length||(i.logInfo=[]),i.logInfo.push($root.proto.ContractLoginfo.decode(e,e.uint32()));break}case 7:{i.createdContractIDs&&i.createdContractIDs.length||(i.createdContractIDs=[]),i.createdContractIDs.push($root.proto.ContractID.decode(e,e.uint32()));break}case 9:{i.evmAddress=$root.google.protobuf.BytesValue.decode(e,e.uint32());break}case 10:{i.gas=e.int64();break}case 11:{i.amount=e.int64();break}case 12:{i.functionParameters=e.bytes();break}case 13:{i.senderId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractFunctionResult\"},e}(),ContractCallLocalQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 3:{i.gas=e.int64();break}case 4:{i.functionParameters=e.bytes();break}case 5:{i.maxResultSize=e.int64();break}case 6:{i.senderId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractCallLocalQuery\"},e}(),ContractCallLocalResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.functionResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractCallLocalResponse\"},e}(),ContractGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractGetInfoQuery\"},e}(),ContractGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.contractInfo=$root.proto.ContractGetInfoResponse.ContractInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractGetInfoResponse\"},e.ContractInfo=function(){function e(e){if(this.tokenRelationships=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.contractAccountID=e.string();break}case 4:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 5:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 6:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 7:{i.storage=e.int64();break}case 8:{i.memo=e.string();break}case 9:{i.balance=e.uint64();break}case 10:{i.deleted=e.bool();break}case 11:{i.tokenRelationships&&i.tokenRelationships.length||(i.tokenRelationships=[]),i.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break}case 12:{i.ledgerId=e.bytes();break}case 13:{i.autoRenewAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 14:{i.maxAutomaticTokenAssociations=e.int32();break}case 15:{i.stakingInfo=$root.proto.StakingInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractGetInfoResponse.ContractInfo\"},e}(),e}(),ContractGetBytecodeQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractGetBytecodeQuery\"},e}(),ContractGetBytecodeResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 6:{i.bytecode=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractGetBytecodeResponse\"},e}(),ContractGetRecordsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractGetRecordsQuery\"},e}(),ContractGetRecordsResponse:function(){function e(e){if(this.records=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 3:{i.records&&i.records.length||(i.records=[]),i.records.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractGetRecordsResponse\"},e}(),TransactionRecord:function(){function e(e){if(this.tokenTransferLists=[],this.assessedCustomFees=[],this.automaticTokenAssociations=[],this.paidStakingRewards=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.receipt=$root.proto.TransactionReceipt.decode(e,e.uint32());break}case 2:{i.transactionHash=e.bytes();break}case 3:{i.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{i.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 5:{i.memo=e.string();break}case 6:{i.transactionFee=e.uint64();break}case 7:{i.contractCallResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break}case 8:{i.contractCreateResult=$root.proto.ContractFunctionResult.decode(e,e.uint32());break}case 10:{i.transferList=$root.proto.TransferList.decode(e,e.uint32());break}case 11:{i.tokenTransferLists&&i.tokenTransferLists.length||(i.tokenTransferLists=[]),i.tokenTransferLists.push($root.proto.TokenTransferList.decode(e,e.uint32()));break}case 12:{i.scheduleRef=$root.proto.ScheduleID.decode(e,e.uint32());break}case 13:{i.assessedCustomFees&&i.assessedCustomFees.length||(i.assessedCustomFees=[]),i.assessedCustomFees.push($root.proto.AssessedCustomFee.decode(e,e.uint32()));break}case 14:{i.automaticTokenAssociations&&i.automaticTokenAssociations.length||(i.automaticTokenAssociations=[]),i.automaticTokenAssociations.push($root.proto.TokenAssociation.decode(e,e.uint32()));break}case 15:{i.parentConsensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 16:{i.alias=e.bytes();break}case 17:{i.ethereumHash=e.bytes();break}case 18:{i.paidStakingRewards&&i.paidStakingRewards.length||(i.paidStakingRewards=[]),i.paidStakingRewards.push($root.proto.AccountAmount.decode(e,e.uint32()));break}case 19:{i.prngBytes=e.bytes();break}case 20:{i.prngNumber=e.int32();break}case 21:{i.evmAddress=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionRecord\"},e}(),TransactionReceipt:function(){function e(e){if(this.serialNumbers=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.status=e.int32();break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 4:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}case 5:{i.exchangeRate=$root.proto.ExchangeRateSet.decode(e,e.uint32());break}case 6:{i.topicID=$root.proto.TopicID.decode(e,e.uint32());break}case 7:{i.topicSequenceNumber=e.uint64();break}case 8:{i.topicRunningHash=e.bytes();break}case 9:{i.topicRunningHashVersion=e.uint64();break}case 10:{i.tokenID=$root.proto.TokenID.decode(e,e.uint32());break}case 11:{i.newTotalSupply=e.uint64();break}case 12:{i.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}case 13:{i.scheduledTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 14:{if(i.serialNumbers&&i.serialNumbers.length||(i.serialNumbers=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.hbarEquiv=e.int32();break}case 2:{i.centEquiv=e.int32();break}case 3:{i.expirationTime=$root.proto.TimestampSeconds.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ExchangeRate\"},e}(),ExchangeRateSet:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.currentRate=$root.proto.ExchangeRate.decode(e,e.uint32());break}case 2:{i.nextRate=$root.proto.ExchangeRate.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ExchangeRateSet\"},e}(),CryptoGetAccountBalanceQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.contractID=$root.proto.ContractID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetAccountBalanceQuery\"},e}(),CryptoGetAccountBalanceResponse:function(){function e(e){if(this.tokenBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.balance=e.uint64();break}case 4:{i.tokenBalances&&i.tokenBalances.length||(i.tokenBalances=[]),i.tokenBalances.push($root.proto.TokenBalance.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetAccountBalanceResponse\"},e}(),CryptoGetAccountRecordsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetAccountRecordsQuery\"},e}(),CryptoGetAccountRecordsResponse:function(){function e(e){if(this.records=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.records&&i.records.length||(i.records=[]),i.records.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetAccountRecordsResponse\"},e}(),CryptoGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetInfoQuery\"},e}(),CryptoGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.accountInfo=$root.proto.CryptoGetInfoResponse.AccountInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetInfoResponse\"},e.AccountInfo=function(){function e(e){if(this.liveHashes=[],this.tokenRelationships=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.contractAccountID=e.string();break}case 3:{i.deleted=e.bool();break}case 4:{i.proxyAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 6:{i.proxyReceived=e.int64();break}case 7:{i.key=$root.proto.Key.decode(e,e.uint32());break}case 8:{i.balance=e.uint64();break}case 9:{i.generateSendRecordThreshold=e.uint64();break}case 10:{i.generateReceiveRecordThreshold=e.uint64();break}case 11:{i.receiverSigRequired=e.bool();break}case 12:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 13:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 14:{i.liveHashes&&i.liveHashes.length||(i.liveHashes=[]),i.liveHashes.push($root.proto.LiveHash.decode(e,e.uint32()));break}case 15:{i.tokenRelationships&&i.tokenRelationships.length||(i.tokenRelationships=[]),i.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break}case 16:{i.memo=e.string();break}case 17:{i.ownedNfts=e.int64();break}case 18:{i.maxAutomaticTokenAssociations=e.int32();break}case 19:{i.alias=e.bytes();break}case 20:{i.ledgerId=e.bytes();break}case 21:{i.ethereumNonce=e.int64();break}case 22:{i.stakingInfo=$root.proto.StakingInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetInfoResponse.AccountInfo\"},e}(),e}(),CryptoGetLiveHashQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.hash=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetLiveHashQuery\"},e}(),CryptoGetLiveHashResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.liveHash=$root.proto.LiveHash.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetLiveHashResponse\"},e}(),CryptoGetStakersQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetStakersQuery\"},e}(),ProxyStaker:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.amount=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ProxyStaker\"},e}(),AllProxyStakers:function(){function e(e){if(this.proxyStaker=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.proxyStaker&&i.proxyStaker.length||(i.proxyStaker=[]),i.proxyStaker.push($root.proto.ProxyStaker.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.AllProxyStakers\"},e}(),CryptoGetStakersResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 3:{i.stakers=$root.proto.AllProxyStakers.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.CryptoGetStakersResponse\"},e}(),FileGetContentsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileGetContentsQuery\"},e}(),FileGetContentsResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.fileContents=$root.proto.FileGetContentsResponse.FileContents.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileGetContentsResponse\"},e.FileContents=function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{i.contents=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileGetContentsResponse.FileContents\"},e}(),e}(),FileGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileGetInfoQuery\"},e}(),FileGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.fileInfo=$root.proto.FileGetInfoResponse.FileInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileGetInfoResponse\"},e.FileInfo=function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileID=$root.proto.FileID.decode(e,e.uint32());break}case 2:{i.size=e.int64();break}case 3:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{i.deleted=e.bool();break}case 5:{i.keys=$root.proto.KeyList.decode(e,e.uint32());break}case 6:{i.memo=e.string();break}case 7:{i.ledgerId=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.FileGetInfoResponse.FileInfo\"},e}(),e}(),TransactionGetReceiptQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 3:{i.includeDuplicates=e.bool();break}case 4:{i.includeChildReceipts=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionGetReceiptQuery\"},e}(),TransactionGetReceiptResponse:function(){function e(e){if(this.duplicateTransactionReceipts=[],this.childTransactionReceipts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.receipt=$root.proto.TransactionReceipt.decode(e,e.uint32());break}case 4:{i.duplicateTransactionReceipts&&i.duplicateTransactionReceipts.length||(i.duplicateTransactionReceipts=[]),i.duplicateTransactionReceipts.push($root.proto.TransactionReceipt.decode(e,e.uint32()));break}case 5:{i.childTransactionReceipts&&i.childTransactionReceipts.length||(i.childTransactionReceipts=[]),i.childTransactionReceipts.push($root.proto.TransactionReceipt.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionGetReceiptResponse\"},e}(),TransactionGetRecordQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 3:{i.includeDuplicates=e.bool();break}case 4:{i.includeChildRecords=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionGetRecordQuery\"},e}(),TransactionGetRecordResponse:function(){function e(e){if(this.duplicateTransactionRecords=[],this.childTransactionRecords=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 3:{i.transactionRecord=$root.proto.TransactionRecord.decode(e,e.uint32());break}case 4:{i.duplicateTransactionRecords&&i.duplicateTransactionRecords.length||(i.duplicateTransactionRecords=[]),i.duplicateTransactionRecords.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}case 5:{i.childTransactionRecords&&i.childTransactionRecords.length||(i.childTransactionRecords=[]),i.childTransactionRecords.push($root.proto.TransactionRecord.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionGetRecordResponse\"},e}(),TransactionGetFastRecordQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.transactionID=$root.proto.TransactionID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionGetFastRecordQuery\"},e}(),TransactionGetFastRecordResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.transactionRecord=$root.proto.TransactionRecord.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionGetFastRecordResponse\"},e}(),NetworkGetVersionInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NetworkGetVersionInfoQuery\"},e}(),NetworkGetVersionInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.hapiProtoVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break}case 3:{i.hederaServicesVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NetworkGetVersionInfoResponse\"},e}(),NetworkGetExecutionTimeQuery:function(){function e(e){if(this.transactionIds=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.transactionIds&&i.transactionIds.length||(i.transactionIds=[]),i.transactionIds.push($root.proto.TransactionID.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NetworkGetExecutionTimeQuery\"},e}(),NetworkGetExecutionTimeResponse:function(){function e(e){if(this.executionTimes=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{if(i.executionTimes&&i.executionTimes.length||(i.executionTimes=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.token=$root.proto.TokenID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetInfoQuery\"},e}(),TokenInfo:function(){function e(e){if(this.customFees=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.name=e.string();break}case 3:{i.symbol=e.string();break}case 4:{i.decimals=e.uint32();break}case 5:{i.totalSupply=e.uint64();break}case 6:{i.treasury=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{i.kycKey=$root.proto.Key.decode(e,e.uint32());break}case 9:{i.freezeKey=$root.proto.Key.decode(e,e.uint32());break}case 10:{i.wipeKey=$root.proto.Key.decode(e,e.uint32());break}case 11:{i.supplyKey=$root.proto.Key.decode(e,e.uint32());break}case 12:{i.defaultFreezeStatus=e.int32();break}case 13:{i.defaultKycStatus=e.int32();break}case 14:{i.deleted=e.bool();break}case 15:{i.autoRenewAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 16:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 17:{i.expiry=$root.proto.Timestamp.decode(e,e.uint32());break}case 18:{i.memo=e.string();break}case 19:{i.tokenType=e.int32();break}case 20:{i.supplyType=e.int32();break}case 21:{i.maxSupply=e.int64();break}case 22:{i.feeScheduleKey=$root.proto.Key.decode(e,e.uint32());break}case 23:{i.customFees&&i.customFees.length||(i.customFees=[]),i.customFees.push($root.proto.CustomFee.decode(e,e.uint32()));break}case 24:{i.pauseKey=$root.proto.Key.decode(e,e.uint32());break}case 25:{i.pauseStatus=e.int32();break}case 26:{i.ledgerId=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenInfo\"},e}(),TokenGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.tokenInfo=$root.proto.TokenInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetInfoResponse\"},e}(),ScheduleGetInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ScheduleGetInfoQuery\"},e}(),ScheduleInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.scheduleID=$root.proto.ScheduleID.decode(e,e.uint32());break}case 2:{i.deletionTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 3:{i.executionTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 5:{i.scheduledTransactionBody=$root.proto.SchedulableTransactionBody.decode(e,e.uint32());break}case 6:{i.memo=e.string();break}case 7:{i.adminKey=$root.proto.Key.decode(e,e.uint32());break}case 8:{i.signers=$root.proto.KeyList.decode(e,e.uint32());break}case 9:{i.creatorAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 10:{i.payerAccountID=$root.proto.AccountID.decode(e,e.uint32());break}case 11:{i.scheduledTransactionID=$root.proto.TransactionID.decode(e,e.uint32());break}case 12:{i.ledgerId=e.bytes();break}case 13:{i.waitForExpiry=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ScheduleInfo\"},e}(),ScheduleGetInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.scheduleInfo=$root.proto.ScheduleInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ScheduleGetInfoResponse\"},e}(),TokenGetAccountNftInfosQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.start=e.int64();break}case 4:{i.end=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetAccountNftInfosQuery\"},e}(),TokenGetAccountNftInfosResponse:function(){function e(e){if(this.nfts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.nfts&&i.nfts.length||(i.nfts=[]),i.nfts.push($root.proto.TokenNftInfo.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetAccountNftInfosResponse\"},e}(),NftID:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenID=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.serialNumber=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.NftID\"},e}(),TokenGetNftInfoQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.nftID=$root.proto.NftID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetNftInfoQuery\"},e}(),TokenNftInfo:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.nftID=$root.proto.NftID.decode(e,e.uint32());break}case 2:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.creationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 4:{i.metadata=e.bytes();break}case 5:{i.ledgerId=e.bytes();break}case 6:{i.spenderId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenNftInfo\"},e}(),TokenGetNftInfoResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.nft=$root.proto.TokenNftInfo.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetNftInfoResponse\"},e}(),TokenGetNftInfosQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.tokenID=$root.proto.TokenID.decode(e,e.uint32());break}case 3:{i.start=e.int64();break}case 4:{i.end=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetNftInfosQuery\"},e}(),TokenGetNftInfosResponse:function(){function e(e){if(this.nfts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.tokenID=$root.proto.TokenID.decode(e,e.uint32());break}case 3:{i.nfts&&i.nfts.length||(i.nfts=[]),i.nfts.push($root.proto.TokenNftInfo.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenGetNftInfosResponse\"},e}(),GetAccountDetailsQuery:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.QueryHeader.decode(e,e.uint32());break}case 2:{i.accountId=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GetAccountDetailsQuery\"},e}(),GetAccountDetailsResponse:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.header=$root.proto.ResponseHeader.decode(e,e.uint32());break}case 2:{i.accountDetails=$root.proto.GetAccountDetailsResponse.AccountDetails.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GetAccountDetailsResponse\"},e.AccountDetails=function(){function e(e){if(this.tokenRelationships=[],this.grantedCryptoAllowances=[],this.grantedNftAllowances=[],this.grantedTokenAllowances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountId=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.contractAccountId=e.string();break}case 3:{i.deleted=e.bool();break}case 4:{i.proxyAccountId=$root.proto.AccountID.decode(e,e.uint32());break}case 5:{i.proxyReceived=e.int64();break}case 6:{i.key=$root.proto.Key.decode(e,e.uint32());break}case 7:{i.balance=e.uint64();break}case 8:{i.receiverSigRequired=e.bool();break}case 9:{i.expirationTime=$root.proto.Timestamp.decode(e,e.uint32());break}case 10:{i.autoRenewPeriod=$root.proto.Duration.decode(e,e.uint32());break}case 11:{i.tokenRelationships&&i.tokenRelationships.length||(i.tokenRelationships=[]),i.tokenRelationships.push($root.proto.TokenRelationship.decode(e,e.uint32()));break}case 12:{i.memo=e.string();break}case 13:{i.ownedNfts=e.int64();break}case 14:{i.maxAutomaticTokenAssociations=e.int32();break}case 15:{i.alias=e.bytes();break}case 16:{i.ledgerId=e.bytes();break}case 17:{i.grantedCryptoAllowances&&i.grantedCryptoAllowances.length||(i.grantedCryptoAllowances=[]),i.grantedCryptoAllowances.push($root.proto.GrantedCryptoAllowance.decode(e,e.uint32()));break}case 18:{i.grantedNftAllowances&&i.grantedNftAllowances.length||(i.grantedNftAllowances=[]),i.grantedNftAllowances.push($root.proto.GrantedNftAllowance.decode(e,e.uint32()));break}case 19:{i.grantedTokenAllowances&&i.grantedTokenAllowances.length||(i.grantedTokenAllowances=[]),i.grantedTokenAllowances.push($root.proto.GrantedTokenAllowance.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GetAccountDetailsResponse.AccountDetails\"},e}(),e}(),GrantedCryptoAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.amount=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GrantedCryptoAllowance\"},e}(),GrantedNftAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.spender=$root.proto.AccountID.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GrantedNftAllowance\"},e}(),GrantedTokenAllowance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.spender=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.amount=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.GrantedTokenAllowance\"},e}(),Response:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.getByKey=$root.proto.GetByKeyResponse.decode(e,e.uint32());break}case 2:{i.getBySolidityID=$root.proto.GetBySolidityIDResponse.decode(e,e.uint32());break}case 3:{i.contractCallLocal=$root.proto.ContractCallLocalResponse.decode(e,e.uint32());break}case 5:{i.contractGetBytecodeResponse=$root.proto.ContractGetBytecodeResponse.decode(e,e.uint32());break}case 4:{i.contractGetInfo=$root.proto.ContractGetInfoResponse.decode(e,e.uint32());break}case 6:{i.contractGetRecordsResponse=$root.proto.ContractGetRecordsResponse.decode(e,e.uint32());break}case 7:{i.cryptogetAccountBalance=$root.proto.CryptoGetAccountBalanceResponse.decode(e,e.uint32());break}case 8:{i.cryptoGetAccountRecords=$root.proto.CryptoGetAccountRecordsResponse.decode(e,e.uint32());break}case 9:{i.cryptoGetInfo=$root.proto.CryptoGetInfoResponse.decode(e,e.uint32());break}case 10:{i.cryptoGetLiveHash=$root.proto.CryptoGetLiveHashResponse.decode(e,e.uint32());break}case 11:{i.cryptoGetProxyStakers=$root.proto.CryptoGetStakersResponse.decode(e,e.uint32());break}case 12:{i.fileGetContents=$root.proto.FileGetContentsResponse.decode(e,e.uint32());break}case 13:{i.fileGetInfo=$root.proto.FileGetInfoResponse.decode(e,e.uint32());break}case 14:{i.transactionGetReceipt=$root.proto.TransactionGetReceiptResponse.decode(e,e.uint32());break}case 15:{i.transactionGetRecord=$root.proto.TransactionGetRecordResponse.decode(e,e.uint32());break}case 16:{i.transactionGetFastRecord=$root.proto.TransactionGetFastRecordResponse.decode(e,e.uint32());break}case 150:{i.consensusGetTopicInfo=$root.proto.ConsensusGetTopicInfoResponse.decode(e,e.uint32());break}case 151:{i.networkGetVersionInfo=$root.proto.NetworkGetVersionInfoResponse.decode(e,e.uint32());break}case 152:{i.tokenGetInfo=$root.proto.TokenGetInfoResponse.decode(e,e.uint32());break}case 153:{i.scheduleGetInfo=$root.proto.ScheduleGetInfoResponse.decode(e,e.uint32());break}case 154:{i.tokenGetAccountNftInfos=$root.proto.TokenGetAccountNftInfosResponse.decode(e,e.uint32());break}case 155:{i.tokenGetNftInfo=$root.proto.TokenGetNftInfoResponse.decode(e,e.uint32());break}case 156:{i.tokenGetNftInfos=$root.proto.TokenGetNftInfosResponse.decode(e,e.uint32());break}case 157:{i.networkGetExecutionTime=$root.proto.NetworkGetExecutionTimeResponse.decode(e,e.uint32());break}case 158:{i.accountDetails=$root.proto.GetAccountDetailsResponse.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.Response\"},e}(),CryptoService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createAccount\"}),Object.defineProperty(e.prototype.updateAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateAccount\"}),Object.defineProperty(e.prototype.cryptoTransfer=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"cryptoTransfer\"}),Object.defineProperty(e.prototype.cryptoDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"cryptoDelete\"}),Object.defineProperty(e.prototype.approveAllowances=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"approveAllowances\"}),Object.defineProperty(e.prototype.deleteAllowances=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteAllowances\"}),Object.defineProperty(e.prototype.addLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"addLiveHash\"}),Object.defineProperty(e.prototype.deleteLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteLiveHash\"}),Object.defineProperty(e.prototype.getLiveHash=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getLiveHash\"}),Object.defineProperty(e.prototype.getAccountRecords=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountRecords\"}),Object.defineProperty(e.prototype.cryptoGetBalance=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"cryptoGetBalance\"}),Object.defineProperty(e.prototype.getAccountInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountInfo\"}),Object.defineProperty(e.prototype.getTransactionReceipts=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTransactionReceipts\"}),Object.defineProperty(e.prototype.getFastTransactionRecord=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getFastTransactionRecord\"}),Object.defineProperty(e.prototype.getTxRecordByTxID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTxRecordByTxID\"}),Object.defineProperty(e.prototype.getStakersByAccountID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getStakersByAccountID\"}),e}(),FileService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createFile\"}),Object.defineProperty(e.prototype.updateFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateFile\"}),Object.defineProperty(e.prototype.deleteFile=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteFile\"}),Object.defineProperty(e.prototype.appendContent=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"appendContent\"}),Object.defineProperty(e.prototype.getFileContent=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getFileContent\"}),Object.defineProperty(e.prototype.getFileInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getFileInfo\"}),Object.defineProperty(e.prototype.systemDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemDelete\"}),Object.defineProperty(e.prototype.systemUndelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemUndelete\"}),e}(),FreezeService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.freeze=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"freeze\"}),e}(),NetworkService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.getVersionInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getVersionInfo\"}),Object.defineProperty(e.prototype.getExecutionTime=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getExecutionTime\"}),Object.defineProperty(e.prototype.uncheckedSubmit=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"uncheckedSubmit\"}),Object.defineProperty(e.prototype.getAccountDetails=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountDetails\"}),e}(),ScheduleService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createSchedule\"}),Object.defineProperty(e.prototype.signSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"signSchedule\"}),Object.defineProperty(e.prototype.deleteSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteSchedule\"}),Object.defineProperty(e.prototype.getScheduleInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getScheduleInfo\"}),e}(),SmartContractService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createContract\"}),Object.defineProperty(e.prototype.updateContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateContract\"}),Object.defineProperty(e.prototype.contractCallMethod=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"contractCallMethod\"}),Object.defineProperty(e.prototype.getContractInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getContractInfo\"}),Object.defineProperty(e.prototype.contractCallLocalMethod=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"contractCallLocalMethod\"}),Object.defineProperty(e.prototype.contractGetBytecode=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"ContractGetBytecode\"}),Object.defineProperty(e.prototype.getBySolidityID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getBySolidityID\"}),Object.defineProperty(e.prototype.getTxRecordByContractID=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTxRecordByContractID\"}),Object.defineProperty(e.prototype.deleteContract=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteContract\"}),Object.defineProperty(e.prototype.systemDelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemDelete\"}),Object.defineProperty(e.prototype.systemUndelete=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"systemUndelete\"}),Object.defineProperty(e.prototype.callEthereum=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"callEthereum\"}),e}(),ThrottleGroup:function(){function e(e){if(this.operations=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{if(i.operations&&i.operations.length||(i.operations=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.name=e.string();break}case 2:{i.burstPeriodMs=e.uint64();break}case 3:{i.throttleGroups&&i.throttleGroups.length||(i.throttleGroups=[]),i.throttleGroups.push($root.proto.ThrottleGroup.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ThrottleBucket\"},e}(),ThrottleDefinitions:function(){function e(e){if(this.throttleBuckets=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.throttleBuckets&&i.throttleBuckets.length||(i.throttleBuckets=[]),i.throttleBuckets.push($root.proto.ThrottleBucket.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ThrottleDefinitions\"},e}(),TokenService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.createToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"createToken\"}),Object.defineProperty(e.prototype.updateToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateToken\"}),Object.defineProperty(e.prototype.mintToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"mintToken\"}),Object.defineProperty(e.prototype.burnToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"burnToken\"}),Object.defineProperty(e.prototype.deleteToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"deleteToken\"}),Object.defineProperty(e.prototype.wipeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"wipeTokenAccount\"}),Object.defineProperty(e.prototype.freezeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"freezeTokenAccount\"}),Object.defineProperty(e.prototype.unfreezeTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"unfreezeTokenAccount\"}),Object.defineProperty(e.prototype.grantKycToTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"grantKycToTokenAccount\"}),Object.defineProperty(e.prototype.revokeKycFromTokenAccount=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"revokeKycFromTokenAccount\"}),Object.defineProperty(e.prototype.associateTokens=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"associateTokens\"}),Object.defineProperty(e.prototype.dissociateTokens=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"dissociateTokens\"}),Object.defineProperty(e.prototype.updateTokenFeeSchedule=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"updateTokenFeeSchedule\"}),Object.defineProperty(e.prototype.getTokenInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTokenInfo\"}),Object.defineProperty(e.prototype.getAccountNftInfos=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getAccountNftInfos\"}),Object.defineProperty(e.prototype.getTokenNftInfo=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTokenNftInfo\"}),Object.defineProperty(e.prototype.getTokenNftInfos=function t(e,o){return this.rpcCall(t,$root.proto.Query,$root.proto.Response,e,o)},\"name\",{value:\"getTokenNftInfos\"}),Object.defineProperty(e.prototype.pauseToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"pauseToken\"}),Object.defineProperty(e.prototype.unpauseToken=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"unpauseToken\"}),e}(),SignedTransaction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.bodyBytes=e.bytes();break}case 2:{i.sigMap=$root.proto.SignatureMap.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SignedTransaction\"},e}(),UtilService:function(){function e(e,o,t){$protobuf.rpc.Service.call(this,e,o,t)}return(e.prototype=Object.create($protobuf.rpc.Service.prototype)).constructor=e,e.create=function(e,o,t){return new this(e,o,t)},Object.defineProperty(e.prototype.prng=function t(e,o){return this.rpcCall(t,$root.proto.Transaction,$root.proto.TransactionResponse,e,o)},\"name\",{value:\"prng\"}),e}(),TokenUnitBalance:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.tokenId=$root.proto.TokenID.decode(e,e.uint32());break}case 2:{i.balance=e.uint64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TokenUnitBalance\"},e}(),SingleAccountBalances:function(){function e(e){if(this.tokenUnitBalances=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.accountID=$root.proto.AccountID.decode(e,e.uint32());break}case 2:{i.hbarBalance=e.uint64();break}case 3:{i.tokenUnitBalances&&i.tokenUnitBalances.length||(i.tokenUnitBalances=[]),i.tokenUnitBalances.push($root.proto.TokenUnitBalance.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SingleAccountBalances\"},e}(),AllAccountBalances:function(){function e(e){if(this.allAccounts=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{i.allAccounts&&i.allAccounts.length||(i.allAccounts=[]),i.allAccounts.push($root.proto.SingleAccountBalances.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.AllAccountBalances\"},e}(),ContractActions:function(){function e(e){if(this.contractActions=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractActions&&i.contractActions.length||(i.contractActions=[]),i.contractActions.push($root.proto.ContractAction.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractActions\"},e}(),ContractActionType:function(){const e={},o=Object.create(e);return o[e[0]=\"NO_ACTION\"]=0,o[e[1]=\"CALL\"]=1,o[e[2]=\"CREATE\"]=2,o[e[3]=\"PRECOMPILE\"]=3,o[e[4]=\"SYSTEM\"]=4,o}(),CallOperationType:function(){const e={},o=Object.create(e);return o[e[0]=\"OP_UNKNOWN\"]=0,o[e[1]=\"OP_CALL\"]=1,o[e[2]=\"OP_CALLCODE\"]=2,o[e[3]=\"OP_DELEGATECALL\"]=3,o[e[4]=\"OP_STATICCALL\"]=4,o[e[5]=\"OP_CREATE\"]=5,o[e[6]=\"OP_CREATE2\"]=6,o}(),ContractAction:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.callType=e.int32();break}case 2:{i.callingAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 3:{i.callingContract=$root.proto.ContractID.decode(e,e.uint32());break}case 4:{i.gas=e.int64();break}case 5:{i.input=e.bytes();break}case 6:{i.recipientAccount=$root.proto.AccountID.decode(e,e.uint32());break}case 7:{i.recipientContract=$root.proto.ContractID.decode(e,e.uint32());break}case 8:{i.targetedAddress=e.bytes();break}case 9:{i.value=e.int64();break}case 10:{i.gasUsed=e.int64();break}case 11:{i.output=e.bytes();break}case 12:{i.revertReason=e.bytes();break}case 13:{i.error=e.bytes();break}case 14:{i.callDepth=e.int32();break}case 15:{i.callOperationType=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractAction\"},e}(),ContractBytecode:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractId=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.initcode=e.bytes();break}case 3:{i.runtimeBytecode=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractBytecode\"},e}(),ContractStateChanges:function(){function e(e){if(this.contractStateChanges=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractStateChanges&&i.contractStateChanges.length||(i.contractStateChanges=[]),i.contractStateChanges.push($root.proto.ContractStateChange.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractStateChanges\"},e}(),ContractStateChange:function(){function e(e){if(this.storageChanges=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.contractId=$root.proto.ContractID.decode(e,e.uint32());break}case 2:{i.storageChanges&&i.storageChanges.length||(i.storageChanges=[]),i.storageChanges.push($root.proto.StorageChange.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.ContractStateChange\"},e}(),StorageChange:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.slot=e.bytes();break}case 2:{i.valueRead=e.bytes();break}case 3:{i.valueWritten=$root.google.protobuf.BytesValue.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.StorageChange\"},e}(),HashAlgorithm:function(){const e={},o=Object.create(e);return o[e[0]=\"HASH_ALGORITHM_UNKNOWN\"]=0,o[e[1]=\"SHA_384\"]=1,o}(),HashObject:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.algorithm=e.int32();break}case 2:{i.length=e.int32();break}case 3:{i.hash=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.HashObject\"},e}(),RecordStreamFile:function(){function e(e){if(this.recordStreamItems=[],this.sidecars=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.hapiProtoVersion=$root.proto.SemanticVersion.decode(e,e.uint32());break}case 2:{i.startObjectRunningHash=$root.proto.HashObject.decode(e,e.uint32());break}case 3:{i.recordStreamItems&&i.recordStreamItems.length||(i.recordStreamItems=[]),i.recordStreamItems.push($root.proto.RecordStreamItem.decode(e,e.uint32()));break}case 4:{i.endObjectRunningHash=$root.proto.HashObject.decode(e,e.uint32());break}case 5:{i.blockNumber=e.int64();break}case 6:{i.sidecars&&i.sidecars.length||(i.sidecars=[]),i.sidecars.push($root.proto.SidecarMetadata.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.RecordStreamFile\"},e}(),RecordStreamItem:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.transaction=$root.proto.Transaction.decode(e,e.uint32());break}case 2:{i.record=$root.proto.TransactionRecord.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.RecordStreamItem\"},e}(),SidecarMetadata:function(){function e(e){if(this.types=[],e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.hash=$root.proto.HashObject.decode(e,e.uint32());break}case 2:{i.id=e.int32();break}case 3:{if(i.types&&i.types.length||(i.types=[]),2==(7&d))for(var a=e.uint32()+e.pos;e.pos>>3){case 1:{i.sidecarRecords&&i.sidecarRecords.length||(i.sidecarRecords=[]),i.sidecarRecords.push($root.proto.TransactionSidecarRecord.decode(e,e.uint32()));break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SidecarFile\"},e}(),TransactionSidecarRecord:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.consensusTimestamp=$root.proto.Timestamp.decode(e,e.uint32());break}case 2:{i.migration=e.bool();break}case 3:{i.stateChanges=$root.proto.ContractStateChanges.decode(e,e.uint32());break}case 4:{i.actions=$root.proto.ContractActions.decode(e,e.uint32());break}case 5:{i.bytecode=$root.proto.ContractBytecode.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.TransactionSidecarRecord\"},e}(),SignatureFile:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.fileSignature=$root.proto.SignatureObject.decode(e,e.uint32());break}case 2:{i.metadataSignature=$root.proto.SignatureObject.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SignatureFile\"},e}(),SignatureObject:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.type=e.int32();break}case 2:{i.length=e.int32();break}case 3:{i.checksum=e.int32();break}case 4:{i.signature=e.bytes();break}case 5:{i.hashObject=$root.proto.HashObject.decode(e,e.uint32());break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/proto.SignatureObject\"},e}(),SignatureType:function(){const e={},o=Object.create(e);return o[e[0]=\"SIGNATURE_TYPE_UNKNOWN\"]=0,o[e[1]=\"SHA_384_WITH_RSA\"]=1,o}()};return e})();exports.proto=proto;const google=$root.google=(()=>{const e={protobuf:function(){const e={DoubleValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.double();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.DoubleValue\"},e}(),FloatValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.float();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.FloatValue\"},e}(),Int64Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.int64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.Int64Value\"},e}(),UInt64Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.uint64();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.UInt64Value\"},e}(),Int32Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.int32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.Int32Value\"},e}(),UInt32Value:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.uint32();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.UInt32Value\"},e}(),BoolValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.bool();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.BoolValue\"},e}(),StringValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.string();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.StringValue\"},e}(),BytesValue:function(){function e(e){if(e)for(var o=Object.keys(e),t=0;t>>3){case 1:{i.value=e.bytes();break}default:e.skipType(7&d);}return i},e.getTypeUrl=function(e){return void 0===e&&(e=\"type.googleapis.com\"),e+\"/google.protobuf.BytesValue\"},e}()};return e}()};return e})();exports.google=google;\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/proto.js?"); +var inherits = __webpack_require__(5717); +var Buffer = (__webpack_require__(8764).Buffer); -/***/ }), +var DERDecoder = __webpack_require__(1671); -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/minimal.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/minimal.js ***! - \************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function PEMDecoder(entity) { + DERDecoder.call(this, entity); + this.enc = 'pem'; +}; +inherits(PEMDecoder, DERDecoder); +module.exports = PEMDecoder; -"use strict"; -eval("// minimal library entry point.\n\n\nmodule.exports = __webpack_require__(/*! ./src/index-minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/index-minimal.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/minimal.js?"); +PEMDecoder.prototype.decode = function decode(data, options) { + var lines = data.toString().split(/[\r\n]+/g); -/***/ }), + var label = options.label.toUpperCase(); -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/index-minimal.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/index-minimal.js ***! - \**********************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + var re = /^-----(BEGIN|END) ([^-]+)-----$/; + var start = -1; + var end = -1; + for (var i = 0; i < lines.length; i++) { + var match = lines[i].match(re); + if (match === null) + continue; -"use strict"; -eval("\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = __webpack_require__(/*! ./writer */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer.js\");\nprotobuf.BufferWriter = __webpack_require__(/*! ./writer_buffer */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer_buffer.js\");\nprotobuf.Reader = __webpack_require__(/*! ./reader */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader.js\");\nprotobuf.BufferReader = __webpack_require__(/*! ./reader_buffer */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader_buffer.js\");\n\n// Utility\nprotobuf.util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js\");\nprotobuf.rpc = __webpack_require__(/*! ./rpc */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc.js\");\nprotobuf.roots = __webpack_require__(/*! ./roots */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/roots.js\");\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/index-minimal.js?"); + if (match[2] !== label) + continue; -/***/ }), + if (start === -1) { + if (match[1] !== 'BEGIN') + break; + start = i; + } else { + if (match[1] !== 'END') + break; + end = i; + break; + } + } + if (start === -1 || end === -1) + throw new Error('PEM section not found for: ' + label); -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader.js ***! - \***************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var base64 = lines.slice(start + 1, end).join(''); + // Remove excessive symbols + base64.replace(/[^a-z0-9\+\/=]+/gi, ''); + + var input = new Buffer(base64, 'base64'); + return DERDecoder.prototype.decode.call(this, input, options); +}; -"use strict"; -eval("\nmodule.exports = Reader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader.js?"); /***/ }), -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader_buffer.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader_buffer.js ***! - \**********************************************************************************/ +/***/ 6984: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = __webpack_require__(/*! ./reader */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader.js\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/reader_buffer.js?"); +var inherits = __webpack_require__(5717); +var Buffer = (__webpack_require__(8764).Buffer); + +var asn1 = __webpack_require__(9809); +var base = asn1.base; + +// Import DER constants +var der = asn1.constants.der; + +function DEREncoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DEREncoder; + +DEREncoder.prototype.encode = function encode(data, reporter) { + return this.tree._encode(data, reporter).join(); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._encodeComposite = function encodeComposite(tag, + primitive, + cls, + content) { + var encodedTag = encodeTag(tag, primitive, cls, this.reporter); + + // Short form + if (content.length < 0x80) { + var header = new Buffer(2); + header[0] = encodedTag; + header[1] = content.length; + return this._createEncoderBuffer([ header, content ]); + } + + // Long form + // Count octets required to store length + var lenOctets = 1; + for (var i = content.length; i >= 0x100; i >>= 8) + lenOctets++; + + var header = new Buffer(1 + 1 + lenOctets); + header[0] = encodedTag; + header[1] = 0x80 | lenOctets; + + for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) + header[i] = j & 0xff; + + return this._createEncoderBuffer([ header, content ]); +}; + +DERNode.prototype._encodeStr = function encodeStr(str, tag) { + if (tag === 'bitstr') { + return this._createEncoderBuffer([ str.unused | 0, str.data ]); + } else if (tag === 'bmpstr') { + var buf = new Buffer(str.length * 2); + for (var i = 0; i < str.length; i++) { + buf.writeUInt16BE(str.charCodeAt(i), i * 2); + } + return this._createEncoderBuffer(buf); + } else if (tag === 'numstr') { + if (!this._isNumstr(str)) { + return this.reporter.error('Encoding of string type: numstr supports ' + + 'only digits and space'); + } + return this._createEncoderBuffer(str); + } else if (tag === 'printstr') { + if (!this._isPrintstr(str)) { + return this.reporter.error('Encoding of string type: printstr supports ' + + 'only latin upper and lower case letters, ' + + 'digits, space, apostrophe, left and rigth ' + + 'parenthesis, plus sign, comma, hyphen, ' + + 'dot, slash, colon, equal sign, ' + + 'question mark'); + } + return this._createEncoderBuffer(str); + } else if (/str$/.test(tag)) { + return this._createEncoderBuffer(str); + } else if (tag === 'objDesc') { + return this._createEncoderBuffer(str); + } else { + return this.reporter.error('Encoding of string type: ' + tag + + ' unsupported'); + } +}; + +DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { + if (typeof id === 'string') { + if (!values) + return this.reporter.error('string objid given, but no values map found'); + if (!values.hasOwnProperty(id)) + return this.reporter.error('objid not found in values map'); + id = values[id].split(/[\s\.]+/g); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } else if (Array.isArray(id)) { + id = id.slice(); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } + + if (!Array.isArray(id)) { + return this.reporter.error('objid() should be either array or string, ' + + 'got: ' + JSON.stringify(id)); + } + + if (!relative) { + if (id[1] >= 40) + return this.reporter.error('Second objid identifier OOB'); + id.splice(0, 2, id[0] * 40 + id[1]); + } + + // Count number of octets + var size = 0; + for (var i = 0; i < id.length; i++) { + var ident = id[i]; + for (size++; ident >= 0x80; ident >>= 7) + size++; + } + + var objid = new Buffer(size); + var offset = objid.length - 1; + for (var i = id.length - 1; i >= 0; i--) { + var ident = id[i]; + objid[offset--] = ident & 0x7f; + while ((ident >>= 7) > 0) + objid[offset--] = 0x80 | (ident & 0x7f); + } + + return this._createEncoderBuffer(objid); +}; + +function two(num) { + if (num < 10) + return '0' + num; + else + return num; +} + +DERNode.prototype._encodeTime = function encodeTime(time, tag) { + var str; + var date = new Date(time); + + if (tag === 'gentime') { + str = [ + two(date.getFullYear()), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else if (tag === 'utctime') { + str = [ + two(date.getFullYear() % 100), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else { + this.reporter.error('Encoding ' + tag + ' time is not supported yet'); + } + + return this._encodeStr(str, 'octstr'); +}; + +DERNode.prototype._encodeNull = function encodeNull() { + return this._createEncoderBuffer(''); +}; + +DERNode.prototype._encodeInt = function encodeInt(num, values) { + if (typeof num === 'string') { + if (!values) + return this.reporter.error('String int or enum given, but no values map'); + if (!values.hasOwnProperty(num)) { + return this.reporter.error('Values map doesn\'t contain: ' + + JSON.stringify(num)); + } + num = values[num]; + } + + // Bignum, assume big endian + if (typeof num !== 'number' && !Buffer.isBuffer(num)) { + var numArray = num.toArray(); + if (!num.sign && numArray[0] & 0x80) { + numArray.unshift(0); + } + num = new Buffer(numArray); + } + + if (Buffer.isBuffer(num)) { + var size = num.length; + if (num.length === 0) + size++; + + var out = new Buffer(size); + num.copy(out); + if (num.length === 0) + out[0] = 0 + return this._createEncoderBuffer(out); + } + + if (num < 0x80) + return this._createEncoderBuffer(num); + + if (num < 0x100) + return this._createEncoderBuffer([0, num]); + + var size = 1; + for (var i = num; i >= 0x100; i >>= 8) + size++; + + var out = new Array(size); + for (var i = out.length - 1; i >= 0; i--) { + out[i] = num & 0xff; + num >>= 8; + } + if(out[0] & 0x80) { + out.unshift(0); + } + + return this._createEncoderBuffer(new Buffer(out)); +}; + +DERNode.prototype._encodeBool = function encodeBool(value) { + return this._createEncoderBuffer(value ? 0xff : 0); +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getEncoder('der').tree; +}; + +DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { + var state = this._baseState; + var i; + if (state['default'] === null) + return false; + + var data = dataBuffer.join(); + if (state.defaultBuffer === undefined) + state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); + + if (data.length !== state.defaultBuffer.length) + return false; + + for (i=0; i < data.length; i++) + if (data[i] !== state.defaultBuffer[i]) + return false; + + return true; +}; + +// Utility methods + +function encodeTag(tag, primitive, cls, reporter) { + var res; + + if (tag === 'seqof') + tag = 'seq'; + else if (tag === 'setof') + tag = 'set'; + + if (der.tagByName.hasOwnProperty(tag)) + res = der.tagByName[tag]; + else if (typeof tag === 'number' && (tag | 0) === tag) + res = tag; + else + return reporter.error('Unknown tag: ' + tag); + + if (res >= 0x1f) + return reporter.error('Multi-octet tag encoding unsupported'); + + if (!primitive) + res |= 0x20; -/***/ }), + res |= (der.tagClassByName[cls || 'universal'] << 6); -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/roots.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/roots.js ***! - \**************************************************************************/ -/***/ (function(module) { + return res; +} -"use strict"; -eval("\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available across modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/roots.js?"); /***/ }), -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc.js ***! - \************************************************************************/ +/***/ 6579: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = __webpack_require__(/*! ./rpc/service */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc/service.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc.js?"); +var encoders = exports; + +encoders.der = __webpack_require__(6984); +encoders.pem = __webpack_require__(2883); + /***/ }), -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc/service.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc/service.js ***! - \********************************************************************************/ +/***/ 2883: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\nmodule.exports = Service;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js\");\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/rpc/service.js?"); +var inherits = __webpack_require__(5717); -/***/ }), +var DEREncoder = __webpack_require__(6984); -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/longbits.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/longbits.js ***! - \**********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function PEMEncoder(entity) { + DEREncoder.call(this, entity); + this.enc = 'pem'; +}; +inherits(PEMEncoder, DEREncoder); +module.exports = PEMEncoder; + +PEMEncoder.prototype.encode = function encode(data, options) { + var buf = DEREncoder.prototype.encode.call(this, data); + + var p = buf.toString('base64'); + var out = [ '-----BEGIN ' + options.label + '-----' ]; + for (var i = 0; i < p.length; i += 64) + out.push(p.slice(i, i + 64)); + out.push('-----END ' + options.label + '-----'); + return out.join('\n'); +}; -"use strict"; -eval("\nmodule.exports = LongBits;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/longbits.js?"); /***/ }), -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js ***! - \*********************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 9742: +/***/ (function(__unused_webpack_module, exports) { "use strict"; -eval("\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = __webpack_require__(/*! @protobufjs/aspromise */ \"./node_modules/@protobufjs/aspromise/index.js\");\n\n// converts to / from base64 encoded strings\nutil.base64 = __webpack_require__(/*! @protobufjs/base64 */ \"./node_modules/@protobufjs/base64/index.js\");\n\n// base class of rpc.Service\nutil.EventEmitter = __webpack_require__(/*! @protobufjs/eventemitter */ \"./node_modules/@protobufjs/eventemitter/index.js\");\n\n// float handling accross browsers\nutil.float = __webpack_require__(/*! @protobufjs/float */ \"./node_modules/@protobufjs/float/index.js\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = __webpack_require__(/*! @protobufjs/inquire */ \"./node_modules/@protobufjs/inquire/index.js\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = __webpack_require__(/*! @protobufjs/utf8 */ \"./node_modules/@protobufjs/utf8/index.js\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = __webpack_require__(/*! @protobufjs/pool */ \"./node_modules/@protobufjs/pool/index.js\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = __webpack_require__(/*! ./longbits */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/longbits.js\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof __webpack_require__.g !== \"undefined\"\n && __webpack_require__.g\n && __webpack_require__.g.process\n && __webpack_require__.g.process.versions\n && __webpack_require__.g.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && __webpack_require__.g\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n CustomError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: CustomError,\n writable: true,\n enumerable: false,\n configurable: true,\n },\n name: {\n get: function get() { return name; },\n set: undefined,\n enumerable: false,\n // configurable: false would accurately preserve the behavior of\n // the original, but I'm guessing that was not intentional.\n // For an actual error subclass, this property would\n // be configurable.\n configurable: true,\n },\n toString: {\n value: function value() { return this.name + \": \" + this.message; },\n writable: true,\n enumerable: false,\n configurable: true,\n },\n });\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer.js ***! - \***************************************************************************/ +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray + +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + + +/***/ }), + +/***/ 3550: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\nmodule.exports = Writer;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer.js?"); +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(6601).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // 'A' - 'F' + if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + // '0' - '9' + } else { + return (c - 48) & 0xf; + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; -/***/ }), + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 4497: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ "./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer_buffer.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer_buffer.js ***! - \**********************************************************************************/ +// based on the aes implimentation in triple sec +// https://github.com/keybase/triplesec +// which is in turn based on the one from crypto-js +// https://code.google.com/p/crypto-js/ + +var Buffer = (__webpack_require__(9509).Buffer) + +function asUInt32Array (buf) { + if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + + var len = (buf.length / 4) | 0 + var out = new Array(len) + + for (var i = 0; i < len; i++) { + out[i] = buf.readUInt32BE(i * 4) + } + + return out +} + +function scrubVec (v) { + for (var i = 0; i < v.length; v++) { + v[i] = 0 + } +} + +function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) { + var SUB_MIX0 = SUB_MIX[0] + var SUB_MIX1 = SUB_MIX[1] + var SUB_MIX2 = SUB_MIX[2] + var SUB_MIX3 = SUB_MIX[3] + + var s0 = M[0] ^ keySchedule[0] + var s1 = M[1] ^ keySchedule[1] + var s2 = M[2] ^ keySchedule[2] + var s3 = M[3] ^ keySchedule[3] + var t0, t1, t2, t3 + var ksRow = 4 + + for (var round = 1; round < nRounds; round++) { + t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++] + t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++] + t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++] + t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++] + s0 = t0 + s1 = t1 + s2 = t2 + s3 = t3 + } + + t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++] + t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++] + t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++] + t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++] + t0 = t0 >>> 0 + t1 = t1 >>> 0 + t2 = t2 >>> 0 + t3 = t3 >>> 0 + + return [t0, t1, t2, t3] +} + +// AES constants +var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36] +var G = (function () { + // Compute double table + var d = new Array(256) + for (var j = 0; j < 256; j++) { + if (j < 128) { + d[j] = j << 1 + } else { + d[j] = (j << 1) ^ 0x11b + } + } + + var SBOX = [] + var INV_SBOX = [] + var SUB_MIX = [[], [], [], []] + var INV_SUB_MIX = [[], [], [], []] + + // Walk GF(2^8) + var x = 0 + var xi = 0 + for (var i = 0; i < 256; ++i) { + // Compute sbox + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4) + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63 + SBOX[x] = sx + INV_SBOX[sx] = x + + // Compute multiplication + var x2 = d[x] + var x4 = d[x2] + var x8 = d[x4] + + // Compute sub bytes, mix columns tables + var t = (d[sx] * 0x101) ^ (sx * 0x1010100) + SUB_MIX[0][x] = (t << 24) | (t >>> 8) + SUB_MIX[1][x] = (t << 16) | (t >>> 16) + SUB_MIX[2][x] = (t << 8) | (t >>> 24) + SUB_MIX[3][x] = t + + // Compute inv sub bytes, inv mix columns tables + t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100) + INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8) + INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16) + INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24) + INV_SUB_MIX[3][sx] = t + + if (x === 0) { + x = xi = 1 + } else { + x = x2 ^ d[d[d[x8 ^ x2]]] + xi ^= d[d[xi]] + } + } + + return { + SBOX: SBOX, + INV_SBOX: INV_SBOX, + SUB_MIX: SUB_MIX, + INV_SUB_MIX: INV_SUB_MIX + } +})() + +function AES (key) { + this._key = asUInt32Array(key) + this._reset() +} + +AES.blockSize = 4 * 4 +AES.keySize = 256 / 8 +AES.prototype.blockSize = AES.blockSize +AES.prototype.keySize = AES.keySize +AES.prototype._reset = function () { + var keyWords = this._key + var keySize = keyWords.length + var nRounds = keySize + 6 + var ksRows = (nRounds + 1) * 4 + + var keySchedule = [] + for (var k = 0; k < keySize; k++) { + keySchedule[k] = keyWords[k] + } + + for (k = keySize; k < ksRows; k++) { + var t = keySchedule[k - 1] + + if (k % keySize === 0) { + t = (t << 8) | (t >>> 24) + t = + (G.SBOX[t >>> 24] << 24) | + (G.SBOX[(t >>> 16) & 0xff] << 16) | + (G.SBOX[(t >>> 8) & 0xff] << 8) | + (G.SBOX[t & 0xff]) + + t ^= RCON[(k / keySize) | 0] << 24 + } else if (keySize > 6 && k % keySize === 4) { + t = + (G.SBOX[t >>> 24] << 24) | + (G.SBOX[(t >>> 16) & 0xff] << 16) | + (G.SBOX[(t >>> 8) & 0xff] << 8) | + (G.SBOX[t & 0xff]) + } + + keySchedule[k] = keySchedule[k - keySize] ^ t + } + + var invKeySchedule = [] + for (var ik = 0; ik < ksRows; ik++) { + var ksR = ksRows - ik + var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)] + + if (ik < 4 || ksR <= 4) { + invKeySchedule[ik] = tt + } else { + invKeySchedule[ik] = + G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ + G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^ + G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^ + G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]] + } + } + + this._nRounds = nRounds + this._keySchedule = keySchedule + this._invKeySchedule = invKeySchedule +} + +AES.prototype.encryptBlockRaw = function (M) { + M = asUInt32Array(M) + return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds) +} + +AES.prototype.encryptBlock = function (M) { + var out = this.encryptBlockRaw(M) + var buf = Buffer.allocUnsafe(16) + buf.writeUInt32BE(out[0], 0) + buf.writeUInt32BE(out[1], 4) + buf.writeUInt32BE(out[2], 8) + buf.writeUInt32BE(out[3], 12) + return buf +} + +AES.prototype.decryptBlock = function (M) { + M = asUInt32Array(M) + + // swap + var m1 = M[1] + M[1] = M[3] + M[3] = m1 + + var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds) + var buf = Buffer.allocUnsafe(16) + buf.writeUInt32BE(out[0], 0) + buf.writeUInt32BE(out[3], 4) + buf.writeUInt32BE(out[2], 8) + buf.writeUInt32BE(out[1], 12) + return buf +} + +AES.prototype.scrub = function () { + scrubVec(this._keySchedule) + scrubVec(this._invKeySchedule) + scrubVec(this._key) +} + +module.exports.AES = AES + + +/***/ }), + +/***/ 2422: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = __webpack_require__(/*! ./writer */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer.js\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/node_modules/protobufjs/src/writer_buffer.js?"); +var aes = __webpack_require__(4497) +var Buffer = (__webpack_require__(9509).Buffer) +var Transform = __webpack_require__(1027) +var inherits = __webpack_require__(5717) +var GHASH = __webpack_require__(3288) +var xor = __webpack_require__(7295) +var incr32 = __webpack_require__(685) + +function xorTest (a, b) { + var out = 0 + if (a.length !== b.length) out++ + + var len = Math.min(a.length, b.length) + for (var i = 0; i < len; ++i) { + out += (a[i] ^ b[i]) + } + + return out +} + +function calcIv (self, iv, ck) { + if (iv.length === 12) { + self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])]) + return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])]) + } + var ghash = new GHASH(ck) + var len = iv.length + var toPad = len % 16 + ghash.update(iv) + if (toPad) { + toPad = 16 - toPad + ghash.update(Buffer.alloc(toPad, 0)) + } + ghash.update(Buffer.alloc(8, 0)) + var ivBits = len * 8 + var tail = Buffer.alloc(8) + tail.writeUIntBE(ivBits, 0, 8) + ghash.update(tail) + self._finID = ghash.state + var out = Buffer.from(self._finID) + incr32(out) + return out +} +function StreamCipher (mode, key, iv, decrypt) { + Transform.call(this) + + var h = Buffer.alloc(4, 0) + + this._cipher = new aes.AES(key) + var ck = this._cipher.encryptBlock(h) + this._ghash = new GHASH(ck) + iv = calcIv(this, iv, ck) + + this._prev = Buffer.from(iv) + this._cache = Buffer.allocUnsafe(0) + this._secCache = Buffer.allocUnsafe(0) + this._decrypt = decrypt + this._alen = 0 + this._len = 0 + this._mode = mode + + this._authTag = null + this._called = false +} + +inherits(StreamCipher, Transform) + +StreamCipher.prototype._update = function (chunk) { + if (!this._called && this._alen) { + var rump = 16 - (this._alen % 16) + if (rump < 16) { + rump = Buffer.alloc(rump, 0) + this._ghash.update(rump) + } + } + + this._called = true + var out = this._mode.encrypt(this, chunk) + if (this._decrypt) { + this._ghash.update(chunk) + } else { + this._ghash.update(out) + } + this._len += chunk.length + return out +} + +StreamCipher.prototype._final = function () { + if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data') + + var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID)) + if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data') + + this._authTag = tag + this._cipher.scrub() +} + +StreamCipher.prototype.getAuthTag = function getAuthTag () { + if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state') + + return this._authTag +} + +StreamCipher.prototype.setAuthTag = function setAuthTag (tag) { + if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state') + + this._authTag = tag +} + +StreamCipher.prototype.setAAD = function setAAD (buf) { + if (this._called) throw new Error('Attempting to set AAD in unsupported state') + + this._ghash.update(buf) + this._alen += buf.length +} + +module.exports = StreamCipher + + +/***/ }), + +/***/ 4696: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +var ciphers = __webpack_require__(1494) +var deciphers = __webpack_require__(6193) +var modes = __webpack_require__(4946) -/***/ "./node_modules/@hethers/abstract-provider/lib.esm/_version.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hethers/abstract-provider/lib.esm/_version.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +function getCiphers () { + return Object.keys(modes) +} + +exports.createCipher = exports.Cipher = ciphers.createCipher +exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv +exports.createDecipher = exports.Decipher = deciphers.createDecipher +exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv +exports.listCiphers = exports.getCiphers = getCiphers -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"abstract-provider/1.2.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-provider/lib.esm/_version.js?"); /***/ }), -/***/ "./node_modules/@hethers/abstract-provider/lib.esm/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hethers/abstract-provider/lib.esm/index.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 6193: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Provider\": function() { return /* binding */ Provider; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/abstract-provider/lib.esm/_version.js\");\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\n// Exported Abstracts\nclass Provider {\n constructor() {\n logger.checkAbstract(new.target, Provider);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, \"_isProvider\", true);\n }\n getHederaClient() {\n return logger.throwError(\"getHederaClient not implemented\", _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NOT_IMPLEMENTED, {\n operation: 'getHederaClient'\n });\n }\n getHederaNetworkConfig() {\n return logger.throwError(\"getHederaNetworkConfig not implemented\", _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NOT_IMPLEMENTED, {\n operation: 'getHederaNetworkConfig'\n });\n }\n // Latest State\n getGasPrice() {\n return logger.throwArgumentError(\"getGasPrice not implemented\", _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NOT_IMPLEMENTED, {\n operation: \"getGasPrice\"\n });\n }\n // Alias for \"on\"\n addListener(eventName, listener) {\n return this.on(eventName, listener);\n }\n // Alias for \"off\"\n removeListener(eventName, listener) {\n return this.off(eventName, listener);\n }\n static isProvider(value) {\n return !!(value && value._isProvider);\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-provider/lib.esm/index.js?"); +var AuthCipher = __webpack_require__(2422) +var Buffer = (__webpack_require__(9509).Buffer) +var MODES = __webpack_require__(45) +var StreamCipher = __webpack_require__(5969) +var Transform = __webpack_require__(1027) +var aes = __webpack_require__(4497) +var ebtk = __webpack_require__(3048) +var inherits = __webpack_require__(5717) + +function Decipher (mode, key, iv) { + Transform.call(this) + + this._cache = new Splitter() + this._last = void 0 + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._mode = mode + this._autopadding = true +} + +inherits(Decipher, Transform) + +Decipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + while ((chunk = this._cache.get(this._autopadding))) { + thing = this._mode.decrypt(this, chunk) + out.push(thing) + } + return Buffer.concat(out) +} + +Decipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + return unpad(this._mode.decrypt(this, chunk)) + } else if (chunk) { + throw new Error('data not multiple of block length') + } +} + +Decipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} + +function Splitter () { + this.cache = Buffer.allocUnsafe(0) +} + +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} + +Splitter.prototype.get = function (autoPadding) { + var out + if (autoPadding) { + if (this.cache.length > 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } else { + if (this.cache.length >= 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } + + return null +} + +Splitter.prototype.flush = function () { + if (this.cache.length) return this.cache +} + +function unpad (last) { + var padded = last[15] + if (padded < 1 || padded > 16) { + throw new Error('unable to decrypt data') + } + var i = -1 + while (++i < padded) { + if (last[(i + (16 - padded))] !== padded) { + throw new Error('unable to decrypt data') + } + } + if (padded === 16) return + + return last.slice(0, 16 - padded) +} + +function createDecipheriv (suite, password, iv) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + if (typeof iv === 'string') iv = Buffer.from(iv) + if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) + + if (typeof password === 'string') password = Buffer.from(password) + if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) + + if (config.type === 'stream') { + return new StreamCipher(config.module, password, iv, true) + } else if (config.type === 'auth') { + return new AuthCipher(config.module, password, iv, true) + } + + return new Decipher(config.module, password, iv) +} + +function createDecipher (suite, password) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + var keys = ebtk(password, false, config.key, config.iv) + return createDecipheriv(suite, keys.key, keys.iv) +} + +exports.createDecipher = createDecipher +exports.createDecipheriv = createDecipheriv + + +/***/ }), + +/***/ 1494: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +var MODES = __webpack_require__(45) +var AuthCipher = __webpack_require__(2422) +var Buffer = (__webpack_require__(9509).Buffer) +var StreamCipher = __webpack_require__(5969) +var Transform = __webpack_require__(1027) +var aes = __webpack_require__(4497) +var ebtk = __webpack_require__(3048) +var inherits = __webpack_require__(5717) + +function Cipher (mode, key, iv) { + Transform.call(this) + + this._cache = new Splitter() + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._mode = mode + this._autopadding = true +} + +inherits(Cipher, Transform) + +Cipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + + while ((chunk = this._cache.get())) { + thing = this._mode.encrypt(this, chunk) + out.push(thing) + } + + return Buffer.concat(out) +} + +var PADDING = Buffer.alloc(16, 0x10) + +Cipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + chunk = this._mode.encrypt(this, chunk) + this._cipher.scrub() + return chunk + } + + if (!chunk.equals(PADDING)) { + this._cipher.scrub() + throw new Error('data not multiple of block length') + } +} + +Cipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} + +function Splitter () { + this.cache = Buffer.allocUnsafe(0) +} + +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} + +Splitter.prototype.get = function () { + if (this.cache.length > 15) { + var out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + return null +} + +Splitter.prototype.flush = function () { + var len = 16 - this.cache.length + var padBuff = Buffer.allocUnsafe(len) + + var i = -1 + while (++i < len) { + padBuff.writeUInt8(len, i) + } + + return Buffer.concat([this.cache, padBuff]) +} + +function createCipheriv (suite, password, iv) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + if (typeof password === 'string') password = Buffer.from(password) + if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) + + if (typeof iv === 'string') iv = Buffer.from(iv) + if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) + + if (config.type === 'stream') { + return new StreamCipher(config.module, password, iv) + } else if (config.type === 'auth') { + return new AuthCipher(config.module, password, iv) + } + + return new Cipher(config.module, password, iv) +} + +function createCipher (suite, password) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') -/***/ "./node_modules/@hethers/abstract-signer/lib.esm/_version.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hethers/abstract-signer/lib.esm/_version.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + var keys = ebtk(password, false, config.key, config.iv) + return createCipheriv(suite, keys.key, keys.iv) +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"abstract-signer/1.2.1\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-signer/lib.esm/_version.js?"); +exports.createCipheriv = createCipheriv +exports.createCipher = createCipher -/***/ }), -/***/ "./node_modules/@hethers/abstract-signer/lib.esm/index.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hethers/abstract-signer/lib.esm/index.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ }), -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Signer\": function() { return /* binding */ Signer; },\n/* harmony export */ \"VoidSigner\": function() { return /* binding */ VoidSigner; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/abstract-signer/lib.esm/_version.js\");\n/* harmony import */ var _hethers_address__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @hethers/address */ \"./node_modules/@hethers/address/lib.esm/index.js\");\n/* harmony import */ var _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/sdk */ \"./node_modules/@hashgraph/sdk/src/browser.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(long__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/proto/lib/index.js\");\n\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\n\n\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger(_version__WEBPACK_IMPORTED_MODULE_4__.version);\nconst allowedTransactionKeys = [\n \"accessList\", \"chainId\", \"customData\", \"data\", \"from\", \"gasLimit\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"to\", \"type\", \"value\",\n \"nodeId\"\n];\n// oversize cost for 1 gas in ContractCallQuery\nconst CALL_GAS_PRICE_TINYBARS = 100;\n// the average default cost of a signed hedera ContractCallQuery\n// source https://github.com/hashgraph/hedera-services/blob/master/hedera-node/src/main/resources/feeSchedules.json\n// 1_000_000_000_000_000 / 100_000_000 (to hbars) / 10_000_000 (coef to weibars) = 1 hbar or 100_000_000 weibars\nconst DEFAULT_HEDERA_CALL_TX_FEE = 100000000;\nconst TX_FEE_BUFFER_MULTIPLIER = 2;\n;\n;\nfunction checkError(method, error, txRequest) {\n switch (error.status._code) {\n // insufficient gas\n case 30:\n return logger.throwError(\"insufficient funds for gas cost\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.CALL_EXCEPTION, { tx: txRequest });\n // insufficient payer balance\n case 10:\n return logger.throwError(\"insufficient funds in payer account\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.INSUFFICIENT_FUNDS, { tx: txRequest });\n // insufficient tx fee\n case 9:\n return logger.throwError(\"transaction fee too low\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.INSUFFICIENT_FUNDS, { tx: txRequest });\n // invalid signature\n case 7:\n return logger.throwError(\"invalid transaction signature\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.UNKNOWN_ERROR, { tx: txRequest });\n // invalid contract id\n case 16:\n return logger.throwError(\"invalid contract address\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.INVALID_ARGUMENT, { tx: txRequest });\n // contract revert\n case 33:\n return logger.throwError(\"contract execution reverted\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.CALL_EXCEPTION, { tx: txRequest });\n }\n throw error;\n}\nclass Signer {\n ///////////////////\n // Sub-classes MUST call super\n constructor() {\n logger.checkAbstract(new.target, Signer);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, \"_isSigner\", true);\n }\n getGasPrice() {\n return __awaiter(this, void 0, void 0, function* () {\n this._checkProvider(\"getGasPrice\");\n return yield this.provider.getGasPrice();\n });\n }\n ///////////////////\n // Sub-classes MAY override these\n getBalance() {\n return __awaiter(this, void 0, void 0, function* () {\n this._checkProvider(\"getBalance\");\n return yield this.provider.getBalance(this.getAddress());\n });\n }\n // Populates \"from\" if unspecified, and estimates the gas for the transaction\n estimateGas(transaction) {\n return __awaiter(this, void 0, void 0, function* () {\n this._checkProvider(\"estimateGas\");\n const tx = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)(this.checkTransaction(transaction));\n // cost-answer query on hedera\n return yield this.provider.estimateGas(tx);\n });\n }\n // super classes should override this for now\n call(txRequest) {\n return __awaiter(this, void 0, void 0, function* () {\n this._checkProvider(\"call\");\n const tx = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)(this.checkTransaction(txRequest));\n const to = (0,_hethers_address__WEBPACK_IMPORTED_MODULE_6__.asAccountString)(tx.to);\n const from = (0,_hethers_address__WEBPACK_IMPORTED_MODULE_6__.asAccountString)(yield this.getAddress());\n const nodeID = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.AccountId.fromString((0,_hethers_address__WEBPACK_IMPORTED_MODULE_6__.asAccountString)(tx.nodeId));\n const paymentTxId = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.TransactionId.generate(from);\n const hederaTx = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.ContractCallQuery()\n .setFunctionParameters((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.arrayify)(tx.data))\n .setNodeAccountIds([nodeID])\n .setGas(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_8__.BigNumber.from(tx.gasLimit).toNumber())\n .setPaymentTransactionId(paymentTxId);\n if (tx.customData.usingContractAlias) {\n hederaTx.setContractId(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.ContractId.fromEvmAddress(0, 0, tx.to.toString()));\n }\n else {\n hederaTx.setContractId(to);\n }\n const gasLimit = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_8__.BigNumber.from(tx.gasLimit).toNumber();\n const baseCost = DEFAULT_HEDERA_CALL_TX_FEE * TX_FEE_BUFFER_MULTIPLIER;\n const cost = baseCost + gasLimit * CALL_GAS_PRICE_TINYBARS;\n const paymentBody = {\n transactionID: paymentTxId._toProtobuf(),\n nodeAccountID: nodeID._toProtobuf(),\n transactionFee: _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Hbar.fromTinybars(baseCost).toTinybars(),\n transactionValidDuration: {\n seconds: long__WEBPACK_IMPORTED_MODULE_1__.fromInt(120),\n },\n cryptoTransfer: {\n transfers: {\n accountAmounts: [\n {\n accountID: _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.AccountId.fromString(from)._toProtobuf(),\n amount: _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Hbar.fromTinybars(cost).negated().toTinybars()\n },\n {\n accountID: nodeID._toProtobuf(),\n amount: _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Hbar.fromTinybars(cost).toTinybars()\n }\n ],\n },\n },\n };\n const signed = {\n bodyBytes: _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.TransactionBody.encode(paymentBody).finish(),\n sigMap: {}\n };\n const walletKey = this.isED25519Type\n ? _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromStringED25519(this._signingKey().privateKey)\n : _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromStringECDSA(this._signingKey().privateKey);\n const signature = walletKey.sign(signed.bodyBytes);\n signed.sigMap = {\n sigPair: [walletKey.publicKey._toProtobufSignature(signature)]\n };\n const transferSignedTransactionBytes = _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.SignedTransaction.encode(signed).finish();\n hederaTx._paymentTransactions.push({\n signedTransactionBytes: transferSignedTransactionBytes\n });\n try {\n const response = yield hederaTx.execute(this.provider.getHederaClient());\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_7__.hexlify)(response.bytes);\n }\n catch (error) {\n return checkError('call', error, tx);\n }\n });\n }\n /**\n * Composes a transaction which is signed and sent to the provider's network.\n * @param transaction - the actual tx\n */\n sendTransaction(transaction) {\n return __awaiter(this, void 0, void 0, function* () {\n const tx = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)(transaction);\n if (tx.to) {\n const signed = yield this.signTransaction(tx);\n return yield this.provider.sendTransaction(signed);\n }\n else {\n const contractByteCode = tx.data;\n let chunks = splitInChunks(Buffer.from(contractByteCode.toString()).toString(), 4096);\n const fileCreate = {\n customData: {\n fileChunk: chunks[0],\n fileKey: _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PublicKey.fromString(this._signingKey().compressedPublicKey)\n }\n };\n const signedFileCreate = yield this.signTransaction(fileCreate);\n const resp = yield this.provider.sendTransaction(signedFileCreate);\n for (let chunk of chunks.slice(1)) {\n const fileAppend = {\n customData: {\n fileId: resp.customData.fileId.toString(),\n fileChunk: chunk\n }\n };\n const signedFileAppend = yield this.signTransaction(fileAppend);\n yield this.provider.sendTransaction(signedFileAppend);\n }\n const contractCreate = {\n gasLimit: tx.gasLimit,\n value: tx.value || 0,\n customData: {\n bytecodeFileId: resp.customData.fileId.toString(),\n // @ts-ignore\n maxAutomaticTokenAssociations: transaction.customData.maxAutomaticTokenAssociations\n }\n };\n const signedContractCreate = yield this.signTransaction(contractCreate);\n return yield this.provider.sendTransaction(signedContractCreate);\n }\n });\n }\n getChainId() {\n return __awaiter(this, void 0, void 0, function* () {\n this._checkProvider(\"getChainId\");\n const network = yield this.provider.getNetwork();\n return network.chainId;\n });\n }\n /**\n * Checks if the given transaction is usable.\n * Properties - `from`, `nodeId`, `gasLimit`\n * @param transaction - the tx to be checked\n */\n checkTransaction(transaction) {\n for (const key in transaction) {\n if (allowedTransactionKeys.indexOf(key) === -1) {\n logger.throwArgumentError(\"invalid transaction key: \" + key, \"transaction\", transaction);\n }\n }\n const tx = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.shallowCopy)(transaction);\n if (!tx.nodeId) {\n this._checkProvider();\n // provider present, we can go on\n const submittableNodeIDs = this.provider.getHederaNetworkConfig();\n if (submittableNodeIDs.length > 0) {\n tx.nodeId = submittableNodeIDs[randomNumBetween(0, submittableNodeIDs.length - 1)].toString();\n }\n else {\n logger.throwError(\"Unable to find submittable node ID. The signer's provider is not connected to any usable network\");\n }\n }\n if (tx.from == null) {\n tx.from = this.getAddress();\n }\n else {\n // Make sure any provided address matches this signer\n tx.from = Promise.all([\n Promise.resolve(tx.from),\n this.getAddress()\n ]).then((result) => {\n if (result[0].toString().toLowerCase() !== result[1].toLowerCase()) {\n logger.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n return result[0];\n });\n }\n tx.gasLimit = transaction.gasLimit;\n return tx;\n }\n /**\n * Populates any missing properties in a transaction request.\n * Properties affected - `to`, `chainId`\n * @param transaction\n */\n populateTransaction(transaction) {\n return __awaiter(this, void 0, void 0, function* () {\n const tx = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)(this.checkTransaction(transaction));\n if (tx.to != null) {\n tx.to = Promise.resolve(tx.to).then((to) => __awaiter(this, void 0, void 0, function* () {\n if (to == null) {\n return null;\n }\n return (0,_hethers_address__WEBPACK_IMPORTED_MODULE_6__.getChecksumAddress)((0,_hethers_address__WEBPACK_IMPORTED_MODULE_6__.getAddressFromAccount)(to));\n }));\n // Prevent this error from causing an UnhandledPromiseException\n tx.to.catch((error) => { });\n }\n let isCryptoTransfer = false;\n if (tx.to && tx.value) {\n if (!tx.data && !tx.gasLimit) {\n isCryptoTransfer = true;\n }\n else if (tx.data && !tx.gasLimit) {\n logger.throwError(\"gasLimit is not provided. Cannot execute a Contract Call\");\n }\n else if (!tx.data && tx.gasLimit) {\n this._checkProvider();\n if ((yield this.provider.getCode(tx.to)) === '0x') {\n logger.throwError(\"receiver is an account. Cannot execute a Contract Call\");\n }\n }\n }\n tx.customData = Object.assign(Object.assign({}, tx.customData), { isCryptoTransfer });\n const customData = yield tx.customData;\n // FileCreate and FileAppend always carry a customData.fileChunk object\n const isFileCreateOrAppend = customData && customData.fileChunk;\n // CreateAccount always has a publicKey\n const isCreateAccount = customData && customData.publicKey;\n if (!isFileCreateOrAppend && !isCreateAccount && !tx.customData.isCryptoTransfer && tx.gasLimit == null) {\n return logger.throwError(\"cannot estimate gas; transaction requires manual gas limit\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { tx: tx });\n }\n return yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)(tx);\n });\n }\n ///////////////////\n // Sub-classes SHOULD leave these alone\n _checkProvider(operation) {\n if (!this.provider) {\n logger.throwError(\"missing provider\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: (operation || \"_checkProvider\")\n });\n }\n }\n static isSigner(value) {\n return !!(value && value._isSigner);\n }\n}\nclass VoidSigner extends Signer {\n constructor(address, provider) {\n logger.checkNew(new.target, VoidSigner);\n super();\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, \"address\", address);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, \"provider\", provider || null);\n }\n getAddress() {\n return Promise.resolve(this.address);\n }\n _fail(message, operation) {\n return Promise.resolve().then(() => {\n logger.throwError(message, _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.UNSUPPORTED_OPERATION, { operation: operation });\n });\n }\n signMessage(message) {\n return this._fail(\"VoidSigner cannot sign messages\", \"signMessage\");\n }\n signTransaction(transaction) {\n return this._fail(\"VoidSigner cannot sign transactions\", \"signTransaction\");\n }\n createAccount(pubKey, initialBalance) {\n return this._fail(\"VoidSigner cannot create accounts\", \"createAccount\");\n }\n _signTypedData(domain, types, value) {\n return this._fail(\"VoidSigner cannot sign typed data\", \"signTypedData\");\n }\n connect(provider) {\n return new VoidSigner(this.address, provider);\n }\n}\n/**\n * Generates a random integer in the given range\n * @param min - range start\n * @param max - range end\n */\nfunction randomNumBetween(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n/**\n * Splits data (utf8) into chunks with the given size\n * @param data\n * @param chunkSize\n */\nfunction splitInChunks(data, chunkSize) {\n const chunks = [];\n let num = 0;\n while (num <= data.length) {\n const slice = data.slice(num, chunkSize + num);\n num += chunkSize;\n chunks.push(slice);\n }\n return chunks;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-signer/lib.esm/index.js?"); +/***/ 3288: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ }), +var Buffer = (__webpack_require__(9509).Buffer) +var ZEROES = Buffer.alloc(16, 0) + +function toArray (buf) { + return [ + buf.readUInt32BE(0), + buf.readUInt32BE(4), + buf.readUInt32BE(8), + buf.readUInt32BE(12) + ] +} + +function fromArray (out) { + var buf = Buffer.allocUnsafe(16) + buf.writeUInt32BE(out[0] >>> 0, 0) + buf.writeUInt32BE(out[1] >>> 0, 4) + buf.writeUInt32BE(out[2] >>> 0, 8) + buf.writeUInt32BE(out[3] >>> 0, 12) + return buf +} + +function GHASH (key) { + this.h = key + this.state = Buffer.alloc(16, 0) + this.cache = Buffer.allocUnsafe(0) +} + +// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html +// by Juho Vähä-Herttua +GHASH.prototype.ghash = function (block) { + var i = -1 + while (++i < block.length) { + this.state[i] ^= block[i] + } + this._multiply() +} + +GHASH.prototype._multiply = function () { + var Vi = toArray(this.h) + var Zi = [0, 0, 0, 0] + var j, xi, lsbVi + var i = -1 + while (++i < 128) { + xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0 + if (xi) { + // Z_i+1 = Z_i ^ V_i + Zi[0] ^= Vi[0] + Zi[1] ^= Vi[1] + Zi[2] ^= Vi[2] + Zi[3] ^= Vi[3] + } + + // Store the value of LSB(V_i) + lsbVi = (Vi[3] & 1) !== 0 + + // V_i+1 = V_i >> 1 + for (j = 3; j > 0; j--) { + Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31) + } + Vi[0] = Vi[0] >>> 1 + + // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R + if (lsbVi) { + Vi[0] = Vi[0] ^ (0xe1 << 24) + } + } + this.state = fromArray(Zi) +} + +GHASH.prototype.update = function (buf) { + this.cache = Buffer.concat([this.cache, buf]) + var chunk + while (this.cache.length >= 16) { + chunk = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + this.ghash(chunk) + } +} + +GHASH.prototype.final = function (abl, bl) { + if (this.cache.length) { + this.ghash(Buffer.concat([this.cache, ZEROES], 16)) + } + + this.ghash(fromArray([0, abl, 0, bl])) + return this.state +} + +module.exports = GHASH + + +/***/ }), + +/***/ 685: +/***/ (function(module) { -/***/ "./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/_version.js": -/*!*********************************************************************************************************!*\ - !*** ./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! - \*********************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +function incr32 (iv) { + var len = iv.length + var item + while (len--) { + item = iv.readUInt8(len) + if (item === 255) { + iv.writeUInt8(0, len) + } else { + item++ + iv.writeUInt8(item, len) + break + } + } +} +module.exports = incr32 -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bignumber/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/_version.js?"); /***/ }), -/***/ "./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": -/*!**********************************************************************************************************!*\ - !*** ./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! - \**********************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 5292: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigNumber\": function() { return /* binding */ BigNumber; },\n/* harmony export */ \"_base16To36\": function() { return /* binding */ _base16To36; },\n/* harmony export */ \"_base36To16\": function() { return /* binding */ _base36To16; },\n/* harmony export */ \"isBigNumberish\": function() { return /* binding */ isBigNumberish; }\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/_version.js\");\n\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\n\nvar BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN);\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nfunction isBigNumberish(value) {\n return (value != null) && (BigNumber.isBigNumber(value) ||\n (typeof (value) === \"number\" && (value % 1) === 0) ||\n (typeof (value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) ||\n (typeof (value) === \"bigint\") ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nclass BigNumber {\n constructor(constructorGuard, hex) {\n logger.checkNew(new.target, BigNumber);\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division by zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot modulo negative values\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot raise to negative values\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'and' negative values\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'or' negative values\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'xor' negative values\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot mask negative values\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return (this._hex[0] === \"-\");\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof (value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof (value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof (anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) {\n return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof (hex) === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof (hex) === \"string\") {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === \"-\" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof (value) !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nfunction _base36To16(value) {\n return (new BN(value, 36)).toString(16);\n}\n// value should have no prefix\nfunction _base16To36(value) {\n return (new BN(value, 16)).toString(36);\n}\n//# sourceMappingURL=bignumber.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js?"); +var xor = __webpack_require__(7295) -/***/ }), +exports.encrypt = function (self, block) { + var data = xor(block, self._prev) -/***/ "./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!*****************************************************************************************************!*\ - !*** ./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \*****************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + self._prev = self._cipher.encryptBlock(data) + return self._prev +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/_version.js?"); +exports.decrypt = function (self, block) { + var pad = self._prev -/***/ }), + self._prev = block + var out = self._cipher.decryptBlock(block) -/***/ "./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \**************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return xor(out, pad) +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/abstract-signer/node_modules/@ethersproject/bytes/lib.esm/index.js?"); /***/ }), -/***/ "./node_modules/@hethers/address/lib.esm/_version.js": -/*!***********************************************************!*\ - !*** ./node_modules/@hethers/address/lib.esm/_version.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 6311: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"address/1.2.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/address/lib.esm/_version.js?"); +var Buffer = (__webpack_require__(9509).Buffer) +var xor = __webpack_require__(7295) -/***/ }), +function encryptStart (self, data, decrypt) { + var len = data.length + var out = xor(data, self._cache) + self._cache = self._cache.slice(len) + self._prev = Buffer.concat([self._prev, decrypt ? data : out]) + return out +} -/***/ "./node_modules/@hethers/address/lib.esm/index.js": -/*!********************************************************!*\ - !*** ./node_modules/@hethers/address/lib.esm/index.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +exports.encrypt = function (self, data, decrypt) { + var out = Buffer.allocUnsafe(0) + var len -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"asAccountString\": function() { return /* binding */ asAccountString; },\n/* harmony export */ \"getAccountFromAddress\": function() { return /* binding */ getAccountFromAddress; },\n/* harmony export */ \"getAccountFromTransactionId\": function() { return /* binding */ getAccountFromTransactionId; },\n/* harmony export */ \"getAddress\": function() { return /* binding */ getAddress; },\n/* harmony export */ \"getAddressFromAccount\": function() { return /* binding */ getAddressFromAccount; },\n/* harmony export */ \"getChecksumAddress\": function() { return /* binding */ getChecksumAddress; },\n/* harmony export */ \"getCreate2Address\": function() { return /* binding */ getCreate2Address; },\n/* harmony export */ \"getIcapAddress\": function() { return /* binding */ getIcapAddress; },\n/* harmony export */ \"isAddress\": function() { return /* binding */ isAddress; },\n/* harmony export */ \"parseAccount\": function() { return /* binding */ parseAccount; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@hethers/address/node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/address/lib.esm/_version.js\");\n\n\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction getAccountFromTransactionId(transactionId) {\n // TransactionId look like this: '0.0.99999999-9999999999-999999999'\n // or like this: '0.0.99999999@9999999999-999999999'\n if (!transactionId.match(/^\\d+?\\.\\d+?\\.\\d+[-|@]\\d+-\\d+$/)) {\n logger.throwArgumentError(\"invalid transactionId\", \"transactionId\", transactionId);\n }\n let splitSymbol = transactionId.indexOf('@') === -1 ? '-' : '@';\n const account = transactionId.split(splitSymbol);\n return account[0];\n}\nfunction asAccountString(accountLike) {\n let parsedAccount = typeof (accountLike) === \"string\" ? parseAccount(accountLike) : accountLike;\n return `${parsedAccount.shard}.${parsedAccount.realm}.${parsedAccount.num}`;\n}\nfunction getChecksumAddress(address) {\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isHexString)(address, 20)) {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n address = address.toLowerCase();\n const chars = address.substring(2).split(\"\");\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n const hashed = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)(expanded));\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return \"0x\" + chars.join(\"\");\n}\n// Shims for environments that are missing some required constants and functions\nconst MAX_SAFE_INTEGER = 0x1fffffffffffff;\nfunction log10(x) {\n if (Math.log10) {\n return Math.log10(x);\n }\n return Math.log(x) / Math.LN10;\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\nconst safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address.split(\"\").map((c) => {\n return ibanLookup[c];\n }).join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\nfunction getAddress(address) {\n let result = null;\n if (typeof (address) !== \"string\") {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (address.substring(0, 2) !== \"0x\") {\n address = \"0x\" + address;\n }\n result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {\n logger.throwArgumentError(\"bad address checksum\", \"address\", address);\n }\n // Maybe ICAP? (we only support direct mode)\n }\n else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n if (address.substring(2, 4) !== ibanChecksum(address)) {\n logger.throwArgumentError(\"bad icap checksum\", \"address\", address);\n }\n result = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base36To16)(address.substring(4));\n while (result.length < 40) {\n result = \"0\" + result;\n }\n result = getChecksumAddress(\"0x\" + result);\n }\n else {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n return result;\n}\nfunction isAddress(address) {\n try {\n getAddress(address);\n return true;\n }\n catch (error) {\n }\n return false;\n}\nfunction getIcapAddress(address) {\n let base36 = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base16To36)(getAddress(address).substring(2)).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\" + base36;\n }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\nfunction getCreate2Address(from, salt, initCodeHash) {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(salt) !== 32) {\n logger.throwArgumentError(\"salt must be 32 bytes\", \"salt\", salt);\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(initCodeHash) !== 32) {\n logger.throwArgumentError(\"initCodeHash must be 32 bytes\", \"initCodeHash\", initCodeHash);\n }\n return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.concat)([\"0xff\", getAddress(from), salt, initCodeHash])), 12));\n}\nfunction getAddressFromAccount(accountLike) {\n let parsedAccount = typeof (accountLike) === \"string\" ? parseAccount(accountLike) : accountLike;\n const buffer = new Uint8Array(20);\n const view = new DataView(buffer.buffer, 0, 20);\n view.setInt32(0, Number(parsedAccount.shard));\n view.setBigInt64(4, parsedAccount.realm);\n view.setBigInt64(12, parsedAccount.num);\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(buffer);\n}\nfunction getAccountFromAddress(address) {\n let buffer = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(getAddress(address));\n const view = new DataView(buffer.buffer, 0, 20);\n return {\n shard: BigInt(view.getInt32(0)),\n realm: BigInt(view.getBigInt64(4)),\n num: BigInt(view.getBigInt64(12))\n };\n}\nfunction parseAccount(account) {\n let result = null;\n if (typeof (account) !== \"string\") {\n logger.throwArgumentError(\"invalid account\", \"account\", account);\n }\n if (account.match(/^[0-9]+\\.[0-9]+\\.[0-9]+$/)) {\n let parsedAccount = account.split('.');\n result = {\n shard: BigInt(parsedAccount[0]),\n realm: BigInt(parsedAccount[1]),\n num: BigInt(parsedAccount[2])\n };\n }\n else if (isAddress(account)) {\n result = getAccountFromAddress(account);\n }\n else {\n logger.throwArgumentError(\"invalid account\", \"account\", account);\n }\n return result;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/address/lib.esm/index.js?"); + while (data.length) { + if (self._cache.length === 0) { + self._cache = self._cipher.encryptBlock(self._prev) + self._prev = Buffer.allocUnsafe(0) + } -/***/ }), + if (self._cache.length <= data.length) { + len = self._cache.length + out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]) + data = data.slice(len) + } else { + out = Buffer.concat([out, encryptStart(self, data, decrypt)]) + break + } + } -/***/ "./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js": -/*!*************************************************************************************************!*\ - !*** ./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! - \*************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return out +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bignumber/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js?"); /***/ }), -/***/ "./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! - \**************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigNumber\": function() { return /* binding */ BigNumber; },\n/* harmony export */ \"_base16To36\": function() { return /* binding */ _base16To36; },\n/* harmony export */ \"_base36To16\": function() { return /* binding */ _base36To16; },\n/* harmony export */ \"isBigNumberish\": function() { return /* binding */ isBigNumberish; }\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/_version.js\");\n\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\n\nvar BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN);\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nfunction isBigNumberish(value) {\n return (value != null) && (BigNumber.isBigNumber(value) ||\n (typeof (value) === \"number\" && (value % 1) === 0) ||\n (typeof (value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) ||\n (typeof (value) === \"bigint\") ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nclass BigNumber {\n constructor(constructorGuard, hex) {\n logger.checkNew(new.target, BigNumber);\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division by zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot modulo negative values\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot raise to negative values\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'and' negative values\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'or' negative values\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'xor' negative values\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot mask negative values\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return (this._hex[0] === \"-\");\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof (value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof (value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof (anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) {\n return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof (hex) === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof (hex) === \"string\") {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === \"-\" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof (value) !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nfunction _base36To16(value) {\n return (new BN(value, 36)).toString(16);\n}\n// value should have no prefix\nfunction _base16To36(value) {\n return (new BN(value, 16)).toString(36);\n}\n//# sourceMappingURL=bignumber.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/address/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js?"); +/***/ 1510: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +var Buffer = (__webpack_require__(9509).Buffer) -/***/ "./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!*********************************************************************************************!*\ - !*** ./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \*********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +function encryptByte (self, byteParam, decrypt) { + var pad + var i = -1 + var len = 8 + var out = 0 + var bit, value + while (++i < len) { + pad = self._cipher.encryptBlock(self._prev) + bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0 + value = pad[0] ^ bit + out += ((value & 0x80) >> (i % 8)) + self._prev = shiftIn(self._prev, decrypt ? bit : value) + } + return out +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/_version.js?"); +function shiftIn (buffer, value) { + var len = buffer.length + var i = -1 + var out = Buffer.allocUnsafe(buffer.length) + buffer = Buffer.concat([buffer, Buffer.from([value])]) -/***/ }), + while (++i < len) { + out[i] = buffer[i] << 1 | buffer[i + 1] >> (7) + } -/***/ "./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!******************************************************************************************!*\ - !*** ./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \******************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return out +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/index.js?"); +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length + var out = Buffer.allocUnsafe(len) + var i = -1 -/***/ }), + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt) + } -/***/ "./node_modules/@hethers/address/node_modules/@ethersproject/keccak256/lib.esm/index.js": -/*!**********************************************************************************************!*\ - !*** ./node_modules/@hethers/address/node_modules/@ethersproject/keccak256/lib.esm/index.js ***! - \**********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return out +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"keccak256\": function() { return /* binding */ keccak256; }\n/* harmony export */ });\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ \"./node_modules/js-sha3/src/sha3.js\");\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/address/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n\n\n\nfunction keccak256(data) {\n return '0x' + js_sha3__WEBPACK_IMPORTED_MODULE_0___default().keccak_256((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(data));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/address/node_modules/@ethersproject/keccak256/lib.esm/index.js?"); /***/ }), -/***/ "./node_modules/@hethers/constants/lib.esm/bignumbers.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hethers/constants/lib.esm/bignumbers.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 1964: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MaxInt256\": function() { return /* binding */ MaxInt256; },\n/* harmony export */ \"MaxUint256\": function() { return /* binding */ MaxUint256; },\n/* harmony export */ \"MinInt256\": function() { return /* binding */ MinInt256; },\n/* harmony export */ \"NegativeOne\": function() { return /* binding */ NegativeOne; },\n/* harmony export */ \"One\": function() { return /* binding */ One; },\n/* harmony export */ \"TinybarPerHbar\": function() { return /* binding */ TinybarPerHbar; },\n/* harmony export */ \"Two\": function() { return /* binding */ Two; },\n/* harmony export */ \"WeiPerEther\": function() { return /* binding */ WeiPerEther; },\n/* harmony export */ \"Zero\": function() { return /* binding */ Zero; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n\nconst NegativeOne = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(-1));\nconst Zero = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(0));\nconst One = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(1));\nconst Two = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(2));\nconst WeiPerEther = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"1000000000000000000\"));\nconst MaxUint256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\nconst TinybarPerHbar = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"100000000\"));\nconst MinInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"-0x8000000000000000000000000000000000000000000000000000000000000000\"));\nconst MaxInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\n\n//# sourceMappingURL=bignumbers.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/constants/lib.esm/bignumbers.js?"); +var Buffer = (__webpack_require__(9509).Buffer) -/***/ }), +function encryptByte (self, byteParam, decrypt) { + var pad = self._cipher.encryptBlock(self._prev) + var out = pad[0] ^ byteParam -/***/ "./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/_version.js": -/*!***************************************************************************************************!*\ - !*** ./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! - \***************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + self._prev = Buffer.concat([ + self._prev.slice(1), + Buffer.from([decrypt ? byteParam : out]) + ]) -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bignumber/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/_version.js?"); + return out +} -/***/ }), +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length + var out = Buffer.allocUnsafe(len) + var i = -1 -/***/ "./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": -/*!****************************************************************************************************!*\ - !*** ./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! - \****************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt) + } + + return out +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigNumber\": function() { return /* binding */ BigNumber; },\n/* harmony export */ \"_base16To36\": function() { return /* binding */ _base16To36; },\n/* harmony export */ \"_base36To16\": function() { return /* binding */ _base36To16; },\n/* harmony export */ \"isBigNumberish\": function() { return /* binding */ isBigNumberish; }\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/_version.js\");\n\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\n\nvar BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN);\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nfunction isBigNumberish(value) {\n return (value != null) && (BigNumber.isBigNumber(value) ||\n (typeof (value) === \"number\" && (value % 1) === 0) ||\n (typeof (value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) ||\n (typeof (value) === \"bigint\") ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nclass BigNumber {\n constructor(constructorGuard, hex) {\n logger.checkNew(new.target, BigNumber);\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division by zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot modulo negative values\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot raise to negative values\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'and' negative values\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'or' negative values\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'xor' negative values\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot mask negative values\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return (this._hex[0] === \"-\");\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof (value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof (value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof (anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) {\n return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof (hex) === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof (hex) === \"string\") {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === \"-\" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof (value) !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nfunction _base36To16(value) {\n return (new BN(value, 36)).toString(16);\n}\n// value should have no prefix\nfunction _base16To36(value) {\n return (new BN(value, 16)).toString(36);\n}\n//# sourceMappingURL=bignumber.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/constants/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js?"); /***/ }), -/***/ "./node_modules/@hethers/hdnode/lib.esm/_version.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hethers/hdnode/lib.esm/_version.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 6009: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"hdnode/1.2.1\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/lib.esm/_version.js?"); +var xor = __webpack_require__(7295) +var Buffer = (__webpack_require__(9509).Buffer) +var incr32 = __webpack_require__(685) + +function getBlock (self) { + var out = self._cipher.encryptBlockRaw(self._prev) + incr32(self._prev) + return out +} + +var blockSize = 16 +exports.encrypt = function (self, chunk) { + var chunkNum = Math.ceil(chunk.length / blockSize) + var start = self._cache.length + self._cache = Buffer.concat([ + self._cache, + Buffer.allocUnsafe(chunkNum * blockSize) + ]) + for (var i = 0; i < chunkNum; i++) { + var out = getBlock(self) + var offset = start + i * blockSize + self._cache.writeUInt32BE(out[0], offset + 0) + self._cache.writeUInt32BE(out[1], offset + 4) + self._cache.writeUInt32BE(out[2], offset + 8) + self._cache.writeUInt32BE(out[3], offset + 12) + } + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} + + +/***/ }), + +/***/ 1084: +/***/ (function(__unused_webpack_module, exports) { -/***/ }), +exports.encrypt = function (self, block) { + return self._cipher.encryptBlock(block) +} -/***/ "./node_modules/@hethers/hdnode/lib.esm/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hethers/hdnode/lib.esm/index.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +exports.decrypt = function (self, block) { + return self._cipher.decryptBlock(block) +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HDNode\": function() { return /* binding */ HDNode; },\n/* harmony export */ \"defaultPath\": function() { return /* binding */ defaultPath; },\n/* harmony export */ \"entropyToMnemonic\": function() { return /* binding */ entropyToMnemonic; },\n/* harmony export */ \"getAccountPath\": function() { return /* binding */ getAccountPath; },\n/* harmony export */ \"initializeSigningKey\": function() { return /* binding */ initializeSigningKey; },\n/* harmony export */ \"isValidMnemonic\": function() { return /* binding */ isValidMnemonic; },\n/* harmony export */ \"mnemonicToEntropy\": function() { return /* binding */ mnemonicToEntropy; },\n/* harmony export */ \"mnemonicToSeed\": function() { return /* binding */ mnemonicToSeed; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_basex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/basex */ \"./node_modules/@ethersproject/basex/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/strings */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/utf8.js\");\n/* harmony import */ var _ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ethersproject/pbkdf2 */ \"./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _hethers_signing_key__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @hethers/signing-key */ \"./node_modules/@hethers/signing-key/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/sha2 */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/sha2.js\");\n/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/sha2 */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/types.js\");\n/* harmony import */ var _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/wordlists */ \"./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/hdnode/lib.esm/_version.js\");\n/* harmony import */ var _hethers_transactions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @hethers/transactions */ \"./node_modules/@hethers/transactions/lib.esm/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nconst N = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__.BigNumber.from(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n// \"Bitcoin seed\"\nconst MasterSecret = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__.toUtf8Bytes)(\"Bitcoin seed\");\nconst HardenedBit = 0x80000000;\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits) {\n return ((1 << bits) - 1) << (8 - bits);\n}\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits) {\n return (1 << bits) - 1;\n}\nfunction bytes32(value) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(value), 32);\n}\nfunction base58check(data) {\n return _ethersproject_basex__WEBPACK_IMPORTED_MODULE_5__.Base58.encode((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.concat)([data, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexDataSlice)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.sha256)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.sha256)(data)), 0, 4)]));\n}\nfunction getWordlist(wordlist) {\n if (wordlist == null) {\n return _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_7__.wordlists.en;\n }\n if (typeof (wordlist) === \"string\") {\n const words = _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_7__.wordlists[wordlist];\n if (words == null) {\n logger.throwArgumentError(\"unknown locale\", \"wordlist\", wordlist);\n }\n return words;\n }\n return wordlist;\n}\nconst _constructorGuard = {};\nconst defaultPath = \"m/44'/60'/0'/0/0\";\nclass HDNode {\n /**\n * This constructor should not be called directly.\n *\n * Please use:\n * - fromMnemonic\n * - fromSeed\n */\n constructor(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath, isED25519Type) {\n logger.checkNew(new.target, HDNode);\n /* istanbul ignore if */\n if (constructorGuard !== _constructorGuard) {\n throw new Error(\"HDNode constructor cannot be called directly\");\n }\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"isED25519Type\", !!isED25519Type);\n if (privateKey) {\n const signingKey = initializeSigningKey(privateKey, this.isED25519Type);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"privateKey\", signingKey.privateKey);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"publicKey\", signingKey.compressedPublicKey);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"alias\", (0,_hethers_transactions__WEBPACK_IMPORTED_MODULE_9__.computeAlias)(this.privateKey, this.isED25519Type));\n }\n else {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"privateKey\", null);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"alias\", null);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"publicKey\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(publicKey));\n }\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"parentFingerprint\", parentFingerprint);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"fingerprint\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexDataSlice)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.ripemd160)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.sha256)(this.publicKey)), 0, 4));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"chainCode\", chainCode);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"index\", index);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"depth\", depth);\n if (mnemonicOrPath == null) {\n // From a source that does not preserve the path (e.g. extended keys)\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"mnemonic\", null);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"path\", null);\n }\n else if (typeof (mnemonicOrPath) === \"string\") {\n // From a source that does not preserve the mnemonic (e.g. neutered)\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"mnemonic\", null);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"path\", mnemonicOrPath);\n }\n else {\n // From a fully qualified source\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"mnemonic\", mnemonicOrPath);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__.defineReadOnly)(this, \"path\", mnemonicOrPath.path);\n }\n }\n get extendedKey() {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n if (this.depth >= 256) {\n throw new Error(\"Depth too large!\");\n }\n return base58check((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.concat)([\n ((this.privateKey != null) ? \"0x0488ADE4\" : \"0x0488B21E\"),\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(this.depth),\n this.parentFingerprint,\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(this.index), 4),\n this.chainCode,\n ((this.privateKey != null) ? (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.concat)([\"0x00\", this.privateKey]) : this.publicKey),\n ]));\n }\n neuter() {\n return new HDNode(_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path);\n }\n _derive(index) {\n if (index > 0xffffffff) {\n throw new Error(\"invalid index - \" + String(index));\n }\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (index & ~HardenedBit);\n }\n const data = new Uint8Array(37);\n if (index & HardenedBit) {\n if (!this.privateKey) {\n throw new Error(\"cannot derive child of neutered node\");\n }\n // Data = 0x00 || ser_256(k_par)\n data.set((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey), 1);\n // Hardened path\n if (path) {\n path += \"'\";\n }\n }\n else {\n // Data = ser_p(point(k_par))\n data.set((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.publicKey));\n }\n // Data += ser_32(i)\n for (let i = 24; i >= 0; i -= 8) {\n data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);\n }\n const I = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.computeHmac)(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__.SupportedAlgorithm.sha512, this.chainCode, data));\n const IL = I.slice(0, 32);\n const IR = I.slice(32);\n // The private key\n let ki = null;\n // The public key\n let Ki = null;\n if (this.privateKey) {\n ki = bytes32(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__.BigNumber.from(IL).add(this.privateKey).mod(N));\n }\n else {\n const ek = initializeSigningKey((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(IL), this.isED25519Type);\n Ki = ek._addPoint(this.publicKey);\n }\n let mnemonicOrPath = path;\n const srcMnemonic = this.mnemonic;\n if (srcMnemonic) {\n mnemonicOrPath = Object.freeze({\n phrase: srcMnemonic.phrase,\n path: path,\n locale: (srcMnemonic.locale || \"en\")\n });\n }\n return new HDNode(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath, this.isED25519Type);\n }\n derivePath(path) {\n const components = path.split(\"/\");\n if (components.length === 0 || (components[0] === \"m\" && this.depth !== 0)) {\n throw new Error(\"invalid path - \" + path);\n }\n if (components[0] === \"m\") {\n components.shift();\n }\n let result = this;\n for (let i = 0; i < components.length; i++) {\n const component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n const index = parseInt(component.substring(0, component.length - 1));\n if (index >= HardenedBit) {\n throw new Error(\"invalid path index - \" + component);\n }\n result = result._derive(HardenedBit + index);\n }\n else if (component.match(/^[0-9]+$/)) {\n const index = parseInt(component);\n if (index >= HardenedBit) {\n throw new Error(\"invalid path index - \" + component);\n }\n result = result._derive(index);\n }\n else {\n throw new Error(\"invalid path component - \" + component);\n }\n }\n return result;\n }\n static _fromSeed(seed, mnemonic, isED25519Type) {\n const seedArray = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(seed);\n if (seedArray.length < 16 || seedArray.length > 64) {\n throw new Error(\"invalid seed\");\n }\n const I = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.computeHmac)(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__.SupportedAlgorithm.sha512, MasterSecret, seedArray));\n return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, \"0x00000000\", bytes32(I.slice(32)), 0, 0, mnemonic, isED25519Type);\n }\n static fromMnemonic(mnemonic, password, wordlist, isED25519Type) {\n // If a locale name was passed in, find the associated wordlist\n wordlist = getWordlist(wordlist);\n // Normalize the case and spacing in the mnemonic (throws if the mnemonic is invalid)\n mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);\n return HDNode._fromSeed(mnemonicToSeed(mnemonic, password), {\n phrase: mnemonic,\n path: \"m\",\n locale: wordlist.locale\n }, isED25519Type);\n }\n static fromSeed(seed, isED25519Type) {\n return HDNode._fromSeed(seed, null, isED25519Type);\n }\n static fromExtendedKey(extendedKey) {\n const bytes = _ethersproject_basex__WEBPACK_IMPORTED_MODULE_5__.Base58.decode(extendedKey);\n if (bytes.length !== 82 || base58check(bytes.slice(0, 78)) !== extendedKey) {\n logger.throwArgumentError(\"invalid extended key\", \"extendedKey\", \"[REDACTED]\");\n }\n const depth = bytes[4];\n const parentFingerprint = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes.slice(5, 9));\n const index = parseInt((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes.slice(9, 13)).substring(2), 16);\n const chainCode = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes.slice(13, 45));\n const key = bytes.slice(45, 78);\n switch ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes.slice(0, 4))) {\n // Public Key\n case \"0x0488b21e\":\n case \"0x043587cf\":\n return new HDNode(_constructorGuard, null, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(key), parentFingerprint, chainCode, index, depth, null);\n // Private Key\n case \"0x0488ade4\":\n case \"0x04358394 \":\n if (key[0] !== 0) {\n break;\n }\n return new HDNode(_constructorGuard, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null);\n }\n return logger.throwArgumentError(\"invalid extended key\", \"extendedKey\", \"[REDACTED]\");\n }\n}\nfunction mnemonicToSeed(mnemonic, password) {\n if (!password) {\n password = \"\";\n }\n const salt = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__.toUtf8Bytes)(\"mnemonic\" + password, _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__.UnicodeNormalizationForm.NFKD);\n return (0,_ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_11__.pbkdf2)((0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__.toUtf8Bytes)(mnemonic, _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__.UnicodeNormalizationForm.NFKD), salt, 2048, 64, \"sha512\");\n}\nfunction mnemonicToEntropy(mnemonic, wordlist) {\n wordlist = getWordlist(wordlist);\n logger.checkNormalize();\n const words = wordlist.split(mnemonic);\n if ((words.length % 3) !== 0) {\n throw new Error(\"invalid mnemonic\");\n }\n const entropy = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(new Uint8Array(Math.ceil(11 * words.length / 8)));\n let offset = 0;\n for (let i = 0; i < words.length; i++) {\n let index = wordlist.getWordIndex(words[i].normalize(\"NFKD\"));\n if (index === -1) {\n throw new Error(\"invalid mnemonic\");\n }\n for (let bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n const entropyBits = 32 * words.length / 3;\n const checksumBits = words.length / 3;\n const checksumMask = getUpperMask(checksumBits);\n const checksum = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;\n if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {\n throw new Error(\"invalid checksum\");\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(entropy.slice(0, entropyBits / 8));\n}\nfunction entropyToMnemonic(entropy, wordlist) {\n wordlist = getWordlist(wordlist);\n entropy = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(entropy);\n if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) {\n throw new Error(\"invalid entropy\");\n }\n const indices = [0];\n let remainingBits = 11;\n for (let i = 0; i < entropy.length; i++) {\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n remainingBits -= 8;\n // This byte will complete an 11-bit index\n }\n else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n remainingBits += 3;\n }\n }\n // Compute the checksum bits\n const checksumBits = entropy.length / 4;\n const checksum = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_6__.sha256)(entropy))[0] & getUpperMask(checksumBits);\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n return wordlist.join(indices.map((index) => wordlist.getWord(index)));\n}\nfunction isValidMnemonic(mnemonic, wordlist) {\n try {\n mnemonicToEntropy(mnemonic, wordlist);\n return true;\n }\n catch (error) { }\n return false;\n}\nfunction getAccountPath(index) {\n if (typeof (index) !== \"number\" || index < 0 || index >= HardenedBit || index % 1) {\n logger.throwArgumentError(\"invalid account index\", \"index\", index);\n }\n return `m/44'/60'/${index}'/0/0`;\n}\nfunction initializeSigningKey(privateKey, isED25519Type) {\n if (isED25519Type) {\n return new _hethers_signing_key__WEBPACK_IMPORTED_MODULE_12__.SigningKeyED(privateKey);\n }\n return new _hethers_signing_key__WEBPACK_IMPORTED_MODULE_12__.SigningKey(privateKey);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/lib.esm/index.js?"); /***/ }), -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/_version.js": -/*!************************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! - \************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 45: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bignumber/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/_version.js?"); +var modeModules = { + ECB: __webpack_require__(1084), + CBC: __webpack_require__(5292), + CFB: __webpack_require__(6311), + CFB8: __webpack_require__(1964), + CFB1: __webpack_require__(1510), + OFB: __webpack_require__(8861), + CTR: __webpack_require__(6009), + GCM: __webpack_require__(6009) +} -/***/ }), +var modes = __webpack_require__(4946) -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": -/*!*************************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! - \*************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +for (var key in modes) { + modes[key].module = modeModules[modes[key].mode] +} + +module.exports = modes -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigNumber\": function() { return /* binding */ BigNumber; },\n/* harmony export */ \"_base16To36\": function() { return /* binding */ _base16To36; },\n/* harmony export */ \"_base36To16\": function() { return /* binding */ _base36To16; },\n/* harmony export */ \"isBigNumberish\": function() { return /* binding */ isBigNumberish; }\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/_version.js\");\n\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\n\nvar BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN);\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nfunction isBigNumberish(value) {\n return (value != null) && (BigNumber.isBigNumber(value) ||\n (typeof (value) === \"number\" && (value % 1) === 0) ||\n (typeof (value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) ||\n (typeof (value) === \"bigint\") ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nclass BigNumber {\n constructor(constructorGuard, hex) {\n logger.checkNew(new.target, BigNumber);\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division by zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot modulo negative values\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot raise to negative values\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'and' negative values\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'or' negative values\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'xor' negative values\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot mask negative values\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return (this._hex[0] === \"-\");\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof (value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof (value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof (anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) {\n return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof (hex) === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof (hex) === \"string\") {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === \"-\" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof (value) !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nfunction _base36To16(value) {\n return (new BN(value, 36)).toString(16);\n}\n// value should have no prefix\nfunction _base16To36(value) {\n return (new BN(value, 16)).toString(36);\n}\n//# sourceMappingURL=bignumber.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js?"); /***/ }), -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!********************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 8861: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +var xor = __webpack_require__(7295) -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/_version.js?"); +function getBlock (self) { + self._prev = self._cipher.encryptBlock(self._prev) + return self._prev +} -/***/ }), +exports.encrypt = function (self, chunk) { + while (self._cache.length < chunk.length) { + self._cache = Buffer.concat([self._cache, getBlock(self)]) + } -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!*****************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \*****************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/index.js?"); /***/ }), -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/_version.js": -/*!*******************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/_version.js ***! - \*******************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 5969: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"sha2/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/_version.js?"); +var aes = __webpack_require__(4497) +var Buffer = (__webpack_require__(9509).Buffer) +var Transform = __webpack_require__(1027) +var inherits = __webpack_require__(5717) -/***/ }), +function StreamCipher (mode, key, iv, decrypt) { + Transform.call(this) -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/sha2.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/sha2.js ***! - \***************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._cache = Buffer.allocUnsafe(0) + this._secCache = Buffer.allocUnsafe(0) + this._decrypt = decrypt + this._mode = mode +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"computeHmac\": function() { return /* binding */ computeHmac; },\n/* harmony export */ \"ripemd160\": function() { return /* binding */ ripemd160; },\n/* harmony export */ \"sha256\": function() { return /* binding */ sha256; },\n/* harmony export */ \"sha512\": function() { return /* binding */ sha512; }\n/* harmony export */ });\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! hash.js */ \"./node_modules/hash.js/lib/hash.js\");\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(hash_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./types */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/types.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/_version.js\");\n\n\n//const _ripemd160 = _hash.ripemd160;\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nfunction ripemd160(data) {\n return \"0x\" + (hash_js__WEBPACK_IMPORTED_MODULE_0___default().ripemd160().update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\"));\n}\nfunction sha256(data) {\n return \"0x\" + (hash_js__WEBPACK_IMPORTED_MODULE_0___default().sha256().update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\"));\n}\nfunction sha512(data) {\n return \"0x\" + (hash_js__WEBPACK_IMPORTED_MODULE_0___default().sha512().update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\"));\n}\nfunction computeHmac(algorithm, key, data) {\n if (!_types__WEBPACK_IMPORTED_MODULE_4__.SupportedAlgorithm[algorithm]) {\n logger.throwError(\"unsupported algorithm \" + algorithm, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"hmac\",\n algorithm: algorithm\n });\n }\n return \"0x\" + hash_js__WEBPACK_IMPORTED_MODULE_0___default().hmac((hash_js__WEBPACK_IMPORTED_MODULE_0___default())[algorithm], (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(key)).update((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)).digest(\"hex\");\n}\n//# sourceMappingURL=sha2.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/sha2.js?"); +inherits(StreamCipher, Transform) -/***/ }), +StreamCipher.prototype._update = function (chunk) { + return this._mode.encrypt(this, chunk, this._decrypt) +} -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/types.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/types.js ***! - \****************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +StreamCipher.prototype._final = function () { + this._cipher.scrub() +} + +module.exports = StreamCipher -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SupportedAlgorithm\": function() { return /* binding */ SupportedAlgorithm; }\n/* harmony export */ });\nvar SupportedAlgorithm;\n(function (SupportedAlgorithm) {\n SupportedAlgorithm[\"sha256\"] = \"sha256\";\n SupportedAlgorithm[\"sha512\"] = \"sha512\";\n})(SupportedAlgorithm || (SupportedAlgorithm = {}));\n;\n//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/sha2/lib.esm/types.js?"); /***/ }), -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/_version.js": -/*!**********************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/_version.js ***! - \**********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 3614: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"strings/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/_version.js?"); +var DES = __webpack_require__(7667) +var aes = __webpack_require__(4696) +var aesModes = __webpack_require__(45) +var desModes = __webpack_require__(9715) +var ebtk = __webpack_require__(3048) + +function createCipher (suite, password) { + suite = suite.toLowerCase() + + var keyLen, ivLen + if (aesModes[suite]) { + keyLen = aesModes[suite].key + ivLen = aesModes[suite].iv + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8 + ivLen = desModes[suite].iv + } else { + throw new TypeError('invalid suite type') + } + + var keys = ebtk(password, false, keyLen, ivLen) + return createCipheriv(suite, keys.key, keys.iv) +} + +function createDecipher (suite, password) { + suite = suite.toLowerCase() + + var keyLen, ivLen + if (aesModes[suite]) { + keyLen = aesModes[suite].key + ivLen = aesModes[suite].iv + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8 + ivLen = desModes[suite].iv + } else { + throw new TypeError('invalid suite type') + } + + var keys = ebtk(password, false, keyLen, ivLen) + return createDecipheriv(suite, keys.key, keys.iv) +} + +function createCipheriv (suite, key, iv) { + suite = suite.toLowerCase() + if (aesModes[suite]) return aes.createCipheriv(suite, key, iv) + if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite }) + + throw new TypeError('invalid suite type') +} + +function createDecipheriv (suite, key, iv) { + suite = suite.toLowerCase() + if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv) + if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true }) + + throw new TypeError('invalid suite type') +} + +function getCiphers () { + return Object.keys(desModes).concat(aes.getCiphers()) +} + +exports.createCipher = exports.Cipher = createCipher +exports.createCipheriv = exports.Cipheriv = createCipheriv +exports.createDecipher = exports.Decipher = createDecipher +exports.createDecipheriv = exports.Decipheriv = createDecipheriv +exports.listCiphers = exports.getCiphers = getCiphers + + +/***/ }), + +/***/ 7667: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ }), +var CipherBase = __webpack_require__(1027) +var des = __webpack_require__(5251) +var inherits = __webpack_require__(5717) +var Buffer = (__webpack_require__(9509).Buffer) + +var modes = { + 'des-ede3-cbc': des.CBC.instantiate(des.EDE), + 'des-ede3': des.EDE, + 'des-ede-cbc': des.CBC.instantiate(des.EDE), + 'des-ede': des.EDE, + 'des-cbc': des.CBC.instantiate(des.DES), + 'des-ecb': des.DES +} +modes.des = modes['des-cbc'] +modes.des3 = modes['des-ede3-cbc'] +module.exports = DES +inherits(DES, CipherBase) +function DES (opts) { + CipherBase.call(this) + var modeName = opts.mode.toLowerCase() + var mode = modes[modeName] + var type + if (opts.decrypt) { + type = 'decrypt' + } else { + type = 'encrypt' + } + var key = opts.key + if (!Buffer.isBuffer(key)) { + key = Buffer.from(key) + } + if (modeName === 'des-ede' || modeName === 'des-ede-cbc') { + key = Buffer.concat([key, key.slice(0, 8)]) + } + var iv = opts.iv + if (!Buffer.isBuffer(iv)) { + iv = Buffer.from(iv) + } + this._des = mode.create({ + key: key, + iv: iv, + type: type + }) +} +DES.prototype._update = function (data) { + return Buffer.from(this._des.update(data)) +} +DES.prototype._final = function () { + return Buffer.from(this._des.final()) +} + + +/***/ }), + +/***/ 9715: +/***/ (function(__unused_webpack_module, exports) { -/***/ "./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/utf8.js": -/*!******************************************************************************************!*\ - !*** ./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/utf8.js ***! - \******************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +exports["des-ecb"] = { + key: 8, + iv: 0 +} +exports["des-cbc"] = exports.des = { + key: 8, + iv: 8 +} +exports["des-ede3-cbc"] = exports.des3 = { + key: 24, + iv: 8 +} +exports["des-ede3"] = { + key: 24, + iv: 0 +} +exports["des-ede-cbc"] = { + key: 16, + iv: 8 +} +exports["des-ede"] = { + key: 16, + iv: 0 +} + + +/***/ }), + +/***/ 3663: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"UnicodeNormalizationForm\": function() { return /* binding */ UnicodeNormalizationForm; },\n/* harmony export */ \"Utf8ErrorFuncs\": function() { return /* binding */ Utf8ErrorFuncs; },\n/* harmony export */ \"Utf8ErrorReason\": function() { return /* binding */ Utf8ErrorReason; },\n/* harmony export */ \"_toEscapedUtf8String\": function() { return /* binding */ _toEscapedUtf8String; },\n/* harmony export */ \"_toUtf8String\": function() { return /* binding */ _toUtf8String; },\n/* harmony export */ \"toUtf8Bytes\": function() { return /* binding */ toUtf8Bytes; },\n/* harmony export */ \"toUtf8CodePoints\": function() { return /* binding */ toUtf8CodePoints; },\n/* harmony export */ \"toUtf8String\": function() { return /* binding */ toUtf8String; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/_version.js\");\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nvar UnicodeNormalizationForm;\n(function (UnicodeNormalizationForm) {\n UnicodeNormalizationForm[\"current\"] = \"\";\n UnicodeNormalizationForm[\"NFC\"] = \"NFC\";\n UnicodeNormalizationForm[\"NFD\"] = \"NFD\";\n UnicodeNormalizationForm[\"NFKC\"] = \"NFKC\";\n UnicodeNormalizationForm[\"NFKD\"] = \"NFKD\";\n})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {}));\n;\nvar Utf8ErrorReason;\n(function (Utf8ErrorReason) {\n // A continuation byte was present where there was nothing to continue\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"UNEXPECTED_CONTINUE\"] = \"unexpected continuation byte\";\n // An invalid (non-continuation) byte to start a UTF-8 codepoint was found\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"BAD_PREFIX\"] = \"bad codepoint prefix\";\n // The string is too short to process the expected codepoint\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"OVERRUN\"] = \"string overrun\";\n // A missing continuation byte was expected but not found\n // - offset = the index the continuation byte was expected at\n Utf8ErrorReason[\"MISSING_CONTINUE\"] = \"missing continuation byte\";\n // The computed code point is outside the range for UTF-8\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; outside the UTF-8 range\n Utf8ErrorReason[\"OUT_OF_RANGE\"] = \"out of UTF-8 range\";\n // UTF-8 strings may not contain UTF-16 surrogate pairs\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range\n Utf8ErrorReason[\"UTF16_SURROGATE\"] = \"UTF-16 surrogate\";\n // The string is an overlong representation\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; already bounds checked\n Utf8ErrorReason[\"OVERLONG\"] = \"overlong representation\";\n})(Utf8ErrorReason || (Utf8ErrorReason = {}));\n;\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n return logger.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === Utf8ErrorReason.OVERRUN) {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === Utf8ErrorReason.OVERLONG) {\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n// Common error handing strategies\nconst Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(bytes);\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);\n }\n else {\n i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nfunction toUtf8Bytes(str, form = UnicodeNormalizationForm.current) {\n if (form != UnicodeNormalizationForm.current) {\n logger.checkNormalize();\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) {\n throw new Error(\"invalid utf-8 string\");\n }\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(result);\n}\n;\nfunction escapeChar(value) {\n const hex = (\"0000\" + value.toString(16));\n return \"\\\\u\" + hex.substring(hex.length - 4);\n}\nfunction _toEscapedUtf8String(bytes, onError) {\n return '\"' + getUtf8CodePoints(bytes, onError).map((codePoint) => {\n if (codePoint < 256) {\n switch (codePoint) {\n case 8: return \"\\\\b\";\n case 9: return \"\\\\t\";\n case 10: return \"\\\\n\";\n case 13: return \"\\\\r\";\n case 34: return \"\\\\\\\"\";\n case 92: return \"\\\\\\\\\";\n }\n if (codePoint >= 32 && codePoint < 127) {\n return String.fromCharCode(codePoint);\n }\n }\n if (codePoint <= 0xffff) {\n return escapeChar(codePoint);\n }\n codePoint -= 0x10000;\n return escapeChar(((codePoint >> 10) & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00);\n }).join(\"\") + '\"';\n}\nfunction _toUtf8String(codePoints) {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));\n }).join(\"\");\n}\nfunction toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\nfunction toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/hdnode/node_modules/@ethersproject/strings/lib.esm/utf8.js?"); -/***/ }), -/***/ "./node_modules/@hethers/json-wallets/lib.esm/_version.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/lib.esm/_version.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var BN = __webpack_require__(3982); +var randomBytes = __webpack_require__(1798); +var Buffer = (__webpack_require__(9509).Buffer); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"json-wallets/1.2.1\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/lib.esm/_version.js?"); +function getr(priv) { + var len = priv.modulus.byteLength(); + var r; + do { + r = new BN(randomBytes(len)); + } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)); + return r; +} -/***/ }), +function blind(priv) { + var r = getr(priv); + var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed(); + return { blinder: blinder, unblinder: r.invm(priv.modulus) }; +} -/***/ "./node_modules/@hethers/json-wallets/lib.esm/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/lib.esm/index.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +function crt(msg, priv) { + var blinds = blind(priv); + var len = priv.modulus.byteLength(); + var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus); + var c1 = blinded.toRed(BN.mont(priv.prime1)); + var c2 = blinded.toRed(BN.mont(priv.prime2)); + var qinv = priv.coefficient; + var p = priv.prime1; + var q = priv.prime2; + var m1 = c1.redPow(priv.exponent1).fromRed(); + var m2 = c2.redPow(priv.exponent2).fromRed(); + var h = m1.isub(m2).imul(qinv).umod(p).imul(q); + return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len); +} +crt.getr = getr; + +module.exports = crt; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decryptJsonWallet\": function() { return /* binding */ decryptJsonWallet; },\n/* harmony export */ \"decryptJsonWalletSync\": function() { return /* binding */ decryptJsonWalletSync; },\n/* harmony export */ \"decryptKeystore\": function() { return /* reexport safe */ _keystore__WEBPACK_IMPORTED_MODULE_1__.decrypt; },\n/* harmony export */ \"decryptKeystoreSync\": function() { return /* reexport safe */ _keystore__WEBPACK_IMPORTED_MODULE_1__.decryptSync; },\n/* harmony export */ \"encryptKeystore\": function() { return /* reexport safe */ _keystore__WEBPACK_IMPORTED_MODULE_1__.encrypt; },\n/* harmony export */ \"getJsonWalletAddress\": function() { return /* reexport safe */ _inspect__WEBPACK_IMPORTED_MODULE_0__.getJsonWalletAddress; },\n/* harmony export */ \"isKeystoreWallet\": function() { return /* reexport safe */ _inspect__WEBPACK_IMPORTED_MODULE_0__.isKeystoreWallet; }\n/* harmony export */ });\n/* harmony import */ var _inspect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inspect */ \"./node_modules/@hethers/json-wallets/lib.esm/inspect.js\");\n/* harmony import */ var _keystore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keystore */ \"./node_modules/@hethers/json-wallets/lib.esm/keystore.js\");\n\n\n\nfunction decryptJsonWallet(json, password, progressCallback) {\n if ((0,_inspect__WEBPACK_IMPORTED_MODULE_0__.isKeystoreWallet)(json)) {\n return (0,_keystore__WEBPACK_IMPORTED_MODULE_1__.decrypt)(json, password, progressCallback);\n }\n return Promise.reject(new Error(\"invalid JSON wallet\"));\n}\nfunction decryptJsonWalletSync(json, password) {\n if ((0,_inspect__WEBPACK_IMPORTED_MODULE_0__.isKeystoreWallet)(json)) {\n return (0,_keystore__WEBPACK_IMPORTED_MODULE_1__.decryptSync)(json, password);\n }\n throw new Error(\"invalid JSON wallet\");\n}\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/lib.esm/index.js?"); /***/ }), -/***/ "./node_modules/@hethers/json-wallets/lib.esm/inspect.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/lib.esm/inspect.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 3982: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"getJsonWalletAddress\": function() { return /* binding */ getJsonWalletAddress; },\n/* harmony export */ \"isKeystoreWallet\": function() { return /* binding */ isKeystoreWallet; }\n/* harmony export */ });\n/* harmony import */ var _hethers_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hethers/address */ \"./node_modules/@hethers/address/lib.esm/index.js\");\n\n\nfunction isKeystoreWallet(json) {\n let data = null;\n try {\n data = JSON.parse(json);\n }\n catch (error) {\n return false;\n }\n if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) {\n return false;\n }\n // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff\n return true;\n}\nfunction getJsonWalletAddress(json) {\n if (isKeystoreWallet(json)) {\n try {\n return (0,_hethers_address__WEBPACK_IMPORTED_MODULE_0__.getAddress)(JSON.parse(json).address);\n }\n catch (error) {\n return null;\n }\n }\n return null;\n}\n//# sourceMappingURL=inspect.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/lib.esm/inspect.js?"); +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(1922).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert(false, 'Invalid character in ' + string); + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this._strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; + + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this._strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + + BN.prototype._move = function _move (dest) { + move(dest, this); + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; + } + + function inspect () { + return (this.red ? ''; + } + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; + + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; + } + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); + + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; + + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position < res.length) { + res[position++] = carry; + + while (position < res.length) { + res[position++] = 0; + } + } + }; + + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position >= 0) { + res[position--] = carry; + + while (position >= 0) { + res[position--] = 0; + } + } + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] >>> wbit) & 0x01; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this._strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this._strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this._strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this._strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this._strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this._strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out._strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out._strip(); + } + + function jumboMulTo (self, num, out) { + // Temporary disable, see https://github.com/indutny/bn.js/issues/211 + // var fftm = new FFTM(); + // return fftm.mulp(self, num, out); + return bigMulTo(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; -/***/ }), - -/***/ "./node_modules/@hethers/json-wallets/lib.esm/keystore.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/lib.esm/keystore.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this._strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this._strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this._strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this._strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this._strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a._strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modrn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modrn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modrn = function modrn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return isNegNum ? -acc : acc; + }; + + // WARNING: DEPRECATED + BN.prototype.modn = function modn (num) { + return this.modrn(num); + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + this._strip(); + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this._strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is a BN v4 instance + r.strip(); + } else { + // r is a BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + + move(a, a.umod(this.m)._forceRed(this)); + return a; + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 6042: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"KeystoreAccount\": function() { return /* binding */ KeystoreAccount; },\n/* harmony export */ \"decrypt\": function() { return /* binding */ decrypt; },\n/* harmony export */ \"decryptSync\": function() { return /* binding */ decryptSync; },\n/* harmony export */ \"encrypt\": function() { return /* binding */ encrypt; }\n/* harmony export */ });\n/* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! aes-js */ \"./node_modules/aes-js/index.js\");\n/* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aes_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var scrypt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! scrypt-js */ \"./node_modules/scrypt-js/scrypt.js\");\n/* harmony import */ var scrypt_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(scrypt_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _hethers_address__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @hethers/address */ \"./node_modules/@hethers/address/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @hethers/hdnode */ \"./node_modules/@hethers/hdnode/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/pbkdf2 */ \"./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js\");\n/* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ethersproject/random */ \"./node_modules/@ethersproject/random/lib.esm/random.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ \"./node_modules/@hethers/json-wallets/lib.esm/utils.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/json-wallets/lib.esm/_version.js\");\n\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\n\n\n\n\n\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_2__.Logger(_version__WEBPACK_IMPORTED_MODULE_3__.version);\n// Exported Types\nfunction hasMnemonic(value) {\n return (value != null && value.mnemonic && value.mnemonic.phrase);\n}\nclass KeystoreAccount extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.Description {\n isKeystoreAccount(value) {\n return !!(value && value._isKeystoreAccount);\n }\n}\nfunction _decrypt(data, key, ciphertext) {\n const cipher = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/cipher\");\n if (cipher === \"aes-128-ctr\") {\n const iv = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.looseArrayify)((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/cipherparams/iv\"));\n const counter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(iv);\n const aesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(key, counter);\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(aesCtr.decrypt(ciphertext));\n }\n return null;\n}\nfunction _getAccount(data, key) {\n const ciphertext = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.looseArrayify)((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/ciphertext\"));\n const computedMAC = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.concat)([key.slice(16, 32), ciphertext]))).substring(2);\n if (computedMAC !== (0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/mac\").toLowerCase()) {\n throw new Error(\"invalid password\");\n }\n const privateKey = _decrypt(data, key.slice(0, 16), ciphertext);\n if (!privateKey) {\n logger.throwError(\"unsupported cipher\", _hethers_logger__WEBPACK_IMPORTED_MODULE_2__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"decrypt\"\n });\n }\n const mnemonicKey = key.slice(32, 64);\n let address;\n if (data.address) {\n address = data.address.toLowerCase();\n if (address.substring(0, 2) !== \"0x\") {\n address = \"0x\" + address;\n }\n }\n const account = {\n _isKeystoreAccount: true,\n address: address ? (0,_hethers_address__WEBPACK_IMPORTED_MODULE_8__.getAddress)(address) : undefined,\n privateKey: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(privateKey),\n isED25519Type: data.isED25519Type\n };\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"x-ethers/version\") === \"0.1\") {\n const mnemonicCiphertext = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.looseArrayify)((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"x-ethers/mnemonicCiphertext\"));\n const mnemonicIv = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.looseArrayify)((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"x-ethers/mnemonicCounter\"));\n const mnemonicCounter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(mnemonicIv);\n const mnemonicAesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(mnemonicKey, mnemonicCounter);\n const path = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"x-ethers/path\") || _hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__.defaultPath;\n const locale = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"x-ethers/locale\") || \"en\";\n const entropy = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(mnemonicAesCtr.decrypt(mnemonicCiphertext));\n try {\n const mnemonic = (0,_hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__.entropyToMnemonic)(entropy, locale);\n const node = _hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__.HDNode.fromMnemonic(mnemonic, null, locale, account.isED25519Type).derivePath(path);\n if (node.privateKey != account.privateKey) {\n throw new Error(\"mnemonic mismatch\");\n }\n account.mnemonic = node.mnemonic;\n }\n catch (error) {\n // If we don't have the locale wordlist installed to\n // read this mnemonic, just bail and don't set the\n // mnemonic\n if (error.code !== _hethers_logger__WEBPACK_IMPORTED_MODULE_2__.Logger.errors.INVALID_ARGUMENT || error.argument !== \"wordlist\") {\n throw error;\n }\n }\n }\n return new KeystoreAccount(account);\n}\nfunction pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)((0,_ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_10__.pbkdf2)(passwordBytes, salt, count, dkLen, prfFunc));\n}\nfunction pbkdf2(passwordBytes, salt, count, dkLen, prfFunc) {\n return Promise.resolve(pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc));\n}\nfunction _computeKdfKey(data, password, pbkdf2Func, scryptFunc, progressCallback) {\n const passwordBytes = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getPassword)(password);\n const kdf = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdf\");\n if (kdf && typeof (kdf) === \"string\") {\n const throwError = function (name, value) {\n return logger.throwArgumentError(\"invalid key-derivation function parameters\", name, value);\n };\n if (kdf.toLowerCase() === \"scrypt\") {\n const salt = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.looseArrayify)((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/salt\"));\n const N = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/n\"));\n const r = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/r\"));\n const p = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/p\"));\n // Check for all required parameters\n if (!N || !r || !p) {\n throwError(\"kdf\", kdf);\n }\n // Make sure N is a power of 2\n if ((N & (N - 1)) !== 0) {\n throwError(\"N\", N);\n }\n const dkLen = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/dklen\"));\n if (dkLen !== 32) {\n throwError(\"dklen\", dkLen);\n }\n return scryptFunc(passwordBytes, salt, N, r, p, 64, progressCallback);\n }\n else if (kdf.toLowerCase() === \"pbkdf2\") {\n const salt = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.looseArrayify)((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/salt\"));\n let prfFunc = null;\n const prf = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/prf\");\n if (prf === \"hmac-sha256\") {\n prfFunc = \"sha256\";\n }\n else if (prf === \"hmac-sha512\") {\n prfFunc = \"sha512\";\n }\n else {\n throwError(\"prf\", prf);\n }\n const count = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/c\"));\n const dkLen = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__.searchPath)(data, \"crypto/kdfparams/dklen\"));\n if (dkLen !== 32) {\n throwError(\"dklen\", dkLen);\n }\n return pbkdf2Func(passwordBytes, salt, count, dkLen, prfFunc);\n }\n }\n return logger.throwArgumentError(\"unsupported key-derivation function\", \"kdf\", kdf);\n}\nfunction decryptSync(json, password) {\n const data = JSON.parse(json);\n const key = _computeKdfKey(data, password, pbkdf2Sync, (scrypt_js__WEBPACK_IMPORTED_MODULE_1___default().syncScrypt));\n return _getAccount(data, key);\n}\nfunction decrypt(json, password, progressCallback) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = JSON.parse(json);\n const key = yield _computeKdfKey(data, password, pbkdf2, (scrypt_js__WEBPACK_IMPORTED_MODULE_1___default().scrypt), progressCallback);\n return _getAccount(data, key);\n });\n}\nfunction encrypt(account, password, options, progressCallback) {\n try {\n // Check the mnemonic (if any) matches the private key\n if (hasMnemonic(account)) {\n const mnemonic = account.mnemonic;\n const node = _hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale, account.isED25519Type).derivePath(mnemonic.path || _hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__.defaultPath);\n if (node.privateKey != account.privateKey) {\n throw new Error(\"mnemonic mismatch\");\n }\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n // The options are optional, so adjust the call as needed\n if (typeof (options) === \"function\" && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (!options) {\n options = {};\n }\n const privateKey = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(account.privateKey);\n const passwordBytes = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getPassword)(password);\n let entropy = null;\n let path = null;\n let locale = null;\n if (hasMnemonic(account)) {\n const srcMnemonic = account.mnemonic;\n entropy = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)((0,_hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__.mnemonicToEntropy)(srcMnemonic.phrase, srcMnemonic.locale || \"en\"));\n path = srcMnemonic.path || _hethers_hdnode__WEBPACK_IMPORTED_MODULE_9__.defaultPath;\n locale = srcMnemonic.locale || \"en\";\n }\n let client = options.client;\n if (!client) {\n client = \"ethers.js\";\n }\n // Check/generate the salt\n let salt = null;\n if (options.salt) {\n salt = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(options.salt);\n }\n else {\n salt = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_11__.randomBytes)(32);\n ;\n }\n // Override initialization vector\n let iv = null;\n if (options.iv) {\n iv = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(options.iv);\n if (iv.length !== 16) {\n throw new Error(\"invalid iv\");\n }\n }\n else {\n iv = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_11__.randomBytes)(16);\n }\n // Override the uuid\n let uuidRandom = null;\n if (options.uuid) {\n uuidRandom = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(options.uuid);\n if (uuidRandom.length !== 16) {\n throw new Error(\"invalid uuid\");\n }\n }\n else {\n uuidRandom = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_11__.randomBytes)(16);\n }\n // Override the scrypt password-based key derivation function parameters\n let N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) {\n N = options.scrypt.N;\n }\n if (options.scrypt.r) {\n r = options.scrypt.r;\n }\n if (options.scrypt.p) {\n p = options.scrypt.p;\n }\n }\n // We take 64 bytes:\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n return scrypt_js__WEBPACK_IMPORTED_MODULE_1___default().scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then((key) => {\n key = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(key);\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n const derivedKey = key.slice(0, 16);\n const macPrefix = key.slice(16, 32);\n // This will be used to encrypt the mnemonic phrase (if any)\n const mnemonicKey = key.slice(32, 64);\n // Encrypt the private key\n const counter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(iv);\n const aesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(derivedKey, counter);\n const ciphertext = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(aesCtr.encrypt(privateKey));\n // Compute the message authentication code, used to check the password\n const mac = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.concat)([macPrefix, ciphertext]));\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n // As per Version 3, the address field is OPTIONAL\n const data = {\n address: account.address ? account.address.substring(2).toLowerCase() : undefined,\n id: (0,_utils__WEBPACK_IMPORTED_MODULE_5__.uuidV4)(uuidRandom),\n isED25519Type: account.isED25519Type,\n version: 3,\n Crypto: {\n cipher: \"aes-128-ctr\",\n cipherparams: {\n iv: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(iv).substring(2),\n },\n ciphertext: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(ciphertext).substring(2),\n kdf: \"scrypt\",\n kdfparams: {\n salt: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(salt).substring(2),\n n: N,\n dklen: 32,\n p: p,\n r: r\n },\n mac: mac.substring(2)\n }\n };\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (entropy) {\n const mnemonicIv = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_11__.randomBytes)(16);\n const mnemonicCounter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(mnemonicIv);\n const mnemonicAesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(mnemonicKey, mnemonicCounter);\n const mnemonicCiphertext = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(mnemonicAesCtr.encrypt(entropy));\n const now = new Date();\n const timestamp = (now.getUTCFullYear() + \"-\" +\n (0,_utils__WEBPACK_IMPORTED_MODULE_5__.zpad)(now.getUTCMonth() + 1, 2) + \"-\" +\n (0,_utils__WEBPACK_IMPORTED_MODULE_5__.zpad)(now.getUTCDate(), 2) + \"T\" +\n (0,_utils__WEBPACK_IMPORTED_MODULE_5__.zpad)(now.getUTCHours(), 2) + \"-\" +\n (0,_utils__WEBPACK_IMPORTED_MODULE_5__.zpad)(now.getUTCMinutes(), 2) + \"-\" +\n (0,_utils__WEBPACK_IMPORTED_MODULE_5__.zpad)(now.getUTCSeconds(), 2) + \".0Z\");\n data[\"x-ethers\"] = {\n client: client,\n gethFilename: (\"UTC--\" + timestamp + \"--\" + data.address),\n mnemonicCounter: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(mnemonicIv).substring(2),\n mnemonicCiphertext: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(mnemonicCiphertext).substring(2),\n path: path,\n locale: locale,\n version: \"0.1\"\n };\n }\n return JSON.stringify(data);\n });\n}\n//# sourceMappingURL=keystore.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/lib.esm/keystore.js?"); -/***/ }), -/***/ "./node_modules/@hethers/json-wallets/lib.esm/utils.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/lib.esm/utils.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +module.exports = __webpack_require__(5207); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"getPassword\": function() { return /* binding */ getPassword; },\n/* harmony export */ \"looseArrayify\": function() { return /* binding */ looseArrayify; },\n/* harmony export */ \"searchPath\": function() { return /* binding */ searchPath; },\n/* harmony export */ \"uuidV4\": function() { return /* binding */ uuidV4; },\n/* harmony export */ \"zpad\": function() { return /* binding */ zpad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/strings */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/utf8.js\");\n\n\n\nfunction looseArrayify(hexString) {\n if (typeof (hexString) === 'string' && hexString.substring(0, 2) !== '0x') {\n hexString = '0x' + hexString;\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(hexString);\n}\nfunction zpad(value, length) {\n value = String(value);\n while (value.length < length) {\n value = '0' + value;\n }\n return value;\n}\nfunction getPassword(password) {\n if (typeof (password) === 'string') {\n return (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__.toUtf8Bytes)(password, _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__.UnicodeNormalizationForm.NFKC);\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(password);\n}\nfunction searchPath(object, path) {\n let currentChild = object;\n const comps = path.toLowerCase().split('/');\n for (let i = 0; i < comps.length; i++) {\n // Search for a child object with a case-insensitive matching key\n let matchingChild = null;\n for (const key in currentChild) {\n if (key.toLowerCase() === comps[i]) {\n matchingChild = currentChild[key];\n break;\n }\n }\n // Didn't find one. :'(\n if (matchingChild === null) {\n return null;\n }\n // Now check this child...\n currentChild = matchingChild;\n }\n return currentChild;\n}\n// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\nfunction uuidV4(randomBytes) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(randomBytes);\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexlify)(bytes);\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/lib.esm/utils.js?"); /***/ }), -/***/ "./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \**************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 4743: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/_version.js?"); -/***/ }), -/***/ "./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!***********************************************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \***********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var Buffer = (__webpack_require__(9509).Buffer); +var createHash = __webpack_require__(3482); +var stream = __webpack_require__(8473); +var inherits = __webpack_require__(5717); +var sign = __webpack_require__(2957); +var verify = __webpack_require__(7753); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/index.js?"); +var algorithms = __webpack_require__(5207); +Object.keys(algorithms).forEach(function (key) { + algorithms[key].id = Buffer.from(algorithms[key].id, 'hex'); + algorithms[key.toLowerCase()] = algorithms[key]; +}); -/***/ }), +function Sign(algorithm) { + stream.Writable.call(this); -/***/ "./node_modules/@hethers/json-wallets/node_modules/@ethersproject/keccak256/lib.esm/index.js": -/*!***************************************************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/node_modules/@ethersproject/keccak256/lib.esm/index.js ***! - \***************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + var data = algorithms[algorithm]; + if (!data) { throw new Error('Unknown message digest'); } -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"keccak256\": function() { return /* binding */ keccak256; }\n/* harmony export */ });\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ \"./node_modules/js-sha3/src/sha3.js\");\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n\n\n\nfunction keccak256(data) {\n return '0x' + js_sha3__WEBPACK_IMPORTED_MODULE_0___default().keccak_256((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(data));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/node_modules/@ethersproject/keccak256/lib.esm/index.js?"); + this._hashType = data.hash; + this._hash = createHash(data.hash); + this._tag = data.id; + this._signType = data.sign; +} +inherits(Sign, stream.Writable); -/***/ }), +Sign.prototype._write = function _write(data, _, done) { + this._hash.update(data); + done(); +}; -/***/ "./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/_version.js": -/*!****************************************************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/_version.js ***! - \****************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +Sign.prototype.update = function update(data, enc) { + this._hash.update(typeof data === 'string' ? Buffer.from(data, enc) : data); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"strings/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/_version.js?"); + return this; +}; -/***/ }), +Sign.prototype.sign = function signMethod(key, enc) { + this.end(); + var hash = this._hash.digest(); + var sig = sign(hash, key, this._hashType, this._signType, this._tag); -/***/ "./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/utf8.js": -/*!************************************************************************************************!*\ - !*** ./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/utf8.js ***! - \************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return enc ? sig.toString(enc) : sig; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"UnicodeNormalizationForm\": function() { return /* binding */ UnicodeNormalizationForm; },\n/* harmony export */ \"Utf8ErrorFuncs\": function() { return /* binding */ Utf8ErrorFuncs; },\n/* harmony export */ \"Utf8ErrorReason\": function() { return /* binding */ Utf8ErrorReason; },\n/* harmony export */ \"_toEscapedUtf8String\": function() { return /* binding */ _toEscapedUtf8String; },\n/* harmony export */ \"_toUtf8String\": function() { return /* binding */ _toUtf8String; },\n/* harmony export */ \"toUtf8Bytes\": function() { return /* binding */ toUtf8Bytes; },\n/* harmony export */ \"toUtf8CodePoints\": function() { return /* binding */ toUtf8CodePoints; },\n/* harmony export */ \"toUtf8String\": function() { return /* binding */ toUtf8String; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/_version.js\");\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nvar UnicodeNormalizationForm;\n(function (UnicodeNormalizationForm) {\n UnicodeNormalizationForm[\"current\"] = \"\";\n UnicodeNormalizationForm[\"NFC\"] = \"NFC\";\n UnicodeNormalizationForm[\"NFD\"] = \"NFD\";\n UnicodeNormalizationForm[\"NFKC\"] = \"NFKC\";\n UnicodeNormalizationForm[\"NFKD\"] = \"NFKD\";\n})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {}));\n;\nvar Utf8ErrorReason;\n(function (Utf8ErrorReason) {\n // A continuation byte was present where there was nothing to continue\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"UNEXPECTED_CONTINUE\"] = \"unexpected continuation byte\";\n // An invalid (non-continuation) byte to start a UTF-8 codepoint was found\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"BAD_PREFIX\"] = \"bad codepoint prefix\";\n // The string is too short to process the expected codepoint\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"OVERRUN\"] = \"string overrun\";\n // A missing continuation byte was expected but not found\n // - offset = the index the continuation byte was expected at\n Utf8ErrorReason[\"MISSING_CONTINUE\"] = \"missing continuation byte\";\n // The computed code point is outside the range for UTF-8\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; outside the UTF-8 range\n Utf8ErrorReason[\"OUT_OF_RANGE\"] = \"out of UTF-8 range\";\n // UTF-8 strings may not contain UTF-16 surrogate pairs\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range\n Utf8ErrorReason[\"UTF16_SURROGATE\"] = \"UTF-16 surrogate\";\n // The string is an overlong representation\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; already bounds checked\n Utf8ErrorReason[\"OVERLONG\"] = \"overlong representation\";\n})(Utf8ErrorReason || (Utf8ErrorReason = {}));\n;\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n return logger.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === Utf8ErrorReason.OVERRUN) {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === Utf8ErrorReason.OVERLONG) {\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n// Common error handing strategies\nconst Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(bytes);\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);\n }\n else {\n i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nfunction toUtf8Bytes(str, form = UnicodeNormalizationForm.current) {\n if (form != UnicodeNormalizationForm.current) {\n logger.checkNormalize();\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) {\n throw new Error(\"invalid utf-8 string\");\n }\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(result);\n}\n;\nfunction escapeChar(value) {\n const hex = (\"0000\" + value.toString(16));\n return \"\\\\u\" + hex.substring(hex.length - 4);\n}\nfunction _toEscapedUtf8String(bytes, onError) {\n return '\"' + getUtf8CodePoints(bytes, onError).map((codePoint) => {\n if (codePoint < 256) {\n switch (codePoint) {\n case 8: return \"\\\\b\";\n case 9: return \"\\\\t\";\n case 10: return \"\\\\n\";\n case 13: return \"\\\\r\";\n case 34: return \"\\\\\\\"\";\n case 92: return \"\\\\\\\\\";\n }\n if (codePoint >= 32 && codePoint < 127) {\n return String.fromCharCode(codePoint);\n }\n }\n if (codePoint <= 0xffff) {\n return escapeChar(codePoint);\n }\n codePoint -= 0x10000;\n return escapeChar(((codePoint >> 10) & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00);\n }).join(\"\") + '\"';\n}\nfunction _toUtf8String(codePoints) {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));\n }).join(\"\");\n}\nfunction toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\nfunction toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/json-wallets/node_modules/@ethersproject/strings/lib.esm/utf8.js?"); +function Verify(algorithm) { + stream.Writable.call(this); -/***/ }), + var data = algorithms[algorithm]; + if (!data) { throw new Error('Unknown message digest'); } -/***/ "./node_modules/@hethers/logger/lib.esm/_version.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hethers/logger/lib.esm/_version.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + this._hash = createHash(data.hash); + this._tag = data.id; + this._signType = data.sign; +} +inherits(Verify, stream.Writable); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"logger/1.2.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/logger/lib.esm/_version.js?"); +Verify.prototype._write = function _write(data, _, done) { + this._hash.update(data); + done(); +}; -/***/ }), +Verify.prototype.update = function update(data, enc) { + this._hash.update(typeof data === 'string' ? Buffer.from(data, enc) : data); -/***/ "./node_modules/@hethers/logger/lib.esm/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hethers/logger/lib.esm/index.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return this; +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ErrorCode\": function() { return /* binding */ ErrorCode; },\n/* harmony export */ \"LogLevel\": function() { return /* binding */ LogLevel; },\n/* harmony export */ \"Logger\": function() { return /* binding */ Logger; }\n/* harmony export */ });\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/logger/lib.esm/_version.js\");\n\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = { debug: 1, \"default\": 2, info: 2, warning: 3, error: 4, off: 5 };\nlet _logLevel = LogLevels[\"default\"];\n\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n ;\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nvar LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nvar ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Ethereum Network, such as an invalid chain ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + gasLimit * gasPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // The gas limit could not be estimated\n // - transaction: the transaction passed to estimateGas\n ErrorCode[\"UNPREDICTABLE_GAS_LIMIT\"] = \"UNPREDICTABLE_GAS_LIMIT\";\n})(ErrorCode || (ErrorCode = {}));\n;\nconst HEX = \"0123456789abcdef\";\nclass Logger {\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\", form: _normalizeError\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof (value) !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" + JSON.stringify(kind.name) + \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__.version);\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\nLogger.errors = ErrorCode;\nLogger.levels = LogLevel;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/logger/lib.esm/index.js?"); +Verify.prototype.verify = function verifyMethod(key, sig, enc) { + var sigBuffer = typeof sig === 'string' ? Buffer.from(sig, enc) : sig; -/***/ }), + this.end(); + var hash = this._hash.digest(); + return verify(sigBuffer, hash, key, this._signType, this._tag); +}; -/***/ "./node_modules/@hethers/signing-key/lib.esm/_version.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hethers/signing-key/lib.esm/_version.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +function createSign(algorithm) { + return new Sign(algorithm); +} + +function createVerify(algorithm) { + return new Verify(algorithm); +} + +module.exports = { + Sign: createSign, + Verify: createVerify, + createSign: createSign, + createVerify: createVerify +}; -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"signing-key/1.2.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/signing-key/lib.esm/_version.js?"); /***/ }), -/***/ "./node_modules/@hethers/signing-key/lib.esm/elliptic.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hethers/signing-key/lib.esm/elliptic.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 2957: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"EC\": function() { return /* binding */ EC; },\n/* harmony export */ \"ED\": function() { return /* binding */ ED; }\n/* harmony export */ });\n/* harmony import */ var elliptic__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! elliptic */ \"./node_modules/elliptic/lib/elliptic.js\");\n/* harmony import */ var elliptic__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(elliptic__WEBPACK_IMPORTED_MODULE_0__);\n\nvar EC = (elliptic__WEBPACK_IMPORTED_MODULE_0___default().ec);\nvar ED = (elliptic__WEBPACK_IMPORTED_MODULE_0___default().eddsa);\n\n//# sourceMappingURL=elliptic.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/signing-key/lib.esm/elliptic.js?"); -/***/ }), -/***/ "./node_modules/@hethers/signing-key/lib.esm/index.js": -/*!************************************************************!*\ - !*** ./node_modules/@hethers/signing-key/lib.esm/index.js ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var Buffer = (__webpack_require__(9509).Buffer); +var createHmac = __webpack_require__(8355); +var crt = __webpack_require__(3663); +var EC = (__webpack_require__(12).ec); +var BN = __webpack_require__(8815); +var parseKeys = __webpack_require__(980); +var curves = __webpack_require__(1308); + +var RSA_PKCS1_PADDING = 1; + +function sign(hash, key, hashType, signType, tag) { + var priv = parseKeys(key); + if (priv.curve) { + // rsa keys can be interpreted as ecdsa ones in openssl + if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong private key type'); } + return ecSign(hash, priv); + } else if (priv.type === 'dsa') { + if (signType !== 'dsa') { throw new Error('wrong private key type'); } + return dsaSign(hash, priv, hashType); + } + if (signType !== 'rsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong private key type'); } + if (key.padding !== undefined && key.padding !== RSA_PKCS1_PADDING) { throw new Error('illegal or unsupported padding mode'); } + + hash = Buffer.concat([tag, hash]); + var len = priv.modulus.byteLength(); + var pad = [0, 1]; + while (hash.length + pad.length + 1 < len) { pad.push(0xff); } + pad.push(0x00); + var i = -1; + while (++i < hash.length) { pad.push(hash[i]); } + + var out = crt(pad, priv); + return out; +} + +function ecSign(hash, priv) { + var curveId = curves[priv.curve.join('.')]; + if (!curveId) { throw new Error('unknown curve ' + priv.curve.join('.')); } + + var curve = new EC(curveId); + var key = curve.keyFromPrivate(priv.privateKey); + var out = key.sign(hash); + + return Buffer.from(out.toDER()); +} + +function dsaSign(hash, priv, algo) { + var x = priv.params.priv_key; + var p = priv.params.p; + var q = priv.params.q; + var g = priv.params.g; + var r = new BN(0); + var k; + var H = bits2int(hash, q).mod(q); + var s = false; + var kv = getKey(x, q, hash, algo); + while (s === false) { + k = makeKey(q, kv, algo); + r = makeR(g, k, p, q); + s = k.invm(q).imul(H.add(x.mul(r))).mod(q); + if (s.cmpn(0) === 0) { + s = false; + r = new BN(0); + } + } + return toDER(r, s); +} + +function toDER(r, s) { + r = r.toArray(); + s = s.toArray(); + + // Pad values + if (r[0] & 0x80) { r = [0].concat(r); } + if (s[0] & 0x80) { s = [0].concat(s); } + + var total = r.length + s.length + 4; + var res = [ + 0x30, total, 0x02, r.length + ]; + res = res.concat(r, [0x02, s.length], s); + return Buffer.from(res); +} + +function getKey(x, q, hash, algo) { + x = Buffer.from(x.toArray()); + if (x.length < q.byteLength()) { + var zeros = Buffer.alloc(q.byteLength() - x.length); + x = Buffer.concat([zeros, x]); + } + var hlen = hash.length; + var hbits = bits2octets(hash, q); + var v = Buffer.alloc(hlen); + v.fill(1); + var k = Buffer.alloc(hlen); + k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest(); + v = createHmac(algo, k).update(v).digest(); + k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest(); + v = createHmac(algo, k).update(v).digest(); + return { k: k, v: v }; +} + +function bits2int(obits, q) { + var bits = new BN(obits); + var shift = (obits.length << 3) - q.bitLength(); + if (shift > 0) { bits.ishrn(shift); } + return bits; +} + +function bits2octets(bits, q) { + bits = bits2int(bits, q); + bits = bits.mod(q); + var out = Buffer.from(bits.toArray()); + if (out.length < q.byteLength()) { + var zeros = Buffer.alloc(q.byteLength() - out.length); + out = Buffer.concat([zeros, out]); + } + return out; +} + +function makeKey(q, kv, algo) { + var t; + var k; + + do { + t = Buffer.alloc(0); + + while (t.length * 8 < q.bitLength()) { + kv.v = createHmac(algo, kv.k).update(kv.v).digest(); + t = Buffer.concat([t, kv.v]); + } + + k = bits2int(t, q); + kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest(); + kv.v = createHmac(algo, kv.k).update(kv.v).digest(); + } while (k.cmp(q) !== -1); + + return k; +} + +function makeR(g, k, p, q) { + return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q); +} + +module.exports = sign; +module.exports.getKey = getKey; +module.exports.makeKey = makeKey; + + +/***/ }), + +/***/ 7753: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SigningKey\": function() { return /* binding */ SigningKey; },\n/* harmony export */ \"SigningKeyED\": function() { return /* binding */ SigningKeyED; },\n/* harmony export */ \"computePublicKey\": function() { return /* binding */ computePublicKey; },\n/* harmony export */ \"recoverPublicKey\": function() { return /* binding */ recoverPublicKey; }\n/* harmony export */ });\n/* harmony import */ var _elliptic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./elliptic */ \"./node_modules/@hethers/signing-key/lib.esm/elliptic.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/signing-key/lib.esm/_version.js\");\n\n\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nlet _ecCurve = null;\nlet _edCurve = null;\nfunction getECCurve() {\n if (!_ecCurve) {\n _ecCurve = new _elliptic__WEBPACK_IMPORTED_MODULE_2__.EC(\"secp256k1\");\n }\n return _ecCurve;\n}\nfunction getEDCurve() {\n if (!_edCurve) {\n _edCurve = new _elliptic__WEBPACK_IMPORTED_MODULE_2__.ED(\"ed25519\");\n }\n return _edCurve;\n}\nclass SigningKeyED {\n constructor(privateKey) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"curve\", \"ed25519\");\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"privateKey\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(privateKey));\n const privKey = this.privateKey.startsWith(\"0x\") ? this.privateKey.slice(2) : this.privateKey;\n const keyPair = getEDCurve().keyFromSecret(privKey);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"publicKey\", \"0x\" + keyPair.getPublic(\"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"compressedPublicKey\", \"0x\" + keyPair.getPublic(\"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"_isSigningKey\", true);\n }\n _addPoint(other) {\n return logger.throwError(\"_addPoint not supported\", _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: '_addPoint'\n });\n }\n signDigest(digest) {\n return logger.throwError(\"signDigest not supported\", _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: 'signDigest'\n });\n }\n computeSharedSecret(otherKey) {\n return logger.throwError(\"computeSharedSecret not supported\", _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: 'computeSharedSecret'\n });\n }\n static isSigningKey(value) {\n return !!(value && value._isSigningKey);\n }\n}\nclass SigningKey {\n constructor(privateKey) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"curve\", \"secp256k1\");\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"privateKey\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(privateKey));\n const keyPair = getECCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"publicKey\", \"0x\" + keyPair.getPublic(false, \"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"compressedPublicKey\", \"0x\" + keyPair.getPublic(true, \"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"_isSigningKey\", true);\n }\n _addPoint(other) {\n const p0 = getECCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.publicKey));\n const p1 = getECCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(other));\n return \"0x\" + p0.pub.add(p1.pub).encodeCompressed(\"hex\");\n }\n signDigest(digest) {\n const keyPair = getECCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n const digestBytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(digest);\n if (digestBytes.length !== 32) {\n logger.throwArgumentError(\"bad digest length\", \"digest\", digest);\n }\n const signature = keyPair.sign(digestBytes, { canonical: true });\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.splitSignature)({\n recoveryParam: signature.recoveryParam,\n r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + signature.r.toString(16), 32),\n s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + signature.s.toString(16), 32),\n });\n }\n computeSharedSecret(otherKey) {\n const keyPair = getECCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n const otherKeyPair = getECCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(computePublicKey(otherKey)));\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);\n }\n static isSigningKey(value) {\n return !!(value && value._isSigningKey);\n }\n}\nfunction recoverPublicKey(digest, signature, isED25519Type) {\n if (isED25519Type) {\n return logger.throwError(\"recoverPublicKey not supported\", _hethers_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: \"recoverPublicKey\" });\n }\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.splitSignature)(signature);\n const rs = { r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(sig.r), s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(sig.s) };\n return \"0x\" + getECCurve().recoverPubKey((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(digest), rs, sig.recoveryParam).encode(\"hex\", false);\n}\nfunction computePublicKey(key, compressed, isED25519Type) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(key);\n if (isED25519Type) {\n return (new SigningKeyED(bytes)).publicKey;\n }\n if (bytes.length === 32) {\n const signingKey = new SigningKey(bytes);\n if (compressed) {\n return \"0x\" + getECCurve().keyFromPrivate(bytes).getPublic(true, \"hex\");\n }\n return signingKey.publicKey;\n }\n else if (bytes.length === 33) {\n if (compressed) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes);\n }\n return \"0x\" + getECCurve().keyFromPublic(bytes).getPublic(false, \"hex\");\n }\n else if (bytes.length === 65) {\n if (!compressed) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes);\n }\n return \"0x\" + getECCurve().keyFromPublic(bytes).getPublic(true, \"hex\");\n }\n return logger.throwArgumentError(\"invalid public or private key\", \"key\", \"[REDACTED]\");\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/signing-key/lib.esm/index.js?"); -/***/ }), -/***/ "./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!*************************************************************************************************!*\ - !*** ./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \*************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var Buffer = (__webpack_require__(9509).Buffer); +var BN = __webpack_require__(8815); +var EC = (__webpack_require__(12).ec); +var parseKeys = __webpack_require__(980); +var curves = __webpack_require__(1308); + +function verify(sig, hash, key, signType, tag) { + var pub = parseKeys(key); + if (pub.type === 'ec') { + // rsa keys can be interpreted as ecdsa ones in openssl + if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong public key type'); } + return ecVerify(sig, hash, pub); + } else if (pub.type === 'dsa') { + if (signType !== 'dsa') { throw new Error('wrong public key type'); } + return dsaVerify(sig, hash, pub); + } + if (signType !== 'rsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong public key type'); } + + hash = Buffer.concat([tag, hash]); + var len = pub.modulus.byteLength(); + var pad = [1]; + var padNum = 0; + while (hash.length + pad.length + 2 < len) { + pad.push(0xff); + padNum += 1; + } + pad.push(0x00); + var i = -1; + while (++i < hash.length) { + pad.push(hash[i]); + } + pad = Buffer.from(pad); + var red = BN.mont(pub.modulus); + sig = new BN(sig).toRed(red); + + sig = sig.redPow(new BN(pub.publicExponent)); + sig = Buffer.from(sig.fromRed().toArray()); + var out = padNum < 8 ? 1 : 0; + len = Math.min(sig.length, pad.length); + if (sig.length !== pad.length) { out = 1; } + + i = -1; + while (++i < len) { out |= sig[i] ^ pad[i]; } + return out === 0; +} + +function ecVerify(sig, hash, pub) { + var curveId = curves[pub.data.algorithm.curve.join('.')]; + if (!curveId) { throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.')); } + + var curve = new EC(curveId); + var pubkey = pub.data.subjectPrivateKey.data; + + return curve.verify(hash, sig, pubkey); +} + +function dsaVerify(sig, hash, pub) { + var p = pub.data.p; + var q = pub.data.q; + var g = pub.data.g; + var y = pub.data.pub_key; + var unpacked = parseKeys.signature.decode(sig, 'der'); + var s = unpacked.s; + var r = unpacked.r; + checkValue(s, q); + checkValue(r, q); + var montp = BN.mont(p); + var w = s.invm(q); + var v = g.toRed(montp) + .redPow(new BN(hash).mul(w).mod(q)) + .fromRed() + .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()) + .mod(p) + .mod(q); + return v.cmp(r) === 0; +} + +function checkValue(b, q) { + if (b.cmpn(0) <= 0) { throw new Error('invalid sig'); } + if (b.cmp(q) >= 0) { throw new Error('invalid sig'); } +} + +module.exports = verify; + + +/***/ }), + +/***/ 8815: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(2363).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert(false, 'Invalid character in ' + string); + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this._strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; + + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this._strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + + BN.prototype._move = function _move (dest) { + move(dest, this); + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; + } + + function inspect () { + return (this.red ? ''; + } + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; + + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; + } + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); + + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; + + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position < res.length) { + res[position++] = carry; + + while (position < res.length) { + res[position++] = 0; + } + } + }; + + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position >= 0) { + res[position--] = carry; + + while (position >= 0) { + res[position--] = 0; + } + } + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] >>> wbit) & 0x01; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this._strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this._strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this._strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this._strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this._strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this._strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out._strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out._strip(); + } + + function jumboMulTo (self, num, out) { + // Temporary disable, see https://github.com/indutny/bn.js/issues/211 + // var fftm = new FFTM(); + // return fftm.mulp(self, num, out); + return bigMulTo(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this._strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this._strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this._strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this._strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this._strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a._strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modrn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modrn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modrn = function modrn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return isNegNum ? -acc : acc; + }; + + // WARNING: DEPRECATED + BN.prototype.modn = function modn (num) { + return this.modrn(num); + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + this._strip(); + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this._strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is a BN v4 instance + r.strip(); + } else { + // r is a BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + + move(a, a.umod(this.m)._forceRed(this)); + return a; + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 12: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/_version.js?"); -/***/ }), -/***/ "./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!**********************************************************************************************!*\ - !*** ./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \**********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var elliptic = exports; + +elliptic.version = (__webpack_require__(5341)/* .version */ .i8); +elliptic.utils = __webpack_require__(6107); +elliptic.rand = __webpack_require__(5923); +elliptic.curve = __webpack_require__(9406); +elliptic.curves = __webpack_require__(5418); + +// Protocols +elliptic.ec = __webpack_require__(5765); +elliptic.eddsa = __webpack_require__(2087); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/signing-key/node_modules/@ethersproject/bytes/lib.esm/index.js?"); /***/ }), -/***/ "./node_modules/@hethers/transactions/lib.esm/_version.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hethers/transactions/lib.esm/_version.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 8663: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"transactions/1.2.1\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/transactions/lib.esm/_version.js?"); -/***/ }), -/***/ "./node_modules/@hethers/transactions/lib.esm/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hethers/transactions/lib.esm/index.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var BN = __webpack_require__(6046); +var utils = __webpack_require__(6107); +var getNAF = utils.getNAF; +var getJSF = utils.getJSF; +var assert = utils.assert; + +function BaseCurve(type, conf) { + this.type = type; + this.p = new BN(conf.p, 16); + + // Use Montgomery, when there is no fast reduction for the prime + this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); + + // Useful for many curves + this.zero = new BN(0).toRed(this.red); + this.one = new BN(1).toRed(this.red); + this.two = new BN(2).toRed(this.red); + + // Curve configuration, optional + this.n = conf.n && new BN(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + + // Temporary arrays + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); + + this._bitLength = this.n ? this.n.bitLength() : 0; + + // Generalized Greg Maxwell's trick + var adjustCount = this.n && this.p.div(this.n); + if (!adjustCount || adjustCount.cmpn(100) > 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} +module.exports = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + assert(p.precomputed); + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1, this._bitLength); + var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; + + // Translate into more windowed form + var repr = []; + var j; + var nafW; + for (j = 0; j < naf.length; j += doubles.step) { + nafW = 0; + for (var l = j + doubles.step - 1; l >= j; l--) + nafW = (nafW << 1) + naf[l]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (j = 0; j < repr.length; j++) { + nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w, this._bitLength); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var l = 0; i >= 0 && naf[i] === 0; i--) + l++; + if (i >= 0) + l++; + acc = acc.dblp(l); + + if (i < 0) + break; + var z = naf[i]; + assert(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len, + jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + var i; + var j; + var p; + for (i = 0; i < len; i++) { + p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); + naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b], /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3, /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (j = 0; j < len; j++) { + var z = tmp[j]; + p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (i = 0; i < len; i++) + wnd[i] = null; + + if (jacobianResult) + return acc; + else + return acc.toP(); +}; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} +BaseCurve.BasePoint = BasePoint; + +BasePoint.prototype.eq = function eq(/*other*/) { + throw new Error('Not implemented'); +}; + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + bytes = utils.toArray(bytes, enc); + + var len = this.p.byteLength(); + + // uncompressed, hybrid-odd, hybrid-even + if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && + bytes.length - 1 === 2 * len) { + if (bytes[0] === 0x06) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 0x07) + assert(bytes[bytes.length - 1] % 2 === 1); + + var res = this.point(bytes.slice(1, 1 + len), + bytes.slice(1 + len, 1 + 2 * len)); + + return res; + } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && + bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); + } + throw new Error('Unknown point format'); +}; + +BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); +}; + +BasePoint.prototype._encode = function _encode(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray('be', len); + + if (compact) + return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); + + return [ 0x04 ].concat(x, this.getY().toArray('be', len)); +}; + +BasePoint.prototype.encode = function encode(enc, compact) { + return utils.encode(this._encode(compact), enc); +}; + +BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null, + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) + return false; + + var doubles = this.precomputed.doubles; + if (!doubles) + return false; + + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles, + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res, + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; + + +/***/ }), + +/***/ 9810: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TransactionTypes\": function() { return /* binding */ TransactionTypes; },\n/* harmony export */ \"accessListify\": function() { return /* binding */ accessListify; },\n/* harmony export */ \"computeAlias\": function() { return /* binding */ computeAlias; },\n/* harmony export */ \"computeAliasFromPubKey\": function() { return /* binding */ computeAliasFromPubKey; },\n/* harmony export */ \"parse\": function() { return /* binding */ parse; },\n/* harmony export */ \"serializeHederaTransaction\": function() { return /* binding */ serializeHederaTransaction; }\n/* harmony export */ });\n/* harmony import */ var _hethers_address__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @hethers/address */ \"./node_modules/@hethers/address/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _hethers_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hethers/constants */ \"./node_modules/@hethers/constants/lib.esm/bignumbers.js\");\n/* harmony import */ var _hethers_signing_key__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @hethers/signing-key */ \"./node_modules/@hethers/signing-key/lib.esm/index.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/transactions/lib.esm/_version.js\");\n/* harmony import */ var _ethersproject_base64__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/base64 */ \"./node_modules/@hethers/transactions/node_modules/@ethersproject/base64/lib.esm/base64.js\");\n/* harmony import */ var _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/sdk */ \"./node_modules/@hashgraph/sdk/src/browser.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(long__WEBPACK_IMPORTED_MODULE_2__);\n\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\n\n\n\n\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger(_version__WEBPACK_IMPORTED_MODULE_4__.version);\nvar TransactionTypes;\n(function (TransactionTypes) {\n TransactionTypes[TransactionTypes[\"legacy\"] = 0] = \"legacy\";\n TransactionTypes[TransactionTypes[\"eip2930\"] = 1] = \"eip2930\";\n TransactionTypes[TransactionTypes[\"eip1559\"] = 2] = \"eip1559\";\n})(TransactionTypes || (TransactionTypes = {}));\n///////////////////////////////\nfunction handleNumber(value) {\n if (value === \"0x\") {\n return _hethers_constants__WEBPACK_IMPORTED_MODULE_5__.Zero;\n }\n return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__.BigNumber.from(value);\n}\nfunction computeAlias(key, isED25519Type) {\n const publicKey = (0,_hethers_signing_key__WEBPACK_IMPORTED_MODULE_7__.computePublicKey)(key, false, isED25519Type);\n return computeAliasFromPubKey(publicKey);\n}\nfunction computeAliasFromPubKey(pubKey) {\n return `0.0.${_ethersproject_base64__WEBPACK_IMPORTED_MODULE_8__.encode(pubKey)}`;\n}\nfunction accessSetify(addr, storageKeys) {\n return {\n address: (0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.getAddress)(addr),\n storageKeys: (storageKeys || []).map((storageKey, index) => {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.hexDataLength)(storageKey) !== 32) {\n logger.throwArgumentError(\"invalid access list storageKey\", `accessList[${addr}:${index}]`, storageKey);\n }\n return storageKey.toLowerCase();\n })\n };\n}\nfunction accessListify(value) {\n if (Array.isArray(value)) {\n return value.map((set, index) => {\n if (Array.isArray(set)) {\n if (set.length > 2) {\n logger.throwArgumentError(\"access list expected to be [ address, storageKeys[] ]\", `value[${index}]`, set);\n }\n return accessSetify(set[0], set[1]);\n }\n return accessSetify(set.address, set.storageKeys);\n });\n }\n const result = Object.keys(value).map((addr) => {\n const storageKeys = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, {});\n return accessSetify(addr, Object.keys(storageKeys).sort());\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\nfunction isAccountLike(str) {\n str = str.toString();\n const m = str.split('.').map((e) => parseInt(e)).filter((e) => e >= 0).length;\n return m == 3;\n}\nfunction validateMemo(memo, memoType) {\n if (memo.length > 100 || memo.length === 0) {\n logger.throwArgumentError(`invalid ${memoType} memo`, _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.INVALID_ARGUMENT, {\n memo: memo\n });\n }\n}\nfunction serializeHederaTransaction(transaction, pubKey) {\n var _a, _b, _c, _d;\n let tx;\n const arrayifiedData = transaction.data ? (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.arrayify)(transaction.data) : new Uint8Array();\n const gas = numberify(transaction.gasLimit ? transaction.gasLimit : 0);\n if (transaction.customData.isCryptoTransfer) {\n tx = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.TransferTransaction()\n .addHbarTransfer((0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.asAccountString)(transaction.from), new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Hbar(transaction.value.toString(), _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.HbarUnit.Tinybar).negated())\n .addHbarTransfer((0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.asAccountString)(transaction.to), new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Hbar(transaction.value.toString(), _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.HbarUnit.Tinybar));\n }\n else if (transaction.to) {\n tx = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.ContractExecuteTransaction()\n .setFunctionParameters(arrayifiedData)\n .setGas(gas);\n if (transaction.value) {\n tx.setPayableAmount(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Hbar.fromTinybars((_a = transaction.value) === null || _a === void 0 ? void 0 : _a.toString()));\n }\n if (transaction.customData.usingContractAlias) {\n tx.setContractId(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.ContractId.fromEvmAddress(0, 0, transaction.to.toString()));\n }\n else {\n tx.setContractId((0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.asAccountString)(transaction.to));\n }\n }\n else {\n if (transaction.customData.bytecodeFileId) {\n tx = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.ContractCreateTransaction()\n .setBytecodeFileId(transaction.customData.bytecodeFileId)\n .setConstructorParameters(arrayifiedData)\n .setInitialBalance((_b = transaction.value) === null || _b === void 0 ? void 0 : _b.toString())\n .setMaxAutomaticTokenAssociations((_d = (_c = transaction.customData) === null || _c === void 0 ? void 0 : _c.maxAutomaticTokenAssociations) !== null && _d !== void 0 ? _d : 0)\n .setGas(gas);\n if (transaction.customData.contractAdminKey) {\n const inputKey = transaction.customData.contractAdminKey;\n const keyInitializer = {};\n if (inputKey.toString().startsWith('0x')) {\n if ((0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.isAddress)(inputKey)) {\n const account = (0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.getAccountFromAddress)(inputKey);\n keyInitializer.contractID = {\n shardNum: new (long__WEBPACK_IMPORTED_MODULE_2___default())(numberify(account.shard)),\n realmNum: new (long__WEBPACK_IMPORTED_MODULE_2___default())(numberify(account.realm)),\n contractNum: new (long__WEBPACK_IMPORTED_MODULE_2___default())(numberify(account.num))\n };\n }\n else {\n keyInitializer.ECDSASecp256k1 = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.arrayify)(inputKey);\n }\n }\n if (isAccountLike(inputKey)) {\n const account = inputKey.split('.').map((e) => parseInt(e));\n keyInitializer.contractID = {\n shardNum: new (long__WEBPACK_IMPORTED_MODULE_2___default())(account[0]),\n realmNum: new (long__WEBPACK_IMPORTED_MODULE_2___default())(account[1]),\n contractNum: new (long__WEBPACK_IMPORTED_MODULE_2___default())(account[2])\n };\n }\n const key = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PublicKey._fromProtobufKey(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.Key.create(keyInitializer));\n tx.setAdminKey(key);\n }\n if (transaction.customData.contractMemo) {\n validateMemo(transaction.customData.contractMemo, 'contract');\n tx.setContractMemo(transaction.customData.contractMemo);\n }\n }\n else {\n if (transaction.customData.fileChunk && transaction.customData.fileId) {\n tx = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.FileAppendTransaction()\n .setContents(transaction.customData.fileChunk)\n .setFileId(transaction.customData.fileId)\n .setChunkSize(4096);\n }\n else if (!transaction.customData.fileId && transaction.customData.fileChunk) {\n // only a chunk, thus the first one\n tx = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.FileCreateTransaction()\n .setContents(transaction.customData.fileChunk)\n .setKeys([transaction.customData.fileKey ?\n transaction.customData.fileKey :\n pubKey\n ]);\n }\n else if (transaction.customData.publicKey) {\n const { publicKey, initialBalance } = transaction.customData;\n tx = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.AccountCreateTransaction()\n .setKey(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PublicKey.fromString(publicKey.toString()))\n .setInitialBalance(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Hbar.fromTinybars(initialBalance.toString()));\n }\n else {\n logger.throwArgumentError(\"Cannot determine transaction type from given custom data. Need either `to`, `fileChunk`, `fileId` or `bytecodeFileId`\", _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.INVALID_ARGUMENT, transaction);\n }\n }\n }\n if (transaction.customData.memo) {\n validateMemo(transaction.customData.memo, 'tx');\n tx.setTransactionMemo(transaction.customData.memo);\n }\n const account = (0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.getAccountFromAddress)(transaction.from.toString());\n tx.setTransactionId(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.TransactionId.generate(new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.AccountId({\n shard: numberify(account.shard),\n realm: numberify(account.realm),\n num: numberify(account.num)\n })))\n .setNodeAccountIds([_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.AccountId.fromString(transaction.nodeId.toString())])\n .freeze();\n return tx;\n}\nfunction parse(rawTransaction) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n const payload = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.arrayify)(rawTransaction);\n let parsed;\n try {\n parsed = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.Transaction.fromBytes(payload);\n }\n catch (error) {\n logger.throwArgumentError(error.message, \"rawTransaction\", rawTransaction);\n }\n const tx = parsed.transactionId;\n const nanos = tx.validStart.nanos.toString().padStart(9, '0');\n const seconds = tx.validStart.seconds.toString().padStart(10, '0');\n let contents = {\n transactionId: `${tx.accountId.toString()}-${seconds}-${nanos}`,\n hash: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.hexlify)(yield parsed.getTransactionHash()),\n from: (0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.getAddressFromAccount)(parsed.transactionId.accountId.toString()),\n };\n if (parsed instanceof _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.ContractExecuteTransaction) {\n parsed = parsed;\n contents.to = (0,_hethers_address__WEBPACK_IMPORTED_MODULE_9__.getAddressFromAccount)((_a = parsed.contractId) === null || _a === void 0 ? void 0 : _a.toString());\n contents.gasLimit = handleNumber(parsed.gas.toString());\n contents.value = parsed.payableAmount ?\n handleNumber(parsed.payableAmount.toTinybars().toString()) : handleNumber('0');\n contents.data = parsed.functionParameters ? (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.hexlify)(parsed.functionParameters) : '0x';\n }\n else if (parsed instanceof _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.ContractCreateTransaction) {\n parsed = parsed;\n contents.gasLimit = handleNumber(parsed.gas.toString());\n contents.value = parsed.initialBalance ?\n handleNumber(parsed.initialBalance.toBigNumber().toString()) : handleNumber('0');\n // TODO IMPORTANT! We are setting only the constructor arguments and not the whole bytecode + constructor args\n contents.data = parsed.constructorParameters ? (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.hexlify)(parsed.constructorParameters) : '0x';\n }\n else if (parsed instanceof _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.FileCreateTransaction) {\n parsed = parsed;\n contents.data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.hexlify)(Buffer.from(parsed.contents));\n }\n else if (parsed instanceof _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.FileAppendTransaction) {\n parsed = parsed;\n contents.data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_10__.hexlify)(Buffer.from(parsed.contents));\n }\n else if (parsed instanceof _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.TransferTransaction) {\n // TODO populate value / to?\n }\n else if (parsed instanceof _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.AccountCreateTransaction) {\n parsed = parsed;\n contents.value = parsed.initialBalance ?\n handleNumber(parsed.initialBalance.toBigNumber().toString()) : handleNumber('0');\n }\n else {\n return logger.throwError(`unsupported transaction`, _hethers_logger__WEBPACK_IMPORTED_MODULE_3__.Logger.errors.UNSUPPORTED_OPERATION, { operation: \"parse\" });\n }\n // TODO populate r, s ,v\n return Object.assign(Object.assign({}, contents), { chainId: 0, r: '', s: '', v: 0 });\n });\n}\nfunction numberify(num) {\n return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__.BigNumber.from(num).toNumber();\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/transactions/lib.esm/index.js?"); -/***/ }), -/***/ "./node_modules/@hethers/transactions/node_modules/@ethersproject/base64/lib.esm/base64.js": -/*!*************************************************************************************************!*\ - !*** ./node_modules/@hethers/transactions/node_modules/@ethersproject/base64/lib.esm/base64.js ***! - \*************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var utils = __webpack_require__(6107); +var BN = __webpack_require__(6046); +var inherits = __webpack_require__(5717); +var Base = __webpack_require__(8663); + +var assert = utils.assert; + +function EdwardsCurve(conf) { + // NOTE: Important as we are creating point in Base.call() + this.twisted = (conf.a | 0) !== 1; + this.mOneA = this.twisted && (conf.a | 0) === -1; + this.extended = this.mOneA; + + Base.call(this, 'edwards', conf); + + this.a = new BN(conf.a, 16).umod(this.red.m); + this.a = this.a.toRed(this.red); + this.c = new BN(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new BN(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = (conf.c | 0) === 1; +} +inherits(EdwardsCurve, Base); +module.exports = EdwardsCurve; + +EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); +}; + +EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); +}; + +// Just for compatibility with Short curve +EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); +}; + +EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + + var y2 = rhs.redMul(lhs.redInvm()); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { + y = new BN(y, 16); + if (!y.red) + y = y.toRed(this.red); + + // x^2 = (y^2 - c^2) / (c^2 d y^2 - a) + var y2 = y.redSqr(); + var lhs = y2.redSub(this.c2); + var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a); + var x2 = lhs.redMul(rhs.redInvm()); + + if (x2.cmp(this.zero) === 0) { + if (odd) + throw new Error('invalid point'); + else + return this.point(this.zero, y); + } + + var x = x2.redSqrt(); + if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + if (x.fromRed().isOdd() !== odd) + x = x.redNeg(); + + return this.point(x, y); +}; + +EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + + // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) + point.normalize(); + + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + + return lhs.cmp(rhs) === 0; +}; + +function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = z ? new BN(z, 16) : this.curve.one; + this.t = t && new BN(t, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + + // Use extended coordinates + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } +} +inherits(Point, Base.BasePoint); + +EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.x.cmpn(0) === 0 && + (this.y.cmp(this.z) === 0 || + (this.zOne && this.y.cmp(this.curve.c) === 0)); +}; + +Point.prototype._extDbl = function _extDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #doubling-dbl-2008-hwcd + // 4M + 4S + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = 2 * Z1^2 + var c = this.z.redSqr(); + c = c.redIAdd(c); + // D = a * A + var d = this.curve._mulA(a); + // E = (X1 + Y1)^2 - A - B + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + // G = D + B + var g = d.redAdd(b); + // F = G - C + var f = g.redSub(c); + // H = D - B + var h = d.redSub(b); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projDbl = function _projDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #doubling-dbl-2008-bbjlp + // #doubling-dbl-2007-bl + // and others + // Generally 3M + 4S or 2M + 4S + + // B = (X1 + Y1)^2 + var b = this.x.redAdd(this.y).redSqr(); + // C = X1^2 + var c = this.x.redSqr(); + // D = Y1^2 + var d = this.y.redSqr(); + + var nx; + var ny; + var nz; + var e; + var h; + var j; + if (this.curve.twisted) { + // E = a * C + e = this.curve._mulA(c); + // F = E + D + var f = e.redAdd(d); + if (this.zOne) { + // X3 = (B - C - D) * (F - 2) + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F^2 - 2 * F + nz = f.redSqr().redSub(f).redSub(f); + } else { + // H = Z1^2 + h = this.z.redSqr(); + // J = F - 2 * H + j = f.redSub(h).redISub(h); + // X3 = (B-C-D)*J + nx = b.redSub(c).redISub(d).redMul(j); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F * J + nz = f.redMul(j); + } + } else { + // E = C + D + e = c.redAdd(d); + // H = (c * Z1)^2 + h = this.curve._mulC(this.z).redSqr(); + // J = E - 2 * H + j = e.redSub(h).redSub(h); + // X3 = c * (B - E) * J + nx = this.curve._mulC(b.redISub(e)).redMul(j); + // Y3 = c * E * (C - D) + ny = this.curve._mulC(e).redMul(c.redISub(d)); + // Z3 = E * J + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + // Double in extended coordinates + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); +}; + +Point.prototype._extAdd = function _extAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #addition-add-2008-hwcd-3 + // 8M + + // A = (Y1 - X1) * (Y2 - X2) + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + // B = (Y1 + X1) * (Y2 + X2) + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + // C = T1 * k * T2 + var c = this.t.redMul(this.curve.dd).redMul(p.t); + // D = Z1 * 2 * Z2 + var d = this.z.redMul(p.z.redAdd(p.z)); + // E = B - A + var e = b.redSub(a); + // F = D - C + var f = d.redSub(c); + // G = D + C + var g = d.redAdd(c); + // H = B + A + var h = b.redAdd(a); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projAdd = function _projAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #addition-add-2008-bbjlp + // #addition-add-2007-bl + // 10M + 1S + + // A = Z1 * Z2 + var a = this.z.redMul(p.z); + // B = A^2 + var b = a.redSqr(); + // C = X1 * X2 + var c = this.x.redMul(p.x); + // D = Y1 * Y2 + var d = this.y.redMul(p.y); + // E = d * C * D + var e = this.curve.d.redMul(c).redMul(d); + // F = B - E + var f = b.redSub(e); + // G = B + E + var g = b.redAdd(e); + // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + var ny; + var nz; + if (this.curve.twisted) { + // Y3 = A * G * (D - a * C) + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + // Z3 = F * G + nz = f.redMul(g); + } else { + // Y3 = A * G * (D - C) + ny = a.redMul(g).redMul(d.redSub(c)); + // Z3 = c * F * G + nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); +}; + +Point.prototype.mul = function mul(k) { + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true); +}; + +Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + + // Normalize coordinates + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; +}; + +Point.prototype.neg = function neg() { + return this.curve.point(this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg()); +}; + +Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); +}; + +Point.prototype.eq = function eq(other) { + return this === other || + this.getX().cmp(other.getX()) === 0 && + this.getY().cmp(other.getY()) === 0; +}; + +Point.prototype.eqXToP = function eqXToP(x) { + var rx = x.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(this.z); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } +}; + +// Compatibility with BaseCurve +Point.prototype.toP = Point.prototype.normalize; +Point.prototype.mixedAdd = Point.prototype.add; + + +/***/ }), + +/***/ 9406: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; },\n/* harmony export */ \"encode\": function() { return /* binding */ encode; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n\n\nfunction decode(textData) {\n textData = atob(textData);\n const data = [];\n for (let i = 0; i < textData.length; i++) {\n data.push(textData.charCodeAt(i));\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(data);\n}\nfunction encode(data) {\n data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(data);\n let textData = \"\";\n for (let i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n}\n//# sourceMappingURL=base64.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/transactions/node_modules/@ethersproject/base64/lib.esm/base64.js?"); -/***/ }), -/***/ "./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js": -/*!******************************************************************************************************!*\ - !*** ./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! - \******************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var curve = exports; + +curve.base = __webpack_require__(8663); +curve.short = __webpack_require__(6911); +curve.mont = __webpack_require__(9206); +curve.edwards = __webpack_require__(9810); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bignumber/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js?"); /***/ }), -/***/ "./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": -/*!*******************************************************************************************************!*\ - !*** ./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! - \*******************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/***/ 9206: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigNumber\": function() { return /* binding */ BigNumber; },\n/* harmony export */ \"_base16To36\": function() { return /* binding */ _base16To36; },\n/* harmony export */ \"_base36To16\": function() { return /* binding */ _base36To16; },\n/* harmony export */ \"isBigNumberish\": function() { return /* binding */ isBigNumberish; }\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/_version.js\");\n\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\n\nvar BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN);\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nfunction isBigNumberish(value) {\n return (value != null) && (BigNumber.isBigNumber(value) ||\n (typeof (value) === \"number\" && (value % 1) === 0) ||\n (typeof (value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) ||\n (typeof (value) === \"bigint\") ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nclass BigNumber {\n constructor(constructorGuard, hex) {\n logger.checkNew(new.target, BigNumber);\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division by zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot modulo negative values\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"cannot raise to negative values\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'and' negative values\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'or' negative values\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"cannot 'xor' negative values\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot mask negative values\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"cannot shift negative values\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return (this._hex[0] === \"-\");\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof (value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof (value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof (anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) {\n return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof (hex) === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof (hex) === \"string\") {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === \"-\" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof (value) !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nfunction _base36To16(value) {\n return (new BN(value, 36)).toString(16);\n}\n// value should have no prefix\nfunction _base16To36(value) {\n return (new BN(value, 16)).toString(36);\n}\n//# sourceMappingURL=bignumber.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/transactions/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js?"); -/***/ }), -/***/ "./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \**************************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var BN = __webpack_require__(6046); +var inherits = __webpack_require__(5717); +var Base = __webpack_require__(8663); + +var utils = __webpack_require__(6107); + +function MontCurve(conf) { + Base.call(this, 'mont', conf); + + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.i4 = new BN(4).toRed(this.red).redInvm(); + this.two = new BN(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +} +inherits(MontCurve, Base); +module.exports = MontCurve; + +MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + + return y.redSqr().cmp(rhs) === 0; +}; + +function Point(curve, x, z) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new BN(x, 16); + this.z = new BN(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } +} +inherits(Point, Base.BasePoint); + +MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + return this.point(utils.toArray(bytes, enc), 1); +}; + +MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); +}; + +MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +Point.prototype.precompute = function precompute() { + // No-op +}; + +Point.prototype._encode = function _encode() { + return this.getX().toArray('be', this.curve.p.byteLength()); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +Point.prototype.dbl = function dbl() { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 + // 2M + 2S + 4A + + // A = X1 + Z1 + var a = this.x.redAdd(this.z); + // AA = A^2 + var aa = a.redSqr(); + // B = X1 - Z1 + var b = this.x.redSub(this.z); + // BB = B^2 + var bb = b.redSqr(); + // C = AA - BB + var c = aa.redSub(bb); + // X3 = AA * BB + var nx = aa.redMul(bb); + // Z3 = C * (BB + A24 * C) + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); +}; + +Point.prototype.add = function add() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.diffAdd = function diffAdd(p, diff) { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 + // 4M + 2S + 6A + + // A = X2 + Z2 + var a = this.x.redAdd(this.z); + // B = X2 - Z2 + var b = this.x.redSub(this.z); + // C = X3 + Z3 + var c = p.x.redAdd(p.z); + // D = X3 - Z3 + var d = p.x.redSub(p.z); + // DA = D * A + var da = d.redMul(a); + // CB = C * B + var cb = c.redMul(b); + // X5 = Z1 * (DA + CB)^2 + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + // Z5 = X1 * (DA - CB)^2 + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); +}; + +Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; // (N / 2) * Q + Q + var b = this.curve.point(null, null); // (N / 2) * Q + var c = this; // Q + + for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) + bits.push(t.andln(1)); + + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q + a = a.diffAdd(b, c); + // N * Q = 2 * ((N / 2) * Q + Q)) + b = b.dbl(); + } else { + // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) + b = a.diffAdd(b, c); + // N * Q + Q = 2 * ((N / 2) * Q + Q) + a = a.dbl(); + } + } + return b; +}; + +Point.prototype.mulAdd = function mulAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.jumlAdd = function jumlAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.eq = function eq(other) { + return this.getX().cmp(other.getX()) === 0; +}; + +Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; +}; + +Point.prototype.getX = function getX() { + // Normalize coordinates + this.normalize(); + + return this.x.fromRed(); +}; + + +/***/ }), + +/***/ 6911: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/_version.js?"); -/***/ }), -/***/ "./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!***********************************************************************************************!*\ - !*** ./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \***********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var utils = __webpack_require__(6107); +var BN = __webpack_require__(6046); +var inherits = __webpack_require__(5717); +var Base = __webpack_require__(8663); + +var assert = utils.assert; + +function ShortCurve(conf) { + Base.call(this, 'short', conf); + + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; + + // If the curve is endomorphic, precalculate beta and lambda + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +inherits(ShortCurve, Base); +module.exports = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + + // Compute beta and lambda, that lambda * P = (beta * Px; Py) + var beta; + var lambda; + if (conf.beta) { + beta = new BN(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + // Choose the smallest beta + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new BN(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + + // Get basis vectors, used for balanced length-two representation + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new BN(vec.a, 16), + b: new BN(vec.b, 16), + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis, + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : BN.mont(num); + var tinv = new BN(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + + var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv); + + var l1 = ntinv.redAdd(s).fromRed(); + var l2 = ntinv.redSub(s).fromRed(); + return [ l1, l2 ]; +}; + +ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + + // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + var u = lambda; + var v = this.n.clone(); + var x1 = new BN(1); + var y1 = new BN(0); + var x2 = new BN(0); + var y2 = new BN(1); + + // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + var a0; + var b0; + // First vector + var a1; + var b1; + // Second vector + var a2; + var b2; + + var prevR; + var i = 0; + var r; + var x; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + r = v.sub(q.mul(u)); + x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + prevR = r; + + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r.neg(); + b2 = x; + + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + + // Normalize signs + if (a1.negative) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.negative) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 }, + ]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + + // Calculate answer + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1: k1, k2: k2 }; +}; + +ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) + return true; + + var x = point.x; + var y = point.y; + + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = + function _endoWnafMulAdd(points, coeffs, jacobianResult) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + var p = points[i]; + var beta = p._getBeta(); + + if (split.k1.negative) { + split.k1.ineg(); + p = p.neg(true); + } + if (split.k2.negative) { + split.k2.ineg(); + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); + + // Clean-up references to points and coefficients + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; + }; + +function Point(curve, x, y, isRed) { + Base.BasePoint.call(this, curve, 'affine'); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + // Force redgomery representation when loading from JSON + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +inherits(Point, Base.BasePoint); + +ShortCurve.prototype.point = function point(x, y, isRed) { + return new Point(this, x, y, isRed); +}; + +ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); +}; + +Point.prototype._getBeta = function _getBeta() { + if (!this.curve.endo) + return; + + var pre = this.precomputed; + if (pre && pre.beta) + return pre.beta; + + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (pre) { + var curve = this.curve; + var endoMul = function(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + }; + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul), + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul), + }, + }; + } + return beta; +}; + +Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) + return [ this.x, this.y ]; + + return [ this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1), + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1), + }, + } ]; +}; + +Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === 'string') + obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) + return res; + + function obj2point(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [ res ].concat(pre.doubles.points.map(obj2point)), + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [ res ].concat(pre.naf.points.map(obj2point)), + }, + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) + return p; + + // P + O = P + if (p.inf) + return this; + + // P + P = 2P + if (this.eq(p)) + return this.dbl(); + + // P + (-P) = O + if (this.neg().eq(p)) + return this.curve.point(null, null); + + // P + Q = O + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + + // 2P = O + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + + var a = this.curve.a; + + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new BN(k, 16); + if (this.isInfinity()) + return this; + else if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else if (this.curve.endo) + return this.curve._endoWnafMulAdd([ this ], [ k ]); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs, true); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2, true); +}; + +Point.prototype.eq = function eq(p) { + return this === p || + this.inf === p.inf && + (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); +}; + +Point.prototype.neg = function neg(_precompute) { + if (this.inf) + return this; + + var res = this.curve.point(this.x, this.y.redNeg()); + if (_precompute && this.precomputed) { + var pre = this.precomputed; + var negate = function(p) { + return p.neg(); + }; + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate), + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate), + }, + }; + } + return res; +}; + +Point.prototype.toJ = function toJ() { + if (this.inf) + return this.curve.jpoint(null, null, null); + + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; +}; + +function JPoint(curve, x, y, z) { + Base.BasePoint.call(this, curve, 'jacobian'); + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new BN(0); + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = new BN(z, 16); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + + this.zOne = this.z === this.curve.one; +} +inherits(JPoint, Base.BasePoint); + +ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); +}; + +JPoint.prototype.toP = function toP() { + if (this.isInfinity()) + return this.curve.point(null, null); + + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + + return this.curve.point(ax, ay); +}; + +JPoint.prototype.neg = function neg() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; + +JPoint.prototype.add = function add(p) { + // O + P = P + if (this.isInfinity()) + return p; + + // P + O = P + if (p.isInfinity()) + return this; + + // 12M + 4S + 7A + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) + return p.toJ(); + + // P + O = P + if (p.isInfinity()) + return this; + + // 8M + 3S + 7A + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + + var i; + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + for (i = 0; i < pow; i++) + r = r.dbl(); + return r; + } + + // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + var a = this.curve.a; + var tinv = this.curve.tinv; + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + // Reuse results + var jyd = jy.redAdd(jy); + for (i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) + jz4 = jz4.redMul(jyd4); + + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 14A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // T = M ^ 2 - 2*S + var t = m.redSqr().redISub(s).redISub(s); + + // 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2*Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-dbl-2009-l + // 2M + 5S + 13A + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = B^2 + var c = b.redSqr(); + // D = 2 * ((X1 + B)^2 - A - C) + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + // E = 3 * A + var e = a.redAdd(a).redIAdd(a); + // F = E^2 + var f = e.redSqr(); + + // 8 * C + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + + // X3 = F - 2 * D + nx = f.redISub(d).redISub(d); + // Y3 = E * (D - X3) - 8 * C + ny = e.redMul(d.redISub(nx)).redISub(c8); + // Z3 = 2 * Y1 * Z1 + nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 15A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + // T = M^2 - 2 * S + var t = m.redSqr().redISub(s).redISub(s); + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2 * Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + + // delta = Z1^2 + var delta = this.z.redSqr(); + // gamma = Y1^2 + var gamma = this.y.redSqr(); + // beta = X1 * gamma + var beta = this.x.redMul(gamma); + // alpha = 3 * (X1 - delta) * (X1 + delta) + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + // X3 = alpha^2 - 8 * beta + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + // Z3 = (Y1 + Z1)^2 - gamma - delta + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; + + // 4M + 6S + 10A + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // ZZ = Z1^2 + var zz = this.z.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // M = 3 * XX + a * ZZ2; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // MM = M^2 + var mm = m.redSqr(); + // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); + // EE = E^2 + var ee = e.redSqr(); + // T = 16*YYYY + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + // U = (M + E)^2 - MM - EE - T + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + // X3 = 4 * (X1 * EE - 4 * YY * U) + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + // Z3 = (Z1 + E)^2 - ZZ - EE + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new BN(k, kbase); + + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') + return this.eq(p.toJ()); + + if (this === p) + return true; + + // x1 * z2^2 == x2 * z1^2 + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + + // y1 * z2^3 == y2 * z1^3 + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.eqXToP = function eqXToP(x) { + var zs = this.z.redSqr(); + var rx = x.toRed(this.curve.red).redMul(zs); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(zs); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + + +/***/ }), + +/***/ 5418: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/transactions/node_modules/@ethersproject/bytes/lib.esm/index.js?"); -/***/ }), -/***/ "./node_modules/@hethers/wallet/lib.esm/_version.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hethers/wallet/lib.esm/_version.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var curves = exports; + +var hash = __webpack_require__(3715); +var curve = __webpack_require__(9406); +var utils = __webpack_require__(6107); + +var assert = utils.assert; + +function PresetCurve(options) { + if (options.type === 'short') + this.curve = new curve.short(options); + else if (options.type === 'edwards') + this.curve = new curve.edwards(options); + else + this.curve = new curve.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); +} +curves.PresetCurve = PresetCurve; + +function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve, + }); + return curve; + }, + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash.sha256, + gRed: false, + g: [ + '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', + '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811', + ], +}); + +defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: hash.sha256, + gRed: false, + g: [ + 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', + 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34', + ], +}); + +defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: hash.sha256, + gRed: false, + g: [ + '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5', + ], +}); + +defineCurve('p384', { + type: 'short', + prime: null, + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 ffffffff', + a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 fffffffc', + b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', + n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', + hash: hash.sha384, + gRed: false, + g: [ + 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + + '5502f25d bf55296c 3a545e38 72760ab7', + '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f', + ], +}); + +defineCurve('p521', { + type: 'short', + prime: null, + p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff', + a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff fffffffc', + b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', + n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', + hash: hash.sha512, + gRed: false, + g: [ + '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', + '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + + '3fad0761 353c7086 a272c240 88be9476 9fd16650', + ], +}); + +defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '1', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '9', + ], +}); + +defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', + + // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658', + ], +}); + +var pre; +try { + pre = __webpack_require__(9384); +} catch (e) { + pre = undefined; +} + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash.sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3', + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15', + }, + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + pre, + ], +}); + + +/***/ }), + +/***/ 5765: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"wallet/1.2.1\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/wallet/lib.esm/_version.js?"); -/***/ }), -/***/ "./node_modules/@hethers/wallet/lib.esm/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hethers/wallet/lib.esm/index.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var BN = __webpack_require__(6046); +var HmacDRBG = __webpack_require__(2156); +var utils = __webpack_require__(6107); +var curves = __webpack_require__(5418); +var rand = __webpack_require__(5923); +var assert = utils.assert; + +var KeyPair = __webpack_require__(5594); +var Signature = __webpack_require__(2891); + +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert(Object.prototype.hasOwnProperty.call(curves, options), + 'Unknown curve ' + options); + + options = curves[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + if (options instanceof curves.PresetCurve) + options = { curve: options }; + + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.ushrn(1); + this.g = this.curve.g; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +module.exports = EC; + +EC.prototype.keyPair = function keyPair(options) { + return new KeyPair(this, options); +}; + +EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return KeyPair.fromPrivate(this, priv, enc); +}; + +EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return KeyPair.fromPublic(this, pub, enc); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + entropy: options.entropy || rand(this.hash.hmacStrength), + entropyEnc: options.entropy && options.entropyEnc || 'utf8', + nonce: this.n.toArray(), + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new BN(2)); + for (;;) { + var priv = new BN(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + + priv.iaddn(1); + return this.keyFromPrivate(priv); + } +}; + +EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) + msg = msg.ushrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; +}; + +EC.prototype.sign = function sign(msg, key, enc, options) { + if (typeof enc === 'object') { + options = enc; + enc = null; + } + if (!options) + options = {}; + + key = this.keyFromPrivate(key, enc); + msg = this._truncateToN(new BN(msg, 16)); + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray('be', bytes); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray('be', bytes); + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce: nonce, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new BN(1)); + + for (var iter = 0; ; iter++) { + var k = options.k ? + options.k(iter) : + new BN(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + + var kpX = kp.getX(); + var r = kpX.umod(this.n); + if (r.cmpn(0) === 0) + continue; + + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); + s = s.umod(this.n); + if (s.cmpn(0) === 0) + continue; + + var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | + (kpX.cmp(r) !== 0 ? 2 : 0); + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + + return new Signature({ r: r, s: s, recoveryParam: recoveryParam }); + } +}; + +EC.prototype.verify = function verify(msg, signature, key, enc) { + msg = this._truncateToN(new BN(msg, 16)); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, 'hex'); + + // Perform primitive values validation + var r = signature.r; + var s = signature.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) + return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) + return false; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r).umod(this.n); + var p; + + if (!this.curve._maxwellTrick) { + p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().umod(this.n).cmp(r) === 0; + } + + // NOTE: Greg Maxwell's trick, inspired by: + // https://git.io/vad3K + + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + // Compare `p.x` of Jacobian point with `r`, + // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the + // inverse of `p.z^2` + return p.eqXToP(r); +}; + +EC.prototype.recoverPubKey = function(msg, signature, j, enc) { + assert((3 & j) === j, 'The recovery param is more than two bits'); + signature = new Signature(signature, enc); + + var n = this.n; + var e = new BN(msg); + var r = signature.r; + var s = signature.s; + + // A set LSB signifies that the y-coordinate is odd + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) + throw new Error('Unable to find sencond key candinate'); + + // 1.1. Let x = r + jn. + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + + // 1.6.1 Compute Q = r^-1 (sR - eG) + // Q = r^-1 (sR + -eG) + return this.g.mulAdd(s1, r, s2); +}; + +EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { + signature = new Signature(signature, enc); + if (signature.recoveryParam !== null) + return signature.recoveryParam; + + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature, i); + } catch (e) { + continue; + } + + if (Qprime.eq(Q)) + return i; + } + throw new Error('Unable to find valid recovery factor'); +}; + + +/***/ }), + +/***/ 5594: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Wallet\": function() { return /* binding */ Wallet; },\n/* harmony export */ \"verifyMessage\": function() { return /* binding */ verifyMessage; }\n/* harmony export */ });\n/* harmony import */ var _hethers_address__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @hethers/address */ \"./node_modules/@hethers/address/lib.esm/index.js\");\n/* harmony import */ var _hethers_abstract_provider__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @hethers/abstract-provider */ \"./node_modules/@hethers/abstract-provider/lib.esm/index.js\");\n/* harmony import */ var _hethers_abstract_signer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @hethers/abstract-signer */ \"./node_modules/@hethers/abstract-signer/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ethersproject/hash */ \"./node_modules/@hethers/wallet/node_modules/@ethersproject/hash/lib.esm/message.js\");\n/* harmony import */ var _hethers_hdnode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @hethers/hdnode */ \"./node_modules/@hethers/hdnode/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@hethers/wallet/node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @ethersproject/random */ \"./node_modules/@ethersproject/random/lib.esm/random.js\");\n/* harmony import */ var _hethers_signing_key__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hethers/signing-key */ \"./node_modules/@hethers/signing-key/lib.esm/index.js\");\n/* harmony import */ var _hethers_json_wallets__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @hethers/json-wallets */ \"./node_modules/@hethers/json-wallets/lib.esm/keystore.js\");\n/* harmony import */ var _hethers_json_wallets__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @hethers/json-wallets */ \"./node_modules/@hethers/json-wallets/lib.esm/index.js\");\n/* harmony import */ var _hethers_transactions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @hethers/transactions */ \"./node_modules/@hethers/transactions/lib.esm/index.js\");\n/* harmony import */ var _hethers_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hethers/logger */ \"./node_modules/@hethers/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/wallet/lib.esm/_version.js\");\n/* harmony import */ var _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/sdk */ \"./node_modules/@hashgraph/sdk/src/browser.js\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst logger = new _hethers_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nfunction isAccount(value) {\n if (!value || !value.privateKey)\n return false;\n let privKeyCopy = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromString(value.privateKey).toStringRaw();\n if (!privKeyCopy.startsWith('0x')) {\n privKeyCopy = '0x' + privKeyCopy;\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(privKeyCopy, 32);\n}\nfunction hasMnemonic(value) {\n const mnemonic = value.mnemonic;\n return (mnemonic && mnemonic.phrase);\n}\nfunction hasAlias(value) {\n return isAccount(value) && value.alias != null;\n}\nfunction prepend0x(value) {\n if (value.match(/^[0-9a-f]*$/i) && value.length === 64) {\n return `0x${value}`;\n }\n return value;\n}\nclass Wallet extends _hethers_abstract_signer__WEBPACK_IMPORTED_MODULE_4__.Signer {\n constructor(identity, provider) {\n logger.checkNew(new.target, Wallet);\n super();\n if (isAccount(identity) && !_hethers_signing_key__WEBPACK_IMPORTED_MODULE_5__.SigningKey.isSigningKey(identity)) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"isED25519Type\", !!identity.isED25519Type);\n // removes DER header if presented in the private key\n let privKey = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromString(identity.privateKey).toStringRaw();\n // A lot of common tools do not prefix private keys with a 0x (see: #1166)\n if (typeof (privKey) === \"string\") {\n privKey = prepend0x(privKey);\n }\n const signingKey = (0,_hethers_hdnode__WEBPACK_IMPORTED_MODULE_7__.initializeSigningKey)(privKey, this.isED25519Type);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"_signingKey\", () => signingKey);\n if (identity.address || identity.account) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"address\", identity.address ? (0,_hethers_address__WEBPACK_IMPORTED_MODULE_8__.getAddress)(identity.address) : (0,_hethers_address__WEBPACK_IMPORTED_MODULE_8__.getAddressFromAccount)(identity.account));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"account\", identity.account ? identity.account : (0,_hethers_address__WEBPACK_IMPORTED_MODULE_8__.getAccountFromAddress)(identity.address));\n }\n if (hasAlias(identity)) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"alias\", identity.alias);\n if (this.alias !== (0,_hethers_transactions__WEBPACK_IMPORTED_MODULE_9__.computeAlias)(signingKey.privateKey, this.isED25519Type)) {\n logger.throwArgumentError(\"privateKey/alias mismatch\", \"privateKey\", \"[REDACTED]\");\n }\n }\n if (hasMnemonic(identity)) {\n const srcMnemonic = identity.mnemonic;\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"_mnemonic\", () => ({\n phrase: srcMnemonic.phrase,\n path: srcMnemonic.path || _hethers_hdnode__WEBPACK_IMPORTED_MODULE_7__.defaultPath,\n locale: srcMnemonic.locale || \"en\"\n }));\n const mnemonic = this.mnemonic;\n const node = _hethers_hdnode__WEBPACK_IMPORTED_MODULE_7__.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale, this.isED25519Type).derivePath(mnemonic.path);\n if (node.privateKey !== this._signingKey().privateKey) {\n logger.throwArgumentError(\"mnemonic/privateKey mismatch\", \"privateKey\", \"[REDACTED]\");\n }\n }\n else {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"_mnemonic\", () => null);\n }\n }\n else {\n if (_hethers_signing_key__WEBPACK_IMPORTED_MODULE_5__.SigningKey.isSigningKey(identity)) {\n /* istanbul ignore if */\n if (identity.curve !== \"secp256k1\" && identity.curve !== \"ed25519\") {\n logger.throwArgumentError(\"unsupported curve; must be secp256k1 or ed25519\", \"privateKey\", \"[REDACTED]\");\n }\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"_signingKey\", () => identity);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"isED25519Type\", identity.curve === \"ed25519\");\n }\n else {\n // A lot of common tools do not prefix private keys with a 0x (see: #1166)\n if (typeof (identity) === \"string\") {\n identity = prepend0x(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromString(identity).toStringRaw());\n }\n const signingKey = new _hethers_signing_key__WEBPACK_IMPORTED_MODULE_5__.SigningKey(identity);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"_signingKey\", () => signingKey);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"isED25519Type\", false);\n }\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"_mnemonic\", () => null);\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"alias\", (0,_hethers_transactions__WEBPACK_IMPORTED_MODULE_9__.computeAlias)(this._signingKey().privateKey));\n }\n /* istanbul ignore if */\n if (provider && !_hethers_abstract_provider__WEBPACK_IMPORTED_MODULE_10__.Provider.isProvider(provider)) {\n logger.throwArgumentError(\"invalid provider\", \"provider\", provider);\n }\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__.defineReadOnly)(this, \"provider\", provider || null);\n }\n get mnemonic() {\n return this._mnemonic();\n }\n get privateKey() {\n return this._signingKey().privateKey;\n }\n get publicKey() {\n return this._signingKey().publicKey;\n }\n getAddress() {\n return Promise.resolve(this.address);\n }\n getAccount() {\n return Promise.resolve(this.account);\n }\n getAlias() {\n return Promise.resolve(this.alias);\n }\n connect(provider) {\n return new Wallet(this, provider);\n }\n connectAccount(accountLike) {\n const eoa = {\n privateKey: this._signingKey().privateKey,\n address: (0,_hethers_address__WEBPACK_IMPORTED_MODULE_8__.getAddressFromAccount)(accountLike),\n alias: this.alias,\n isED25519Type: this.isED25519Type,\n mnemonic: this._mnemonic()\n };\n return new Wallet(eoa, this.provider);\n }\n signTransaction(transaction) {\n this._checkAddress('signTransaction');\n let tx = this.checkTransaction(transaction);\n return this.populateTransaction(tx).then((readyTx) => __awaiter(this, void 0, void 0, function* () {\n const pubKey = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PublicKey.fromString(this._signingKey().compressedPublicKey);\n const tx = (0,_hethers_transactions__WEBPACK_IMPORTED_MODULE_9__.serializeHederaTransaction)(readyTx, pubKey);\n const privKey = this.isED25519Type\n ? _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromStringED25519(this._signingKey().privateKey)\n : _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromStringECDSA(this._signingKey().privateKey);\n const signed = yield tx.sign(privKey);\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(signed.toBytes());\n }));\n }\n signMessage(message) {\n if (typeof unityEnv != 'undefined') {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.joinSignature)(this._signingKey().signDigest((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_11__.hashMessage)(message)));\n } else {\n return __awaiter(this, void 0, void 0, function* () {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.joinSignature)(this._signingKey().signDigest((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_11__.hashMessage)(message)));\n });\n }\n }\n _signTypedData(domain, types, value) {\n return __awaiter(this, void 0, void 0, function* () {\n return logger.throwError(\"_signTypedData not supported\", _hethers_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: '_signTypedData'\n });\n });\n }\n encrypt(password, options, progressCallback) {\n if (typeof (options) === \"function\" && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (progressCallback && typeof (progressCallback) !== \"function\") {\n throw new Error(\"invalid callback\");\n }\n if (!options) {\n options = {};\n }\n return (0,_hethers_json_wallets__WEBPACK_IMPORTED_MODULE_12__.encrypt)(this, password, options, progressCallback);\n }\n /**\n * Performs a contract local call (ContractCallQuery) against the given contract in the provider's network.\n * In the future, this method should automatically perform getCost and apply the results for gasLimit/txFee.\n * TODO: utilize getCost when implemented\n *\n * @param txRequest - the call request to be submitted\n */\n /**\n * Static methods to create Wallet instances.\n */\n static createRandom(options) {\n let entropy = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_13__.randomBytes)(16);\n if (!options) {\n options = {};\n }\n if (options.extraEntropy) {\n entropy = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_14__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([entropy, options.extraEntropy])), 0, 16));\n }\n const mnemonic = (0,_hethers_hdnode__WEBPACK_IMPORTED_MODULE_7__.entropyToMnemonic)(entropy, options.locale);\n return Wallet.fromMnemonic(mnemonic, options.path, options.locale, options.isED25519Type);\n }\n createAccount(pubKey, initialBalance) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!initialBalance)\n initialBalance = BigInt(0);\n const signed = yield this.signTransaction({\n customData: {\n publicKey: pubKey,\n initialBalance\n }\n });\n return this.provider.sendTransaction(signed);\n });\n }\n ;\n static fromEncryptedJson(json, password, progressCallback) {\n return (0,_hethers_json_wallets__WEBPACK_IMPORTED_MODULE_15__.decryptJsonWallet)(json, password, progressCallback).then((account) => {\n return new Wallet(account);\n });\n }\n static fromEncryptedJsonSync(json, password) {\n return new Wallet((0,_hethers_json_wallets__WEBPACK_IMPORTED_MODULE_15__.decryptJsonWalletSync)(json, password));\n }\n static fromMnemonic(mnemonic, path, wordlist, isED25519Type) {\n if (!path) {\n path = _hethers_hdnode__WEBPACK_IMPORTED_MODULE_7__.defaultPath;\n }\n return new Wallet(_hethers_hdnode__WEBPACK_IMPORTED_MODULE_7__.HDNode.fromMnemonic(mnemonic, null, wordlist, isED25519Type).derivePath(path));\n }\n _checkAddress(operation) {\n if (!this.address) {\n logger.throwError(\"missing address\", _hethers_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: (operation || \"_checkAddress\")\n });\n }\n }\n}\nfunction verifyMessage(message, signature, isED25519Type) {\n return (0,_hethers_signing_key__WEBPACK_IMPORTED_MODULE_5__.recoverPublicKey)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_11__.hashMessage)(message)), signature, isED25519Type);\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/wallet/lib.esm/index.js?"); -/***/ }), -/***/ "./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!********************************************************************************************!*\ - !*** ./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var BN = __webpack_require__(6046); +var utils = __webpack_require__(6107); +var assert = utils.assert; + +function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; + + // KeyPair(ec, { priv: ..., pub: ... }) + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); +} +module.exports = KeyPair; + +KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + + return new KeyPair(ec, { + pub: pub, + pubEnc: enc, + }); +}; + +KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + + return new KeyPair(ec, { + priv: priv, + privEnc: enc, + }); +}; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + + if (pub.isInfinity()) + return { result: false, reason: 'Invalid public key' }; + if (!pub.validate()) + return { result: false, reason: 'Public key is not a point' }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: 'Public key * N != O' }; + + return { result: true, reason: null }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + + if (!enc) + return this.pub; + + return this.pub.encode(enc, compact); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') + return this.priv.toString(16, 2); + else + return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { + this.priv = new BN(key, enc || 16); + + // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + this.priv = this.priv.umod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + // Montgomery points only have an `x` coordinate. + // Weierstrass/Edwards points on the other hand have both `x` and + // `y` coordinates. + if (this.ec.curve.type === 'mont') { + assert(key.x, 'Need x coordinate'); + } else if (this.ec.curve.type === 'short' || + this.ec.curve.type === 'edwards') { + assert(key.x && key.y, 'Need both x and y coordinate'); + } + this.pub = this.ec.curve.point(key.x, key.y); + return; + } + this.pub = this.ec.curve.decodePoint(key, enc); +}; + +// ECDH +KeyPair.prototype.derive = function derive(pub) { + if(!pub.validate()) { + assert(pub.validate(), 'public point not validated'); + } + return pub.mul(this.priv).getX(); +}; + +// ECDSA +KeyPair.prototype.sign = function sign(msg, enc, options) { + return this.ec.sign(msg, this, enc, options); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; + + +/***/ }), + +/***/ 2891: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"version\": function() { return /* binding */ version; }\n/* harmony export */ });\nconst version = \"bytes/5.5.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/_version.js?"); -/***/ }), -/***/ "./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!*****************************************************************************************!*\ - !*** ./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \*****************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var BN = __webpack_require__(6046); + +var utils = __webpack_require__(6107); +var assert = utils.assert; + +function Signature(options, enc) { + if (options instanceof Signature) + return options; + + if (this._importDER(options, enc)) + return; + + assert(options.r && options.s, 'Signature without r or s'); + this.r = new BN(options.r, 16); + this.s = new BN(options.s, 16); + if (options.recoveryParam === undefined) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; +} +module.exports = Signature; + +function Position() { + this.place = 0; +} + +function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 0x80)) { + return initial; + } + var octetLen = initial & 0xf; + + // Indefinite length or overflow + if (octetLen === 0 || octetLen > 4) { + return false; + } + + if(buf[p.place] === 0x00) { + return false; + } + + var val = 0; + for (var i = 0, off = p.place; i < octetLen; i++, off++) { + val <<= 8; + val |= buf[off]; + val >>>= 0; + } + + // Leading zeroes + if (val <= 0x7f) { + return false; + } + + p.place = off; + return val; +} + +function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); +} + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 0x30) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if ((len + p.place) !== data.length) { + return false; + } + if (data[p.place++] !== 0x02) { + return false; + } + var rlen = getLength(data, p); + if (rlen === false) { + return false; + } + if ((data[p.place] & 128) !== 0) { + return false; + } + var r = data.slice(p.place, rlen + p.place); + p.place += rlen; + if (data[p.place++] !== 0x02) { + return false; + } + var slen = getLength(data, p); + if (slen === false) { + return false; + } + if (data.length !== slen + p.place) { + return false; + } + if ((data[p.place] & 128) !== 0) { + return false; + } + var s = data.slice(p.place, slen + p.place); + if (r[0] === 0) { + if (r[1] & 0x80) { + r = r.slice(1); + } else { + // Leading zeroes + return false; + } + } + if (s[0] === 0) { + if (s[1] & 0x80) { + s = s.slice(1); + } else { + // Leading zeroes + return false; + } + } + + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + + return true; +}; + +function constructLength(arr, len) { + if (len < 0x80) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 0x80); + while (--octets) { + arr.push((len >>> (octets << 3)) & 0xff); + } + arr.push(len); +} + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + r = rmPadding(r); + s = rmPadding(s); + + while (!s[0] && !(s[1] & 0x80)) { + s = s.slice(1); + } + var arr = [ 0x02 ]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(0x02); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [ 0x30 ]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); +}; + + +/***/ }), + +/***/ 2087: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayify\": function() { return /* binding */ arrayify; },\n/* harmony export */ \"concat\": function() { return /* binding */ concat; },\n/* harmony export */ \"hexConcat\": function() { return /* binding */ hexConcat; },\n/* harmony export */ \"hexDataLength\": function() { return /* binding */ hexDataLength; },\n/* harmony export */ \"hexDataSlice\": function() { return /* binding */ hexDataSlice; },\n/* harmony export */ \"hexStripZeros\": function() { return /* binding */ hexStripZeros; },\n/* harmony export */ \"hexValue\": function() { return /* binding */ hexValue; },\n/* harmony export */ \"hexZeroPad\": function() { return /* binding */ hexZeroPad; },\n/* harmony export */ \"hexlify\": function() { return /* binding */ hexlify; },\n/* harmony export */ \"isBytes\": function() { return /* binding */ isBytes; },\n/* harmony export */ \"isBytesLike\": function() { return /* binding */ isBytesLike; },\n/* harmony export */ \"isHexString\": function() { return /* binding */ isHexString; },\n/* harmony export */ \"joinSignature\": function() { return /* binding */ joinSignature; },\n/* harmony export */ \"splitSignature\": function() { return /* binding */ splitSignature; },\n/* harmony export */ \"stripZeros\": function() { return /* binding */ stripZeros; },\n/* harmony export */ \"zeroPad\": function() { return /* binding */ zeroPad; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/index.js?"); -/***/ }), -/***/ "./node_modules/@hethers/wallet/node_modules/@ethersproject/hash/lib.esm/message.js": -/*!******************************************************************************************!*\ - !*** ./node_modules/@hethers/wallet/node_modules/@ethersproject/hash/lib.esm/message.js ***! - \******************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var hash = __webpack_require__(3715); +var curves = __webpack_require__(5418); +var utils = __webpack_require__(6107); +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var KeyPair = __webpack_require__(7278); +var Signature = __webpack_require__(9318); + +function EDDSA(curve) { + assert(curve === 'ed25519', 'only tested with ed25519 so far'); + + if (!(this instanceof EDDSA)) + return new EDDSA(curve); + + curve = curves[curve].curve; + this.curve = curve; + this.g = curve.g; + this.g.precompute(curve.n.bitLength() + 1); + + this.pointClass = curve.point().constructor; + this.encodingLength = Math.ceil(curve.n.bitLength() / 8); + this.hash = hash.sha512; +} + +module.exports = EDDSA; + +/** +* @param {Array|String} message - message bytes +* @param {Array|String|KeyPair} secret - secret bytes or a keypair +* @returns {Signature} - signature +*/ +EDDSA.prototype.sign = function sign(message, secret) { + message = parseBytes(message); + var key = this.keyFromSecret(secret); + var r = this.hashInt(key.messagePrefix(), message); + var R = this.g.mul(r); + var Rencoded = this.encodePoint(R); + var s_ = this.hashInt(Rencoded, key.pubBytes(), message) + .mul(key.priv()); + var S = r.add(s_).umod(this.curve.n); + return this.makeSignature({ R: R, S: S, Rencoded: Rencoded }); +}; + +/** +* @param {Array} message - message bytes +* @param {Array|String|Signature} sig - sig bytes +* @param {Array|String|Point|KeyPair} pub - public key +* @returns {Boolean} - true if public key matches sig of message +*/ +EDDSA.prototype.verify = function verify(message, sig, pub) { + message = parseBytes(message); + sig = this.makeSignature(sig); + if (sig.S().gte(sig.eddsa.curve.n) || sig.S().isNeg()) { + return false; + } + var key = this.keyFromPublic(pub); + var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); + var SG = this.g.mul(sig.S()); + var RplusAh = sig.R().add(key.pub().mul(h)); + return RplusAh.eq(SG); +}; + +EDDSA.prototype.hashInt = function hashInt() { + var hash = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash.update(arguments[i]); + return utils.intFromLE(hash.digest()).umod(this.curve.n); +}; + +EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { + return KeyPair.fromPublic(this, pub); +}; + +EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { + return KeyPair.fromSecret(this, secret); +}; + +EDDSA.prototype.makeSignature = function makeSignature(sig) { + if (sig instanceof Signature) + return sig; + return new Signature(this, sig); +}; + +/** +* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2 +* +* EDDSA defines methods for encoding and decoding points and integers. These are +* helper convenience methods, that pass along to utility functions implied +* parameters. +* +*/ +EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray('le', this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0; + return enc; +}; + +EDDSA.prototype.decodePoint = function decodePoint(bytes) { + bytes = utils.parseBytes(bytes); + + var lastIx = bytes.length - 1; + var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80); + var xIsOdd = (bytes[lastIx] & 0x80) !== 0; + + var y = utils.intFromLE(normed); + return this.curve.pointFromY(y, xIsOdd); +}; + +EDDSA.prototype.encodeInt = function encodeInt(num) { + return num.toArray('le', this.encodingLength); +}; + +EDDSA.prototype.decodeInt = function decodeInt(bytes) { + return utils.intFromLE(bytes); +}; + +EDDSA.prototype.isPoint = function isPoint(val) { + return val instanceof this.pointClass; +}; + + +/***/ }), + +/***/ 7278: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"hashMessage\": function() { return /* binding */ hashMessage; },\n/* harmony export */ \"messagePrefix\": function() { return /* binding */ messagePrefix; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@hethers/wallet/node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/strings */ \"./node_modules/@ethersproject/strings/lib.esm/utf8.js\");\n\n\n\nconst messagePrefix = \"\\x19Ethereum Signed Message:\\n\";\nfunction hashMessage(message) {\n if (typeof (message) === \"string\") {\n message = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__.toUtf8Bytes)(message);\n }\n return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.concat)([\n (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__.toUtf8Bytes)(messagePrefix),\n (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__.toUtf8Bytes)(String(message.length)),\n message\n ]));\n}\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/wallet/node_modules/@ethersproject/hash/lib.esm/message.js?"); -/***/ }), -/***/ "./node_modules/@hethers/wallet/node_modules/@ethersproject/keccak256/lib.esm/index.js": -/*!*********************************************************************************************!*\ - !*** ./node_modules/@hethers/wallet/node_modules/@ethersproject/keccak256/lib.esm/index.js ***! - \*********************************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +var utils = __webpack_require__(6107); +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var cachedProperty = utils.cachedProperty; + +/** +* @param {EDDSA} eddsa - instance +* @param {Object} params - public/private key parameters +* +* @param {Array} [params.secret] - secret seed bytes +* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms) +* @param {Array} [params.pub] - public key point encoded as bytes +* +*/ +function KeyPair(eddsa, params) { + this.eddsa = eddsa; + this._secret = parseBytes(params.secret); + if (eddsa.isPoint(params.pub)) + this._pub = params.pub; + else + this._pubBytes = parseBytes(params.pub); +} + +KeyPair.fromPublic = function fromPublic(eddsa, pub) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(eddsa, { pub: pub }); +}; + +KeyPair.fromSecret = function fromSecret(eddsa, secret) { + if (secret instanceof KeyPair) + return secret; + return new KeyPair(eddsa, { secret: secret }); +}; + +KeyPair.prototype.secret = function secret() { + return this._secret; +}; + +cachedProperty(KeyPair, 'pubBytes', function pubBytes() { + return this.eddsa.encodePoint(this.pub()); +}); + +cachedProperty(KeyPair, 'pub', function pub() { + if (this._pubBytes) + return this.eddsa.decodePoint(this._pubBytes); + return this.eddsa.g.mul(this.priv()); +}); + +cachedProperty(KeyPair, 'privBytes', function privBytes() { + var eddsa = this.eddsa; + var hash = this.hash(); + var lastIx = eddsa.encodingLength - 1; + + var a = hash.slice(0, eddsa.encodingLength); + a[0] &= 248; + a[lastIx] &= 127; + a[lastIx] |= 64; + + return a; +}); + +cachedProperty(KeyPair, 'priv', function priv() { + return this.eddsa.decodeInt(this.privBytes()); +}); + +cachedProperty(KeyPair, 'hash', function hash() { + return this.eddsa.hash().update(this.secret()).digest(); +}); + +cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() { + return this.hash().slice(this.eddsa.encodingLength); +}); + +KeyPair.prototype.sign = function sign(message) { + assert(this._secret, 'KeyPair can only verify'); + return this.eddsa.sign(message, this); +}; + +KeyPair.prototype.verify = function verify(message, sig) { + return this.eddsa.verify(message, sig, this); +}; + +KeyPair.prototype.getSecret = function getSecret(enc) { + assert(this._secret, 'KeyPair is public only'); + return utils.encode(this.secret(), enc); +}; + +KeyPair.prototype.getPublic = function getPublic(enc) { + return utils.encode(this.pubBytes(), enc); +}; + +module.exports = KeyPair; + + +/***/ }), + +/***/ 9318: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"keccak256\": function() { return /* binding */ keccak256; }\n/* harmony export */ });\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ \"./node_modules/js-sha3/src/sha3.js\");\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@hethers/wallet/node_modules/@ethersproject/bytes/lib.esm/index.js\");\n\n\n\nfunction keccak256(data) {\n return '0x' + js_sha3__WEBPACK_IMPORTED_MODULE_0___default().keccak_256((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(data));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hethers/wallet/node_modules/@ethersproject/keccak256/lib.esm/index.js?"); -/***/ }), -/***/ "./node_modules/@protobufjs/aspromise/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/@protobufjs/aspromise/index.js ***! - \*****************************************************/ -/***/ (function(module) { +var BN = __webpack_require__(6046); +var utils = __webpack_require__(6107); +var assert = utils.assert; +var cachedProperty = utils.cachedProperty; +var parseBytes = utils.parseBytes; -"use strict"; -eval("\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@protobufjs/aspromise/index.js?"); +/** +* @param {EDDSA} eddsa - eddsa instance +* @param {Array|Object} sig - +* @param {Array|Point} [sig.R] - R point as Point or bytes +* @param {Array|bn} [sig.S] - S scalar as bn or bytes +* @param {Array} [sig.Rencoded] - R point encoded +* @param {Array} [sig.Sencoded] - S scalar encoded +*/ +function Signature(eddsa, sig) { + this.eddsa = eddsa; -/***/ }), + if (typeof sig !== 'object') + sig = parseBytes(sig); -/***/ "./node_modules/@protobufjs/base64/index.js": -/*!**************************************************!*\ - !*** ./node_modules/@protobufjs/base64/index.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, exports) { + if (Array.isArray(sig)) { + assert(sig.length === eddsa.encodingLength * 2, 'Signature has invalid size'); + sig = { + R: sig.slice(0, eddsa.encodingLength), + S: sig.slice(eddsa.encodingLength), + }; + } -"use strict"; -eval("\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@protobufjs/base64/index.js?"); + assert(sig.R && sig.S, 'Signature without R or S'); -/***/ }), + if (eddsa.isPoint(sig.R)) + this._R = sig.R; + if (sig.S instanceof BN) + this._S = sig.S; -/***/ "./node_modules/@protobufjs/eventemitter/index.js": -/*!********************************************************!*\ - !*** ./node_modules/@protobufjs/eventemitter/index.js ***! - \********************************************************/ -/***/ (function(module) { + this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded; + this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded; +} -"use strict"; -eval("\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@protobufjs/eventemitter/index.js?"); +cachedProperty(Signature, 'S', function S() { + return this.eddsa.decodeInt(this.Sencoded()); +}); -/***/ }), +cachedProperty(Signature, 'R', function R() { + return this.eddsa.decodePoint(this.Rencoded()); +}); -/***/ "./node_modules/@protobufjs/float/index.js": -/*!*************************************************!*\ - !*** ./node_modules/@protobufjs/float/index.js ***! - \*************************************************/ -/***/ (function(module) { +cachedProperty(Signature, 'Rencoded', function Rencoded() { + return this.eddsa.encodePoint(this.R()); +}); -"use strict"; -eval("\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@protobufjs/float/index.js?"); +cachedProperty(Signature, 'Sencoded', function Sencoded() { + return this.eddsa.encodeInt(this.S()); +}); -/***/ }), +Signature.prototype.toBytes = function toBytes() { + return this.Rencoded().concat(this.Sencoded()); +}; -/***/ "./node_modules/@protobufjs/inquire/index.js": -/*!***************************************************!*\ - !*** ./node_modules/@protobufjs/inquire/index.js ***! - \***************************************************/ -/***/ (function(module) { +Signature.prototype.toHex = function toHex() { + return utils.encode(this.toBytes(), 'hex').toUpperCase(); +}; + +module.exports = Signature; -"use strict"; -eval("\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@protobufjs/inquire/index.js?"); /***/ }), -/***/ "./node_modules/@protobufjs/pool/index.js": -/*!************************************************!*\ - !*** ./node_modules/@protobufjs/pool/index.js ***! - \************************************************/ +/***/ 9384: /***/ (function(module) { -"use strict"; -eval("\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@protobufjs/pool/index.js?"); +module.exports = { + doubles: { + step: 4, + points: [ + [ + 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', + 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821', + ], + [ + '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', + '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf', + ], + [ + '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', + 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695', + ], + [ + '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', + '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9', + ], + [ + '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', + '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36', + ], + [ + '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', + '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f', + ], + [ + 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', + '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999', + ], + [ + '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', + 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09', + ], + [ + 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', + '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d', + ], + [ + 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', + 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088', + ], + [ + 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', + '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d', + ], + [ + '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', + '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8', + ], + [ + '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', + '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a', + ], + [ + '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', + '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453', + ], + [ + '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', + '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160', + ], + [ + '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', + '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0', + ], + [ + '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', + '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6', + ], + [ + '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', + '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589', + ], + [ + '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', + 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17', + ], + [ + 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', + '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda', + ], + [ + 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', + '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd', + ], + [ + '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', + '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2', + ], + [ + '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', + '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6', + ], + [ + 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', + '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f', + ], + [ + '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', + 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01', + ], + [ + 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', + '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3', + ], + [ + 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', + 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f', + ], + [ + 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', + '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7', + ], + [ + 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', + 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78', + ], + [ + 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', + '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1', + ], + [ + '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', + 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150', + ], + [ + '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', + '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82', + ], + [ + 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', + '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc', + ], + [ + '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', + 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b', + ], + [ + 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', + '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51', + ], + [ + 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', + '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45', + ], + [ + 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', + 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120', + ], + [ + '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', + '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84', + ], + [ + '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', + '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d', + ], + [ + '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', + 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d', + ], + [ + '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', + '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8', + ], + [ + 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', + '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8', + ], + [ + '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', + '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac', + ], + [ + '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', + 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f', + ], + [ + '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', + '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962', + ], + [ + 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', + '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907', + ], + [ + '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', + 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec', + ], + [ + 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', + 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d', + ], + [ + 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', + '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414', + ], + [ + '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', + 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd', + ], + [ + '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', + 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0', + ], + [ + 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', + '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811', + ], + [ + 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', + '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1', + ], + [ + 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', + '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c', + ], + [ + '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', + 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73', + ], + [ + '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', + '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd', + ], + [ + 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', + 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405', + ], + [ + '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', + 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589', + ], + [ + '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', + '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e', + ], + [ + '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', + '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27', + ], + [ + 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', + 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1', + ], + [ + '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', + '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482', + ], + [ + '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', + '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945', + ], + [ + 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', + '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573', + ], + [ + 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', + 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82', + ], + ], + }, + naf: { + wnd: 7, + points: [ + [ + 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', + '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672', + ], + [ + '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', + 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6', + ], + [ + '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', + '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da', + ], + [ + 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', + 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37', + ], + [ + '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', + 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b', + ], + [ + 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', + 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81', + ], + [ + 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', + '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58', + ], + [ + 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', + '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77', + ], + [ + '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', + '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a', + ], + [ + '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', + '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c', + ], + [ + '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', + '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67', + ], + [ + '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', + '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402', + ], + [ + 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', + 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55', + ], + [ + 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', + '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482', + ], + [ + '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', + 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82', + ], + [ + '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', + 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396', + ], + [ + '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', + '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49', + ], + [ + '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', + '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf', + ], + [ + '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', + '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a', + ], + [ + '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', + 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7', + ], + [ + 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', + 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933', + ], + [ + '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', + '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a', + ], + [ + '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', + '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6', + ], + [ + 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', + 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37', + ], + [ + '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', + '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e', + ], + [ + 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', + 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6', + ], + [ + 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', + 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476', + ], + [ + '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', + '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40', + ], + [ + '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', + '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61', + ], + [ + '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', + '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683', + ], + [ + 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', + '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5', + ], + [ + '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', + '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b', + ], + [ + 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', + '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417', + ], + [ + '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', + 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868', + ], + [ + '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', + 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a', + ], + [ + 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', + 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6', + ], + [ + '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', + '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996', + ], + [ + '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', + 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e', + ], + [ + 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', + 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d', + ], + [ + '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', + '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2', + ], + [ + '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', + 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e', + ], + [ + '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', + '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437', + ], + [ + '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', + 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311', + ], + [ + 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', + '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4', + ], + [ + '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', + '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575', + ], + [ + '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', + 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d', + ], + [ + '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', + 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d', + ], + [ + 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', + 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629', + ], + [ + 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', + 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06', + ], + [ + '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', + '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374', + ], + [ + '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', + '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee', + ], + [ + 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', + '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1', + ], + [ + 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', + 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b', + ], + [ + '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', + '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661', + ], + [ + '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', + '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6', + ], + [ + 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', + '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e', + ], + [ + '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', + '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d', + ], + [ + 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', + 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc', + ], + [ + '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', + 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4', + ], + [ + '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', + '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c', + ], + [ + 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', + '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b', + ], + [ + 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', + '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913', + ], + [ + '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', + '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154', + ], + [ + '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', + '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865', + ], + [ + '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', + 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc', + ], + [ + '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', + 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224', + ], + [ + '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', + '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e', + ], + [ + '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', + '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6', + ], + [ + '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', + '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511', + ], + [ + '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', + 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b', + ], + [ + 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', + 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2', + ], + [ + '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', + 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c', + ], + [ + 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', + '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3', + ], + [ + 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', + '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d', + ], + [ + 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', + '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700', + ], + [ + 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', + '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4', + ], + [ + '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', + 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196', + ], + [ + '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', + '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4', + ], + [ + '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', + 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257', + ], + [ + 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', + 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13', + ], + [ + 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', + '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096', + ], + [ + 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', + 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38', + ], + [ + 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', + '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f', + ], + [ + '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', + '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448', + ], + [ + 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', + '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a', + ], + [ + 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', + '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4', + ], + [ + '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', + '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437', + ], + [ + '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', + 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7', + ], + [ + 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', + '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d', + ], + [ + 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', + '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a', + ], + [ + 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', + '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54', + ], + [ + '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', + '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77', + ], + [ + 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', + 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517', + ], + [ + '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', + 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10', + ], + [ + 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', + 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125', + ], + [ + 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', + '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e', + ], + [ + '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', + 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1', + ], + [ + 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', + '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2', + ], + [ + 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', + '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423', + ], + [ + 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', + '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8', + ], + [ + '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', + 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758', + ], + [ + '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', + 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375', + ], + [ + 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', + '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d', + ], + [ + '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', + 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec', + ], + [ + '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', + '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0', + ], + [ + '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', + 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c', + ], + [ + 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', + 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4', + ], + [ + '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', + 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f', + ], + [ + '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', + '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649', + ], + [ + '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', + 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826', + ], + [ + '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', + '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5', + ], + [ + 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', + 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87', + ], + [ + '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', + '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b', + ], + [ + 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', + '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc', + ], + [ + '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', + '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c', + ], + [ + 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', + 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f', + ], + [ + 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', + '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a', + ], + [ + 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', + 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46', + ], + [ + '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', + 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f', + ], + [ + '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', + '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03', + ], + [ + '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', + 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08', + ], + [ + '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', + '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8', + ], + [ + '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', + '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373', + ], + [ + '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', + 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3', + ], + [ + '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', + '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8', + ], + [ + '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', + '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1', + ], + [ + '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', + '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9', + ], + ], + }, +}; + + +/***/ }), + +/***/ 6107: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +"use strict"; -/***/ "./node_modules/@protobufjs/utf8/index.js": -/*!************************************************!*\ - !*** ./node_modules/@protobufjs/utf8/index.js ***! - \************************************************/ -/***/ (function(__unused_webpack_module, exports) { -"use strict"; -eval("\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@protobufjs/utf8/index.js?"); +var utils = exports; +var BN = __webpack_require__(6046); +var minAssert = __webpack_require__(9746); +var minUtils = __webpack_require__(4504); + +utils.assert = minAssert; +utils.toArray = minUtils.toArray; +utils.zero2 = minUtils.zero2; +utils.toHex = minUtils.toHex; +utils.encode = minUtils.encode; + +// Represent num in a w-NAF form +function getNAF(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + var i; + for (i = 0; i < naf.length; i += 1) { + naf[i] = 0; + } + + var ws = 1 << (w + 1); + var k = num.clone(); + + for (i = 0; i < naf.length; i++) { + var z; + var mod = k.andln(ws - 1); + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + + naf[i] = z; + k.iushrn(1); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [], + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; + +function cachedProperty(obj, name, computer) { + var key = '_' + name; + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : + this[key] = computer.call(this); + }; +} +utils.cachedProperty = cachedProperty; + +function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : + bytes; +} +utils.parseBytes = parseBytes; + +function intFromLE(bytes) { + return new BN(bytes, 'hex', 'le'); +} +utils.intFromLE = intFromLE; + + + +/***/ }), + +/***/ 6046: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ }), +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(1476).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // 'A' - 'F' + if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + // '0' - '9' + } else { + return (c - 48) & 0xf; + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; -/***/ "./node_modules/aes-js/index.js": -/*!**************************************!*\ - !*** ./node_modules/aes-js/index.js ***! - \**************************************/ + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 7295: /***/ (function(module) { -"use strict"; -eval("\n\n(function(root) {\n\n function checkInt(value) {\n return (parseInt(value) === value);\n }\n\n function checkInts(arrayish) {\n if (!checkInt(arrayish.length)) { return false; }\n\n for (var i = 0; i < arrayish.length; i++) {\n if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) {\n return false;\n }\n }\n\n return true;\n }\n\n function coerceArray(arg, copy) {\n\n // ArrayBuffer view\n if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === 'Uint8Array') {\n\n if (copy) {\n if (arg.slice) {\n arg = arg.slice();\n } else {\n arg = Array.prototype.slice.call(arg);\n }\n }\n\n return arg;\n }\n\n // It's an array; check it is a valid representation of a byte\n if (Array.isArray(arg)) {\n if (!checkInts(arg)) {\n throw new Error('Array contains invalid value: ' + arg);\n }\n\n return new Uint8Array(arg);\n }\n\n // Something else, but behaves like an array (maybe a Buffer? Arguments?)\n if (checkInt(arg.length) && checkInts(arg)) {\n return new Uint8Array(arg);\n }\n\n throw new Error('unsupported array-like object');\n }\n\n function createArray(length) {\n return new Uint8Array(length);\n }\n\n function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {\n if (sourceStart != null || sourceEnd != null) {\n if (sourceArray.slice) {\n sourceArray = sourceArray.slice(sourceStart, sourceEnd);\n } else {\n sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);\n }\n }\n targetArray.set(sourceArray, targetStart);\n }\n\n\n\n var convertUtf8 = (function() {\n function toBytes(text) {\n var result = [], i = 0;\n text = encodeURI(text);\n while (i < text.length) {\n var c = text.charCodeAt(i++);\n\n // if it is a % sign, encode the following 2 bytes as a hex value\n if (c === 37) {\n result.push(parseInt(text.substr(i, 2), 16))\n i += 2;\n\n // otherwise, just the actual byte\n } else {\n result.push(c)\n }\n }\n\n return coerceArray(result);\n }\n\n function fromBytes(bytes) {\n var result = [], i = 0;\n\n while (i < bytes.length) {\n var c = bytes[i];\n\n if (c < 128) {\n result.push(String.fromCharCode(c));\n i++;\n } else if (c > 191 && c < 224) {\n result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f)));\n i += 2;\n } else {\n result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f)));\n i += 3;\n }\n }\n\n return result.join('');\n }\n\n return {\n toBytes: toBytes,\n fromBytes: fromBytes,\n }\n })();\n\n var convertHex = (function() {\n function toBytes(text) {\n var result = [];\n for (var i = 0; i < text.length; i += 2) {\n result.push(parseInt(text.substr(i, 2), 16));\n }\n\n return result;\n }\n\n // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html\n var Hex = '0123456789abcdef';\n\n function fromBytes(bytes) {\n var result = [];\n for (var i = 0; i < bytes.length; i++) {\n var v = bytes[i];\n result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]);\n }\n return result.join('');\n }\n\n return {\n toBytes: toBytes,\n fromBytes: fromBytes,\n }\n })();\n\n\n // Number of rounds by keysize\n var numberOfRounds = {16: 10, 24: 12, 32: 14}\n\n // Round constant words\n var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91];\n\n // S-box and Inverse S-box (S is for Substitution)\n var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16];\n var Si =[0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d];\n\n // Transformations for encryption\n var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a];\n var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616];\n var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16];\n var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c];\n\n // Transformations for decryption\n var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742];\n var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857];\n var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8];\n var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0];\n\n // Transformations for decryption key expansion\n var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3];\n var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697];\n var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46];\n var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d];\n\n function convertToInt32(bytes) {\n var result = [];\n for (var i = 0; i < bytes.length; i += 4) {\n result.push(\n (bytes[i ] << 24) |\n (bytes[i + 1] << 16) |\n (bytes[i + 2] << 8) |\n bytes[i + 3]\n );\n }\n return result;\n }\n\n var AES = function(key) {\n if (!(this instanceof AES)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n Object.defineProperty(this, 'key', {\n value: coerceArray(key, true)\n });\n\n this._prepare();\n }\n\n\n AES.prototype._prepare = function() {\n\n var rounds = numberOfRounds[this.key.length];\n if (rounds == null) {\n throw new Error('invalid key size (must be 16, 24 or 32 bytes)');\n }\n\n // encryption round keys\n this._Ke = [];\n\n // decryption round keys\n this._Kd = [];\n\n for (var i = 0; i <= rounds; i++) {\n this._Ke.push([0, 0, 0, 0]);\n this._Kd.push([0, 0, 0, 0]);\n }\n\n var roundKeyCount = (rounds + 1) * 4;\n var KC = this.key.length / 4;\n\n // convert the key into ints\n var tk = convertToInt32(this.key);\n\n // copy values into round key arrays\n var index;\n for (var i = 0; i < KC; i++) {\n index = i >> 2;\n this._Ke[index][i % 4] = tk[i];\n this._Kd[rounds - index][i % 4] = tk[i];\n }\n\n // key expansion (fips-197 section 5.2)\n var rconpointer = 0;\n var t = KC, tt;\n while (t < roundKeyCount) {\n tt = tk[KC - 1];\n tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^\n (S[(tt >> 8) & 0xFF] << 16) ^\n (S[ tt & 0xFF] << 8) ^\n S[(tt >> 24) & 0xFF] ^\n (rcon[rconpointer] << 24));\n rconpointer += 1;\n\n // key expansion (for non-256 bit)\n if (KC != 8) {\n for (var i = 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n\n // key expansion for 256-bit keys is \"slightly different\" (fips-197)\n } else {\n for (var i = 1; i < (KC / 2); i++) {\n tk[i] ^= tk[i - 1];\n }\n tt = tk[(KC / 2) - 1];\n\n tk[KC / 2] ^= (S[ tt & 0xFF] ^\n (S[(tt >> 8) & 0xFF] << 8) ^\n (S[(tt >> 16) & 0xFF] << 16) ^\n (S[(tt >> 24) & 0xFF] << 24));\n\n for (var i = (KC / 2) + 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n }\n\n // copy values into round key arrays\n var i = 0, r, c;\n while (i < KC && t < roundKeyCount) {\n r = t >> 2;\n c = t % 4;\n this._Ke[r][c] = tk[i];\n this._Kd[rounds - r][c] = tk[i++];\n t++;\n }\n }\n\n // inverse-cipher-ify the decryption round key (fips-197 section 5.3)\n for (var r = 1; r < rounds; r++) {\n for (var c = 0; c < 4; c++) {\n tt = this._Kd[r][c];\n this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^\n U2[(tt >> 16) & 0xFF] ^\n U3[(tt >> 8) & 0xFF] ^\n U4[ tt & 0xFF]);\n }\n }\n }\n\n AES.prototype.encrypt = function(plaintext) {\n if (plaintext.length != 16) {\n throw new Error('invalid plaintext size (must be 16 bytes)');\n }\n\n var rounds = this._Ke.length - 1;\n var a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n var t = convertToInt32(plaintext);\n for (var i = 0; i < 4; i++) {\n t[i] ^= this._Ke[0][i];\n }\n\n // apply round transforms\n for (var r = 1; r < rounds; r++) {\n for (var i = 0; i < 4; i++) {\n a[i] = (T1[(t[ i ] >> 24) & 0xff] ^\n T2[(t[(i + 1) % 4] >> 16) & 0xff] ^\n T3[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T4[ t[(i + 3) % 4] & 0xff] ^\n this._Ke[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n var result = createArray(16), tt;\n for (var i = 0; i < 4; i++) {\n tt = this._Ke[rounds][i];\n result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n\n AES.prototype.decrypt = function(ciphertext) {\n if (ciphertext.length != 16) {\n throw new Error('invalid ciphertext size (must be 16 bytes)');\n }\n\n var rounds = this._Kd.length - 1;\n var a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n var t = convertToInt32(ciphertext);\n for (var i = 0; i < 4; i++) {\n t[i] ^= this._Kd[0][i];\n }\n\n // apply round transforms\n for (var r = 1; r < rounds; r++) {\n for (var i = 0; i < 4; i++) {\n a[i] = (T5[(t[ i ] >> 24) & 0xff] ^\n T6[(t[(i + 3) % 4] >> 16) & 0xff] ^\n T7[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T8[ t[(i + 1) % 4] & 0xff] ^\n this._Kd[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n var result = createArray(16), tt;\n for (var i = 0; i < 4; i++) {\n tt = this._Kd[rounds][i];\n result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n\n\n /**\n * Mode Of Operation - Electonic Codebook (ECB)\n */\n var ModeOfOperationECB = function(key) {\n if (!(this instanceof ModeOfOperationECB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Electronic Code Block\";\n this.name = \"ecb\";\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationECB.prototype.encrypt = function(plaintext) {\n plaintext = coerceArray(plaintext);\n\n if ((plaintext.length % 16) !== 0) {\n throw new Error('invalid plaintext size (must be multiple of 16 bytes)');\n }\n\n var ciphertext = createArray(plaintext.length);\n var block = createArray(16);\n\n for (var i = 0; i < plaintext.length; i += 16) {\n copyArray(plaintext, block, 0, i, i + 16);\n block = this._aes.encrypt(block);\n copyArray(block, ciphertext, i);\n }\n\n return ciphertext;\n }\n\n ModeOfOperationECB.prototype.decrypt = function(ciphertext) {\n ciphertext = coerceArray(ciphertext);\n\n if ((ciphertext.length % 16) !== 0) {\n throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');\n }\n\n var plaintext = createArray(ciphertext.length);\n var block = createArray(16);\n\n for (var i = 0; i < ciphertext.length; i += 16) {\n copyArray(ciphertext, block, 0, i, i + 16);\n block = this._aes.decrypt(block);\n copyArray(block, plaintext, i);\n }\n\n return plaintext;\n }\n\n\n /**\n * Mode Of Operation - Cipher Block Chaining (CBC)\n */\n var ModeOfOperationCBC = function(key, iv) {\n if (!(this instanceof ModeOfOperationCBC)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Cipher Block Chaining\";\n this.name = \"cbc\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 bytes)');\n }\n\n this._lastCipherblock = coerceArray(iv, true);\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCBC.prototype.encrypt = function(plaintext) {\n plaintext = coerceArray(plaintext);\n\n if ((plaintext.length % 16) !== 0) {\n throw new Error('invalid plaintext size (must be multiple of 16 bytes)');\n }\n\n var ciphertext = createArray(plaintext.length);\n var block = createArray(16);\n\n for (var i = 0; i < plaintext.length; i += 16) {\n copyArray(plaintext, block, 0, i, i + 16);\n\n for (var j = 0; j < 16; j++) {\n block[j] ^= this._lastCipherblock[j];\n }\n\n this._lastCipherblock = this._aes.encrypt(block);\n copyArray(this._lastCipherblock, ciphertext, i);\n }\n\n return ciphertext;\n }\n\n ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {\n ciphertext = coerceArray(ciphertext);\n\n if ((ciphertext.length % 16) !== 0) {\n throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');\n }\n\n var plaintext = createArray(ciphertext.length);\n var block = createArray(16);\n\n for (var i = 0; i < ciphertext.length; i += 16) {\n copyArray(ciphertext, block, 0, i, i + 16);\n block = this._aes.decrypt(block);\n\n for (var j = 0; j < 16; j++) {\n plaintext[i + j] = block[j] ^ this._lastCipherblock[j];\n }\n\n copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16);\n }\n\n return plaintext;\n }\n\n\n /**\n * Mode Of Operation - Cipher Feedback (CFB)\n */\n var ModeOfOperationCFB = function(key, iv, segmentSize) {\n if (!(this instanceof ModeOfOperationCFB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Cipher Feedback\";\n this.name = \"cfb\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 size)');\n }\n\n if (!segmentSize) { segmentSize = 1; }\n\n this.segmentSize = segmentSize;\n\n this._shiftRegister = coerceArray(iv, true);\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCFB.prototype.encrypt = function(plaintext) {\n if ((plaintext.length % this.segmentSize) != 0) {\n throw new Error('invalid plaintext size (must be segmentSize bytes)');\n }\n\n var encrypted = coerceArray(plaintext, true);\n\n var xorSegment;\n for (var i = 0; i < encrypted.length; i += this.segmentSize) {\n xorSegment = this._aes.encrypt(this._shiftRegister);\n for (var j = 0; j < this.segmentSize; j++) {\n encrypted[i + j] ^= xorSegment[j];\n }\n\n // Shift the register\n copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);\n copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);\n }\n\n return encrypted;\n }\n\n ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {\n if ((ciphertext.length % this.segmentSize) != 0) {\n throw new Error('invalid ciphertext size (must be segmentSize bytes)');\n }\n\n var plaintext = coerceArray(ciphertext, true);\n\n var xorSegment;\n for (var i = 0; i < plaintext.length; i += this.segmentSize) {\n xorSegment = this._aes.encrypt(this._shiftRegister);\n\n for (var j = 0; j < this.segmentSize; j++) {\n plaintext[i + j] ^= xorSegment[j];\n }\n\n // Shift the register\n copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);\n copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);\n }\n\n return plaintext;\n }\n\n /**\n * Mode Of Operation - Output Feedback (OFB)\n */\n var ModeOfOperationOFB = function(key, iv) {\n if (!(this instanceof ModeOfOperationOFB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Output Feedback\";\n this.name = \"ofb\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 bytes)');\n }\n\n this._lastPrecipher = coerceArray(iv, true);\n this._lastPrecipherIndex = 16;\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationOFB.prototype.encrypt = function(plaintext) {\n var encrypted = coerceArray(plaintext, true);\n\n for (var i = 0; i < encrypted.length; i++) {\n if (this._lastPrecipherIndex === 16) {\n this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);\n this._lastPrecipherIndex = 0;\n }\n encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++];\n }\n\n return encrypted;\n }\n\n // Decryption is symetric\n ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;\n\n\n /**\n * Counter object for CTR common mode of operation\n */\n var Counter = function(initialValue) {\n if (!(this instanceof Counter)) {\n throw Error('Counter must be instanitated with `new`');\n }\n\n // We allow 0, but anything false-ish uses the default 1\n if (initialValue !== 0 && !initialValue) { initialValue = 1; }\n\n if (typeof(initialValue) === 'number') {\n this._counter = createArray(16);\n this.setValue(initialValue);\n\n } else {\n this.setBytes(initialValue);\n }\n }\n\n Counter.prototype.setValue = function(value) {\n if (typeof(value) !== 'number' || parseInt(value) != value) {\n throw new Error('invalid counter value (must be an integer)');\n }\n\n for (var index = 15; index >= 0; --index) {\n this._counter[index] = value % 256;\n value = value >> 8;\n }\n }\n\n Counter.prototype.setBytes = function(bytes) {\n bytes = coerceArray(bytes, true);\n\n if (bytes.length != 16) {\n throw new Error('invalid counter bytes size (must be 16 bytes)');\n }\n\n this._counter = bytes;\n };\n\n Counter.prototype.increment = function() {\n for (var i = 15; i >= 0; i--) {\n if (this._counter[i] === 255) {\n this._counter[i] = 0;\n } else {\n this._counter[i]++;\n break;\n }\n }\n }\n\n\n /**\n * Mode Of Operation - Counter (CTR)\n */\n var ModeOfOperationCTR = function(key, counter) {\n if (!(this instanceof ModeOfOperationCTR)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Counter\";\n this.name = \"ctr\";\n\n if (!(counter instanceof Counter)) {\n counter = new Counter(counter)\n }\n\n this._counter = counter;\n\n this._remainingCounter = null;\n this._remainingCounterIndex = 16;\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCTR.prototype.encrypt = function(plaintext) {\n var encrypted = coerceArray(plaintext, true);\n\n for (var i = 0; i < encrypted.length; i++) {\n if (this._remainingCounterIndex === 16) {\n this._remainingCounter = this._aes.encrypt(this._counter._counter);\n this._remainingCounterIndex = 0;\n this._counter.increment();\n }\n encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++];\n }\n\n return encrypted;\n }\n\n // Decryption is symetric\n ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;\n\n\n ///////////////////////\n // Padding\n\n // See:https://tools.ietf.org/html/rfc2315\n function pkcs7pad(data) {\n data = coerceArray(data, true);\n var padder = 16 - (data.length % 16);\n var result = createArray(data.length + padder);\n copyArray(data, result);\n for (var i = data.length; i < result.length; i++) {\n result[i] = padder;\n }\n return result;\n }\n\n function pkcs7strip(data) {\n data = coerceArray(data, true);\n if (data.length < 16) { throw new Error('PKCS#7 invalid length'); }\n\n var padder = data[data.length - 1];\n if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); }\n\n var length = data.length - padder;\n for (var i = 0; i < padder; i++) {\n if (data[length + i] !== padder) {\n throw new Error('PKCS#7 invalid padding byte');\n }\n }\n\n var result = createArray(length);\n copyArray(data, result, 0, 0, length);\n return result;\n }\n\n ///////////////////////\n // Exporting\n\n\n // The block cipher\n var aesjs = {\n AES: AES,\n Counter: Counter,\n\n ModeOfOperation: {\n ecb: ModeOfOperationECB,\n cbc: ModeOfOperationCBC,\n cfb: ModeOfOperationCFB,\n ofb: ModeOfOperationOFB,\n ctr: ModeOfOperationCTR\n },\n\n utils: {\n hex: convertHex,\n utf8: convertUtf8\n },\n\n padding: {\n pkcs7: {\n pad: pkcs7pad,\n strip: pkcs7strip\n }\n },\n\n _arrayTest: {\n coerceArray: coerceArray,\n createArray: createArray,\n copyArray: copyArray,\n }\n };\n\n\n // node.js\n if (true) {\n module.exports = aesjs\n\n // RequireJS/AMD\n // http://www.requirejs.org/docs/api.html\n // https://github.com/amdjs/amdjs-api/wiki/AMD\n } else {}\n\n\n})(this);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/aes-js/index.js?"); +module.exports = function xor (a, b) { + var length = Math.min(a.length, b.length) + var buffer = new Buffer(length) -/***/ }), + for (var i = 0; i < length; ++i) { + buffer[i] = a[i] ^ b[i] + } -/***/ "./node_modules/asn1.js/lib/asn1.js": -/*!******************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1.js ***! - \******************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + return buffer +} -"use strict"; -eval("\n\nconst asn1 = exports;\n\nasn1.bignum = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n\nasn1.define = (__webpack_require__(/*! ./asn1/api */ \"./node_modules/asn1.js/lib/asn1/api.js\").define);\nasn1.base = __webpack_require__(/*! ./asn1/base */ \"./node_modules/asn1.js/lib/asn1/base/index.js\");\nasn1.constants = __webpack_require__(/*! ./asn1/constants */ \"./node_modules/asn1.js/lib/asn1/constants/index.js\");\nasn1.decoders = __webpack_require__(/*! ./asn1/decoders */ \"./node_modules/asn1.js/lib/asn1/decoders/index.js\");\nasn1.encoders = __webpack_require__(/*! ./asn1/encoders */ \"./node_modules/asn1.js/lib/asn1/encoders/index.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1.js?"); /***/ }), -/***/ "./node_modules/asn1.js/lib/asn1/api.js": -/*!**********************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/api.js ***! - \**********************************************/ +/***/ 8764: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("\n\nconst encoders = __webpack_require__(/*! ./encoders */ \"./node_modules/asn1.js/lib/asn1/encoders/index.js\");\nconst decoders = __webpack_require__(/*! ./decoders */ \"./node_modules/asn1.js/lib/asn1/decoders/index.js\");\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nconst api = exports;\n\napi.define = function define(name, body) {\n return new Entity(name, body);\n};\n\nfunction Entity(name, body) {\n this.name = name;\n this.body = body;\n\n this.decoders = {};\n this.encoders = {};\n}\n\nEntity.prototype._createNamed = function createNamed(Base) {\n const name = this.name;\n\n function Generated(entity) {\n this._initNamed(entity, name);\n }\n inherits(Generated, Base);\n Generated.prototype._initNamed = function _initNamed(entity, name) {\n Base.call(this, entity, name);\n };\n\n return new Generated(this);\n};\n\nEntity.prototype._getDecoder = function _getDecoder(enc) {\n enc = enc || 'der';\n // Lazily create decoder\n if (!this.decoders.hasOwnProperty(enc))\n this.decoders[enc] = this._createNamed(decoders[enc]);\n return this.decoders[enc];\n};\n\nEntity.prototype.decode = function decode(data, enc, options) {\n return this._getDecoder(enc).decode(data, options);\n};\n\nEntity.prototype._getEncoder = function _getEncoder(enc) {\n enc = enc || 'der';\n // Lazily create encoder\n if (!this.encoders.hasOwnProperty(enc))\n this.encoders[enc] = this._createNamed(encoders[enc]);\n return this.encoders[enc];\n};\n\nEntity.prototype.encode = function encode(data, enc, /* internal */ reporter) {\n return this._getEncoder(enc).encode(data, reporter);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/api.js?"); +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + + + +const base64 = __webpack_require__(9742) +const ieee754 = __webpack_require__(645) +const customInspectSymbol = + (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation + ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation + : null + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +const K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Print warning and recommend using `buffer` v4.x which has an Object + * implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * We report that the browser does not support typed arrays if the are not subclassable + * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` + * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support + * for __proto__ and has a buggy typed array implementation. + */ +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() + +if (!Buffer.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 typedArraySupport () { + // Can typed array instances can be augmented? + try { + const arr = new Uint8Array(1) + const proto = { foo: function () { return 42 } } + Object.setPrototypeOf(proto, Uint8Array.prototype) + Object.setPrototypeOf(arr, proto) + return arr.foo() === 42 + } catch (e) { + return false + } +} + +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) + +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + const buf = new Uint8Array(length) + Object.setPrototypeOf(buf, Buffer.prototype) + return buf +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ -/***/ }), +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + if (ArrayBuffer.isView(value)) { + return fromArrayView(value) + } + + if (value == null) { + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof SharedArrayBuffer !== 'undefined' && + (isInstance(value, SharedArrayBuffer) || + (value && isInstance(value.buffer, SharedArrayBuffer)))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } + + const valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } + + const b = fromObject(value) + if (b) return b + + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) + } + + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length) +} + +// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: +// https://github.com/feross/buffer/pull/148 +Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) +Object.setPrototypeOf(Buffer, Uint8Array) + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } +} + +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpreted as a start offset. + return typeof encoding === 'string' + ? createBuffer(size).fill(fill, encoding) + : createBuffer(size).fill(fill) + } + return createBuffer(size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} + +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(size) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + const length = byteLength(string, encoding) | 0 + let buf = createBuffer(length) + + const actual = buf.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual) + } + + return buf +} + +function fromArrayLike (array) { + const length = array.length < 0 ? 0 : checked(array.length) | 0 + const buf = createBuffer(length) + for (let i = 0; i < length; i += 1) { + buf[i] = array[i] & 255 + } + return buf +} + +function fromArrayView (arrayView) { + if (isInstance(arrayView, Uint8Array)) { + const copy = new Uint8Array(arrayView) + return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) + } + return fromArrayLike(arrayView) +} + +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } + + let buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) + } else { + buf = new Uint8Array(array, byteOffset, length) + } + + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(buf, Buffer.prototype) + + return buf +} + +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + const len = checked(obj.length) | 0 + const buf = createBuffer(len) + + if (buf.length === 0) { + return buf + } + + obj.copy(buf, 0, 0, len) + return buf + } + + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) + } + return fromArrayLike(obj) + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } +} + +function checked (length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + if (a === b) return 0 + + let x = a.length + let y = b.length + + for (let i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).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 true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + let i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + const buffer = Buffer.allocUnsafe(length) + let pos = 0 + for (i = 0; i < list.length; ++i) { + let buf = list[i] + if (isInstance(buf, Uint8Array)) { + if (pos + buf.length > buffer.length) { + if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + buf.copy(buffer, pos) + } else { + Uint8Array.prototype.set.call( + buffer, + buf, + pos + ) + } + } else if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } else { + buf.copy(buffer, pos) + } + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + const len = string.length + const mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 + + // Use a for loop to avoid recursion + let loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + let loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coercion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) +// to detect a Buffer instance. It's not possible to use `instanceof Buffer` +// reliably in a browserify context because there could be multiple different +// copies of the 'buffer' package in use. This method works even for Buffer +// instances that were created from another copy of the `buffer` package. +// See: https://github.com/feross/buffer/issues/154 +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + const i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + const len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (let i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + const len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (let i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + const len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (let i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + const length = this.length + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.toLocaleString = Buffer.prototype.toString + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + let str = '' + const max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} +if (customInspectSymbol) { + Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + let x = thisEnd - thisStart + let y = end - start + const len = Math.min(x, y) + + const thisCopy = this.slice(thisStart, thisEnd) + const targetCopy = target.slice(start, end) + + for (let i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (numberIsNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + let indexSize = 1 + let arrLength = arr.length + let valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + let i + if (dir) { + let foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + let found = true + for (let j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + const remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + const strLen = string.length + + if (length > strLen / 2) { + length = strLen / 2 + } + let i + for (i = 0; i < length; ++i) { + const parsed = parseInt(string.substr(i * 2, 2), 16) + if (numberIsNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset >>> 0 + if (isFinite(length)) { + length = length >>> 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + const remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + let loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + case 'latin1': + case 'binary': + return asciiWrite(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + const res = [] + + let i = start + while (i < end) { + const firstByte = buf[i] + let codePoint = null + let bytesPerSequence = (firstByte > 0xEF) + ? 4 + : (firstByte > 0xDF) + ? 3 + : (firstByte > 0xBF) + ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + let secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +const MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + const len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + let res = '' + let i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + const len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + let out = '' + for (let i = start; i < end; ++i) { + out += hexSliceLookupTable[buf[i]] + } + return out +} + +function utf16leSlice (buf, start, end) { + const bytes = buf.slice(start, end) + let res = '' + // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) + for (let i = 0; i < bytes.length - 1; i += 2) { + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + const len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + const newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(newBuf, Buffer.prototype) + + return newBuf +} -/***/ "./node_modules/asn1.js/lib/asn1/base/buffer.js": -/*!******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/buffer.js ***! - \******************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUintLE = +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUintBE = +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + let val = this[offset + --byteLength] + let mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUint8 = +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUint16LE = +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUint16BE = +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUint32LE = +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUint32BE = +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const lo = first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24 + + const hi = this[++offset] + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + last * 2 ** 24 + + return BigInt(lo) + (BigInt(hi) << BigInt(32)) +}) + +Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const hi = first * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + const lo = this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last + + return (BigInt(hi) << BigInt(32)) + BigInt(lo) +}) + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let i = byteLength + let mul = 1 + let val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = this[offset + 4] + + this[offset + 5] * 2 ** 8 + + this[offset + 6] * 2 ** 16 + + (last << 24) // Overflow + + return (BigInt(val) << BigInt(32)) + + BigInt(first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24) +}) + +Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = (first << 24) + // Overflow + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + return (BigInt(val) << BigInt(32)) + + BigInt(this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last) +}) + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUintLE = +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let mul = 1 + let i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUintBE = +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let i = byteLength - 1 + let mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUint8 = +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeUint16LE = +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeUint16BE = +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeUint32LE = +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeUint32BE = +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +function wrtBigUInt64LE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + return offset +} + +function wrtBigUInt64BE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset + 7] = lo + lo = lo >> 8 + buf[offset + 6] = lo + lo = lo >> 8 + buf[offset + 5] = lo + lo = lo >> 8 + buf[offset + 4] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset + 3] = hi + hi = hi >> 8 + buf[offset + 2] = hi + hi = hi >> 8 + buf[offset + 1] = hi + hi = hi >> 8 + buf[offset] = hi + return offset + 8 +} + +Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = 0 + let mul = 1 + let sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = byteLength - 1 + let mul = 1 + let sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + const len = end - start + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + if (val.length === 1) { + const code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } else if (typeof val === 'boolean') { + val = Number(val) + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + let i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + const bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + const len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// CUSTOM ERRORS +// ============= + +// Simplified versions from Node, changed for Buffer-only usage +const errors = {} +function E (sym, getMessage, Base) { + errors[sym] = class NodeError extends Base { + constructor () { + super() + + Object.defineProperty(this, 'message', { + value: getMessage.apply(this, arguments), + writable: true, + configurable: true + }) + + // Add the error code to the name to include it in the stack trace. + this.name = `${this.name} [${sym}]` + // Access the stack to generate the error message including the error code + // from the name. + this.stack // eslint-disable-line no-unused-expressions + // Reset the name to the actual name. + delete this.name + } + + get code () { + return sym + } + + set code (value) { + Object.defineProperty(this, 'code', { + configurable: true, + enumerable: true, + value, + writable: true + }) + } + + toString () { + return `${this.name} [${sym}]: ${this.message}` + } + } +} + +E('ERR_BUFFER_OUT_OF_BOUNDS', + function (name) { + if (name) { + return `${name} is outside of buffer bounds` + } + + return 'Attempt to access memory outside buffer bounds' + }, RangeError) +E('ERR_INVALID_ARG_TYPE', + function (name, actual) { + return `The "${name}" argument must be of type number. Received type ${typeof actual}` + }, TypeError) +E('ERR_OUT_OF_RANGE', + function (str, range, input) { + let msg = `The value of "${str}" is out of range.` + let received = input + if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { + received = addNumericalSeparator(String(input)) + } else if (typeof input === 'bigint') { + received = String(input) + if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { + received = addNumericalSeparator(received) + } + received += 'n' + } + msg += ` It must be ${range}. Received ${received}` + return msg + }, RangeError) + +function addNumericalSeparator (val) { + let res = '' + let i = val.length + const start = val[0] === '-' ? 1 : 0 + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}` + } + return `${val.slice(0, i)}${res}` +} + +// CHECK FUNCTIONS +// =============== + +function checkBounds (buf, offset, byteLength) { + validateNumber(offset, 'offset') + if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { + boundsError(offset, buf.length - (byteLength + 1)) + } +} + +function checkIntBI (value, min, max, buf, offset, byteLength) { + if (value > max || value < min) { + const n = typeof min === 'bigint' ? 'n' : '' + let range + if (byteLength > 3) { + if (min === 0 || min === BigInt(0)) { + range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` + } else { + range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + + `${(byteLength + 1) * 8 - 1}${n}` + } + } else { + range = `>= ${min}${n} and <= ${max}${n}` + } + throw new errors.ERR_OUT_OF_RANGE('value', range, value) + } + checkBounds(buf, offset, byteLength) +} + +function validateNumber (value, name) { + if (typeof value !== 'number') { + throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) + } +} + +function boundsError (value, length, type) { + if (Math.floor(value) !== value) { + validateNumber(value, type) + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) + } + + if (length < 0) { + throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() + } + + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', + `>= ${type ? 1 : 0} and <= ${length}`, + value) +} + +// HELPER FUNCTIONS +// ================ + +const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = str.trim().replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function utf8ToBytes (string, units) { + units = units || Infinity + let codePoint + const length = string.length + let leadSurrogate = null + const bytes = [] + + for (let i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + let c, hi, lo + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + let i + for (i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +// Create lookup table for `toString('hex')` +// See: https://github.com/feross/buffer/issues/219 +const hexSliceLookupTable = (function () { + const alphabet = '0123456789abcdef' + const table = new Array(256) + for (let i = 0; i < 16; ++i) { + const i16 = i * 16 + for (let j = 0; j < 16; ++j) { + table[i16 + j] = alphabet[i] + alphabet[j] + } + } + return table +})() + +// Return not function with Error if BigInt not supported +function defineBigIntMethod (fn) { + return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn +} + +function BufferBigIntNotDefined () { + throw new Error('BigInt not supported') +} + + +/***/ }), + +/***/ 1027: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\n\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nconst Reporter = (__webpack_require__(/*! ../base/reporter */ \"./node_modules/asn1.js/lib/asn1/base/reporter.js\").Reporter);\nconst Buffer = (__webpack_require__(/*! safer-buffer */ \"./node_modules/safer-buffer/safer.js\").Buffer);\n\nfunction DecoderBuffer(base, options) {\n Reporter.call(this, options);\n if (!Buffer.isBuffer(base)) {\n this.error('Input not Buffer');\n return;\n }\n\n this.base = base;\n this.offset = 0;\n this.length = base.length;\n}\ninherits(DecoderBuffer, Reporter);\nexports.DecoderBuffer = DecoderBuffer;\n\nDecoderBuffer.isDecoderBuffer = function isDecoderBuffer(data) {\n if (data instanceof DecoderBuffer) {\n return true;\n }\n\n // Or accept compatible API\n const isCompatible = typeof data === 'object' &&\n Buffer.isBuffer(data.base) &&\n data.constructor.name === 'DecoderBuffer' &&\n typeof data.offset === 'number' &&\n typeof data.length === 'number' &&\n typeof data.save === 'function' &&\n typeof data.restore === 'function' &&\n typeof data.isEmpty === 'function' &&\n typeof data.readUInt8 === 'function' &&\n typeof data.skip === 'function' &&\n typeof data.raw === 'function';\n\n return isCompatible;\n};\n\nDecoderBuffer.prototype.save = function save() {\n return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };\n};\n\nDecoderBuffer.prototype.restore = function restore(save) {\n // Return skipped data\n const res = new DecoderBuffer(this.base);\n res.offset = save.offset;\n res.length = this.offset;\n\n this.offset = save.offset;\n Reporter.prototype.restore.call(this, save.reporter);\n\n return res;\n};\n\nDecoderBuffer.prototype.isEmpty = function isEmpty() {\n return this.offset === this.length;\n};\n\nDecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {\n if (this.offset + 1 <= this.length)\n return this.base.readUInt8(this.offset++, true);\n else\n return this.error(fail || 'DecoderBuffer overrun');\n};\n\nDecoderBuffer.prototype.skip = function skip(bytes, fail) {\n if (!(this.offset + bytes <= this.length))\n return this.error(fail || 'DecoderBuffer overrun');\n\n const res = new DecoderBuffer(this.base);\n\n // Share reporter state\n res._reporterState = this._reporterState;\n\n res.offset = this.offset;\n res.length = this.offset + bytes;\n this.offset += bytes;\n return res;\n};\n\nDecoderBuffer.prototype.raw = function raw(save) {\n return this.base.slice(save ? save.offset : this.offset, this.length);\n};\n\nfunction EncoderBuffer(value, reporter) {\n if (Array.isArray(value)) {\n this.length = 0;\n this.value = value.map(function(item) {\n if (!EncoderBuffer.isEncoderBuffer(item))\n item = new EncoderBuffer(item, reporter);\n this.length += item.length;\n return item;\n }, this);\n } else if (typeof value === 'number') {\n if (!(0 <= value && value <= 0xff))\n return reporter.error('non-byte EncoderBuffer value');\n this.value = value;\n this.length = 1;\n } else if (typeof value === 'string') {\n this.value = value;\n this.length = Buffer.byteLength(value);\n } else if (Buffer.isBuffer(value)) {\n this.value = value;\n this.length = value.length;\n } else {\n return reporter.error('Unsupported type: ' + typeof value);\n }\n}\nexports.EncoderBuffer = EncoderBuffer;\n\nEncoderBuffer.isEncoderBuffer = function isEncoderBuffer(data) {\n if (data instanceof EncoderBuffer) {\n return true;\n }\n\n // Or accept compatible API\n const isCompatible = typeof data === 'object' &&\n data.constructor.name === 'EncoderBuffer' &&\n typeof data.length === 'number' &&\n typeof data.join === 'function';\n\n return isCompatible;\n};\n\nEncoderBuffer.prototype.join = function join(out, offset) {\n if (!out)\n out = Buffer.alloc(this.length);\n if (!offset)\n offset = 0;\n\n if (this.length === 0)\n return out;\n\n if (Array.isArray(this.value)) {\n this.value.forEach(function(item) {\n item.join(out, offset);\n offset += item.length;\n });\n } else {\n if (typeof this.value === 'number')\n out[offset] = this.value;\n else if (typeof this.value === 'string')\n out.write(this.value, offset);\n else if (Buffer.isBuffer(this.value))\n this.value.copy(out, offset);\n offset += this.length;\n }\n\n return out;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/base/buffer.js?"); +var Buffer = (__webpack_require__(9509).Buffer) +var Transform = (__webpack_require__(2830).Transform) +var StringDecoder = (__webpack_require__(2553)/* .StringDecoder */ .s) +var inherits = __webpack_require__(5717) + +function CipherBase (hashMode) { + Transform.call(this) + this.hashMode = typeof hashMode === 'string' + if (this.hashMode) { + this[hashMode] = this._finalOrDigest + } else { + this.final = this._finalOrDigest + } + if (this._final) { + this.__final = this._final + this._final = null + } + this._decoder = null + this._encoding = null +} +inherits(CipherBase, Transform) + +CipherBase.prototype.update = function (data, inputEnc, outputEnc) { + if (typeof data === 'string') { + data = Buffer.from(data, inputEnc) + } + + var outData = this._update(data) + if (this.hashMode) return this + + if (outputEnc) { + outData = this._toString(outData, outputEnc) + } + + return outData +} + +CipherBase.prototype.setAutoPadding = function () {} +CipherBase.prototype.getAuthTag = function () { + throw new Error('trying to get auth tag in unsupported state') +} + +CipherBase.prototype.setAuthTag = function () { + throw new Error('trying to set auth tag in unsupported state') +} + +CipherBase.prototype.setAAD = function () { + throw new Error('trying to set aad in unsupported state') +} + +CipherBase.prototype._transform = function (data, _, next) { + var err + try { + if (this.hashMode) { + this._update(data) + } else { + this.push(this._update(data)) + } + } catch (e) { + err = e + } finally { + next(err) + } +} +CipherBase.prototype._flush = function (done) { + var err + try { + this.push(this.__final()) + } catch (e) { + err = e + } + + done(err) +} +CipherBase.prototype._finalOrDigest = function (outputEnc) { + var outData = this.__final() || Buffer.alloc(0) + if (outputEnc) { + outData = this._toString(outData, outputEnc, true) + } + return outData +} + +CipherBase.prototype._toString = function (value, enc, fin) { + if (!this._decoder) { + this._decoder = new StringDecoder(enc) + this._encoding = enc + } + + if (this._encoding !== enc) throw new Error('can\'t switch encodings') + + var out = this._decoder.write(value) + if (fin) { + out += this._decoder.end() + } + + return out +} + +module.exports = CipherBase + + +/***/ }), + +/***/ 6497: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -/***/ }), +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = __webpack_require__(8764).Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +/***/ }), + +/***/ 6393: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ "./node_modules/asn1.js/lib/asn1/base/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/index.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +var elliptic = __webpack_require__(6266) +var BN = __webpack_require__(3550) + +module.exports = function createECDH (curve) { + return new ECDH(curve) +} + +var aliases = { + secp256k1: { + name: 'secp256k1', + byteLength: 32 + }, + secp224r1: { + name: 'p224', + byteLength: 28 + }, + prime256v1: { + name: 'p256', + byteLength: 32 + }, + prime192v1: { + name: 'p192', + byteLength: 24 + }, + ed25519: { + name: 'ed25519', + byteLength: 32 + }, + secp384r1: { + name: 'p384', + byteLength: 48 + }, + secp521r1: { + name: 'p521', + byteLength: 66 + } +} + +aliases.p224 = aliases.secp224r1 +aliases.p256 = aliases.secp256r1 = aliases.prime256v1 +aliases.p192 = aliases.secp192r1 = aliases.prime192v1 +aliases.p384 = aliases.secp384r1 +aliases.p521 = aliases.secp521r1 + +function ECDH (curve) { + this.curveType = aliases[curve] + if (!this.curveType) { + this.curveType = { + name: curve + } + } + this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap + this.keys = void 0 +} + +ECDH.prototype.generateKeys = function (enc, format) { + this.keys = this.curve.genKeyPair() + return this.getPublicKey(enc, format) +} + +ECDH.prototype.computeSecret = function (other, inenc, enc) { + inenc = inenc || 'utf8' + if (!Buffer.isBuffer(other)) { + other = new Buffer(other, inenc) + } + var otherPub = this.curve.keyFromPublic(other).getPublic() + var out = otherPub.mul(this.keys.getPrivate()).getX() + return formatReturnValue(out, enc, this.curveType.byteLength) +} + +ECDH.prototype.getPublicKey = function (enc, format) { + var key = this.keys.getPublic(format === 'compressed', true) + if (format === 'hybrid') { + if (key[key.length - 1] % 2) { + key[0] = 7 + } else { + key[0] = 6 + } + } + return formatReturnValue(key, enc) +} + +ECDH.prototype.getPrivateKey = function (enc) { + return formatReturnValue(this.keys.getPrivate(), enc) +} + +ECDH.prototype.setPublicKey = function (pub, enc) { + enc = enc || 'utf8' + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc) + } + this.keys._importPublic(pub) + return this +} + +ECDH.prototype.setPrivateKey = function (priv, enc) { + enc = enc || 'utf8' + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc) + } + + var _priv = new BN(priv) + _priv = _priv.toString(16) + this.keys = this.curve.genKeyPair() + this.keys._importPrivate(_priv) + return this +} + +function formatReturnValue (bn, enc, len) { + if (!Array.isArray(bn)) { + bn = bn.toArray() + } + var buf = new Buffer(bn) + if (len && buf.length < len) { + var zeros = new Buffer(len - buf.length) + zeros.fill(0) + buf = Buffer.concat([zeros, buf]) + } + if (!enc) { + return buf + } else { + return buf.toString(enc) + } +} + + +/***/ }), + +/***/ 3482: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nconst base = exports;\n\nbase.Reporter = (__webpack_require__(/*! ./reporter */ \"./node_modules/asn1.js/lib/asn1/base/reporter.js\").Reporter);\nbase.DecoderBuffer = (__webpack_require__(/*! ./buffer */ \"./node_modules/asn1.js/lib/asn1/base/buffer.js\").DecoderBuffer);\nbase.EncoderBuffer = (__webpack_require__(/*! ./buffer */ \"./node_modules/asn1.js/lib/asn1/base/buffer.js\").EncoderBuffer);\nbase.Node = __webpack_require__(/*! ./node */ \"./node_modules/asn1.js/lib/asn1/base/node.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/base/index.js?"); -/***/ }), +var inherits = __webpack_require__(5717) +var MD5 = __webpack_require__(2318) +var RIPEMD160 = __webpack_require__(9785) +var sha = __webpack_require__(9072) +var Base = __webpack_require__(1027) -/***/ "./node_modules/asn1.js/lib/asn1/base/node.js": -/*!****************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/node.js ***! - \****************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function Hash (hash) { + Base.call(this, 'digest') -"use strict"; -eval("\n\nconst Reporter = (__webpack_require__(/*! ../base/reporter */ \"./node_modules/asn1.js/lib/asn1/base/reporter.js\").Reporter);\nconst EncoderBuffer = (__webpack_require__(/*! ../base/buffer */ \"./node_modules/asn1.js/lib/asn1/base/buffer.js\").EncoderBuffer);\nconst DecoderBuffer = (__webpack_require__(/*! ../base/buffer */ \"./node_modules/asn1.js/lib/asn1/base/buffer.js\").DecoderBuffer);\nconst assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\n// Supported tags\nconst tags = [\n 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',\n 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',\n 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',\n 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'\n];\n\n// Public methods list\nconst methods = [\n 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',\n 'any', 'contains'\n].concat(tags);\n\n// Overrided methods list\nconst overrided = [\n '_peekTag', '_decodeTag', '_use',\n '_decodeStr', '_decodeObjid', '_decodeTime',\n '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',\n\n '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',\n '_encodeNull', '_encodeInt', '_encodeBool'\n];\n\nfunction Node(enc, parent, name) {\n const state = {};\n this._baseState = state;\n\n state.name = name;\n state.enc = enc;\n\n state.parent = parent || null;\n state.children = null;\n\n // State\n state.tag = null;\n state.args = null;\n state.reverseArgs = null;\n state.choice = null;\n state.optional = false;\n state.any = false;\n state.obj = false;\n state.use = null;\n state.useDecoder = null;\n state.key = null;\n state['default'] = null;\n state.explicit = null;\n state.implicit = null;\n state.contains = null;\n\n // Should create new instance on each method\n if (!state.parent) {\n state.children = [];\n this._wrap();\n }\n}\nmodule.exports = Node;\n\nconst stateProps = [\n 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',\n 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',\n 'implicit', 'contains'\n];\n\nNode.prototype.clone = function clone() {\n const state = this._baseState;\n const cstate = {};\n stateProps.forEach(function(prop) {\n cstate[prop] = state[prop];\n });\n const res = new this.constructor(cstate.parent);\n res._baseState = cstate;\n return res;\n};\n\nNode.prototype._wrap = function wrap() {\n const state = this._baseState;\n methods.forEach(function(method) {\n this[method] = function _wrappedMethod() {\n const clone = new this.constructor(this);\n state.children.push(clone);\n return clone[method].apply(clone, arguments);\n };\n }, this);\n};\n\nNode.prototype._init = function init(body) {\n const state = this._baseState;\n\n assert(state.parent === null);\n body.call(this);\n\n // Filter children\n state.children = state.children.filter(function(child) {\n return child._baseState.parent === this;\n }, this);\n assert.equal(state.children.length, 1, 'Root node can have only one child');\n};\n\nNode.prototype._useArgs = function useArgs(args) {\n const state = this._baseState;\n\n // Filter children and args\n const children = args.filter(function(arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function(arg) {\n return !(arg instanceof this.constructor);\n }, this);\n\n if (children.length !== 0) {\n assert(state.children === null);\n state.children = children;\n\n // Replace parent to maintain backward link\n children.forEach(function(child) {\n child._baseState.parent = this;\n }, this);\n }\n if (args.length !== 0) {\n assert(state.args === null);\n state.args = args;\n state.reverseArgs = args.map(function(arg) {\n if (typeof arg !== 'object' || arg.constructor !== Object)\n return arg;\n\n const res = {};\n Object.keys(arg).forEach(function(key) {\n if (key == (key | 0))\n key |= 0;\n const value = arg[key];\n res[value] = key;\n });\n return res;\n });\n }\n};\n\n//\n// Overrided methods\n//\n\noverrided.forEach(function(method) {\n Node.prototype[method] = function _overrided() {\n const state = this._baseState;\n throw new Error(method + ' not implemented for encoding: ' + state.enc);\n };\n});\n\n//\n// Public methods\n//\n\ntags.forEach(function(tag) {\n Node.prototype[tag] = function _tagMethod() {\n const state = this._baseState;\n const args = Array.prototype.slice.call(arguments);\n\n assert(state.tag === null);\n state.tag = tag;\n\n this._useArgs(args);\n\n return this;\n };\n});\n\nNode.prototype.use = function use(item) {\n assert(item);\n const state = this._baseState;\n\n assert(state.use === null);\n state.use = item;\n\n return this;\n};\n\nNode.prototype.optional = function optional() {\n const state = this._baseState;\n\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.def = function def(val) {\n const state = this._baseState;\n\n assert(state['default'] === null);\n state['default'] = val;\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.explicit = function explicit(num) {\n const state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.explicit = num;\n\n return this;\n};\n\nNode.prototype.implicit = function implicit(num) {\n const state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.implicit = num;\n\n return this;\n};\n\nNode.prototype.obj = function obj() {\n const state = this._baseState;\n const args = Array.prototype.slice.call(arguments);\n\n state.obj = true;\n\n if (args.length !== 0)\n this._useArgs(args);\n\n return this;\n};\n\nNode.prototype.key = function key(newKey) {\n const state = this._baseState;\n\n assert(state.key === null);\n state.key = newKey;\n\n return this;\n};\n\nNode.prototype.any = function any() {\n const state = this._baseState;\n\n state.any = true;\n\n return this;\n};\n\nNode.prototype.choice = function choice(obj) {\n const state = this._baseState;\n\n assert(state.choice === null);\n state.choice = obj;\n this._useArgs(Object.keys(obj).map(function(key) {\n return obj[key];\n }));\n\n return this;\n};\n\nNode.prototype.contains = function contains(item) {\n const state = this._baseState;\n\n assert(state.use === null);\n state.contains = item;\n\n return this;\n};\n\n//\n// Decoding\n//\n\nNode.prototype._decode = function decode(input, options) {\n const state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return input.wrapResult(state.children[0]._decode(input, options));\n\n let result = state['default'];\n let present = true;\n\n let prevKey = null;\n if (state.key !== null)\n prevKey = input.enterKey(state.key);\n\n // Check if tag is there\n if (state.optional) {\n let tag = null;\n if (state.explicit !== null)\n tag = state.explicit;\n else if (state.implicit !== null)\n tag = state.implicit;\n else if (state.tag !== null)\n tag = state.tag;\n\n if (tag === null && !state.any) {\n // Trial and Error\n const save = input.save();\n try {\n if (state.choice === null)\n this._decodeGeneric(state.tag, input, options);\n else\n this._decodeChoice(input, options);\n present = true;\n } catch (e) {\n present = false;\n }\n input.restore(save);\n } else {\n present = this._peekTag(input, tag, state.any);\n\n if (input.isError(present))\n return present;\n }\n }\n\n // Push object on stack\n let prevObj;\n if (state.obj && present)\n prevObj = input.enterObject();\n\n if (present) {\n // Unwrap explicit values\n if (state.explicit !== null) {\n const explicit = this._decodeTag(input, state.explicit);\n if (input.isError(explicit))\n return explicit;\n input = explicit;\n }\n\n const start = input.offset;\n\n // Unwrap implicit and normal values\n if (state.use === null && state.choice === null) {\n let save;\n if (state.any)\n save = input.save();\n const body = this._decodeTag(\n input,\n state.implicit !== null ? state.implicit : state.tag,\n state.any\n );\n if (input.isError(body))\n return body;\n\n if (state.any)\n result = input.raw(save);\n else\n input = body;\n }\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), start, input.length, 'tagged');\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), input.offset, input.length, 'content');\n\n // Select proper method for tag\n if (state.any) {\n // no-op\n } else if (state.choice === null) {\n result = this._decodeGeneric(state.tag, input, options);\n } else {\n result = this._decodeChoice(input, options);\n }\n\n if (input.isError(result))\n return result;\n\n // Decode children\n if (!state.any && state.choice === null && state.children !== null) {\n state.children.forEach(function decodeChildren(child) {\n // NOTE: We are ignoring errors here, to let parser continue with other\n // parts of encoded data\n child._decode(input, options);\n });\n }\n\n // Decode contained/encoded by schema, only in bit or octet strings\n if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {\n const data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)\n ._decode(data, options);\n }\n }\n\n // Pop object\n if (state.obj && present)\n result = input.leaveObject(prevObj);\n\n // Set key\n if (state.key !== null && (result !== null || present === true))\n input.leaveKey(prevKey, state.key, result);\n else if (prevKey !== null)\n input.exitKey(prevKey);\n\n return result;\n};\n\nNode.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {\n const state = this._baseState;\n\n if (tag === 'seq' || tag === 'set')\n return null;\n if (tag === 'seqof' || tag === 'setof')\n return this._decodeList(input, tag, state.args[0], options);\n else if (/str$/.test(tag))\n return this._decodeStr(input, tag, options);\n else if (tag === 'objid' && state.args)\n return this._decodeObjid(input, state.args[0], state.args[1], options);\n else if (tag === 'objid')\n return this._decodeObjid(input, null, null, options);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._decodeTime(input, tag, options);\n else if (tag === 'null_')\n return this._decodeNull(input, options);\n else if (tag === 'bool')\n return this._decodeBool(input, options);\n else if (tag === 'objDesc')\n return this._decodeStr(input, tag, options);\n else if (tag === 'int' || tag === 'enum')\n return this._decodeInt(input, state.args && state.args[0], options);\n\n if (state.use !== null) {\n return this._getUse(state.use, input._reporterState.obj)\n ._decode(input, options);\n } else {\n return input.error('unknown tag: ' + tag);\n }\n};\n\nNode.prototype._getUse = function _getUse(entity, obj) {\n\n const state = this._baseState;\n // Create altered use decoder if implicit is set\n state.useDecoder = this._use(entity, obj);\n assert(state.useDecoder._baseState.parent === null);\n state.useDecoder = state.useDecoder._baseState.children[0];\n if (state.implicit !== state.useDecoder._baseState.implicit) {\n state.useDecoder = state.useDecoder.clone();\n state.useDecoder._baseState.implicit = state.implicit;\n }\n return state.useDecoder;\n};\n\nNode.prototype._decodeChoice = function decodeChoice(input, options) {\n const state = this._baseState;\n let result = null;\n let match = false;\n\n Object.keys(state.choice).some(function(key) {\n const save = input.save();\n const node = state.choice[key];\n try {\n const value = node._decode(input, options);\n if (input.isError(value))\n return false;\n\n result = { type: key, value: value };\n match = true;\n } catch (e) {\n input.restore(save);\n return false;\n }\n return true;\n }, this);\n\n if (!match)\n return input.error('Choice not matched');\n\n return result;\n};\n\n//\n// Encoding\n//\n\nNode.prototype._createEncoderBuffer = function createEncoderBuffer(data) {\n return new EncoderBuffer(data, this.reporter);\n};\n\nNode.prototype._encode = function encode(data, reporter, parent) {\n const state = this._baseState;\n if (state['default'] !== null && state['default'] === data)\n return;\n\n const result = this._encodeValue(data, reporter, parent);\n if (result === undefined)\n return;\n\n if (this._skipDefault(result, reporter, parent))\n return;\n\n return result;\n};\n\nNode.prototype._encodeValue = function encode(data, reporter, parent) {\n const state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return state.children[0]._encode(data, reporter || new Reporter());\n\n let result = null;\n\n // Set reporter to share it with a child class\n this.reporter = reporter;\n\n // Check if data is there\n if (state.optional && data === undefined) {\n if (state['default'] !== null)\n data = state['default'];\n else\n return;\n }\n\n // Encode children first\n let content = null;\n let primitive = false;\n if (state.any) {\n // Anything that was given is translated to buffer\n result = this._createEncoderBuffer(data);\n } else if (state.choice) {\n result = this._encodeChoice(data, reporter);\n } else if (state.contains) {\n content = this._getUse(state.contains, parent)._encode(data, reporter);\n primitive = true;\n } else if (state.children) {\n content = state.children.map(function(child) {\n if (child._baseState.tag === 'null_')\n return child._encode(null, reporter, data);\n\n if (child._baseState.key === null)\n return reporter.error('Child should have a key');\n const prevKey = reporter.enterKey(child._baseState.key);\n\n if (typeof data !== 'object')\n return reporter.error('Child expected, but input is not object');\n\n const res = child._encode(data[child._baseState.key], reporter, data);\n reporter.leaveKey(prevKey);\n\n return res;\n }, this).filter(function(child) {\n return child;\n });\n content = this._createEncoderBuffer(content);\n } else {\n if (state.tag === 'seqof' || state.tag === 'setof') {\n // TODO(indutny): this should be thrown on DSL level\n if (!(state.args && state.args.length === 1))\n return reporter.error('Too many args for : ' + state.tag);\n\n if (!Array.isArray(data))\n return reporter.error('seqof/setof, but data is not Array');\n\n const child = this.clone();\n child._baseState.implicit = null;\n content = this._createEncoderBuffer(data.map(function(item) {\n const state = this._baseState;\n\n return this._getUse(state.args[0], data)._encode(item, reporter);\n }, child));\n } else if (state.use !== null) {\n result = this._getUse(state.use, parent)._encode(data, reporter);\n } else {\n content = this._encodePrimitive(state.tag, data);\n primitive = true;\n }\n }\n\n // Encode data itself\n if (!state.any && state.choice === null) {\n const tag = state.implicit !== null ? state.implicit : state.tag;\n const cls = state.implicit === null ? 'universal' : 'context';\n\n if (tag === null) {\n if (state.use === null)\n reporter.error('Tag could be omitted only for .use()');\n } else {\n if (state.use === null)\n result = this._encodeComposite(tag, primitive, cls, content);\n }\n }\n\n // Wrap in explicit\n if (state.explicit !== null)\n result = this._encodeComposite(state.explicit, false, 'context', result);\n\n return result;\n};\n\nNode.prototype._encodeChoice = function encodeChoice(data, reporter) {\n const state = this._baseState;\n\n const node = state.choice[data.type];\n if (!node) {\n assert(\n false,\n data.type + ' not found in ' +\n JSON.stringify(Object.keys(state.choice)));\n }\n return node._encode(data.value, reporter);\n};\n\nNode.prototype._encodePrimitive = function encodePrimitive(tag, data) {\n const state = this._baseState;\n\n if (/str$/.test(tag))\n return this._encodeStr(data, tag);\n else if (tag === 'objid' && state.args)\n return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);\n else if (tag === 'objid')\n return this._encodeObjid(data, null, null);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._encodeTime(data, tag);\n else if (tag === 'null_')\n return this._encodeNull();\n else if (tag === 'int' || tag === 'enum')\n return this._encodeInt(data, state.args && state.reverseArgs[0]);\n else if (tag === 'bool')\n return this._encodeBool(data);\n else if (tag === 'objDesc')\n return this._encodeStr(data, tag);\n else\n throw new Error('Unsupported tag: ' + tag);\n};\n\nNode.prototype._isNumstr = function isNumstr(str) {\n return /^[0-9 ]*$/.test(str);\n};\n\nNode.prototype._isPrintstr = function isPrintstr(str) {\n return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/base/node.js?"); + this._hash = hash +} -/***/ }), +inherits(Hash, Base) -/***/ "./node_modules/asn1.js/lib/asn1/base/reporter.js": -/*!********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/reporter.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +Hash.prototype._update = function (data) { + this._hash.update(data) +} -"use strict"; -eval("\n\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nfunction Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n}\nexports.Reporter = Reporter;\n\nReporter.prototype.isError = function isError(obj) {\n return obj instanceof ReporterError;\n};\n\nReporter.prototype.save = function save() {\n const state = this._reporterState;\n\n return { obj: state.obj, pathLen: state.path.length };\n};\n\nReporter.prototype.restore = function restore(data) {\n const state = this._reporterState;\n\n state.obj = data.obj;\n state.path = state.path.slice(0, data.pathLen);\n};\n\nReporter.prototype.enterKey = function enterKey(key) {\n return this._reporterState.path.push(key);\n};\n\nReporter.prototype.exitKey = function exitKey(index) {\n const state = this._reporterState;\n\n state.path = state.path.slice(0, index - 1);\n};\n\nReporter.prototype.leaveKey = function leaveKey(index, key, value) {\n const state = this._reporterState;\n\n this.exitKey(index);\n if (state.obj !== null)\n state.obj[key] = value;\n};\n\nReporter.prototype.path = function path() {\n return this._reporterState.path.join('/');\n};\n\nReporter.prototype.enterObject = function enterObject() {\n const state = this._reporterState;\n\n const prev = state.obj;\n state.obj = {};\n return prev;\n};\n\nReporter.prototype.leaveObject = function leaveObject(prev) {\n const state = this._reporterState;\n\n const now = state.obj;\n state.obj = prev;\n return now;\n};\n\nReporter.prototype.error = function error(msg) {\n let err;\n const state = this._reporterState;\n\n const inherited = msg instanceof ReporterError;\n if (inherited) {\n err = msg;\n } else {\n err = new ReporterError(state.path.map(function(elem) {\n return '[' + JSON.stringify(elem) + ']';\n }).join(''), msg.message || msg, msg.stack);\n }\n\n if (!state.options.partial)\n throw err;\n\n if (!inherited)\n state.errors.push(err);\n\n return err;\n};\n\nReporter.prototype.wrapResult = function wrapResult(result) {\n const state = this._reporterState;\n if (!state.options.partial)\n return result;\n\n return {\n result: this.isError(result) ? null : result,\n errors: state.errors\n };\n};\n\nfunction ReporterError(path, msg) {\n this.path = path;\n this.rethrow(msg);\n}\ninherits(ReporterError, Error);\n\nReporterError.prototype.rethrow = function rethrow(msg) {\n this.message = msg + ' at: ' + (this.path || '(shallow)');\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, ReporterError);\n\n if (!this.stack) {\n try {\n // IE only adds stack when thrown\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n }\n return this;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/base/reporter.js?"); +Hash.prototype._final = function () { + return this._hash.digest() +} -/***/ }), +module.exports = function createHash (alg) { + alg = alg.toLowerCase() + if (alg === 'md5') return new MD5() + if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160() -/***/ "./node_modules/asn1.js/lib/asn1/constants/der.js": -/*!********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/constants/der.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports) { + return new Hash(sha(alg)) +} -"use strict"; -eval("\n\n// Helper\nfunction reverse(map) {\n const res = {};\n\n Object.keys(map).forEach(function(key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key)\n key = key | 0;\n\n const value = map[key];\n res[value] = key;\n });\n\n return res;\n}\n\nexports.tagClass = {\n 0: 'universal',\n 1: 'application',\n 2: 'context',\n 3: 'private'\n};\nexports.tagClassByName = reverse(exports.tagClass);\n\nexports.tag = {\n 0x00: 'end',\n 0x01: 'bool',\n 0x02: 'int',\n 0x03: 'bitstr',\n 0x04: 'octstr',\n 0x05: 'null_',\n 0x06: 'objid',\n 0x07: 'objDesc',\n 0x08: 'external',\n 0x09: 'real',\n 0x0a: 'enum',\n 0x0b: 'embed',\n 0x0c: 'utf8str',\n 0x0d: 'relativeOid',\n 0x10: 'seq',\n 0x11: 'set',\n 0x12: 'numstr',\n 0x13: 'printstr',\n 0x14: 't61str',\n 0x15: 'videostr',\n 0x16: 'ia5str',\n 0x17: 'utctime',\n 0x18: 'gentime',\n 0x19: 'graphstr',\n 0x1a: 'iso646str',\n 0x1b: 'genstr',\n 0x1c: 'unistr',\n 0x1d: 'charstr',\n 0x1e: 'bmpstr'\n};\nexports.tagByName = reverse(exports.tag);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/constants/der.js?"); /***/ }), -/***/ "./node_modules/asn1.js/lib/asn1/constants/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/constants/index.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 8028: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var MD5 = __webpack_require__(2318) + +module.exports = function (buffer) { + return new MD5().update(buffer).digest() +} -"use strict"; -eval("\n\nconst constants = exports;\n\n// Helper\nconstants._reverse = function reverse(map) {\n const res = {};\n\n Object.keys(map).forEach(function(key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key)\n key = key | 0;\n\n const value = map[key];\n res[value] = key;\n });\n\n return res;\n};\n\nconstants.der = __webpack_require__(/*! ./der */ \"./node_modules/asn1.js/lib/asn1/constants/der.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/constants/index.js?"); /***/ }), -/***/ "./node_modules/asn1.js/lib/asn1/decoders/der.js": -/*!*******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/decoders/der.js ***! - \*******************************************************/ +/***/ 8355: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nconst bignum = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nconst DecoderBuffer = (__webpack_require__(/*! ../base/buffer */ \"./node_modules/asn1.js/lib/asn1/base/buffer.js\").DecoderBuffer);\nconst Node = __webpack_require__(/*! ../base/node */ \"./node_modules/asn1.js/lib/asn1/base/node.js\");\n\n// Import DER constants\nconst der = __webpack_require__(/*! ../constants/der */ \"./node_modules/asn1.js/lib/asn1/constants/der.js\");\n\nfunction DERDecoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n}\nmodule.exports = DERDecoder;\n\nDERDecoder.prototype.decode = function decode(data, options) {\n if (!DecoderBuffer.isDecoderBuffer(data)) {\n data = new DecoderBuffer(data, options);\n }\n\n return this.tree._decode(data, options);\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\ninherits(DERNode, Node);\n\nDERNode.prototype._peekTag = function peekTag(buffer, tag, any) {\n if (buffer.isEmpty())\n return false;\n\n const state = buffer.save();\n const decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n buffer.restore(state);\n\n return decodedTag.tag === tag || decodedTag.tagStr === tag ||\n (decodedTag.tagStr + 'of') === tag || any;\n};\n\nDERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {\n const decodedTag = derDecodeTag(buffer,\n 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n let len = derDecodeLen(buffer,\n decodedTag.primitive,\n 'Failed to get length of \"' + tag + '\"');\n\n // Failure\n if (buffer.isError(len))\n return len;\n\n if (!any &&\n decodedTag.tag !== tag &&\n decodedTag.tagStr !== tag &&\n decodedTag.tagStr + 'of' !== tag) {\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n }\n\n if (decodedTag.primitive || len !== null)\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n\n // Indefinite length... find END tag\n const state = buffer.save();\n const res = this._skipUntilEnd(\n buffer,\n 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n if (buffer.isError(res))\n return res;\n\n len = buffer.offset - state.offset;\n buffer.restore(state);\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n};\n\nDERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {\n for (;;) {\n const tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag))\n return tag;\n const len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len))\n return len;\n\n let res;\n if (tag.primitive || len !== null)\n res = buffer.skip(len);\n else\n res = this._skipUntilEnd(buffer, fail);\n\n // Failure\n if (buffer.isError(res))\n return res;\n\n if (tag.tagStr === 'end')\n break;\n }\n};\n\nDERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,\n options) {\n const result = [];\n while (!buffer.isEmpty()) {\n const possibleEnd = this._peekTag(buffer, 'end');\n if (buffer.isError(possibleEnd))\n return possibleEnd;\n\n const res = decoder.decode(buffer, 'der', options);\n if (buffer.isError(res) && possibleEnd)\n break;\n result.push(res);\n }\n return result;\n};\n\nDERNode.prototype._decodeStr = function decodeStr(buffer, tag) {\n if (tag === 'bitstr') {\n const unused = buffer.readUInt8();\n if (buffer.isError(unused))\n return unused;\n return { unused: unused, data: buffer.raw() };\n } else if (tag === 'bmpstr') {\n const raw = buffer.raw();\n if (raw.length % 2 === 1)\n return buffer.error('Decoding of string type: bmpstr length mismatch');\n\n let str = '';\n for (let i = 0; i < raw.length / 2; i++) {\n str += String.fromCharCode(raw.readUInt16BE(i * 2));\n }\n return str;\n } else if (tag === 'numstr') {\n const numstr = buffer.raw().toString('ascii');\n if (!this._isNumstr(numstr)) {\n return buffer.error('Decoding of string type: ' +\n 'numstr unsupported characters');\n }\n return numstr;\n } else if (tag === 'octstr') {\n return buffer.raw();\n } else if (tag === 'objDesc') {\n return buffer.raw();\n } else if (tag === 'printstr') {\n const printstr = buffer.raw().toString('ascii');\n if (!this._isPrintstr(printstr)) {\n return buffer.error('Decoding of string type: ' +\n 'printstr unsupported characters');\n }\n return printstr;\n } else if (/str$/.test(tag)) {\n return buffer.raw().toString();\n } else {\n return buffer.error('Decoding of string type: ' + tag + ' unsupported');\n }\n};\n\nDERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {\n let result;\n const identifiers = [];\n let ident = 0;\n let subident = 0;\n while (!buffer.isEmpty()) {\n subident = buffer.readUInt8();\n ident <<= 7;\n ident |= subident & 0x7f;\n if ((subident & 0x80) === 0) {\n identifiers.push(ident);\n ident = 0;\n }\n }\n if (subident & 0x80)\n identifiers.push(ident);\n\n const first = (identifiers[0] / 40) | 0;\n const second = identifiers[0] % 40;\n\n if (relative)\n result = identifiers;\n else\n result = [first, second].concat(identifiers.slice(1));\n\n if (values) {\n let tmp = values[result.join(' ')];\n if (tmp === undefined)\n tmp = values[result.join('.')];\n if (tmp !== undefined)\n result = tmp;\n }\n\n return result;\n};\n\nDERNode.prototype._decodeTime = function decodeTime(buffer, tag) {\n const str = buffer.raw().toString();\n\n let year;\n let mon;\n let day;\n let hour;\n let min;\n let sec;\n if (tag === 'gentime') {\n year = str.slice(0, 4) | 0;\n mon = str.slice(4, 6) | 0;\n day = str.slice(6, 8) | 0;\n hour = str.slice(8, 10) | 0;\n min = str.slice(10, 12) | 0;\n sec = str.slice(12, 14) | 0;\n } else if (tag === 'utctime') {\n year = str.slice(0, 2) | 0;\n mon = str.slice(2, 4) | 0;\n day = str.slice(4, 6) | 0;\n hour = str.slice(6, 8) | 0;\n min = str.slice(8, 10) | 0;\n sec = str.slice(10, 12) | 0;\n if (year < 70)\n year = 2000 + year;\n else\n year = 1900 + year;\n } else {\n return buffer.error('Decoding ' + tag + ' time is not supported yet');\n }\n\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n};\n\nDERNode.prototype._decodeNull = function decodeNull() {\n return null;\n};\n\nDERNode.prototype._decodeBool = function decodeBool(buffer) {\n const res = buffer.readUInt8();\n if (buffer.isError(res))\n return res;\n else\n return res !== 0;\n};\n\nDERNode.prototype._decodeInt = function decodeInt(buffer, values) {\n // Bigint, return as it is (assume big endian)\n const raw = buffer.raw();\n let res = new bignum(raw);\n\n if (values)\n res = values[res.toString(10)] || res;\n\n return res;\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getDecoder('der').tree;\n};\n\n// Utility methods\n\nfunction derDecodeTag(buf, fail) {\n let tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n\n const cls = der.tagClass[tag >> 6];\n const primitive = (tag & 0x20) === 0;\n\n // Multi-octet tag - load\n if ((tag & 0x1f) === 0x1f) {\n let oct = tag;\n tag = 0;\n while ((oct & 0x80) === 0x80) {\n oct = buf.readUInt8(fail);\n if (buf.isError(oct))\n return oct;\n\n tag <<= 7;\n tag |= oct & 0x7f;\n }\n } else {\n tag &= 0x1f;\n }\n const tagStr = der.tag[tag];\n\n return {\n cls: cls,\n primitive: primitive,\n tag: tag,\n tagStr: tagStr\n };\n}\n\nfunction derDecodeLen(buf, primitive, fail) {\n let len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n\n // Indefinite form\n if (!primitive && len === 0x80)\n return null;\n\n // Definite form\n if ((len & 0x80) === 0) {\n // Short form\n return len;\n }\n\n // Long form\n const num = len & 0x7f;\n if (num > 4)\n return buf.error('length octect is too long');\n\n len = 0;\n for (let i = 0; i < num; i++) {\n len <<= 8;\n const j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n\n return len;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/decoders/der.js?"); -/***/ }), +var inherits = __webpack_require__(5717) +var Legacy = __webpack_require__(1031) +var Base = __webpack_require__(1027) +var Buffer = (__webpack_require__(9509).Buffer) +var md5 = __webpack_require__(8028) +var RIPEMD160 = __webpack_require__(9785) -/***/ "./node_modules/asn1.js/lib/asn1/decoders/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/decoders/index.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +var sha = __webpack_require__(9072) -"use strict"; -eval("\n\nconst decoders = exports;\n\ndecoders.der = __webpack_require__(/*! ./der */ \"./node_modules/asn1.js/lib/asn1/decoders/der.js\");\ndecoders.pem = __webpack_require__(/*! ./pem */ \"./node_modules/asn1.js/lib/asn1/decoders/pem.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/decoders/index.js?"); +var ZEROS = Buffer.alloc(128) -/***/ }), +function Hmac (alg, key) { + Base.call(this, 'digest') + if (typeof key === 'string') { + key = Buffer.from(key) + } -/***/ "./node_modules/asn1.js/lib/asn1/decoders/pem.js": -/*!*******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/decoders/pem.js ***! - \*******************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 -"use strict"; -eval("\n\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nconst Buffer = (__webpack_require__(/*! safer-buffer */ \"./node_modules/safer-buffer/safer.js\").Buffer);\n\nconst DERDecoder = __webpack_require__(/*! ./der */ \"./node_modules/asn1.js/lib/asn1/decoders/der.js\");\n\nfunction PEMDecoder(entity) {\n DERDecoder.call(this, entity);\n this.enc = 'pem';\n}\ninherits(PEMDecoder, DERDecoder);\nmodule.exports = PEMDecoder;\n\nPEMDecoder.prototype.decode = function decode(data, options) {\n const lines = data.toString().split(/[\\r\\n]+/g);\n\n const label = options.label.toUpperCase();\n\n const re = /^-----(BEGIN|END) ([^-]+)-----$/;\n let start = -1;\n let end = -1;\n for (let i = 0; i < lines.length; i++) {\n const match = lines[i].match(re);\n if (match === null)\n continue;\n\n if (match[2] !== label)\n continue;\n\n if (start === -1) {\n if (match[1] !== 'BEGIN')\n break;\n start = i;\n } else {\n if (match[1] !== 'END')\n break;\n end = i;\n break;\n }\n }\n if (start === -1 || end === -1)\n throw new Error('PEM section not found for: ' + label);\n\n const base64 = lines.slice(start + 1, end).join('');\n // Remove excessive symbols\n base64.replace(/[^a-z0-9+/=]+/gi, '');\n\n const input = Buffer.from(base64, 'base64');\n return DERDecoder.prototype.decode.call(this, input, options);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/decoders/pem.js?"); + this._alg = alg + this._key = key + if (key.length > blocksize) { + var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) + key = hash.update(key).digest() + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } -/***/ }), + var ipad = this._ipad = Buffer.allocUnsafe(blocksize) + var opad = this._opad = Buffer.allocUnsafe(blocksize) -/***/ "./node_modules/asn1.js/lib/asn1/encoders/der.js": -/*!*******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/encoders/der.js ***! - \*******************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } + this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) + this._hash.update(ipad) +} -"use strict"; -eval("\n\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nconst Buffer = (__webpack_require__(/*! safer-buffer */ \"./node_modules/safer-buffer/safer.js\").Buffer);\nconst Node = __webpack_require__(/*! ../base/node */ \"./node_modules/asn1.js/lib/asn1/base/node.js\");\n\n// Import DER constants\nconst der = __webpack_require__(/*! ../constants/der */ \"./node_modules/asn1.js/lib/asn1/constants/der.js\");\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n}\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\ninherits(DERNode, Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag,\n primitive,\n cls,\n content) {\n const encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n\n // Short form\n if (content.length < 0x80) {\n const header = Buffer.alloc(2);\n header[0] = encodedTag;\n header[1] = content.length;\n return this._createEncoderBuffer([ header, content ]);\n }\n\n // Long form\n // Count octets required to store length\n let lenOctets = 1;\n for (let i = content.length; i >= 0x100; i >>= 8)\n lenOctets++;\n\n const header = Buffer.alloc(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)\n header[i] = j & 0xff;\n\n return this._createEncoderBuffer([ header, content ]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'bitstr') {\n return this._createEncoderBuffer([ str.unused | 0, str.data ]);\n } else if (tag === 'bmpstr') {\n const buf = Buffer.alloc(str.length * 2);\n for (let i = 0; i < str.length; i++) {\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n }\n return this._createEncoderBuffer(buf);\n } else if (tag === 'numstr') {\n if (!this._isNumstr(str)) {\n return this.reporter.error('Encoding of string type: numstr supports ' +\n 'only digits and space');\n }\n return this._createEncoderBuffer(str);\n } else if (tag === 'printstr') {\n if (!this._isPrintstr(str)) {\n return this.reporter.error('Encoding of string type: printstr supports ' +\n 'only latin upper and lower case letters, ' +\n 'digits, space, apostrophe, left and rigth ' +\n 'parenthesis, plus sign, comma, hyphen, ' +\n 'dot, slash, colon, equal sign, ' +\n 'question mark');\n }\n return this._createEncoderBuffer(str);\n } else if (/str$/.test(tag)) {\n return this._createEncoderBuffer(str);\n } else if (tag === 'objDesc') {\n return this._createEncoderBuffer(str);\n } else {\n return this.reporter.error('Encoding of string type: ' + tag +\n ' unsupported');\n }\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values)\n return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id))\n return this.reporter.error('objid not found in values map');\n id = values[id].split(/[\\s.]+/g);\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n } else if (Array.isArray(id)) {\n id = id.slice();\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' +\n 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n\n // Count number of octets\n let size = 0;\n for (let i = 0; i < id.length; i++) {\n let ident = id[i];\n for (size++; ident >= 0x80; ident >>= 7)\n size++;\n }\n\n const objid = Buffer.alloc(size);\n let offset = objid.length - 1;\n for (let i = id.length - 1; i >= 0; i--) {\n let ident = id[i];\n objid[offset--] = ident & 0x7f;\n while ((ident >>= 7) > 0)\n objid[offset--] = 0x80 | (ident & 0x7f);\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num < 10)\n return '0' + num;\n else\n return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n let str;\n const date = new Date(time);\n\n if (tag === 'gentime') {\n str = [\n two(date.getUTCFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else if (tag === 'utctime') {\n str = [\n two(date.getUTCFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values)\n return this.reporter.error('String int or enum given, but no values map');\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' +\n JSON.stringify(num));\n }\n num = values[num];\n }\n\n // Bignum, assume big endian\n if (typeof num !== 'number' && !Buffer.isBuffer(num)) {\n const numArray = num.toArray();\n if (!num.sign && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n num = Buffer.from(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n let size = num.length;\n if (num.length === 0)\n size++;\n\n const out = Buffer.alloc(size);\n num.copy(out);\n if (num.length === 0)\n out[0] = 0;\n return this._createEncoderBuffer(out);\n }\n\n if (num < 0x80)\n return this._createEncoderBuffer(num);\n\n if (num < 0x100)\n return this._createEncoderBuffer([0, num]);\n\n let size = 1;\n for (let i = num; i >= 0x100; i >>= 8)\n size++;\n\n const out = new Array(size);\n for (let i = out.length - 1; i >= 0; i--) {\n out[i] = num & 0xff;\n num >>= 8;\n }\n if(out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(Buffer.from(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n const state = this._baseState;\n let i;\n if (state['default'] === null)\n return false;\n\n const data = dataBuffer.join();\n if (state.defaultBuffer === undefined)\n state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n\n if (data.length !== state.defaultBuffer.length)\n return false;\n\n for (i=0; i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return false;\n\n return true;\n};\n\n// Utility methods\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n let res;\n\n if (tag === 'seqof')\n tag = 'seq';\n else if (tag === 'setof')\n tag = 'set';\n\n if (der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag === 'number' && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error('Unknown tag: ' + tag);\n\n if (res >= 0x1f)\n return reporter.error('Multi-octet tag encoding unsupported');\n\n if (!primitive)\n res |= 0x20;\n\n res |= (der.tagClassByName[cls || 'universal'] << 6);\n\n return res;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/encoders/der.js?"); +inherits(Hmac, Base) -/***/ }), +Hmac.prototype._update = function (data) { + this._hash.update(data) +} -/***/ "./node_modules/asn1.js/lib/asn1/encoders/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/encoders/index.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +Hmac.prototype._final = function () { + var h = this._hash.digest() + var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg) + return hash.update(this._opad).update(h).digest() +} + +module.exports = function createHmac (alg, key) { + alg = alg.toLowerCase() + if (alg === 'rmd160' || alg === 'ripemd160') { + return new Hmac('rmd160', key) + } + if (alg === 'md5') { + return new Legacy(md5, key) + } + return new Hmac(alg, key) +} -"use strict"; -eval("\n\nconst encoders = exports;\n\nencoders.der = __webpack_require__(/*! ./der */ \"./node_modules/asn1.js/lib/asn1/encoders/der.js\");\nencoders.pem = __webpack_require__(/*! ./pem */ \"./node_modules/asn1.js/lib/asn1/encoders/pem.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/encoders/index.js?"); /***/ }), -/***/ "./node_modules/asn1.js/lib/asn1/encoders/pem.js": -/*!*******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/encoders/pem.js ***! - \*******************************************************/ +/***/ 1031: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nconst DEREncoder = __webpack_require__(/*! ./der */ \"./node_modules/asn1.js/lib/asn1/encoders/der.js\");\n\nfunction PEMEncoder(entity) {\n DEREncoder.call(this, entity);\n this.enc = 'pem';\n}\ninherits(PEMEncoder, DEREncoder);\nmodule.exports = PEMEncoder;\n\nPEMEncoder.prototype.encode = function encode(data, options) {\n const buf = DEREncoder.prototype.encode.call(this, data);\n\n const p = buf.toString('base64');\n const out = [ '-----BEGIN ' + options.label + '-----' ];\n for (let i = 0; i < p.length; i += 64)\n out.push(p.slice(i, i + 64));\n out.push('-----END ' + options.label + '-----');\n return out.join('\\n');\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/asn1.js/lib/asn1/encoders/pem.js?"); -/***/ }), +var inherits = __webpack_require__(5717) +var Buffer = (__webpack_require__(9509).Buffer) -/***/ "./node_modules/base64-js/index.js": -/*!*****************************************!*\ - !*** ./node_modules/base64-js/index.js ***! - \*****************************************/ -/***/ (function(__unused_webpack_module, exports) { +var Base = __webpack_require__(1027) -"use strict"; -eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/base64-js/index.js?"); +var ZEROS = Buffer.alloc(128) +var blocksize = 64 -/***/ }), +function Hmac (alg, key) { + Base.call(this, 'digest') + if (typeof key === 'string') { + key = Buffer.from(key) + } -/***/ "./node_modules/bn.js/lib/bn.js": -/*!**************************************!*\ - !*** ./node_modules/bn.js/lib/bn.js ***! - \**************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this._alg = alg + this._key = key -eval("/* module decorator */ module = __webpack_require__.nmd(module);\n(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = (__webpack_require__(/*! buffer */ \"?8131\").Buffer);\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [ number & 0x3ffffff ];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [ 0 ];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // 'A' - 'F'\n if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n // '0' - '9'\n } else {\n return (c - 48) & 0xf;\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this.strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n r += c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n r += c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n r += c;\n }\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [ 0 ];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this.strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype.strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n BN.prototype.inspect = function inspect () {\n return (this.red ? '';\n };\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16);\n };\n\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n assert(typeof Buffer !== 'undefined');\n return this.toArrayLike(Buffer, endian, length);\n };\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n this.strip();\n var littleEndian = endian === 'le';\n var res = new ArrayType(reqLength);\n\n var b, i;\n var q = this.clone();\n if (!littleEndian) {\n // Assume big-endian\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[i] = b;\n }\n\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n\n return res;\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this.strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this.strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this.strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this.strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this.strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this.strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n function jumboMulTo (self, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this.strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this.strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this.strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q.strip();\n }\n a.strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modn = function modn (num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return acc;\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n return this.strip();\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this.strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is BN v4 instance\n r.strip();\n } else {\n // r is BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})( false || module, this);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/bn.js/lib/bn.js?"); + if (key.length > blocksize) { + key = alg(key) + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } -/***/ }), + var ipad = this._ipad = Buffer.allocUnsafe(blocksize) + var opad = this._opad = Buffer.allocUnsafe(blocksize) -/***/ "./node_modules/browserify-aes/aes.js": -/*!********************************************!*\ - !*** ./node_modules/browserify-aes/aes.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } -eval("// based on the aes implimentation in triple sec\n// https://github.com/keybase/triplesec\n// which is in turn based on the one from crypto-js\n// https://code.google.com/p/crypto-js/\n\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nfunction asUInt32Array (buf) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n\n var len = (buf.length / 4) | 0\n var out = new Array(len)\n\n for (var i = 0; i < len; i++) {\n out[i] = buf.readUInt32BE(i * 4)\n }\n\n return out\n}\n\nfunction scrubVec (v) {\n for (var i = 0; i < v.length; v++) {\n v[i] = 0\n }\n}\n\nfunction cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {\n var SUB_MIX0 = SUB_MIX[0]\n var SUB_MIX1 = SUB_MIX[1]\n var SUB_MIX2 = SUB_MIX[2]\n var SUB_MIX3 = SUB_MIX[3]\n\n var s0 = M[0] ^ keySchedule[0]\n var s1 = M[1] ^ keySchedule[1]\n var s2 = M[2] ^ keySchedule[2]\n var s3 = M[3] ^ keySchedule[3]\n var t0, t1, t2, t3\n var ksRow = 4\n\n for (var round = 1; round < nRounds; round++) {\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]\n t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]\n t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]\n t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]\n s0 = t0\n s1 = t1\n s2 = t2\n s3 = t3\n }\n\n t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]\n t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]\n t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]\n t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]\n t0 = t0 >>> 0\n t1 = t1 >>> 0\n t2 = t2 >>> 0\n t3 = t3 >>> 0\n\n return [t0, t1, t2, t3]\n}\n\n// AES constants\nvar RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]\nvar G = (function () {\n // Compute double table\n var d = new Array(256)\n for (var j = 0; j < 256; j++) {\n if (j < 128) {\n d[j] = j << 1\n } else {\n d[j] = (j << 1) ^ 0x11b\n }\n }\n\n var SBOX = []\n var INV_SBOX = []\n var SUB_MIX = [[], [], [], []]\n var INV_SUB_MIX = [[], [], [], []]\n\n // Walk GF(2^8)\n var x = 0\n var xi = 0\n for (var i = 0; i < 256; ++i) {\n // Compute sbox\n var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)\n sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63\n SBOX[x] = sx\n INV_SBOX[sx] = x\n\n // Compute multiplication\n var x2 = d[x]\n var x4 = d[x2]\n var x8 = d[x4]\n\n // Compute sub bytes, mix columns tables\n var t = (d[sx] * 0x101) ^ (sx * 0x1010100)\n SUB_MIX[0][x] = (t << 24) | (t >>> 8)\n SUB_MIX[1][x] = (t << 16) | (t >>> 16)\n SUB_MIX[2][x] = (t << 8) | (t >>> 24)\n SUB_MIX[3][x] = t\n\n // Compute inv sub bytes, inv mix columns tables\n t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)\n INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)\n INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)\n INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)\n INV_SUB_MIX[3][sx] = t\n\n if (x === 0) {\n x = xi = 1\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]]\n xi ^= d[d[xi]]\n }\n }\n\n return {\n SBOX: SBOX,\n INV_SBOX: INV_SBOX,\n SUB_MIX: SUB_MIX,\n INV_SUB_MIX: INV_SUB_MIX\n }\n})()\n\nfunction AES (key) {\n this._key = asUInt32Array(key)\n this._reset()\n}\n\nAES.blockSize = 4 * 4\nAES.keySize = 256 / 8\nAES.prototype.blockSize = AES.blockSize\nAES.prototype.keySize = AES.keySize\nAES.prototype._reset = function () {\n var keyWords = this._key\n var keySize = keyWords.length\n var nRounds = keySize + 6\n var ksRows = (nRounds + 1) * 4\n\n var keySchedule = []\n for (var k = 0; k < keySize; k++) {\n keySchedule[k] = keyWords[k]\n }\n\n for (k = keySize; k < ksRows; k++) {\n var t = keySchedule[k - 1]\n\n if (k % keySize === 0) {\n t = (t << 8) | (t >>> 24)\n t =\n (G.SBOX[t >>> 24] << 24) |\n (G.SBOX[(t >>> 16) & 0xff] << 16) |\n (G.SBOX[(t >>> 8) & 0xff] << 8) |\n (G.SBOX[t & 0xff])\n\n t ^= RCON[(k / keySize) | 0] << 24\n } else if (keySize > 6 && k % keySize === 4) {\n t =\n (G.SBOX[t >>> 24] << 24) |\n (G.SBOX[(t >>> 16) & 0xff] << 16) |\n (G.SBOX[(t >>> 8) & 0xff] << 8) |\n (G.SBOX[t & 0xff])\n }\n\n keySchedule[k] = keySchedule[k - keySize] ^ t\n }\n\n var invKeySchedule = []\n for (var ik = 0; ik < ksRows; ik++) {\n var ksR = ksRows - ik\n var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]\n\n if (ik < 4 || ksR <= 4) {\n invKeySchedule[ik] = tt\n } else {\n invKeySchedule[ik] =\n G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^\n G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^\n G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^\n G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]\n }\n }\n\n this._nRounds = nRounds\n this._keySchedule = keySchedule\n this._invKeySchedule = invKeySchedule\n}\n\nAES.prototype.encryptBlockRaw = function (M) {\n M = asUInt32Array(M)\n return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)\n}\n\nAES.prototype.encryptBlock = function (M) {\n var out = this.encryptBlockRaw(M)\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0], 0)\n buf.writeUInt32BE(out[1], 4)\n buf.writeUInt32BE(out[2], 8)\n buf.writeUInt32BE(out[3], 12)\n return buf\n}\n\nAES.prototype.decryptBlock = function (M) {\n M = asUInt32Array(M)\n\n // swap\n var m1 = M[1]\n M[1] = M[3]\n M[3] = m1\n\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0], 0)\n buf.writeUInt32BE(out[3], 4)\n buf.writeUInt32BE(out[2], 8)\n buf.writeUInt32BE(out[1], 12)\n return buf\n}\n\nAES.prototype.scrub = function () {\n scrubVec(this._keySchedule)\n scrubVec(this._invKeySchedule)\n scrubVec(this._key)\n}\n\nmodule.exports.AES = AES\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/aes.js?"); + this._hash = [ipad] +} -/***/ }), +inherits(Hmac, Base) -/***/ "./node_modules/browserify-aes/authCipher.js": -/*!***************************************************!*\ - !*** ./node_modules/browserify-aes/authCipher.js ***! - \***************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +Hmac.prototype._update = function (data) { + this._hash.push(data) +} + +Hmac.prototype._final = function () { + var h = this._alg(Buffer.concat(this._hash)) + return this._alg(Buffer.concat([this._opad, h])) +} +module.exports = Hmac -eval("var aes = __webpack_require__(/*! ./aes */ \"./node_modules/browserify-aes/aes.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar Transform = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar GHASH = __webpack_require__(/*! ./ghash */ \"./node_modules/browserify-aes/ghash.js\")\nvar xor = __webpack_require__(/*! buffer-xor */ \"./node_modules/buffer-xor/index.js\")\nvar incr32 = __webpack_require__(/*! ./incr32 */ \"./node_modules/browserify-aes/incr32.js\")\n\nfunction xorTest (a, b) {\n var out = 0\n if (a.length !== b.length) out++\n\n var len = Math.min(a.length, b.length)\n for (var i = 0; i < len; ++i) {\n out += (a[i] ^ b[i])\n }\n\n return out\n}\n\nfunction calcIv (self, iv, ck) {\n if (iv.length === 12) {\n self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])\n return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])\n }\n var ghash = new GHASH(ck)\n var len = iv.length\n var toPad = len % 16\n ghash.update(iv)\n if (toPad) {\n toPad = 16 - toPad\n ghash.update(Buffer.alloc(toPad, 0))\n }\n ghash.update(Buffer.alloc(8, 0))\n var ivBits = len * 8\n var tail = Buffer.alloc(8)\n tail.writeUIntBE(ivBits, 0, 8)\n ghash.update(tail)\n self._finID = ghash.state\n var out = Buffer.from(self._finID)\n incr32(out)\n return out\n}\nfunction StreamCipher (mode, key, iv, decrypt) {\n Transform.call(this)\n\n var h = Buffer.alloc(4, 0)\n\n this._cipher = new aes.AES(key)\n var ck = this._cipher.encryptBlock(h)\n this._ghash = new GHASH(ck)\n iv = calcIv(this, iv, ck)\n\n this._prev = Buffer.from(iv)\n this._cache = Buffer.allocUnsafe(0)\n this._secCache = Buffer.allocUnsafe(0)\n this._decrypt = decrypt\n this._alen = 0\n this._len = 0\n this._mode = mode\n\n this._authTag = null\n this._called = false\n}\n\ninherits(StreamCipher, Transform)\n\nStreamCipher.prototype._update = function (chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - (this._alen % 16)\n if (rump < 16) {\n rump = Buffer.alloc(rump, 0)\n this._ghash.update(rump)\n }\n }\n\n this._called = true\n var out = this._mode.encrypt(this, chunk)\n if (this._decrypt) {\n this._ghash.update(chunk)\n } else {\n this._ghash.update(out)\n }\n this._len += chunk.length\n return out\n}\n\nStreamCipher.prototype._final = function () {\n if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')\n\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))\n if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')\n\n this._authTag = tag\n this._cipher.scrub()\n}\n\nStreamCipher.prototype.getAuthTag = function getAuthTag () {\n if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')\n\n return this._authTag\n}\n\nStreamCipher.prototype.setAuthTag = function setAuthTag (tag) {\n if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')\n\n this._authTag = tag\n}\n\nStreamCipher.prototype.setAAD = function setAAD (buf) {\n if (this._called) throw new Error('Attempting to set AAD in unsupported state')\n\n this._ghash.update(buf)\n this._alen += buf.length\n}\n\nmodule.exports = StreamCipher\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/authCipher.js?"); /***/ }), -/***/ "./node_modules/browserify-aes/browser.js": -/*!************************************************!*\ - !*** ./node_modules/browserify-aes/browser.js ***! - \************************************************/ +/***/ 5835: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("var ciphers = __webpack_require__(/*! ./encrypter */ \"./node_modules/browserify-aes/encrypter.js\")\nvar deciphers = __webpack_require__(/*! ./decrypter */ \"./node_modules/browserify-aes/decrypter.js\")\nvar modes = __webpack_require__(/*! ./modes/list.json */ \"./node_modules/browserify-aes/modes/list.json\")\n\nfunction getCiphers () {\n return Object.keys(modes)\n}\n\nexports.createCipher = exports.Cipher = ciphers.createCipher\nexports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv\nexports.createDecipher = exports.Decipher = deciphers.createDecipher\nexports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv\nexports.listCiphers = exports.getCiphers = getCiphers\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/browser.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/browserify-aes/decrypter.js": -/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/decrypter.js ***! - \**************************************************/ +exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(1798) +exports.createHash = exports.Hash = __webpack_require__(3482) +exports.createHmac = exports.Hmac = __webpack_require__(8355) + +var algos = __webpack_require__(6042) +var algoKeys = Object.keys(algos) +var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys) +exports.getHashes = function () { + return hashes +} + +var p = __webpack_require__(5632) +exports.pbkdf2 = p.pbkdf2 +exports.pbkdf2Sync = p.pbkdf2Sync + +var aes = __webpack_require__(3614) + +exports.Cipher = aes.Cipher +exports.createCipher = aes.createCipher +exports.Cipheriv = aes.Cipheriv +exports.createCipheriv = aes.createCipheriv +exports.Decipher = aes.Decipher +exports.createDecipher = aes.createDecipher +exports.Decipheriv = aes.Decipheriv +exports.createDecipheriv = aes.createDecipheriv +exports.getCiphers = aes.getCiphers +exports.listCiphers = aes.listCiphers + +var dh = __webpack_require__(2607) + +exports.DiffieHellmanGroup = dh.DiffieHellmanGroup +exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup +exports.getDiffieHellman = dh.getDiffieHellman +exports.createDiffieHellman = dh.createDiffieHellman +exports.DiffieHellman = dh.DiffieHellman + +var sign = __webpack_require__(4743) + +exports.createSign = sign.createSign +exports.Sign = sign.Sign +exports.createVerify = sign.createVerify +exports.Verify = sign.Verify + +exports.createECDH = __webpack_require__(6393) + +var publicEncrypt = __webpack_require__(7900) + +exports.publicEncrypt = publicEncrypt.publicEncrypt +exports.privateEncrypt = publicEncrypt.privateEncrypt +exports.publicDecrypt = publicEncrypt.publicDecrypt +exports.privateDecrypt = publicEncrypt.privateDecrypt + +// the least I can do is make error messages for the rest of the node.js/crypto api. +// ;[ +// 'createCredentials' +// ].forEach(function (name) { +// exports[name] = function () { +// throw new Error([ +// 'sorry, ' + name + ' is not implemented yet', +// 'we accept pull requests', +// 'https://github.com/crypto-browserify/crypto-browserify' +// ].join('\n')) +// } +// }) + +var rf = __webpack_require__(7963) + +exports.randomFill = rf.randomFill +exports.randomFillSync = rf.randomFillSync + +exports.createCredentials = function () { + throw new Error([ + 'sorry, createCredentials is not implemented yet', + 'we accept pull requests', + 'https://github.com/crypto-browserify/crypto-browserify' + ].join('\n')) +} + +exports.constants = { + 'DH_CHECK_P_NOT_SAFE_PRIME': 2, + 'DH_CHECK_P_NOT_PRIME': 1, + 'DH_UNABLE_TO_CHECK_GENERATOR': 4, + 'DH_NOT_SUITABLE_GENERATOR': 8, + 'NPN_ENABLED': 1, + 'ALPN_ENABLED': 1, + 'RSA_PKCS1_PADDING': 1, + 'RSA_SSLV23_PADDING': 2, + 'RSA_NO_PADDING': 3, + 'RSA_PKCS1_OAEP_PADDING': 4, + 'RSA_X931_PADDING': 5, + 'RSA_PKCS1_PSS_PADDING': 6, + 'POINT_CONVERSION_COMPRESSED': 2, + 'POINT_CONVERSION_UNCOMPRESSED': 4, + 'POINT_CONVERSION_HYBRID': 6 +} + + +/***/ }), + +/***/ 5251: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("var AuthCipher = __webpack_require__(/*! ./authCipher */ \"./node_modules/browserify-aes/authCipher.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar MODES = __webpack_require__(/*! ./modes */ \"./node_modules/browserify-aes/modes/index.js\")\nvar StreamCipher = __webpack_require__(/*! ./streamCipher */ \"./node_modules/browserify-aes/streamCipher.js\")\nvar Transform = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\nvar aes = __webpack_require__(/*! ./aes */ \"./node_modules/browserify-aes/aes.js\")\nvar ebtk = __webpack_require__(/*! evp_bytestokey */ \"./node_modules/evp_bytestokey/index.js\")\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\n\nfunction Decipher (mode, key, iv) {\n Transform.call(this)\n\n this._cache = new Splitter()\n this._last = void 0\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._mode = mode\n this._autopadding = true\n}\n\ninherits(Decipher, Transform)\n\nDecipher.prototype._update = function (data) {\n this._cache.add(data)\n var chunk\n var thing\n var out = []\n while ((chunk = this._cache.get(this._autopadding))) {\n thing = this._mode.decrypt(this, chunk)\n out.push(thing)\n }\n return Buffer.concat(out)\n}\n\nDecipher.prototype._final = function () {\n var chunk = this._cache.flush()\n if (this._autopadding) {\n return unpad(this._mode.decrypt(this, chunk))\n } else if (chunk) {\n throw new Error('data not multiple of block length')\n }\n}\n\nDecipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo\n return this\n}\n\nfunction Splitter () {\n this.cache = Buffer.allocUnsafe(0)\n}\n\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data])\n}\n\nSplitter.prototype.get = function (autoPadding) {\n var out\n if (autoPadding) {\n if (this.cache.length > 16) {\n out = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n return out\n }\n } else {\n if (this.cache.length >= 16) {\n out = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n return out\n }\n }\n\n return null\n}\n\nSplitter.prototype.flush = function () {\n if (this.cache.length) return this.cache\n}\n\nfunction unpad (last) {\n var padded = last[15]\n if (padded < 1 || padded > 16) {\n throw new Error('unable to decrypt data')\n }\n var i = -1\n while (++i < padded) {\n if (last[(i + (16 - padded))] !== padded) {\n throw new Error('unable to decrypt data')\n }\n }\n if (padded === 16) return\n\n return last.slice(0, 16 - padded)\n}\n\nfunction createDecipheriv (suite, password, iv) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n if (typeof iv === 'string') iv = Buffer.from(iv)\n if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)\n\n if (typeof password === 'string') password = Buffer.from(password)\n if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)\n\n if (config.type === 'stream') {\n return new StreamCipher(config.module, password, iv, true)\n } else if (config.type === 'auth') {\n return new AuthCipher(config.module, password, iv, true)\n }\n\n return new Decipher(config.module, password, iv)\n}\n\nfunction createDecipher (suite, password) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n var keys = ebtk(password, false, config.key, config.iv)\n return createDecipheriv(suite, keys.key, keys.iv)\n}\n\nexports.createDecipher = createDecipher\nexports.createDecipheriv = createDecipheriv\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/decrypter.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/browserify-aes/encrypter.js": -/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/encrypter.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +exports.utils = __webpack_require__(1278); +exports.Cipher = __webpack_require__(5756); +exports.DES = __webpack_require__(778); +exports.CBC = __webpack_require__(9051); +exports.EDE = __webpack_require__(651); -eval("var MODES = __webpack_require__(/*! ./modes */ \"./node_modules/browserify-aes/modes/index.js\")\nvar AuthCipher = __webpack_require__(/*! ./authCipher */ \"./node_modules/browserify-aes/authCipher.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar StreamCipher = __webpack_require__(/*! ./streamCipher */ \"./node_modules/browserify-aes/streamCipher.js\")\nvar Transform = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\nvar aes = __webpack_require__(/*! ./aes */ \"./node_modules/browserify-aes/aes.js\")\nvar ebtk = __webpack_require__(/*! evp_bytestokey */ \"./node_modules/evp_bytestokey/index.js\")\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\n\nfunction Cipher (mode, key, iv) {\n Transform.call(this)\n\n this._cache = new Splitter()\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._mode = mode\n this._autopadding = true\n}\n\ninherits(Cipher, Transform)\n\nCipher.prototype._update = function (data) {\n this._cache.add(data)\n var chunk\n var thing\n var out = []\n\n while ((chunk = this._cache.get())) {\n thing = this._mode.encrypt(this, chunk)\n out.push(thing)\n }\n\n return Buffer.concat(out)\n}\n\nvar PADDING = Buffer.alloc(16, 0x10)\n\nCipher.prototype._final = function () {\n var chunk = this._cache.flush()\n if (this._autopadding) {\n chunk = this._mode.encrypt(this, chunk)\n this._cipher.scrub()\n return chunk\n }\n\n if (!chunk.equals(PADDING)) {\n this._cipher.scrub()\n throw new Error('data not multiple of block length')\n }\n}\n\nCipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo\n return this\n}\n\nfunction Splitter () {\n this.cache = Buffer.allocUnsafe(0)\n}\n\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data])\n}\n\nSplitter.prototype.get = function () {\n if (this.cache.length > 15) {\n var out = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n return out\n }\n return null\n}\n\nSplitter.prototype.flush = function () {\n var len = 16 - this.cache.length\n var padBuff = Buffer.allocUnsafe(len)\n\n var i = -1\n while (++i < len) {\n padBuff.writeUInt8(len, i)\n }\n\n return Buffer.concat([this.cache, padBuff])\n}\n\nfunction createCipheriv (suite, password, iv) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n if (typeof password === 'string') password = Buffer.from(password)\n if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)\n\n if (typeof iv === 'string') iv = Buffer.from(iv)\n if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)\n\n if (config.type === 'stream') {\n return new StreamCipher(config.module, password, iv)\n } else if (config.type === 'auth') {\n return new AuthCipher(config.module, password, iv)\n }\n\n return new Cipher(config.module, password, iv)\n}\n\nfunction createCipher (suite, password) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n var keys = ebtk(password, false, config.key, config.iv)\n return createCipheriv(suite, keys.key, keys.iv)\n}\n\nexports.createCipheriv = createCipheriv\nexports.createCipher = createCipher\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/encrypter.js?"); /***/ }), -/***/ "./node_modules/browserify-aes/ghash.js": -/*!**********************************************!*\ - !*** ./node_modules/browserify-aes/ghash.js ***! - \**********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 9051: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar ZEROES = Buffer.alloc(16, 0)\n\nfunction toArray (buf) {\n return [\n buf.readUInt32BE(0),\n buf.readUInt32BE(4),\n buf.readUInt32BE(8),\n buf.readUInt32BE(12)\n ]\n}\n\nfunction fromArray (out) {\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0] >>> 0, 0)\n buf.writeUInt32BE(out[1] >>> 0, 4)\n buf.writeUInt32BE(out[2] >>> 0, 8)\n buf.writeUInt32BE(out[3] >>> 0, 12)\n return buf\n}\n\nfunction GHASH (key) {\n this.h = key\n this.state = Buffer.alloc(16, 0)\n this.cache = Buffer.allocUnsafe(0)\n}\n\n// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html\n// by Juho Vähä-Herttua\nGHASH.prototype.ghash = function (block) {\n var i = -1\n while (++i < block.length) {\n this.state[i] ^= block[i]\n }\n this._multiply()\n}\n\nGHASH.prototype._multiply = function () {\n var Vi = toArray(this.h)\n var Zi = [0, 0, 0, 0]\n var j, xi, lsbVi\n var i = -1\n while (++i < 128) {\n xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0\n if (xi) {\n // Z_i+1 = Z_i ^ V_i\n Zi[0] ^= Vi[0]\n Zi[1] ^= Vi[1]\n Zi[2] ^= Vi[2]\n Zi[3] ^= Vi[3]\n }\n\n // Store the value of LSB(V_i)\n lsbVi = (Vi[3] & 1) !== 0\n\n // V_i+1 = V_i >> 1\n for (j = 3; j > 0; j--) {\n Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)\n }\n Vi[0] = Vi[0] >>> 1\n\n // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R\n if (lsbVi) {\n Vi[0] = Vi[0] ^ (0xe1 << 24)\n }\n }\n this.state = fromArray(Zi)\n}\n\nGHASH.prototype.update = function (buf) {\n this.cache = Buffer.concat([this.cache, buf])\n var chunk\n while (this.cache.length >= 16) {\n chunk = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n this.ghash(chunk)\n }\n}\n\nGHASH.prototype.final = function (abl, bl) {\n if (this.cache.length) {\n this.ghash(Buffer.concat([this.cache, ZEROES], 16))\n }\n\n this.ghash(fromArray([0, abl, 0, bl]))\n return this.state\n}\n\nmodule.exports = GHASH\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/ghash.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/browserify-aes/incr32.js": -/*!***********************************************!*\ - !*** ./node_modules/browserify-aes/incr32.js ***! - \***********************************************/ -/***/ (function(module) { +var assert = __webpack_require__(9746); +var inherits = __webpack_require__(5717); -eval("function incr32 (iv) {\n var len = iv.length\n var item\n while (len--) {\n item = iv.readUInt8(len)\n if (item === 255) {\n iv.writeUInt8(0, len)\n } else {\n item++\n iv.writeUInt8(item, len)\n break\n }\n }\n}\nmodule.exports = incr32\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/incr32.js?"); +var proto = {}; -/***/ }), +function CBCState(iv) { + assert.equal(iv.length, 8, 'Invalid IV length'); -/***/ "./node_modules/browserify-aes/modes/cbc.js": -/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/modes/cbc.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + this.iv = new Array(8); + for (var i = 0; i < this.iv.length; i++) + this.iv[i] = iv[i]; +} -eval("var xor = __webpack_require__(/*! buffer-xor */ \"./node_modules/buffer-xor/index.js\")\n\nexports.encrypt = function (self, block) {\n var data = xor(block, self._prev)\n\n self._prev = self._cipher.encryptBlock(data)\n return self._prev\n}\n\nexports.decrypt = function (self, block) {\n var pad = self._prev\n\n self._prev = block\n var out = self._cipher.decryptBlock(block)\n\n return xor(out, pad)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/cbc.js?"); +function instantiate(Base) { + function CBC(options) { + Base.call(this, options); + this._cbcInit(); + } + inherits(CBC, Base); -/***/ }), + var keys = Object.keys(proto); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + CBC.prototype[key] = proto[key]; + } -/***/ "./node_modules/browserify-aes/modes/cfb.js": -/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/modes/cfb.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + CBC.create = function create(options) { + return new CBC(options); + }; -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar xor = __webpack_require__(/*! buffer-xor */ \"./node_modules/buffer-xor/index.js\")\n\nfunction encryptStart (self, data, decrypt) {\n var len = data.length\n var out = xor(data, self._cache)\n self._cache = self._cache.slice(len)\n self._prev = Buffer.concat([self._prev, decrypt ? data : out])\n return out\n}\n\nexports.encrypt = function (self, data, decrypt) {\n var out = Buffer.allocUnsafe(0)\n var len\n\n while (data.length) {\n if (self._cache.length === 0) {\n self._cache = self._cipher.encryptBlock(self._prev)\n self._prev = Buffer.allocUnsafe(0)\n }\n\n if (self._cache.length <= data.length) {\n len = self._cache.length\n out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])\n data = data.slice(len)\n } else {\n out = Buffer.concat([out, encryptStart(self, data, decrypt)])\n break\n }\n }\n\n return out\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/cfb.js?"); + return CBC; +} -/***/ }), +exports.instantiate = instantiate; -/***/ "./node_modules/browserify-aes/modes/cfb1.js": -/*!***************************************************!*\ - !*** ./node_modules/browserify-aes/modes/cfb1.js ***! - \***************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +proto._cbcInit = function _cbcInit() { + var state = new CBCState(this.options.iv); + this._cbcState = state; +}; -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nfunction encryptByte (self, byteParam, decrypt) {\n var pad\n var i = -1\n var len = 8\n var out = 0\n var bit, value\n while (++i < len) {\n pad = self._cipher.encryptBlock(self._prev)\n bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0\n value = pad[0] ^ bit\n out += ((value & 0x80) >> (i % 8))\n self._prev = shiftIn(self._prev, decrypt ? bit : value)\n }\n return out\n}\n\nfunction shiftIn (buffer, value) {\n var len = buffer.length\n var i = -1\n var out = Buffer.allocUnsafe(buffer.length)\n buffer = Buffer.concat([buffer, Buffer.from([value])])\n\n while (++i < len) {\n out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)\n }\n\n return out\n}\n\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length\n var out = Buffer.allocUnsafe(len)\n var i = -1\n\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt)\n }\n\n return out\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/cfb1.js?"); +proto._update = function _update(inp, inOff, out, outOff) { + var state = this._cbcState; + var superProto = this.constructor.super_.prototype; -/***/ }), + var iv = state.iv; + if (this.type === 'encrypt') { + for (var i = 0; i < this.blockSize; i++) + iv[i] ^= inp[inOff + i]; -/***/ "./node_modules/browserify-aes/modes/cfb8.js": -/*!***************************************************!*\ - !*** ./node_modules/browserify-aes/modes/cfb8.js ***! - \***************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + superProto._update.call(this, iv, 0, out, outOff); -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nfunction encryptByte (self, byteParam, decrypt) {\n var pad = self._cipher.encryptBlock(self._prev)\n var out = pad[0] ^ byteParam\n\n self._prev = Buffer.concat([\n self._prev.slice(1),\n Buffer.from([decrypt ? byteParam : out])\n ])\n\n return out\n}\n\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length\n var out = Buffer.allocUnsafe(len)\n var i = -1\n\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt)\n }\n\n return out\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/cfb8.js?"); + for (var i = 0; i < this.blockSize; i++) + iv[i] = out[outOff + i]; + } else { + superProto._update.call(this, inp, inOff, out, outOff); -/***/ }), + for (var i = 0; i < this.blockSize; i++) + out[outOff + i] ^= iv[i]; -/***/ "./node_modules/browserify-aes/modes/ctr.js": -/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/modes/ctr.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + for (var i = 0; i < this.blockSize; i++) + iv[i] = inp[inOff + i]; + } +}; -eval("var xor = __webpack_require__(/*! buffer-xor */ \"./node_modules/buffer-xor/index.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar incr32 = __webpack_require__(/*! ../incr32 */ \"./node_modules/browserify-aes/incr32.js\")\n\nfunction getBlock (self) {\n var out = self._cipher.encryptBlockRaw(self._prev)\n incr32(self._prev)\n return out\n}\n\nvar blockSize = 16\nexports.encrypt = function (self, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize)\n var start = self._cache.length\n self._cache = Buffer.concat([\n self._cache,\n Buffer.allocUnsafe(chunkNum * blockSize)\n ])\n for (var i = 0; i < chunkNum; i++) {\n var out = getBlock(self)\n var offset = start + i * blockSize\n self._cache.writeUInt32BE(out[0], offset + 0)\n self._cache.writeUInt32BE(out[1], offset + 4)\n self._cache.writeUInt32BE(out[2], offset + 8)\n self._cache.writeUInt32BE(out[3], offset + 12)\n }\n var pad = self._cache.slice(0, chunk.length)\n self._cache = self._cache.slice(chunk.length)\n return xor(chunk, pad)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/ctr.js?"); /***/ }), -/***/ "./node_modules/browserify-aes/modes/ecb.js": -/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/modes/ecb.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, exports) { +/***/ 5756: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("exports.encrypt = function (self, block) {\n return self._cipher.encryptBlock(block)\n}\n\nexports.decrypt = function (self, block) {\n return self._cipher.decryptBlock(block)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/ecb.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/browserify-aes/modes/index.js": -/*!****************************************************!*\ - !*** ./node_modules/browserify-aes/modes/index.js ***! - \****************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +var assert = __webpack_require__(9746); + +function Cipher(options) { + this.options = options; -eval("var modeModules = {\n ECB: __webpack_require__(/*! ./ecb */ \"./node_modules/browserify-aes/modes/ecb.js\"),\n CBC: __webpack_require__(/*! ./cbc */ \"./node_modules/browserify-aes/modes/cbc.js\"),\n CFB: __webpack_require__(/*! ./cfb */ \"./node_modules/browserify-aes/modes/cfb.js\"),\n CFB8: __webpack_require__(/*! ./cfb8 */ \"./node_modules/browserify-aes/modes/cfb8.js\"),\n CFB1: __webpack_require__(/*! ./cfb1 */ \"./node_modules/browserify-aes/modes/cfb1.js\"),\n OFB: __webpack_require__(/*! ./ofb */ \"./node_modules/browserify-aes/modes/ofb.js\"),\n CTR: __webpack_require__(/*! ./ctr */ \"./node_modules/browserify-aes/modes/ctr.js\"),\n GCM: __webpack_require__(/*! ./ctr */ \"./node_modules/browserify-aes/modes/ctr.js\")\n}\n\nvar modes = __webpack_require__(/*! ./list.json */ \"./node_modules/browserify-aes/modes/list.json\")\n\nfor (var key in modes) {\n modes[key].module = modeModules[modes[key].mode]\n}\n\nmodule.exports = modes\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/index.js?"); + this.type = this.options.type; + this.blockSize = 8; + this._init(); + + this.buffer = new Array(this.blockSize); + this.bufferOff = 0; + this.padding = options.padding !== false +} +module.exports = Cipher; + +Cipher.prototype._init = function _init() { + // Might be overrided +}; + +Cipher.prototype.update = function update(data) { + if (data.length === 0) + return []; + + if (this.type === 'decrypt') + return this._updateDecrypt(data); + else + return this._updateEncrypt(data); +}; -/***/ }), +Cipher.prototype._buffer = function _buffer(data, off) { + // Append data to buffer + var min = Math.min(this.buffer.length - this.bufferOff, data.length - off); + for (var i = 0; i < min; i++) + this.buffer[this.bufferOff + i] = data[off + i]; + this.bufferOff += min; + + // Shift next + return min; +}; + +Cipher.prototype._flushBuffer = function _flushBuffer(out, off) { + this._update(this.buffer, 0, out, off); + this.bufferOff = 0; + return this.blockSize; +}; -/***/ "./node_modules/browserify-aes/modes/ofb.js": -/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/modes/ofb.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +Cipher.prototype._updateEncrypt = function _updateEncrypt(data) { + var inputOff = 0; + var outputOff = 0; -eval("var xor = __webpack_require__(/*! buffer-xor */ \"./node_modules/buffer-xor/index.js\")\n\nfunction getBlock (self) {\n self._prev = self._cipher.encryptBlock(self._prev)\n return self._prev\n}\n\nexports.encrypt = function (self, chunk) {\n while (self._cache.length < chunk.length) {\n self._cache = Buffer.concat([self._cache, getBlock(self)])\n }\n\n var pad = self._cache.slice(0, chunk.length)\n self._cache = self._cache.slice(chunk.length)\n return xor(chunk, pad)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/ofb.js?"); + var count = ((this.bufferOff + data.length) / this.blockSize) | 0; + var out = new Array(count * this.blockSize); -/***/ }), + if (this.bufferOff !== 0) { + inputOff += this._buffer(data, inputOff); -/***/ "./node_modules/browserify-aes/streamCipher.js": -/*!*****************************************************!*\ - !*** ./node_modules/browserify-aes/streamCipher.js ***! - \*****************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (this.bufferOff === this.buffer.length) + outputOff += this._flushBuffer(out, outputOff); + } -eval("var aes = __webpack_require__(/*! ./aes */ \"./node_modules/browserify-aes/aes.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar Transform = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\n\nfunction StreamCipher (mode, key, iv, decrypt) {\n Transform.call(this)\n\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._cache = Buffer.allocUnsafe(0)\n this._secCache = Buffer.allocUnsafe(0)\n this._decrypt = decrypt\n this._mode = mode\n}\n\ninherits(StreamCipher, Transform)\n\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt)\n}\n\nStreamCipher.prototype._final = function () {\n this._cipher.scrub()\n}\n\nmodule.exports = StreamCipher\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/streamCipher.js?"); + // Write blocks + var max = data.length - ((data.length - inputOff) % this.blockSize); + for (; inputOff < max; inputOff += this.blockSize) { + this._update(data, inputOff, out, outputOff); + outputOff += this.blockSize; + } -/***/ }), + // Queue rest + for (; inputOff < data.length; inputOff++, this.bufferOff++) + this.buffer[this.bufferOff] = data[inputOff]; -/***/ "./node_modules/browserify-cipher/browser.js": -/*!***************************************************!*\ - !*** ./node_modules/browserify-cipher/browser.js ***! - \***************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + return out; +}; -eval("var DES = __webpack_require__(/*! browserify-des */ \"./node_modules/browserify-des/index.js\")\nvar aes = __webpack_require__(/*! browserify-aes/browser */ \"./node_modules/browserify-aes/browser.js\")\nvar aesModes = __webpack_require__(/*! browserify-aes/modes */ \"./node_modules/browserify-aes/modes/index.js\")\nvar desModes = __webpack_require__(/*! browserify-des/modes */ \"./node_modules/browserify-des/modes.js\")\nvar ebtk = __webpack_require__(/*! evp_bytestokey */ \"./node_modules/evp_bytestokey/index.js\")\n\nfunction createCipher (suite, password) {\n suite = suite.toLowerCase()\n\n var keyLen, ivLen\n if (aesModes[suite]) {\n keyLen = aesModes[suite].key\n ivLen = aesModes[suite].iv\n } else if (desModes[suite]) {\n keyLen = desModes[suite].key * 8\n ivLen = desModes[suite].iv\n } else {\n throw new TypeError('invalid suite type')\n }\n\n var keys = ebtk(password, false, keyLen, ivLen)\n return createCipheriv(suite, keys.key, keys.iv)\n}\n\nfunction createDecipher (suite, password) {\n suite = suite.toLowerCase()\n\n var keyLen, ivLen\n if (aesModes[suite]) {\n keyLen = aesModes[suite].key\n ivLen = aesModes[suite].iv\n } else if (desModes[suite]) {\n keyLen = desModes[suite].key * 8\n ivLen = desModes[suite].iv\n } else {\n throw new TypeError('invalid suite type')\n }\n\n var keys = ebtk(password, false, keyLen, ivLen)\n return createDecipheriv(suite, keys.key, keys.iv)\n}\n\nfunction createCipheriv (suite, key, iv) {\n suite = suite.toLowerCase()\n if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)\n if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })\n\n throw new TypeError('invalid suite type')\n}\n\nfunction createDecipheriv (suite, key, iv) {\n suite = suite.toLowerCase()\n if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)\n if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })\n\n throw new TypeError('invalid suite type')\n}\n\nfunction getCiphers () {\n return Object.keys(desModes).concat(aes.getCiphers())\n}\n\nexports.createCipher = exports.Cipher = createCipher\nexports.createCipheriv = exports.Cipheriv = createCipheriv\nexports.createDecipher = exports.Decipher = createDecipher\nexports.createDecipheriv = exports.Decipheriv = createDecipheriv\nexports.listCiphers = exports.getCiphers = getCiphers\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-cipher/browser.js?"); +Cipher.prototype._updateDecrypt = function _updateDecrypt(data) { + var inputOff = 0; + var outputOff = 0; -/***/ }), + var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1; + var out = new Array(count * this.blockSize); -/***/ "./node_modules/browserify-des/index.js": -/*!**********************************************!*\ - !*** ./node_modules/browserify-des/index.js ***! - \**********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // TODO(indutny): optimize it, this is far from optimal + for (; count > 0; count--) { + inputOff += this._buffer(data, inputOff); + outputOff += this._flushBuffer(out, outputOff); + } -eval("var CipherBase = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\nvar des = __webpack_require__(/*! des.js */ \"./node_modules/des.js/lib/des.js\")\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar modes = {\n 'des-ede3-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede3': des.EDE,\n 'des-ede-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede': des.EDE,\n 'des-cbc': des.CBC.instantiate(des.DES),\n 'des-ecb': des.DES\n}\nmodes.des = modes['des-cbc']\nmodes.des3 = modes['des-ede3-cbc']\nmodule.exports = DES\ninherits(DES, CipherBase)\nfunction DES (opts) {\n CipherBase.call(this)\n var modeName = opts.mode.toLowerCase()\n var mode = modes[modeName]\n var type\n if (opts.decrypt) {\n type = 'decrypt'\n } else {\n type = 'encrypt'\n }\n var key = opts.key\n if (!Buffer.isBuffer(key)) {\n key = Buffer.from(key)\n }\n if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {\n key = Buffer.concat([key, key.slice(0, 8)])\n }\n var iv = opts.iv\n if (!Buffer.isBuffer(iv)) {\n iv = Buffer.from(iv)\n }\n this._des = mode.create({\n key: key,\n iv: iv,\n type: type\n })\n}\nDES.prototype._update = function (data) {\n return Buffer.from(this._des.update(data))\n}\nDES.prototype._final = function () {\n return Buffer.from(this._des.final())\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-des/index.js?"); + // Buffer rest of the input + inputOff += this._buffer(data, inputOff); -/***/ }), + return out; +}; -/***/ "./node_modules/browserify-des/modes.js": -/*!**********************************************!*\ - !*** ./node_modules/browserify-des/modes.js ***! - \**********************************************/ -/***/ (function(__unused_webpack_module, exports) { +Cipher.prototype.final = function final(buffer) { + var first; + if (buffer) + first = this.update(buffer); -eval("exports[\"des-ecb\"] = {\n key: 8,\n iv: 0\n}\nexports[\"des-cbc\"] = exports.des = {\n key: 8,\n iv: 8\n}\nexports[\"des-ede3-cbc\"] = exports.des3 = {\n key: 24,\n iv: 8\n}\nexports[\"des-ede3\"] = {\n key: 24,\n iv: 0\n}\nexports[\"des-ede-cbc\"] = {\n key: 16,\n iv: 8\n}\nexports[\"des-ede\"] = {\n key: 16,\n iv: 0\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-des/modes.js?"); + var last; + if (this.type === 'encrypt') + last = this._finalEncrypt(); + else + last = this._finalDecrypt(); -/***/ }), + if (first) + return first.concat(last); + else + return last; +}; + +Cipher.prototype._pad = function _pad(buffer, off) { + if (off === 0) + return false; -/***/ "./node_modules/browserify-rsa/index.js": -/*!**********************************************!*\ - !*** ./node_modules/browserify-rsa/index.js ***! - \**********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + while (off < buffer.length) + buffer[off++] = 0; -eval("var BN = __webpack_require__(/*! bn.js */ \"./node_modules/browserify-rsa/node_modules/bn.js/lib/bn.js\")\nvar randomBytes = __webpack_require__(/*! randombytes */ \"./node_modules/randombytes/browser.js\")\n\nfunction blind (priv) {\n var r = getr(priv)\n var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed()\n return { blinder: blinder, unblinder: r.invm(priv.modulus) }\n}\n\nfunction getr (priv) {\n var len = priv.modulus.byteLength()\n var r\n do {\n r = new BN(randomBytes(len))\n } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2))\n return r\n}\n\nfunction crt (msg, priv) {\n var blinds = blind(priv)\n var len = priv.modulus.byteLength()\n var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus)\n var c1 = blinded.toRed(BN.mont(priv.prime1))\n var c2 = blinded.toRed(BN.mont(priv.prime2))\n var qinv = priv.coefficient\n var p = priv.prime1\n var q = priv.prime2\n var m1 = c1.redPow(priv.exponent1).fromRed()\n var m2 = c2.redPow(priv.exponent2).fromRed()\n var h = m1.isub(m2).imul(qinv).umod(p).imul(q)\n return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len)\n}\ncrt.getr = getr\n\nmodule.exports = crt\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-rsa/index.js?"); + return true; +}; -/***/ }), +Cipher.prototype._finalEncrypt = function _finalEncrypt() { + if (!this._pad(this.buffer, this.bufferOff)) + return []; -/***/ "./node_modules/browserify-rsa/node_modules/bn.js/lib/bn.js": -/*!******************************************************************!*\ - !*** ./node_modules/browserify-rsa/node_modules/bn.js/lib/bn.js ***! - \******************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var out = new Array(this.blockSize); + this._update(this.buffer, 0, out, 0); + return out; +}; -eval("/* module decorator */ module = __webpack_require__.nmd(module);\n(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = (__webpack_require__(/*! buffer */ \"?f9d4\").Buffer);\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})( false || module, this);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-rsa/node_modules/bn.js/lib/bn.js?"); +Cipher.prototype._unpad = function _unpad(buffer) { + return buffer; +}; -/***/ }), +Cipher.prototype._finalDecrypt = function _finalDecrypt() { + assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt'); + var out = new Array(this.blockSize); + this._flushBuffer(out, 0); -/***/ "./node_modules/browserify-sign/algos.js": -/*!***********************************************!*\ - !*** ./node_modules/browserify-sign/algos.js ***! - \***********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return this._unpad(out); +}; -eval("module.exports = __webpack_require__(/*! ./browser/algorithms.json */ \"./node_modules/browserify-sign/browser/algorithms.json\")\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-sign/algos.js?"); /***/ }), -/***/ "./node_modules/browserify-sign/browser/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/browserify-sign/browser/index.js ***! - \*******************************************************/ +/***/ 778: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar createHash = __webpack_require__(/*! create-hash */ \"./node_modules/create-hash/browser.js\")\nvar stream = __webpack_require__(/*! readable-stream */ \"./node_modules/readable-stream/readable-browser.js\")\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar sign = __webpack_require__(/*! ./sign */ \"./node_modules/browserify-sign/browser/sign.js\")\nvar verify = __webpack_require__(/*! ./verify */ \"./node_modules/browserify-sign/browser/verify.js\")\n\nvar algorithms = __webpack_require__(/*! ./algorithms.json */ \"./node_modules/browserify-sign/browser/algorithms.json\")\nObject.keys(algorithms).forEach(function (key) {\n algorithms[key].id = Buffer.from(algorithms[key].id, 'hex')\n algorithms[key.toLowerCase()] = algorithms[key]\n})\n\nfunction Sign (algorithm) {\n stream.Writable.call(this)\n\n var data = algorithms[algorithm]\n if (!data) throw new Error('Unknown message digest')\n\n this._hashType = data.hash\n this._hash = createHash(data.hash)\n this._tag = data.id\n this._signType = data.sign\n}\ninherits(Sign, stream.Writable)\n\nSign.prototype._write = function _write (data, _, done) {\n this._hash.update(data)\n done()\n}\n\nSign.prototype.update = function update (data, enc) {\n if (typeof data === 'string') data = Buffer.from(data, enc)\n\n this._hash.update(data)\n return this\n}\n\nSign.prototype.sign = function signMethod (key, enc) {\n this.end()\n var hash = this._hash.digest()\n var sig = sign(hash, key, this._hashType, this._signType, this._tag)\n\n return enc ? sig.toString(enc) : sig\n}\n\nfunction Verify (algorithm) {\n stream.Writable.call(this)\n\n var data = algorithms[algorithm]\n if (!data) throw new Error('Unknown message digest')\n\n this._hash = createHash(data.hash)\n this._tag = data.id\n this._signType = data.sign\n}\ninherits(Verify, stream.Writable)\n\nVerify.prototype._write = function _write (data, _, done) {\n this._hash.update(data)\n done()\n}\n\nVerify.prototype.update = function update (data, enc) {\n if (typeof data === 'string') data = Buffer.from(data, enc)\n\n this._hash.update(data)\n return this\n}\n\nVerify.prototype.verify = function verifyMethod (key, sig, enc) {\n if (typeof sig === 'string') sig = Buffer.from(sig, enc)\n\n this.end()\n var hash = this._hash.digest()\n return verify(sig, hash, key, this._signType, this._tag)\n}\n\nfunction createSign (algorithm) {\n return new Sign(algorithm)\n}\n\nfunction createVerify (algorithm) {\n return new Verify(algorithm)\n}\n\nmodule.exports = {\n Sign: createSign,\n Verify: createVerify,\n createSign: createSign,\n createVerify: createVerify\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-sign/browser/index.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/browserify-sign/browser/sign.js": -/*!******************************************************!*\ - !*** ./node_modules/browserify-sign/browser/sign.js ***! - \******************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +var assert = __webpack_require__(9746); +var inherits = __webpack_require__(5717); -eval("// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar createHmac = __webpack_require__(/*! create-hmac */ \"./node_modules/create-hmac/browser.js\")\nvar crt = __webpack_require__(/*! browserify-rsa */ \"./node_modules/browserify-rsa/index.js\")\nvar EC = (__webpack_require__(/*! elliptic */ \"./node_modules/elliptic/lib/elliptic.js\").ec)\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\")\nvar parseKeys = __webpack_require__(/*! parse-asn1 */ \"./node_modules/parse-asn1/index.js\")\nvar curves = __webpack_require__(/*! ./curves.json */ \"./node_modules/browserify-sign/browser/curves.json\")\n\nfunction sign (hash, key, hashType, signType, tag) {\n var priv = parseKeys(key)\n if (priv.curve) {\n // rsa keys can be interpreted as ecdsa ones in openssl\n if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')\n return ecSign(hash, priv)\n } else if (priv.type === 'dsa') {\n if (signType !== 'dsa') throw new Error('wrong private key type')\n return dsaSign(hash, priv, hashType)\n } else {\n if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')\n }\n hash = Buffer.concat([tag, hash])\n var len = priv.modulus.byteLength()\n var pad = [0, 1]\n while (hash.length + pad.length + 1 < len) pad.push(0xff)\n pad.push(0x00)\n var i = -1\n while (++i < hash.length) pad.push(hash[i])\n\n var out = crt(pad, priv)\n return out\n}\n\nfunction ecSign (hash, priv) {\n var curveId = curves[priv.curve.join('.')]\n if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))\n\n var curve = new EC(curveId)\n var key = curve.keyFromPrivate(priv.privateKey)\n var out = key.sign(hash)\n\n return Buffer.from(out.toDER())\n}\n\nfunction dsaSign (hash, priv, algo) {\n var x = priv.params.priv_key\n var p = priv.params.p\n var q = priv.params.q\n var g = priv.params.g\n var r = new BN(0)\n var k\n var H = bits2int(hash, q).mod(q)\n var s = false\n var kv = getKey(x, q, hash, algo)\n while (s === false) {\n k = makeKey(q, kv, algo)\n r = makeR(g, k, p, q)\n s = k.invm(q).imul(H.add(x.mul(r))).mod(q)\n if (s.cmpn(0) === 0) {\n s = false\n r = new BN(0)\n }\n }\n return toDER(r, s)\n}\n\nfunction toDER (r, s) {\n r = r.toArray()\n s = s.toArray()\n\n // Pad values\n if (r[0] & 0x80) r = [0].concat(r)\n if (s[0] & 0x80) s = [0].concat(s)\n\n var total = r.length + s.length + 4\n var res = [0x30, total, 0x02, r.length]\n res = res.concat(r, [0x02, s.length], s)\n return Buffer.from(res)\n}\n\nfunction getKey (x, q, hash, algo) {\n x = Buffer.from(x.toArray())\n if (x.length < q.byteLength()) {\n var zeros = Buffer.alloc(q.byteLength() - x.length)\n x = Buffer.concat([zeros, x])\n }\n var hlen = hash.length\n var hbits = bits2octets(hash, q)\n var v = Buffer.alloc(hlen)\n v.fill(1)\n var k = Buffer.alloc(hlen)\n k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest()\n v = createHmac(algo, k).update(v).digest()\n k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest()\n v = createHmac(algo, k).update(v).digest()\n return { k: k, v: v }\n}\n\nfunction bits2int (obits, q) {\n var bits = new BN(obits)\n var shift = (obits.length << 3) - q.bitLength()\n if (shift > 0) bits.ishrn(shift)\n return bits\n}\n\nfunction bits2octets (bits, q) {\n bits = bits2int(bits, q)\n bits = bits.mod(q)\n var out = Buffer.from(bits.toArray())\n if (out.length < q.byteLength()) {\n var zeros = Buffer.alloc(q.byteLength() - out.length)\n out = Buffer.concat([zeros, out])\n }\n return out\n}\n\nfunction makeKey (q, kv, algo) {\n var t\n var k\n\n do {\n t = Buffer.alloc(0)\n\n while (t.length * 8 < q.bitLength()) {\n kv.v = createHmac(algo, kv.k).update(kv.v).digest()\n t = Buffer.concat([t, kv.v])\n }\n\n k = bits2int(t, q)\n kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest()\n kv.v = createHmac(algo, kv.k).update(kv.v).digest()\n } while (k.cmp(q) !== -1)\n\n return k\n}\n\nfunction makeR (g, k, p, q) {\n return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)\n}\n\nmodule.exports = sign\nmodule.exports.getKey = getKey\nmodule.exports.makeKey = makeKey\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-sign/browser/sign.js?"); +var utils = __webpack_require__(1278); +var Cipher = __webpack_require__(5756); -/***/ }), +function DESState() { + this.tmp = new Array(2); + this.keys = null; +} -/***/ "./node_modules/browserify-sign/browser/verify.js": -/*!********************************************************!*\ - !*** ./node_modules/browserify-sign/browser/verify.js ***! - \********************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function DES(options) { + Cipher.call(this, options); -eval("// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/browserify-sign/node_modules/bn.js/lib/bn.js\")\nvar EC = (__webpack_require__(/*! elliptic */ \"./node_modules/elliptic/lib/elliptic.js\").ec)\nvar parseKeys = __webpack_require__(/*! parse-asn1 */ \"./node_modules/parse-asn1/index.js\")\nvar curves = __webpack_require__(/*! ./curves.json */ \"./node_modules/browserify-sign/browser/curves.json\")\n\nfunction verify (sig, hash, key, signType, tag) {\n var pub = parseKeys(key)\n if (pub.type === 'ec') {\n // rsa keys can be interpreted as ecdsa ones in openssl\n if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')\n return ecVerify(sig, hash, pub)\n } else if (pub.type === 'dsa') {\n if (signType !== 'dsa') throw new Error('wrong public key type')\n return dsaVerify(sig, hash, pub)\n } else {\n if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')\n }\n hash = Buffer.concat([tag, hash])\n var len = pub.modulus.byteLength()\n var pad = [1]\n var padNum = 0\n while (hash.length + pad.length + 2 < len) {\n pad.push(0xff)\n padNum++\n }\n pad.push(0x00)\n var i = -1\n while (++i < hash.length) {\n pad.push(hash[i])\n }\n pad = Buffer.from(pad)\n var red = BN.mont(pub.modulus)\n sig = new BN(sig).toRed(red)\n\n sig = sig.redPow(new BN(pub.publicExponent))\n sig = Buffer.from(sig.fromRed().toArray())\n var out = padNum < 8 ? 1 : 0\n len = Math.min(sig.length, pad.length)\n if (sig.length !== pad.length) out = 1\n\n i = -1\n while (++i < len) out |= sig[i] ^ pad[i]\n return out === 0\n}\n\nfunction ecVerify (sig, hash, pub) {\n var curveId = curves[pub.data.algorithm.curve.join('.')]\n if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))\n\n var curve = new EC(curveId)\n var pubkey = pub.data.subjectPrivateKey.data\n\n return curve.verify(hash, sig, pubkey)\n}\n\nfunction dsaVerify (sig, hash, pub) {\n var p = pub.data.p\n var q = pub.data.q\n var g = pub.data.g\n var y = pub.data.pub_key\n var unpacked = parseKeys.signature.decode(sig, 'der')\n var s = unpacked.s\n var r = unpacked.r\n checkValue(s, q)\n checkValue(r, q)\n var montp = BN.mont(p)\n var w = s.invm(q)\n var v = g.toRed(montp)\n .redPow(new BN(hash).mul(w).mod(q))\n .fromRed()\n .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())\n .mod(p)\n .mod(q)\n return v.cmp(r) === 0\n}\n\nfunction checkValue (b, q) {\n if (b.cmpn(0) <= 0) throw new Error('invalid sig')\n if (b.cmp(q) >= q) throw new Error('invalid sig')\n}\n\nmodule.exports = verify\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-sign/browser/verify.js?"); + var state = new DESState(); + this._desState = state; -/***/ }), + this.deriveKeys(state, options.key); +} +inherits(DES, Cipher); +module.exports = DES; -/***/ "./node_modules/browserify-sign/node_modules/bn.js/lib/bn.js": -/*!*******************************************************************!*\ - !*** ./node_modules/browserify-sign/node_modules/bn.js/lib/bn.js ***! - \*******************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +DES.create = function create(options) { + return new DES(options); +}; -eval("/* module decorator */ module = __webpack_require__.nmd(module);\n(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = (__webpack_require__(/*! buffer */ \"?7a28\").Buffer);\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})( false || module, this);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-sign/node_modules/bn.js/lib/bn.js?"); +var shiftTable = [ + 1, 1, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 1 +]; -/***/ }), +DES.prototype.deriveKeys = function deriveKeys(state, key) { + state.keys = new Array(16 * 2); -/***/ "./node_modules/buffer-xor/index.js": -/*!******************************************!*\ - !*** ./node_modules/buffer-xor/index.js ***! - \******************************************/ -/***/ (function(module) { + assert.equal(key.length, this.blockSize, 'Invalid key length'); -eval("module.exports = function xor (a, b) {\n var length = Math.min(a.length, b.length)\n var buffer = new Buffer(length)\n\n for (var i = 0; i < length; ++i) {\n buffer[i] = a[i] ^ b[i]\n }\n\n return buffer\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/buffer-xor/index.js?"); + var kL = utils.readUInt32BE(key, 0); + var kR = utils.readUInt32BE(key, 4); -/***/ }), + utils.pc1(kL, kR, state.tmp, 0); + kL = state.tmp[0]; + kR = state.tmp[1]; + for (var i = 0; i < state.keys.length; i += 2) { + var shift = shiftTable[i >>> 1]; + kL = utils.r28shl(kL, shift); + kR = utils.r28shl(kR, shift); + utils.pc2(kL, kR, state.keys, i); + } +}; -/***/ "./node_modules/buffer/index.js": -/*!**************************************!*\ - !*** ./node_modules/buffer/index.js ***! - \**************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +DES.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._desState; -"use strict"; -eval("/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nconst base64 = __webpack_require__(/*! base64-js */ \"./node_modules/base64-js/index.js\")\nconst ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/buffer/index.js?"); + var l = utils.readUInt32BE(inp, inOff); + var r = utils.readUInt32BE(inp, inOff + 4); -/***/ }), + // Initial Permutation + utils.ip(l, r, state.tmp, 0); + l = state.tmp[0]; + r = state.tmp[1]; -/***/ "./node_modules/cipher-base/index.js": -/*!*******************************************!*\ - !*** ./node_modules/cipher-base/index.js ***! - \*******************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (this.type === 'encrypt') + this._encrypt(state, l, r, state.tmp, 0); + else + this._decrypt(state, l, r, state.tmp, 0); -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar Transform = (__webpack_require__(/*! stream */ \"./node_modules/stream-browserify/index.js\").Transform)\nvar StringDecoder = (__webpack_require__(/*! string_decoder */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder)\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\n\nfunction CipherBase (hashMode) {\n Transform.call(this)\n this.hashMode = typeof hashMode === 'string'\n if (this.hashMode) {\n this[hashMode] = this._finalOrDigest\n } else {\n this.final = this._finalOrDigest\n }\n if (this._final) {\n this.__final = this._final\n this._final = null\n }\n this._decoder = null\n this._encoding = null\n}\ninherits(CipherBase, Transform)\n\nCipherBase.prototype.update = function (data, inputEnc, outputEnc) {\n if (typeof data === 'string') {\n data = Buffer.from(data, inputEnc)\n }\n\n var outData = this._update(data)\n if (this.hashMode) return this\n\n if (outputEnc) {\n outData = this._toString(outData, outputEnc)\n }\n\n return outData\n}\n\nCipherBase.prototype.setAutoPadding = function () {}\nCipherBase.prototype.getAuthTag = function () {\n throw new Error('trying to get auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAuthTag = function () {\n throw new Error('trying to set auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAAD = function () {\n throw new Error('trying to set aad in unsupported state')\n}\n\nCipherBase.prototype._transform = function (data, _, next) {\n var err\n try {\n if (this.hashMode) {\n this._update(data)\n } else {\n this.push(this._update(data))\n }\n } catch (e) {\n err = e\n } finally {\n next(err)\n }\n}\nCipherBase.prototype._flush = function (done) {\n var err\n try {\n this.push(this.__final())\n } catch (e) {\n err = e\n }\n\n done(err)\n}\nCipherBase.prototype._finalOrDigest = function (outputEnc) {\n var outData = this.__final() || Buffer.alloc(0)\n if (outputEnc) {\n outData = this._toString(outData, outputEnc, true)\n }\n return outData\n}\n\nCipherBase.prototype._toString = function (value, enc, fin) {\n if (!this._decoder) {\n this._decoder = new StringDecoder(enc)\n this._encoding = enc\n }\n\n if (this._encoding !== enc) throw new Error('can\\'t switch encodings')\n\n var out = this._decoder.write(value)\n if (fin) {\n out += this._decoder.end()\n }\n\n return out\n}\n\nmodule.exports = CipherBase\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/cipher-base/index.js?"); + l = state.tmp[0]; + r = state.tmp[1]; -/***/ }), + utils.writeUInt32BE(out, l, outOff); + utils.writeUInt32BE(out, r, outOff + 4); +}; -/***/ "./node_modules/create-ecdh/browser.js": -/*!*********************************************!*\ - !*** ./node_modules/create-ecdh/browser.js ***! - \*********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +DES.prototype._pad = function _pad(buffer, off) { + if (this.padding === false) { + return false; + } -eval("var elliptic = __webpack_require__(/*! elliptic */ \"./node_modules/elliptic/lib/elliptic.js\")\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\")\n\nmodule.exports = function createECDH (curve) {\n return new ECDH(curve)\n}\n\nvar aliases = {\n secp256k1: {\n name: 'secp256k1',\n byteLength: 32\n },\n secp224r1: {\n name: 'p224',\n byteLength: 28\n },\n prime256v1: {\n name: 'p256',\n byteLength: 32\n },\n prime192v1: {\n name: 'p192',\n byteLength: 24\n },\n ed25519: {\n name: 'ed25519',\n byteLength: 32\n },\n secp384r1: {\n name: 'p384',\n byteLength: 48\n },\n secp521r1: {\n name: 'p521',\n byteLength: 66\n }\n}\n\naliases.p224 = aliases.secp224r1\naliases.p256 = aliases.secp256r1 = aliases.prime256v1\naliases.p192 = aliases.secp192r1 = aliases.prime192v1\naliases.p384 = aliases.secp384r1\naliases.p521 = aliases.secp521r1\n\nfunction ECDH (curve) {\n this.curveType = aliases[curve]\n if (!this.curveType) {\n this.curveType = {\n name: curve\n }\n }\n this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap\n this.keys = void 0\n}\n\nECDH.prototype.generateKeys = function (enc, format) {\n this.keys = this.curve.genKeyPair()\n return this.getPublicKey(enc, format)\n}\n\nECDH.prototype.computeSecret = function (other, inenc, enc) {\n inenc = inenc || 'utf8'\n if (!Buffer.isBuffer(other)) {\n other = new Buffer(other, inenc)\n }\n var otherPub = this.curve.keyFromPublic(other).getPublic()\n var out = otherPub.mul(this.keys.getPrivate()).getX()\n return formatReturnValue(out, enc, this.curveType.byteLength)\n}\n\nECDH.prototype.getPublicKey = function (enc, format) {\n var key = this.keys.getPublic(format === 'compressed', true)\n if (format === 'hybrid') {\n if (key[key.length - 1] % 2) {\n key[0] = 7\n } else {\n key[0] = 6\n }\n }\n return formatReturnValue(key, enc)\n}\n\nECDH.prototype.getPrivateKey = function (enc) {\n return formatReturnValue(this.keys.getPrivate(), enc)\n}\n\nECDH.prototype.setPublicKey = function (pub, enc) {\n enc = enc || 'utf8'\n if (!Buffer.isBuffer(pub)) {\n pub = new Buffer(pub, enc)\n }\n this.keys._importPublic(pub)\n return this\n}\n\nECDH.prototype.setPrivateKey = function (priv, enc) {\n enc = enc || 'utf8'\n if (!Buffer.isBuffer(priv)) {\n priv = new Buffer(priv, enc)\n }\n\n var _priv = new BN(priv)\n _priv = _priv.toString(16)\n this.keys = this.curve.genKeyPair()\n this.keys._importPrivate(_priv)\n return this\n}\n\nfunction formatReturnValue (bn, enc, len) {\n if (!Array.isArray(bn)) {\n bn = bn.toArray()\n }\n var buf = new Buffer(bn)\n if (len && buf.length < len) {\n var zeros = new Buffer(len - buf.length)\n zeros.fill(0)\n buf = Buffer.concat([zeros, buf])\n }\n if (!enc) {\n return buf\n } else {\n return buf.toString(enc)\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/create-ecdh/browser.js?"); + var value = buffer.length - off; + for (var i = off; i < buffer.length; i++) + buffer[i] = value; -/***/ }), + return true; +}; -/***/ "./node_modules/create-hash/browser.js": -/*!*********************************************!*\ - !*** ./node_modules/create-hash/browser.js ***! - \*********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +DES.prototype._unpad = function _unpad(buffer) { + if (this.padding === false) { + return buffer; + } -"use strict"; -eval("\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar MD5 = __webpack_require__(/*! md5.js */ \"./node_modules/md5.js/index.js\")\nvar RIPEMD160 = __webpack_require__(/*! ripemd160 */ \"./node_modules/ripemd160/index.js\")\nvar sha = __webpack_require__(/*! sha.js */ \"./node_modules/sha.js/index.js\")\nvar Base = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\n\nfunction Hash (hash) {\n Base.call(this, 'digest')\n\n this._hash = hash\n}\n\ninherits(Hash, Base)\n\nHash.prototype._update = function (data) {\n this._hash.update(data)\n}\n\nHash.prototype._final = function () {\n return this._hash.digest()\n}\n\nmodule.exports = function createHash (alg) {\n alg = alg.toLowerCase()\n if (alg === 'md5') return new MD5()\n if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()\n\n return new Hash(sha(alg))\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/create-hash/browser.js?"); + var pad = buffer[buffer.length - 1]; + for (var i = buffer.length - pad; i < buffer.length; i++) + assert.equal(buffer[i], pad); -/***/ }), + return buffer.slice(0, buffer.length - pad); +}; -/***/ "./node_modules/create-hash/md5.js": -/*!*****************************************!*\ - !*** ./node_modules/create-hash/md5.js ***! - \*****************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) { + var l = lStart; + var r = rStart; -eval("var MD5 = __webpack_require__(/*! md5.js */ \"./node_modules/md5.js/index.js\")\n\nmodule.exports = function (buffer) {\n return new MD5().update(buffer).digest()\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/create-hash/md5.js?"); + // Apply f() x16 times + for (var i = 0; i < state.keys.length; i += 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; -/***/ }), + // f(r, k) + utils.expand(r, state.tmp, 0); -/***/ "./node_modules/create-hmac/browser.js": -/*!*********************************************!*\ - !*** ./node_modules/create-hmac/browser.js ***! - \*********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); -"use strict"; -eval("\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Legacy = __webpack_require__(/*! ./legacy */ \"./node_modules/create-hmac/legacy.js\")\nvar Base = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar md5 = __webpack_require__(/*! create-hash/md5 */ \"./node_modules/create-hash/md5.js\")\nvar RIPEMD160 = __webpack_require__(/*! ripemd160 */ \"./node_modules/ripemd160/index.js\")\n\nvar sha = __webpack_require__(/*! sha.js */ \"./node_modules/sha.js/index.js\")\n\nvar ZEROS = Buffer.alloc(128)\n\nfunction Hmac (alg, key) {\n Base.call(this, 'digest')\n if (typeof key === 'string') {\n key = Buffer.from(key)\n }\n\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n this._alg = alg\n this._key = key\n if (key.length > blocksize) {\n var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n key = hash.update(key).digest()\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize)\n var opad = this._opad = Buffer.allocUnsafe(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n this._hash.update(ipad)\n}\n\ninherits(Hmac, Base)\n\nHmac.prototype._update = function (data) {\n this._hash.update(data)\n}\n\nHmac.prototype._final = function () {\n var h = this._hash.digest()\n var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)\n return hash.update(this._opad).update(h).digest()\n}\n\nmodule.exports = function createHmac (alg, key) {\n alg = alg.toLowerCase()\n if (alg === 'rmd160' || alg === 'ripemd160') {\n return new Hmac('rmd160', key)\n }\n if (alg === 'md5') {\n return new Legacy(md5, key)\n }\n return new Hmac(alg, key)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/create-hmac/browser.js?"); + var t = r; + r = (l ^ f) >>> 0; + l = t; + } -/***/ }), + // Reverse Initial Permutation + utils.rip(r, l, out, off); +}; -/***/ "./node_modules/create-hmac/legacy.js": -/*!********************************************!*\ - !*** ./node_modules/create-hmac/legacy.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { + var l = rStart; + var r = lStart; -"use strict"; -eval("\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar Base = __webpack_require__(/*! cipher-base */ \"./node_modules/cipher-base/index.js\")\n\nvar ZEROS = Buffer.alloc(128)\nvar blocksize = 64\n\nfunction Hmac (alg, key) {\n Base.call(this, 'digest')\n if (typeof key === 'string') {\n key = Buffer.from(key)\n }\n\n this._alg = alg\n this._key = key\n\n if (key.length > blocksize) {\n key = alg(key)\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize)\n var opad = this._opad = Buffer.allocUnsafe(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n\n this._hash = [ipad]\n}\n\ninherits(Hmac, Base)\n\nHmac.prototype._update = function (data) {\n this._hash.push(data)\n}\n\nHmac.prototype._final = function () {\n var h = this._alg(Buffer.concat(this._hash))\n return this._alg(Buffer.concat([this._opad, h]))\n}\nmodule.exports = Hmac\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/create-hmac/legacy.js?"); + // Apply f() x16 times + for (var i = state.keys.length - 2; i >= 0; i -= 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; -/***/ }), + // f(r, k) + utils.expand(l, state.tmp, 0); -/***/ "./node_modules/crypto-browserify/index.js": -/*!*************************************************!*\ - !*** ./node_modules/crypto-browserify/index.js ***! - \*************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + + var t = l; + l = (r ^ f) >>> 0; + r = t; + } + + // Reverse Initial Permutation + utils.rip(l, r, out, off); +}; -"use strict"; -eval("\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(/*! randombytes */ \"./node_modules/randombytes/browser.js\")\nexports.createHash = exports.Hash = __webpack_require__(/*! create-hash */ \"./node_modules/create-hash/browser.js\")\nexports.createHmac = exports.Hmac = __webpack_require__(/*! create-hmac */ \"./node_modules/create-hmac/browser.js\")\n\nvar algos = __webpack_require__(/*! browserify-sign/algos */ \"./node_modules/browserify-sign/algos.js\")\nvar algoKeys = Object.keys(algos)\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)\nexports.getHashes = function () {\n return hashes\n}\n\nvar p = __webpack_require__(/*! pbkdf2 */ \"./node_modules/pbkdf2/browser.js\")\nexports.pbkdf2 = p.pbkdf2\nexports.pbkdf2Sync = p.pbkdf2Sync\n\nvar aes = __webpack_require__(/*! browserify-cipher */ \"./node_modules/browserify-cipher/browser.js\")\n\nexports.Cipher = aes.Cipher\nexports.createCipher = aes.createCipher\nexports.Cipheriv = aes.Cipheriv\nexports.createCipheriv = aes.createCipheriv\nexports.Decipher = aes.Decipher\nexports.createDecipher = aes.createDecipher\nexports.Decipheriv = aes.Decipheriv\nexports.createDecipheriv = aes.createDecipheriv\nexports.getCiphers = aes.getCiphers\nexports.listCiphers = aes.listCiphers\n\nvar dh = __webpack_require__(/*! diffie-hellman */ \"./node_modules/diffie-hellman/browser.js\")\n\nexports.DiffieHellmanGroup = dh.DiffieHellmanGroup\nexports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup\nexports.getDiffieHellman = dh.getDiffieHellman\nexports.createDiffieHellman = dh.createDiffieHellman\nexports.DiffieHellman = dh.DiffieHellman\n\nvar sign = __webpack_require__(/*! browserify-sign */ \"./node_modules/browserify-sign/browser/index.js\")\n\nexports.createSign = sign.createSign\nexports.Sign = sign.Sign\nexports.createVerify = sign.createVerify\nexports.Verify = sign.Verify\n\nexports.createECDH = __webpack_require__(/*! create-ecdh */ \"./node_modules/create-ecdh/browser.js\")\n\nvar publicEncrypt = __webpack_require__(/*! public-encrypt */ \"./node_modules/public-encrypt/browser.js\")\n\nexports.publicEncrypt = publicEncrypt.publicEncrypt\nexports.privateEncrypt = publicEncrypt.privateEncrypt\nexports.publicDecrypt = publicEncrypt.publicDecrypt\nexports.privateDecrypt = publicEncrypt.privateDecrypt\n\n// the least I can do is make error messages for the rest of the node.js/crypto api.\n// ;[\n// 'createCredentials'\n// ].forEach(function (name) {\n// exports[name] = function () {\n// throw new Error([\n// 'sorry, ' + name + ' is not implemented yet',\n// 'we accept pull requests',\n// 'https://github.com/crypto-browserify/crypto-browserify'\n// ].join('\\n'))\n// }\n// })\n\nvar rf = __webpack_require__(/*! randomfill */ \"./node_modules/randomfill/browser.js\")\n\nexports.randomFill = rf.randomFill\nexports.randomFillSync = rf.randomFillSync\n\nexports.createCredentials = function () {\n throw new Error([\n 'sorry, createCredentials is not implemented yet',\n 'we accept pull requests',\n 'https://github.com/crypto-browserify/crypto-browserify'\n ].join('\\n'))\n}\n\nexports.constants = {\n 'DH_CHECK_P_NOT_SAFE_PRIME': 2,\n 'DH_CHECK_P_NOT_PRIME': 1,\n 'DH_UNABLE_TO_CHECK_GENERATOR': 4,\n 'DH_NOT_SUITABLE_GENERATOR': 8,\n 'NPN_ENABLED': 1,\n 'ALPN_ENABLED': 1,\n 'RSA_PKCS1_PADDING': 1,\n 'RSA_SSLV23_PADDING': 2,\n 'RSA_NO_PADDING': 3,\n 'RSA_PKCS1_OAEP_PADDING': 4,\n 'RSA_X931_PADDING': 5,\n 'RSA_PKCS1_PSS_PADDING': 6,\n 'POINT_CONVERSION_COMPRESSED': 2,\n 'POINT_CONVERSION_UNCOMPRESSED': 4,\n 'POINT_CONVERSION_HYBRID': 6\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/crypto-browserify/index.js?"); /***/ }), -/***/ "./node_modules/des.js/lib/des.js": -/*!****************************************!*\ - !*** ./node_modules/des.js/lib/des.js ***! - \****************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 651: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nexports.utils = __webpack_require__(/*! ./des/utils */ \"./node_modules/des.js/lib/des/utils.js\");\nexports.Cipher = __webpack_require__(/*! ./des/cipher */ \"./node_modules/des.js/lib/des/cipher.js\");\nexports.DES = __webpack_require__(/*! ./des/des */ \"./node_modules/des.js/lib/des/des.js\");\nexports.CBC = __webpack_require__(/*! ./des/cbc */ \"./node_modules/des.js/lib/des/cbc.js\");\nexports.EDE = __webpack_require__(/*! ./des/ede */ \"./node_modules/des.js/lib/des/ede.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/des.js/lib/des.js?"); -/***/ }), -/***/ "./node_modules/des.js/lib/des/cbc.js": -/*!********************************************!*\ - !*** ./node_modules/des.js/lib/des/cbc.js ***! - \********************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +var assert = __webpack_require__(9746); +var inherits = __webpack_require__(5717); -"use strict"; -eval("\n\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nvar proto = {};\n\nfunction CBCState(iv) {\n assert.equal(iv.length, 8, 'Invalid IV length');\n\n this.iv = new Array(8);\n for (var i = 0; i < this.iv.length; i++)\n this.iv[i] = iv[i];\n}\n\nfunction instantiate(Base) {\n function CBC(options) {\n Base.call(this, options);\n this._cbcInit();\n }\n inherits(CBC, Base);\n\n var keys = Object.keys(proto);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n CBC.prototype[key] = proto[key];\n }\n\n CBC.create = function create(options) {\n return new CBC(options);\n };\n\n return CBC;\n}\n\nexports.instantiate = instantiate;\n\nproto._cbcInit = function _cbcInit() {\n var state = new CBCState(this.options.iv);\n this._cbcState = state;\n};\n\nproto._update = function _update(inp, inOff, out, outOff) {\n var state = this._cbcState;\n var superProto = this.constructor.super_.prototype;\n\n var iv = state.iv;\n if (this.type === 'encrypt') {\n for (var i = 0; i < this.blockSize; i++)\n iv[i] ^= inp[inOff + i];\n\n superProto._update.call(this, iv, 0, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++)\n iv[i] = out[outOff + i];\n } else {\n superProto._update.call(this, inp, inOff, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++)\n out[outOff + i] ^= iv[i];\n\n for (var i = 0; i < this.blockSize; i++)\n iv[i] = inp[inOff + i];\n }\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/des.js/lib/des/cbc.js?"); +var Cipher = __webpack_require__(5756); +var DES = __webpack_require__(778); -/***/ }), +function EDEState(type, key) { + assert.equal(key.length, 24, 'Invalid key length'); -/***/ "./node_modules/des.js/lib/des/cipher.js": -/*!***********************************************!*\ - !*** ./node_modules/des.js/lib/des/cipher.js ***! - \***********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var k1 = key.slice(0, 8); + var k2 = key.slice(8, 16); + var k3 = key.slice(16, 24); -"use strict"; -eval("\n\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nfunction Cipher(options) {\n this.options = options;\n\n this.type = this.options.type;\n this.blockSize = 8;\n this._init();\n\n this.buffer = new Array(this.blockSize);\n this.bufferOff = 0;\n this.padding = options.padding !== false\n}\nmodule.exports = Cipher;\n\nCipher.prototype._init = function _init() {\n // Might be overrided\n};\n\nCipher.prototype.update = function update(data) {\n if (data.length === 0)\n return [];\n\n if (this.type === 'decrypt')\n return this._updateDecrypt(data);\n else\n return this._updateEncrypt(data);\n};\n\nCipher.prototype._buffer = function _buffer(data, off) {\n // Append data to buffer\n var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);\n for (var i = 0; i < min; i++)\n this.buffer[this.bufferOff + i] = data[off + i];\n this.bufferOff += min;\n\n // Shift next\n return min;\n};\n\nCipher.prototype._flushBuffer = function _flushBuffer(out, off) {\n this._update(this.buffer, 0, out, off);\n this.bufferOff = 0;\n return this.blockSize;\n};\n\nCipher.prototype._updateEncrypt = function _updateEncrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n\n var count = ((this.bufferOff + data.length) / this.blockSize) | 0;\n var out = new Array(count * this.blockSize);\n\n if (this.bufferOff !== 0) {\n inputOff += this._buffer(data, inputOff);\n\n if (this.bufferOff === this.buffer.length)\n outputOff += this._flushBuffer(out, outputOff);\n }\n\n // Write blocks\n var max = data.length - ((data.length - inputOff) % this.blockSize);\n for (; inputOff < max; inputOff += this.blockSize) {\n this._update(data, inputOff, out, outputOff);\n outputOff += this.blockSize;\n }\n\n // Queue rest\n for (; inputOff < data.length; inputOff++, this.bufferOff++)\n this.buffer[this.bufferOff] = data[inputOff];\n\n return out;\n};\n\nCipher.prototype._updateDecrypt = function _updateDecrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n\n var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;\n var out = new Array(count * this.blockSize);\n\n // TODO(indutny): optimize it, this is far from optimal\n for (; count > 0; count--) {\n inputOff += this._buffer(data, inputOff);\n outputOff += this._flushBuffer(out, outputOff);\n }\n\n // Buffer rest of the input\n inputOff += this._buffer(data, inputOff);\n\n return out;\n};\n\nCipher.prototype.final = function final(buffer) {\n var first;\n if (buffer)\n first = this.update(buffer);\n\n var last;\n if (this.type === 'encrypt')\n last = this._finalEncrypt();\n else\n last = this._finalDecrypt();\n\n if (first)\n return first.concat(last);\n else\n return last;\n};\n\nCipher.prototype._pad = function _pad(buffer, off) {\n if (off === 0)\n return false;\n\n while (off < buffer.length)\n buffer[off++] = 0;\n\n return true;\n};\n\nCipher.prototype._finalEncrypt = function _finalEncrypt() {\n if (!this._pad(this.buffer, this.bufferOff))\n return [];\n\n var out = new Array(this.blockSize);\n this._update(this.buffer, 0, out, 0);\n return out;\n};\n\nCipher.prototype._unpad = function _unpad(buffer) {\n return buffer;\n};\n\nCipher.prototype._finalDecrypt = function _finalDecrypt() {\n assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');\n var out = new Array(this.blockSize);\n this._flushBuffer(out, 0);\n\n return this._unpad(out);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/des.js/lib/des/cipher.js?"); + if (type === 'encrypt') { + this.ciphers = [ + DES.create({ type: 'encrypt', key: k1 }), + DES.create({ type: 'decrypt', key: k2 }), + DES.create({ type: 'encrypt', key: k3 }) + ]; + } else { + this.ciphers = [ + DES.create({ type: 'decrypt', key: k3 }), + DES.create({ type: 'encrypt', key: k2 }), + DES.create({ type: 'decrypt', key: k1 }) + ]; + } +} -/***/ }), +function EDE(options) { + Cipher.call(this, options); -/***/ "./node_modules/des.js/lib/des/des.js": -/*!********************************************!*\ - !*** ./node_modules/des.js/lib/des/des.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var state = new EDEState(this.type, this.options.key); + this._edeState = state; +} +inherits(EDE, Cipher); -"use strict"; -eval("\n\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/des.js/lib/des/utils.js\");\nvar Cipher = __webpack_require__(/*! ./cipher */ \"./node_modules/des.js/lib/des/cipher.js\");\n\nfunction DESState() {\n this.tmp = new Array(2);\n this.keys = null;\n}\n\nfunction DES(options) {\n Cipher.call(this, options);\n\n var state = new DESState();\n this._desState = state;\n\n this.deriveKeys(state, options.key);\n}\ninherits(DES, Cipher);\nmodule.exports = DES;\n\nDES.create = function create(options) {\n return new DES(options);\n};\n\nvar shiftTable = [\n 1, 1, 2, 2, 2, 2, 2, 2,\n 1, 2, 2, 2, 2, 2, 2, 1\n];\n\nDES.prototype.deriveKeys = function deriveKeys(state, key) {\n state.keys = new Array(16 * 2);\n\n assert.equal(key.length, this.blockSize, 'Invalid key length');\n\n var kL = utils.readUInt32BE(key, 0);\n var kR = utils.readUInt32BE(key, 4);\n\n utils.pc1(kL, kR, state.tmp, 0);\n kL = state.tmp[0];\n kR = state.tmp[1];\n for (var i = 0; i < state.keys.length; i += 2) {\n var shift = shiftTable[i >>> 1];\n kL = utils.r28shl(kL, shift);\n kR = utils.r28shl(kR, shift);\n utils.pc2(kL, kR, state.keys, i);\n }\n};\n\nDES.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._desState;\n\n var l = utils.readUInt32BE(inp, inOff);\n var r = utils.readUInt32BE(inp, inOff + 4);\n\n // Initial Permutation\n utils.ip(l, r, state.tmp, 0);\n l = state.tmp[0];\n r = state.tmp[1];\n\n if (this.type === 'encrypt')\n this._encrypt(state, l, r, state.tmp, 0);\n else\n this._decrypt(state, l, r, state.tmp, 0);\n\n l = state.tmp[0];\n r = state.tmp[1];\n\n utils.writeUInt32BE(out, l, outOff);\n utils.writeUInt32BE(out, r, outOff + 4);\n};\n\nDES.prototype._pad = function _pad(buffer, off) {\n if (this.padding === false) {\n return false;\n }\n\n var value = buffer.length - off;\n for (var i = off; i < buffer.length; i++)\n buffer[i] = value;\n\n return true;\n};\n\nDES.prototype._unpad = function _unpad(buffer) {\n if (this.padding === false) {\n return buffer;\n }\n\n var pad = buffer[buffer.length - 1];\n for (var i = buffer.length - pad; i < buffer.length; i++)\n assert.equal(buffer[i], pad);\n\n return buffer.slice(0, buffer.length - pad);\n};\n\nDES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {\n var l = lStart;\n var r = rStart;\n\n // Apply f() x16 times\n for (var i = 0; i < state.keys.length; i += 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1];\n\n // f(r, k)\n utils.expand(r, state.tmp, 0);\n\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n\n var t = r;\n r = (l ^ f) >>> 0;\n l = t;\n }\n\n // Reverse Initial Permutation\n utils.rip(r, l, out, off);\n};\n\nDES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {\n var l = rStart;\n var r = lStart;\n\n // Apply f() x16 times\n for (var i = state.keys.length - 2; i >= 0; i -= 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1];\n\n // f(r, k)\n utils.expand(l, state.tmp, 0);\n\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n\n var t = l;\n l = (r ^ f) >>> 0;\n r = t;\n }\n\n // Reverse Initial Permutation\n utils.rip(l, r, out, off);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/des.js/lib/des/des.js?"); +module.exports = EDE; -/***/ }), +EDE.create = function create(options) { + return new EDE(options); +}; -/***/ "./node_modules/des.js/lib/des/ede.js": -/*!********************************************!*\ - !*** ./node_modules/des.js/lib/des/ede.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +EDE.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._edeState; + + state.ciphers[0]._update(inp, inOff, out, outOff); + state.ciphers[1]._update(out, outOff, out, outOff); + state.ciphers[2]._update(out, outOff, out, outOff); +}; + +EDE.prototype._pad = DES.prototype._pad; +EDE.prototype._unpad = DES.prototype._unpad; -"use strict"; -eval("\n\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nvar Cipher = __webpack_require__(/*! ./cipher */ \"./node_modules/des.js/lib/des/cipher.js\");\nvar DES = __webpack_require__(/*! ./des */ \"./node_modules/des.js/lib/des/des.js\");\n\nfunction EDEState(type, key) {\n assert.equal(key.length, 24, 'Invalid key length');\n\n var k1 = key.slice(0, 8);\n var k2 = key.slice(8, 16);\n var k3 = key.slice(16, 24);\n\n if (type === 'encrypt') {\n this.ciphers = [\n DES.create({ type: 'encrypt', key: k1 }),\n DES.create({ type: 'decrypt', key: k2 }),\n DES.create({ type: 'encrypt', key: k3 })\n ];\n } else {\n this.ciphers = [\n DES.create({ type: 'decrypt', key: k3 }),\n DES.create({ type: 'encrypt', key: k2 }),\n DES.create({ type: 'decrypt', key: k1 })\n ];\n }\n}\n\nfunction EDE(options) {\n Cipher.call(this, options);\n\n var state = new EDEState(this.type, this.options.key);\n this._edeState = state;\n}\ninherits(EDE, Cipher);\n\nmodule.exports = EDE;\n\nEDE.create = function create(options) {\n return new EDE(options);\n};\n\nEDE.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._edeState;\n\n state.ciphers[0]._update(inp, inOff, out, outOff);\n state.ciphers[1]._update(out, outOff, out, outOff);\n state.ciphers[2]._update(out, outOff, out, outOff);\n};\n\nEDE.prototype._pad = DES.prototype._pad;\nEDE.prototype._unpad = DES.prototype._unpad;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/des.js/lib/des/ede.js?"); /***/ }), -/***/ "./node_modules/des.js/lib/des/utils.js": -/*!**********************************************!*\ - !*** ./node_modules/des.js/lib/des/utils.js ***! - \**********************************************/ +/***/ 1278: /***/ (function(__unused_webpack_module, exports) { "use strict"; -eval("\n\nexports.readUInt32BE = function readUInt32BE(bytes, off) {\n var res = (bytes[0 + off] << 24) |\n (bytes[1 + off] << 16) |\n (bytes[2 + off] << 8) |\n bytes[3 + off];\n return res >>> 0;\n};\n\nexports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {\n bytes[0 + off] = value >>> 24;\n bytes[1 + off] = (value >>> 16) & 0xff;\n bytes[2 + off] = (value >>> 8) & 0xff;\n bytes[3 + off] = value & 0xff;\n};\n\nexports.ip = function ip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >>> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inL >>> (j + i)) & 1;\n }\n }\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= (inR >>> (j + i)) & 1;\n }\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= (inL >>> (j + i)) & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.rip = function rip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 0; i < 4; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outL <<= 1;\n outL |= (inR >>> (j + i)) & 1;\n outL <<= 1;\n outL |= (inL >>> (j + i)) & 1;\n }\n }\n for (var i = 4; i < 8; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outR <<= 1;\n outR |= (inR >>> (j + i)) & 1;\n outR <<= 1;\n outR |= (inL >>> (j + i)) & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.pc1 = function pc1(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n // 7, 15, 23, 31, 39, 47, 55, 63\n // 6, 14, 22, 30, 39, 47, 55, 63\n // 5, 13, 21, 29, 39, 47, 55, 63\n // 4, 12, 20, 28\n for (var i = 7; i >= 5; i--) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inL >> (j + i)) & 1;\n }\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >> (j + i)) & 1;\n }\n\n // 1, 9, 17, 25, 33, 41, 49, 57\n // 2, 10, 18, 26, 34, 42, 50, 58\n // 3, 11, 19, 27, 35, 43, 51, 59\n // 36, 44, 52, 60\n for (var i = 1; i <= 3; i++) {\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inR >> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inL >> (j + i)) & 1;\n }\n }\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inL >> (j + i)) & 1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.r28shl = function r28shl(num, shift) {\n return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));\n};\n\nvar pc2table = [\n // inL => outL\n 14, 11, 17, 4, 27, 23, 25, 0,\n 13, 22, 7, 18, 5, 9, 16, 24,\n 2, 20, 12, 21, 1, 8, 15, 26,\n\n // inR => outR\n 15, 4, 25, 19, 9, 1, 26, 16,\n 5, 11, 23, 8, 12, 7, 17, 0,\n 22, 3, 10, 14, 6, 20, 27, 24\n];\n\nexports.pc2 = function pc2(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n var len = pc2table.length >>> 1;\n for (var i = 0; i < len; i++) {\n outL <<= 1;\n outL |= (inL >>> pc2table[i]) & 0x1;\n }\n for (var i = len; i < pc2table.length; i++) {\n outR <<= 1;\n outR |= (inR >>> pc2table[i]) & 0x1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.expand = function expand(r, out, off) {\n var outL = 0;\n var outR = 0;\n\n outL = ((r & 1) << 5) | (r >>> 27);\n for (var i = 23; i >= 15; i -= 4) {\n outL <<= 6;\n outL |= (r >>> i) & 0x3f;\n }\n for (var i = 11; i >= 3; i -= 4) {\n outR |= (r >>> i) & 0x3f;\n outR <<= 6;\n }\n outR |= ((r & 0x1f) << 1) | (r >>> 31);\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nvar sTable = [\n 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,\n 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,\n 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,\n 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,\n\n 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,\n 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,\n 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,\n 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,\n\n 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,\n 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,\n 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,\n 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,\n\n 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,\n 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,\n 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,\n 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,\n\n 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,\n 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,\n 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,\n 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,\n\n 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,\n 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,\n 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,\n 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,\n\n 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,\n 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,\n 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,\n 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,\n\n 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,\n 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,\n 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,\n 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11\n];\n\nexports.substitute = function substitute(inL, inR) {\n var out = 0;\n for (var i = 0; i < 4; i++) {\n var b = (inL >>> (18 - i * 6)) & 0x3f;\n var sb = sTable[i * 0x40 + b];\n\n out <<= 4;\n out |= sb;\n }\n for (var i = 0; i < 4; i++) {\n var b = (inR >>> (18 - i * 6)) & 0x3f;\n var sb = sTable[4 * 0x40 + i * 0x40 + b];\n\n out <<= 4;\n out |= sb;\n }\n return out >>> 0;\n};\n\nvar permuteTable = [\n 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,\n 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7\n];\n\nexports.permute = function permute(num) {\n var out = 0;\n for (var i = 0; i < permuteTable.length; i++) {\n out <<= 1;\n out |= (num >>> permuteTable[i]) & 0x1;\n }\n return out >>> 0;\n};\n\nexports.padSplit = function padSplit(num, size, group) {\n var str = num.toString(2);\n while (str.length < size)\n str = '0' + str;\n\n var out = [];\n for (var i = 0; i < size; i += group)\n out.push(str.slice(i, i + group));\n return out.join(' ');\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/des.js/lib/des/utils.js?"); -/***/ }), -/***/ "./node_modules/diffie-hellman/browser.js": -/*!************************************************!*\ - !*** ./node_modules/diffie-hellman/browser.js ***! - \************************************************/ +exports.readUInt32BE = function readUInt32BE(bytes, off) { + var res = (bytes[0 + off] << 24) | + (bytes[1 + off] << 16) | + (bytes[2 + off] << 8) | + bytes[3 + off]; + return res >>> 0; +}; + +exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) { + bytes[0 + off] = value >>> 24; + bytes[1 + off] = (value >>> 16) & 0xff; + bytes[2 + off] = (value >>> 8) & 0xff; + bytes[3 + off] = value & 0xff; +}; + +exports.ip = function ip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + for (var i = 6; i >= 0; i -= 2) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } + + for (var i = 6; i >= 0; i -= 2) { + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + } + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.rip = function rip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + for (var i = 0; i < 4; i++) { + for (var j = 24; j >= 0; j -= 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } + for (var i = 4; i < 8; i++) { + for (var j = 24; j >= 0; j -= 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.pc1 = function pc1(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + // 7, 15, 23, 31, 39, 47, 55, 63 + // 6, 14, 22, 30, 39, 47, 55, 63 + // 5, 13, 21, 29, 39, 47, 55, 63 + // 4, 12, 20, 28 + for (var i = 7; i >= 5; i--) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + + // 1, 9, 17, 25, 33, 41, 49, 57 + // 2, 10, 18, 26, 34, 42, 50, 58 + // 3, 11, 19, 27, 35, 43, 51, 59 + // 36, 44, 52, 60 + for (var i = 1; i <= 3; i++) { + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.r28shl = function r28shl(num, shift) { + return ((num << shift) & 0xfffffff) | (num >>> (28 - shift)); +}; + +var pc2table = [ + // inL => outL + 14, 11, 17, 4, 27, 23, 25, 0, + 13, 22, 7, 18, 5, 9, 16, 24, + 2, 20, 12, 21, 1, 8, 15, 26, + + // inR => outR + 15, 4, 25, 19, 9, 1, 26, 16, + 5, 11, 23, 8, 12, 7, 17, 0, + 22, 3, 10, 14, 6, 20, 27, 24 +]; + +exports.pc2 = function pc2(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + var len = pc2table.length >>> 1; + for (var i = 0; i < len; i++) { + outL <<= 1; + outL |= (inL >>> pc2table[i]) & 0x1; + } + for (var i = len; i < pc2table.length; i++) { + outR <<= 1; + outR |= (inR >>> pc2table[i]) & 0x1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.expand = function expand(r, out, off) { + var outL = 0; + var outR = 0; + + outL = ((r & 1) << 5) | (r >>> 27); + for (var i = 23; i >= 15; i -= 4) { + outL <<= 6; + outL |= (r >>> i) & 0x3f; + } + for (var i = 11; i >= 3; i -= 4) { + outR |= (r >>> i) & 0x3f; + outR <<= 6; + } + outR |= ((r & 0x1f) << 1) | (r >>> 31); + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +var sTable = [ + 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, + 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, + 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, + 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, + + 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, + 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, + 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, + 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, + + 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, + 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, + 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, + 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, + + 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, + 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, + 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, + 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, + + 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, + 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, + 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, + 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, + + 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, + 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, + 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, + 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, + + 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, + 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, + 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, + 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, + + 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, + 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, + 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, + 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 +]; + +exports.substitute = function substitute(inL, inR) { + var out = 0; + for (var i = 0; i < 4; i++) { + var b = (inL >>> (18 - i * 6)) & 0x3f; + var sb = sTable[i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + for (var i = 0; i < 4; i++) { + var b = (inR >>> (18 - i * 6)) & 0x3f; + var sb = sTable[4 * 0x40 + i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + return out >>> 0; +}; + +var permuteTable = [ + 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, + 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7 +]; + +exports.permute = function permute(num) { + var out = 0; + for (var i = 0; i < permuteTable.length; i++) { + out <<= 1; + out |= (num >>> permuteTable[i]) & 0x1; + } + return out >>> 0; +}; + +exports.padSplit = function padSplit(num, size, group) { + var str = num.toString(2); + while (str.length < size) + str = '0' + str; + + var out = []; + for (var i = 0; i < size; i += group) + out.push(str.slice(i, i + group)); + return out.join(' '); +}; + + +/***/ }), + +/***/ 2607: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("var generatePrime = __webpack_require__(/*! ./lib/generatePrime */ \"./node_modules/diffie-hellman/lib/generatePrime.js\")\nvar primes = __webpack_require__(/*! ./lib/primes.json */ \"./node_modules/diffie-hellman/lib/primes.json\")\n\nvar DH = __webpack_require__(/*! ./lib/dh */ \"./node_modules/diffie-hellman/lib/dh.js\")\n\nfunction getDiffieHellman (mod) {\n var prime = new Buffer(primes[mod].prime, 'hex')\n var gen = new Buffer(primes[mod].gen, 'hex')\n\n return new DH(prime, gen)\n}\n\nvar ENCODINGS = {\n 'binary': true, 'hex': true, 'base64': true\n}\n\nfunction createDiffieHellman (prime, enc, generator, genc) {\n if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {\n return createDiffieHellman(prime, 'binary', enc, generator)\n }\n\n enc = enc || 'binary'\n genc = genc || 'binary'\n generator = generator || new Buffer([2])\n\n if (!Buffer.isBuffer(generator)) {\n generator = new Buffer(generator, genc)\n }\n\n if (typeof prime === 'number') {\n return new DH(generatePrime(prime, generator), generator, true)\n }\n\n if (!Buffer.isBuffer(prime)) {\n prime = new Buffer(prime, enc)\n }\n\n return new DH(prime, generator, true)\n}\n\nexports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman\nexports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/diffie-hellman/browser.js?"); +var generatePrime = __webpack_require__(3590) +var primes = __webpack_require__(9799) -/***/ }), +var DH = __webpack_require__(7426) -/***/ "./node_modules/diffie-hellman/lib/dh.js": -/*!***********************************************!*\ - !*** ./node_modules/diffie-hellman/lib/dh.js ***! - \***********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function getDiffieHellman (mod) { + var prime = new Buffer(primes[mod].prime, 'hex') + var gen = new Buffer(primes[mod].gen, 'hex') -eval("var BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar MillerRabin = __webpack_require__(/*! miller-rabin */ \"./node_modules/miller-rabin/lib/mr.js\");\nvar millerRabin = new MillerRabin();\nvar TWENTYFOUR = new BN(24);\nvar ELEVEN = new BN(11);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar primes = __webpack_require__(/*! ./generatePrime */ \"./node_modules/diffie-hellman/lib/generatePrime.js\");\nvar randomBytes = __webpack_require__(/*! randombytes */ \"./node_modules/randombytes/browser.js\");\nmodule.exports = DH;\n\nfunction setPublicKey(pub, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(pub)) {\n pub = new Buffer(pub, enc);\n }\n this._pub = new BN(pub);\n return this;\n}\n\nfunction setPrivateKey(priv, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(priv)) {\n priv = new Buffer(priv, enc);\n }\n this._priv = new BN(priv);\n return this;\n}\n\nvar primeCache = {};\nfunction checkPrime(prime, generator) {\n var gen = generator.toString('hex');\n var hex = [gen, prime.toString(16)].join('_');\n if (hex in primeCache) {\n return primeCache[hex];\n }\n var error = 0;\n\n if (prime.isEven() ||\n !primes.simpleSieve ||\n !primes.fermatTest(prime) ||\n !millerRabin.test(prime)) {\n //not a prime so +1\n error += 1;\n\n if (gen === '02' || gen === '05') {\n // we'd be able to check the generator\n // it would fail so +8\n error += 8;\n } else {\n //we wouldn't be able to test the generator\n // so +4\n error += 4;\n }\n primeCache[hex] = error;\n return error;\n }\n if (!millerRabin.test(prime.shrn(1))) {\n //not a safe prime\n error += 2;\n }\n var rem;\n switch (gen) {\n case '02':\n if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {\n // unsuidable generator\n error += 8;\n }\n break;\n case '05':\n rem = prime.mod(TEN);\n if (rem.cmp(THREE) && rem.cmp(SEVEN)) {\n // prime mod 10 needs to equal 3 or 7\n error += 8;\n }\n break;\n default:\n error += 4;\n }\n primeCache[hex] = error;\n return error;\n}\n\nfunction DH(prime, generator, malleable) {\n this.setGenerator(generator);\n this.__prime = new BN(prime);\n this._prime = BN.mont(this.__prime);\n this._primeLen = prime.length;\n this._pub = undefined;\n this._priv = undefined;\n this._primeCode = undefined;\n if (malleable) {\n this.setPublicKey = setPublicKey;\n this.setPrivateKey = setPrivateKey;\n } else {\n this._primeCode = 8;\n }\n}\nObject.defineProperty(DH.prototype, 'verifyError', {\n enumerable: true,\n get: function () {\n if (typeof this._primeCode !== 'number') {\n this._primeCode = checkPrime(this.__prime, this.__gen);\n }\n return this._primeCode;\n }\n});\nDH.prototype.generateKeys = function () {\n if (!this._priv) {\n this._priv = new BN(randomBytes(this._primeLen));\n }\n this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();\n return this.getPublicKey();\n};\n\nDH.prototype.computeSecret = function (other) {\n other = new BN(other);\n other = other.toRed(this._prime);\n var secret = other.redPow(this._priv).fromRed();\n var out = new Buffer(secret.toArray());\n var prime = this.getPrime();\n if (out.length < prime.length) {\n var front = new Buffer(prime.length - out.length);\n front.fill(0);\n out = Buffer.concat([front, out]);\n }\n return out;\n};\n\nDH.prototype.getPublicKey = function getPublicKey(enc) {\n return formatReturnValue(this._pub, enc);\n};\n\nDH.prototype.getPrivateKey = function getPrivateKey(enc) {\n return formatReturnValue(this._priv, enc);\n};\n\nDH.prototype.getPrime = function (enc) {\n return formatReturnValue(this.__prime, enc);\n};\n\nDH.prototype.getGenerator = function (enc) {\n return formatReturnValue(this._gen, enc);\n};\n\nDH.prototype.setGenerator = function (gen, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(gen)) {\n gen = new Buffer(gen, enc);\n }\n this.__gen = gen;\n this._gen = new BN(gen);\n return this;\n};\n\nfunction formatReturnValue(bn, enc) {\n var buf = new Buffer(bn.toArray());\n if (!enc) {\n return buf;\n } else {\n return buf.toString(enc);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/diffie-hellman/lib/dh.js?"); + return new DH(prime, gen) +} -/***/ }), +var ENCODINGS = { + 'binary': true, 'hex': true, 'base64': true +} -/***/ "./node_modules/diffie-hellman/lib/generatePrime.js": -/*!**********************************************************!*\ - !*** ./node_modules/diffie-hellman/lib/generatePrime.js ***! - \**********************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function createDiffieHellman (prime, enc, generator, genc) { + if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) { + return createDiffieHellman(prime, 'binary', enc, generator) + } -eval("var randomBytes = __webpack_require__(/*! randombytes */ \"./node_modules/randombytes/browser.js\");\nmodule.exports = findPrime;\nfindPrime.simpleSieve = simpleSieve;\nfindPrime.fermatTest = fermatTest;\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar TWENTYFOUR = new BN(24);\nvar MillerRabin = __webpack_require__(/*! miller-rabin */ \"./node_modules/miller-rabin/lib/mr.js\");\nvar millerRabin = new MillerRabin();\nvar ONE = new BN(1);\nvar TWO = new BN(2);\nvar FIVE = new BN(5);\nvar SIXTEEN = new BN(16);\nvar EIGHT = new BN(8);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar ELEVEN = new BN(11);\nvar FOUR = new BN(4);\nvar TWELVE = new BN(12);\nvar primes = null;\n\nfunction _getPrimes() {\n if (primes !== null)\n return primes;\n\n var limit = 0x100000;\n var res = [];\n res[0] = 2;\n for (var i = 1, k = 3; k < limit; k += 2) {\n var sqrt = Math.ceil(Math.sqrt(k));\n for (var j = 0; j < i && res[j] <= sqrt; j++)\n if (k % res[j] === 0)\n break;\n\n if (i !== j && res[j] <= sqrt)\n continue;\n\n res[i++] = k;\n }\n primes = res;\n return res;\n}\n\nfunction simpleSieve(p) {\n var primes = _getPrimes();\n\n for (var i = 0; i < primes.length; i++)\n if (p.modn(primes[i]) === 0) {\n if (p.cmpn(primes[i]) === 0) {\n return true;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\nfunction fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n}\n\nfunction findPrime(bits, gen) {\n if (bits < 16) {\n // this is what openssl does\n if (gen === 2 || gen === 5) {\n return new BN([0x8c, 0x7b]);\n } else {\n return new BN([0x8c, 0x27]);\n }\n }\n gen = new BN(gen);\n\n var num, n2;\n\n while (true) {\n num = new BN(randomBytes(Math.ceil(bits / 8)));\n while (num.bitLength() > bits) {\n num.ishrn(1);\n }\n if (num.isEven()) {\n num.iadd(ONE);\n }\n if (!num.testn(1)) {\n num.iadd(TWO);\n }\n if (!gen.cmp(TWO)) {\n while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {\n num.iadd(FOUR);\n }\n } else if (!gen.cmp(FIVE)) {\n while (num.mod(TEN).cmp(THREE)) {\n num.iadd(FOUR);\n }\n }\n n2 = num.shrn(1);\n if (simpleSieve(n2) && simpleSieve(num) &&\n fermatTest(n2) && fermatTest(num) &&\n millerRabin.test(n2) && millerRabin.test(num)) {\n return num;\n }\n }\n\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/diffie-hellman/lib/generatePrime.js?"); + enc = enc || 'binary' + genc = genc || 'binary' + generator = generator || new Buffer([2]) -/***/ }), + if (!Buffer.isBuffer(generator)) { + generator = new Buffer(generator, genc) + } -/***/ "./node_modules/elliptic/lib/elliptic.js": -/*!***********************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic.js ***! - \***********************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + if (typeof prime === 'number') { + return new DH(generatePrime(prime, generator), generator, true) + } -"use strict"; -eval("\n\nvar elliptic = exports;\n\nelliptic.version = (__webpack_require__(/*! ../package.json */ \"./node_modules/elliptic/package.json\").version);\nelliptic.utils = __webpack_require__(/*! ./elliptic/utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nelliptic.rand = __webpack_require__(/*! brorand */ \"./src/fallback/unity/brorand.js\");\nelliptic.curve = __webpack_require__(/*! ./elliptic/curve */ \"./node_modules/elliptic/lib/elliptic/curve/index.js\");\nelliptic.curves = __webpack_require__(/*! ./elliptic/curves */ \"./node_modules/elliptic/lib/elliptic/curves.js\");\n\n// Protocols\nelliptic.ec = __webpack_require__(/*! ./elliptic/ec */ \"./node_modules/elliptic/lib/elliptic/ec/index.js\");\nelliptic.eddsa = __webpack_require__(/*! ./elliptic/eddsa */ \"./node_modules/elliptic/lib/elliptic/eddsa/index.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic.js?"); + if (!Buffer.isBuffer(prime)) { + prime = new Buffer(prime, enc) + } -/***/ }), + return new DH(prime, generator, true) +} -/***/ "./node_modules/elliptic/lib/elliptic/curve/base.js": -/*!**********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/base.js ***! - \**********************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman +exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman -"use strict"; -eval("\n\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar getNAF = utils.getNAF;\nvar getJSF = utils.getJSF;\nvar assert = utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new BN(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);\n\n // Useful for many curves\n this.zero = new BN(0).toRed(this.red);\n this.one = new BN(1).toRed(this.red);\n this.two = new BN(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new BN(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n\n this._bitLength = this.n ? this.n.bitLength() : 0;\n\n // Generalized Greg Maxwell's trick\n var adjustCount = this.n && this.p.div(this.n);\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1, this._bitLength);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n var j;\n var nafW;\n for (j = 0; j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1; l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (j = 0; j < repr.length; j++) {\n nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w, this._bitLength);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var l = 0; i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0)\n l++;\n acc = acc.dblp(l);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len,\n jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n var i;\n var j;\n var p;\n for (i = 0; i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);\n naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b], /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3, /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (j = 0; j < len; j++) {\n var z = tmp[j];\n p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (i = 0; i < len; i++)\n wnd[i] = null;\n\n if (jacobianResult)\n return acc;\n else\n return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq(/*other*/) {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n\n var len = this.p.byteLength();\n\n // uncompressed, hybrid-odd, hybrid-even\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&\n bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06)\n assert(bytes[bytes.length - 1] % 2 === 0);\n else if (bytes[0] === 0x07)\n assert(bytes[bytes.length - 1] % 2 === 1);\n\n var res = this.point(bytes.slice(1, 1 + len),\n bytes.slice(1 + len, 1 + 2 * len));\n\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&\n bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n\n if (compact)\n return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n\n return [ 0x04 ].concat(x, this.getY().toArray('be', len));\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null,\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed)\n return false;\n\n var doubles = this.precomputed.doubles;\n if (!doubles)\n return false;\n\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles,\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res,\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/curve/base.js?"); /***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/curve/edwards.js": -/*!*************************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/edwards.js ***! - \*************************************************************/ +/***/ 7426: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nvar Base = __webpack_require__(/*! ./base */ \"./node_modules/elliptic/lib/elliptic/curve/base.js\");\n\nvar assert = utils.assert;\n\nfunction EdwardsCurve(conf) {\n // NOTE: Important as we are creating point in Base.call()\n this.twisted = (conf.a | 0) !== 1;\n this.mOneA = this.twisted && (conf.a | 0) === -1;\n this.extended = this.mOneA;\n\n Base.call(this, 'edwards', conf);\n\n this.a = new BN(conf.a, 16).umod(this.red.m);\n this.a = this.a.toRed(this.red);\n this.c = new BN(conf.c, 16).toRed(this.red);\n this.c2 = this.c.redSqr();\n this.d = new BN(conf.d, 16).toRed(this.red);\n this.dd = this.d.redAdd(this.d);\n\n assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);\n this.oneC = (conf.c | 0) === 1;\n}\ninherits(EdwardsCurve, Base);\nmodule.exports = EdwardsCurve;\n\nEdwardsCurve.prototype._mulA = function _mulA(num) {\n if (this.mOneA)\n return num.redNeg();\n else\n return this.a.redMul(num);\n};\n\nEdwardsCurve.prototype._mulC = function _mulC(num) {\n if (this.oneC)\n return num;\n else\n return this.c.redMul(num);\n};\n\n// Just for compatibility with Short curve\nEdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {\n return this.point(x, y, z, t);\n};\n\nEdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var x2 = x.redSqr();\n var rhs = this.c2.redSub(this.a.redMul(x2));\n var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));\n\n var y2 = rhs.redMul(lhs.redInvm());\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nEdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {\n y = new BN(y, 16);\n if (!y.red)\n y = y.toRed(this.red);\n\n // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)\n var y2 = y.redSqr();\n var lhs = y2.redSub(this.c2);\n var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);\n var x2 = lhs.redMul(rhs.redInvm());\n\n if (x2.cmp(this.zero) === 0) {\n if (odd)\n throw new Error('invalid point');\n else\n return this.point(this.zero, y);\n }\n\n var x = x2.redSqrt();\n if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n if (x.fromRed().isOdd() !== odd)\n x = x.redNeg();\n\n return this.point(x, y);\n};\n\nEdwardsCurve.prototype.validate = function validate(point) {\n if (point.isInfinity())\n return true;\n\n // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)\n point.normalize();\n\n var x2 = point.x.redSqr();\n var y2 = point.y.redSqr();\n var lhs = x2.redMul(this.a).redAdd(y2);\n var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n\n return lhs.cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, y, z, t) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && y === null && z === null) {\n this.x = this.curve.zero;\n this.y = this.curve.one;\n this.z = this.curve.one;\n this.t = this.curve.zero;\n this.zOne = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = z ? new BN(z, 16) : this.curve.one;\n this.t = t && new BN(t, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n if (this.t && !this.t.red)\n this.t = this.t.toRed(this.curve.red);\n this.zOne = this.z === this.curve.one;\n\n // Use extended coordinates\n if (this.curve.extended && !this.t) {\n this.t = this.x.redMul(this.y);\n if (!this.zOne)\n this.t = this.t.redMul(this.z.redInvm());\n }\n }\n}\ninherits(Point, Base.BasePoint);\n\nEdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n};\n\nEdwardsCurve.prototype.point = function point(x, y, z, t) {\n return new Point(this, x, y, z, t);\n};\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.x.cmpn(0) === 0 &&\n (this.y.cmp(this.z) === 0 ||\n (this.zOne && this.y.cmp(this.curve.c) === 0));\n};\n\nPoint.prototype._extDbl = function _extDbl() {\n // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html\n // #doubling-dbl-2008-hwcd\n // 4M + 4S\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = 2 * Z1^2\n var c = this.z.redSqr();\n c = c.redIAdd(c);\n // D = a * A\n var d = this.curve._mulA(a);\n // E = (X1 + Y1)^2 - A - B\n var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);\n // G = D + B\n var g = d.redAdd(b);\n // F = G - C\n var f = g.redSub(c);\n // H = D - B\n var h = d.redSub(b);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projDbl = function _projDbl() {\n // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html\n // #doubling-dbl-2008-bbjlp\n // #doubling-dbl-2007-bl\n // and others\n // Generally 3M + 4S or 2M + 4S\n\n // B = (X1 + Y1)^2\n var b = this.x.redAdd(this.y).redSqr();\n // C = X1^2\n var c = this.x.redSqr();\n // D = Y1^2\n var d = this.y.redSqr();\n\n var nx;\n var ny;\n var nz;\n var e;\n var h;\n var j;\n if (this.curve.twisted) {\n // E = a * C\n e = this.curve._mulA(c);\n // F = E + D\n var f = e.redAdd(d);\n if (this.zOne) {\n // X3 = (B - C - D) * (F - 2)\n nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));\n // Y3 = F * (E - D)\n ny = f.redMul(e.redSub(d));\n // Z3 = F^2 - 2 * F\n nz = f.redSqr().redSub(f).redSub(f);\n } else {\n // H = Z1^2\n h = this.z.redSqr();\n // J = F - 2 * H\n j = f.redSub(h).redISub(h);\n // X3 = (B-C-D)*J\n nx = b.redSub(c).redISub(d).redMul(j);\n // Y3 = F * (E - D)\n ny = f.redMul(e.redSub(d));\n // Z3 = F * J\n nz = f.redMul(j);\n }\n } else {\n // E = C + D\n e = c.redAdd(d);\n // H = (c * Z1)^2\n h = this.curve._mulC(this.z).redSqr();\n // J = E - 2 * H\n j = e.redSub(h).redSub(h);\n // X3 = c * (B - E) * J\n nx = this.curve._mulC(b.redISub(e)).redMul(j);\n // Y3 = c * E * (C - D)\n ny = this.curve._mulC(e).redMul(c.redISub(d));\n // Z3 = E * J\n nz = e.redMul(j);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n // Double in extended coordinates\n if (this.curve.extended)\n return this._extDbl();\n else\n return this._projDbl();\n};\n\nPoint.prototype._extAdd = function _extAdd(p) {\n // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html\n // #addition-add-2008-hwcd-3\n // 8M\n\n // A = (Y1 - X1) * (Y2 - X2)\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));\n // B = (Y1 + X1) * (Y2 + X2)\n var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));\n // C = T1 * k * T2\n var c = this.t.redMul(this.curve.dd).redMul(p.t);\n // D = Z1 * 2 * Z2\n var d = this.z.redMul(p.z.redAdd(p.z));\n // E = B - A\n var e = b.redSub(a);\n // F = D - C\n var f = d.redSub(c);\n // G = D + C\n var g = d.redAdd(c);\n // H = B + A\n var h = b.redAdd(a);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projAdd = function _projAdd(p) {\n // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html\n // #addition-add-2008-bbjlp\n // #addition-add-2007-bl\n // 10M + 1S\n\n // A = Z1 * Z2\n var a = this.z.redMul(p.z);\n // B = A^2\n var b = a.redSqr();\n // C = X1 * X2\n var c = this.x.redMul(p.x);\n // D = Y1 * Y2\n var d = this.y.redMul(p.y);\n // E = d * C * D\n var e = this.curve.d.redMul(c).redMul(d);\n // F = B - E\n var f = b.redSub(e);\n // G = B + E\n var g = b.redAdd(e);\n // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)\n var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);\n var nx = a.redMul(f).redMul(tmp);\n var ny;\n var nz;\n if (this.curve.twisted) {\n // Y3 = A * G * (D - a * C)\n ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));\n // Z3 = F * G\n nz = f.redMul(g);\n } else {\n // Y3 = A * G * (D - C)\n ny = a.redMul(g).redMul(d.redSub(c));\n // Z3 = c * F * G\n nz = this.curve._mulC(f).redMul(g);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.add = function add(p) {\n if (this.isInfinity())\n return p;\n if (p.isInfinity())\n return this;\n\n if (this.curve.extended)\n return this._extAdd(p);\n else\n return this._projAdd(p);\n};\n\nPoint.prototype.mul = function mul(k) {\n if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);\n};\n\nPoint.prototype.normalize = function normalize() {\n if (this.zOne)\n return this;\n\n // Normalize coordinates\n var zi = this.z.redInvm();\n this.x = this.x.redMul(zi);\n this.y = this.y.redMul(zi);\n if (this.t)\n this.t = this.t.redMul(zi);\n this.z = this.curve.one;\n this.zOne = true;\n return this;\n};\n\nPoint.prototype.neg = function neg() {\n return this.curve.point(this.x.redNeg(),\n this.y,\n this.z,\n this.t && this.t.redNeg());\n};\n\nPoint.prototype.getX = function getX() {\n this.normalize();\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n this.normalize();\n return this.y.fromRed();\n};\n\nPoint.prototype.eq = function eq(other) {\n return this === other ||\n this.getX().cmp(other.getX()) === 0 &&\n this.getY().cmp(other.getY()) === 0;\n};\n\nPoint.prototype.eqXToP = function eqXToP(x) {\n var rx = x.toRed(this.curve.red).redMul(this.z);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(this.z);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n};\n\n// Compatibility with BaseCurve\nPoint.prototype.toP = Point.prototype.normalize;\nPoint.prototype.mixedAdd = Point.prototype.add;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/curve/edwards.js?"); - -/***/ }), +var BN = __webpack_require__(3550); +var MillerRabin = __webpack_require__(3047); +var millerRabin = new MillerRabin(); +var TWENTYFOUR = new BN(24); +var ELEVEN = new BN(11); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var primes = __webpack_require__(3590); +var randomBytes = __webpack_require__(1798); +module.exports = DH; + +function setPublicKey(pub, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc); + } + this._pub = new BN(pub); + return this; +} + +function setPrivateKey(priv, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc); + } + this._priv = new BN(priv); + return this; +} + +var primeCache = {}; +function checkPrime(prime, generator) { + var gen = generator.toString('hex'); + var hex = [gen, prime.toString(16)].join('_'); + if (hex in primeCache) { + return primeCache[hex]; + } + var error = 0; + + if (prime.isEven() || + !primes.simpleSieve || + !primes.fermatTest(prime) || + !millerRabin.test(prime)) { + //not a prime so +1 + error += 1; + + if (gen === '02' || gen === '05') { + // we'd be able to check the generator + // it would fail so +8 + error += 8; + } else { + //we wouldn't be able to test the generator + // so +4 + error += 4; + } + primeCache[hex] = error; + return error; + } + if (!millerRabin.test(prime.shrn(1))) { + //not a safe prime + error += 2; + } + var rem; + switch (gen) { + case '02': + if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) { + // unsuidable generator + error += 8; + } + break; + case '05': + rem = prime.mod(TEN); + if (rem.cmp(THREE) && rem.cmp(SEVEN)) { + // prime mod 10 needs to equal 3 or 7 + error += 8; + } + break; + default: + error += 4; + } + primeCache[hex] = error; + return error; +} + +function DH(prime, generator, malleable) { + this.setGenerator(generator); + this.__prime = new BN(prime); + this._prime = BN.mont(this.__prime); + this._primeLen = prime.length; + this._pub = undefined; + this._priv = undefined; + this._primeCode = undefined; + if (malleable) { + this.setPublicKey = setPublicKey; + this.setPrivateKey = setPrivateKey; + } else { + this._primeCode = 8; + } +} +Object.defineProperty(DH.prototype, 'verifyError', { + enumerable: true, + get: function () { + if (typeof this._primeCode !== 'number') { + this._primeCode = checkPrime(this.__prime, this.__gen); + } + return this._primeCode; + } +}); +DH.prototype.generateKeys = function () { + if (!this._priv) { + this._priv = new BN(randomBytes(this._primeLen)); + } + this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(); + return this.getPublicKey(); +}; + +DH.prototype.computeSecret = function (other) { + other = new BN(other); + other = other.toRed(this._prime); + var secret = other.redPow(this._priv).fromRed(); + var out = new Buffer(secret.toArray()); + var prime = this.getPrime(); + if (out.length < prime.length) { + var front = new Buffer(prime.length - out.length); + front.fill(0); + out = Buffer.concat([front, out]); + } + return out; +}; + +DH.prototype.getPublicKey = function getPublicKey(enc) { + return formatReturnValue(this._pub, enc); +}; + +DH.prototype.getPrivateKey = function getPrivateKey(enc) { + return formatReturnValue(this._priv, enc); +}; + +DH.prototype.getPrime = function (enc) { + return formatReturnValue(this.__prime, enc); +}; + +DH.prototype.getGenerator = function (enc) { + return formatReturnValue(this._gen, enc); +}; + +DH.prototype.setGenerator = function (gen, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(gen)) { + gen = new Buffer(gen, enc); + } + this.__gen = gen; + this._gen = new BN(gen); + return this; +}; + +function formatReturnValue(bn, enc) { + var buf = new Buffer(bn.toArray()); + if (!enc) { + return buf; + } else { + return buf.toString(enc); + } +} + + +/***/ }), + +/***/ 3590: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/***/ "./node_modules/elliptic/lib/elliptic/curve/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/index.js ***! - \***********************************************************/ +var randomBytes = __webpack_require__(1798); +module.exports = findPrime; +findPrime.simpleSieve = simpleSieve; +findPrime.fermatTest = fermatTest; +var BN = __webpack_require__(3550); +var TWENTYFOUR = new BN(24); +var MillerRabin = __webpack_require__(3047); +var millerRabin = new MillerRabin(); +var ONE = new BN(1); +var TWO = new BN(2); +var FIVE = new BN(5); +var SIXTEEN = new BN(16); +var EIGHT = new BN(8); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var ELEVEN = new BN(11); +var FOUR = new BN(4); +var TWELVE = new BN(12); +var primes = null; + +function _getPrimes() { + if (primes !== null) + return primes; + + var limit = 0x100000; + var res = []; + res[0] = 2; + for (var i = 1, k = 3; k < limit; k += 2) { + var sqrt = Math.ceil(Math.sqrt(k)); + for (var j = 0; j < i && res[j] <= sqrt; j++) + if (k % res[j] === 0) + break; + + if (i !== j && res[j] <= sqrt) + continue; + + res[i++] = k; + } + primes = res; + return res; +} + +function simpleSieve(p) { + var primes = _getPrimes(); + + for (var i = 0; i < primes.length; i++) + if (p.modn(primes[i]) === 0) { + if (p.cmpn(primes[i]) === 0) { + return true; + } else { + return false; + } + } + + return true; +} + +function fermatTest(p) { + var red = BN.mont(p); + return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0; +} + +function findPrime(bits, gen) { + if (bits < 16) { + // this is what openssl does + if (gen === 2 || gen === 5) { + return new BN([0x8c, 0x7b]); + } else { + return new BN([0x8c, 0x27]); + } + } + gen = new BN(gen); + + var num, n2; + + while (true) { + num = new BN(randomBytes(Math.ceil(bits / 8))); + while (num.bitLength() > bits) { + num.ishrn(1); + } + if (num.isEven()) { + num.iadd(ONE); + } + if (!num.testn(1)) { + num.iadd(TWO); + } + if (!gen.cmp(TWO)) { + while (num.mod(TWENTYFOUR).cmp(ELEVEN)) { + num.iadd(FOUR); + } + } else if (!gen.cmp(FIVE)) { + while (num.mod(TEN).cmp(THREE)) { + num.iadd(FOUR); + } + } + n2 = num.shrn(1); + if (simpleSieve(n2) && simpleSieve(num) && + fermatTest(n2) && fermatTest(num) && + millerRabin.test(n2) && millerRabin.test(num)) { + return num; + } + } + +} + + +/***/ }), + +/***/ 6266: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("\n\nvar curve = exports;\n\ncurve.base = __webpack_require__(/*! ./base */ \"./node_modules/elliptic/lib/elliptic/curve/base.js\");\ncurve.short = __webpack_require__(/*! ./short */ \"./node_modules/elliptic/lib/elliptic/curve/short.js\");\ncurve.mont = __webpack_require__(/*! ./mont */ \"./node_modules/elliptic/lib/elliptic/curve/mont.js\");\ncurve.edwards = __webpack_require__(/*! ./edwards */ \"./node_modules/elliptic/lib/elliptic/curve/edwards.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/curve/index.js?"); + + +var elliptic = exports; + +elliptic.version = (__webpack_require__(8597)/* .version */ .i8); +elliptic.utils = __webpack_require__(953); +elliptic.rand = __webpack_require__(5923); +elliptic.curve = __webpack_require__(8254); +elliptic.curves = __webpack_require__(5427); + +// Protocols +elliptic.ec = __webpack_require__(7954); +elliptic.eddsa = __webpack_require__(5980); + /***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/curve/mont.js": -/*!**********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/mont.js ***! - \**********************************************************/ +/***/ 4918: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nvar Base = __webpack_require__(/*! ./base */ \"./node_modules/elliptic/lib/elliptic/curve/base.js\");\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\n\nfunction MontCurve(conf) {\n Base.call(this, 'mont', conf);\n\n this.a = new BN(conf.a, 16).toRed(this.red);\n this.b = new BN(conf.b, 16).toRed(this.red);\n this.i4 = new BN(4).toRed(this.red).redInvm();\n this.two = new BN(2).toRed(this.red);\n this.a24 = this.i4.redMul(this.a.redAdd(this.two));\n}\ninherits(MontCurve, Base);\nmodule.exports = MontCurve;\n\nMontCurve.prototype.validate = function validate(point) {\n var x = point.normalize().x;\n var x2 = x.redSqr();\n var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);\n var y = rhs.redSqrt();\n\n return y.redSqr().cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, z) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && z === null) {\n this.x = this.curve.one;\n this.z = this.curve.zero;\n } else {\n this.x = new BN(x, 16);\n this.z = new BN(z, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n }\n}\ninherits(Point, Base.BasePoint);\n\nMontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n return this.point(utils.toArray(bytes, enc), 1);\n};\n\nMontCurve.prototype.point = function point(x, z) {\n return new Point(this, x, z);\n};\n\nMontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n};\n\nPoint.prototype.precompute = function precompute() {\n // No-op\n};\n\nPoint.prototype._encode = function _encode() {\n return this.getX().toArray('be', this.curve.p.byteLength());\n};\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1] || curve.one);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\nPoint.prototype.dbl = function dbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3\n // 2M + 2S + 4A\n\n // A = X1 + Z1\n var a = this.x.redAdd(this.z);\n // AA = A^2\n var aa = a.redSqr();\n // B = X1 - Z1\n var b = this.x.redSub(this.z);\n // BB = B^2\n var bb = b.redSqr();\n // C = AA - BB\n var c = aa.redSub(bb);\n // X3 = AA * BB\n var nx = aa.redMul(bb);\n // Z3 = C * (BB + A24 * C)\n var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.add = function add() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.diffAdd = function diffAdd(p, diff) {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3\n // 4M + 2S + 6A\n\n // A = X2 + Z2\n var a = this.x.redAdd(this.z);\n // B = X2 - Z2\n var b = this.x.redSub(this.z);\n // C = X3 + Z3\n var c = p.x.redAdd(p.z);\n // D = X3 - Z3\n var d = p.x.redSub(p.z);\n // DA = D * A\n var da = d.redMul(a);\n // CB = C * B\n var cb = c.redMul(b);\n // X5 = Z1 * (DA + CB)^2\n var nx = diff.z.redMul(da.redAdd(cb).redSqr());\n // Z5 = X1 * (DA - CB)^2\n var nz = diff.x.redMul(da.redISub(cb).redSqr());\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.mul = function mul(k) {\n var t = k.clone();\n var a = this; // (N / 2) * Q + Q\n var b = this.curve.point(null, null); // (N / 2) * Q\n var c = this; // Q\n\n for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))\n bits.push(t.andln(1));\n\n for (var i = bits.length - 1; i >= 0; i--) {\n if (bits[i] === 0) {\n // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q\n a = a.diffAdd(b, c);\n // N * Q = 2 * ((N / 2) * Q + Q))\n b = b.dbl();\n } else {\n // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)\n b = a.diffAdd(b, c);\n // N * Q + Q = 2 * ((N / 2) * Q + Q)\n a = a.dbl();\n }\n }\n return b;\n};\n\nPoint.prototype.mulAdd = function mulAdd() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.jumlAdd = function jumlAdd() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.eq = function eq(other) {\n return this.getX().cmp(other.getX()) === 0;\n};\n\nPoint.prototype.normalize = function normalize() {\n this.x = this.x.redMul(this.z.redInvm());\n this.z = this.curve.one;\n return this;\n};\n\nPoint.prototype.getX = function getX() {\n // Normalize coordinates\n this.normalize();\n\n return this.x.fromRed();\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/curve/mont.js?"); -/***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/curve/short.js": -/*!***********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/short.js ***! - \***********************************************************/ +var BN = __webpack_require__(3550); +var utils = __webpack_require__(953); +var getNAF = utils.getNAF; +var getJSF = utils.getJSF; +var assert = utils.assert; + +function BaseCurve(type, conf) { + this.type = type; + this.p = new BN(conf.p, 16); + + // Use Montgomery, when there is no fast reduction for the prime + this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); + + // Useful for many curves + this.zero = new BN(0).toRed(this.red); + this.one = new BN(1).toRed(this.red); + this.two = new BN(2).toRed(this.red); + + // Curve configuration, optional + this.n = conf.n && new BN(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + + // Temporary arrays + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); + + this._bitLength = this.n ? this.n.bitLength() : 0; + + // Generalized Greg Maxwell's trick + var adjustCount = this.n && this.p.div(this.n); + if (!adjustCount || adjustCount.cmpn(100) > 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} +module.exports = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + assert(p.precomputed); + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1, this._bitLength); + var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; + + // Translate into more windowed form + var repr = []; + var j; + var nafW; + for (j = 0; j < naf.length; j += doubles.step) { + nafW = 0; + for (var l = j + doubles.step - 1; l >= j; l--) + nafW = (nafW << 1) + naf[l]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (j = 0; j < repr.length; j++) { + nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w, this._bitLength); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var l = 0; i >= 0 && naf[i] === 0; i--) + l++; + if (i >= 0) + l++; + acc = acc.dblp(l); + + if (i < 0) + break; + var z = naf[i]; + assert(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len, + jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + var i; + var j; + var p; + for (i = 0; i < len; i++) { + p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); + naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b], /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3, /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (j = 0; j < len; j++) { + var z = tmp[j]; + p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (i = 0; i < len; i++) + wnd[i] = null; + + if (jacobianResult) + return acc; + else + return acc.toP(); +}; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} +BaseCurve.BasePoint = BasePoint; + +BasePoint.prototype.eq = function eq(/*other*/) { + throw new Error('Not implemented'); +}; + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + bytes = utils.toArray(bytes, enc); + + var len = this.p.byteLength(); + + // uncompressed, hybrid-odd, hybrid-even + if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && + bytes.length - 1 === 2 * len) { + if (bytes[0] === 0x06) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 0x07) + assert(bytes[bytes.length - 1] % 2 === 1); + + var res = this.point(bytes.slice(1, 1 + len), + bytes.slice(1 + len, 1 + 2 * len)); + + return res; + } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && + bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); + } + throw new Error('Unknown point format'); +}; + +BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); +}; + +BasePoint.prototype._encode = function _encode(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray('be', len); + + if (compact) + return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); + + return [ 0x04 ].concat(x, this.getY().toArray('be', len)); +}; + +BasePoint.prototype.encode = function encode(enc, compact) { + return utils.encode(this._encode(compact), enc); +}; + +BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null, + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) + return false; + + var doubles = this.precomputed.doubles; + if (!doubles) + return false; + + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles, + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res, + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; + + +/***/ }), + +/***/ 1138: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nvar Base = __webpack_require__(/*! ./base */ \"./node_modules/elliptic/lib/elliptic/curve/base.js\");\n\nvar assert = utils.assert;\n\nfunction ShortCurve(conf) {\n Base.call(this, 'short', conf);\n\n this.a = new BN(conf.a, 16).toRed(this.red);\n this.b = new BN(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits(ShortCurve, Base);\nmodule.exports = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new BN(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new BN(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16),\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis,\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : BN.mont(num);\n var tinv = new BN(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n\n var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new BN(1);\n var y1 = new BN(0);\n var x2 = new BN(0);\n var y2 = new BN(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n var r;\n var x;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n r = v.sub(q.mul(u));\n x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.negative) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.negative) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 },\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd =\n function _endoWnafMulAdd(points, coeffs, jacobianResult) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.negative) {\n split.k1.ineg();\n p = p.neg(true);\n }\n if (split.k2.negative) {\n split.k2.ineg();\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n };\n\nfunction Point(curve, x, y, isRed) {\n Base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits(Point, Base.BasePoint);\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n var endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul),\n },\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1),\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1),\n },\n } ];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point)),\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point)),\n },\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new BN(k, 16);\n if (this.isInfinity())\n return this;\n else if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs, true);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2, true);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n var negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate),\n },\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n Base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new BN(0);\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = new BN(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits(JPoint, Base.BasePoint);\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new BN(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.eqXToP = function eqXToP(x) {\n var zs = this.z.redSqr();\n var rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(zs);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/curve/short.js?"); -/***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/curves.js": -/*!******************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curves.js ***! - \******************************************************/ +var utils = __webpack_require__(953); +var BN = __webpack_require__(3550); +var inherits = __webpack_require__(5717); +var Base = __webpack_require__(4918); + +var assert = utils.assert; + +function EdwardsCurve(conf) { + // NOTE: Important as we are creating point in Base.call() + this.twisted = (conf.a | 0) !== 1; + this.mOneA = this.twisted && (conf.a | 0) === -1; + this.extended = this.mOneA; + + Base.call(this, 'edwards', conf); + + this.a = new BN(conf.a, 16).umod(this.red.m); + this.a = this.a.toRed(this.red); + this.c = new BN(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new BN(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = (conf.c | 0) === 1; +} +inherits(EdwardsCurve, Base); +module.exports = EdwardsCurve; + +EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); +}; + +EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); +}; + +// Just for compatibility with Short curve +EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); +}; + +EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + + var y2 = rhs.redMul(lhs.redInvm()); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { + y = new BN(y, 16); + if (!y.red) + y = y.toRed(this.red); + + // x^2 = (y^2 - c^2) / (c^2 d y^2 - a) + var y2 = y.redSqr(); + var lhs = y2.redSub(this.c2); + var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a); + var x2 = lhs.redMul(rhs.redInvm()); + + if (x2.cmp(this.zero) === 0) { + if (odd) + throw new Error('invalid point'); + else + return this.point(this.zero, y); + } + + var x = x2.redSqrt(); + if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + if (x.fromRed().isOdd() !== odd) + x = x.redNeg(); + + return this.point(x, y); +}; + +EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + + // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) + point.normalize(); + + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + + return lhs.cmp(rhs) === 0; +}; + +function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = z ? new BN(z, 16) : this.curve.one; + this.t = t && new BN(t, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + + // Use extended coordinates + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } +} +inherits(Point, Base.BasePoint); + +EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.x.cmpn(0) === 0 && + (this.y.cmp(this.z) === 0 || + (this.zOne && this.y.cmp(this.curve.c) === 0)); +}; + +Point.prototype._extDbl = function _extDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #doubling-dbl-2008-hwcd + // 4M + 4S + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = 2 * Z1^2 + var c = this.z.redSqr(); + c = c.redIAdd(c); + // D = a * A + var d = this.curve._mulA(a); + // E = (X1 + Y1)^2 - A - B + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + // G = D + B + var g = d.redAdd(b); + // F = G - C + var f = g.redSub(c); + // H = D - B + var h = d.redSub(b); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projDbl = function _projDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #doubling-dbl-2008-bbjlp + // #doubling-dbl-2007-bl + // and others + // Generally 3M + 4S or 2M + 4S + + // B = (X1 + Y1)^2 + var b = this.x.redAdd(this.y).redSqr(); + // C = X1^2 + var c = this.x.redSqr(); + // D = Y1^2 + var d = this.y.redSqr(); + + var nx; + var ny; + var nz; + var e; + var h; + var j; + if (this.curve.twisted) { + // E = a * C + e = this.curve._mulA(c); + // F = E + D + var f = e.redAdd(d); + if (this.zOne) { + // X3 = (B - C - D) * (F - 2) + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F^2 - 2 * F + nz = f.redSqr().redSub(f).redSub(f); + } else { + // H = Z1^2 + h = this.z.redSqr(); + // J = F - 2 * H + j = f.redSub(h).redISub(h); + // X3 = (B-C-D)*J + nx = b.redSub(c).redISub(d).redMul(j); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F * J + nz = f.redMul(j); + } + } else { + // E = C + D + e = c.redAdd(d); + // H = (c * Z1)^2 + h = this.curve._mulC(this.z).redSqr(); + // J = E - 2 * H + j = e.redSub(h).redSub(h); + // X3 = c * (B - E) * J + nx = this.curve._mulC(b.redISub(e)).redMul(j); + // Y3 = c * E * (C - D) + ny = this.curve._mulC(e).redMul(c.redISub(d)); + // Z3 = E * J + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + // Double in extended coordinates + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); +}; + +Point.prototype._extAdd = function _extAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #addition-add-2008-hwcd-3 + // 8M + + // A = (Y1 - X1) * (Y2 - X2) + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + // B = (Y1 + X1) * (Y2 + X2) + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + // C = T1 * k * T2 + var c = this.t.redMul(this.curve.dd).redMul(p.t); + // D = Z1 * 2 * Z2 + var d = this.z.redMul(p.z.redAdd(p.z)); + // E = B - A + var e = b.redSub(a); + // F = D - C + var f = d.redSub(c); + // G = D + C + var g = d.redAdd(c); + // H = B + A + var h = b.redAdd(a); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projAdd = function _projAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #addition-add-2008-bbjlp + // #addition-add-2007-bl + // 10M + 1S + + // A = Z1 * Z2 + var a = this.z.redMul(p.z); + // B = A^2 + var b = a.redSqr(); + // C = X1 * X2 + var c = this.x.redMul(p.x); + // D = Y1 * Y2 + var d = this.y.redMul(p.y); + // E = d * C * D + var e = this.curve.d.redMul(c).redMul(d); + // F = B - E + var f = b.redSub(e); + // G = B + E + var g = b.redAdd(e); + // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + var ny; + var nz; + if (this.curve.twisted) { + // Y3 = A * G * (D - a * C) + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + // Z3 = F * G + nz = f.redMul(g); + } else { + // Y3 = A * G * (D - C) + ny = a.redMul(g).redMul(d.redSub(c)); + // Z3 = c * F * G + nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); +}; + +Point.prototype.mul = function mul(k) { + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true); +}; + +Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + + // Normalize coordinates + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; +}; + +Point.prototype.neg = function neg() { + return this.curve.point(this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg()); +}; + +Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); +}; + +Point.prototype.eq = function eq(other) { + return this === other || + this.getX().cmp(other.getX()) === 0 && + this.getY().cmp(other.getY()) === 0; +}; + +Point.prototype.eqXToP = function eqXToP(x) { + var rx = x.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(this.z); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } +}; + +// Compatibility with BaseCurve +Point.prototype.toP = Point.prototype.normalize; +Point.prototype.mixedAdd = Point.prototype.add; + + +/***/ }), + +/***/ 8254: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("\n\nvar curves = exports;\n\nvar hash = __webpack_require__(/*! hash.js */ \"./node_modules/hash.js/lib/hash.js\");\nvar curve = __webpack_require__(/*! ./curve */ \"./node_modules/elliptic/lib/elliptic/curve/index.js\");\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\n\nvar assert = utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new curve.edwards(options);\n else\n this.curve = new curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve,\n });\n return curve;\n },\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',\n ],\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34',\n ],\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5',\n ],\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f',\n ],\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650',\n ],\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9',\n ],\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658',\n ],\n});\n\nvar pre;\ntry {\n pre = __webpack_require__(/*! ./precomputed/secp256k1 */ \"./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js\");\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3',\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15',\n },\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre,\n ],\n});\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/curves.js?"); -/***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/ec/index.js": -/*!********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/ec/index.js ***! - \********************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +var curve = exports; + +curve.base = __webpack_require__(4918); +curve.short = __webpack_require__(6673); +curve.mont = __webpack_require__(2881); +curve.edwards = __webpack_require__(1138); -"use strict"; -eval("\n\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar HmacDRBG = __webpack_require__(/*! hmac-drbg */ \"./node_modules/hmac-drbg/lib/hmac-drbg.js\");\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar curves = __webpack_require__(/*! ../curves */ \"./node_modules/elliptic/lib/elliptic/curves.js\");\nvar rand = __webpack_require__(/*! brorand */ \"./src/fallback/unity/brorand.js\");\nvar assert = utils.assert;\n\nvar KeyPair = __webpack_require__(/*! ./key */ \"./node_modules/elliptic/lib/elliptic/ec/key.js\");\nvar Signature = __webpack_require__(/*! ./signature */ \"./node_modules/elliptic/lib/elliptic/ec/signature.js\");\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert(Object.prototype.hasOwnProperty.call(curves, options),\n 'Unknown curve ' + options);\n\n options = curves[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof curves.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.ushrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nmodule.exports = EC;\n\nEC.prototype.keyPair = function keyPair(options) {\n return new KeyPair(this, options);\n};\n\nEC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {\n return KeyPair.fromPrivate(this, priv, enc);\n};\n\nEC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {\n return KeyPair.fromPublic(this, pub, enc);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new HmacDRBG({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || 'utf8',\n nonce: this.n.toArray(),\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new BN(2));\n for (;;) {\n var priv = new BN(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyFromPrivate(priv);\n }\n};\n\nEC.prototype._truncateToN = function _truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.ushrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, enc, options) {\n if (typeof enc === 'object') {\n options = enc;\n enc = null;\n }\n if (!options)\n options = {};\n\n key = this.keyFromPrivate(key, enc);\n msg = this._truncateToN(new BN(msg, 16));\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray('be', bytes);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray('be', bytes);\n\n // Instantiate Hmac_DRBG\n var drbg = new HmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new BN(1));\n\n for (var iter = 0; ; iter++) {\n var k = options.k ?\n options.k(iter) :\n new BN(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var kpX = kp.getX();\n var r = kpX.umod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));\n s = s.umod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |\n (kpX.cmp(r) !== 0 ? 2 : 0);\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0) {\n s = this.n.sub(s);\n recoveryParam ^= 1;\n }\n\n return new Signature({ r: r, s: s, recoveryParam: recoveryParam });\n }\n};\n\nEC.prototype.verify = function verify(msg, signature, key, enc) {\n msg = this._truncateToN(new BN(msg, 16));\n key = this.keyFromPublic(key, enc);\n signature = new Signature(signature, 'hex');\n\n // Perform primitive values validation\n var r = signature.r;\n var s = signature.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).umod(this.n);\n var u2 = sinv.mul(r).umod(this.n);\n var p;\n\n if (!this.curve._maxwellTrick) {\n p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().umod(this.n).cmp(r) === 0;\n }\n\n // NOTE: Greg Maxwell's trick, inspired by:\n // https://git.io/vad3K\n\n p = this.g.jmulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n // Compare `p.x` of Jacobian point with `r`,\n // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the\n // inverse of `p.z^2`\n return p.eqXToP(r);\n};\n\nEC.prototype.recoverPubKey = function(msg, signature, j, enc) {\n assert((3 & j) === j, 'The recovery param is more than two bits');\n signature = new Signature(signature, enc);\n\n var n = this.n;\n var e = new BN(msg);\n var r = signature.r;\n var s = signature.s;\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = j & 1;\n var isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error('Unable to find sencond key candinate');\n\n // 1.1. Let x = r + jn.\n if (isSecondKey)\n r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);\n else\n r = this.curve.pointFromX(r, isYOdd);\n\n var rInv = signature.r.invm(n);\n var s1 = n.sub(e).mul(rInv).umod(n);\n var s2 = s.mul(rInv).umod(n);\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n return this.g.mulAdd(s1, r, s2);\n};\n\nEC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {\n signature = new Signature(signature, enc);\n if (signature.recoveryParam !== null)\n return signature.recoveryParam;\n\n for (var i = 0; i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature, i);\n } catch (e) {\n continue;\n }\n\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error('Unable to find valid recovery factor');\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/ec/index.js?"); /***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/ec/key.js": -/*!******************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/ec/key.js ***! - \******************************************************/ +/***/ 2881: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar assert = utils.assert;\n\nfunction KeyPair(ec, options) {\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(ec, { priv: ..., pub: ... })\n if (options.priv)\n this._importPrivate(options.priv, options.privEnc);\n if (options.pub)\n this._importPublic(options.pub, options.pubEnc);\n}\nmodule.exports = KeyPair;\n\nKeyPair.fromPublic = function fromPublic(ec, pub, enc) {\n if (pub instanceof KeyPair)\n return pub;\n\n return new KeyPair(ec, {\n pub: pub,\n pubEnc: enc,\n });\n};\n\nKeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {\n if (priv instanceof KeyPair)\n return priv;\n\n return new KeyPair(ec, {\n priv: priv,\n privEnc: enc,\n });\n};\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n if (!enc)\n return this.pub;\n\n return this.pub.encode(enc, compact);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key, enc) {\n this.priv = new BN(key, enc || 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.umod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key, enc) {\n if (key.x || key.y) {\n // Montgomery points only have an `x` coordinate.\n // Weierstrass/Edwards points on the other hand have both `x` and\n // `y` coordinates.\n if (this.ec.curve.type === 'mont') {\n assert(key.x, 'Need x coordinate');\n } else if (this.ec.curve.type === 'short' ||\n this.ec.curve.type === 'edwards') {\n assert(key.x && key.y, 'Need both x and y coordinate');\n }\n this.pub = this.ec.curve.point(key.x, key.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key, enc);\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n if(!pub.validate()) {\n assert(pub.validate(), 'public point not validated');\n }\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/ec/key.js?"); -/***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/ec/signature.js": -/*!************************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/ec/signature.js ***! - \************************************************************/ +var BN = __webpack_require__(3550); +var inherits = __webpack_require__(5717); +var Base = __webpack_require__(4918); + +var utils = __webpack_require__(953); + +function MontCurve(conf) { + Base.call(this, 'mont', conf); + + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.i4 = new BN(4).toRed(this.red).redInvm(); + this.two = new BN(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +} +inherits(MontCurve, Base); +module.exports = MontCurve; + +MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + + return y.redSqr().cmp(rhs) === 0; +}; + +function Point(curve, x, z) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new BN(x, 16); + this.z = new BN(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } +} +inherits(Point, Base.BasePoint); + +MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + return this.point(utils.toArray(bytes, enc), 1); +}; + +MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); +}; + +MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +Point.prototype.precompute = function precompute() { + // No-op +}; + +Point.prototype._encode = function _encode() { + return this.getX().toArray('be', this.curve.p.byteLength()); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +Point.prototype.dbl = function dbl() { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 + // 2M + 2S + 4A + + // A = X1 + Z1 + var a = this.x.redAdd(this.z); + // AA = A^2 + var aa = a.redSqr(); + // B = X1 - Z1 + var b = this.x.redSub(this.z); + // BB = B^2 + var bb = b.redSqr(); + // C = AA - BB + var c = aa.redSub(bb); + // X3 = AA * BB + var nx = aa.redMul(bb); + // Z3 = C * (BB + A24 * C) + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); +}; + +Point.prototype.add = function add() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.diffAdd = function diffAdd(p, diff) { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 + // 4M + 2S + 6A + + // A = X2 + Z2 + var a = this.x.redAdd(this.z); + // B = X2 - Z2 + var b = this.x.redSub(this.z); + // C = X3 + Z3 + var c = p.x.redAdd(p.z); + // D = X3 - Z3 + var d = p.x.redSub(p.z); + // DA = D * A + var da = d.redMul(a); + // CB = C * B + var cb = c.redMul(b); + // X5 = Z1 * (DA + CB)^2 + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + // Z5 = X1 * (DA - CB)^2 + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); +}; + +Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; // (N / 2) * Q + Q + var b = this.curve.point(null, null); // (N / 2) * Q + var c = this; // Q + + for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) + bits.push(t.andln(1)); + + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q + a = a.diffAdd(b, c); + // N * Q = 2 * ((N / 2) * Q + Q)) + b = b.dbl(); + } else { + // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) + b = a.diffAdd(b, c); + // N * Q + Q = 2 * ((N / 2) * Q + Q) + a = a.dbl(); + } + } + return b; +}; + +Point.prototype.mulAdd = function mulAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.jumlAdd = function jumlAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.eq = function eq(other) { + return this.getX().cmp(other.getX()) === 0; +}; + +Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; +}; + +Point.prototype.getX = function getX() { + // Normalize coordinates + this.normalize(); + + return this.x.fromRed(); +}; + + +/***/ }), + +/***/ 6673: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar assert = utils.assert;\n\nfunction Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n\n if (this._importDER(options, enc))\n return;\n\n assert(options.r && options.s, 'Signature without r or s');\n this.r = new BN(options.r, 16);\n this.s = new BN(options.s, 16);\n if (options.recoveryParam === undefined)\n this.recoveryParam = null;\n else\n this.recoveryParam = options.recoveryParam;\n}\nmodule.exports = Signature;\n\nfunction Position() {\n this.place = 0;\n}\n\nfunction getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 0x80)) {\n return initial;\n }\n var octetLen = initial & 0xf;\n\n // Indefinite length or overflow\n if (octetLen === 0 || octetLen > 4) {\n return false;\n }\n\n var val = 0;\n for (var i = 0, off = p.place; i < octetLen; i++, off++) {\n val <<= 8;\n val |= buf[off];\n val >>>= 0;\n }\n\n // Leading zeroes\n if (val <= 0x7f) {\n return false;\n }\n\n p.place = off;\n return val;\n}\n\nfunction rmPadding(buf) {\n var i = 0;\n var len = buf.length - 1;\n while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {\n i++;\n }\n if (i === 0) {\n return buf;\n }\n return buf.slice(i);\n}\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils.toArray(data, enc);\n var p = new Position();\n if (data[p.place++] !== 0x30) {\n return false;\n }\n var len = getLength(data, p);\n if (len === false) {\n return false;\n }\n if ((len + p.place) !== data.length) {\n return false;\n }\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var rlen = getLength(data, p);\n if (rlen === false) {\n return false;\n }\n var r = data.slice(p.place, rlen + p.place);\n p.place += rlen;\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var slen = getLength(data, p);\n if (slen === false) {\n return false;\n }\n if (data.length !== slen + p.place) {\n return false;\n }\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0) {\n if (r[1] & 0x80) {\n r = r.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n if (s[0] === 0) {\n if (s[1] & 0x80) {\n s = s.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n\n this.r = new BN(r);\n this.s = new BN(s);\n this.recoveryParam = null;\n\n return true;\n};\n\nfunction constructLength(arr, len) {\n if (len < 0x80) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n arr.push(octets | 0x80);\n while (--octets) {\n arr.push((len >>> (octets << 3)) & 0xff);\n }\n arr.push(len);\n}\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n r = rmPadding(r);\n s = rmPadding(s);\n\n while (!s[0] && !(s[1] & 0x80)) {\n s = s.slice(1);\n }\n var arr = [ 0x02 ];\n constructLength(arr, r.length);\n arr = arr.concat(r);\n arr.push(0x02);\n constructLength(arr, s.length);\n var backHalf = arr.concat(s);\n var res = [ 0x30 ];\n constructLength(res, backHalf.length);\n res = res.concat(backHalf);\n return utils.encode(res, enc);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/ec/signature.js?"); -/***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/eddsa/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/eddsa/index.js ***! - \***********************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +var utils = __webpack_require__(953); +var BN = __webpack_require__(3550); +var inherits = __webpack_require__(5717); +var Base = __webpack_require__(4918); + +var assert = utils.assert; + +function ShortCurve(conf) { + Base.call(this, 'short', conf); + + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; + + // If the curve is endomorphic, precalculate beta and lambda + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +inherits(ShortCurve, Base); +module.exports = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + + // Compute beta and lambda, that lambda * P = (beta * Px; Py) + var beta; + var lambda; + if (conf.beta) { + beta = new BN(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + // Choose the smallest beta + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new BN(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + + // Get basis vectors, used for balanced length-two representation + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new BN(vec.a, 16), + b: new BN(vec.b, 16), + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis, + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : BN.mont(num); + var tinv = new BN(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + + var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv); + + var l1 = ntinv.redAdd(s).fromRed(); + var l2 = ntinv.redSub(s).fromRed(); + return [ l1, l2 ]; +}; + +ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + + // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + var u = lambda; + var v = this.n.clone(); + var x1 = new BN(1); + var y1 = new BN(0); + var x2 = new BN(0); + var y2 = new BN(1); + + // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + var a0; + var b0; + // First vector + var a1; + var b1; + // Second vector + var a2; + var b2; + + var prevR; + var i = 0; + var r; + var x; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + r = v.sub(q.mul(u)); + x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + prevR = r; + + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r.neg(); + b2 = x; + + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + + // Normalize signs + if (a1.negative) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.negative) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 }, + ]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + + // Calculate answer + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1: k1, k2: k2 }; +}; + +ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) + return true; + + var x = point.x; + var y = point.y; + + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = + function _endoWnafMulAdd(points, coeffs, jacobianResult) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + var p = points[i]; + var beta = p._getBeta(); + + if (split.k1.negative) { + split.k1.ineg(); + p = p.neg(true); + } + if (split.k2.negative) { + split.k2.ineg(); + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); + + // Clean-up references to points and coefficients + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; + }; + +function Point(curve, x, y, isRed) { + Base.BasePoint.call(this, curve, 'affine'); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + // Force redgomery representation when loading from JSON + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +inherits(Point, Base.BasePoint); + +ShortCurve.prototype.point = function point(x, y, isRed) { + return new Point(this, x, y, isRed); +}; + +ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); +}; + +Point.prototype._getBeta = function _getBeta() { + if (!this.curve.endo) + return; + + var pre = this.precomputed; + if (pre && pre.beta) + return pre.beta; + + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (pre) { + var curve = this.curve; + var endoMul = function(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + }; + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul), + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul), + }, + }; + } + return beta; +}; + +Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) + return [ this.x, this.y ]; + + return [ this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1), + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1), + }, + } ]; +}; + +Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === 'string') + obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) + return res; + + function obj2point(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [ res ].concat(pre.doubles.points.map(obj2point)), + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [ res ].concat(pre.naf.points.map(obj2point)), + }, + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) + return p; + + // P + O = P + if (p.inf) + return this; + + // P + P = 2P + if (this.eq(p)) + return this.dbl(); + + // P + (-P) = O + if (this.neg().eq(p)) + return this.curve.point(null, null); + + // P + Q = O + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + + // 2P = O + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + + var a = this.curve.a; + + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new BN(k, 16); + if (this.isInfinity()) + return this; + else if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else if (this.curve.endo) + return this.curve._endoWnafMulAdd([ this ], [ k ]); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs, true); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2, true); +}; + +Point.prototype.eq = function eq(p) { + return this === p || + this.inf === p.inf && + (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); +}; + +Point.prototype.neg = function neg(_precompute) { + if (this.inf) + return this; + + var res = this.curve.point(this.x, this.y.redNeg()); + if (_precompute && this.precomputed) { + var pre = this.precomputed; + var negate = function(p) { + return p.neg(); + }; + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate), + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate), + }, + }; + } + return res; +}; + +Point.prototype.toJ = function toJ() { + if (this.inf) + return this.curve.jpoint(null, null, null); + + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; +}; + +function JPoint(curve, x, y, z) { + Base.BasePoint.call(this, curve, 'jacobian'); + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new BN(0); + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = new BN(z, 16); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + + this.zOne = this.z === this.curve.one; +} +inherits(JPoint, Base.BasePoint); + +ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); +}; + +JPoint.prototype.toP = function toP() { + if (this.isInfinity()) + return this.curve.point(null, null); + + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + + return this.curve.point(ax, ay); +}; + +JPoint.prototype.neg = function neg() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; + +JPoint.prototype.add = function add(p) { + // O + P = P + if (this.isInfinity()) + return p; + + // P + O = P + if (p.isInfinity()) + return this; + + // 12M + 4S + 7A + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) + return p.toJ(); + + // P + O = P + if (p.isInfinity()) + return this; + + // 8M + 3S + 7A + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + + var i; + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + for (i = 0; i < pow; i++) + r = r.dbl(); + return r; + } + + // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + var a = this.curve.a; + var tinv = this.curve.tinv; + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + // Reuse results + var jyd = jy.redAdd(jy); + for (i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) + jz4 = jz4.redMul(jyd4); + + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 14A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // T = M ^ 2 - 2*S + var t = m.redSqr().redISub(s).redISub(s); + + // 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2*Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-dbl-2009-l + // 2M + 5S + 13A + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = B^2 + var c = b.redSqr(); + // D = 2 * ((X1 + B)^2 - A - C) + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + // E = 3 * A + var e = a.redAdd(a).redIAdd(a); + // F = E^2 + var f = e.redSqr(); + + // 8 * C + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + + // X3 = F - 2 * D + nx = f.redISub(d).redISub(d); + // Y3 = E * (D - X3) - 8 * C + ny = e.redMul(d.redISub(nx)).redISub(c8); + // Z3 = 2 * Y1 * Z1 + nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 15A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + // T = M^2 - 2 * S + var t = m.redSqr().redISub(s).redISub(s); + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2 * Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + + // delta = Z1^2 + var delta = this.z.redSqr(); + // gamma = Y1^2 + var gamma = this.y.redSqr(); + // beta = X1 * gamma + var beta = this.x.redMul(gamma); + // alpha = 3 * (X1 - delta) * (X1 + delta) + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + // X3 = alpha^2 - 8 * beta + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + // Z3 = (Y1 + Z1)^2 - gamma - delta + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; + + // 4M + 6S + 10A + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // ZZ = Z1^2 + var zz = this.z.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // M = 3 * XX + a * ZZ2; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // MM = M^2 + var mm = m.redSqr(); + // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); + // EE = E^2 + var ee = e.redSqr(); + // T = 16*YYYY + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + // U = (M + E)^2 - MM - EE - T + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + // X3 = 4 * (X1 * EE - 4 * YY * U) + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + // Z3 = (Z1 + E)^2 - ZZ - EE + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new BN(k, kbase); + + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') + return this.eq(p.toJ()); + + if (this === p) + return true; + + // x1 * z2^2 == x2 * z1^2 + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + + // y1 * z2^3 == y2 * z1^3 + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.eqXToP = function eqXToP(x) { + var zs = this.z.redSqr(); + var rx = x.toRed(this.curve.red).redMul(zs); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(zs); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + + +/***/ }), + +/***/ 5427: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("\n\nvar hash = __webpack_require__(/*! hash.js */ \"./node_modules/hash.js/lib/hash.js\");\nvar curves = __webpack_require__(/*! ../curves */ \"./node_modules/elliptic/lib/elliptic/curves.js\");\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar assert = utils.assert;\nvar parseBytes = utils.parseBytes;\nvar KeyPair = __webpack_require__(/*! ./key */ \"./node_modules/elliptic/lib/elliptic/eddsa/key.js\");\nvar Signature = __webpack_require__(/*! ./signature */ \"./node_modules/elliptic/lib/elliptic/eddsa/signature.js\");\n\nfunction EDDSA(curve) {\n assert(curve === 'ed25519', 'only tested with ed25519 so far');\n\n if (!(this instanceof EDDSA))\n return new EDDSA(curve);\n\n curve = curves[curve].curve;\n this.curve = curve;\n this.g = curve.g;\n this.g.precompute(curve.n.bitLength() + 1);\n\n this.pointClass = curve.point().constructor;\n this.encodingLength = Math.ceil(curve.n.bitLength() / 8);\n this.hash = hash.sha512;\n}\n\nmodule.exports = EDDSA;\n\n/**\n* @param {Array|String} message - message bytes\n* @param {Array|String|KeyPair} secret - secret bytes or a keypair\n* @returns {Signature} - signature\n*/\nEDDSA.prototype.sign = function sign(message, secret) {\n message = parseBytes(message);\n var key = this.keyFromSecret(secret);\n var r = this.hashInt(key.messagePrefix(), message);\n var R = this.g.mul(r);\n var Rencoded = this.encodePoint(R);\n var s_ = this.hashInt(Rencoded, key.pubBytes(), message)\n .mul(key.priv());\n var S = r.add(s_).umod(this.curve.n);\n return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });\n};\n\n/**\n* @param {Array} message - message bytes\n* @param {Array|String|Signature} sig - sig bytes\n* @param {Array|String|Point|KeyPair} pub - public key\n* @returns {Boolean} - true if public key matches sig of message\n*/\nEDDSA.prototype.verify = function verify(message, sig, pub) {\n message = parseBytes(message);\n sig = this.makeSignature(sig);\n var key = this.keyFromPublic(pub);\n var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);\n var SG = this.g.mul(sig.S());\n var RplusAh = sig.R().add(key.pub().mul(h));\n return RplusAh.eq(SG);\n};\n\nEDDSA.prototype.hashInt = function hashInt() {\n var hash = this.hash();\n for (var i = 0; i < arguments.length; i++)\n hash.update(arguments[i]);\n return utils.intFromLE(hash.digest()).umod(this.curve.n);\n};\n\nEDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {\n return KeyPair.fromPublic(this, pub);\n};\n\nEDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {\n return KeyPair.fromSecret(this, secret);\n};\n\nEDDSA.prototype.makeSignature = function makeSignature(sig) {\n if (sig instanceof Signature)\n return sig;\n return new Signature(this, sig);\n};\n\n/**\n* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2\n*\n* EDDSA defines methods for encoding and decoding points and integers. These are\n* helper convenience methods, that pass along to utility functions implied\n* parameters.\n*\n*/\nEDDSA.prototype.encodePoint = function encodePoint(point) {\n var enc = point.getY().toArray('le', this.encodingLength);\n enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;\n return enc;\n};\n\nEDDSA.prototype.decodePoint = function decodePoint(bytes) {\n bytes = utils.parseBytes(bytes);\n\n var lastIx = bytes.length - 1;\n var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);\n var xIsOdd = (bytes[lastIx] & 0x80) !== 0;\n\n var y = utils.intFromLE(normed);\n return this.curve.pointFromY(y, xIsOdd);\n};\n\nEDDSA.prototype.encodeInt = function encodeInt(num) {\n return num.toArray('le', this.encodingLength);\n};\n\nEDDSA.prototype.decodeInt = function decodeInt(bytes) {\n return utils.intFromLE(bytes);\n};\n\nEDDSA.prototype.isPoint = function isPoint(val) {\n return val instanceof this.pointClass;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/eddsa/index.js?"); -/***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/eddsa/key.js": -/*!*********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/eddsa/key.js ***! - \*********************************************************/ +var curves = exports; + +var hash = __webpack_require__(3715); +var curve = __webpack_require__(8254); +var utils = __webpack_require__(953); + +var assert = utils.assert; + +function PresetCurve(options) { + if (options.type === 'short') + this.curve = new curve.short(options); + else if (options.type === 'edwards') + this.curve = new curve.edwards(options); + else + this.curve = new curve.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); +} +curves.PresetCurve = PresetCurve; + +function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve, + }); + return curve; + }, + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash.sha256, + gRed: false, + g: [ + '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', + '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811', + ], +}); + +defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: hash.sha256, + gRed: false, + g: [ + 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', + 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34', + ], +}); + +defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: hash.sha256, + gRed: false, + g: [ + '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5', + ], +}); + +defineCurve('p384', { + type: 'short', + prime: null, + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 ffffffff', + a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 fffffffc', + b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', + n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', + hash: hash.sha384, + gRed: false, + g: [ + 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + + '5502f25d bf55296c 3a545e38 72760ab7', + '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f', + ], +}); + +defineCurve('p521', { + type: 'short', + prime: null, + p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff', + a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff fffffffc', + b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', + n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', + hash: hash.sha512, + gRed: false, + g: [ + '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', + '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + + '3fad0761 353c7086 a272c240 88be9476 9fd16650', + ], +}); + +defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '1', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '9', + ], +}); + +defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', + + // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658', + ], +}); + +var pre; +try { + pre = __webpack_require__(1037); +} catch (e) { + pre = undefined; +} + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash.sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3', + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15', + }, + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + pre, + ], +}); + + +/***/ }), + +/***/ 7954: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar assert = utils.assert;\nvar parseBytes = utils.parseBytes;\nvar cachedProperty = utils.cachedProperty;\n\n/**\n* @param {EDDSA} eddsa - instance\n* @param {Object} params - public/private key parameters\n*\n* @param {Array} [params.secret] - secret seed bytes\n* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)\n* @param {Array} [params.pub] - public key point encoded as bytes\n*\n*/\nfunction KeyPair(eddsa, params) {\n this.eddsa = eddsa;\n this._secret = parseBytes(params.secret);\n if (eddsa.isPoint(params.pub))\n this._pub = params.pub;\n else\n this._pubBytes = parseBytes(params.pub);\n}\n\nKeyPair.fromPublic = function fromPublic(eddsa, pub) {\n if (pub instanceof KeyPair)\n return pub;\n return new KeyPair(eddsa, { pub: pub });\n};\n\nKeyPair.fromSecret = function fromSecret(eddsa, secret) {\n if (secret instanceof KeyPair)\n return secret;\n return new KeyPair(eddsa, { secret: secret });\n};\n\nKeyPair.prototype.secret = function secret() {\n return this._secret;\n};\n\ncachedProperty(KeyPair, 'pubBytes', function pubBytes() {\n return this.eddsa.encodePoint(this.pub());\n});\n\ncachedProperty(KeyPair, 'pub', function pub() {\n if (this._pubBytes)\n return this.eddsa.decodePoint(this._pubBytes);\n return this.eddsa.g.mul(this.priv());\n});\n\ncachedProperty(KeyPair, 'privBytes', function privBytes() {\n var eddsa = this.eddsa;\n var hash = this.hash();\n var lastIx = eddsa.encodingLength - 1;\n\n var a = hash.slice(0, eddsa.encodingLength);\n a[0] &= 248;\n a[lastIx] &= 127;\n a[lastIx] |= 64;\n\n return a;\n});\n\ncachedProperty(KeyPair, 'priv', function priv() {\n return this.eddsa.decodeInt(this.privBytes());\n});\n\ncachedProperty(KeyPair, 'hash', function hash() {\n return this.eddsa.hash().update(this.secret()).digest();\n});\n\ncachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {\n return this.hash().slice(this.eddsa.encodingLength);\n});\n\nKeyPair.prototype.sign = function sign(message) {\n assert(this._secret, 'KeyPair can only verify');\n return this.eddsa.sign(message, this);\n};\n\nKeyPair.prototype.verify = function verify(message, sig) {\n return this.eddsa.verify(message, sig, this);\n};\n\nKeyPair.prototype.getSecret = function getSecret(enc) {\n assert(this._secret, 'KeyPair is public only');\n return utils.encode(this.secret(), enc);\n};\n\nKeyPair.prototype.getPublic = function getPublic(enc) {\n return utils.encode(this.pubBytes(), enc);\n};\n\nmodule.exports = KeyPair;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/eddsa/key.js?"); -/***/ }), -/***/ "./node_modules/elliptic/lib/elliptic/eddsa/signature.js": -/*!***************************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/eddsa/signature.js ***! - \***************************************************************/ +var BN = __webpack_require__(3550); +var HmacDRBG = __webpack_require__(2156); +var utils = __webpack_require__(953); +var curves = __webpack_require__(5427); +var rand = __webpack_require__(5923); +var assert = utils.assert; + +var KeyPair = __webpack_require__(1251); +var Signature = __webpack_require__(611); + +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert(Object.prototype.hasOwnProperty.call(curves, options), + 'Unknown curve ' + options); + + options = curves[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + if (options instanceof curves.PresetCurve) + options = { curve: options }; + + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.ushrn(1); + this.g = this.curve.g; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +module.exports = EC; + +EC.prototype.keyPair = function keyPair(options) { + return new KeyPair(this, options); +}; + +EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return KeyPair.fromPrivate(this, priv, enc); +}; + +EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return KeyPair.fromPublic(this, pub, enc); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + entropy: options.entropy || rand(this.hash.hmacStrength), + entropyEnc: options.entropy && options.entropyEnc || 'utf8', + nonce: this.n.toArray(), + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new BN(2)); + for (;;) { + var priv = new BN(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + + priv.iaddn(1); + return this.keyFromPrivate(priv); + } +}; + +EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) + msg = msg.ushrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; +}; + +EC.prototype.sign = function sign(msg, key, enc, options) { + if (typeof enc === 'object') { + options = enc; + enc = null; + } + if (!options) + options = {}; + + key = this.keyFromPrivate(key, enc); + msg = this._truncateToN(new BN(msg, 16)); + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray('be', bytes); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray('be', bytes); + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce: nonce, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new BN(1)); + + for (var iter = 0; ; iter++) { + var k = options.k ? + options.k(iter) : + new BN(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + + var kpX = kp.getX(); + var r = kpX.umod(this.n); + if (r.cmpn(0) === 0) + continue; + + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); + s = s.umod(this.n); + if (s.cmpn(0) === 0) + continue; + + var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | + (kpX.cmp(r) !== 0 ? 2 : 0); + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + + return new Signature({ r: r, s: s, recoveryParam: recoveryParam }); + } +}; + +EC.prototype.verify = function verify(msg, signature, key, enc) { + msg = this._truncateToN(new BN(msg, 16)); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, 'hex'); + + // Perform primitive values validation + var r = signature.r; + var s = signature.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) + return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) + return false; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r).umod(this.n); + var p; + + if (!this.curve._maxwellTrick) { + p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().umod(this.n).cmp(r) === 0; + } + + // NOTE: Greg Maxwell's trick, inspired by: + // https://git.io/vad3K + + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + // Compare `p.x` of Jacobian point with `r`, + // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the + // inverse of `p.z^2` + return p.eqXToP(r); +}; + +EC.prototype.recoverPubKey = function(msg, signature, j, enc) { + assert((3 & j) === j, 'The recovery param is more than two bits'); + signature = new Signature(signature, enc); + + var n = this.n; + var e = new BN(msg); + var r = signature.r; + var s = signature.s; + + // A set LSB signifies that the y-coordinate is odd + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) + throw new Error('Unable to find sencond key candinate'); + + // 1.1. Let x = r + jn. + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + + // 1.6.1 Compute Q = r^-1 (sR - eG) + // Q = r^-1 (sR + -eG) + return this.g.mulAdd(s1, r, s2); +}; + +EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { + signature = new Signature(signature, enc); + if (signature.recoveryParam !== null) + return signature.recoveryParam; + + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature, i); + } catch (e) { + continue; + } + + if (Qprime.eq(Q)) + return i; + } + throw new Error('Unable to find valid recovery factor'); +}; + + +/***/ }), + +/***/ 1251: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/elliptic/lib/elliptic/utils.js\");\nvar assert = utils.assert;\nvar cachedProperty = utils.cachedProperty;\nvar parseBytes = utils.parseBytes;\n\n/**\n* @param {EDDSA} eddsa - eddsa instance\n* @param {Array|Object} sig -\n* @param {Array|Point} [sig.R] - R point as Point or bytes\n* @param {Array|bn} [sig.S] - S scalar as bn or bytes\n* @param {Array} [sig.Rencoded] - R point encoded\n* @param {Array} [sig.Sencoded] - S scalar encoded\n*/\nfunction Signature(eddsa, sig) {\n this.eddsa = eddsa;\n\n if (typeof sig !== 'object')\n sig = parseBytes(sig);\n\n if (Array.isArray(sig)) {\n sig = {\n R: sig.slice(0, eddsa.encodingLength),\n S: sig.slice(eddsa.encodingLength),\n };\n }\n\n assert(sig.R && sig.S, 'Signature without R or S');\n\n if (eddsa.isPoint(sig.R))\n this._R = sig.R;\n if (sig.S instanceof BN)\n this._S = sig.S;\n\n this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;\n this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;\n}\n\ncachedProperty(Signature, 'S', function S() {\n return this.eddsa.decodeInt(this.Sencoded());\n});\n\ncachedProperty(Signature, 'R', function R() {\n return this.eddsa.decodePoint(this.Rencoded());\n});\n\ncachedProperty(Signature, 'Rencoded', function Rencoded() {\n return this.eddsa.encodePoint(this.R());\n});\n\ncachedProperty(Signature, 'Sencoded', function Sencoded() {\n return this.eddsa.encodeInt(this.S());\n});\n\nSignature.prototype.toBytes = function toBytes() {\n return this.Rencoded().concat(this.Sencoded());\n};\n\nSignature.prototype.toHex = function toHex() {\n return utils.encode(this.toBytes(), 'hex').toUpperCase();\n};\n\nmodule.exports = Signature;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/eddsa/signature.js?"); - -/***/ }), - -/***/ "./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js": -/*!*********************************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***! - \*********************************************************************/ -/***/ (function(module) { -eval("module.exports = {\n doubles: {\n step: 4,\n points: [\n [\n 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',\n 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821',\n ],\n [\n '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',\n '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf',\n ],\n [\n '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',\n 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695',\n ],\n [\n '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',\n '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9',\n ],\n [\n '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',\n '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36',\n ],\n [\n '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',\n '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f',\n ],\n [\n 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',\n '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999',\n ],\n [\n '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',\n 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09',\n ],\n [\n 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',\n '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d',\n ],\n [\n 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',\n 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088',\n ],\n [\n 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',\n '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d',\n ],\n [\n '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',\n '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8',\n ],\n [\n '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',\n '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a',\n ],\n [\n '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',\n '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453',\n ],\n [\n '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',\n '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160',\n ],\n [\n '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',\n '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0',\n ],\n [\n '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',\n '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6',\n ],\n [\n '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',\n '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589',\n ],\n [\n '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',\n 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17',\n ],\n [\n 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',\n '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda',\n ],\n [\n 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',\n '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd',\n ],\n [\n '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',\n '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2',\n ],\n [\n '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',\n '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6',\n ],\n [\n 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',\n '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f',\n ],\n [\n '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',\n 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01',\n ],\n [\n 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',\n '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3',\n ],\n [\n 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',\n 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f',\n ],\n [\n 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',\n '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7',\n ],\n [\n 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',\n 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78',\n ],\n [\n 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',\n '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1',\n ],\n [\n '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',\n 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150',\n ],\n [\n '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',\n '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82',\n ],\n [\n 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',\n '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc',\n ],\n [\n '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',\n 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b',\n ],\n [\n 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',\n '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51',\n ],\n [\n 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',\n '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45',\n ],\n [\n 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',\n 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120',\n ],\n [\n '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',\n '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84',\n ],\n [\n '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',\n '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d',\n ],\n [\n '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',\n 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d',\n ],\n [\n '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',\n '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8',\n ],\n [\n 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',\n '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8',\n ],\n [\n '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',\n '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac',\n ],\n [\n '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',\n 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f',\n ],\n [\n '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',\n '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962',\n ],\n [\n 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',\n '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907',\n ],\n [\n '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',\n 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec',\n ],\n [\n 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',\n 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d',\n ],\n [\n 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',\n '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414',\n ],\n [\n '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',\n 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd',\n ],\n [\n '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',\n 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0',\n ],\n [\n 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',\n '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811',\n ],\n [\n 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',\n '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1',\n ],\n [\n 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',\n '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c',\n ],\n [\n '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',\n 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73',\n ],\n [\n '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',\n '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd',\n ],\n [\n 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',\n 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405',\n ],\n [\n '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',\n 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589',\n ],\n [\n '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',\n '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e',\n ],\n [\n '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',\n '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27',\n ],\n [\n 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',\n 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1',\n ],\n [\n '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',\n '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482',\n ],\n [\n '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',\n '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945',\n ],\n [\n 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',\n '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573',\n ],\n [\n 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',\n 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82',\n ],\n ],\n },\n naf: {\n wnd: 7,\n points: [\n [\n 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',\n '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672',\n ],\n [\n '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',\n 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6',\n ],\n [\n '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',\n '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da',\n ],\n [\n 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',\n 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37',\n ],\n [\n '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',\n 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b',\n ],\n [\n 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',\n 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81',\n ],\n [\n 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',\n '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58',\n ],\n [\n 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',\n '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77',\n ],\n [\n '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',\n '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a',\n ],\n [\n '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',\n '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c',\n ],\n [\n '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',\n '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67',\n ],\n [\n '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',\n '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402',\n ],\n [\n 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',\n 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55',\n ],\n [\n 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',\n '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482',\n ],\n [\n '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',\n 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82',\n ],\n [\n '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',\n 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396',\n ],\n [\n '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',\n '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49',\n ],\n [\n '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',\n '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf',\n ],\n [\n '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',\n '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a',\n ],\n [\n '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',\n 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7',\n ],\n [\n 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',\n 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933',\n ],\n [\n '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',\n '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a',\n ],\n [\n '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',\n '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6',\n ],\n [\n 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',\n 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37',\n ],\n [\n '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',\n '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e',\n ],\n [\n 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',\n 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6',\n ],\n [\n 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',\n 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476',\n ],\n [\n '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',\n '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40',\n ],\n [\n '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',\n '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61',\n ],\n [\n '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',\n '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683',\n ],\n [\n 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',\n '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5',\n ],\n [\n '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',\n '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b',\n ],\n [\n 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',\n '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417',\n ],\n [\n '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',\n 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868',\n ],\n [\n '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',\n 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a',\n ],\n [\n 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',\n 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6',\n ],\n [\n '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',\n '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996',\n ],\n [\n '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',\n 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e',\n ],\n [\n 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',\n 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d',\n ],\n [\n '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',\n '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2',\n ],\n [\n '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',\n 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e',\n ],\n [\n '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',\n '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437',\n ],\n [\n '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',\n 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311',\n ],\n [\n 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',\n '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4',\n ],\n [\n '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',\n '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575',\n ],\n [\n '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',\n 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d',\n ],\n [\n '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',\n 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d',\n ],\n [\n 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',\n 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629',\n ],\n [\n 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',\n 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06',\n ],\n [\n '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',\n '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374',\n ],\n [\n '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',\n '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee',\n ],\n [\n 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',\n '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1',\n ],\n [\n 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',\n 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b',\n ],\n [\n '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',\n '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661',\n ],\n [\n '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',\n '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6',\n ],\n [\n 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',\n '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e',\n ],\n [\n '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',\n '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d',\n ],\n [\n 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',\n 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc',\n ],\n [\n '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',\n 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4',\n ],\n [\n '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',\n '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c',\n ],\n [\n 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',\n '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b',\n ],\n [\n 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',\n '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913',\n ],\n [\n '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',\n '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154',\n ],\n [\n '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',\n '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865',\n ],\n [\n '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',\n 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc',\n ],\n [\n '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',\n 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224',\n ],\n [\n '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',\n '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e',\n ],\n [\n '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',\n '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6',\n ],\n [\n '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',\n '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511',\n ],\n [\n '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',\n 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b',\n ],\n [\n 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',\n 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2',\n ],\n [\n '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',\n 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c',\n ],\n [\n 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',\n '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3',\n ],\n [\n 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',\n '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d',\n ],\n [\n 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',\n '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700',\n ],\n [\n 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',\n '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4',\n ],\n [\n '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',\n 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196',\n ],\n [\n '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',\n '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4',\n ],\n [\n '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',\n 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257',\n ],\n [\n 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',\n 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13',\n ],\n [\n 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',\n '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096',\n ],\n [\n 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',\n 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38',\n ],\n [\n 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',\n '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f',\n ],\n [\n '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',\n '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448',\n ],\n [\n 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',\n '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a',\n ],\n [\n 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',\n '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4',\n ],\n [\n '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',\n '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437',\n ],\n [\n '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',\n 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7',\n ],\n [\n 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',\n '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d',\n ],\n [\n 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',\n '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a',\n ],\n [\n 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',\n '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54',\n ],\n [\n '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',\n '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77',\n ],\n [\n 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',\n 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517',\n ],\n [\n '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',\n 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10',\n ],\n [\n 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',\n 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125',\n ],\n [\n 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',\n '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e',\n ],\n [\n '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',\n 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1',\n ],\n [\n 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',\n '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2',\n ],\n [\n 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',\n '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423',\n ],\n [\n 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',\n '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8',\n ],\n [\n '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',\n 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758',\n ],\n [\n '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',\n 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375',\n ],\n [\n 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',\n '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d',\n ],\n [\n '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',\n 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec',\n ],\n [\n '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',\n '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0',\n ],\n [\n '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',\n 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c',\n ],\n [\n 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',\n 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4',\n ],\n [\n '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',\n 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f',\n ],\n [\n '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',\n '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649',\n ],\n [\n '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',\n 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826',\n ],\n [\n '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',\n '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5',\n ],\n [\n 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',\n 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87',\n ],\n [\n '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',\n '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b',\n ],\n [\n 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',\n '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc',\n ],\n [\n '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',\n '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c',\n ],\n [\n 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',\n 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f',\n ],\n [\n 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',\n '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a',\n ],\n [\n 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',\n 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46',\n ],\n [\n '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',\n 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f',\n ],\n [\n '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',\n '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03',\n ],\n [\n '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',\n 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08',\n ],\n [\n '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',\n '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8',\n ],\n [\n '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',\n '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373',\n ],\n [\n '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',\n 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3',\n ],\n [\n '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',\n '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8',\n ],\n [\n '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',\n '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1',\n ],\n [\n '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',\n '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9',\n ],\n ],\n },\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js?"); -/***/ }), - -/***/ "./node_modules/elliptic/lib/elliptic/utils.js": -/*!*****************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/utils.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +var BN = __webpack_require__(3550); +var utils = __webpack_require__(953); +var assert = utils.assert; + +function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; + + // KeyPair(ec, { priv: ..., pub: ... }) + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); +} +module.exports = KeyPair; + +KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + + return new KeyPair(ec, { + pub: pub, + pubEnc: enc, + }); +}; + +KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + + return new KeyPair(ec, { + priv: priv, + privEnc: enc, + }); +}; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + + if (pub.isInfinity()) + return { result: false, reason: 'Invalid public key' }; + if (!pub.validate()) + return { result: false, reason: 'Public key is not a point' }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: 'Public key * N != O' }; + + return { result: true, reason: null }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + + if (!enc) + return this.pub; + + return this.pub.encode(enc, compact); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') + return this.priv.toString(16, 2); + else + return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { + this.priv = new BN(key, enc || 16); + + // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + this.priv = this.priv.umod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + // Montgomery points only have an `x` coordinate. + // Weierstrass/Edwards points on the other hand have both `x` and + // `y` coordinates. + if (this.ec.curve.type === 'mont') { + assert(key.x, 'Need x coordinate'); + } else if (this.ec.curve.type === 'short' || + this.ec.curve.type === 'edwards') { + assert(key.x && key.y, 'Need both x and y coordinate'); + } + this.pub = this.ec.curve.point(key.x, key.y); + return; + } + this.pub = this.ec.curve.decodePoint(key, enc); +}; + +// ECDH +KeyPair.prototype.derive = function derive(pub) { + if(!pub.validate()) { + assert(pub.validate(), 'public point not validated'); + } + return pub.mul(this.priv).getX(); +}; + +// ECDSA +KeyPair.prototype.sign = function sign(msg, enc, options) { + return this.ec.sign(msg, this, enc, options); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; + + +/***/ }), + +/***/ 611: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar utils = exports;\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar minAssert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\nvar minUtils = __webpack_require__(/*! minimalistic-crypto-utils */ \"./node_modules/minimalistic-crypto-utils/lib/utils.js\");\n\nutils.assert = minAssert;\nutils.toArray = minUtils.toArray;\nutils.zero2 = minUtils.zero2;\nutils.toHex = minUtils.toHex;\nutils.encode = minUtils.encode;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w, bits) {\n var naf = new Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n\n var ws = 1 << (w + 1);\n var k = num.clone();\n\n for (var i = 0; i < naf.length; i++) {\n var z;\n var mod = k.andln(ws - 1);\n if (k.isOdd()) {\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n\n naf[i] = z;\n k.iushrn(1);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n [],\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n var m8;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.iushrn(1);\n k2.iushrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\nfunction cachedProperty(obj, name, computer) {\n var key = '_' + name;\n obj.prototype[name] = function cachedProperty() {\n return this[key] !== undefined ? this[key] :\n this[key] = computer.call(this);\n };\n}\nutils.cachedProperty = cachedProperty;\n\nfunction parseBytes(bytes) {\n return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :\n bytes;\n}\nutils.parseBytes = parseBytes;\n\nfunction intFromLE(bytes) {\n return new BN(bytes, 'hex', 'le');\n}\nutils.intFromLE = intFromLE;\n\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/lib/elliptic/utils.js?"); -/***/ }), -/***/ "./node_modules/events/events.js": -/*!***************************************!*\ - !*** ./node_modules/events/events.js ***! - \***************************************/ -/***/ (function(module) { +var BN = __webpack_require__(3550); + +var utils = __webpack_require__(953); +var assert = utils.assert; + +function Signature(options, enc) { + if (options instanceof Signature) + return options; + + if (this._importDER(options, enc)) + return; + + assert(options.r && options.s, 'Signature without r or s'); + this.r = new BN(options.r, 16); + this.s = new BN(options.s, 16); + if (options.recoveryParam === undefined) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; +} +module.exports = Signature; + +function Position() { + this.place = 0; +} + +function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 0x80)) { + return initial; + } + var octetLen = initial & 0xf; + + // Indefinite length or overflow + if (octetLen === 0 || octetLen > 4) { + return false; + } + + var val = 0; + for (var i = 0, off = p.place; i < octetLen; i++, off++) { + val <<= 8; + val |= buf[off]; + val >>>= 0; + } + + // Leading zeroes + if (val <= 0x7f) { + return false; + } + + p.place = off; + return val; +} + +function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); +} + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 0x30) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if ((len + p.place) !== data.length) { + return false; + } + if (data[p.place++] !== 0x02) { + return false; + } + var rlen = getLength(data, p); + if (rlen === false) { + return false; + } + var r = data.slice(p.place, rlen + p.place); + p.place += rlen; + if (data[p.place++] !== 0x02) { + return false; + } + var slen = getLength(data, p); + if (slen === false) { + return false; + } + if (data.length !== slen + p.place) { + return false; + } + var s = data.slice(p.place, slen + p.place); + if (r[0] === 0) { + if (r[1] & 0x80) { + r = r.slice(1); + } else { + // Leading zeroes + return false; + } + } + if (s[0] === 0) { + if (s[1] & 0x80) { + s = s.slice(1); + } else { + // Leading zeroes + return false; + } + } + + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + + return true; +}; + +function constructLength(arr, len) { + if (len < 0x80) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 0x80); + while (--octets) { + arr.push((len >>> (octets << 3)) & 0xff); + } + arr.push(len); +} + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + r = rmPadding(r); + s = rmPadding(s); + + while (!s[0] && !(s[1] & 0x80)) { + s = s.slice(1); + } + var arr = [ 0x02 ]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(0x02); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [ 0x30 ]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); +}; + + +/***/ }), + +/***/ 5980: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/events/events.js?"); -/***/ }), -/***/ "./node_modules/evp_bytestokey/index.js": -/*!**********************************************!*\ - !*** ./node_modules/evp_bytestokey/index.js ***! - \**********************************************/ +var hash = __webpack_require__(3715); +var curves = __webpack_require__(5427); +var utils = __webpack_require__(953); +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var KeyPair = __webpack_require__(9087); +var Signature = __webpack_require__(3622); + +function EDDSA(curve) { + assert(curve === 'ed25519', 'only tested with ed25519 so far'); + + if (!(this instanceof EDDSA)) + return new EDDSA(curve); + + curve = curves[curve].curve; + this.curve = curve; + this.g = curve.g; + this.g.precompute(curve.n.bitLength() + 1); + + this.pointClass = curve.point().constructor; + this.encodingLength = Math.ceil(curve.n.bitLength() / 8); + this.hash = hash.sha512; +} + +module.exports = EDDSA; + +/** +* @param {Array|String} message - message bytes +* @param {Array|String|KeyPair} secret - secret bytes or a keypair +* @returns {Signature} - signature +*/ +EDDSA.prototype.sign = function sign(message, secret) { + message = parseBytes(message); + var key = this.keyFromSecret(secret); + var r = this.hashInt(key.messagePrefix(), message); + var R = this.g.mul(r); + var Rencoded = this.encodePoint(R); + var s_ = this.hashInt(Rencoded, key.pubBytes(), message) + .mul(key.priv()); + var S = r.add(s_).umod(this.curve.n); + return this.makeSignature({ R: R, S: S, Rencoded: Rencoded }); +}; + +/** +* @param {Array} message - message bytes +* @param {Array|String|Signature} sig - sig bytes +* @param {Array|String|Point|KeyPair} pub - public key +* @returns {Boolean} - true if public key matches sig of message +*/ +EDDSA.prototype.verify = function verify(message, sig, pub) { + message = parseBytes(message); + sig = this.makeSignature(sig); + var key = this.keyFromPublic(pub); + var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); + var SG = this.g.mul(sig.S()); + var RplusAh = sig.R().add(key.pub().mul(h)); + return RplusAh.eq(SG); +}; + +EDDSA.prototype.hashInt = function hashInt() { + var hash = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash.update(arguments[i]); + return utils.intFromLE(hash.digest()).umod(this.curve.n); +}; + +EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { + return KeyPair.fromPublic(this, pub); +}; + +EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { + return KeyPair.fromSecret(this, secret); +}; + +EDDSA.prototype.makeSignature = function makeSignature(sig) { + if (sig instanceof Signature) + return sig; + return new Signature(this, sig); +}; + +/** +* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2 +* +* EDDSA defines methods for encoding and decoding points and integers. These are +* helper convenience methods, that pass along to utility functions implied +* parameters. +* +*/ +EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray('le', this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0; + return enc; +}; + +EDDSA.prototype.decodePoint = function decodePoint(bytes) { + bytes = utils.parseBytes(bytes); + + var lastIx = bytes.length - 1; + var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80); + var xIsOdd = (bytes[lastIx] & 0x80) !== 0; + + var y = utils.intFromLE(normed); + return this.curve.pointFromY(y, xIsOdd); +}; + +EDDSA.prototype.encodeInt = function encodeInt(num) { + return num.toArray('le', this.encodingLength); +}; + +EDDSA.prototype.decodeInt = function decodeInt(bytes) { + return utils.intFromLE(bytes); +}; + +EDDSA.prototype.isPoint = function isPoint(val) { + return val instanceof this.pointClass; +}; + + +/***/ }), + +/***/ 9087: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar MD5 = __webpack_require__(/*! md5.js */ \"./node_modules/md5.js/index.js\")\n\n/* eslint-disable camelcase */\nfunction EVP_BytesToKey (password, salt, keyBits, ivLen) {\n if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')\n if (salt) {\n if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')\n if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')\n }\n\n var keyLen = keyBits / 8\n var key = Buffer.alloc(keyLen)\n var iv = Buffer.alloc(ivLen || 0)\n var tmp = Buffer.alloc(0)\n\n while (keyLen > 0 || ivLen > 0) {\n var hash = new MD5()\n hash.update(tmp)\n hash.update(password)\n if (salt) hash.update(salt)\n tmp = hash.digest()\n\n var used = 0\n\n if (keyLen > 0) {\n var keyStart = key.length - keyLen\n used = Math.min(keyLen, tmp.length)\n tmp.copy(key, keyStart, 0, used)\n keyLen -= used\n }\n\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen\n var length = Math.min(ivLen, tmp.length - used)\n tmp.copy(iv, ivStart, used, used + length)\n ivLen -= length\n }\n }\n\n tmp.fill(0)\n return { key: key, iv: iv }\n}\n\nmodule.exports = EVP_BytesToKey\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/evp_bytestokey/index.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/hash-base/index.js": -/*!*****************************************!*\ - !*** ./node_modules/hash-base/index.js ***! - \*****************************************/ +var utils = __webpack_require__(953); +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var cachedProperty = utils.cachedProperty; + +/** +* @param {EDDSA} eddsa - instance +* @param {Object} params - public/private key parameters +* +* @param {Array} [params.secret] - secret seed bytes +* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms) +* @param {Array} [params.pub] - public key point encoded as bytes +* +*/ +function KeyPair(eddsa, params) { + this.eddsa = eddsa; + this._secret = parseBytes(params.secret); + if (eddsa.isPoint(params.pub)) + this._pub = params.pub; + else + this._pubBytes = parseBytes(params.pub); +} + +KeyPair.fromPublic = function fromPublic(eddsa, pub) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(eddsa, { pub: pub }); +}; + +KeyPair.fromSecret = function fromSecret(eddsa, secret) { + if (secret instanceof KeyPair) + return secret; + return new KeyPair(eddsa, { secret: secret }); +}; + +KeyPair.prototype.secret = function secret() { + return this._secret; +}; + +cachedProperty(KeyPair, 'pubBytes', function pubBytes() { + return this.eddsa.encodePoint(this.pub()); +}); + +cachedProperty(KeyPair, 'pub', function pub() { + if (this._pubBytes) + return this.eddsa.decodePoint(this._pubBytes); + return this.eddsa.g.mul(this.priv()); +}); + +cachedProperty(KeyPair, 'privBytes', function privBytes() { + var eddsa = this.eddsa; + var hash = this.hash(); + var lastIx = eddsa.encodingLength - 1; + + var a = hash.slice(0, eddsa.encodingLength); + a[0] &= 248; + a[lastIx] &= 127; + a[lastIx] |= 64; + + return a; +}); + +cachedProperty(KeyPair, 'priv', function priv() { + return this.eddsa.decodeInt(this.privBytes()); +}); + +cachedProperty(KeyPair, 'hash', function hash() { + return this.eddsa.hash().update(this.secret()).digest(); +}); + +cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() { + return this.hash().slice(this.eddsa.encodingLength); +}); + +KeyPair.prototype.sign = function sign(message) { + assert(this._secret, 'KeyPair can only verify'); + return this.eddsa.sign(message, this); +}; + +KeyPair.prototype.verify = function verify(message, sig) { + return this.eddsa.verify(message, sig, this); +}; + +KeyPair.prototype.getSecret = function getSecret(enc) { + assert(this._secret, 'KeyPair is public only'); + return utils.encode(this.secret(), enc); +}; + +KeyPair.prototype.getPublic = function getPublic(enc) { + return utils.encode(this.pubBytes(), enc); +}; + +module.exports = KeyPair; + + +/***/ }), + +/***/ 3622: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar Transform = (__webpack_require__(/*! readable-stream */ \"./node_modules/readable-stream/readable-browser.js\").Transform)\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\n\nfunction throwIfNotStringOrBuffer (val, prefix) {\n if (!Buffer.isBuffer(val) && typeof val !== 'string') {\n throw new TypeError(prefix + ' must be a string or a buffer')\n }\n}\n\nfunction HashBase (blockSize) {\n Transform.call(this)\n\n this._block = Buffer.allocUnsafe(blockSize)\n this._blockSize = blockSize\n this._blockOffset = 0\n this._length = [0, 0, 0, 0]\n\n this._finalized = false\n}\n\ninherits(HashBase, Transform)\n\nHashBase.prototype._transform = function (chunk, encoding, callback) {\n var error = null\n try {\n this.update(chunk, encoding)\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype._flush = function (callback) {\n var error = null\n try {\n this.push(this.digest())\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype.update = function (data, encoding) {\n throwIfNotStringOrBuffer(data, 'Data')\n if (this._finalized) throw new Error('Digest already called')\n if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)\n\n // consume data\n var block = this._block\n var offset = 0\n while (this._blockOffset + data.length - offset >= this._blockSize) {\n for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]\n this._update()\n this._blockOffset = 0\n }\n while (offset < data.length) block[this._blockOffset++] = data[offset++]\n\n // update length\n for (var j = 0, carry = data.length * 8; carry > 0; ++j) {\n this._length[j] += carry\n carry = (this._length[j] / 0x0100000000) | 0\n if (carry > 0) this._length[j] -= 0x0100000000 * carry\n }\n\n return this\n}\n\nHashBase.prototype._update = function () {\n throw new Error('_update is not implemented')\n}\n\nHashBase.prototype.digest = function (encoding) {\n if (this._finalized) throw new Error('Digest already called')\n this._finalized = true\n\n var digest = this._digest()\n if (encoding !== undefined) digest = digest.toString(encoding)\n\n // reset state\n this._block.fill(0)\n this._blockOffset = 0\n for (var i = 0; i < 4; ++i) this._length[i] = 0\n\n return digest\n}\n\nHashBase.prototype._digest = function () {\n throw new Error('_digest is not implemented')\n}\n\nmodule.exports = HashBase\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash-base/index.js?"); - -/***/ }), -/***/ "./node_modules/hash.js/lib/hash.js": -/*!******************************************!*\ - !*** ./node_modules/hash.js/lib/hash.js ***! - \******************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -eval("var hash = exports;\n\nhash.utils = __webpack_require__(/*! ./hash/utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nhash.common = __webpack_require__(/*! ./hash/common */ \"./node_modules/hash.js/lib/hash/common.js\");\nhash.sha = __webpack_require__(/*! ./hash/sha */ \"./node_modules/hash.js/lib/hash/sha.js\");\nhash.ripemd = __webpack_require__(/*! ./hash/ripemd */ \"./node_modules/hash.js/lib/hash/ripemd.js\");\nhash.hmac = __webpack_require__(/*! ./hash/hmac */ \"./node_modules/hash.js/lib/hash/hmac.js\");\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash.js?"); -/***/ }), +var BN = __webpack_require__(3550); +var utils = __webpack_require__(953); +var assert = utils.assert; +var cachedProperty = utils.cachedProperty; +var parseBytes = utils.parseBytes; -/***/ "./node_modules/hash.js/lib/hash/common.js": -/*!*************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/common.js ***! - \*************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/** +* @param {EDDSA} eddsa - eddsa instance +* @param {Array|Object} sig - +* @param {Array|Point} [sig.R] - R point as Point or bytes +* @param {Array|bn} [sig.S] - S scalar as bn or bytes +* @param {Array} [sig.Rencoded] - R point encoded +* @param {Array} [sig.Sencoded] - S scalar encoded +*/ +function Signature(eddsa, sig) { + this.eddsa = eddsa; -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/common.js?"); + if (typeof sig !== 'object') + sig = parseBytes(sig); -/***/ }), + if (Array.isArray(sig)) { + sig = { + R: sig.slice(0, eddsa.encodingLength), + S: sig.slice(eddsa.encodingLength), + }; + } -/***/ "./node_modules/hash.js/lib/hash/hmac.js": -/*!***********************************************!*\ - !*** ./node_modules/hash.js/lib/hash/hmac.js ***! - \***********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + assert(sig.R && sig.S, 'Signature without R or S'); -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/hmac.js?"); + if (eddsa.isPoint(sig.R)) + this._R = sig.R; + if (sig.S instanceof BN) + this._S = sig.S; -/***/ }), + this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded; + this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded; +} -/***/ "./node_modules/hash.js/lib/hash/ripemd.js": -/*!*************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/ripemd.js ***! - \*************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +cachedProperty(Signature, 'S', function S() { + return this.eddsa.decodeInt(this.Sencoded()); +}); -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ./common */ \"./node_modules/hash.js/lib/hash/common.js\");\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_3 = utils.sum32_3;\nvar sum32_4 = utils.sum32_4;\nvar BlockHash = common.BlockHash;\n\nfunction RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160();\n\n BlockHash.call(this);\n\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];\n this.endian = 'little';\n}\nutils.inherits(RIPEMD160, BlockHash);\nexports.ripemd160 = RIPEMD160;\n\nRIPEMD160.blockSize = 512;\nRIPEMD160.outSize = 160;\nRIPEMD160.hmacStrength = 192;\nRIPEMD160.padLength = 64;\n\nRIPEMD160.prototype._update = function update(msg, start) {\n var A = this.h[0];\n var B = this.h[1];\n var C = this.h[2];\n var D = this.h[3];\n var E = this.h[4];\n var Ah = A;\n var Bh = B;\n var Ch = C;\n var Dh = D;\n var Eh = E;\n for (var j = 0; j < 80; j++) {\n var T = sum32(\n rotl32(\n sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),\n s[j]),\n E);\n A = E;\n E = D;\n D = rotl32(C, 10);\n C = B;\n B = T;\n T = sum32(\n rotl32(\n sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),\n sh[j]),\n Eh);\n Ah = Eh;\n Eh = Dh;\n Dh = rotl32(Ch, 10);\n Ch = Bh;\n Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh);\n this.h[1] = sum32_3(this.h[2], D, Eh);\n this.h[2] = sum32_3(this.h[3], E, Ah);\n this.h[3] = sum32_3(this.h[4], A, Bh);\n this.h[4] = sum32_3(this.h[0], B, Ch);\n this.h[0] = T;\n};\n\nRIPEMD160.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'little');\n else\n return utils.split32(this.h, 'little');\n};\n\nfunction f(j, x, y, z) {\n if (j <= 15)\n return x ^ y ^ z;\n else if (j <= 31)\n return (x & y) | ((~x) & z);\n else if (j <= 47)\n return (x | (~y)) ^ z;\n else if (j <= 63)\n return (x & z) | (y & (~z));\n else\n return x ^ (y | (~z));\n}\n\nfunction K(j) {\n if (j <= 15)\n return 0x00000000;\n else if (j <= 31)\n return 0x5a827999;\n else if (j <= 47)\n return 0x6ed9eba1;\n else if (j <= 63)\n return 0x8f1bbcdc;\n else\n return 0xa953fd4e;\n}\n\nfunction Kh(j) {\n if (j <= 15)\n return 0x50a28be6;\n else if (j <= 31)\n return 0x5c4dd124;\n else if (j <= 47)\n return 0x6d703ef3;\n else if (j <= 63)\n return 0x7a6d76e9;\n else\n return 0x00000000;\n}\n\nvar r = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\n];\n\nvar rh = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n];\n\nvar s = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\n];\n\nvar sh = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n];\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/ripemd.js?"); +cachedProperty(Signature, 'R', function R() { + return this.eddsa.decodePoint(this.Rencoded()); +}); -/***/ }), +cachedProperty(Signature, 'Rencoded', function Rencoded() { + return this.eddsa.encodePoint(this.R()); +}); -/***/ "./node_modules/hash.js/lib/hash/sha.js": -/*!**********************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha.js ***! - \**********************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +cachedProperty(Signature, 'Sencoded', function Sencoded() { + return this.eddsa.encodeInt(this.S()); +}); -"use strict"; -eval("\n\nexports.sha1 = __webpack_require__(/*! ./sha/1 */ \"./node_modules/hash.js/lib/hash/sha/1.js\");\nexports.sha224 = __webpack_require__(/*! ./sha/224 */ \"./node_modules/hash.js/lib/hash/sha/224.js\");\nexports.sha256 = __webpack_require__(/*! ./sha/256 */ \"./node_modules/hash.js/lib/hash/sha/256.js\");\nexports.sha384 = __webpack_require__(/*! ./sha/384 */ \"./node_modules/hash.js/lib/hash/sha/384.js\");\nexports.sha512 = __webpack_require__(/*! ./sha/512 */ \"./node_modules/hash.js/lib/hash/sha/512.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/sha.js?"); +Signature.prototype.toBytes = function toBytes() { + return this.Rencoded().concat(this.Sencoded()); +}; -/***/ }), +Signature.prototype.toHex = function toHex() { + return utils.encode(this.toBytes(), 'hex').toUpperCase(); +}; -/***/ "./node_modules/hash.js/lib/hash/sha/1.js": -/*!************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/1.js ***! - \************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +module.exports = Signature; -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ../common */ \"./node_modules/hash.js/lib/hash/common.js\");\nvar shaCommon = __webpack_require__(/*! ./common */ \"./node_modules/hash.js/lib/hash/sha/common.js\");\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_5 = utils.sum32_5;\nvar ft_1 = shaCommon.ft_1;\nvar BlockHash = common.BlockHash;\n\nvar sha1_K = [\n 0x5A827999, 0x6ED9EBA1,\n 0x8F1BBCDC, 0xCA62C1D6\n];\n\nfunction SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1();\n\n BlockHash.call(this);\n this.h = [\n 0x67452301, 0xefcdab89, 0x98badcfe,\n 0x10325476, 0xc3d2e1f0 ];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nmodule.exports = SHA1;\n\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n\n for(; i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n\n for (i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n};\n\nSHA1.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/sha/1.js?"); /***/ }), -/***/ "./node_modules/hash.js/lib/hash/sha/224.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/224.js ***! - \**************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 1037: +/***/ (function(module) { + +module.exports = { + doubles: { + step: 4, + points: [ + [ + 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', + 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821', + ], + [ + '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', + '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf', + ], + [ + '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', + 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695', + ], + [ + '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', + '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9', + ], + [ + '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', + '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36', + ], + [ + '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', + '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f', + ], + [ + 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', + '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999', + ], + [ + '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', + 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09', + ], + [ + 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', + '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d', + ], + [ + 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', + 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088', + ], + [ + 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', + '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d', + ], + [ + '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', + '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8', + ], + [ + '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', + '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a', + ], + [ + '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', + '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453', + ], + [ + '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', + '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160', + ], + [ + '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', + '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0', + ], + [ + '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', + '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6', + ], + [ + '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', + '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589', + ], + [ + '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', + 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17', + ], + [ + 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', + '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda', + ], + [ + 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', + '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd', + ], + [ + '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', + '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2', + ], + [ + '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', + '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6', + ], + [ + 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', + '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f', + ], + [ + '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', + 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01', + ], + [ + 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', + '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3', + ], + [ + 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', + 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f', + ], + [ + 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', + '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7', + ], + [ + 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', + 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78', + ], + [ + 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', + '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1', + ], + [ + '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', + 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150', + ], + [ + '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', + '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82', + ], + [ + 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', + '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc', + ], + [ + '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', + 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b', + ], + [ + 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', + '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51', + ], + [ + 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', + '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45', + ], + [ + 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', + 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120', + ], + [ + '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', + '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84', + ], + [ + '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', + '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d', + ], + [ + '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', + 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d', + ], + [ + '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', + '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8', + ], + [ + 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', + '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8', + ], + [ + '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', + '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac', + ], + [ + '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', + 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f', + ], + [ + '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', + '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962', + ], + [ + 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', + '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907', + ], + [ + '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', + 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec', + ], + [ + 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', + 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d', + ], + [ + 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', + '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414', + ], + [ + '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', + 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd', + ], + [ + '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', + 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0', + ], + [ + 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', + '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811', + ], + [ + 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', + '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1', + ], + [ + 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', + '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c', + ], + [ + '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', + 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73', + ], + [ + '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', + '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd', + ], + [ + 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', + 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405', + ], + [ + '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', + 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589', + ], + [ + '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', + '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e', + ], + [ + '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', + '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27', + ], + [ + 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', + 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1', + ], + [ + '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', + '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482', + ], + [ + '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', + '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945', + ], + [ + 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', + '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573', + ], + [ + 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', + 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82', + ], + ], + }, + naf: { + wnd: 7, + points: [ + [ + 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', + '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672', + ], + [ + '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', + 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6', + ], + [ + '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', + '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da', + ], + [ + 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', + 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37', + ], + [ + '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', + 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b', + ], + [ + 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', + 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81', + ], + [ + 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', + '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58', + ], + [ + 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', + '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77', + ], + [ + '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', + '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a', + ], + [ + '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', + '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c', + ], + [ + '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', + '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67', + ], + [ + '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', + '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402', + ], + [ + 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', + 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55', + ], + [ + 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', + '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482', + ], + [ + '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', + 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82', + ], + [ + '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', + 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396', + ], + [ + '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', + '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49', + ], + [ + '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', + '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf', + ], + [ + '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', + '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a', + ], + [ + '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', + 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7', + ], + [ + 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', + 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933', + ], + [ + '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', + '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a', + ], + [ + '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', + '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6', + ], + [ + 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', + 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37', + ], + [ + '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', + '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e', + ], + [ + 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', + 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6', + ], + [ + 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', + 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476', + ], + [ + '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', + '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40', + ], + [ + '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', + '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61', + ], + [ + '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', + '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683', + ], + [ + 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', + '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5', + ], + [ + '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', + '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b', + ], + [ + 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', + '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417', + ], + [ + '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', + 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868', + ], + [ + '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', + 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a', + ], + [ + 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', + 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6', + ], + [ + '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', + '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996', + ], + [ + '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', + 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e', + ], + [ + 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', + 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d', + ], + [ + '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', + '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2', + ], + [ + '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', + 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e', + ], + [ + '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', + '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437', + ], + [ + '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', + 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311', + ], + [ + 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', + '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4', + ], + [ + '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', + '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575', + ], + [ + '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', + 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d', + ], + [ + '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', + 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d', + ], + [ + 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', + 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629', + ], + [ + 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', + 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06', + ], + [ + '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', + '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374', + ], + [ + '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', + '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee', + ], + [ + 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', + '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1', + ], + [ + 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', + 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b', + ], + [ + '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', + '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661', + ], + [ + '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', + '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6', + ], + [ + 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', + '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e', + ], + [ + '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', + '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d', + ], + [ + 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', + 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc', + ], + [ + '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', + 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4', + ], + [ + '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', + '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c', + ], + [ + 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', + '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b', + ], + [ + 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', + '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913', + ], + [ + '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', + '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154', + ], + [ + '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', + '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865', + ], + [ + '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', + 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc', + ], + [ + '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', + 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224', + ], + [ + '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', + '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e', + ], + [ + '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', + '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6', + ], + [ + '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', + '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511', + ], + [ + '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', + 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b', + ], + [ + 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', + 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2', + ], + [ + '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', + 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c', + ], + [ + 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', + '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3', + ], + [ + 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', + '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d', + ], + [ + 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', + '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700', + ], + [ + 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', + '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4', + ], + [ + '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', + 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196', + ], + [ + '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', + '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4', + ], + [ + '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', + 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257', + ], + [ + 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', + 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13', + ], + [ + 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', + '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096', + ], + [ + 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', + 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38', + ], + [ + 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', + '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f', + ], + [ + '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', + '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448', + ], + [ + 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', + '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a', + ], + [ + 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', + '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4', + ], + [ + '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', + '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437', + ], + [ + '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', + 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7', + ], + [ + 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', + '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d', + ], + [ + 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', + '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a', + ], + [ + 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', + '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54', + ], + [ + '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', + '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77', + ], + [ + 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', + 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517', + ], + [ + '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', + 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10', + ], + [ + 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', + 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125', + ], + [ + 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', + '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e', + ], + [ + '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', + 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1', + ], + [ + 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', + '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2', + ], + [ + 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', + '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423', + ], + [ + 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', + '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8', + ], + [ + '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', + 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758', + ], + [ + '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', + 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375', + ], + [ + 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', + '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d', + ], + [ + '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', + 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec', + ], + [ + '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', + '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0', + ], + [ + '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', + 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c', + ], + [ + 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', + 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4', + ], + [ + '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', + 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f', + ], + [ + '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', + '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649', + ], + [ + '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', + 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826', + ], + [ + '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', + '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5', + ], + [ + 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', + 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87', + ], + [ + '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', + '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b', + ], + [ + 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', + '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc', + ], + [ + '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', + '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c', + ], + [ + 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', + 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f', + ], + [ + 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', + '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a', + ], + [ + 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', + 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46', + ], + [ + '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', + 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f', + ], + [ + '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', + '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03', + ], + [ + '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', + 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08', + ], + [ + '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', + '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8', + ], + [ + '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', + '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373', + ], + [ + '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', + 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3', + ], + [ + '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', + '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8', + ], + [ + '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', + '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1', + ], + [ + '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', + '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9', + ], + ], + }, +}; + + +/***/ }), + +/***/ 953: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar SHA256 = __webpack_require__(/*! ./256 */ \"./node_modules/hash.js/lib/hash/sha/256.js\");\n\nfunction SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224();\n\n SHA256.call(this);\n this.h = [\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,\n 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];\n}\nutils.inherits(SHA224, SHA256);\nmodule.exports = SHA224;\n\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 7), 'big');\n else\n return utils.split32(this.h.slice(0, 7), 'big');\n};\n\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/sha/224.js?"); -/***/ }), -/***/ "./node_modules/hash.js/lib/hash/sha/256.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/256.js ***! - \**************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +var utils = exports; +var BN = __webpack_require__(3550); +var minAssert = __webpack_require__(9746); +var minUtils = __webpack_require__(4504); + +utils.assert = minAssert; +utils.toArray = minUtils.toArray; +utils.zero2 = minUtils.zero2; +utils.toHex = minUtils.toHex; +utils.encode = minUtils.encode; + +// Represent num in a w-NAF form +function getNAF(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + naf.fill(0); + + var ws = 1 << (w + 1); + var k = num.clone(); + + for (var i = 0; i < naf.length; i++) { + var z; + var mod = k.andln(ws - 1); + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + + naf[i] = z; + k.iushrn(1); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [], + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; + +function cachedProperty(obj, name, computer) { + var key = '_' + name; + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : + this[key] = computer.call(this); + }; +} +utils.cachedProperty = cachedProperty; + +function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : + bytes; +} +utils.parseBytes = parseBytes; + +function intFromLE(bytes) { + return new BN(bytes, 'hex', 'le'); +} +utils.intFromLE = intFromLE; + + + +/***/ }), + +/***/ 7187: +/***/ (function(module) { "use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ../common */ \"./node_modules/hash.js/lib/hash/common.js\");\nvar shaCommon = __webpack_require__(/*! ./common */ \"./node_modules/hash.js/lib/hash/sha/common.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar ch32 = shaCommon.ch32;\nvar maj32 = shaCommon.maj32;\nvar s0_256 = shaCommon.s0_256;\nvar s1_256 = shaCommon.s1_256;\nvar g0_256 = shaCommon.g0_256;\nvar g1_256 = shaCommon.g1_256;\n\nvar BlockHash = common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nmodule.exports = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/sha/256.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha/384.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/384.js ***! - \**************************************************/ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; +module.exports.once = once; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} + + +/***/ }), + +/***/ 3048: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\n\nvar SHA512 = __webpack_require__(/*! ./512 */ \"./node_modules/hash.js/lib/hash/sha/512.js\");\n\nfunction SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384();\n\n SHA512.call(this);\n this.h = [\n 0xcbbb9d5d, 0xc1059ed8,\n 0x629a292a, 0x367cd507,\n 0x9159015a, 0x3070dd17,\n 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31,\n 0x8eb44a87, 0x68581511,\n 0xdb0c2e0d, 0x64f98fa7,\n 0x47b5481d, 0xbefa4fa4 ];\n}\nutils.inherits(SHA384, SHA512);\nmodule.exports = SHA384;\n\nSHA384.blockSize = 1024;\nSHA384.outSize = 384;\nSHA384.hmacStrength = 192;\nSHA384.padLength = 128;\n\nSHA384.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 12), 'big');\n else\n return utils.split32(this.h.slice(0, 12), 'big');\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/sha/384.js?"); +var Buffer = (__webpack_require__(9509).Buffer) +var MD5 = __webpack_require__(2318) -/***/ }), +/* eslint-disable camelcase */ +function EVP_BytesToKey (password, salt, keyBits, ivLen) { + if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary') + if (salt) { + if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary') + if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length') + } -/***/ "./node_modules/hash.js/lib/hash/sha/512.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/512.js ***! - \**************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var keyLen = keyBits / 8 + var key = Buffer.alloc(keyLen) + var iv = Buffer.alloc(ivLen || 0) + var tmp = Buffer.alloc(0) -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ../common */ \"./node_modules/hash.js/lib/hash/common.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\n\nvar BlockHash = common.BlockHash;\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nmodule.exports = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n c0_hi = s0_512_hi(ah, al);\n c0_lo = s0_512_lo(ah, al);\n c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/sha/512.js?"); + while (keyLen > 0 || ivLen > 0) { + var hash = new MD5() + hash.update(tmp) + hash.update(password) + if (salt) hash.update(salt) + tmp = hash.digest() -/***/ }), + var used = 0 -/***/ "./node_modules/hash.js/lib/hash/sha/common.js": -/*!*****************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/common.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + if (keyLen > 0) { + var keyStart = key.length - keyLen + used = Math.min(keyLen, tmp.length) + tmp.copy(key, keyStart, 0, used) + keyLen -= used + } -"use strict"; -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar rotr32 = utils.rotr32;\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\nexports.ft_1 = ft_1;\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\nexports.ch32 = ch32;\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\nexports.maj32 = maj32;\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\nexports.p32 = p32;\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\nexports.s0_256 = s0_256;\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\nexports.s1_256 = s1_256;\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\nexports.g0_256 = g0_256;\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\nexports.g1_256 = g1_256;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/sha/common.js?"); + if (used < tmp.length && ivLen > 0) { + var ivStart = iv.length - ivLen + var length = Math.min(ivLen, tmp.length - used) + tmp.copy(iv, ivStart, used, used + length) + ivLen -= length + } + } -/***/ }), + tmp.fill(0) + return { key: key, iv: iv } +} -/***/ "./node_modules/hash.js/lib/hash/utils.js": -/*!************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/utils.js ***! - \************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +module.exports = EVP_BytesToKey -"use strict"; -eval("\n\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nexports.inherits = inherits;\n\nfunction isSurrogatePair(msg, i) {\n if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {\n return false;\n }\n if (i < 0 || i + 1 >= msg.length) {\n return false;\n }\n return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;\n}\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n // Inspired by stringToUtf8ByteArray() in closure-library by Google\n // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143\n // Apache License 2.0\n // https://github.com/google/closure-library/blob/master/LICENSE\n var p = 0;\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n if (c < 128) {\n res[p++] = c;\n } else if (c < 2048) {\n res[p++] = (c >> 6) | 192;\n res[p++] = (c & 63) | 128;\n } else if (isSurrogatePair(msg, i)) {\n c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);\n res[p++] = (c >> 18) | 240;\n res[p++] = ((c >> 12) & 63) | 128;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n } else {\n res[p++] = (c >> 12) | 224;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n }\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nexports.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nexports.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nexports.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nexports.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nexports.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nexports.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nexports.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nexports.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nexports.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nexports.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nexports.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nexports.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nexports.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nexports.sum32_5 = sum32_5;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n}\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n}\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n}\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n}\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n}\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n}\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n}\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n}\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.shr64_lo = shr64_lo;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hash.js/lib/hash/utils.js?"); /***/ }), -/***/ "./node_modules/hmac-drbg/lib/hmac-drbg.js": -/*!*************************************************!*\ - !*** ./node_modules/hmac-drbg/lib/hmac-drbg.js ***! - \*************************************************/ +/***/ 3349: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\n\nvar hash = __webpack_require__(/*! hash.js */ \"./node_modules/hash.js/lib/hash.js\");\nvar utils = __webpack_require__(/*! minimalistic-crypto-utils */ \"./node_modules/minimalistic-crypto-utils/lib/utils.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this._reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');\n var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');\n var pers = utils.toArray(options.pers, options.persEnc || 'hex');\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nmodule.exports = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this._reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new hash.hmac(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils.toArray(entropy, entropyEnc);\n add = utils.toArray(add, addEnc);\n\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this._reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this._reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils.toArray(add, addEnc || 'hex');\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this._reseed++;\n return utils.encode(res, enc);\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/hmac-drbg/lib/hmac-drbg.js?"); - -/***/ }), - -/***/ "./node_modules/ieee754/index.js": -/*!***************************************!*\ - !*** ./node_modules/ieee754/index.js ***! - \***************************************/ -/***/ (function(__unused_webpack_module, exports) { - -eval("/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/ieee754/index.js?"); - -/***/ }), -/***/ "./node_modules/inherits/inherits_browser.js": -/*!***************************************************!*\ - !*** ./node_modules/inherits/inherits_browser.js ***! - \***************************************************/ -/***/ (function(module) { - -eval("if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/inherits/inherits_browser.js?"); +var Buffer = (__webpack_require__(9509).Buffer) +var Transform = (__webpack_require__(2830).Transform) +var inherits = __webpack_require__(5717) -/***/ }), +function throwIfNotStringOrBuffer (val, prefix) { + if (!Buffer.isBuffer(val) && typeof val !== 'string') { + throw new TypeError(prefix + ' must be a string or a buffer') + } +} -/***/ "./node_modules/js-logger/src/logger.js": -/*!**********************************************!*\ - !*** ./node_modules/js-logger/src/logger.js ***! - \**********************************************/ -/***/ (function(module, exports, __webpack_require__) { +function HashBase (blockSize) { + Transform.call(this) -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\r\n * js-logger - http://github.com/jonnyreeves/js-logger\r\n * Jonny Reeves, http://jonnyreeves.co.uk/\r\n * js-logger may be freely distributed under the MIT license.\r\n */\r\n(function (global) {\r\n\t\"use strict\";\r\n\r\n\t// Top level module for the global, static logger instance.\r\n\tvar Logger = { };\r\n\r\n\t// For those that are at home that are keeping score.\r\n\tLogger.VERSION = \"1.6.1\";\r\n\r\n\t// Function which handles all incoming log messages.\r\n\tvar logHandler;\r\n\r\n\t// Map of ContextualLogger instances by name; used by Logger.get() to return the same named instance.\r\n\tvar contextualLoggersByNameMap = {};\r\n\r\n\t// Polyfill for ES5's Function.bind.\r\n\tvar bind = function(scope, func) {\r\n\t\treturn function() {\r\n\t\t\treturn func.apply(scope, arguments);\r\n\t\t};\r\n\t};\r\n\r\n\t// Super exciting object merger-matron 9000 adding another 100 bytes to your download.\r\n\tvar merge = function () {\r\n\t\tvar args = arguments, target = args[0], key, i;\r\n\t\tfor (i = 1; i < args.length; i++) {\r\n\t\t\tfor (key in args[i]) {\r\n\t\t\t\tif (!(key in target) && args[i].hasOwnProperty(key)) {\r\n\t\t\t\t\ttarget[key] = args[i][key];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn target;\r\n\t};\r\n\r\n\t// Helper to define a logging level object; helps with optimisation.\r\n\tvar defineLogLevel = function(value, name) {\r\n\t\treturn { value: value, name: name };\r\n\t};\r\n\r\n\t// Predefined logging levels.\r\n\tLogger.TRACE = defineLogLevel(1, 'TRACE');\r\n\tLogger.DEBUG = defineLogLevel(2, 'DEBUG');\r\n\tLogger.INFO = defineLogLevel(3, 'INFO');\r\n\tLogger.TIME = defineLogLevel(4, 'TIME');\r\n\tLogger.WARN = defineLogLevel(5, 'WARN');\r\n\tLogger.ERROR = defineLogLevel(8, 'ERROR');\r\n\tLogger.OFF = defineLogLevel(99, 'OFF');\r\n\r\n\t// Inner class which performs the bulk of the work; ContextualLogger instances can be configured independently\r\n\t// of each other.\r\n\tvar ContextualLogger = function(defaultContext) {\r\n\t\tthis.context = defaultContext;\r\n\t\tthis.setLevel(defaultContext.filterLevel);\r\n\t\tthis.log = this.info; // Convenience alias.\r\n\t};\r\n\r\n\tContextualLogger.prototype = {\r\n\t\t// Changes the current logging level for the logging instance.\r\n\t\tsetLevel: function (newLevel) {\r\n\t\t\t// Ensure the supplied Level object looks valid.\r\n\t\t\tif (newLevel && \"value\" in newLevel) {\r\n\t\t\t\tthis.context.filterLevel = newLevel;\r\n\t\t\t}\r\n\t\t},\r\n\t\t\r\n\t\t// Gets the current logging level for the logging instance\r\n\t\tgetLevel: function () {\r\n\t\t\treturn this.context.filterLevel;\r\n\t\t},\r\n\r\n\t\t// Is the logger configured to output messages at the supplied level?\r\n\t\tenabledFor: function (lvl) {\r\n\t\t\tvar filterLevel = this.context.filterLevel;\r\n\t\t\treturn lvl.value >= filterLevel.value;\r\n\t\t},\r\n\r\n\t\ttrace: function () {\r\n\t\t\tthis.invoke(Logger.TRACE, arguments);\r\n\t\t},\r\n\r\n\t\tdebug: function () {\r\n\t\t\tthis.invoke(Logger.DEBUG, arguments);\r\n\t\t},\r\n\r\n\t\tinfo: function () {\r\n\t\t\tthis.invoke(Logger.INFO, arguments);\r\n\t\t},\r\n\r\n\t\twarn: function () {\r\n\t\t\tthis.invoke(Logger.WARN, arguments);\r\n\t\t},\r\n\r\n\t\terror: function () {\r\n\t\t\tthis.invoke(Logger.ERROR, arguments);\r\n\t\t},\r\n\r\n\t\ttime: function (label) {\r\n\t\t\tif (typeof label === 'string' && label.length > 0) {\r\n\t\t\t\tthis.invoke(Logger.TIME, [ label, 'start' ]);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\ttimeEnd: function (label) {\r\n\t\t\tif (typeof label === 'string' && label.length > 0) {\r\n\t\t\t\tthis.invoke(Logger.TIME, [ label, 'end' ]);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t// Invokes the logger callback if it's not being filtered.\r\n\t\tinvoke: function (level, msgArgs) {\r\n\t\t\tif (logHandler && this.enabledFor(level)) {\r\n\t\t\t\tlogHandler(msgArgs, merge({ level: level }, this.context));\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t// Protected instance which all calls to the to level `Logger` module will be routed through.\r\n\tvar globalLogger = new ContextualLogger({ filterLevel: Logger.OFF });\r\n\r\n\t// Configure the global Logger instance.\r\n\t(function() {\r\n\t\t// Shortcut for optimisers.\r\n\t\tvar L = Logger;\r\n\r\n\t\tL.enabledFor = bind(globalLogger, globalLogger.enabledFor);\r\n\t\tL.trace = bind(globalLogger, globalLogger.trace);\r\n\t\tL.debug = bind(globalLogger, globalLogger.debug);\r\n\t\tL.time = bind(globalLogger, globalLogger.time);\r\n\t\tL.timeEnd = bind(globalLogger, globalLogger.timeEnd);\r\n\t\tL.info = bind(globalLogger, globalLogger.info);\r\n\t\tL.warn = bind(globalLogger, globalLogger.warn);\r\n\t\tL.error = bind(globalLogger, globalLogger.error);\r\n\r\n\t\t// Don't forget the convenience alias!\r\n\t\tL.log = L.info;\r\n\t}());\r\n\r\n\t// Set the global logging handler. The supplied function should expect two arguments, the first being an arguments\r\n\t// object with the supplied log messages and the second being a context object which contains a hash of stateful\r\n\t// parameters which the logging function can consume.\r\n\tLogger.setHandler = function (func) {\r\n\t\tlogHandler = func;\r\n\t};\r\n\r\n\t// Sets the global logging filter level which applies to *all* previously registered, and future Logger instances.\r\n\t// (note that named loggers (retrieved via `Logger.get`) can be configured independently if required).\r\n\tLogger.setLevel = function(level) {\r\n\t\t// Set the globalLogger's level.\r\n\t\tglobalLogger.setLevel(level);\r\n\r\n\t\t// Apply this level to all registered contextual loggers.\r\n\t\tfor (var key in contextualLoggersByNameMap) {\r\n\t\t\tif (contextualLoggersByNameMap.hasOwnProperty(key)) {\r\n\t\t\t\tcontextualLoggersByNameMap[key].setLevel(level);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t// Gets the global logging filter level\r\n\tLogger.getLevel = function() {\r\n\t\treturn globalLogger.getLevel();\r\n\t};\r\n\r\n\t// Retrieve a ContextualLogger instance. Note that named loggers automatically inherit the global logger's level,\r\n\t// default context and log handler.\r\n\tLogger.get = function (name) {\r\n\t\t// All logger instances are cached so they can be configured ahead of use.\r\n\t\treturn contextualLoggersByNameMap[name] ||\r\n\t\t\t(contextualLoggersByNameMap[name] = new ContextualLogger(merge({ name: name }, globalLogger.context)));\r\n\t};\r\n\r\n\t// CreateDefaultHandler returns a handler function which can be passed to `Logger.setHandler()` which will\r\n\t// write to the window's console object (if present); the optional options object can be used to customise the\r\n\t// formatter used to format each log message.\r\n\tLogger.createDefaultHandler = function (options) {\r\n\t\toptions = options || {};\r\n\r\n\t\toptions.formatter = options.formatter || function defaultMessageFormatter(messages, context) {\r\n\t\t\t// Prepend the logger's name to the log message for easy identification.\r\n\t\t\tif (context.name) {\r\n\t\t\t\tmessages.unshift(\"[\" + context.name + \"]\");\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// Map of timestamps by timer labels used to track `#time` and `#timeEnd()` invocations in environments\r\n\t\t// that don't offer a native console method.\r\n\t\tvar timerStartTimeByLabelMap = {};\r\n\r\n\t\t// Support for IE8+ (and other, slightly more sane environments)\r\n\t\tvar invokeConsoleMethod = function (hdlr, messages) {\r\n\t\t\tFunction.prototype.apply.call(hdlr, console, messages);\r\n\t\t};\r\n\r\n\t\t// Check for the presence of a logger.\r\n\t\tif (typeof console === \"undefined\") {\r\n\t\t\treturn function () { /* no console */ };\r\n\t\t}\r\n\r\n\t\treturn function(messages, context) {\r\n\t\t\t// Convert arguments object to Array.\r\n\t\t\tmessages = Array.prototype.slice.call(messages);\r\n\r\n\t\t\tvar hdlr = console.log;\r\n\t\t\tvar timerLabel;\r\n\r\n\t\t\tif (context.level === Logger.TIME) {\r\n\t\t\t\ttimerLabel = (context.name ? '[' + context.name + '] ' : '') + messages[0];\r\n\r\n\t\t\t\tif (messages[1] === 'start') {\r\n\t\t\t\t\tif (console.time) {\r\n\t\t\t\t\t\tconsole.time(timerLabel);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\ttimerStartTimeByLabelMap[timerLabel] = new Date().getTime();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tif (console.timeEnd) {\r\n\t\t\t\t\t\tconsole.timeEnd(timerLabel);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tinvokeConsoleMethod(hdlr, [ timerLabel + ': ' +\r\n\t\t\t\t\t\t\t(new Date().getTime() - timerStartTimeByLabelMap[timerLabel]) + 'ms' ]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Delegate through to custom warn/error loggers if present on the console.\r\n\t\t\t\tif (context.level === Logger.WARN && console.warn) {\r\n\t\t\t\t\thdlr = console.warn;\r\n\t\t\t\t} else if (context.level === Logger.ERROR && console.error) {\r\n\t\t\t\t\thdlr = console.error;\r\n\t\t\t\t} else if (context.level === Logger.INFO && console.info) {\r\n\t\t\t\t\thdlr = console.info;\r\n\t\t\t\t} else if (context.level === Logger.DEBUG && console.debug) {\r\n\t\t\t\t\thdlr = console.debug;\r\n\t\t\t\t} else if (context.level === Logger.TRACE && console.trace) {\r\n\t\t\t\t\thdlr = console.trace;\r\n\t\t\t\t}\r\n\r\n\t\t\t\toptions.formatter(messages, context);\r\n\t\t\t\tinvokeConsoleMethod(hdlr, messages);\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n\r\n\t// Configure and example a Default implementation which writes to the `window.console` (if present). The\r\n\t// `options` hash can be used to configure the default logLevel and provide a custom message formatter.\r\n\tLogger.useDefaults = function(options) {\r\n\t\tLogger.setLevel(options && options.defaultLevel || Logger.DEBUG);\r\n\t\tLogger.setHandler(Logger.createDefaultHandler(options));\r\n\t};\r\n\r\n\t// Createa an alias to useDefaults to avoid reaking a react-hooks rule.\r\n\tLogger.setDefaults = Logger.useDefaults;\r\n\r\n\t// Export to popular environments boilerplate.\r\n\tif (true) {\r\n\t\t!(__WEBPACK_AMD_DEFINE_FACTORY__ = (Logger),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r\n\t}\r\n\telse {}\r\n}(this));\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/js-logger/src/logger.js?"); + this._block = Buffer.allocUnsafe(blockSize) + this._blockSize = blockSize + this._blockOffset = 0 + this._length = [0, 0, 0, 0] -/***/ }), + this._finalized = false +} -/***/ "./node_modules/js-sha3/src/sha3.js": -/*!******************************************!*\ - !*** ./node_modules/js-sha3/src/sha3.js ***! - \******************************************/ -/***/ (function(module, exports, __webpack_require__) { +inherits(HashBase, Transform) -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\nvar __WEBPACK_AMD_DEFINE_RESULT__;/**\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\n *\n * @version 0.8.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var INPUT_ERROR = 'input is invalid type';\n var FINALIZE_ERROR = 'finalize already called';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA3_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = __webpack_require__.g;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && \"object\" === 'object' && module.exports;\n var AMD = true && __webpack_require__.amdO;\n var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\n var CSHAKE_PADDING = [4, 1024, 262144, 67108864];\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\n var PADDING = [6, 1536, 393216, 100663296];\n var SHIFT = [0, 8, 16, 24];\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n var BITS = [224, 256, 384, 512];\n var SHAKE_BITS = [128, 256];\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];\n var CSHAKE_BYTEPAD = {\n '128': 168,\n '256': 136\n };\n\n if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n\n if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n\n var createOutputMethod = function (bits, padding, outputType) {\n return function (message) {\n return new Keccak(bits, padding, bits).update(message)[outputType]();\n };\n };\n\n var createShakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits) {\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\n };\n };\n\n var createCshakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits, n, s) {\n return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();\n };\n };\n\n var createKmacOutputMethod = function (bits, padding, outputType) {\n return function (key, message, outputBits, s) {\n return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();\n };\n };\n\n var createOutputMethods = function (method, createMethod, bits, padding) {\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createMethod(bits, padding, type);\n }\n return method;\n };\n\n var createMethod = function (bits, padding) {\n var method = createOutputMethod(bits, padding, 'hex');\n method.create = function () {\n return new Keccak(bits, padding, bits);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n return createOutputMethods(method, createOutputMethod, bits, padding);\n };\n\n var createShakeMethod = function (bits, padding) {\n var method = createShakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits) {\n return new Keccak(bits, padding, outputBits);\n };\n method.update = function (message, outputBits) {\n return method.create(outputBits).update(message);\n };\n return createOutputMethods(method, createShakeOutputMethod, bits, padding);\n };\n\n var createCshakeMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createCshakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits, n, s) {\n if (!n && !s) {\n return methods['shake' + bits].create(outputBits);\n } else {\n return new Keccak(bits, padding, outputBits).bytepad([n, s], w);\n }\n };\n method.update = function (message, outputBits, n, s) {\n return method.create(outputBits, n, s).update(message);\n };\n return createOutputMethods(method, createCshakeOutputMethod, bits, padding);\n };\n\n var createKmacMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createKmacOutputMethod(bits, padding, 'hex');\n method.create = function (key, outputBits, s) {\n return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);\n };\n method.update = function (key, message, outputBits, s) {\n return method.create(key, outputBits, s).update(message);\n };\n return createOutputMethods(method, createKmacOutputMethod, bits, padding);\n };\n\n var algorithms = [\n { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },\n { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },\n { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },\n { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },\n { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }\n ];\n\n var methods = {}, methodNames = [];\n\n for (var i = 0; i < algorithms.length; ++i) {\n var algorithm = algorithms[i];\n var bits = algorithm.bits;\n for (var j = 0; j < bits.length; ++j) {\n var methodName = algorithm.name + '_' + bits[j];\n methodNames.push(methodName);\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\n if (algorithm.name !== 'sha3') {\n var newMethodName = algorithm.name + bits[j];\n methodNames.push(newMethodName);\n methods[newMethodName] = methods[methodName];\n }\n }\n }\n\n function Keccak(bits, padding, outputBits) {\n this.blocks = [];\n this.s = [];\n this.padding = padding;\n this.outputBits = outputBits;\n this.reset = true;\n this.finalized = false;\n this.block = 0;\n this.start = 0;\n this.blockCount = (1600 - (bits << 1)) >> 5;\n this.byteCount = this.blockCount << 2;\n this.outputBlocks = outputBits >> 5;\n this.extraBytes = (outputBits & 31) >> 3;\n\n for (var i = 0; i < 50; ++i) {\n this.s[i] = 0;\n }\n }\n\n Keccak.prototype.update = function (message) {\n if (this.finalized) {\n throw new Error(FINALIZE_ERROR);\n }\n var notString, type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var blocks = this.blocks, byteCount = this.byteCount, length = message.length,\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\n\n while (index < length) {\n if (this.reset) {\n this.reset = false;\n blocks[0] = this.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (notString) {\n for (i = this.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n this.lastByteIndex = i;\n if (i >= byteCount) {\n this.start = i - byteCount;\n this.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n this.reset = true;\n } else {\n this.start = i;\n }\n }\n return this;\n };\n\n Keccak.prototype.encode = function (x, right) {\n var o = x & 255, n = 1;\n var bytes = [o];\n x = x >> 8;\n o = x & 255;\n while (o > 0) {\n bytes.unshift(o);\n x = x >> 8;\n o = x & 255;\n ++n;\n }\n if (right) {\n bytes.push(n);\n } else {\n bytes.unshift(n);\n }\n this.update(bytes);\n return bytes.length;\n };\n\n Keccak.prototype.encodeString = function (str) {\n var notString, type = typeof str;\n if (type !== 'string') {\n if (type === 'object') {\n if (str === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {\n str = new Uint8Array(str);\n } else if (!Array.isArray(str)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var bytes = 0, length = str.length;\n if (notString) {\n bytes = length;\n } else {\n for (var i = 0; i < str.length; ++i) {\n var code = str.charCodeAt(i);\n if (code < 0x80) {\n bytes += 1;\n } else if (code < 0x800) {\n bytes += 2;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes += 3;\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));\n bytes += 4;\n }\n }\n }\n bytes += this.encode(bytes * 8);\n this.update(str);\n return bytes;\n };\n\n Keccak.prototype.bytepad = function (strs, w) {\n var bytes = this.encode(w);\n for (var i = 0; i < strs.length; ++i) {\n bytes += this.encodeString(strs[i]);\n }\n var paddingBytes = w - bytes % w;\n var zeros = [];\n zeros.length = paddingBytes;\n this.update(zeros);\n return this;\n };\n\n Keccak.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\n blocks[i >> 2] |= this.padding[i & 3];\n if (this.lastByteIndex === this.byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n };\n\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var hex = '', block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n if (extraBytes) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\n if (extraBytes > 1) {\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\n }\n if (extraBytes > 2) {\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\n }\n }\n return hex;\n };\n\n Keccak.prototype.arrayBuffer = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var bytes = this.outputBits >> 3;\n var buffer;\n if (extraBytes) {\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\n } else {\n buffer = new ArrayBuffer(bytes);\n }\n var array = new Uint32Array(buffer);\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n array[j] = s[i];\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n array[i] = s[i];\n buffer = buffer.slice(0, bytes);\n }\n return buffer;\n };\n\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\n\n Keccak.prototype.digest = Keccak.prototype.array = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var array = [], offset, block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n array[offset + 1] = (block >> 8) & 0xFF;\n array[offset + 2] = (block >> 16) & 0xFF;\n array[offset + 3] = (block >> 24) & 0xFF;\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n if (extraBytes > 1) {\n array[offset + 1] = (block >> 8) & 0xFF;\n }\n if (extraBytes > 2) {\n array[offset + 2] = (block >> 16) & 0xFF;\n }\n }\n return array;\n };\n\n function Kmac(bits, padding, outputBits) {\n Keccak.call(this, bits, padding, outputBits);\n }\n\n Kmac.prototype = new Keccak();\n\n Kmac.prototype.finalize = function () {\n this.encode(this.outputBits, true);\n return Keccak.prototype.finalize.call(this);\n };\n\n var f = function (s) {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n };\n\n if (COMMON_JS) {\n module.exports = methods;\n } else {\n for (i = 0; i < methodNames.length; ++i) {\n root[methodNames[i]] = methods[methodNames[i]];\n }\n if (AMD) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return methods;\n }).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n }\n})();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/js-sha3/src/sha3.js?"); +HashBase.prototype._transform = function (chunk, encoding, callback) { + var error = null + try { + this.update(chunk, encoding) + } catch (err) { + error = err + } -/***/ }), + callback(error) +} -/***/ "./node_modules/long/src/long.js": -/*!***************************************!*\ - !*** ./node_modules/long/src/long.js ***! - \***************************************/ -/***/ (function(module) { +HashBase.prototype._flush = function (callback) { + var error = null + try { + this.push(this.digest()) + } catch (err) { + error = err + } -eval("module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/long/src/long.js?"); + callback(error) +} -/***/ }), +HashBase.prototype.update = function (data, encoding) { + throwIfNotStringOrBuffer(data, 'Data') + if (this._finalized) throw new Error('Digest already called') + if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding) -/***/ "./node_modules/md5.js/index.js": -/*!**************************************!*\ - !*** ./node_modules/md5.js/index.js ***! - \**************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // consume data + var block = this._block + var offset = 0 + while (this._blockOffset + data.length - offset >= this._blockSize) { + for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] + this._update() + this._blockOffset = 0 + } + while (offset < data.length) block[this._blockOffset++] = data[offset++] -"use strict"; -eval("\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar HashBase = __webpack_require__(/*! hash-base */ \"./node_modules/hash-base/index.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar ARRAY16 = new Array(16)\n\nfunction MD5 () {\n HashBase.call(this, 64)\n\n // state\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n}\n\ninherits(MD5, HashBase)\n\nMD5.prototype._update = function () {\n var M = ARRAY16\n for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)\n\n var a = this._a\n var b = this._b\n var c = this._c\n var d = this._d\n\n a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)\n d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)\n c = fnF(c, d, a, b, M[2], 0x242070db, 17)\n b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)\n a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)\n d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)\n c = fnF(c, d, a, b, M[6], 0xa8304613, 17)\n b = fnF(b, c, d, a, M[7], 0xfd469501, 22)\n a = fnF(a, b, c, d, M[8], 0x698098d8, 7)\n d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)\n c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)\n b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)\n a = fnF(a, b, c, d, M[12], 0x6b901122, 7)\n d = fnF(d, a, b, c, M[13], 0xfd987193, 12)\n c = fnF(c, d, a, b, M[14], 0xa679438e, 17)\n b = fnF(b, c, d, a, M[15], 0x49b40821, 22)\n\n a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)\n d = fnG(d, a, b, c, M[6], 0xc040b340, 9)\n c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)\n b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)\n a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)\n d = fnG(d, a, b, c, M[10], 0x02441453, 9)\n c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)\n b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)\n a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)\n d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)\n c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)\n b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)\n a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)\n d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)\n c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)\n b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)\n\n a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)\n d = fnH(d, a, b, c, M[8], 0x8771f681, 11)\n c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)\n b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)\n a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)\n d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)\n c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)\n b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)\n a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)\n d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)\n c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)\n b = fnH(b, c, d, a, M[6], 0x04881d05, 23)\n a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)\n d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)\n c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)\n b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)\n\n a = fnI(a, b, c, d, M[0], 0xf4292244, 6)\n d = fnI(d, a, b, c, M[7], 0x432aff97, 10)\n c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)\n b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)\n a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)\n d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)\n c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)\n b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)\n a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)\n d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)\n c = fnI(c, d, a, b, M[6], 0xa3014314, 15)\n b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)\n a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)\n d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)\n c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)\n b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)\n\n this._a = (this._a + a) | 0\n this._b = (this._b + b) | 0\n this._c = (this._c + c) | 0\n this._d = (this._d + d) | 0\n}\n\nMD5.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64)\n this._update()\n this._blockOffset = 0\n }\n\n this._block.fill(0, this._blockOffset, 56)\n this._block.writeUInt32LE(this._length[0], 56)\n this._block.writeUInt32LE(this._length[1], 60)\n this._update()\n\n // produce result\n var buffer = Buffer.allocUnsafe(16)\n buffer.writeInt32LE(this._a, 0)\n buffer.writeInt32LE(this._b, 4)\n buffer.writeInt32LE(this._c, 8)\n buffer.writeInt32LE(this._d, 12)\n return buffer\n}\n\nfunction rotl (x, n) {\n return (x << n) | (x >>> (32 - n))\n}\n\nfunction fnF (a, b, c, d, m, k, s) {\n return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnG (a, b, c, d, m, k, s) {\n return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnH (a, b, c, d, m, k, s) {\n return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnI (a, b, c, d, m, k, s) {\n return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0\n}\n\nmodule.exports = MD5\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/md5.js/index.js?"); + // update length + for (var j = 0, carry = data.length * 8; carry > 0; ++j) { + this._length[j] += carry + carry = (this._length[j] / 0x0100000000) | 0 + if (carry > 0) this._length[j] -= 0x0100000000 * carry + } -/***/ }), + return this +} -/***/ "./node_modules/miller-rabin/lib/mr.js": -/*!*********************************************!*\ - !*** ./node_modules/miller-rabin/lib/mr.js ***! - \*********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +HashBase.prototype._update = function () { + throw new Error('_update is not implemented') +} -eval("var bn = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\nvar brorand = __webpack_require__(/*! brorand */ \"./src/fallback/unity/brorand.js\");\n\nfunction MillerRabin(rand) {\n this.rand = rand || new brorand.Rand();\n}\nmodule.exports = MillerRabin;\n\nMillerRabin.create = function create(rand) {\n return new MillerRabin(rand);\n};\n\nMillerRabin.prototype._randbelow = function _randbelow(n) {\n var len = n.bitLength();\n var min_bytes = Math.ceil(len / 8);\n\n // Generage random bytes until a number less than n is found.\n // This ensures that 0..n-1 have an equal probability of being selected.\n do\n var a = new bn(this.rand.generate(min_bytes));\n while (a.cmp(n) >= 0);\n\n return a;\n};\n\nMillerRabin.prototype._randrange = function _randrange(start, stop) {\n // Generate a random number greater than or equal to start and less than stop.\n var size = stop.sub(start);\n return start.add(this._randbelow(size));\n};\n\nMillerRabin.prototype.test = function test(n, k, cb) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n var prime = true;\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n if (cb)\n cb(a);\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return false;\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s)\n return false;\n }\n\n return prime;\n};\n\nMillerRabin.prototype.getDivisor = function getDivisor(n, k) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n\n var g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s) {\n x = x.redSqr();\n return x.fromRed().subn(1).gcd(n);\n }\n }\n\n return false;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/miller-rabin/lib/mr.js?"); +HashBase.prototype.digest = function (encoding) { + if (this._finalized) throw new Error('Digest already called') + this._finalized = true -/***/ }), + var digest = this._digest() + if (encoding !== undefined) digest = digest.toString(encoding) -/***/ "./node_modules/minimalistic-assert/index.js": -/*!***************************************************!*\ - !*** ./node_modules/minimalistic-assert/index.js ***! - \***************************************************/ -/***/ (function(module) { + // reset state + this._block.fill(0) + this._blockOffset = 0 + for (var i = 0; i < 4; ++i) this._length[i] = 0 -eval("module.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/minimalistic-assert/index.js?"); + return digest +} -/***/ }), +HashBase.prototype._digest = function () { + throw new Error('_digest is not implemented') +} -/***/ "./node_modules/minimalistic-crypto-utils/lib/utils.js": -/*!*************************************************************!*\ - !*** ./node_modules/minimalistic-crypto-utils/lib/utils.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, exports) { +module.exports = HashBase -"use strict"; -eval("\n\nvar utils = exports;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/minimalistic-crypto-utils/lib/utils.js?"); /***/ }), -/***/ "./node_modules/parse-asn1/asn1.js": -/*!*****************************************!*\ - !*** ./node_modules/parse-asn1/asn1.js ***! - \*****************************************/ +/***/ 3715: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js\n// Fedor, you are amazing.\n\n\nvar asn1 = __webpack_require__(/*! asn1.js */ \"./node_modules/asn1.js/lib/asn1.js\")\n\nexports.certificate = __webpack_require__(/*! ./certificate */ \"./node_modules/parse-asn1/certificate.js\")\n\nvar RSAPrivateKey = asn1.define('RSAPrivateKey', function () {\n this.seq().obj(\n this.key('version').int(),\n this.key('modulus').int(),\n this.key('publicExponent').int(),\n this.key('privateExponent').int(),\n this.key('prime1').int(),\n this.key('prime2').int(),\n this.key('exponent1').int(),\n this.key('exponent2').int(),\n this.key('coefficient').int()\n )\n})\nexports.RSAPrivateKey = RSAPrivateKey\n\nvar RSAPublicKey = asn1.define('RSAPublicKey', function () {\n this.seq().obj(\n this.key('modulus').int(),\n this.key('publicExponent').int()\n )\n})\nexports.RSAPublicKey = RSAPublicKey\n\nvar PublicKey = asn1.define('SubjectPublicKeyInfo', function () {\n this.seq().obj(\n this.key('algorithm').use(AlgorithmIdentifier),\n this.key('subjectPublicKey').bitstr()\n )\n})\nexports.PublicKey = PublicKey\n\nvar AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {\n this.seq().obj(\n this.key('algorithm').objid(),\n this.key('none').null_().optional(),\n this.key('curve').objid().optional(),\n this.key('params').seq().obj(\n this.key('p').int(),\n this.key('q').int(),\n this.key('g').int()\n ).optional()\n )\n})\n\nvar PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {\n this.seq().obj(\n this.key('version').int(),\n this.key('algorithm').use(AlgorithmIdentifier),\n this.key('subjectPrivateKey').octstr()\n )\n})\nexports.PrivateKey = PrivateKeyInfo\nvar EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {\n this.seq().obj(\n this.key('algorithm').seq().obj(\n this.key('id').objid(),\n this.key('decrypt').seq().obj(\n this.key('kde').seq().obj(\n this.key('id').objid(),\n this.key('kdeparams').seq().obj(\n this.key('salt').octstr(),\n this.key('iters').int()\n )\n ),\n this.key('cipher').seq().obj(\n this.key('algo').objid(),\n this.key('iv').octstr()\n )\n )\n ),\n this.key('subjectPrivateKey').octstr()\n )\n})\n\nexports.EncryptedPrivateKey = EncryptedPrivateKeyInfo\n\nvar DSAPrivateKey = asn1.define('DSAPrivateKey', function () {\n this.seq().obj(\n this.key('version').int(),\n this.key('p').int(),\n this.key('q').int(),\n this.key('g').int(),\n this.key('pub_key').int(),\n this.key('priv_key').int()\n )\n})\nexports.DSAPrivateKey = DSAPrivateKey\n\nexports.DSAparam = asn1.define('DSAparam', function () {\n this.int()\n})\n\nvar ECPrivateKey = asn1.define('ECPrivateKey', function () {\n this.seq().obj(\n this.key('version').int(),\n this.key('privateKey').octstr(),\n this.key('parameters').optional().explicit(0).use(ECParameters),\n this.key('publicKey').optional().explicit(1).bitstr()\n )\n})\nexports.ECPrivateKey = ECPrivateKey\n\nvar ECParameters = asn1.define('ECParameters', function () {\n this.choice({\n namedCurve: this.objid()\n })\n})\n\nexports.signature = asn1.define('signature', function () {\n this.seq().obj(\n this.key('r').int(),\n this.key('s').int()\n )\n})\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/parse-asn1/asn1.js?"); - -/***/ }), - -/***/ "./node_modules/parse-asn1/certificate.js": -/*!************************************************!*\ - !*** ./node_modules/parse-asn1/certificate.js ***! - \************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -eval("// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js\n// thanks to @Rantanen\n\n\n\nvar asn = __webpack_require__(/*! asn1.js */ \"./node_modules/asn1.js/lib/asn1.js\")\n\nvar Time = asn.define('Time', function () {\n this.choice({\n utcTime: this.utctime(),\n generalTime: this.gentime()\n })\n})\n\nvar AttributeTypeValue = asn.define('AttributeTypeValue', function () {\n this.seq().obj(\n this.key('type').objid(),\n this.key('value').any()\n )\n})\n\nvar AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {\n this.seq().obj(\n this.key('algorithm').objid(),\n this.key('parameters').optional(),\n this.key('curve').objid().optional()\n )\n})\n\nvar SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {\n this.seq().obj(\n this.key('algorithm').use(AlgorithmIdentifier),\n this.key('subjectPublicKey').bitstr()\n )\n})\n\nvar RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {\n this.setof(AttributeTypeValue)\n})\n\nvar RDNSequence = asn.define('RDNSequence', function () {\n this.seqof(RelativeDistinguishedName)\n})\n\nvar Name = asn.define('Name', function () {\n this.choice({\n rdnSequence: this.use(RDNSequence)\n })\n})\n\nvar Validity = asn.define('Validity', function () {\n this.seq().obj(\n this.key('notBefore').use(Time),\n this.key('notAfter').use(Time)\n )\n})\n\nvar Extension = asn.define('Extension', function () {\n this.seq().obj(\n this.key('extnID').objid(),\n this.key('critical').bool().def(false),\n this.key('extnValue').octstr()\n )\n})\n\nvar TBSCertificate = asn.define('TBSCertificate', function () {\n this.seq().obj(\n this.key('version').explicit(0).int().optional(),\n this.key('serialNumber').int(),\n this.key('signature').use(AlgorithmIdentifier),\n this.key('issuer').use(Name),\n this.key('validity').use(Validity),\n this.key('subject').use(Name),\n this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),\n this.key('issuerUniqueID').implicit(1).bitstr().optional(),\n this.key('subjectUniqueID').implicit(2).bitstr().optional(),\n this.key('extensions').explicit(3).seqof(Extension).optional()\n )\n})\n\nvar X509Certificate = asn.define('X509Certificate', function () {\n this.seq().obj(\n this.key('tbsCertificate').use(TBSCertificate),\n this.key('signatureAlgorithm').use(AlgorithmIdentifier),\n this.key('signatureValue').bitstr()\n )\n})\n\nmodule.exports = X509Certificate\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/parse-asn1/certificate.js?"); - -/***/ }), - -/***/ "./node_modules/parse-asn1/fixProc.js": -/*!********************************************!*\ - !*** ./node_modules/parse-asn1/fixProc.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -eval("// adapted from https://github.com/apatil/pemstrip\nvar findProc = /Proc-Type: 4,ENCRYPTED[\\n\\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\\n\\r]+([0-9A-z\\n\\r+/=]+)[\\n\\r]+/m\nvar startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m\nvar fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\\n\\r+/=]+)-----END \\1-----$/m\nvar evp = __webpack_require__(/*! evp_bytestokey */ \"./node_modules/evp_bytestokey/index.js\")\nvar ciphers = __webpack_require__(/*! browserify-aes */ \"./node_modules/browserify-aes/browser.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nmodule.exports = function (okey, password) {\n var key = okey.toString()\n var match = key.match(findProc)\n var decrypted\n if (!match) {\n var match2 = key.match(fullRegex)\n decrypted = Buffer.from(match2[2].replace(/[\\r\\n]/g, ''), 'base64')\n } else {\n var suite = 'aes' + match[1]\n var iv = Buffer.from(match[2], 'hex')\n var cipherText = Buffer.from(match[3].replace(/[\\r\\n]/g, ''), 'base64')\n var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key\n var out = []\n var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)\n out.push(cipher.update(cipherText))\n out.push(cipher.final())\n decrypted = Buffer.concat(out)\n }\n var tag = key.match(startRegex)[1]\n return {\n tag: tag,\n data: decrypted\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/parse-asn1/fixProc.js?"); +var hash = exports; -/***/ }), +hash.utils = __webpack_require__(6436); +hash.common = __webpack_require__(5772); +hash.sha = __webpack_require__(9041); +hash.ripemd = __webpack_require__(2949); +hash.hmac = __webpack_require__(2344); -/***/ "./node_modules/parse-asn1/index.js": -/*!******************************************!*\ - !*** ./node_modules/parse-asn1/index.js ***! - \******************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +// Proxy hash functions to the main object +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; -eval("var asn1 = __webpack_require__(/*! ./asn1 */ \"./node_modules/parse-asn1/asn1.js\")\nvar aesid = __webpack_require__(/*! ./aesid.json */ \"./node_modules/parse-asn1/aesid.json\")\nvar fixProc = __webpack_require__(/*! ./fixProc */ \"./node_modules/parse-asn1/fixProc.js\")\nvar ciphers = __webpack_require__(/*! browserify-aes */ \"./node_modules/browserify-aes/browser.js\")\nvar compat = __webpack_require__(/*! pbkdf2 */ \"./node_modules/pbkdf2/browser.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nmodule.exports = parseKeys\n\nfunction parseKeys (buffer) {\n var password\n if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {\n password = buffer.passphrase\n buffer = buffer.key\n }\n if (typeof buffer === 'string') {\n buffer = Buffer.from(buffer)\n }\n\n var stripped = fixProc(buffer, password)\n\n var type = stripped.tag\n var data = stripped.data\n var subtype, ndata\n switch (type) {\n case 'CERTIFICATE':\n ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo\n // falls through\n case 'PUBLIC KEY':\n if (!ndata) {\n ndata = asn1.PublicKey.decode(data, 'der')\n }\n subtype = ndata.algorithm.algorithm.join('.')\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')\n case '1.2.840.10045.2.1':\n ndata.subjectPrivateKey = ndata.subjectPublicKey\n return {\n type: 'ec',\n data: ndata\n }\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')\n return {\n type: 'dsa',\n data: ndata.algorithm.params\n }\n default: throw new Error('unknown key id ' + subtype)\n }\n // throw new Error('unknown key type ' + type)\n case 'ENCRYPTED PRIVATE KEY':\n data = asn1.EncryptedPrivateKey.decode(data, 'der')\n data = decrypt(data, password)\n // falls through\n case 'PRIVATE KEY':\n ndata = asn1.PrivateKey.decode(data, 'der')\n subtype = ndata.algorithm.algorithm.join('.')\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')\n case '1.2.840.10045.2.1':\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey\n }\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')\n return {\n type: 'dsa',\n params: ndata.algorithm.params\n }\n default: throw new Error('unknown key id ' + subtype)\n }\n // throw new Error('unknown key type ' + type)\n case 'RSA PUBLIC KEY':\n return asn1.RSAPublicKey.decode(data, 'der')\n case 'RSA PRIVATE KEY':\n return asn1.RSAPrivateKey.decode(data, 'der')\n case 'DSA PRIVATE KEY':\n return {\n type: 'dsa',\n params: asn1.DSAPrivateKey.decode(data, 'der')\n }\n case 'EC PRIVATE KEY':\n data = asn1.ECPrivateKey.decode(data, 'der')\n return {\n curve: data.parameters.value,\n privateKey: data.privateKey\n }\n default: throw new Error('unknown key type ' + type)\n }\n}\nparseKeys.signature = asn1.signature\nfunction decrypt (data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt\n var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)\n var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]\n var iv = data.algorithm.decrypt.cipher.iv\n var cipherText = data.subjectPrivateKey\n var keylen = parseInt(algo.split('-')[1], 10) / 8\n var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')\n var cipher = ciphers.createDecipheriv(algo, key, iv)\n var out = []\n out.push(cipher.update(cipherText))\n out.push(cipher.final())\n return Buffer.concat(out)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/parse-asn1/index.js?"); /***/ }), -/***/ "./node_modules/pbkdf2/browser.js": -/*!****************************************!*\ - !*** ./node_modules/pbkdf2/browser.js ***! - \****************************************/ +/***/ 5772: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("exports.pbkdf2 = __webpack_require__(/*! ./lib/async */ \"./node_modules/pbkdf2/lib/async.js\")\nexports.pbkdf2Sync = __webpack_require__(/*! ./lib/sync */ \"./node_modules/pbkdf2/lib/sync-browser.js\")\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/pbkdf2/browser.js?"); - -/***/ }), - -/***/ "./node_modules/pbkdf2/lib/async.js": -/*!******************************************!*\ - !*** ./node_modules/pbkdf2/lib/async.js ***! - \******************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar checkParameters = __webpack_require__(/*! ./precondition */ \"./node_modules/pbkdf2/lib/precondition.js\")\nvar defaultEncoding = __webpack_require__(/*! ./default-encoding */ \"./node_modules/pbkdf2/lib/default-encoding.js\")\nvar sync = __webpack_require__(/*! ./sync */ \"./node_modules/pbkdf2/lib/sync-browser.js\")\nvar toBuffer = __webpack_require__(/*! ./to-buffer */ \"./node_modules/pbkdf2/lib/to-buffer.js\")\n\nvar ZERO_BUF\nvar subtle = __webpack_require__.g.crypto && __webpack_require__.g.crypto.subtle\nvar toBrowser = {\n sha: 'SHA-1',\n 'sha-1': 'SHA-1',\n sha1: 'SHA-1',\n sha256: 'SHA-256',\n 'sha-256': 'SHA-256',\n sha384: 'SHA-384',\n 'sha-384': 'SHA-384',\n 'sha-512': 'SHA-512',\n sha512: 'SHA-512'\n}\nvar checks = []\nfunction checkNative (algo) {\n if (__webpack_require__.g.process && !__webpack_require__.g.process.browser) {\n return Promise.resolve(false)\n }\n if (!subtle || !subtle.importKey || !subtle.deriveBits) {\n return Promise.resolve(false)\n }\n if (checks[algo] !== undefined) {\n return checks[algo]\n }\n ZERO_BUF = ZERO_BUF || Buffer.alloc(8)\n var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)\n .then(function () {\n return true\n }).catch(function () {\n return false\n })\n checks[algo] = prom\n return prom\n}\nvar nextTick\nfunction getNextTick () {\n if (nextTick) {\n return nextTick\n }\n if (__webpack_require__.g.process && __webpack_require__.g.process.nextTick) {\n nextTick = __webpack_require__.g.process.nextTick\n } else if (__webpack_require__.g.queueMicrotask) {\n nextTick = __webpack_require__.g.queueMicrotask\n } else if (__webpack_require__.g.setImmediate) {\n nextTick = __webpack_require__.g.setImmediate\n } else {\n nextTick = __webpack_require__.g.setTimeout\n }\n return nextTick\n}\nfunction browserPbkdf2 (password, salt, iterations, length, algo) {\n return subtle.importKey(\n 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']\n ).then(function (key) {\n return subtle.deriveBits({\n name: 'PBKDF2',\n salt: salt,\n iterations: iterations,\n hash: {\n name: algo\n }\n }, key, length << 3)\n }).then(function (res) {\n return Buffer.from(res)\n })\n}\n\nfunction resolvePromise (promise, callback) {\n promise.then(function (out) {\n getNextTick()(function () {\n callback(null, out)\n })\n }, function (e) {\n getNextTick()(function () {\n callback(e)\n })\n })\n}\nmodule.exports = function (password, salt, iterations, keylen, digest, callback) {\n if (typeof digest === 'function') {\n callback = digest\n digest = undefined\n }\n\n digest = digest || 'sha1'\n var algo = toBrowser[digest.toLowerCase()]\n\n if (!algo || typeof __webpack_require__.g.Promise !== 'function') {\n getNextTick()(function () {\n var out\n try {\n out = sync(password, salt, iterations, keylen, digest)\n } catch (e) {\n return callback(e)\n }\n callback(null, out)\n })\n return\n }\n\n checkParameters(iterations, keylen)\n password = toBuffer(password, defaultEncoding, 'Password')\n salt = toBuffer(salt, defaultEncoding, 'Salt')\n if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')\n\n resolvePromise(checkNative(algo).then(function (resp) {\n if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)\n\n return sync(password, salt, iterations, keylen, digest)\n }), callback)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/pbkdf2/lib/async.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/pbkdf2/lib/default-encoding.js": -/*!*****************************************************!*\ - !*** ./node_modules/pbkdf2/lib/default-encoding.js ***! - \*****************************************************/ +var utils = __webpack_require__(6436); +var assert = __webpack_require__(9746); + +function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = 'big'; + + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; +} +exports.BlockHash = BlockHash; + +BlockHash.prototype.update = function update(msg, enc) { + // Convert message to array, pad it, and join into 32bit blocks + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + + // Enough data, try updating + if (this.pending.length >= this._delta8) { + msg = this.pending; + + // Process pending data in blocks + var r = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r, msg.length); + if (this.pending.length === 0) + this.pending = null; + + msg = utils.join32(msg, 0, msg.length - r, this.endian); + for (var i = 0; i < msg.length; i += this._delta32) + this._update(msg, i, i + this._delta32); + } + + return this; +}; + +BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert(this.pending === null); + + return this._digest(enc); +}; + +BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - ((len + this.padLength) % bytes); + var res = new Array(k + this.padLength); + res[0] = 0x80; + for (var i = 1; i < k; i++) + res[i] = 0; + + // Append length + len <<= 3; + if (this.endian === 'big') { + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = (len >>> 24) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = len & 0xff; + } else { + res[i++] = len & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 24) & 0xff; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + + for (t = 8; t < this.padLength; t++) + res[i++] = 0; + } + + return res; +}; + + +/***/ }), + +/***/ 2344: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\nvar defaultEncoding\n/* istanbul ignore next */\nif (__webpack_require__.g.process && __webpack_require__.g.process.browser) {\n defaultEncoding = 'utf-8'\n} else if (__webpack_require__.g.process && __webpack_require__.g.process.version) {\n var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)\n\n defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'\n} else {\n defaultEncoding = 'utf-8'\n}\nmodule.exports = defaultEncoding\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/pbkdf2/lib/default-encoding.js?"); - -/***/ }), +"use strict"; -/***/ "./node_modules/pbkdf2/lib/precondition.js": -/*!*************************************************!*\ - !*** ./node_modules/pbkdf2/lib/precondition.js ***! - \*************************************************/ -/***/ (function(module) { -eval("var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs\n\nmodule.exports = function (iterations, keylen) {\n if (typeof iterations !== 'number') {\n throw new TypeError('Iterations not a number')\n }\n\n if (iterations < 0) {\n throw new TypeError('Bad iterations')\n }\n\n if (typeof keylen !== 'number') {\n throw new TypeError('Key length not a number')\n }\n\n if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */\n throw new TypeError('Bad key length')\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/pbkdf2/lib/precondition.js?"); +var utils = __webpack_require__(6436); +var assert = __webpack_require__(9746); -/***/ }), +function Hmac(hash, key, enc) { + if (!(this instanceof Hmac)) + return new Hmac(hash, key, enc); + this.Hash = hash; + this.blockSize = hash.blockSize / 8; + this.outSize = hash.outSize / 8; + this.inner = null; + this.outer = null; -/***/ "./node_modules/pbkdf2/lib/sync-browser.js": -/*!*************************************************!*\ - !*** ./node_modules/pbkdf2/lib/sync-browser.js ***! - \*************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + this._init(utils.toArray(key, enc)); +} +module.exports = Hmac; -eval("var md5 = __webpack_require__(/*! create-hash/md5 */ \"./node_modules/create-hash/md5.js\")\nvar RIPEMD160 = __webpack_require__(/*! ripemd160 */ \"./node_modules/ripemd160/index.js\")\nvar sha = __webpack_require__(/*! sha.js */ \"./node_modules/sha.js/index.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar checkParameters = __webpack_require__(/*! ./precondition */ \"./node_modules/pbkdf2/lib/precondition.js\")\nvar defaultEncoding = __webpack_require__(/*! ./default-encoding */ \"./node_modules/pbkdf2/lib/default-encoding.js\")\nvar toBuffer = __webpack_require__(/*! ./to-buffer */ \"./node_modules/pbkdf2/lib/to-buffer.js\")\n\nvar ZEROS = Buffer.alloc(128)\nvar sizes = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n rmd160: 20,\n ripemd160: 20\n}\n\nfunction Hmac (alg, key, saltLen) {\n var hash = getDigest(alg)\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n if (key.length > blocksize) {\n key = hash(key)\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])\n var opad = Buffer.allocUnsafe(blocksize + sizes[alg])\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n\n var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)\n ipad.copy(ipad1, 0, 0, blocksize)\n this.ipad1 = ipad1\n this.ipad2 = ipad\n this.opad = opad\n this.alg = alg\n this.blocksize = blocksize\n this.hash = hash\n this.size = sizes[alg]\n}\n\nHmac.prototype.run = function (data, ipad) {\n data.copy(ipad, this.blocksize)\n var h = this.hash(ipad)\n h.copy(this.opad, this.blocksize)\n return this.hash(this.opad)\n}\n\nfunction getDigest (alg) {\n function shaFunc (data) {\n return sha(alg).update(data).digest()\n }\n function rmd160Func (data) {\n return new RIPEMD160().update(data).digest()\n }\n\n if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func\n if (alg === 'md5') return md5\n return shaFunc\n}\n\nfunction pbkdf2 (password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen)\n password = toBuffer(password, defaultEncoding, 'Password')\n salt = toBuffer(salt, defaultEncoding, 'Salt')\n\n digest = digest || 'sha1'\n\n var hmac = new Hmac(digest, password, salt.length)\n\n var DK = Buffer.allocUnsafe(keylen)\n var block1 = Buffer.allocUnsafe(salt.length + 4)\n salt.copy(block1, 0, 0, salt.length)\n\n var destPos = 0\n var hLen = sizes[digest]\n var l = Math.ceil(keylen / hLen)\n\n for (var i = 1; i <= l; i++) {\n block1.writeUInt32BE(i, salt.length)\n\n var T = hmac.run(block1, hmac.ipad1)\n var U = T\n\n for (var j = 1; j < iterations; j++) {\n U = hmac.run(U, hmac.ipad2)\n for (var k = 0; k < hLen; k++) T[k] ^= U[k]\n }\n\n T.copy(DK, destPos)\n destPos += hLen\n }\n\n return DK\n}\n\nmodule.exports = pbkdf2\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/pbkdf2/lib/sync-browser.js?"); +Hmac.prototype._init = function init(key) { + // Shorten key, if needed + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); -/***/ }), + // Add padding to key + for (var i = key.length; i < this.blockSize; i++) + key.push(0); -/***/ "./node_modules/pbkdf2/lib/to-buffer.js": -/*!**********************************************!*\ - !*** ./node_modules/pbkdf2/lib/to-buffer.js ***! - \**********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (i = 0; i < key.length; i++) + key[i] ^= 0x36; + this.inner = new this.Hash().update(key); -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nmodule.exports = function (thing, encoding, name) {\n if (Buffer.isBuffer(thing)) {\n return thing\n } else if (typeof thing === 'string') {\n return Buffer.from(thing, encoding)\n } else if (ArrayBuffer.isView(thing)) {\n return Buffer.from(thing.buffer)\n } else {\n throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/pbkdf2/lib/to-buffer.js?"); + // 0x36 ^ 0x5c = 0x6a + for (i = 0; i < key.length; i++) + key[i] ^= 0x6a; + this.outer = new this.Hash().update(key); +}; -/***/ }), +Hmac.prototype.update = function update(msg, enc) { + this.inner.update(msg, enc); + return this; +}; -/***/ "./node_modules/process/browser.js": -/*!*****************************************!*\ - !*** ./node_modules/process/browser.js ***! - \*****************************************/ -/***/ (function(module) { +Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); +}; -eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/process/browser.js?"); /***/ }), -/***/ "./node_modules/protobufjs/minimal.js": -/*!********************************************!*\ - !*** ./node_modules/protobufjs/minimal.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 2949: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("// minimal library entry point.\n\n\nmodule.exports = __webpack_require__(/*! ./src/index-minimal */ \"./node_modules/protobufjs/src/index-minimal.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/minimal.js?"); -/***/ }), -/***/ "./node_modules/protobufjs/src/index-minimal.js": -/*!******************************************************!*\ - !*** ./node_modules/protobufjs/src/index-minimal.js ***! - \******************************************************/ +var utils = __webpack_require__(6436); +var common = __webpack_require__(5772); + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = common.BlockHash; + +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); + + BlockHash.call(this); + + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; + this.endian = 'little'; +} +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; + +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; + +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), + s[j]), + E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), + sh[j]), + Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'little'); + else + return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return (x & y) | ((~x) & z); + else if (j <= 47) + return (x | (~y)) ^ z; + else if (j <= 63) + return (x & z) | (y & (~z)); + else + return x ^ (y | (~z)); +} + +function K(j) { + if (j <= 15) + return 0x00000000; + else if (j <= 31) + return 0x5a827999; + else if (j <= 47) + return 0x6ed9eba1; + else if (j <= 63) + return 0x8f1bbcdc; + else + return 0xa953fd4e; +} + +function Kh(j) { + if (j <= 15) + return 0x50a28be6; + else if (j <= 31) + return 0x5c4dd124; + else if (j <= 47) + return 0x6d703ef3; + else if (j <= 63) + return 0x7a6d76e9; + else + return 0x00000000; +} + +var r = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +]; + +var rh = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +]; + +var s = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +]; + +var sh = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +]; + + +/***/ }), + +/***/ 9041: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = __webpack_require__(/*! ./writer */ \"./node_modules/protobufjs/src/writer.js\");\nprotobuf.BufferWriter = __webpack_require__(/*! ./writer_buffer */ \"./node_modules/protobufjs/src/writer_buffer.js\");\nprotobuf.Reader = __webpack_require__(/*! ./reader */ \"./node_modules/protobufjs/src/reader.js\");\nprotobuf.BufferReader = __webpack_require__(/*! ./reader_buffer */ \"./node_modules/protobufjs/src/reader_buffer.js\");\n\n// Utility\nprotobuf.util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\nprotobuf.rpc = __webpack_require__(/*! ./rpc */ \"./node_modules/protobufjs/src/rpc.js\");\nprotobuf.roots = __webpack_require__(/*! ./roots */ \"./node_modules/protobufjs/src/roots.js\");\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/index-minimal.js?"); -/***/ }), -/***/ "./node_modules/protobufjs/src/reader.js": -/*!***********************************************!*\ - !*** ./node_modules/protobufjs/src/reader.js ***! - \***********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +exports.sha1 = __webpack_require__(4761); +exports.sha224 = __webpack_require__(799); +exports.sha256 = __webpack_require__(9344); +exports.sha384 = __webpack_require__(772); +exports.sha512 = __webpack_require__(5900); -"use strict"; -eval("\nmodule.exports = Reader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1\n ? new this.buf.constructor(0)\n : this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/reader.js?"); /***/ }), -/***/ "./node_modules/protobufjs/src/reader_buffer.js": -/*!******************************************************!*\ - !*** ./node_modules/protobufjs/src/reader_buffer.js ***! - \******************************************************/ +/***/ 4761: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = __webpack_require__(/*! ./reader */ \"./node_modules/protobufjs/src/reader.js\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/reader_buffer.js?"); - -/***/ }), - -/***/ "./node_modules/protobufjs/src/roots.js": -/*!**********************************************!*\ - !*** ./node_modules/protobufjs/src/roots.js ***! - \**********************************************/ -/***/ (function(module) { -"use strict"; -eval("\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available accross modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/roots.js?"); -/***/ }), +var utils = __webpack_require__(6436); +var common = __webpack_require__(5772); +var shaCommon = __webpack_require__(7038); -/***/ "./node_modules/protobufjs/src/rpc.js": -/*!********************************************!*\ - !*** ./node_modules/protobufjs/src/rpc.js ***! - \********************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_5 = utils.sum32_5; +var ft_1 = shaCommon.ft_1; +var BlockHash = common.BlockHash; -"use strict"; -eval("\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = __webpack_require__(/*! ./rpc/service */ \"./node_modules/protobufjs/src/rpc/service.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/rpc.js?"); +var sha1_K = [ + 0x5A827999, 0x6ED9EBA1, + 0x8F1BBCDC, 0xCA62C1D6 +]; -/***/ }), +function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); -/***/ "./node_modules/protobufjs/src/rpc/service.js": -/*!****************************************************!*\ - !*** ./node_modules/protobufjs/src/rpc/service.js ***! - \****************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + BlockHash.call(this); + this.h = [ + 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 ]; + this.W = new Array(80); +} -"use strict"; -eval("\nmodule.exports = Service;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/rpc/service.js?"); +utils.inherits(SHA1, BlockHash); +module.exports = SHA1; -/***/ }), +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; -/***/ "./node_modules/protobufjs/src/util/longbits.js": -/*!******************************************************!*\ - !*** ./node_modules/protobufjs/src/util/longbits.js ***! - \******************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; -"use strict"; -eval("\nmodule.exports = LongBits;\n\nvar util = __webpack_require__(/*! ../util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/util/longbits.js?"); + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; -/***/ }), + for(; i < W.length; i++) + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); -/***/ "./node_modules/protobufjs/src/util/minimal.js": -/*!*****************************************************!*\ - !*** ./node_modules/protobufjs/src/util/minimal.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; -"use strict"; -eval("\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = __webpack_require__(/*! @protobufjs/aspromise */ \"./node_modules/@protobufjs/aspromise/index.js\");\n\n// converts to / from base64 encoded strings\nutil.base64 = __webpack_require__(/*! @protobufjs/base64 */ \"./node_modules/@protobufjs/base64/index.js\");\n\n// base class of rpc.Service\nutil.EventEmitter = __webpack_require__(/*! @protobufjs/eventemitter */ \"./node_modules/@protobufjs/eventemitter/index.js\");\n\n// float handling accross browsers\nutil.float = __webpack_require__(/*! @protobufjs/float */ \"./node_modules/@protobufjs/float/index.js\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = __webpack_require__(/*! @protobufjs/inquire */ \"./node_modules/@protobufjs/inquire/index.js\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = __webpack_require__(/*! @protobufjs/utf8 */ \"./node_modules/@protobufjs/utf8/index.js\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = __webpack_require__(/*! @protobufjs/pool */ \"./node_modules/@protobufjs/pool/index.js\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = __webpack_require__(/*! ./longbits */ \"./node_modules/protobufjs/src/util/longbits.js\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof __webpack_require__.g !== \"undefined\"\n && __webpack_require__.g\n && __webpack_require__.g.process\n && __webpack_require__.g.process.versions\n && __webpack_require__.g.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && __webpack_require__.g\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;\n\n Object.defineProperty(CustomError.prototype, \"name\", { get: function() { return name; } });\n\n CustomError.prototype.toString = function toString() {\n return this.name + \": \" + this.message;\n };\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/util/minimal.js?"); + for (i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; + } -/***/ }), + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); +}; -/***/ "./node_modules/protobufjs/src/writer.js": -/*!***********************************************!*\ - !*** ./node_modules/protobufjs/src/writer.js ***! - \***********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; -"use strict"; -eval("\nmodule.exports = Writer;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/writer.js?"); /***/ }), -/***/ "./node_modules/protobufjs/src/writer_buffer.js": -/*!******************************************************!*\ - !*** ./node_modules/protobufjs/src/writer_buffer.js ***! - \******************************************************/ +/***/ 799: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = __webpack_require__(/*! ./writer */ \"./node_modules/protobufjs/src/writer.js\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = __webpack_require__(/*! ./util/minimal */ \"./node_modules/protobufjs/src/util/minimal.js\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/protobufjs/src/writer_buffer.js?"); - -/***/ }), - -/***/ "./node_modules/public-encrypt/browser.js": -/*!************************************************!*\ - !*** ./node_modules/public-encrypt/browser.js ***! - \************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -eval("exports.publicEncrypt = __webpack_require__(/*! ./publicEncrypt */ \"./node_modules/public-encrypt/publicEncrypt.js\")\nexports.privateDecrypt = __webpack_require__(/*! ./privateDecrypt */ \"./node_modules/public-encrypt/privateDecrypt.js\")\n\nexports.privateEncrypt = function privateEncrypt (key, buf) {\n return exports.publicEncrypt(key, buf, true)\n}\n\nexports.publicDecrypt = function publicDecrypt (key, buf) {\n return exports.privateDecrypt(key, buf, true)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/public-encrypt/browser.js?"); -/***/ }), - -/***/ "./node_modules/public-encrypt/mgf.js": -/*!********************************************!*\ - !*** ./node_modules/public-encrypt/mgf.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("var createHash = __webpack_require__(/*! create-hash */ \"./node_modules/create-hash/browser.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nmodule.exports = function (seed, len) {\n var t = Buffer.alloc(0)\n var i = 0\n var c\n while (t.length < len) {\n c = i2ops(i++)\n t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])\n }\n return t.slice(0, len)\n}\n\nfunction i2ops (c) {\n var out = Buffer.allocUnsafe(4)\n out.writeUInt32BE(c, 0)\n return out\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/public-encrypt/mgf.js?"); +var utils = __webpack_require__(6436); +var SHA256 = __webpack_require__(9344); -/***/ }), +function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); -/***/ "./node_modules/public-encrypt/privateDecrypt.js": -/*!*******************************************************!*\ - !*** ./node_modules/public-encrypt/privateDecrypt.js ***! - \*******************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + SHA256.call(this); + this.h = [ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; +} +utils.inherits(SHA224, SHA256); +module.exports = SHA224; -eval("var parseKeys = __webpack_require__(/*! parse-asn1 */ \"./node_modules/parse-asn1/index.js\")\nvar mgf = __webpack_require__(/*! ./mgf */ \"./node_modules/public-encrypt/mgf.js\")\nvar xor = __webpack_require__(/*! ./xor */ \"./node_modules/public-encrypt/xor.js\")\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\")\nvar crt = __webpack_require__(/*! browserify-rsa */ \"./node_modules/browserify-rsa/index.js\")\nvar createHash = __webpack_require__(/*! create-hash */ \"./node_modules/create-hash/browser.js\")\nvar withPublic = __webpack_require__(/*! ./withPublic */ \"./node_modules/public-encrypt/withPublic.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nmodule.exports = function privateDecrypt (privateKey, enc, reverse) {\n var padding\n if (privateKey.padding) {\n padding = privateKey.padding\n } else if (reverse) {\n padding = 1\n } else {\n padding = 4\n }\n\n var key = parseKeys(privateKey)\n var k = key.modulus.byteLength()\n if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {\n throw new Error('decryption error')\n }\n var msg\n if (reverse) {\n msg = withPublic(new BN(enc), key)\n } else {\n msg = crt(enc, key)\n }\n var zBuffer = Buffer.alloc(k - msg.length)\n msg = Buffer.concat([zBuffer, msg], k)\n if (padding === 4) {\n return oaep(key, msg)\n } else if (padding === 1) {\n return pkcs1(key, msg, reverse)\n } else if (padding === 3) {\n return msg\n } else {\n throw new Error('unknown padding')\n }\n}\n\nfunction oaep (key, msg) {\n var k = key.modulus.byteLength()\n var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()\n var hLen = iHash.length\n if (msg[0] !== 0) {\n throw new Error('decryption error')\n }\n var maskedSeed = msg.slice(1, hLen + 1)\n var maskedDb = msg.slice(hLen + 1)\n var seed = xor(maskedSeed, mgf(maskedDb, hLen))\n var db = xor(maskedDb, mgf(seed, k - hLen - 1))\n if (compare(iHash, db.slice(0, hLen))) {\n throw new Error('decryption error')\n }\n var i = hLen\n while (db[i] === 0) {\n i++\n }\n if (db[i++] !== 1) {\n throw new Error('decryption error')\n }\n return db.slice(i)\n}\n\nfunction pkcs1 (key, msg, reverse) {\n var p1 = msg.slice(0, 2)\n var i = 2\n var status = 0\n while (msg[i++] !== 0) {\n if (i >= msg.length) {\n status++\n break\n }\n }\n var ps = msg.slice(2, i - 1)\n\n if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {\n status++\n }\n if (ps.length < 8) {\n status++\n }\n if (status) {\n throw new Error('decryption error')\n }\n return msg.slice(i)\n}\nfunction compare (a, b) {\n a = Buffer.from(a)\n b = Buffer.from(b)\n var dif = 0\n var len = a.length\n if (a.length !== b.length) {\n dif++\n len = Math.min(a.length, b.length)\n }\n var i = -1\n while (++i < len) {\n dif += (a[i] ^ b[i])\n }\n return dif\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/public-encrypt/privateDecrypt.js?"); +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; -/***/ }), +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 7), 'big'); + else + return utils.split32(this.h.slice(0, 7), 'big'); +}; -/***/ "./node_modules/public-encrypt/publicEncrypt.js": -/*!******************************************************!*\ - !*** ./node_modules/public-encrypt/publicEncrypt.js ***! - \******************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("var parseKeys = __webpack_require__(/*! parse-asn1 */ \"./node_modules/parse-asn1/index.js\")\nvar randomBytes = __webpack_require__(/*! randombytes */ \"./node_modules/randombytes/browser.js\")\nvar createHash = __webpack_require__(/*! create-hash */ \"./node_modules/create-hash/browser.js\")\nvar mgf = __webpack_require__(/*! ./mgf */ \"./node_modules/public-encrypt/mgf.js\")\nvar xor = __webpack_require__(/*! ./xor */ \"./node_modules/public-encrypt/xor.js\")\nvar BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\")\nvar withPublic = __webpack_require__(/*! ./withPublic */ \"./node_modules/public-encrypt/withPublic.js\")\nvar crt = __webpack_require__(/*! browserify-rsa */ \"./node_modules/browserify-rsa/index.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nmodule.exports = function publicEncrypt (publicKey, msg, reverse) {\n var padding\n if (publicKey.padding) {\n padding = publicKey.padding\n } else if (reverse) {\n padding = 1\n } else {\n padding = 4\n }\n var key = parseKeys(publicKey)\n var paddedMsg\n if (padding === 4) {\n paddedMsg = oaep(key, msg)\n } else if (padding === 1) {\n paddedMsg = pkcs1(key, msg, reverse)\n } else if (padding === 3) {\n paddedMsg = new BN(msg)\n if (paddedMsg.cmp(key.modulus) >= 0) {\n throw new Error('data too long for modulus')\n }\n } else {\n throw new Error('unknown padding')\n }\n if (reverse) {\n return crt(paddedMsg, key)\n } else {\n return withPublic(paddedMsg, key)\n }\n}\n\nfunction oaep (key, msg) {\n var k = key.modulus.byteLength()\n var mLen = msg.length\n var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()\n var hLen = iHash.length\n var hLen2 = 2 * hLen\n if (mLen > k - hLen2 - 2) {\n throw new Error('message too long')\n }\n var ps = Buffer.alloc(k - mLen - hLen2 - 2)\n var dblen = k - hLen - 1\n var seed = randomBytes(hLen)\n var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen))\n var maskedSeed = xor(seed, mgf(maskedDb, hLen))\n return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k))\n}\nfunction pkcs1 (key, msg, reverse) {\n var mLen = msg.length\n var k = key.modulus.byteLength()\n if (mLen > k - 11) {\n throw new Error('message too long')\n }\n var ps\n if (reverse) {\n ps = Buffer.alloc(k - mLen - 3, 0xff)\n } else {\n ps = nonZero(k - mLen - 3)\n }\n return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k))\n}\nfunction nonZero (len) {\n var out = Buffer.allocUnsafe(len)\n var i = 0\n var cache = randomBytes(len * 2)\n var cur = 0\n var num\n while (i < len) {\n if (cur === cache.length) {\n cache = randomBytes(len * 2)\n cur = 0\n }\n num = cache[cur++]\n if (num) {\n out[i++] = num\n }\n }\n return out\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/public-encrypt/publicEncrypt.js?"); /***/ }), -/***/ "./node_modules/public-encrypt/withPublic.js": -/*!***************************************************!*\ - !*** ./node_modules/public-encrypt/withPublic.js ***! - \***************************************************/ +/***/ 9344: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("var BN = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nfunction withPublic (paddedMsg, key) {\n return Buffer.from(paddedMsg\n .toRed(BN.mont(key.modulus))\n .redPow(new BN(key.publicExponent))\n .fromRed()\n .toArray())\n}\n\nmodule.exports = withPublic\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/public-encrypt/withPublic.js?"); - -/***/ }), - -/***/ "./node_modules/public-encrypt/xor.js": -/*!********************************************!*\ - !*** ./node_modules/public-encrypt/xor.js ***! - \********************************************/ -/***/ (function(module) { - -eval("module.exports = function xor (a, b) {\n var len = a.length\n var i = -1\n while (++i < len) {\n a[i] ^= b[i]\n }\n return a\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/public-encrypt/xor.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/randombytes/browser.js": -/*!*********************************************!*\ - !*** ./node_modules/randombytes/browser.js ***! - \*********************************************/ +var utils = __webpack_require__(6436); +var common = __webpack_require__(5772); +var shaCommon = __webpack_require__(7038); +var assert = __webpack_require__(9746); + +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var ch32 = shaCommon.ch32; +var maj32 = shaCommon.maj32; +var s0_256 = shaCommon.s0_256; +var s1_256 = shaCommon.s1_256; +var g0_256 = shaCommon.g0_256; +var g1_256 = shaCommon.g1_256; + +var BlockHash = common.BlockHash; + +var sha256_K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]; + +function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + ]; + this.k = sha256_K; + this.W = new Array(64); +} +utils.inherits(SHA256, BlockHash); +module.exports = SHA256; + +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; + +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + for (; i < W.length; i++) + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + + assert(this.k.length === W.length); + for (i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; + +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + + +/***/ }), + +/***/ 772: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nvar MAX_BYTES = 65536\n\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nvar MAX_UINT32 = 4294967295\n\nfunction oldBrowser () {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11')\n}\n\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\nvar crypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes\n} else {\n module.exports = oldBrowser\n}\n\nfunction randomBytes (size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n\n var bytes = Buffer.allocUnsafe(size)\n\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes)\n })\n }\n\n return bytes\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/randombytes/browser.js?"); - -/***/ }), -/***/ "./node_modules/randomfill/browser.js": -/*!********************************************!*\ - !*** ./node_modules/randomfill/browser.js ***! - \********************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n\n\nfunction oldBrowser () {\n throw new Error('secure random number generation not supported by this browser\\nuse chrome, FireFox or Internet Explorer 11')\n}\nvar safeBuffer = __webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\")\nvar randombytes = __webpack_require__(/*! randombytes */ \"./node_modules/randombytes/browser.js\")\nvar Buffer = safeBuffer.Buffer\nvar kBufferMaxLength = safeBuffer.kMaxLength\nvar crypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto\nvar kMaxUint32 = Math.pow(2, 32) - 1\nfunction assertOffset (offset, length) {\n if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare\n throw new TypeError('offset must be a number')\n }\n\n if (offset > kMaxUint32 || offset < 0) {\n throw new TypeError('offset must be a uint32')\n }\n\n if (offset > kBufferMaxLength || offset > length) {\n throw new RangeError('offset out of range')\n }\n}\n\nfunction assertSize (size, offset, length) {\n if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare\n throw new TypeError('size must be a number')\n }\n\n if (size > kMaxUint32 || size < 0) {\n throw new TypeError('size must be a uint32')\n }\n\n if (size + offset > length || size > kBufferMaxLength) {\n throw new RangeError('buffer too small')\n }\n}\nif ((crypto && crypto.getRandomValues) || !process.browser) {\n exports.randomFill = randomFill\n exports.randomFillSync = randomFillSync\n} else {\n exports.randomFill = oldBrowser\n exports.randomFillSync = oldBrowser\n}\nfunction randomFill (buf, offset, size, cb) {\n if (!Buffer.isBuffer(buf) && !(buf instanceof __webpack_require__.g.Uint8Array)) {\n throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array')\n }\n\n if (typeof offset === 'function') {\n cb = offset\n offset = 0\n size = buf.length\n } else if (typeof size === 'function') {\n cb = size\n size = buf.length - offset\n } else if (typeof cb !== 'function') {\n throw new TypeError('\"cb\" argument must be a function')\n }\n assertOffset(offset, buf.length)\n assertSize(size, offset, buf.length)\n return actualFill(buf, offset, size, cb)\n}\n\nfunction actualFill (buf, offset, size, cb) {\n if (process.browser) {\n var ourBuf = buf.buffer\n var uint = new Uint8Array(ourBuf, offset, size)\n crypto.getRandomValues(uint)\n if (cb) {\n process.nextTick(function () {\n cb(null, buf)\n })\n return\n }\n return buf\n }\n if (cb) {\n randombytes(size, function (err, bytes) {\n if (err) {\n return cb(err)\n }\n bytes.copy(buf, offset)\n cb(null, buf)\n })\n return\n }\n var bytes = randombytes(size)\n bytes.copy(buf, offset)\n return buf\n}\nfunction randomFillSync (buf, offset, size) {\n if (typeof offset === 'undefined') {\n offset = 0\n }\n if (!Buffer.isBuffer(buf) && !(buf instanceof __webpack_require__.g.Uint8Array)) {\n throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array')\n }\n\n assertOffset(offset, buf.length)\n\n if (size === undefined) size = buf.length - offset\n\n assertSize(size, offset, buf.length)\n\n return actualFill(buf, offset, size)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/randomfill/browser.js?"); +var utils = __webpack_require__(6436); -/***/ }), +var SHA512 = __webpack_require__(5900); -/***/ "./node_modules/readable-stream/errors-browser.js": -/*!********************************************************!*\ - !*** ./node_modules/readable-stream/errors-browser.js ***! - \********************************************************/ -/***/ (function(module) { +function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); -"use strict"; -eval("\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/errors-browser.js?"); + SHA512.call(this); + this.h = [ + 0xcbbb9d5d, 0xc1059ed8, + 0x629a292a, 0x367cd507, + 0x9159015a, 0x3070dd17, + 0x152fecd8, 0xf70e5939, + 0x67332667, 0xffc00b31, + 0x8eb44a87, 0x68581511, + 0xdb0c2e0d, 0x64f98fa7, + 0x47b5481d, 0xbefa4fa4 ]; +} +utils.inherits(SHA384, SHA512); +module.exports = SHA384; -/***/ }), +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; -/***/ "./node_modules/readable-stream/lib/_stream_duplex.js": -/*!************************************************************!*\ - !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***! - \************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 12), 'big'); + else + return utils.split32(this.h.slice(0, 12), 'big'); +}; -"use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n};\n/**/\n\nmodule.exports = Duplex;\nvar Readable = __webpack_require__(/*! ./_stream_readable */ \"./node_modules/readable-stream/lib/_stream_readable.js\");\nvar Writable = __webpack_require__(/*! ./_stream_writable */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Duplex, Readable);\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(onEndNT, this);\n}\nfunction onEndNT(self) {\n self.end();\n}\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/_stream_duplex.js?"); /***/ }), -/***/ "./node_modules/readable-stream/lib/_stream_passthrough.js": -/*!*****************************************************************!*\ - !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***! - \*****************************************************************/ +/***/ 5900: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n\n\nmodule.exports = PassThrough;\nvar Transform = __webpack_require__(/*! ./_stream_transform */ \"./node_modules/readable-stream/lib/_stream_transform.js\");\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(PassThrough, Transform);\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/_stream_passthrough.js?"); -/***/ }), -/***/ "./node_modules/readable-stream/lib/_stream_readable.js": -/*!**************************************************************!*\ - !*** ./node_modules/readable-stream/lib/_stream_readable.js ***! - \**************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +var utils = __webpack_require__(6436); +var common = __webpack_require__(5772); +var assert = __webpack_require__(9746); + +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; + +var BlockHash = common.BlockHash; + +var sha512_K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xf3bcc908, + 0xbb67ae85, 0x84caa73b, + 0x3c6ef372, 0xfe94f82b, + 0xa54ff53a, 0x5f1d36f1, + 0x510e527f, 0xade682d1, + 0x9b05688c, 0x2b3e6c1f, + 0x1f83d9ab, 0xfb41bd6b, + 0x5be0cd19, 0x137e2179 ]; + this.k = sha512_K; + this.W = new Array(160); +} +utils.inherits(SHA512, BlockHash); +module.exports = SHA512; + +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; + +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; + + // 32 x 32bit words + for (var i = 0; i < 32; i++) + W[i] = msg[start + i]; + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + var c3_lo = W[i - 31]; + + W[i] = sum64_4_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + W[i + 1] = sum64_4_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + } +}; + +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + + var W = this.W; + + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; + + var T1_hi = sum64_5_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + var T1_lo = sum64_5_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + + c0_hi = s0_512_hi(ah, al); + c0_lo = s0_512_lo(ah, al); + c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + + hh = gh; + hl = gl; + + gh = fh; + gl = fl; + + fh = eh; + fl = el; + + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + + dh = ch; + dl = cl; + + ch = bh; + cl = bl; + + bh = ah; + bl = al; + + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; + +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function ch64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ ((~xh) & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ ((~xl) & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + var c2_hi = rotr64_hi(xl, xh, 7); // 39 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + var c2_lo = rotr64_lo(xl, xh, 7); // 39 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + var c2_hi = shr64_hi(xh, xl, 6); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + var c2_lo = shr64_lo(xh, xl, 6); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + + +/***/ }), + +/***/ 7038: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nmodule.exports = Readable;\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = (__webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter);\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/**/\n\nvar Buffer = (__webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\").Buffer);\nvar OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\nvar debugUtil = __webpack_require__(/*! util */ \"?d17e\");\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\nvar BufferList = __webpack_require__(/*! ./internal/streams/buffer_list */ \"./node_modules/readable-stream/lib/internal/streams/buffer_list.js\");\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/readable-stream/lib/internal/streams/destroy.js\");\nvar _require = __webpack_require__(/*! ./internal/streams/state */ \"./node_modules/readable-stream/lib/internal/streams/state.js\"),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n\n// Lazy loaded to improve the startup performance.\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Readable, Stream);\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'end' (and potentially 'finish')\n this.autoDestroy = !!options.autoDestroy;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder);\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\nfunction Readable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n if (!(this instanceof Readable)) return new Readable(options);\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n\n // legacy\n this.readable = true;\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n Stream.call(this);\n}\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n return er;\n}\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder);\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n // If setEncoding(null), decoder.encoding equals utf8\n this._readableState.encoding = this._readableState.decoder.encoding;\n\n // Iterate over current buffer to convert already stored Buffers:\n var p = this._readableState.buffer.head;\n var content = '';\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n};\n\n// Don't raise the hwm > 1GB\nvar MAX_HWM = 0x40000000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n }\n\n // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n return dest;\n};\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0;\n\n // Try start flowing on next tick if stream isn't explicitly paused\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true;\n\n // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n};\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n this._readableState.paused = true;\n return this;\n};\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null);\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n};\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = __webpack_require__(/*! ./internal/streams/async_iterator */ \"./node_modules/readable-stream/lib/internal/streams/async_iterator.js\");\n }\n return createReadableStreamAsyncIterator(this);\n };\n}\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n});\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length);\n\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = __webpack_require__(/*! ./internal/streams/from */ \"./node_modules/readable-stream/lib/internal/streams/from-browser.js\");\n }\n return from(Readable, iterable, opts);\n };\n}\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/_stream_readable.js?"); - -/***/ }), -/***/ "./node_modules/readable-stream/lib/_stream_transform.js": -/*!***************************************************************!*\ - !*** ./node_modules/readable-stream/lib/_stream_transform.js ***! - \***************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n\n\nmodule.exports = Transform;\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\nvar Duplex = __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Transform, Duplex);\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\nfunction prefinish() {\n var _this = this;\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null)\n // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/_stream_transform.js?"); +var utils = __webpack_require__(6436); +var rotr32 = utils.rotr32; -/***/ }), +function ft_1(s, x, y, z) { + if (s === 0) + return ch32(x, y, z); + if (s === 1 || s === 3) + return p32(x, y, z); + if (s === 2) + return maj32(x, y, z); +} +exports.ft_1 = ft_1; -/***/ "./node_modules/readable-stream/lib/_stream_writable.js": -/*!**************************************************************!*\ - !*** ./node_modules/readable-stream/lib/_stream_writable.js ***! - \**************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function ch32(x, y, z) { + return (x & y) ^ ((~x) & z); +} +exports.ch32 = ch32; -"use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar internalUtil = {\n deprecate: __webpack_require__(/*! util-deprecate */ \"./node_modules/util-deprecate/browser.js\")\n};\n/**/\n\n/**/\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/**/\n\nvar Buffer = (__webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\").Buffer);\nvar OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/readable-stream/lib/internal/streams/destroy.js\");\nvar _require = __webpack_require__(/*! ./internal/streams/state */ \"./node_modules/readable-stream/lib/internal/streams/state.js\"),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Writable, Stream);\nfunction nop() {}\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'finish' (and potentially 'end')\n this.autoDestroy = !!options.autoDestroy;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\nfunction Writable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n\n // legacy.\n this.writable = true;\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n // TODO: defer error events consistently everywhere, not just the cb\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n if (entry === null) state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\nWritable.prototype._writev = null;\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n}\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/_stream_writable.js?"); +function maj32(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); +} +exports.maj32 = maj32; -/***/ }), +function p32(x, y, z) { + return x ^ y ^ z; +} +exports.p32 = p32; -/***/ "./node_modules/readable-stream/lib/internal/streams/async_iterator.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/async_iterator.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} +exports.s0_256 = s0_256; -"use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n\n\nvar _Object$setPrototypeO;\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar finished = __webpack_require__(/*! ./end-of-stream */ \"./node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n }\n\n // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject];\n // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\nmodule.exports = createReadableStreamAsyncIterator;\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/async_iterator.js?"); +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} +exports.s1_256 = s1_256; -/***/ }), +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); +} +exports.g0_256 = g0_256; -/***/ "./node_modules/readable-stream/lib/internal/streams/buffer_list.js": -/*!**************************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/buffer_list.js ***! - \**************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); +} +exports.g1_256 = g1_256; -"use strict"; -eval("\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar _require = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\"),\n Buffer = _require.Buffer;\nvar _require2 = __webpack_require__(/*! util */ \"?ed1b\"),\n inspect = _require2.inspect;\nvar custom = inspect && inspect.custom || 'inspect';\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\nmodule.exports = /*#__PURE__*/function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) ret += s + p.data;\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n }\n\n // Consumes a specified amount of characters from the buffered data.\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread(_objectSpread({}, options), {}, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n}();\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/buffer_list.js?"); /***/ }), -/***/ "./node_modules/readable-stream/lib/internal/streams/destroy.js": -/*!**********************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***! - \**********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 6436: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n}\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/destroy.js?"); -/***/ }), -/***/ "./node_modules/readable-stream/lib/internal/streams/end-of-stream.js": -/*!****************************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***! - \****************************************************************************/ +var assert = __webpack_require__(9746); +var inherits = __webpack_require__(5717); + +exports.inherits = inherits; + +function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { + return false; + } + if (i < 0 || i + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; +} + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + // Inspired by stringToUtf8ByteArray() in closure-library by Google + // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 + // Apache License 2.0 + // https://github.com/google/closure-library/blob/master/LICENSE + var p = 0; + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + if (c < 128) { + res[p++] = c; + } else if (c < 2048) { + res[p++] = (c >> 6) | 192; + res[p++] = (c & 63) | 128; + } else if (isSurrogatePair(msg, i)) { + c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); + res[p++] = (c >> 18) | 240; + res[p++] = ((c >> 12) & 63) | 128; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } else { + res[p++] = (c >> 12) | 224; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +exports.toArray = toArray; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +exports.toHex = toHex; + +function htonl(w) { + var res = (w >>> 24) | + ((w >>> 8) & 0xff00) | + ((w << 8) & 0xff0000) | + ((w & 0xff) << 24); + return res >>> 0; +} +exports.htonl = htonl; + +function toHex32(msg, endian) { + var res = ''; + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; +} +exports.toHex32 = toHex32; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +exports.zero2 = zero2; + +function zero8(word) { + if (word.length === 7) + return '0' + word; + else if (word.length === 6) + return '00' + word; + else if (word.length === 5) + return '000' + word; + else if (word.length === 4) + return '0000' + word; + else if (word.length === 3) + return '00000' + word; + else if (word.length === 2) + return '000000' + word; + else if (word.length === 1) + return '0000000' + word; + else + return word; +} +exports.zero8 = zero8; + +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') + w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; + else + w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; + res[i] = w >>> 0; + } + return res; +} +exports.join32 = join32; + +function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = (m >>> 16) & 0xff; + res[k + 2] = (m >>> 8) & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = (m >>> 16) & 0xff; + res[k + 1] = (m >>> 8) & 0xff; + res[k] = m & 0xff; + } + } + return res; +} +exports.split32 = split32; + +function rotr32(w, b) { + return (w >>> b) | (w << (32 - b)); +} +exports.rotr32 = rotr32; + +function rotl32(w, b) { + return (w << b) | (w >>> (32 - b)); +} +exports.rotl32 = rotl32; + +function sum32(a, b) { + return (a + b) >>> 0; +} +exports.sum32 = sum32; + +function sum32_3(a, b, c) { + return (a + b + c) >>> 0; +} +exports.sum32_3 = sum32_3; + +function sum32_4(a, b, c, d) { + return (a + b + c + d) >>> 0; +} +exports.sum32_4 = sum32_4; + +function sum32_5(a, b, c, d, e) { + return (a + b + c + d + e) >>> 0; +} +exports.sum32_5 = sum32_5; + +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} +exports.sum64 = sum64; + +function sum64_hi(ah, al, bh, bl) { + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +} +exports.sum64_hi = sum64_hi; + +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +} +exports.sum64_lo = sum64_lo; + +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +} +exports.sum64_4_hi = sum64_4_hi; + +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +} +exports.sum64_4_lo = sum64_4_lo; + +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + lo = (lo + el) >>> 0; + carry += lo < el ? 1 : 0; + + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; +} +exports.sum64_5_hi = sum64_5_hi; + +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + + return lo >>> 0; +} +exports.sum64_5_lo = sum64_5_lo; + +function rotr64_hi(ah, al, num) { + var r = (al << (32 - num)) | (ah >>> num); + return r >>> 0; +} +exports.rotr64_hi = rotr64_hi; + +function rotr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +} +exports.rotr64_lo = rotr64_lo; + +function shr64_hi(ah, al, num) { + return ah >>> num; +} +exports.shr64_hi = shr64_hi; + +function shr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +} +exports.shr64_lo = shr64_lo; + + +/***/ }), + +/***/ 2156: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n\n\nvar ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(/*! ../../../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes.ERR_STREAM_PREMATURE_CLOSE);\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n}\nfunction noop() {}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\nmodule.exports = eos;\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/end-of-stream.js?"); -/***/ }), -/***/ "./node_modules/readable-stream/lib/internal/streams/from-browser.js": -/*!***************************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/from-browser.js ***! - \***************************************************************************/ +var hash = __webpack_require__(3715); +var utils = __webpack_require__(4504); +var assert = __webpack_require__(9746); + +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; + + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + + this._reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + + var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex'); + var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex'); + var pers = utils.toArray(options.pers, options.persEnc || 'hex'); + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + this._init(entropy, nonce, pers); +} +module.exports = HmacDRBG; + +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + this._reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); +}; + +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac() + .update(this.V) + .update([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils.toArray(entropy, entropyEnc); + add = utils.toArray(add, addEnc); + + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._update(entropy.concat(add || [])); + this._reseed = 1; +}; + +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this._reseed > this.reseedInterval) + throw new Error('Reseed is required'); + + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } + + // Optional additional data + if (add) { + add = utils.toArray(add, addEnc || 'hex'); + this._update(add); + } + + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + this._update(add); + this._reseed++; + return utils.encode(res, enc); +}; + + +/***/ }), + +/***/ 645: +/***/ (function(__unused_webpack_module, exports) { + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + + +/***/ }), + +/***/ 5717: /***/ (function(module) { -eval("module.exports = function () {\n throw new Error('Readable.from is not available in the browser')\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/from-browser.js?"); +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ 1094: +/***/ (function(module, exports, __webpack_require__) { -/***/ }), +/* provided dependency */ var process = __webpack_require__(4155); +var __WEBPACK_AMD_DEFINE_RESULT__;/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ +/*jslint bitwise: true */ +(function () { + 'use strict'; + + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node; + if (NODE_JS) { + root = __webpack_require__.g; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && "object" === 'object' && module.exports; + var AMD = true && __webpack_require__.amdO; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; + + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } + + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } + + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; + + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); + } + return method; + }; + + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + + var methods = {}, methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } + + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); + } + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } + } + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } + } + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); + } + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); + } + return buffer; + }; + + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; + + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } + + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + if (AMD) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { + return methods; + }).call(exports, __webpack_require__, exports, module), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + } +})(); + + +/***/ }), + +/***/ 3720: +/***/ (function(module) { -/***/ "./node_modules/readable-stream/lib/internal/streams/pipeline.js": -/*!***********************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/pipeline.js ***! - \***********************************************************************/ +module.exports = Long; + +/** + * wasm optimizations, to do native i64 multiplication and divide + */ +var wasm = null; + +try { + wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ + 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 + ])), {}).exports; +} catch (e) { + // no wasm support :( +} + +/** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. + * See the from* functions below for more convenient ways of constructing Longs. + * @exports Long + * @class A Long class for representing a 64 bit two's-complement integer value. + * @param {number} low The low (signed) 32 bits of the long + * @param {number} high The high (signed) 32 bits of the long + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @constructor + */ +function Long(low, high, unsigned) { + + /** + * The low 32 bits as a signed value. + * @type {number} + */ + this.low = low | 0; + + /** + * The high 32 bits as a signed value. + * @type {number} + */ + this.high = high | 0; + + /** + * Whether unsigned or not. + * @type {boolean} + */ + this.unsigned = !!unsigned; +} + +// The internal representation of a long is the two given signed, 32-bit values. +// We use 32-bit pieces because these are the size of integers on which +// Javascript performs bit-operations. For operations like addition and +// multiplication, we split each number into 16 bit pieces, which can easily be +// multiplied within Javascript's floating-point representation without overflow +// or change in sign. +// +// In the algorithms below, we frequently reduce the negative case to the +// positive case by negating the input(s) and then post-processing the result. +// Note that we must ALWAYS check specially whether those values are MIN_VALUE +// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as +// a positive number, it overflows back into a negative). Not handling this +// case would often result in infinite recursion. +// +// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from* +// methods on which they depend. + +/** + * An indicator used to reliably determine if an object is a Long or not. + * @type {boolean} + * @const + * @private + */ +Long.prototype.__isLong__; + +Object.defineProperty(Long.prototype, "__isLong__", { value: true }); + +/** + * @function + * @param {*} obj Object + * @returns {boolean} + * @inner + */ +function isLong(obj) { + return (obj && obj["__isLong__"]) === true; +} + +/** + * Tests if the specified object is a Long. + * @function + * @param {*} obj Object + * @returns {boolean} + */ +Long.isLong = isLong; + +/** + * A cache of the Long representations of small integer values. + * @type {!Object} + * @inner + */ +var INT_CACHE = {}; + +/** + * A cache of the Long representations of small unsigned integer values. + * @type {!Object} + * @inner + */ +var UINT_CACHE = {}; + +/** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromInt(value, unsigned) { + var obj, cachedObj, cache; + if (unsigned) { + value >>>= 0; + if (cache = (0 <= value && value < 256)) { + cachedObj = UINT_CACHE[value]; + if (cachedObj) + return cachedObj; + } + obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true); + if (cache) + UINT_CACHE[value] = obj; + return obj; + } else { + value |= 0; + if (cache = (-128 <= value && value < 128)) { + cachedObj = INT_CACHE[value]; + if (cachedObj) + return cachedObj; + } + obj = fromBits(value, value < 0 ? -1 : 0, false); + if (cache) + INT_CACHE[value] = obj; + return obj; + } +} + +/** + * Returns a Long representing the given 32 bit integer value. + * @function + * @param {number} value The 32 bit integer in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromInt = fromInt; + +/** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromNumber(value, unsigned) { + if (isNaN(value)) + return unsigned ? UZERO : ZERO; + if (unsigned) { + if (value < 0) + return UZERO; + if (value >= TWO_PWR_64_DBL) + return MAX_UNSIGNED_VALUE; + } else { + if (value <= -TWO_PWR_63_DBL) + return MIN_VALUE; + if (value + 1 >= TWO_PWR_63_DBL) + return MAX_VALUE; + } + if (value < 0) + return fromNumber(-value, unsigned).neg(); + return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned); +} + +/** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * @function + * @param {number} value The number in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromNumber = fromNumber; + +/** + * @param {number} lowBits + * @param {number} highBits + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromBits(lowBits, highBits, unsigned) { + return new Long(lowBits, highBits, unsigned); +} + +/** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is + * assumed to use 32 bits. + * @function + * @param {number} lowBits The low 32 bits + * @param {number} highBits The high 32 bits + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromBits = fromBits; + +/** + * @function + * @param {number} base + * @param {number} exponent + * @returns {number} + * @inner + */ +var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4) + +/** + * @param {string} str + * @param {(boolean|number)=} unsigned + * @param {number=} radix + * @returns {!Long} + * @inner + */ +function fromString(str, unsigned, radix) { + if (str.length === 0) + throw Error('empty string'); + if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") + return ZERO; + if (typeof unsigned === 'number') { + // For goog.math.long compatibility + radix = unsigned, + unsigned = false; + } else { + unsigned = !! unsigned; + } + radix = radix || 10; + if (radix < 2 || 36 < radix) + throw RangeError('radix'); + + var p; + if ((p = str.indexOf('-')) > 0) + throw Error('interior hyphen'); + else if (p === 0) { + return fromString(str.substring(1), unsigned, radix).neg(); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 8)); + + var result = ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i), + value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = fromNumber(pow_dbl(radix, size)); + result = result.mul(power).add(fromNumber(value)); + } else { + result = result.mul(radixToPower); + result = result.add(fromNumber(value)); + } + } + result.unsigned = unsigned; + return result; +} + +/** + * Returns a Long representation of the given string, written using the specified radix. + * @function + * @param {string} str The textual representation of the Long + * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed + * @param {number=} radix The radix in which the text is written (2-36), defaults to 10 + * @returns {!Long} The corresponding Long value + */ +Long.fromString = fromString; + +/** + * @function + * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromValue(val, unsigned) { + if (typeof val === 'number') + return fromNumber(val, unsigned); + if (typeof val === 'string') + return fromString(val, unsigned); + // Throws for non-objects, converts non-instanceof Long: + return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned); +} + +/** + * Converts the specified value to a Long using the appropriate from* function for its type. + * @function + * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} + */ +Long.fromValue = fromValue; + +// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be +// no runtime penalty for these. + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_16_DBL = 1 << 16; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_24_DBL = 1 << 24; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; + +/** + * @type {!Long} + * @const + * @inner + */ +var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL); + +/** + * @type {!Long} + * @inner + */ +var ZERO = fromInt(0); + +/** + * Signed zero. + * @type {!Long} + */ +Long.ZERO = ZERO; + +/** + * @type {!Long} + * @inner + */ +var UZERO = fromInt(0, true); + +/** + * Unsigned zero. + * @type {!Long} + */ +Long.UZERO = UZERO; + +/** + * @type {!Long} + * @inner + */ +var ONE = fromInt(1); + +/** + * Signed one. + * @type {!Long} + */ +Long.ONE = ONE; + +/** + * @type {!Long} + * @inner + */ +var UONE = fromInt(1, true); + +/** + * Unsigned one. + * @type {!Long} + */ +Long.UONE = UONE; + +/** + * @type {!Long} + * @inner + */ +var NEG_ONE = fromInt(-1); + +/** + * Signed negative one. + * @type {!Long} + */ +Long.NEG_ONE = NEG_ONE; + +/** + * @type {!Long} + * @inner + */ +var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false); + +/** + * Maximum signed value. + * @type {!Long} + */ +Long.MAX_VALUE = MAX_VALUE; + +/** + * @type {!Long} + * @inner + */ +var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true); + +/** + * Maximum unsigned value. + * @type {!Long} + */ +Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE; + +/** + * @type {!Long} + * @inner + */ +var MIN_VALUE = fromBits(0, 0x80000000|0, false); + +/** + * Minimum signed value. + * @type {!Long} + */ +Long.MIN_VALUE = MIN_VALUE; + +/** + * @alias Long.prototype + * @inner + */ +var LongPrototype = Long.prototype; + +/** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + * @returns {number} + */ +LongPrototype.toInt = function toInt() { + return this.unsigned ? this.low >>> 0 : this.low; +}; + +/** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + * @returns {number} + */ +LongPrototype.toNumber = function toNumber() { + if (this.unsigned) + return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0); + return this.high * TWO_PWR_32_DBL + (this.low >>> 0); +}; + +/** + * Converts the Long to a string written in the specified radix. + * @param {number=} radix Radix (2-36), defaults to 10 + * @returns {string} + * @override + * @throws {RangeError} If `radix` is out of range + */ +LongPrototype.toString = function toString(radix) { + radix = radix || 10; + if (radix < 2 || 36 < radix) + throw RangeError('radix'); + if (this.isZero()) + return '0'; + if (this.isNegative()) { // Unsigned Longs are never negative + if (this.eq(MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = fromNumber(radix), + div = this.div(radixLong), + rem1 = div.mul(radixLong).sub(this); + return div.toString(radix) + rem1.toInt().toString(radix); + } else + return '-' + this.neg().toString(radix); + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), + rem = this; + var result = ''; + while (true) { + var remDiv = rem.div(radixToPower), + intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, + digits = intval.toString(radix); + rem = remDiv; + if (rem.isZero()) + return digits + result; + else { + while (digits.length < 6) + digits = '0' + digits; + result = '' + digits + result; + } + } +}; + +/** + * Gets the high 32 bits as a signed integer. + * @returns {number} Signed high bits + */ +LongPrototype.getHighBits = function getHighBits() { + return this.high; +}; + +/** + * Gets the high 32 bits as an unsigned integer. + * @returns {number} Unsigned high bits + */ +LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() { + return this.high >>> 0; +}; + +/** + * Gets the low 32 bits as a signed integer. + * @returns {number} Signed low bits + */ +LongPrototype.getLowBits = function getLowBits() { + return this.low; +}; + +/** + * Gets the low 32 bits as an unsigned integer. + * @returns {number} Unsigned low bits + */ +LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() { + return this.low >>> 0; +}; + +/** + * Gets the number of bits needed to represent the absolute value of this Long. + * @returns {number} + */ +LongPrototype.getNumBitsAbs = function getNumBitsAbs() { + if (this.isNegative()) // Unsigned Longs are never negative + return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs(); + var val = this.high != 0 ? this.high : this.low; + for (var bit = 31; bit > 0; bit--) + if ((val & (1 << bit)) != 0) + break; + return this.high != 0 ? bit + 33 : bit + 1; +}; + +/** + * Tests if this Long's value equals zero. + * @returns {boolean} + */ +LongPrototype.isZero = function isZero() { + return this.high === 0 && this.low === 0; +}; + +/** + * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}. + * @returns {boolean} + */ +LongPrototype.eqz = LongPrototype.isZero; + +/** + * Tests if this Long's value is negative. + * @returns {boolean} + */ +LongPrototype.isNegative = function isNegative() { + return !this.unsigned && this.high < 0; +}; + +/** + * Tests if this Long's value is positive. + * @returns {boolean} + */ +LongPrototype.isPositive = function isPositive() { + return this.unsigned || this.high >= 0; +}; + +/** + * Tests if this Long's value is odd. + * @returns {boolean} + */ +LongPrototype.isOdd = function isOdd() { + return (this.low & 1) === 1; +}; + +/** + * Tests if this Long's value is even. + * @returns {boolean} + */ +LongPrototype.isEven = function isEven() { + return (this.low & 1) === 0; +}; + +/** + * Tests if this Long's value equals the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.equals = function equals(other) { + if (!isLong(other)) + other = fromValue(other); + if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1) + return false; + return this.high === other.high && this.low === other.low; +}; + +/** + * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.eq = LongPrototype.equals; + +/** + * Tests if this Long's value differs from the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.notEquals = function notEquals(other) { + return !this.eq(/* validates */ other); +}; + +/** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.neq = LongPrototype.notEquals; + +/** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.ne = LongPrototype.notEquals; + +/** + * Tests if this Long's value is less than the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lessThan = function lessThan(other) { + return this.comp(/* validates */ other) < 0; +}; + +/** + * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lt = LongPrototype.lessThan; + +/** + * Tests if this Long's value is less than or equal the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { + return this.comp(/* validates */ other) <= 0; +}; + +/** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lte = LongPrototype.lessThanOrEqual; + +/** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.le = LongPrototype.lessThanOrEqual; + +/** + * Tests if this Long's value is greater than the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.greaterThan = function greaterThan(other) { + return this.comp(/* validates */ other) > 0; +}; + +/** + * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.gt = LongPrototype.greaterThan; + +/** + * Tests if this Long's value is greater than or equal the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { + return this.comp(/* validates */ other) >= 0; +}; + +/** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.gte = LongPrototype.greaterThanOrEqual; + +/** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.ge = LongPrototype.greaterThanOrEqual; + +/** + * Compares this Long's value with the specified's. + * @param {!Long|number|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ +LongPrototype.compare = function compare(other) { + if (!isLong(other)) + other = fromValue(other); + if (this.eq(other)) + return 0; + var thisNeg = this.isNegative(), + otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) + return -1; + if (!thisNeg && otherNeg) + return 1; + // At this point the sign bits are the same + if (!this.unsigned) + return this.sub(other).isNegative() ? -1 : 1; + // Both are positive if at least one is unsigned + return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1; +}; + +/** + * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}. + * @function + * @param {!Long|number|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ +LongPrototype.comp = LongPrototype.compare; + +/** + * Negates this Long's value. + * @returns {!Long} Negated Long + */ +LongPrototype.negate = function negate() { + if (!this.unsigned && this.eq(MIN_VALUE)) + return MIN_VALUE; + return this.not().add(ONE); +}; + +/** + * Negates this Long's value. This is an alias of {@link Long#negate}. + * @function + * @returns {!Long} Negated Long + */ +LongPrototype.neg = LongPrototype.negate; + +/** + * Returns the sum of this and the specified Long. + * @param {!Long|number|string} addend Addend + * @returns {!Long} Sum + */ +LongPrototype.add = function add(addend) { + if (!isLong(addend)) + addend = fromValue(addend); + + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xFFFF; + var a16 = this.low >>> 16; + var a00 = this.low & 0xFFFF; + + var b48 = addend.high >>> 16; + var b32 = addend.high & 0xFFFF; + var b16 = addend.low >>> 16; + var b00 = addend.low & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 + b48; + c48 &= 0xFFFF; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); +}; + +/** + * Returns the difference of this and the specified Long. + * @param {!Long|number|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ +LongPrototype.subtract = function subtract(subtrahend) { + if (!isLong(subtrahend)) + subtrahend = fromValue(subtrahend); + return this.add(subtrahend.neg()); +}; + +/** + * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}. + * @function + * @param {!Long|number|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ +LongPrototype.sub = LongPrototype.subtract; + +/** + * Returns the product of this and the specified Long. + * @param {!Long|number|string} multiplier Multiplier + * @returns {!Long} Product + */ +LongPrototype.multiply = function multiply(multiplier) { + if (this.isZero()) + return ZERO; + if (!isLong(multiplier)) + multiplier = fromValue(multiplier); + + // use wasm support if present + if (wasm) { + var low = wasm.mul(this.low, + this.high, + multiplier.low, + multiplier.high); + return fromBits(low, wasm.get_high(), this.unsigned); + } + + if (multiplier.isZero()) + return ZERO; + if (this.eq(MIN_VALUE)) + return multiplier.isOdd() ? MIN_VALUE : ZERO; + if (multiplier.eq(MIN_VALUE)) + return this.isOdd() ? MIN_VALUE : ZERO; + + if (this.isNegative()) { + if (multiplier.isNegative()) + return this.neg().mul(multiplier.neg()); + else + return this.neg().mul(multiplier).neg(); + } else if (multiplier.isNegative()) + return this.mul(multiplier.neg()).neg(); + + // If both longs are small, use float multiplication + if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) + return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); + + // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xFFFF; + var a16 = this.low >>> 16; + var a00 = this.low & 0xFFFF; + + var b48 = multiplier.high >>> 16; + var b32 = multiplier.high & 0xFFFF; + var b16 = multiplier.low >>> 16; + var b00 = multiplier.low & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xFFFF; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); +}; + +/** + * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}. + * @function + * @param {!Long|number|string} multiplier Multiplier + * @returns {!Long} Product + */ +LongPrototype.mul = LongPrototype.multiply; + +/** + * Returns this Long divided by the specified. The result is signed if this Long is signed or + * unsigned if this Long is unsigned. + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Quotient + */ +LongPrototype.divide = function divide(divisor) { + if (!isLong(divisor)) + divisor = fromValue(divisor); + if (divisor.isZero()) + throw Error('division by zero'); + + // use wasm support if present + if (wasm) { + // guard against signed division overflow: the largest + // negative number / -1 would be 1 larger than the largest + // positive number, due to two's complement. + if (!this.unsigned && + this.high === -0x80000000 && + divisor.low === -1 && divisor.high === -1) { + // be consistent with non-wasm code path + return this; + } + var low = (this.unsigned ? wasm.div_u : wasm.div_s)( + this.low, + this.high, + divisor.low, + divisor.high + ); + return fromBits(low, wasm.get_high(), this.unsigned); + } + + if (this.isZero()) + return this.unsigned ? UZERO : ZERO; + var approx, rem, res; + if (!this.unsigned) { + // This section is only relevant for signed longs and is derived from the + // closure library as a whole. + if (this.eq(MIN_VALUE)) { + if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) + return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + else if (divisor.eq(MIN_VALUE)) + return ONE; + else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shr(1); + approx = halfThis.div(divisor).shl(1); + if (approx.eq(ZERO)) { + return divisor.isNegative() ? ONE : NEG_ONE; + } else { + rem = this.sub(divisor.mul(approx)); + res = approx.add(rem.div(divisor)); + return res; + } + } + } else if (divisor.eq(MIN_VALUE)) + return this.unsigned ? UZERO : ZERO; + if (this.isNegative()) { + if (divisor.isNegative()) + return this.neg().div(divisor.neg()); + return this.neg().div(divisor).neg(); + } else if (divisor.isNegative()) + return this.div(divisor.neg()).neg(); + res = ZERO; + } else { + // The algorithm below has not been made for unsigned longs. It's therefore + // required to take special care of the MSB prior to running it. + if (!divisor.unsigned) + divisor = divisor.toUnsigned(); + if (divisor.gt(this)) + return UZERO; + if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true + return UONE; + res = UZERO; + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + rem = this; + while (rem.gte(divisor)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2), + delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48), + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + approxRes = fromNumber(approx), + approxRem = approxRes.mul(divisor); + while (approxRem.isNegative() || approxRem.gt(rem)) { + approx -= delta; + approxRes = fromNumber(approx, this.unsigned); + approxRem = approxRes.mul(divisor); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) + approxRes = ONE; + + res = res.add(approxRes); + rem = rem.sub(approxRem); + } + return res; +}; + +/** + * Returns this Long divided by the specified. This is an alias of {@link Long#divide}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Quotient + */ +LongPrototype.div = LongPrototype.divide; + +/** + * Returns this Long modulo the specified. + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.modulo = function modulo(divisor) { + if (!isLong(divisor)) + divisor = fromValue(divisor); + + // use wasm support if present + if (wasm) { + var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)( + this.low, + this.high, + divisor.low, + divisor.high + ); + return fromBits(low, wasm.get_high(), this.unsigned); + } + + return this.sub(this.div(divisor).mul(divisor)); +}; + +/** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.mod = LongPrototype.modulo; + +/** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.rem = LongPrototype.modulo; + +/** + * Returns the bitwise NOT of this Long. + * @returns {!Long} + */ +LongPrototype.not = function not() { + return fromBits(~this.low, ~this.high, this.unsigned); +}; + +/** + * Returns the bitwise AND of this Long and the specified. + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.and = function and(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low & other.low, this.high & other.high, this.unsigned); +}; + +/** + * Returns the bitwise OR of this Long and the specified. + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.or = function or(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low | other.low, this.high | other.high, this.unsigned); +}; + +/** + * Returns the bitwise XOR of this Long and the given one. + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.xor = function xor(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftLeft = function shiftLeft(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned); + else + return fromBits(0, this.low << (numBits - 32), this.unsigned); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shl = LongPrototype.shiftLeft; + +/** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftRight = function shiftRight(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned); + else + return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned); +}; + +/** + * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shr = LongPrototype.shiftRight; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + numBits &= 63; + if (numBits === 0) + return this; + else { + var high = this.high; + if (numBits < 32) { + var low = this.low; + return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned); + } else if (numBits === 32) + return fromBits(high, 0, this.unsigned); + else + return fromBits(high >>> (numBits - 32), 0, this.unsigned); + } +}; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shru = LongPrototype.shiftRightUnsigned; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shr_u = LongPrototype.shiftRightUnsigned; + +/** + * Converts this Long to signed. + * @returns {!Long} Signed long + */ +LongPrototype.toSigned = function toSigned() { + if (!this.unsigned) + return this; + return fromBits(this.low, this.high, false); +}; + +/** + * Converts this Long to unsigned. + * @returns {!Long} Unsigned long + */ +LongPrototype.toUnsigned = function toUnsigned() { + if (this.unsigned) + return this; + return fromBits(this.low, this.high, true); +}; + +/** + * Converts this Long to its byte representation. + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @returns {!Array.} Byte representation + */ +LongPrototype.toBytes = function toBytes(le) { + return le ? this.toBytesLE() : this.toBytesBE(); +}; + +/** + * Converts this Long to its little endian byte representation. + * @returns {!Array.} Little endian byte representation + */ +LongPrototype.toBytesLE = function toBytesLE() { + var hi = this.high, + lo = this.low; + return [ + lo & 0xff, + lo >>> 8 & 0xff, + lo >>> 16 & 0xff, + lo >>> 24 , + hi & 0xff, + hi >>> 8 & 0xff, + hi >>> 16 & 0xff, + hi >>> 24 + ]; +}; + +/** + * Converts this Long to its big endian byte representation. + * @returns {!Array.} Big endian byte representation + */ +LongPrototype.toBytesBE = function toBytesBE() { + var hi = this.high, + lo = this.low; + return [ + hi >>> 24 , + hi >>> 16 & 0xff, + hi >>> 8 & 0xff, + hi & 0xff, + lo >>> 24 , + lo >>> 16 & 0xff, + lo >>> 8 & 0xff, + lo & 0xff + ]; +}; + +/** + * Creates a Long from its byte representation. + * @param {!Array.} bytes Byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @returns {Long} The corresponding Long value + */ +Long.fromBytes = function fromBytes(bytes, unsigned, le) { + return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned); +}; + +/** + * Creates a Long from its little endian byte representation. + * @param {!Array.} bytes Little endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ +Long.fromBytesLE = function fromBytesLE(bytes, unsigned) { + return new Long( + bytes[0] | + bytes[1] << 8 | + bytes[2] << 16 | + bytes[3] << 24, + bytes[4] | + bytes[5] << 8 | + bytes[6] << 16 | + bytes[7] << 24, + unsigned + ); +}; + +/** + * Creates a Long from its big endian byte representation. + * @param {!Array.} bytes Big endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ +Long.fromBytesBE = function fromBytesBE(bytes, unsigned) { + return new Long( + bytes[4] << 24 | + bytes[5] << 16 | + bytes[6] << 8 | + bytes[7], + bytes[0] << 24 | + bytes[1] << 16 | + bytes[2] << 8 | + bytes[3], + unsigned + ); +}; + + +/***/ }), + +/***/ 2318: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -eval("// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n\n\nvar eos;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\nvar _require$codes = (__webpack_require__(/*! ../../../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = __webpack_require__(/*! ./end-of-stream */ \"./node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n\n // request.destroy just do .end - .abort is what we want\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\nfunction call(fn) {\n fn();\n}\nfunction pipe(from, to) {\n return from.pipe(to);\n}\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\nmodule.exports = pipeline;\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/pipeline.js?"); - -/***/ }), -/***/ "./node_modules/readable-stream/lib/internal/streams/state.js": -/*!********************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/state.js ***! - \********************************************************************/ +var inherits = __webpack_require__(5717) +var HashBase = __webpack_require__(3349) +var Buffer = (__webpack_require__(9509).Buffer) + +var ARRAY16 = new Array(16) + +function MD5 () { + HashBase.call(this, 64) + + // state + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 +} + +inherits(MD5, HashBase) + +MD5.prototype._update = function () { + var M = ARRAY16 + for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4) + + var a = this._a + var b = this._b + var c = this._c + var d = this._d + + a = fnF(a, b, c, d, M[0], 0xd76aa478, 7) + d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12) + c = fnF(c, d, a, b, M[2], 0x242070db, 17) + b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22) + a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7) + d = fnF(d, a, b, c, M[5], 0x4787c62a, 12) + c = fnF(c, d, a, b, M[6], 0xa8304613, 17) + b = fnF(b, c, d, a, M[7], 0xfd469501, 22) + a = fnF(a, b, c, d, M[8], 0x698098d8, 7) + d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12) + c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17) + b = fnF(b, c, d, a, M[11], 0x895cd7be, 22) + a = fnF(a, b, c, d, M[12], 0x6b901122, 7) + d = fnF(d, a, b, c, M[13], 0xfd987193, 12) + c = fnF(c, d, a, b, M[14], 0xa679438e, 17) + b = fnF(b, c, d, a, M[15], 0x49b40821, 22) + + a = fnG(a, b, c, d, M[1], 0xf61e2562, 5) + d = fnG(d, a, b, c, M[6], 0xc040b340, 9) + c = fnG(c, d, a, b, M[11], 0x265e5a51, 14) + b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20) + a = fnG(a, b, c, d, M[5], 0xd62f105d, 5) + d = fnG(d, a, b, c, M[10], 0x02441453, 9) + c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14) + b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20) + a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5) + d = fnG(d, a, b, c, M[14], 0xc33707d6, 9) + c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14) + b = fnG(b, c, d, a, M[8], 0x455a14ed, 20) + a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5) + d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9) + c = fnG(c, d, a, b, M[7], 0x676f02d9, 14) + b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20) + + a = fnH(a, b, c, d, M[5], 0xfffa3942, 4) + d = fnH(d, a, b, c, M[8], 0x8771f681, 11) + c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16) + b = fnH(b, c, d, a, M[14], 0xfde5380c, 23) + a = fnH(a, b, c, d, M[1], 0xa4beea44, 4) + d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11) + c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16) + b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23) + a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4) + d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11) + c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16) + b = fnH(b, c, d, a, M[6], 0x04881d05, 23) + a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4) + d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11) + c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16) + b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23) + + a = fnI(a, b, c, d, M[0], 0xf4292244, 6) + d = fnI(d, a, b, c, M[7], 0x432aff97, 10) + c = fnI(c, d, a, b, M[14], 0xab9423a7, 15) + b = fnI(b, c, d, a, M[5], 0xfc93a039, 21) + a = fnI(a, b, c, d, M[12], 0x655b59c3, 6) + d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10) + c = fnI(c, d, a, b, M[10], 0xffeff47d, 15) + b = fnI(b, c, d, a, M[1], 0x85845dd1, 21) + a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6) + d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10) + c = fnI(c, d, a, b, M[6], 0xa3014314, 15) + b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21) + a = fnI(a, b, c, d, M[4], 0xf7537e82, 6) + d = fnI(d, a, b, c, M[11], 0xbd3af235, 10) + c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15) + b = fnI(b, c, d, a, M[9], 0xeb86d391, 21) + + this._a = (this._a + a) | 0 + this._b = (this._b + b) | 0 + this._c = (this._c + c) | 0 + this._d = (this._d + d) | 0 +} + +MD5.prototype._digest = function () { + // create padding and handle blocks + this._block[this._blockOffset++] = 0x80 + if (this._blockOffset > 56) { + this._block.fill(0, this._blockOffset, 64) + this._update() + this._blockOffset = 0 + } + + this._block.fill(0, this._blockOffset, 56) + this._block.writeUInt32LE(this._length[0], 56) + this._block.writeUInt32LE(this._length[1], 60) + this._update() + + // produce result + var buffer = Buffer.allocUnsafe(16) + buffer.writeInt32LE(this._a, 0) + buffer.writeInt32LE(this._b, 4) + buffer.writeInt32LE(this._c, 8) + buffer.writeInt32LE(this._d, 12) + return buffer +} + +function rotl (x, n) { + return (x << n) | (x >>> (32 - n)) +} + +function fnF (a, b, c, d, m, k, s) { + return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0 +} + +function fnG (a, b, c, d, m, k, s) { + return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0 +} + +function fnH (a, b, c, d, m, k, s) { + return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0 +} + +function fnI (a, b, c, d, m, k, s) { + return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0 +} + +module.exports = MD5 + + +/***/ }), + +/***/ 3047: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; -eval("\n\nvar ERR_INVALID_OPT_VALUE = (__webpack_require__(/*! ../../../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes.ERR_INVALID_OPT_VALUE);\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n\n // Default value\n return state.objectMode ? 16 : 16 * 1024;\n}\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/state.js?"); +var bn = __webpack_require__(3550); +var brorand = __webpack_require__(5923); -/***/ }), +function MillerRabin(rand) { + this.rand = rand || new brorand.Rand(); +} +module.exports = MillerRabin; -/***/ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +MillerRabin.create = function create(rand) { + return new MillerRabin(rand); +}; + +MillerRabin.prototype._randbelow = function _randbelow(n) { + var len = n.bitLength(); + var min_bytes = Math.ceil(len / 8); -eval("module.exports = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/lib/internal/streams/stream-browser.js?"); + // Generage random bytes until a number less than n is found. + // This ensures that 0..n-1 have an equal probability of being selected. + do + var a = new bn(this.rand.generate(min_bytes)); + while (a.cmp(n) >= 0); -/***/ }), + return a; +}; -/***/ "./node_modules/readable-stream/readable-browser.js": -/*!**********************************************************!*\ - !*** ./node_modules/readable-stream/readable-browser.js ***! - \**********************************************************/ -/***/ (function(module, exports, __webpack_require__) { +MillerRabin.prototype._randrange = function _randrange(start, stop) { + // Generate a random number greater than or equal to start and less than stop. + var size = stop.sub(start); + return start.add(this._randbelow(size)); +}; -eval("exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ \"./node_modules/readable-stream/lib/_stream_readable.js\");\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\nexports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\nexports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ \"./node_modules/readable-stream/lib/_stream_transform.js\");\nexports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ \"./node_modules/readable-stream/lib/_stream_passthrough.js\");\nexports.finished = __webpack_require__(/*! ./lib/internal/streams/end-of-stream.js */ \"./node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\nexports.pipeline = __webpack_require__(/*! ./lib/internal/streams/pipeline.js */ \"./node_modules/readable-stream/lib/internal/streams/pipeline.js\");\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/readable-stream/readable-browser.js?"); +MillerRabin.prototype.test = function test(n, k, cb) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); -/***/ }), + if (!k) + k = Math.max(1, (len / 48) | 0); -/***/ "./node_modules/ripemd160/index.js": -/*!*****************************************!*\ - !*** ./node_modules/ripemd160/index.js ***! - \*****************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); -"use strict"; -eval("\nvar Buffer = (__webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\").Buffer)\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar HashBase = __webpack_require__(/*! hash-base */ \"./node_modules/hash-base/index.js\")\n\nvar ARRAY16 = new Array(16)\n\nvar zl = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\n]\n\nvar zr = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n]\n\nvar sl = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\n]\n\nvar sr = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n]\n\nvar hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]\nvar hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]\n\nfunction RIPEMD160 () {\n HashBase.call(this, 64)\n\n // state\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n}\n\ninherits(RIPEMD160, HashBase)\n\nRIPEMD160.prototype._update = function () {\n var words = ARRAY16\n for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)\n\n var al = this._a | 0\n var bl = this._b | 0\n var cl = this._c | 0\n var dl = this._d | 0\n var el = this._e | 0\n\n var ar = this._a | 0\n var br = this._b | 0\n var cr = this._c | 0\n var dr = this._d | 0\n var er = this._e | 0\n\n // computation\n for (var i = 0; i < 80; i += 1) {\n var tl\n var tr\n if (i < 16) {\n tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])\n tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])\n } else if (i < 32) {\n tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])\n tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])\n } else if (i < 48) {\n tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])\n tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])\n } else if (i < 64) {\n tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])\n tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])\n } else { // if (i<80) {\n tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])\n tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])\n }\n\n al = el\n el = dl\n dl = rotl(cl, 10)\n cl = bl\n bl = tl\n\n ar = er\n er = dr\n dr = rotl(cr, 10)\n cr = br\n br = tr\n }\n\n // update state\n var t = (this._b + cl + dr) | 0\n this._b = (this._c + dl + er) | 0\n this._c = (this._d + el + ar) | 0\n this._d = (this._e + al + br) | 0\n this._e = (this._a + bl + cr) | 0\n this._a = t\n}\n\nRIPEMD160.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64)\n this._update()\n this._blockOffset = 0\n }\n\n this._block.fill(0, this._blockOffset, 56)\n this._block.writeUInt32LE(this._length[0], 56)\n this._block.writeUInt32LE(this._length[1], 60)\n this._update()\n\n // produce result\n var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)\n buffer.writeInt32LE(this._a, 0)\n buffer.writeInt32LE(this._b, 4)\n buffer.writeInt32LE(this._c, 8)\n buffer.writeInt32LE(this._d, 12)\n buffer.writeInt32LE(this._e, 16)\n return buffer\n}\n\nfunction rotl (x, n) {\n return (x << n) | (x >>> (32 - n))\n}\n\nfunction fn1 (a, b, c, d, e, m, k, s) {\n return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn2 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn3 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn4 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn5 (a, b, c, d, e, m, k, s) {\n return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0\n}\n\nmodule.exports = RIPEMD160\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/ripemd160/index.js?"); + var rn1 = n1.toRed(red); -/***/ }), + var prime = true; + for (; k > 0; k--) { + var a = this._randrange(new bn(2), n1); + if (cb) + cb(a); -/***/ "./node_modules/safe-buffer/index.js": -/*!*******************************************!*\ - !*** ./node_modules/safe-buffer/index.js ***! - \*******************************************/ -/***/ (function(module, exports, __webpack_require__) { + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; -eval("/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/safe-buffer/index.js?"); + for (var i = 1; i < s; i++) { + x = x.redSqr(); -/***/ }), + if (x.cmp(rone) === 0) + return false; + if (x.cmp(rn1) === 0) + break; + } -/***/ "./node_modules/safer-buffer/safer.js": -/*!********************************************!*\ - !*** ./node_modules/safer-buffer/safer.js ***! - \********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (i === s) + return false; + } -"use strict"; -eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\n/* eslint-disable node/no-deprecated-api */\n\n\n\nvar buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\nvar Buffer = buffer.Buffer\n\nvar safer = {}\n\nvar key\n\nfor (key in buffer) {\n if (!buffer.hasOwnProperty(key)) continue\n if (key === 'SlowBuffer' || key === 'Buffer') continue\n safer[key] = buffer[key]\n}\n\nvar Safer = safer.Buffer = {}\nfor (key in Buffer) {\n if (!Buffer.hasOwnProperty(key)) continue\n if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue\n Safer[key] = Buffer[key]\n}\n\nsafer.Buffer.prototype = Buffer.prototype\n\nif (!Safer.from || Safer.from === Uint8Array.from) {\n Safer.from = function (value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('The \"value\" argument must not be of type number. Received type ' + typeof value)\n }\n if (value && typeof value.length === 'undefined') {\n throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)\n }\n return Buffer(value, encodingOrOffset, length)\n }\n}\n\nif (!Safer.alloc) {\n Safer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('The \"size\" argument must be of type number. Received type ' + typeof size)\n }\n if (size < 0 || size >= 2 * (1 << 30)) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n var buf = Buffer(size)\n if (!fill || fill.length === 0) {\n buf.fill(0)\n } else if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n return buf\n }\n}\n\nif (!safer.kStringMaxLength) {\n try {\n safer.kStringMaxLength = process.binding('buffer').kStringMaxLength\n } catch (e) {\n // we can't determine kStringMaxLength in environments where process.binding\n // is unsupported, so let's not set it\n }\n}\n\nif (!safer.constants) {\n safer.constants = {\n MAX_LENGTH: safer.kMaxLength\n }\n if (safer.kStringMaxLength) {\n safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength\n }\n}\n\nmodule.exports = safer\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/safer-buffer/safer.js?"); + return prime; +}; -/***/ }), +MillerRabin.prototype.getDivisor = function getDivisor(n, k) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); -/***/ "./node_modules/scrypt-js/scrypt.js": -/*!******************************************!*\ - !*** ./node_modules/scrypt-js/scrypt.js ***! - \******************************************/ -/***/ (function(module) { + if (!k) + k = Math.max(1, (len / 48) | 0); -"use strict"; -eval("\n\n(function(root) {\n const MAX_VALUE = 0x7fffffff;\n\n // The SHA256 and PBKDF2 implementation are from scrypt-async-js:\n // See: https://github.com/dchest/scrypt-async-js\n function SHA256(m) {\n const K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,\n 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,\n 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,\n 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,\n 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,\n 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,\n 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n ]);\n\n let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a;\n let h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;\n const w = new Uint32Array(64);\n\n function blocks(p) {\n let off = 0, len = p.length;\n while (len >= 64) {\n let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i, j, t1, t2;\n\n for (i = 0; i < 16; i++) {\n j = off + i*4;\n w[i] = ((p[j] & 0xff)<<24) | ((p[j+1] & 0xff)<<16) |\n ((p[j+2] & 0xff)<<8) | (p[j+3] & 0xff);\n }\n\n for (i = 16; i < 64; i++) {\n u = w[i-2];\n t1 = ((u>>>17) | (u<<(32-17))) ^ ((u>>>19) | (u<<(32-19))) ^ (u>>>10);\n\n u = w[i-15];\n t2 = ((u>>>7) | (u<<(32-7))) ^ ((u>>>18) | (u<<(32-18))) ^ (u>>>3);\n\n w[i] = (((t1 + w[i-7]) | 0) + ((t2 + w[i-16]) | 0)) | 0;\n }\n\n for (i = 0; i < 64; i++) {\n t1 = ((((((e>>>6) | (e<<(32-6))) ^ ((e>>>11) | (e<<(32-11))) ^\n ((e>>>25) | (e<<(32-25)))) + ((e & f) ^ (~e & g))) | 0) +\n ((h + ((K[i] + w[i]) | 0)) | 0)) | 0;\n\n t2 = ((((a>>>2) | (a<<(32-2))) ^ ((a>>>13) | (a<<(32-13))) ^\n ((a>>>22) | (a<<(32-22)))) + ((a & b) ^ (a & c) ^ (b & c))) | 0;\n\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n\n h0 = (h0 + a) | 0;\n h1 = (h1 + b) | 0;\n h2 = (h2 + c) | 0;\n h3 = (h3 + d) | 0;\n h4 = (h4 + e) | 0;\n h5 = (h5 + f) | 0;\n h6 = (h6 + g) | 0;\n h7 = (h7 + h) | 0;\n\n off += 64;\n len -= 64;\n }\n }\n\n blocks(m);\n\n let i, bytesLeft = m.length % 64,\n bitLenHi = (m.length / 0x20000000) | 0,\n bitLenLo = m.length << 3,\n numZeros = (bytesLeft < 56) ? 56 : 120,\n p = m.slice(m.length - bytesLeft, m.length);\n\n p.push(0x80);\n for (i = bytesLeft + 1; i < numZeros; i++) { p.push(0); }\n p.push((bitLenHi >>> 24) & 0xff);\n p.push((bitLenHi >>> 16) & 0xff);\n p.push((bitLenHi >>> 8) & 0xff);\n p.push((bitLenHi >>> 0) & 0xff);\n p.push((bitLenLo >>> 24) & 0xff);\n p.push((bitLenLo >>> 16) & 0xff);\n p.push((bitLenLo >>> 8) & 0xff);\n p.push((bitLenLo >>> 0) & 0xff);\n\n blocks(p);\n\n return [\n (h0 >>> 24) & 0xff, (h0 >>> 16) & 0xff, (h0 >>> 8) & 0xff, (h0 >>> 0) & 0xff,\n (h1 >>> 24) & 0xff, (h1 >>> 16) & 0xff, (h1 >>> 8) & 0xff, (h1 >>> 0) & 0xff,\n (h2 >>> 24) & 0xff, (h2 >>> 16) & 0xff, (h2 >>> 8) & 0xff, (h2 >>> 0) & 0xff,\n (h3 >>> 24) & 0xff, (h3 >>> 16) & 0xff, (h3 >>> 8) & 0xff, (h3 >>> 0) & 0xff,\n (h4 >>> 24) & 0xff, (h4 >>> 16) & 0xff, (h4 >>> 8) & 0xff, (h4 >>> 0) & 0xff,\n (h5 >>> 24) & 0xff, (h5 >>> 16) & 0xff, (h5 >>> 8) & 0xff, (h5 >>> 0) & 0xff,\n (h6 >>> 24) & 0xff, (h6 >>> 16) & 0xff, (h6 >>> 8) & 0xff, (h6 >>> 0) & 0xff,\n (h7 >>> 24) & 0xff, (h7 >>> 16) & 0xff, (h7 >>> 8) & 0xff, (h7 >>> 0) & 0xff\n ];\n }\n\n function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) {\n // compress password if it's longer than hash block length\n password = (password.length <= 64) ? password : SHA256(password);\n\n const innerLen = 64 + salt.length + 4;\n const inner = new Array(innerLen);\n const outerKey = new Array(64);\n\n let i;\n let dk = [];\n\n // inner = (password ^ ipad) || salt || counter\n for (i = 0; i < 64; i++) { inner[i] = 0x36; }\n for (i = 0; i < password.length; i++) { inner[i] ^= password[i]; }\n for (i = 0; i < salt.length; i++) { inner[64 + i] = salt[i]; }\n for (i = innerLen - 4; i < innerLen; i++) { inner[i] = 0; }\n\n // outerKey = password ^ opad\n for (i = 0; i < 64; i++) outerKey[i] = 0x5c;\n for (i = 0; i < password.length; i++) outerKey[i] ^= password[i];\n\n // increments counter inside inner\n function incrementCounter() {\n for (let i = innerLen - 1; i >= innerLen - 4; i--) {\n inner[i]++;\n if (inner[i] <= 0xff) return;\n inner[i] = 0;\n }\n }\n\n // output blocks = SHA256(outerKey || SHA256(inner)) ...\n while (dkLen >= 32) {\n incrementCounter();\n dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))));\n dkLen -= 32;\n }\n if (dkLen > 0) {\n incrementCounter();\n dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0, dkLen));\n }\n\n return dk;\n }\n\n // The following is an adaptation of scryptsy\n // See: https://www.npmjs.com/package/scryptsy\n function blockmix_salsa8(BY, Yi, r, x, _X) {\n let i;\n\n arraycopy(BY, (2 * r - 1) * 16, _X, 0, 16);\n for (i = 0; i < 2 * r; i++) {\n blockxor(BY, i * 16, _X, 16);\n salsa20_8(_X, x);\n arraycopy(_X, 0, BY, Yi + (i * 16), 16);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy(BY, Yi + (i * 2) * 16, BY, (i * 16), 16);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy(BY, Yi + (i * 2 + 1) * 16, BY, (i + r) * 16, 16);\n }\n }\n\n function R(a, b) {\n return (a << b) | (a >>> (32 - b));\n }\n\n function salsa20_8(B, x) {\n arraycopy(B, 0, x, 0, 16);\n\n for (let i = 8; i > 0; i -= 2) {\n x[ 4] ^= R(x[ 0] + x[12], 7);\n x[ 8] ^= R(x[ 4] + x[ 0], 9);\n x[12] ^= R(x[ 8] + x[ 4], 13);\n x[ 0] ^= R(x[12] + x[ 8], 18);\n x[ 9] ^= R(x[ 5] + x[ 1], 7);\n x[13] ^= R(x[ 9] + x[ 5], 9);\n x[ 1] ^= R(x[13] + x[ 9], 13);\n x[ 5] ^= R(x[ 1] + x[13], 18);\n x[14] ^= R(x[10] + x[ 6], 7);\n x[ 2] ^= R(x[14] + x[10], 9);\n x[ 6] ^= R(x[ 2] + x[14], 13);\n x[10] ^= R(x[ 6] + x[ 2], 18);\n x[ 3] ^= R(x[15] + x[11], 7);\n x[ 7] ^= R(x[ 3] + x[15], 9);\n x[11] ^= R(x[ 7] + x[ 3], 13);\n x[15] ^= R(x[11] + x[ 7], 18);\n x[ 1] ^= R(x[ 0] + x[ 3], 7);\n x[ 2] ^= R(x[ 1] + x[ 0], 9);\n x[ 3] ^= R(x[ 2] + x[ 1], 13);\n x[ 0] ^= R(x[ 3] + x[ 2], 18);\n x[ 6] ^= R(x[ 5] + x[ 4], 7);\n x[ 7] ^= R(x[ 6] + x[ 5], 9);\n x[ 4] ^= R(x[ 7] + x[ 6], 13);\n x[ 5] ^= R(x[ 4] + x[ 7], 18);\n x[11] ^= R(x[10] + x[ 9], 7);\n x[ 8] ^= R(x[11] + x[10], 9);\n x[ 9] ^= R(x[ 8] + x[11], 13);\n x[10] ^= R(x[ 9] + x[ 8], 18);\n x[12] ^= R(x[15] + x[14], 7);\n x[13] ^= R(x[12] + x[15], 9);\n x[14] ^= R(x[13] + x[12], 13);\n x[15] ^= R(x[14] + x[13], 18);\n }\n\n for (let i = 0; i < 16; ++i) {\n B[i] += x[i];\n }\n }\n\n // naive approach... going back to loop unrolling may yield additional performance\n function blockxor(S, Si, D, len) {\n for (let i = 0; i < len; i++) {\n D[i] ^= S[Si + i]\n }\n }\n\n function arraycopy(src, srcPos, dest, destPos, length) {\n while (length--) {\n dest[destPos++] = src[srcPos++];\n }\n }\n\n function checkBufferish(o) {\n if (!o || typeof(o.length) !== 'number') { return false; }\n\n for (let i = 0; i < o.length; i++) {\n const v = o[i];\n if (typeof(v) !== 'number' || v % 1 || v < 0 || v >= 256) {\n return false;\n }\n }\n\n return true;\n }\n\n function ensureInteger(value, name) {\n if (typeof(value) !== \"number\" || (value % 1)) { throw new Error('invalid ' + name); }\n return value;\n }\n\n // N = Cpu cost, r = Memory cost, p = parallelization cost\n // callback(error, progress, key)\n function _scrypt(password, salt, N, r, p, dkLen, callback) {\n\n N = ensureInteger(N, 'N');\n r = ensureInteger(r, 'r');\n p = ensureInteger(p, 'p');\n\n dkLen = ensureInteger(dkLen, 'dkLen');\n\n if (N === 0 || (N & (N - 1)) !== 0) { throw new Error('N must be power of 2'); }\n\n if (N > MAX_VALUE / 128 / r) { throw new Error('N too large'); }\n if (r > MAX_VALUE / 128 / p) { throw new Error('r too large'); }\n\n if (!checkBufferish(password)) {\n throw new Error('password must be an array or buffer');\n }\n password = Array.prototype.slice.call(password);\n\n if (!checkBufferish(salt)) {\n throw new Error('salt must be an array or buffer');\n }\n salt = Array.prototype.slice.call(salt);\n\n let b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r);\n const B = new Uint32Array(p * 32 * r)\n for (let i = 0; i < B.length; i++) {\n const j = i * 4;\n B[i] = ((b[j + 3] & 0xff) << 24) |\n ((b[j + 2] & 0xff) << 16) |\n ((b[j + 1] & 0xff) << 8) |\n ((b[j + 0] & 0xff) << 0);\n }\n\n const XY = new Uint32Array(64 * r);\n const V = new Uint32Array(32 * r * N);\n\n const Yi = 32 * r;\n\n // scratch space\n const x = new Uint32Array(16); // salsa20_8\n const _X = new Uint32Array(16); // blockmix_salsa8\n\n const totalOps = p * N * 2;\n let currentOp = 0;\n let lastPercent10 = null;\n\n // Set this to true to abandon the scrypt on the next step\n let stop = false;\n\n // State information\n let state = 0;\n let i0 = 0, i1;\n let Bi;\n\n // How many blockmix_salsa8 can we do per step?\n const limit = callback ? parseInt(1000 / r): 0xffffffff;\n\n // Trick from scrypt-async; if there is a setImmediate shim in place, use it\n const nextTick = (typeof(setImmediate) !== 'undefined') ? setImmediate : setTimeout;\n\n // This is really all I changed; making scryptsy a state machine so we occasionally\n // stop and give other evnts on the evnt loop a chance to run. ~RicMoo\n const incrementalSMix = function() {\n if (stop) {\n return callback(new Error('cancelled'), currentOp / totalOps);\n }\n\n let steps;\n\n switch (state) {\n case 0:\n // for (var i = 0; i < p; i++)...\n Bi = i0 * 32 * r;\n\n arraycopy(B, Bi, XY, 0, Yi); // ROMix - 1\n\n state = 1; // Move to ROMix 2\n i1 = 0;\n\n // Fall through\n\n case 1:\n\n // Run up to 1000 steps of the first inner smix loop\n steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (let i = 0; i < steps; i++) { // ROMix - 2\n arraycopy(XY, 0, V, (i1 + i) * Yi, Yi) // ROMix - 3\n blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 4\n }\n\n // for (var i = 0; i < N; i++)\n i1 += steps;\n currentOp += steps;\n\n if (callback) {\n // Call the callback with the progress (optionally stopping us)\n const percent10 = parseInt(1000 * currentOp / totalOps);\n if (percent10 !== lastPercent10) {\n stop = callback(null, currentOp / totalOps);\n if (stop) { break; }\n lastPercent10 = percent10;\n }\n }\n\n if (i1 < N) { break; }\n\n i1 = 0; // Move to ROMix 6\n state = 2;\n\n // Fall through\n\n case 2:\n\n // Run up to 1000 steps of the second inner smix loop\n steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (let i = 0; i < steps; i++) { // ROMix - 6\n const offset = (2 * r - 1) * 16; // ROMix - 7\n const j = XY[offset] & (N - 1);\n blockxor(V, j * Yi, XY, Yi); // ROMix - 8 (inner)\n blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 9 (outer)\n }\n\n // for (var i = 0; i < N; i++)...\n i1 += steps;\n currentOp += steps;\n\n // Call the callback with the progress (optionally stopping us)\n if (callback) {\n const percent10 = parseInt(1000 * currentOp / totalOps);\n if (percent10 !== lastPercent10) {\n stop = callback(null, currentOp / totalOps);\n if (stop) { break; }\n lastPercent10 = percent10;\n }\n }\n\n if (i1 < N) { break; }\n\n arraycopy(XY, 0, B, Bi, Yi); // ROMix - 10\n\n // for (var i = 0; i < p; i++)...\n i0++;\n if (i0 < p) {\n state = 0;\n break;\n }\n\n b = [];\n for (let i = 0; i < B.length; i++) {\n b.push((B[i] >> 0) & 0xff);\n b.push((B[i] >> 8) & 0xff);\n b.push((B[i] >> 16) & 0xff);\n b.push((B[i] >> 24) & 0xff);\n }\n\n const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen);\n\n // Send the result to the callback\n if (callback) { callback(null, 1.0, derivedKey); }\n\n // Done; don't break (which would reschedule)\n return derivedKey;\n }\n\n // Schedule the next steps\n if (callback) { nextTick(incrementalSMix); }\n }\n\n // Run the smix state machine until completion\n if (!callback) {\n while (true) {\n const derivedKey = incrementalSMix();\n if (derivedKey != undefined) { return derivedKey; }\n }\n }\n\n // Bootstrap the async incremental smix\n incrementalSMix();\n }\n\n const lib = {\n scrypt: function(password, salt, N, r, p, dkLen, progressCallback) {\n return new Promise(function(resolve, reject) {\n let lastProgress = 0;\n if (progressCallback) { progressCallback(0); }\n _scrypt(password, salt, N, r, p, dkLen, function(error, progress, key) {\n if (error) {\n reject(error);\n } else if (key) {\n if (progressCallback && lastProgress !== 1) {\n progressCallback(1);\n }\n resolve(new Uint8Array(key));\n } else if (progressCallback && progress !== lastProgress) {\n lastProgress = progress;\n return progressCallback(progress);\n }\n });\n });\n },\n syncScrypt: function(password, salt, N, r, p, dkLen) {\n return new Uint8Array(_scrypt(password, salt, N, r, p, dkLen));\n }\n };\n\n // node.js\n if (true) {\n module.exports = lib;\n\n // RequireJS/AMD\n // http://www.requirejs.org/docs/api.html\n // https://github.com/amdjs/amdjs-api/wiki/AMD\n } else {}\n\n})(this);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/scrypt-js/scrypt.js?"); + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); -/***/ }), + var rn1 = n1.toRed(red); -/***/ "./node_modules/sha.js/hash.js": -/*!*************************************!*\ - !*** ./node_modules/sha.js/hash.js ***! - \*************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (; k > 0; k--) { + var a = this._randrange(new bn(2), n1); -eval("var Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\n// prototype class for hash functions\nfunction Hash (blockSize, finalSize) {\n this._block = Buffer.alloc(blockSize)\n this._finalSize = finalSize\n this._blockSize = blockSize\n this._len = 0\n}\n\nHash.prototype.update = function (data, enc) {\n if (typeof data === 'string') {\n enc = enc || 'utf8'\n data = Buffer.from(data, enc)\n }\n\n var block = this._block\n var blockSize = this._blockSize\n var length = data.length\n var accum = this._len\n\n for (var offset = 0; offset < length;) {\n var assigned = accum % blockSize\n var remainder = Math.min(length - offset, blockSize - assigned)\n\n for (var i = 0; i < remainder; i++) {\n block[assigned + i] = data[offset + i]\n }\n\n accum += remainder\n offset += remainder\n\n if ((accum % blockSize) === 0) {\n this._update(block)\n }\n }\n\n this._len += length\n return this\n}\n\nHash.prototype.digest = function (enc) {\n var rem = this._len % this._blockSize\n\n this._block[rem] = 0x80\n\n // zero (rem + 1) trailing bits, where (rem + 1) is the smallest\n // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize\n this._block.fill(0, rem + 1)\n\n if (rem >= this._finalSize) {\n this._update(this._block)\n this._block.fill(0)\n }\n\n var bits = this._len * 8\n\n // uint32\n if (bits <= 0xffffffff) {\n this._block.writeUInt32BE(bits, this._blockSize - 4)\n\n // uint64\n } else {\n var lowBits = (bits & 0xffffffff) >>> 0\n var highBits = (bits - lowBits) / 0x100000000\n\n this._block.writeUInt32BE(highBits, this._blockSize - 8)\n this._block.writeUInt32BE(lowBits, this._blockSize - 4)\n }\n\n this._update(this._block)\n var hash = this._hash()\n\n return enc ? hash.toString(enc) : hash\n}\n\nHash.prototype._update = function () {\n throw new Error('_update must be implemented by subclass')\n}\n\nmodule.exports = Hash\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/hash.js?"); + var g = n.gcd(a); + if (g.cmpn(1) !== 0) + return g; -/***/ }), + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; -/***/ "./node_modules/sha.js/index.js": -/*!**************************************!*\ - !*** ./node_modules/sha.js/index.js ***! - \**************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + for (var i = 1; i < s; i++) { + x = x.redSqr(); -eval("var exports = module.exports = function SHA (algorithm) {\n algorithm = algorithm.toLowerCase()\n\n var Algorithm = exports[algorithm]\n if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')\n\n return new Algorithm()\n}\n\nexports.sha = __webpack_require__(/*! ./sha */ \"./node_modules/sha.js/sha.js\")\nexports.sha1 = __webpack_require__(/*! ./sha1 */ \"./node_modules/sha.js/sha1.js\")\nexports.sha224 = __webpack_require__(/*! ./sha224 */ \"./node_modules/sha.js/sha224.js\")\nexports.sha256 = __webpack_require__(/*! ./sha256 */ \"./node_modules/sha.js/sha256.js\")\nexports.sha384 = __webpack_require__(/*! ./sha384 */ \"./node_modules/sha.js/sha384.js\")\nexports.sha512 = __webpack_require__(/*! ./sha512 */ \"./node_modules/sha.js/sha512.js\")\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/index.js?"); + if (x.cmp(rone) === 0) + return x.fromRed().subn(1).gcd(n); + if (x.cmp(rn1) === 0) + break; + } -/***/ }), + if (i === s) { + x = x.redSqr(); + return x.fromRed().subn(1).gcd(n); + } + } -/***/ "./node_modules/sha.js/sha.js": -/*!************************************!*\ - !*** ./node_modules/sha.js/sha.js ***! - \************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return false; +}; -eval("/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined\n * in FIPS PUB 180-1\n * This source code is derived from sha1.js of the same repository.\n * The difference between SHA-0 and SHA-1 is just a bitwise rotate left\n * operation was added.\n */\n\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Hash = __webpack_require__(/*! ./hash */ \"./node_modules/sha.js/hash.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar K = [\n 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0\n]\n\nvar W = new Array(80)\n\nfunction Sha () {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha, Hash)\n\nSha.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\nfunction rotl5 (num) {\n return (num << 5) | (num >>> 27)\n}\n\nfunction rotl30 (num) {\n return (num << 30) | (num >>> 2)\n}\n\nfunction ft (s, b, c, d) {\n if (s === 0) return (b & c) | ((~b) & d)\n if (s === 2) return (b & c) | (b & d) | (c & d)\n return b ^ c ^ d\n}\n\nSha.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20)\n var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0\n\n e = d\n d = c\n c = rotl30(b)\n b = a\n a = t\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20)\n\n H.writeInt32BE(this._a | 0, 0)\n H.writeInt32BE(this._b | 0, 4)\n H.writeInt32BE(this._c | 0, 8)\n H.writeInt32BE(this._d | 0, 12)\n H.writeInt32BE(this._e | 0, 16)\n\n return H\n}\n\nmodule.exports = Sha\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/sha.js?"); /***/ }), -/***/ "./node_modules/sha.js/sha1.js": -/*!*************************************!*\ - !*** ./node_modules/sha.js/sha1.js ***! - \*************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 9746: +/***/ (function(module) { -eval("/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined\n * in FIPS PUB 180-1\n * Version 2.1a Copyright Paul Johnston 2000 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for details.\n */\n\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Hash = __webpack_require__(/*! ./hash */ \"./node_modules/sha.js/hash.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar K = [\n 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0\n]\n\nvar W = new Array(80)\n\nfunction Sha1 () {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha1, Hash)\n\nSha1.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\nfunction rotl1 (num) {\n return (num << 1) | (num >>> 31)\n}\n\nfunction rotl5 (num) {\n return (num << 5) | (num >>> 27)\n}\n\nfunction rotl30 (num) {\n return (num << 30) | (num >>> 2)\n}\n\nfunction ft (s, b, c, d) {\n if (s === 0) return (b & c) | ((~b) & d)\n if (s === 2) return (b & c) | (b & d) | (c & d)\n return b ^ c ^ d\n}\n\nSha1.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20)\n var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0\n\n e = d\n d = c\n c = rotl30(b)\n b = a\n a = t\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha1.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20)\n\n H.writeInt32BE(this._a | 0, 0)\n H.writeInt32BE(this._b | 0, 4)\n H.writeInt32BE(this._c | 0, 8)\n H.writeInt32BE(this._d | 0, 12)\n H.writeInt32BE(this._e | 0, 16)\n\n return H\n}\n\nmodule.exports = Sha1\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/sha1.js?"); +module.exports = assert; -/***/ }), +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} -/***/ "./node_modules/sha.js/sha224.js": -/*!***************************************!*\ - !*** ./node_modules/sha.js/sha224.js ***! - \***************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); +}; -eval("/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Sha256 = __webpack_require__(/*! ./sha256 */ \"./node_modules/sha.js/sha256.js\")\nvar Hash = __webpack_require__(/*! ./hash */ \"./node_modules/sha.js/hash.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar W = new Array(64)\n\nfunction Sha224 () {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha224, Sha256)\n\nSha224.prototype.init = function () {\n this._a = 0xc1059ed8\n this._b = 0x367cd507\n this._c = 0x3070dd17\n this._d = 0xf70e5939\n this._e = 0xffc00b31\n this._f = 0x68581511\n this._g = 0x64f98fa7\n this._h = 0xbefa4fa4\n\n return this\n}\n\nSha224.prototype._hash = function () {\n var H = Buffer.allocUnsafe(28)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n\n return H\n}\n\nmodule.exports = Sha224\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/sha224.js?"); /***/ }), -/***/ "./node_modules/sha.js/sha256.js": -/*!***************************************!*\ - !*** ./node_modules/sha.js/sha256.js ***! - \***************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 4504: +/***/ (function(__unused_webpack_module, exports) { -eval("/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Hash = __webpack_require__(/*! ./hash */ \"./node_modules/sha.js/hash.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar K = [\n 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,\n 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,\n 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,\n 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,\n 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,\n 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,\n 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,\n 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,\n 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,\n 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,\n 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,\n 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,\n 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,\n 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,\n 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,\n 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2\n]\n\nvar W = new Array(64)\n\nfunction Sha256 () {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha256, Hash)\n\nSha256.prototype.init = function () {\n this._a = 0x6a09e667\n this._b = 0xbb67ae85\n this._c = 0x3c6ef372\n this._d = 0xa54ff53a\n this._e = 0x510e527f\n this._f = 0x9b05688c\n this._g = 0x1f83d9ab\n this._h = 0x5be0cd19\n\n return this\n}\n\nfunction ch (x, y, z) {\n return z ^ (x & (y ^ z))\n}\n\nfunction maj (x, y, z) {\n return (x & y) | (z & (x | y))\n}\n\nfunction sigma0 (x) {\n return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)\n}\n\nfunction sigma1 (x) {\n return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)\n}\n\nfunction gamma0 (x) {\n return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)\n}\n\nfunction gamma1 (x) {\n return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)\n}\n\nSha256.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n var f = this._f | 0\n var g = this._g | 0\n var h = this._h | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0\n\n for (var j = 0; j < 64; ++j) {\n var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0\n var T2 = (sigma0(a) + maj(a, b, c)) | 0\n\n h = g\n g = f\n f = e\n e = (d + T1) | 0\n d = c\n c = b\n b = a\n a = (T1 + T2) | 0\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n this._f = (f + this._f) | 0\n this._g = (g + this._g) | 0\n this._h = (h + this._h) | 0\n}\n\nSha256.prototype._hash = function () {\n var H = Buffer.allocUnsafe(32)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n H.writeInt32BE(this._h, 28)\n\n return H\n}\n\nmodule.exports = Sha256\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/sha256.js?"); +"use strict"; -/***/ }), -/***/ "./node_modules/sha.js/sha384.js": -/*!***************************************!*\ - !*** ./node_modules/sha.js/sha384.js ***! - \***************************************/ +var utils = exports; + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg !== 'string') { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + return res; + } + if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } else { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } + return res; +} +utils.toArray = toArray; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +utils.encode = function encode(arr, enc) { + if (enc === 'hex') + return toHex(arr); + else + return arr; +}; + + +/***/ }), + +/***/ 8925: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Advanced Encryption Standard (AES) implementation. + * + * This implementation is based on the public domain library 'jscrypto' which + * was written by: + * + * Emily Stark (estark@stanford.edu) + * Mike Hamburg (mhamburg@stanford.edu) + * Dan Boneh (dabo@cs.stanford.edu) + * + * Parts of this code are based on the OpenSSL implementation of AES: + * http://www.openssl.org + * + * @author Dave Longley + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(5649); +__webpack_require__(1967); +__webpack_require__(7116); + +/* AES API */ +module.exports = forge.aes = forge.aes || {}; + +/** + * Deprecated. Instead, use: + * + * var cipher = forge.cipher.createCipher('AES-', key); + * cipher.start({iv: iv}); + * + * Creates an AES cipher object to encrypt data using the given symmetric key. + * The output will be stored in the 'output' member of the returned cipher. + * + * The key and iv may be given as a string of bytes, an array of bytes, + * a byte buffer, or an array of 32-bit words. + * + * @param key the symmetric key to use. + * @param iv the initialization vector to use. + * @param output the buffer to write to, null to create one. + * @param mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +forge.aes.startEncrypting = function(key, iv, output, mode) { + var cipher = _createCipher({ + key: key, + output: output, + decrypt: false, + mode: mode + }); + cipher.start(iv); + return cipher; +}; + +/** + * Deprecated. Instead, use: + * + * var cipher = forge.cipher.createCipher('AES-', key); + * + * Creates an AES cipher object to encrypt data using the given symmetric key. + * + * The key may be given as a string of bytes, an array of bytes, a + * byte buffer, or an array of 32-bit words. + * + * @param key the symmetric key to use. + * @param mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +forge.aes.createEncryptionCipher = function(key, mode) { + return _createCipher({ + key: key, + output: null, + decrypt: false, + mode: mode + }); +}; + +/** + * Deprecated. Instead, use: + * + * var decipher = forge.cipher.createDecipher('AES-', key); + * decipher.start({iv: iv}); + * + * Creates an AES cipher object to decrypt data using the given symmetric key. + * The output will be stored in the 'output' member of the returned cipher. + * + * The key and iv may be given as a string of bytes, an array of bytes, + * a byte buffer, or an array of 32-bit words. + * + * @param key the symmetric key to use. + * @param iv the initialization vector to use. + * @param output the buffer to write to, null to create one. + * @param mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +forge.aes.startDecrypting = function(key, iv, output, mode) { + var cipher = _createCipher({ + key: key, + output: output, + decrypt: true, + mode: mode + }); + cipher.start(iv); + return cipher; +}; + +/** + * Deprecated. Instead, use: + * + * var decipher = forge.cipher.createDecipher('AES-', key); + * + * Creates an AES cipher object to decrypt data using the given symmetric key. + * + * The key may be given as a string of bytes, an array of bytes, a + * byte buffer, or an array of 32-bit words. + * + * @param key the symmetric key to use. + * @param mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +forge.aes.createDecryptionCipher = function(key, mode) { + return _createCipher({ + key: key, + output: null, + decrypt: true, + mode: mode + }); +}; + +/** + * Creates a new AES cipher algorithm object. + * + * @param name the name of the algorithm. + * @param mode the mode factory function. + * + * @return the AES algorithm object. + */ +forge.aes.Algorithm = function(name, mode) { + if(!init) { + initialize(); + } + var self = this; + self.name = name; + self.mode = new mode({ + blockSize: 16, + cipher: { + encrypt: function(inBlock, outBlock) { + return _updateBlock(self._w, inBlock, outBlock, false); + }, + decrypt: function(inBlock, outBlock) { + return _updateBlock(self._w, inBlock, outBlock, true); + } + } + }); + self._init = false; +}; + +/** + * Initializes this AES algorithm by expanding its key. + * + * @param options the options to use. + * key the key to use with this algorithm. + * decrypt true if the algorithm should be initialized for decryption, + * false for encryption. + */ +forge.aes.Algorithm.prototype.initialize = function(options) { + if(this._init) { + return; + } + + var key = options.key; + var tmp; + + /* Note: The key may be a string of bytes, an array of bytes, a byte + buffer, or an array of 32-bit integers. If the key is in bytes, then + it must be 16, 24, or 32 bytes in length. If it is in 32-bit + integers, it must be 4, 6, or 8 integers long. */ + + if(typeof key === 'string' && + (key.length === 16 || key.length === 24 || key.length === 32)) { + // convert key string into byte buffer + key = forge.util.createBuffer(key); + } else if(forge.util.isArray(key) && + (key.length === 16 || key.length === 24 || key.length === 32)) { + // convert key integer array into byte buffer + tmp = key; + key = forge.util.createBuffer(); + for(var i = 0; i < tmp.length; ++i) { + key.putByte(tmp[i]); + } + } + + // convert key byte buffer into 32-bit integer array + if(!forge.util.isArray(key)) { + tmp = key; + key = []; + + // key lengths of 16, 24, 32 bytes allowed + var len = tmp.length(); + if(len === 16 || len === 24 || len === 32) { + len = len >>> 2; + for(var i = 0; i < len; ++i) { + key.push(tmp.getInt32()); + } + } + } + + // key must be an array of 32-bit integers by now + if(!forge.util.isArray(key) || + !(key.length === 4 || key.length === 6 || key.length === 8)) { + throw new Error('Invalid key parameter.'); + } + + // encryption operation is always used for these modes + var mode = this.mode.name; + var encryptOp = (['CFB', 'OFB', 'CTR', 'GCM'].indexOf(mode) !== -1); + + // do key expansion + this._w = _expandKey(key, options.decrypt && !encryptOp); + this._init = true; +}; + +/** + * Expands a key. Typically only used for testing. + * + * @param key the symmetric key to expand, as an array of 32-bit words. + * @param decrypt true to expand for decryption, false for encryption. + * + * @return the expanded key. + */ +forge.aes._expandKey = function(key, decrypt) { + if(!init) { + initialize(); + } + return _expandKey(key, decrypt); +}; + +/** + * Updates a single block. Typically only used for testing. + * + * @param w the expanded key to use. + * @param input an array of block-size 32-bit words. + * @param output an array of block-size 32-bit words. + * @param decrypt true to decrypt, false to encrypt. + */ +forge.aes._updateBlock = _updateBlock; + +/** Register AES algorithms **/ + +registerAlgorithm('AES-ECB', forge.cipher.modes.ecb); +registerAlgorithm('AES-CBC', forge.cipher.modes.cbc); +registerAlgorithm('AES-CFB', forge.cipher.modes.cfb); +registerAlgorithm('AES-OFB', forge.cipher.modes.ofb); +registerAlgorithm('AES-CTR', forge.cipher.modes.ctr); +registerAlgorithm('AES-GCM', forge.cipher.modes.gcm); + +function registerAlgorithm(name, mode) { + var factory = function() { + return new forge.aes.Algorithm(name, mode); + }; + forge.cipher.registerAlgorithm(name, factory); +} + +/** AES implementation **/ + +var init = false; // not yet initialized +var Nb = 4; // number of words comprising the state (AES = 4) +var sbox; // non-linear substitution table used in key expansion +var isbox; // inversion of sbox +var rcon; // round constant word array +var mix; // mix-columns table +var imix; // inverse mix-columns table + +/** + * Performs initialization, ie: precomputes tables to optimize for speed. + * + * One way to understand how AES works is to imagine that 'addition' and + * 'multiplication' are interfaces that require certain mathematical + * properties to hold true (ie: they are associative) but they might have + * different implementations and produce different kinds of results ... + * provided that their mathematical properties remain true. AES defines + * its own methods of addition and multiplication but keeps some important + * properties the same, ie: associativity and distributivity. The + * explanation below tries to shed some light on how AES defines addition + * and multiplication of bytes and 32-bit words in order to perform its + * encryption and decryption algorithms. + * + * The basics: + * + * The AES algorithm views bytes as binary representations of polynomials + * that have either 1 or 0 as the coefficients. It defines the addition + * or subtraction of two bytes as the XOR operation. It also defines the + * multiplication of two bytes as a finite field referred to as GF(2^8) + * (Note: 'GF' means "Galois Field" which is a field that contains a finite + * number of elements so GF(2^8) has 256 elements). + * + * This means that any two bytes can be represented as binary polynomials; + * when they multiplied together and modularly reduced by an irreducible + * polynomial of the 8th degree, the results are the field GF(2^8). The + * specific irreducible polynomial that AES uses in hexadecimal is 0x11b. + * This multiplication is associative with 0x01 as the identity: + * + * (b * 0x01 = GF(b, 0x01) = b). + * + * The operation GF(b, 0x02) can be performed at the byte level by left + * shifting b once and then XOR'ing it (to perform the modular reduction) + * with 0x11b if b is >= 128. Repeated application of the multiplication + * of 0x02 can be used to implement the multiplication of any two bytes. + * + * For instance, multiplying 0x57 and 0x13, denoted as GF(0x57, 0x13), can + * be performed by factoring 0x13 into 0x01, 0x02, and 0x10. Then these + * factors can each be multiplied by 0x57 and then added together. To do + * the multiplication, values for 0x57 multiplied by each of these 3 factors + * can be precomputed and stored in a table. To add them, the values from + * the table are XOR'd together. + * + * AES also defines addition and multiplication of words, that is 4-byte + * numbers represented as polynomials of 3 degrees where the coefficients + * are the values of the bytes. + * + * The word [a0, a1, a2, a3] is a polynomial a3x^3 + a2x^2 + a1x + a0. + * + * Addition is performed by XOR'ing like powers of x. Multiplication + * is performed in two steps, the first is an algebriac expansion as + * you would do normally (where addition is XOR). But the result is + * a polynomial larger than 3 degrees and thus it cannot fit in a word. So + * next the result is modularly reduced by an AES-specific polynomial of + * degree 4 which will always produce a polynomial of less than 4 degrees + * such that it will fit in a word. In AES, this polynomial is x^4 + 1. + * + * The modular product of two polynomials 'a' and 'b' is thus: + * + * d(x) = d3x^3 + d2x^2 + d1x + d0 + * with + * d0 = GF(a0, b0) ^ GF(a3, b1) ^ GF(a2, b2) ^ GF(a1, b3) + * d1 = GF(a1, b0) ^ GF(a0, b1) ^ GF(a3, b2) ^ GF(a2, b3) + * d2 = GF(a2, b0) ^ GF(a1, b1) ^ GF(a0, b2) ^ GF(a3, b3) + * d3 = GF(a3, b0) ^ GF(a2, b1) ^ GF(a1, b2) ^ GF(a0, b3) + * + * As a matrix: + * + * [d0] = [a0 a3 a2 a1][b0] + * [d1] [a1 a0 a3 a2][b1] + * [d2] [a2 a1 a0 a3][b2] + * [d3] [a3 a2 a1 a0][b3] + * + * Special polynomials defined by AES (0x02 == {02}): + * a(x) = {03}x^3 + {01}x^2 + {01}x + {02} + * a^-1(x) = {0b}x^3 + {0d}x^2 + {09}x + {0e}. + * + * These polynomials are used in the MixColumns() and InverseMixColumns() + * operations, respectively, to cause each element in the state to affect + * the output (referred to as diffusing). + * + * RotWord() uses: a0 = a1 = a2 = {00} and a3 = {01}, which is the + * polynomial x3. + * + * The ShiftRows() method modifies the last 3 rows in the state (where + * the state is 4 words with 4 bytes per word) by shifting bytes cyclically. + * The 1st byte in the second row is moved to the end of the row. The 1st + * and 2nd bytes in the third row are moved to the end of the row. The 1st, + * 2nd, and 3rd bytes are moved in the fourth row. + * + * More details on how AES arithmetic works: + * + * In the polynomial representation of binary numbers, XOR performs addition + * and subtraction and multiplication in GF(2^8) denoted as GF(a, b) + * corresponds with the multiplication of polynomials modulo an irreducible + * polynomial of degree 8. In other words, for AES, GF(a, b) will multiply + * polynomial 'a' with polynomial 'b' and then do a modular reduction by + * an AES-specific irreducible polynomial of degree 8. + * + * A polynomial is irreducible if its only divisors are one and itself. For + * the AES algorithm, this irreducible polynomial is: + * + * m(x) = x^8 + x^4 + x^3 + x + 1, + * + * or {01}{1b} in hexadecimal notation, where each coefficient is a bit: + * 100011011 = 283 = 0x11b. + * + * For example, GF(0x57, 0x83) = 0xc1 because + * + * 0x57 = 87 = 01010111 = x^6 + x^4 + x^2 + x + 1 + * 0x85 = 131 = 10000101 = x^7 + x + 1 + * + * (x^6 + x^4 + x^2 + x + 1) * (x^7 + x + 1) + * = x^13 + x^11 + x^9 + x^8 + x^7 + + * x^7 + x^5 + x^3 + x^2 + x + + * x^6 + x^4 + x^2 + x + 1 + * = x^13 + x^11 + x^9 + x^8 + x^6 + x^5 + x^4 + x^3 + 1 = y + * y modulo (x^8 + x^4 + x^3 + x + 1) + * = x^7 + x^6 + 1. + * + * The modular reduction by m(x) guarantees the result will be a binary + * polynomial of less than degree 8, so that it can fit in a byte. + * + * The operation to multiply a binary polynomial b with x (the polynomial + * x in binary representation is 00000010) is: + * + * b_7x^8 + b_6x^7 + b_5x^6 + b_4x^5 + b_3x^4 + b_2x^3 + b_1x^2 + b_0x^1 + * + * To get GF(b, x) we must reduce that by m(x). If b_7 is 0 (that is the + * most significant bit is 0 in b) then the result is already reduced. If + * it is 1, then we can reduce it by subtracting m(x) via an XOR. + * + * It follows that multiplication by x (00000010 or 0x02) can be implemented + * by performing a left shift followed by a conditional bitwise XOR with + * 0x1b. This operation on bytes is denoted by xtime(). Multiplication by + * higher powers of x can be implemented by repeated application of xtime(). + * + * By adding intermediate results, multiplication by any constant can be + * implemented. For instance: + * + * GF(0x57, 0x13) = 0xfe because: + * + * xtime(b) = (b & 128) ? (b << 1 ^ 0x11b) : (b << 1) + * + * Note: We XOR with 0x11b instead of 0x1b because in javascript our + * datatype for b can be larger than 1 byte, so a left shift will not + * automatically eliminate bits that overflow a byte ... by XOR'ing the + * overflow bit with 1 (the extra one from 0x11b) we zero it out. + * + * GF(0x57, 0x02) = xtime(0x57) = 0xae + * GF(0x57, 0x04) = xtime(0xae) = 0x47 + * GF(0x57, 0x08) = xtime(0x47) = 0x8e + * GF(0x57, 0x10) = xtime(0x8e) = 0x07 + * + * GF(0x57, 0x13) = GF(0x57, (0x01 ^ 0x02 ^ 0x10)) + * + * And by the distributive property (since XOR is addition and GF() is + * multiplication): + * + * = GF(0x57, 0x01) ^ GF(0x57, 0x02) ^ GF(0x57, 0x10) + * = 0x57 ^ 0xae ^ 0x07 + * = 0xfe. + */ +function initialize() { + init = true; + + /* Populate the Rcon table. These are the values given by + [x^(i-1),{00},{00},{00}] where x^(i-1) are powers of x (and x = 0x02) + in the field of GF(2^8), where i starts at 1. + + rcon[0] = [0x00, 0x00, 0x00, 0x00] + rcon[1] = [0x01, 0x00, 0x00, 0x00] 2^(1-1) = 2^0 = 1 + rcon[2] = [0x02, 0x00, 0x00, 0x00] 2^(2-1) = 2^1 = 2 + ... + rcon[9] = [0x1B, 0x00, 0x00, 0x00] 2^(9-1) = 2^8 = 0x1B + rcon[10] = [0x36, 0x00, 0x00, 0x00] 2^(10-1) = 2^9 = 0x36 + + We only store the first byte because it is the only one used. + */ + rcon = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36]; + + // compute xtime table which maps i onto GF(i, 0x02) + var xtime = new Array(256); + for(var i = 0; i < 128; ++i) { + xtime[i] = i << 1; + xtime[i + 128] = (i + 128) << 1 ^ 0x11B; + } + + // compute all other tables + sbox = new Array(256); + isbox = new Array(256); + mix = new Array(4); + imix = new Array(4); + for(var i = 0; i < 4; ++i) { + mix[i] = new Array(256); + imix[i] = new Array(256); + } + var e = 0, ei = 0, e2, e4, e8, sx, sx2, me, ime; + for(var i = 0; i < 256; ++i) { + /* We need to generate the SubBytes() sbox and isbox tables so that + we can perform byte substitutions. This requires us to traverse + all of the elements in GF, find their multiplicative inverses, + and apply to each the following affine transformation: + + bi' = bi ^ b(i + 4) mod 8 ^ b(i + 5) mod 8 ^ b(i + 6) mod 8 ^ + b(i + 7) mod 8 ^ ci + for 0 <= i < 8, where bi is the ith bit of the byte, and ci is the + ith bit of a byte c with the value {63} or {01100011}. + + It is possible to traverse every possible value in a Galois field + using what is referred to as a 'generator'. There are many + generators (128 out of 256): 3,5,6,9,11,82 to name a few. To fully + traverse GF we iterate 255 times, multiplying by our generator + each time. + + On each iteration we can determine the multiplicative inverse for + the current element. + + Suppose there is an element in GF 'e'. For a given generator 'g', + e = g^x. The multiplicative inverse of e is g^(255 - x). It turns + out that if use the inverse of a generator as another generator + it will produce all of the corresponding multiplicative inverses + at the same time. For this reason, we choose 5 as our inverse + generator because it only requires 2 multiplies and 1 add and its + inverse, 82, requires relatively few operations as well. + + In order to apply the affine transformation, the multiplicative + inverse 'ei' of 'e' can be repeatedly XOR'd (4 times) with a + bit-cycling of 'ei'. To do this 'ei' is first stored in 's' and + 'x'. Then 's' is left shifted and the high bit of 's' is made the + low bit. The resulting value is stored in 's'. Then 'x' is XOR'd + with 's' and stored in 'x'. On each subsequent iteration the same + operation is performed. When 4 iterations are complete, 'x' is + XOR'd with 'c' (0x63) and the transformed value is stored in 'x'. + For example: + + s = 01000001 + x = 01000001 + + iteration 1: s = 10000010, x ^= s + iteration 2: s = 00000101, x ^= s + iteration 3: s = 00001010, x ^= s + iteration 4: s = 00010100, x ^= s + x ^= 0x63 + + This can be done with a loop where s = (s << 1) | (s >> 7). However, + it can also be done by using a single 16-bit (in this case 32-bit) + number 'sx'. Since XOR is an associative operation, we can set 'sx' + to 'ei' and then XOR it with 'sx' left-shifted 1,2,3, and 4 times. + The most significant bits will flow into the high 8 bit positions + and be correctly XOR'd with one another. All that remains will be + to cycle the high 8 bits by XOR'ing them all with the lower 8 bits + afterwards. + + At the same time we're populating sbox and isbox we can precompute + the multiplication we'll need to do to do MixColumns() later. + */ + + // apply affine transformation + sx = ei ^ (ei << 1) ^ (ei << 2) ^ (ei << 3) ^ (ei << 4); + sx = (sx >> 8) ^ (sx & 255) ^ 0x63; + + // update tables + sbox[e] = sx; + isbox[sx] = e; + + /* Mixing columns is done using matrix multiplication. The columns + that are to be mixed are each a single word in the current state. + The state has Nb columns (4 columns). Therefore each column is a + 4 byte word. So to mix the columns in a single column 'c' where + its rows are r0, r1, r2, and r3, we use the following matrix + multiplication: + + [2 3 1 1]*[r0,c]=[r'0,c] + [1 2 3 1] [r1,c] [r'1,c] + [1 1 2 3] [r2,c] [r'2,c] + [3 1 1 2] [r3,c] [r'3,c] + + r0, r1, r2, and r3 are each 1 byte of one of the words in the + state (a column). To do matrix multiplication for each mixed + column c' we multiply the corresponding row from the left matrix + with the corresponding column from the right matrix. In total, we + get 4 equations: + + r0,c' = 2*r0,c + 3*r1,c + 1*r2,c + 1*r3,c + r1,c' = 1*r0,c + 2*r1,c + 3*r2,c + 1*r3,c + r2,c' = 1*r0,c + 1*r1,c + 2*r2,c + 3*r3,c + r3,c' = 3*r0,c + 1*r1,c + 1*r2,c + 2*r3,c + + As usual, the multiplication is as previously defined and the + addition is XOR. In order to optimize mixing columns we can store + the multiplication results in tables. If you think of the whole + column as a word (it might help to visualize by mentally rotating + the equations above by counterclockwise 90 degrees) then you can + see that it would be useful to map the multiplications performed on + each byte (r0, r1, r2, r3) onto a word as well. For instance, we + could map 2*r0,1*r0,1*r0,3*r0 onto a word by storing 2*r0 in the + highest 8 bits and 3*r0 in the lowest 8 bits (with the other two + respectively in the middle). This means that a table can be + constructed that uses r0 as an index to the word. We can do the + same with r1, r2, and r3, creating a total of 4 tables. + + To construct a full c', we can just look up each byte of c in + their respective tables and XOR the results together. + + Also, to build each table we only have to calculate the word + for 2,1,1,3 for every byte ... which we can do on each iteration + of this loop since we will iterate over every byte. After we have + calculated 2,1,1,3 we can get the results for the other tables + by cycling the byte at the end to the beginning. For instance + we can take the result of table 2,1,1,3 and produce table 3,2,1,1 + by moving the right most byte to the left most position just like + how you can imagine the 3 moved out of 2,1,1,3 and to the front + to produce 3,2,1,1. + + There is another optimization in that the same multiples of + the current element we need in order to advance our generator + to the next iteration can be reused in performing the 2,1,1,3 + calculation. We also calculate the inverse mix column tables, + with e,9,d,b being the inverse of 2,1,1,3. + + When we're done, and we need to actually mix columns, the first + byte of each state word should be put through mix[0] (2,1,1,3), + the second through mix[1] (3,2,1,1) and so forth. Then they should + be XOR'd together to produce the fully mixed column. + */ + + // calculate mix and imix table values + sx2 = xtime[sx]; + e2 = xtime[e]; + e4 = xtime[e2]; + e8 = xtime[e4]; + me = + (sx2 << 24) ^ // 2 + (sx << 16) ^ // 1 + (sx << 8) ^ // 1 + (sx ^ sx2); // 3 + ime = + (e2 ^ e4 ^ e8) << 24 ^ // E (14) + (e ^ e8) << 16 ^ // 9 + (e ^ e4 ^ e8) << 8 ^ // D (13) + (e ^ e2 ^ e8); // B (11) + // produce each of the mix tables by rotating the 2,1,1,3 value + for(var n = 0; n < 4; ++n) { + mix[n][e] = me; + imix[n][sx] = ime; + // cycle the right most byte to the left most position + // ie: 2,1,1,3 becomes 3,2,1,1 + me = me << 24 | me >>> 8; + ime = ime << 24 | ime >>> 8; + } + + // get next element and inverse + if(e === 0) { + // 1 is the inverse of 1 + e = ei = 1; + } else { + // e = 2e + 2*2*2*(10e)) = multiply e by 82 (chosen generator) + // ei = ei + 2*2*ei = multiply ei by 5 (inverse generator) + e = e2 ^ xtime[xtime[xtime[e2 ^ e8]]]; + ei ^= xtime[xtime[ei]]; + } + } +} + +/** + * Generates a key schedule using the AES key expansion algorithm. + * + * The AES algorithm takes the Cipher Key, K, and performs a Key Expansion + * routine to generate a key schedule. The Key Expansion generates a total + * of Nb*(Nr + 1) words: the algorithm requires an initial set of Nb words, + * and each of the Nr rounds requires Nb words of key data. The resulting + * key schedule consists of a linear array of 4-byte words, denoted [wi ], + * with i in the range 0 <= i < Nb(Nr + 1). + * + * KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk) + * AES-128 (Nb=4, Nk=4, Nr=10) + * AES-192 (Nb=4, Nk=6, Nr=12) + * AES-256 (Nb=4, Nk=8, Nr=14) + * Note: Nr=Nk+6. + * + * Nb is the number of columns (32-bit words) comprising the State (or + * number of bytes in a block). For AES, Nb=4. + * + * @param key the key to schedule (as an array of 32-bit words). + * @param decrypt true to modify the key schedule to decrypt, false not to. + * + * @return the generated key schedule. + */ +function _expandKey(key, decrypt) { + // copy the key's words to initialize the key schedule + var w = key.slice(0); + + /* RotWord() will rotate a word, moving the first byte to the last + byte's position (shifting the other bytes left). + + We will be getting the value of Rcon at i / Nk. 'i' will iterate + from Nk to (Nb * Nr+1). Nk = 4 (4 byte key), Nb = 4 (4 words in + a block), Nr = Nk + 6 (10). Therefore 'i' will iterate from + 4 to 44 (exclusive). Each time we iterate 4 times, i / Nk will + increase by 1. We use a counter iNk to keep track of this. + */ + + // go through the rounds expanding the key + var temp, iNk = 1; + var Nk = w.length; + var Nr1 = Nk + 6 + 1; + var end = Nb * Nr1; + for(var i = Nk; i < end; ++i) { + temp = w[i - 1]; + if(i % Nk === 0) { + // temp = SubWord(RotWord(temp)) ^ Rcon[i / Nk] + temp = + sbox[temp >>> 16 & 255] << 24 ^ + sbox[temp >>> 8 & 255] << 16 ^ + sbox[temp & 255] << 8 ^ + sbox[temp >>> 24] ^ (rcon[iNk] << 24); + iNk++; + } else if(Nk > 6 && (i % Nk === 4)) { + // temp = SubWord(temp) + temp = + sbox[temp >>> 24] << 24 ^ + sbox[temp >>> 16 & 255] << 16 ^ + sbox[temp >>> 8 & 255] << 8 ^ + sbox[temp & 255]; + } + w[i] = w[i - Nk] ^ temp; + } + + /* When we are updating a cipher block we always use the code path for + encryption whether we are decrypting or not (to shorten code and + simplify the generation of look up tables). However, because there + are differences in the decryption algorithm, other than just swapping + in different look up tables, we must transform our key schedule to + account for these changes: + + 1. The decryption algorithm gets its key rounds in reverse order. + 2. The decryption algorithm adds the round key before mixing columns + instead of afterwards. + + We don't need to modify our key schedule to handle the first case, + we can just traverse the key schedule in reverse order when decrypting. + + The second case requires a little work. + + The tables we built for performing rounds will take an input and then + perform SubBytes() and MixColumns() or, for the decrypt version, + InvSubBytes() and InvMixColumns(). But the decrypt algorithm requires + us to AddRoundKey() before InvMixColumns(). This means we'll need to + apply some transformations to the round key to inverse-mix its columns + so they'll be correct for moving AddRoundKey() to after the state has + had its columns inverse-mixed. + + To inverse-mix the columns of the state when we're decrypting we use a + lookup table that will apply InvSubBytes() and InvMixColumns() at the + same time. However, the round key's bytes are not inverse-substituted + in the decryption algorithm. To get around this problem, we can first + substitute the bytes in the round key so that when we apply the + transformation via the InvSubBytes()+InvMixColumns() table, it will + undo our substitution leaving us with the original value that we + want -- and then inverse-mix that value. + + This change will correctly alter our key schedule so that we can XOR + each round key with our already transformed decryption state. This + allows us to use the same code path as the encryption algorithm. + + We make one more change to the decryption key. Since the decryption + algorithm runs in reverse from the encryption algorithm, we reverse + the order of the round keys to avoid having to iterate over the key + schedule backwards when running the encryption algorithm later in + decryption mode. In addition to reversing the order of the round keys, + we also swap each round key's 2nd and 4th rows. See the comments + section where rounds are performed for more details about why this is + done. These changes are done inline with the other substitution + described above. + */ + if(decrypt) { + var tmp; + var m0 = imix[0]; + var m1 = imix[1]; + var m2 = imix[2]; + var m3 = imix[3]; + var wnew = w.slice(0); + end = w.length; + for(var i = 0, wi = end - Nb; i < end; i += Nb, wi -= Nb) { + // do not sub the first or last round key (round keys are Nb + // words) as no column mixing is performed before they are added, + // but do change the key order + if(i === 0 || i === (end - Nb)) { + wnew[i] = w[wi]; + wnew[i + 1] = w[wi + 3]; + wnew[i + 2] = w[wi + 2]; + wnew[i + 3] = w[wi + 1]; + } else { + // substitute each round key byte because the inverse-mix + // table will inverse-substitute it (effectively cancel the + // substitution because round key bytes aren't sub'd in + // decryption mode) and swap indexes 3 and 1 + for(var n = 0; n < Nb; ++n) { + tmp = w[wi + n]; + wnew[i + (3&-n)] = + m0[sbox[tmp >>> 24]] ^ + m1[sbox[tmp >>> 16 & 255]] ^ + m2[sbox[tmp >>> 8 & 255]] ^ + m3[sbox[tmp & 255]]; + } + } + } + w = wnew; + } + + return w; +} + +/** + * Updates a single block (16 bytes) using AES. The update will either + * encrypt or decrypt the block. + * + * @param w the key schedule. + * @param input the input block (an array of 32-bit words). + * @param output the updated output block. + * @param decrypt true to decrypt the block, false to encrypt it. + */ +function _updateBlock(w, input, output, decrypt) { + /* + Cipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)]) + begin + byte state[4,Nb] + state = in + AddRoundKey(state, w[0, Nb-1]) + for round = 1 step 1 to Nr-1 + SubBytes(state) + ShiftRows(state) + MixColumns(state) + AddRoundKey(state, w[round*Nb, (round+1)*Nb-1]) + end for + SubBytes(state) + ShiftRows(state) + AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) + out = state + end + + InvCipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)]) + begin + byte state[4,Nb] + state = in + AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) + for round = Nr-1 step -1 downto 1 + InvShiftRows(state) + InvSubBytes(state) + AddRoundKey(state, w[round*Nb, (round+1)*Nb-1]) + InvMixColumns(state) + end for + InvShiftRows(state) + InvSubBytes(state) + AddRoundKey(state, w[0, Nb-1]) + out = state + end + */ + + // Encrypt: AddRoundKey(state, w[0, Nb-1]) + // Decrypt: AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) + var Nr = w.length / 4 - 1; + var m0, m1, m2, m3, sub; + if(decrypt) { + m0 = imix[0]; + m1 = imix[1]; + m2 = imix[2]; + m3 = imix[3]; + sub = isbox; + } else { + m0 = mix[0]; + m1 = mix[1]; + m2 = mix[2]; + m3 = mix[3]; + sub = sbox; + } + var a, b, c, d, a2, b2, c2; + a = input[0] ^ w[0]; + b = input[decrypt ? 3 : 1] ^ w[1]; + c = input[2] ^ w[2]; + d = input[decrypt ? 1 : 3] ^ w[3]; + var i = 3; + + /* In order to share code we follow the encryption algorithm when both + encrypting and decrypting. To account for the changes required in the + decryption algorithm, we use different lookup tables when decrypting + and use a modified key schedule to account for the difference in the + order of transformations applied when performing rounds. We also get + key rounds in reverse order (relative to encryption). */ + for(var round = 1; round < Nr; ++round) { + /* As described above, we'll be using table lookups to perform the + column mixing. Each column is stored as a word in the state (the + array 'input' has one column as a word at each index). In order to + mix a column, we perform these transformations on each row in c, + which is 1 byte in each word. The new column for c0 is c'0: + + m0 m1 m2 m3 + r0,c'0 = 2*r0,c0 + 3*r1,c0 + 1*r2,c0 + 1*r3,c0 + r1,c'0 = 1*r0,c0 + 2*r1,c0 + 3*r2,c0 + 1*r3,c0 + r2,c'0 = 1*r0,c0 + 1*r1,c0 + 2*r2,c0 + 3*r3,c0 + r3,c'0 = 3*r0,c0 + 1*r1,c0 + 1*r2,c0 + 2*r3,c0 + + So using mix tables where c0 is a word with r0 being its upper + 8 bits and r3 being its lower 8 bits: + + m0[c0 >> 24] will yield this word: [2*r0,1*r0,1*r0,3*r0] + ... + m3[c0 & 255] will yield this word: [1*r3,1*r3,3*r3,2*r3] + + Therefore to mix the columns in each word in the state we + do the following (& 255 omitted for brevity): + c'0,r0 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] + c'0,r1 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] + c'0,r2 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] + c'0,r3 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] + + However, before mixing, the algorithm requires us to perform + ShiftRows(). The ShiftRows() transformation cyclically shifts the + last 3 rows of the state over different offsets. The first row + (r = 0) is not shifted. + + s'_r,c = s_r,(c + shift(r, Nb) mod Nb + for 0 < r < 4 and 0 <= c < Nb and + shift(1, 4) = 1 + shift(2, 4) = 2 + shift(3, 4) = 3. + + This causes the first byte in r = 1 to be moved to the end of + the row, the first 2 bytes in r = 2 to be moved to the end of + the row, the first 3 bytes in r = 3 to be moved to the end of + the row: + + r1: [c0 c1 c2 c3] => [c1 c2 c3 c0] + r2: [c0 c1 c2 c3] [c2 c3 c0 c1] + r3: [c0 c1 c2 c3] [c3 c0 c1 c2] + + We can make these substitutions inline with our column mixing to + generate an updated set of equations to produce each word in the + state (note the columns have changed positions): + + c0 c1 c2 c3 => c0 c1 c2 c3 + c0 c1 c2 c3 c1 c2 c3 c0 (cycled 1 byte) + c0 c1 c2 c3 c2 c3 c0 c1 (cycled 2 bytes) + c0 c1 c2 c3 c3 c0 c1 c2 (cycled 3 bytes) + + Therefore: + + c'0 = 2*r0,c0 + 3*r1,c1 + 1*r2,c2 + 1*r3,c3 + c'0 = 1*r0,c0 + 2*r1,c1 + 3*r2,c2 + 1*r3,c3 + c'0 = 1*r0,c0 + 1*r1,c1 + 2*r2,c2 + 3*r3,c3 + c'0 = 3*r0,c0 + 1*r1,c1 + 1*r2,c2 + 2*r3,c3 + + c'1 = 2*r0,c1 + 3*r1,c2 + 1*r2,c3 + 1*r3,c0 + c'1 = 1*r0,c1 + 2*r1,c2 + 3*r2,c3 + 1*r3,c0 + c'1 = 1*r0,c1 + 1*r1,c2 + 2*r2,c3 + 3*r3,c0 + c'1 = 3*r0,c1 + 1*r1,c2 + 1*r2,c3 + 2*r3,c0 + + ... and so forth for c'2 and c'3. The important distinction is + that the columns are cycling, with c0 being used with the m0 + map when calculating c0, but c1 being used with the m0 map when + calculating c1 ... and so forth. + + When performing the inverse we transform the mirror image and + skip the bottom row, instead of the top one, and move upwards: + + c3 c2 c1 c0 => c0 c3 c2 c1 (cycled 3 bytes) *same as encryption + c3 c2 c1 c0 c1 c0 c3 c2 (cycled 2 bytes) + c3 c2 c1 c0 c2 c1 c0 c3 (cycled 1 byte) *same as encryption + c3 c2 c1 c0 c3 c2 c1 c0 + + If you compare the resulting matrices for ShiftRows()+MixColumns() + and for InvShiftRows()+InvMixColumns() the 2nd and 4th columns are + different (in encrypt mode vs. decrypt mode). So in order to use + the same code to handle both encryption and decryption, we will + need to do some mapping. + + If in encryption mode we let a=c0, b=c1, c=c2, d=c3, and r be + a row number in the state, then the resulting matrix in encryption + mode for applying the above transformations would be: + + r1: a b c d + r2: b c d a + r3: c d a b + r4: d a b c + + If we did the same in decryption mode we would get: + + r1: a d c b + r2: b a d c + r3: c b a d + r4: d c b a + + If instead we swap d and b (set b=c3 and d=c1), then we get: + + r1: a b c d + r2: d a b c + r3: c d a b + r4: b c d a + + Now the 1st and 3rd rows are the same as the encryption matrix. All + we need to do then to make the mapping exactly the same is to swap + the 2nd and 4th rows when in decryption mode. To do this without + having to do it on each iteration, we swapped the 2nd and 4th rows + in the decryption key schedule. We also have to do the swap above + when we first pull in the input and when we set the final output. */ + a2 = + m0[a >>> 24] ^ + m1[b >>> 16 & 255] ^ + m2[c >>> 8 & 255] ^ + m3[d & 255] ^ w[++i]; + b2 = + m0[b >>> 24] ^ + m1[c >>> 16 & 255] ^ + m2[d >>> 8 & 255] ^ + m3[a & 255] ^ w[++i]; + c2 = + m0[c >>> 24] ^ + m1[d >>> 16 & 255] ^ + m2[a >>> 8 & 255] ^ + m3[b & 255] ^ w[++i]; + d = + m0[d >>> 24] ^ + m1[a >>> 16 & 255] ^ + m2[b >>> 8 & 255] ^ + m3[c & 255] ^ w[++i]; + a = a2; + b = b2; + c = c2; + } + + /* + Encrypt: + SubBytes(state) + ShiftRows(state) + AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) + + Decrypt: + InvShiftRows(state) + InvSubBytes(state) + AddRoundKey(state, w[0, Nb-1]) + */ + // Note: rows are shifted inline + output[0] = + (sub[a >>> 24] << 24) ^ + (sub[b >>> 16 & 255] << 16) ^ + (sub[c >>> 8 & 255] << 8) ^ + (sub[d & 255]) ^ w[++i]; + output[decrypt ? 3 : 1] = + (sub[b >>> 24] << 24) ^ + (sub[c >>> 16 & 255] << 16) ^ + (sub[d >>> 8 & 255] << 8) ^ + (sub[a & 255]) ^ w[++i]; + output[2] = + (sub[c >>> 24] << 24) ^ + (sub[d >>> 16 & 255] << 16) ^ + (sub[a >>> 8 & 255] << 8) ^ + (sub[b & 255]) ^ w[++i]; + output[decrypt ? 1 : 3] = + (sub[d >>> 24] << 24) ^ + (sub[a >>> 16 & 255] << 16) ^ + (sub[b >>> 8 & 255] << 8) ^ + (sub[c & 255]) ^ w[++i]; +} + +/** + * Deprecated. Instead, use: + * + * forge.cipher.createCipher('AES-', key); + * forge.cipher.createDecipher('AES-', key); + * + * Creates a deprecated AES cipher object. This object's mode will default to + * CBC (cipher-block-chaining). + * + * The key and iv may be given as a string of bytes, an array of bytes, a + * byte buffer, or an array of 32-bit words. + * + * @param options the options to use. + * key the symmetric key to use. + * output the buffer to write to. + * decrypt true for decryption, false for encryption. + * mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +function _createCipher(options) { + options = options || {}; + var mode = (options.mode || 'CBC').toUpperCase(); + var algorithm = 'AES-' + mode; + + var cipher; + if(options.decrypt) { + cipher = forge.cipher.createDecipher(algorithm, options.key); + } else { + cipher = forge.cipher.createCipher(algorithm, options.key); + } + + // backwards compatible start API + var start = cipher.start; + cipher.start = function(iv, options) { + // backwards compatibility: support second arg as output buffer + var output = null; + if(options instanceof forge.util.ByteBuffer) { + output = options; + options = {}; + } + options = options || {}; + options.output = output; + options.iv = iv; + start.call(cipher, options); + }; + + return cipher; +} + + +/***/ }), + +/***/ 6164: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("var inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar SHA512 = __webpack_require__(/*! ./sha512 */ \"./node_modules/sha.js/sha512.js\")\nvar Hash = __webpack_require__(/*! ./hash */ \"./node_modules/sha.js/hash.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar W = new Array(160)\n\nfunction Sha384 () {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha384, SHA512)\n\nSha384.prototype.init = function () {\n this._ah = 0xcbbb9d5d\n this._bh = 0x629a292a\n this._ch = 0x9159015a\n this._dh = 0x152fecd8\n this._eh = 0x67332667\n this._fh = 0x8eb44a87\n this._gh = 0xdb0c2e0d\n this._hh = 0x47b5481d\n\n this._al = 0xc1059ed8\n this._bl = 0x367cd507\n this._cl = 0x3070dd17\n this._dl = 0xf70e5939\n this._el = 0xffc00b31\n this._fl = 0x68581511\n this._gl = 0x64f98fa7\n this._hl = 0xbefa4fa4\n\n return this\n}\n\nSha384.prototype._hash = function () {\n var H = Buffer.allocUnsafe(48)\n\n function writeInt64BE (h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._ah, this._al, 0)\n writeInt64BE(this._bh, this._bl, 8)\n writeInt64BE(this._ch, this._cl, 16)\n writeInt64BE(this._dh, this._dl, 24)\n writeInt64BE(this._eh, this._el, 32)\n writeInt64BE(this._fh, this._fl, 40)\n\n return H\n}\n\nmodule.exports = Sha384\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/sha384.js?"); +/** + * A Javascript implementation of AES Cipher Suites for TLS. + * + * @author Dave Longley + * + * Copyright (c) 2009-2015 Digital Bazaar, Inc. + * + */ +var forge = __webpack_require__(3832); +__webpack_require__(8925); +__webpack_require__(4311); -/***/ }), +var tls = module.exports = forge.tls; -/***/ "./node_modules/sha.js/sha512.js": -/*!***************************************!*\ - !*** ./node_modules/sha.js/sha512.js ***! - \***************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * Supported cipher suites. + */ +tls.CipherSuites['TLS_RSA_WITH_AES_128_CBC_SHA'] = { + id: [0x00, 0x2f], + name: 'TLS_RSA_WITH_AES_128_CBC_SHA', + initSecurityParameters: function(sp) { + sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes; + sp.cipher_type = tls.CipherType.block; + sp.enc_key_length = 16; + sp.block_length = 16; + sp.fixed_iv_length = 16; + sp.record_iv_length = 16; + sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1; + sp.mac_length = 20; + sp.mac_key_length = 20; + }, + initConnectionState: initConnectionState +}; +tls.CipherSuites['TLS_RSA_WITH_AES_256_CBC_SHA'] = { + id: [0x00, 0x35], + name: 'TLS_RSA_WITH_AES_256_CBC_SHA', + initSecurityParameters: function(sp) { + sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes; + sp.cipher_type = tls.CipherType.block; + sp.enc_key_length = 32; + sp.block_length = 16; + sp.fixed_iv_length = 16; + sp.record_iv_length = 16; + sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1; + sp.mac_length = 20; + sp.mac_key_length = 20; + }, + initConnectionState: initConnectionState +}; + +function initConnectionState(state, c, sp) { + var client = (c.entity === forge.tls.ConnectionEnd.client); + + // cipher setup + state.read.cipherState = { + init: false, + cipher: forge.cipher.createDecipher('AES-CBC', client ? + sp.keys.server_write_key : sp.keys.client_write_key), + iv: client ? sp.keys.server_write_IV : sp.keys.client_write_IV + }; + state.write.cipherState = { + init: false, + cipher: forge.cipher.createCipher('AES-CBC', client ? + sp.keys.client_write_key : sp.keys.server_write_key), + iv: client ? sp.keys.client_write_IV : sp.keys.server_write_IV + }; + state.read.cipherFunction = decrypt_aes_cbc_sha1; + state.write.cipherFunction = encrypt_aes_cbc_sha1; + + // MAC setup + state.read.macLength = state.write.macLength = sp.mac_length; + state.read.macFunction = state.write.macFunction = tls.hmac_sha1; +} + +/** + * Encrypts the TLSCompressed record into a TLSCipherText record using AES + * in CBC mode. + * + * @param record the TLSCompressed record to encrypt. + * @param s the ConnectionState to use. + * + * @return true on success, false on failure. + */ +function encrypt_aes_cbc_sha1(record, s) { + var rval = false; + + // append MAC to fragment, update sequence number + var mac = s.macFunction(s.macKey, s.sequenceNumber, record); + record.fragment.putBytes(mac); + s.updateSequenceNumber(); + + // TLS 1.1+ use an explicit IV every time to protect against CBC attacks + var iv; + if(record.version.minor === tls.Versions.TLS_1_0.minor) { + // use the pre-generated IV when initializing for TLS 1.0, otherwise use + // the residue from the previous encryption + iv = s.cipherState.init ? null : s.cipherState.iv; + } else { + iv = forge.random.getBytesSync(16); + } + + s.cipherState.init = true; + + // start cipher + var cipher = s.cipherState.cipher; + cipher.start({iv: iv}); + + // TLS 1.1+ write IV into output + if(record.version.minor >= tls.Versions.TLS_1_1.minor) { + cipher.output.putBytes(iv); + } + + // do encryption (default padding is appropriate) + cipher.update(record.fragment); + if(cipher.finish(encrypt_aes_cbc_sha1_padding)) { + // set record fragment to encrypted output + record.fragment = cipher.output; + record.length = record.fragment.length(); + rval = true; + } + + return rval; +} + +/** + * Handles padding for aes_cbc_sha1 in encrypt mode. + * + * @param blockSize the block size. + * @param input the input buffer. + * @param decrypt true in decrypt mode, false in encrypt mode. + * + * @return true on success, false on failure. + */ +function encrypt_aes_cbc_sha1_padding(blockSize, input, decrypt) { + /* The encrypted data length (TLSCiphertext.length) is one more than the sum + of SecurityParameters.block_length, TLSCompressed.length, + SecurityParameters.mac_length, and padding_length. + + The padding may be any length up to 255 bytes long, as long as it results in + the TLSCiphertext.length being an integral multiple of the block length. + Lengths longer than necessary might be desirable to frustrate attacks on a + protocol based on analysis of the lengths of exchanged messages. Each uint8 + in the padding data vector must be filled with the padding length value. + + The padding length should be such that the total size of the + GenericBlockCipher structure is a multiple of the cipher's block length. + Legal values range from zero to 255, inclusive. This length specifies the + length of the padding field exclusive of the padding_length field itself. + + This is slightly different from PKCS#7 because the padding value is 1 + less than the actual number of padding bytes if you include the + padding_length uint8 itself as a padding byte. */ + if(!decrypt) { + // get the number of padding bytes required to reach the blockSize and + // subtract 1 for the padding value (to make room for the padding_length + // uint8) + var padding = blockSize - (input.length() % blockSize); + input.fillWithByte(padding - 1, padding); + } + return true; +} + +/** + * Handles padding for aes_cbc_sha1 in decrypt mode. + * + * @param blockSize the block size. + * @param output the output buffer. + * @param decrypt true in decrypt mode, false in encrypt mode. + * + * @return true on success, false on failure. + */ +function decrypt_aes_cbc_sha1_padding(blockSize, output, decrypt) { + var rval = true; + if(decrypt) { + /* The last byte in the output specifies the number of padding bytes not + including itself. Each of the padding bytes has the same value as that + last byte (known as the padding_length). Here we check all padding + bytes to ensure they have the value of padding_length even if one of + them is bad in order to ward-off timing attacks. */ + var len = output.length(); + var paddingLength = output.last(); + for(var i = len - 1 - paddingLength; i < len - 1; ++i) { + rval = rval && (output.at(i) == paddingLength); + } + if(rval) { + // trim off padding bytes and last padding length byte + output.truncate(paddingLength + 1); + } + } + return rval; +} + +/** + * Decrypts a TLSCipherText record into a TLSCompressed record using + * AES in CBC mode. + * + * @param record the TLSCipherText record to decrypt. + * @param s the ConnectionState to use. + * + * @return true on success, false on failure. + */ +function decrypt_aes_cbc_sha1(record, s) { + var rval = false; + + var iv; + if(record.version.minor === tls.Versions.TLS_1_0.minor) { + // use pre-generated IV when initializing for TLS 1.0, otherwise use the + // residue from the previous decryption + iv = s.cipherState.init ? null : s.cipherState.iv; + } else { + // TLS 1.1+ use an explicit IV every time to protect against CBC attacks + // that is appended to the record fragment + iv = record.fragment.getBytes(16); + } + + s.cipherState.init = true; + + // start cipher + var cipher = s.cipherState.cipher; + cipher.start({iv: iv}); + + // do decryption + cipher.update(record.fragment); + rval = cipher.finish(decrypt_aes_cbc_sha1_padding); + + // even if decryption fails, keep going to minimize timing attacks + + // decrypted data: + // first (len - 20) bytes = application data + // last 20 bytes = MAC + var macLen = s.macLength; + + // create a random MAC to check against should the mac length check fail + // Note: do this regardless of the failure to keep timing consistent + var mac = forge.random.getBytesSync(macLen); + + // get fragment and mac + var len = cipher.output.length(); + if(len >= macLen) { + record.fragment = cipher.output.getBytes(len - macLen); + mac = cipher.output.getBytes(macLen); + } else { + // bad data, but get bytes anyway to try to keep timing consistent + record.fragment = cipher.output.getBytes(); + } + record.fragment = forge.util.createBuffer(record.fragment); + record.length = record.fragment.length(); + + // see if data integrity checks out, update sequence number + var mac2 = s.macFunction(s.macKey, s.sequenceNumber, record); + s.updateSequenceNumber(); + rval = compareMacs(s.macKey, mac, mac2) && rval; + return rval; +} + +/** + * Safely compare two MACs. This function will compare two MACs in a way + * that protects against timing attacks. + * + * TODO: Expose elsewhere as a utility API. + * + * See: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/february/double-hmac-verification/ + * + * @param key the MAC key to use. + * @param mac1 as a binary-encoded string of bytes. + * @param mac2 as a binary-encoded string of bytes. + * + * @return true if the MACs are the same, false if not. + */ +function compareMacs(key, mac1, mac2) { + var hmac = forge.hmac.create(); -eval("var inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nvar Hash = __webpack_require__(/*! ./hash */ \"./node_modules/sha.js/hash.js\")\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer)\n\nvar K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n]\n\nvar W = new Array(160)\n\nfunction Sha512 () {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha512, Hash)\n\nSha512.prototype.init = function () {\n this._ah = 0x6a09e667\n this._bh = 0xbb67ae85\n this._ch = 0x3c6ef372\n this._dh = 0xa54ff53a\n this._eh = 0x510e527f\n this._fh = 0x9b05688c\n this._gh = 0x1f83d9ab\n this._hh = 0x5be0cd19\n\n this._al = 0xf3bcc908\n this._bl = 0x84caa73b\n this._cl = 0xfe94f82b\n this._dl = 0x5f1d36f1\n this._el = 0xade682d1\n this._fl = 0x2b3e6c1f\n this._gl = 0xfb41bd6b\n this._hl = 0x137e2179\n\n return this\n}\n\nfunction Ch (x, y, z) {\n return z ^ (x & (y ^ z))\n}\n\nfunction maj (x, y, z) {\n return (x & y) | (z & (x | y))\n}\n\nfunction sigma0 (x, xl) {\n return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)\n}\n\nfunction sigma1 (x, xl) {\n return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)\n}\n\nfunction Gamma0 (x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)\n}\n\nfunction Gamma0l (x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)\n}\n\nfunction Gamma1 (x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)\n}\n\nfunction Gamma1l (x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)\n}\n\nfunction getCarry (a, b) {\n return (a >>> 0) < (b >>> 0) ? 1 : 0\n}\n\nSha512.prototype._update = function (M) {\n var W = this._w\n\n var ah = this._ah | 0\n var bh = this._bh | 0\n var ch = this._ch | 0\n var dh = this._dh | 0\n var eh = this._eh | 0\n var fh = this._fh | 0\n var gh = this._gh | 0\n var hh = this._hh | 0\n\n var al = this._al | 0\n var bl = this._bl | 0\n var cl = this._cl | 0\n var dl = this._dl | 0\n var el = this._el | 0\n var fl = this._fl | 0\n var gl = this._gl | 0\n var hl = this._hl | 0\n\n for (var i = 0; i < 32; i += 2) {\n W[i] = M.readInt32BE(i * 4)\n W[i + 1] = M.readInt32BE(i * 4 + 4)\n }\n for (; i < 160; i += 2) {\n var xh = W[i - 15 * 2]\n var xl = W[i - 15 * 2 + 1]\n var gamma0 = Gamma0(xh, xl)\n var gamma0l = Gamma0l(xl, xh)\n\n xh = W[i - 2 * 2]\n xl = W[i - 2 * 2 + 1]\n var gamma1 = Gamma1(xh, xl)\n var gamma1l = Gamma1l(xl, xh)\n\n // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n var Wi7h = W[i - 7 * 2]\n var Wi7l = W[i - 7 * 2 + 1]\n\n var Wi16h = W[i - 16 * 2]\n var Wi16l = W[i - 16 * 2 + 1]\n\n var Wil = (gamma0l + Wi7l) | 0\n var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0\n Wil = (Wil + gamma1l) | 0\n Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0\n Wil = (Wil + Wi16l) | 0\n Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0\n\n W[i] = Wih\n W[i + 1] = Wil\n }\n\n for (var j = 0; j < 160; j += 2) {\n Wih = W[j]\n Wil = W[j + 1]\n\n var majh = maj(ah, bh, ch)\n var majl = maj(al, bl, cl)\n\n var sigma0h = sigma0(ah, al)\n var sigma0l = sigma0(al, ah)\n var sigma1h = sigma1(eh, el)\n var sigma1l = sigma1(el, eh)\n\n // t1 = h + sigma1 + ch + K[j] + W[j]\n var Kih = K[j]\n var Kil = K[j + 1]\n\n var chh = Ch(eh, fh, gh)\n var chl = Ch(el, fl, gl)\n\n var t1l = (hl + sigma1l) | 0\n var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0\n t1l = (t1l + chl) | 0\n t1h = (t1h + chh + getCarry(t1l, chl)) | 0\n t1l = (t1l + Kil) | 0\n t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0\n t1l = (t1l + Wil) | 0\n t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0\n\n // t2 = sigma0 + maj\n var t2l = (sigma0l + majl) | 0\n var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0\n\n hh = gh\n hl = gl\n gh = fh\n gl = fl\n fh = eh\n fl = el\n el = (dl + t1l) | 0\n eh = (dh + t1h + getCarry(el, dl)) | 0\n dh = ch\n dl = cl\n ch = bh\n cl = bl\n bh = ah\n bl = al\n al = (t1l + t2l) | 0\n ah = (t1h + t2h + getCarry(al, t1l)) | 0\n }\n\n this._al = (this._al + al) | 0\n this._bl = (this._bl + bl) | 0\n this._cl = (this._cl + cl) | 0\n this._dl = (this._dl + dl) | 0\n this._el = (this._el + el) | 0\n this._fl = (this._fl + fl) | 0\n this._gl = (this._gl + gl) | 0\n this._hl = (this._hl + hl) | 0\n\n this._ah = (this._ah + ah + getCarry(this._al, al)) | 0\n this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0\n this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0\n this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0\n this._eh = (this._eh + eh + getCarry(this._el, el)) | 0\n this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0\n this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0\n this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0\n}\n\nSha512.prototype._hash = function () {\n var H = Buffer.allocUnsafe(64)\n\n function writeInt64BE (h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._ah, this._al, 0)\n writeInt64BE(this._bh, this._bl, 8)\n writeInt64BE(this._ch, this._cl, 16)\n writeInt64BE(this._dh, this._dl, 24)\n writeInt64BE(this._eh, this._el, 32)\n writeInt64BE(this._fh, this._fl, 40)\n writeInt64BE(this._gh, this._gl, 48)\n writeInt64BE(this._hh, this._hl, 56)\n\n return H\n}\n\nmodule.exports = Sha512\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/sha.js/sha512.js?"); + hmac.start('SHA1', key); + hmac.update(mac1); + mac1 = hmac.digest().getBytes(); -/***/ }), + hmac.start(null, null); + hmac.update(mac2); + mac2 = hmac.digest().getBytes(); -/***/ "./node_modules/stream-browserify/index.js": -/*!*************************************************!*\ - !*** ./node_modules/stream-browserify/index.js ***! - \*************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + return mac1 === mac2; +} -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = (__webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter);\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\ninherits(Stream, EE);\nStream.Readable = __webpack_require__(/*! readable-stream/lib/_stream_readable.js */ \"./node_modules/readable-stream/lib/_stream_readable.js\");\nStream.Writable = __webpack_require__(/*! readable-stream/lib/_stream_writable.js */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\nStream.Duplex = __webpack_require__(/*! readable-stream/lib/_stream_duplex.js */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\nStream.Transform = __webpack_require__(/*! readable-stream/lib/_stream_transform.js */ \"./node_modules/readable-stream/lib/_stream_transform.js\");\nStream.PassThrough = __webpack_require__(/*! readable-stream/lib/_stream_passthrough.js */ \"./node_modules/readable-stream/lib/_stream_passthrough.js\");\nStream.finished = __webpack_require__(/*! readable-stream/lib/internal/streams/end-of-stream.js */ \"./node_modules/readable-stream/lib/internal/streams/end-of-stream.js\")\nStream.pipeline = __webpack_require__(/*! readable-stream/lib/internal/streams/pipeline.js */ \"./node_modules/readable-stream/lib/internal/streams/pipeline.js\")\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/stream-browserify/index.js?"); /***/ }), -/***/ "./node_modules/string_decoder/lib/string_decoder.js": -/*!***********************************************************!*\ - !*** ./node_modules/string_decoder/lib/string_decoder.js ***! - \***********************************************************/ +/***/ 9205: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -"use strict"; -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n/**/\n\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer);\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n 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':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/string_decoder/lib/string_decoder.js?"); - -/***/ }), +/** + * Copyright (c) 2019 Digital Bazaar, Inc. + */ -/***/ "./node_modules/text-encoding/index.js": -/*!*********************************************!*\ - !*** ./node_modules/text-encoding/index.js ***! - \*********************************************/ +var forge = __webpack_require__(3832); +__webpack_require__(3068); +var asn1 = forge.asn1; + +exports.privateKeyValidator = { + // PrivateKeyInfo + name: 'PrivateKeyInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + // Version (INTEGER) + name: 'PrivateKeyInfo.version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyVersion' + }, { + // privateKeyAlgorithm + name: 'PrivateKeyInfo.privateKeyAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'AlgorithmIdentifier.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'privateKeyOid' + }] + }, { + // PrivateKey + name: 'PrivateKeyInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'privateKey' + }] +}; + +exports.publicKeyValidator = { + name: 'SubjectPublicKeyInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'subjectPublicKeyInfo', + value: [{ + name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'AlgorithmIdentifier.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'publicKeyOid' + }] + }, + // capture group for ed25519PublicKey + { + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.BITSTRING, + constructed: false, + composed: true, + captureBitStringValue: 'ed25519PublicKey' + } + // FIXME: this is capture group for rsaPublicKey, use it in this API or + // discard? + /* { + // subjectPublicKey + name: 'SubjectPublicKeyInfo.subjectPublicKey', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.BITSTRING, + constructed: false, + value: [{ + // RSAPublicKey + name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + optional: true, + captureAsn1: 'rsaPublicKey' + }] + } */ + ] +}; + + +/***/ }), + +/***/ 3068: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("// This is free and unencumbered software released into the public domain.\n// See LICENSE.md for more information.\n\nvar encoding = __webpack_require__(/*! ./lib/encoding.js */ \"./node_modules/text-encoding/lib/encoding.js\");\n\nmodule.exports = {\n TextEncoder: encoding.TextEncoder,\n TextDecoder: encoding.TextDecoder,\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/text-encoding/index.js?"); +/** + * Javascript implementation of Abstract Syntax Notation Number One. + * + * @author Dave Longley + * + * Copyright (c) 2010-2015 Digital Bazaar, Inc. + * + * An API for storing data using the Abstract Syntax Notation Number One + * format using DER (Distinguished Encoding Rules) encoding. This encoding is + * commonly used to store data for PKI, i.e. X.509 Certificates, and this + * implementation exists for that purpose. + * + * Abstract Syntax Notation Number One (ASN.1) is used to define the abstract + * syntax of information without restricting the way the information is encoded + * for transmission. It provides a standard that allows for open systems + * communication. ASN.1 defines the syntax of information data and a number of + * simple data types as well as a notation for describing them and specifying + * values for them. + * + * The RSA algorithm creates public and private keys that are often stored in + * X.509 or PKCS#X formats -- which use ASN.1 (encoded in DER format). This + * class provides the most basic functionality required to store and load DSA + * keys that are encoded according to ASN.1. + * + * The most common binary encodings for ASN.1 are BER (Basic Encoding Rules) + * and DER (Distinguished Encoding Rules). DER is just a subset of BER that + * has stricter requirements for how data must be encoded. + * + * Each ASN.1 structure has a tag (a byte identifying the ASN.1 structure type) + * and a byte array for the value of this ASN1 structure which may be data or a + * list of ASN.1 structures. + * + * Each ASN.1 structure using BER is (Tag-Length-Value): + * + * | byte 0 | bytes X | bytes Y | + * |--------|---------|---------- + * | tag | length | value | + * + * ASN.1 allows for tags to be of "High-tag-number form" which allows a tag to + * be two or more octets, but that is not supported by this class. A tag is + * only 1 byte. Bits 1-5 give the tag number (ie the data type within a + * particular 'class'), 6 indicates whether or not the ASN.1 value is + * constructed from other ASN.1 values, and bits 7 and 8 give the 'class'. If + * bits 7 and 8 are both zero, the class is UNIVERSAL. If only bit 7 is set, + * then the class is APPLICATION. If only bit 8 is set, then the class is + * CONTEXT_SPECIFIC. If both bits 7 and 8 are set, then the class is PRIVATE. + * The tag numbers for the data types for the class UNIVERSAL are listed below: + * + * UNIVERSAL 0 Reserved for use by the encoding rules + * UNIVERSAL 1 Boolean type + * UNIVERSAL 2 Integer type + * UNIVERSAL 3 Bitstring type + * UNIVERSAL 4 Octetstring type + * UNIVERSAL 5 Null type + * UNIVERSAL 6 Object identifier type + * UNIVERSAL 7 Object descriptor type + * UNIVERSAL 8 External type and Instance-of type + * UNIVERSAL 9 Real type + * UNIVERSAL 10 Enumerated type + * UNIVERSAL 11 Embedded-pdv type + * UNIVERSAL 12 UTF8String type + * UNIVERSAL 13 Relative object identifier type + * UNIVERSAL 14-15 Reserved for future editions + * UNIVERSAL 16 Sequence and Sequence-of types + * UNIVERSAL 17 Set and Set-of types + * UNIVERSAL 18-22, 25-30 Character string types + * UNIVERSAL 23-24 Time types + * + * The length of an ASN.1 structure is specified after the tag identifier. + * There is a definite form and an indefinite form. The indefinite form may + * be used if the encoding is constructed and not all immediately available. + * The indefinite form is encoded using a length byte with only the 8th bit + * set. The end of the constructed object is marked using end-of-contents + * octets (two zero bytes). + * + * The definite form looks like this: + * + * The length may take up 1 or more bytes, it depends on the length of the + * value of the ASN.1 structure. DER encoding requires that if the ASN.1 + * structure has a value that has a length greater than 127, more than 1 byte + * will be used to store its length, otherwise just one byte will be used. + * This is strict. + * + * In the case that the length of the ASN.1 value is less than 127, 1 octet + * (byte) is used to store the "short form" length. The 8th bit has a value of + * 0 indicating the length is "short form" and not "long form" and bits 7-1 + * give the length of the data. (The 8th bit is the left-most, most significant + * bit: also known as big endian or network format). + * + * In the case that the length of the ASN.1 value is greater than 127, 2 to + * 127 octets (bytes) are used to store the "long form" length. The first + * byte's 8th bit is set to 1 to indicate the length is "long form." Bits 7-1 + * give the number of additional octets. All following octets are in base 256 + * with the most significant digit first (typical big-endian binary unsigned + * integer storage). So, for instance, if the length of a value was 257, the + * first byte would be set to: + * + * 10000010 = 130 = 0x82. + * + * This indicates there are 2 octets (base 256) for the length. The second and + * third bytes (the octets just mentioned) would store the length in base 256: + * + * octet 2: 00000001 = 1 * 256^1 = 256 + * octet 3: 00000001 = 1 * 256^0 = 1 + * total = 257 + * + * The algorithm for converting a js integer value of 257 to base-256 is: + * + * var value = 257; + * var bytes = []; + * bytes[0] = (value >>> 8) & 0xFF; // most significant byte first + * bytes[1] = value & 0xFF; // least significant byte last + * + * On the ASN.1 UNIVERSAL Object Identifier (OID) type: + * + * An OID can be written like: "value1.value2.value3...valueN" + * + * The DER encoding rules: + * + * The first byte has the value 40 * value1 + value2. + * The following bytes, if any, encode the remaining values. Each value is + * encoded in base 128, most significant digit first (big endian), with as + * few digits as possible, and the most significant bit of each byte set + * to 1 except the last in each value's encoding. For example: Given the + * OID "1.2.840.113549", its DER encoding is (remember each byte except the + * last one in each encoding is OR'd with 0x80): + * + * byte 1: 40 * 1 + 2 = 42 = 0x2A. + * bytes 2-3: 128 * 6 + 72 = 840 = 6 72 = 6 72 = 0x0648 = 0x8648 + * bytes 4-6: 16384 * 6 + 128 * 119 + 13 = 6 119 13 = 0x06770D = 0x86F70D + * + * The final value is: 0x2A864886F70D. + * The full OID (including ASN.1 tag and length of 6 bytes) is: + * 0x06062A864886F70D + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); +__webpack_require__(6270); + +/* ASN.1 API */ +var asn1 = module.exports = forge.asn1 = forge.asn1 || {}; + +/** + * ASN.1 classes. + */ +asn1.Class = { + UNIVERSAL: 0x00, + APPLICATION: 0x40, + CONTEXT_SPECIFIC: 0x80, + PRIVATE: 0xC0 +}; + +/** + * ASN.1 types. Not all types are supported by this implementation, only + * those necessary to implement a simple PKI are implemented. + */ +asn1.Type = { + NONE: 0, + BOOLEAN: 1, + INTEGER: 2, + BITSTRING: 3, + OCTETSTRING: 4, + NULL: 5, + OID: 6, + ODESC: 7, + EXTERNAL: 8, + REAL: 9, + ENUMERATED: 10, + EMBEDDED: 11, + UTF8: 12, + ROID: 13, + SEQUENCE: 16, + SET: 17, + PRINTABLESTRING: 19, + IA5STRING: 22, + UTCTIME: 23, + GENERALIZEDTIME: 24, + BMPSTRING: 30 +}; + +/** + * Creates a new asn1 object. + * + * @param tagClass the tag class for the object. + * @param type the data type (tag number) for the object. + * @param constructed true if the asn1 object is in constructed form. + * @param value the value for the object, if it is not constructed. + * @param [options] the options to use: + * [bitStringContents] the plain BIT STRING content including padding + * byte. + * + * @return the asn1 object. + */ +asn1.create = function(tagClass, type, constructed, value, options) { + /* An asn1 object has a tagClass, a type, a constructed flag, and a + value. The value's type depends on the constructed flag. If + constructed, it will contain a list of other asn1 objects. If not, + it will contain the ASN.1 value as an array of bytes formatted + according to the ASN.1 data type. */ + + // remove undefined values + if(forge.util.isArray(value)) { + var tmp = []; + for(var i = 0; i < value.length; ++i) { + if(value[i] !== undefined) { + tmp.push(value[i]); + } + } + value = tmp; + } + + var obj = { + tagClass: tagClass, + type: type, + constructed: constructed, + composed: constructed || forge.util.isArray(value), + value: value + }; + if(options && 'bitStringContents' in options) { + // TODO: copy byte buffer if it's a buffer not a string + obj.bitStringContents = options.bitStringContents; + // TODO: add readonly flag to avoid this overhead + // save copy to detect changes + obj.original = asn1.copy(obj); + } + return obj; +}; + +/** + * Copies an asn1 object. + * + * @param obj the asn1 object. + * @param [options] copy options: + * [excludeBitStringContents] true to not copy bitStringContents + * + * @return the a copy of the asn1 object. + */ +asn1.copy = function(obj, options) { + var copy; + + if(forge.util.isArray(obj)) { + copy = []; + for(var i = 0; i < obj.length; ++i) { + copy.push(asn1.copy(obj[i], options)); + } + return copy; + } + + if(typeof obj === 'string') { + // TODO: copy byte buffer if it's a buffer not a string + return obj; + } + + copy = { + tagClass: obj.tagClass, + type: obj.type, + constructed: obj.constructed, + composed: obj.composed, + value: asn1.copy(obj.value, options) + }; + if(options && !options.excludeBitStringContents) { + // TODO: copy byte buffer if it's a buffer not a string + copy.bitStringContents = obj.bitStringContents; + } + return copy; +}; + +/** + * Compares asn1 objects for equality. + * + * Note this function does not run in constant time. + * + * @param obj1 the first asn1 object. + * @param obj2 the second asn1 object. + * @param [options] compare options: + * [includeBitStringContents] true to compare bitStringContents + * + * @return true if the asn1 objects are equal. + */ +asn1.equals = function(obj1, obj2, options) { + if(forge.util.isArray(obj1)) { + if(!forge.util.isArray(obj2)) { + return false; + } + if(obj1.length !== obj2.length) { + return false; + } + for(var i = 0; i < obj1.length; ++i) { + if(!asn1.equals(obj1[i], obj2[i])) { + return false; + } + } + return true; + } + + if(typeof obj1 !== typeof obj2) { + return false; + } + + if(typeof obj1 === 'string') { + return obj1 === obj2; + } + + var equal = obj1.tagClass === obj2.tagClass && + obj1.type === obj2.type && + obj1.constructed === obj2.constructed && + obj1.composed === obj2.composed && + asn1.equals(obj1.value, obj2.value); + if(options && options.includeBitStringContents) { + equal = equal && (obj1.bitStringContents === obj2.bitStringContents); + } + + return equal; +}; + +/** + * Gets the length of a BER-encoded ASN.1 value. + * + * In case the length is not specified, undefined is returned. + * + * @param b the BER-encoded ASN.1 byte buffer, starting with the first + * length byte. + * + * @return the length of the BER-encoded ASN.1 value or undefined. + */ +asn1.getBerValueLength = function(b) { + // TODO: move this function and related DER/BER functions to a der.js + // file; better abstract ASN.1 away from der/ber. + var b2 = b.getByte(); + if(b2 === 0x80) { + return undefined; + } + + // see if the length is "short form" or "long form" (bit 8 set) + var length; + var longForm = b2 & 0x80; + if(!longForm) { + // length is just the first byte + length = b2; + } else { + // the number of bytes the length is specified in bits 7 through 1 + // and each length byte is in big-endian base-256 + length = b.getInt((b2 & 0x7F) << 3); + } + return length; +}; + +/** + * Check if the byte buffer has enough bytes. Throws an Error if not. + * + * @param bytes the byte buffer to parse from. + * @param remaining the bytes remaining in the current parsing state. + * @param n the number of bytes the buffer must have. + */ +function _checkBufferLength(bytes, remaining, n) { + if(n > remaining) { + var error = new Error('Too few bytes to parse DER.'); + error.available = bytes.length(); + error.remaining = remaining; + error.requested = n; + throw error; + } +} + +/** + * Gets the length of a BER-encoded ASN.1 value. + * + * In case the length is not specified, undefined is returned. + * + * @param bytes the byte buffer to parse from. + * @param remaining the bytes remaining in the current parsing state. + * + * @return the length of the BER-encoded ASN.1 value or undefined. + */ +var _getValueLength = function(bytes, remaining) { + // TODO: move this function and related DER/BER functions to a der.js + // file; better abstract ASN.1 away from der/ber. + // fromDer already checked that this byte exists + var b2 = bytes.getByte(); + remaining--; + if(b2 === 0x80) { + return undefined; + } + + // see if the length is "short form" or "long form" (bit 8 set) + var length; + var longForm = b2 & 0x80; + if(!longForm) { + // length is just the first byte + length = b2; + } else { + // the number of bytes the length is specified in bits 7 through 1 + // and each length byte is in big-endian base-256 + var longFormBytes = b2 & 0x7F; + _checkBufferLength(bytes, remaining, longFormBytes); + length = bytes.getInt(longFormBytes << 3); + } + // FIXME: this will only happen for 32 bit getInt with high bit set + if(length < 0) { + throw new Error('Negative length: ' + length); + } + return length; +}; + +/** + * Parses an asn1 object from a byte buffer in DER format. + * + * @param bytes the byte buffer to parse from. + * @param [strict] true to be strict when checking value lengths, false to + * allow truncated values (default: true). + * @param [options] object with options or boolean strict flag + * [strict] true to be strict when checking value lengths, false to + * allow truncated values (default: true). + * [parseAllBytes] true to ensure all bytes are parsed + * (default: true) + * [decodeBitStrings] true to attempt to decode the content of + * BIT STRINGs (not OCTET STRINGs) using strict mode. Note that + * without schema support to understand the data context this can + * erroneously decode values that happen to be valid ASN.1. This + * flag will be deprecated or removed as soon as schema support is + * available. (default: true) + * + * @throws Will throw an error for various malformed input conditions. + * + * @return the parsed asn1 object. + */ +asn1.fromDer = function(bytes, options) { + if(options === undefined) { + options = { + strict: true, + parseAllBytes: true, + decodeBitStrings: true + }; + } + if(typeof options === 'boolean') { + options = { + strict: options, + parseAllBytes: true, + decodeBitStrings: true + }; + } + if(!('strict' in options)) { + options.strict = true; + } + if(!('parseAllBytes' in options)) { + options.parseAllBytes = true; + } + if(!('decodeBitStrings' in options)) { + options.decodeBitStrings = true; + } + + // wrap in buffer if needed + if(typeof bytes === 'string') { + bytes = forge.util.createBuffer(bytes); + } + + var byteCount = bytes.length(); + var value = _fromDer(bytes, bytes.length(), 0, options); + if(options.parseAllBytes && bytes.length() !== 0) { + var error = new Error('Unparsed DER bytes remain after ASN.1 parsing.'); + error.byteCount = byteCount; + error.remaining = bytes.length(); + throw error; + } + return value; +}; + +/** + * Internal function to parse an asn1 object from a byte buffer in DER format. + * + * @param bytes the byte buffer to parse from. + * @param remaining the number of bytes remaining for this chunk. + * @param depth the current parsing depth. + * @param options object with same options as fromDer(). + * + * @return the parsed asn1 object. + */ +function _fromDer(bytes, remaining, depth, options) { + // temporary storage for consumption calculations + var start; + + // minimum length for ASN.1 DER structure is 2 + _checkBufferLength(bytes, remaining, 2); + + // get the first byte + var b1 = bytes.getByte(); + // consumed one byte + remaining--; + + // get the tag class + var tagClass = (b1 & 0xC0); + + // get the type (bits 1-5) + var type = b1 & 0x1F; + + // get the variable value length and adjust remaining bytes + start = bytes.length(); + var length = _getValueLength(bytes, remaining); + remaining -= start - bytes.length(); + + // ensure there are enough bytes to get the value + if(length !== undefined && length > remaining) { + if(options.strict) { + var error = new Error('Too few bytes to read ASN.1 value.'); + error.available = bytes.length(); + error.remaining = remaining; + error.requested = length; + throw error; + } + // Note: be lenient with truncated values and use remaining state bytes + length = remaining; + } + + // value storage + var value; + // possible BIT STRING contents storage + var bitStringContents; + + // constructed flag is bit 6 (32 = 0x20) of the first byte + var constructed = ((b1 & 0x20) === 0x20); + if(constructed) { + // parse child asn1 objects from the value + value = []; + if(length === undefined) { + // asn1 object of indefinite length, read until end tag + for(;;) { + _checkBufferLength(bytes, remaining, 2); + if(bytes.bytes(2) === String.fromCharCode(0, 0)) { + bytes.getBytes(2); + remaining -= 2; + break; + } + start = bytes.length(); + value.push(_fromDer(bytes, remaining, depth + 1, options)); + remaining -= start - bytes.length(); + } + } else { + // parsing asn1 object of definite length + while(length > 0) { + start = bytes.length(); + value.push(_fromDer(bytes, length, depth + 1, options)); + remaining -= start - bytes.length(); + length -= start - bytes.length(); + } + } + } + + // if a BIT STRING, save the contents including padding + if(value === undefined && tagClass === asn1.Class.UNIVERSAL && + type === asn1.Type.BITSTRING) { + bitStringContents = bytes.bytes(length); + } + + // determine if a non-constructed value should be decoded as a composed + // value that contains other ASN.1 objects. BIT STRINGs (and OCTET STRINGs) + // can be used this way. + if(value === undefined && options.decodeBitStrings && + tagClass === asn1.Class.UNIVERSAL && + // FIXME: OCTET STRINGs not yet supported here + // .. other parts of forge expect to decode OCTET STRINGs manually + (type === asn1.Type.BITSTRING /*|| type === asn1.Type.OCTETSTRING*/) && + length > 1) { + // save read position + var savedRead = bytes.read; + var savedRemaining = remaining; + var unused = 0; + if(type === asn1.Type.BITSTRING) { + /* The first octet gives the number of bits by which the length of the + bit string is less than the next multiple of eight (this is called + the "number of unused bits"). + + The second and following octets give the value of the bit string + converted to an octet string. */ + _checkBufferLength(bytes, remaining, 1); + unused = bytes.getByte(); + remaining--; + } + // if all bits are used, maybe the BIT/OCTET STRING holds ASN.1 objs + if(unused === 0) { + try { + // attempt to parse child asn1 object from the value + // (stored in array to signal composed value) + start = bytes.length(); + var subOptions = { + // enforce strict mode to avoid parsing ASN.1 from plain data + strict: true, + decodeBitStrings: true + }; + var composed = _fromDer(bytes, remaining, depth + 1, subOptions); + var used = start - bytes.length(); + remaining -= used; + if(type == asn1.Type.BITSTRING) { + used++; + } + + // if the data all decoded and the class indicates UNIVERSAL or + // CONTEXT_SPECIFIC then assume we've got an encapsulated ASN.1 object + var tc = composed.tagClass; + if(used === length && + (tc === asn1.Class.UNIVERSAL || tc === asn1.Class.CONTEXT_SPECIFIC)) { + value = [composed]; + } + } catch(ex) { + } + } + if(value === undefined) { + // restore read position + bytes.read = savedRead; + remaining = savedRemaining; + } + } + + if(value === undefined) { + // asn1 not constructed or composed, get raw value + // TODO: do DER to OID conversion and vice-versa in .toDer? + + if(length === undefined) { + if(options.strict) { + throw new Error('Non-constructed ASN.1 object of indefinite length.'); + } + // be lenient and use remaining state bytes + length = remaining; + } + + if(type === asn1.Type.BMPSTRING) { + value = ''; + for(; length > 0; length -= 2) { + _checkBufferLength(bytes, remaining, 2); + value += String.fromCharCode(bytes.getInt16()); + remaining -= 2; + } + } else { + value = bytes.getBytes(length); + remaining -= length; + } + } + + // add BIT STRING contents if available + var asn1Options = bitStringContents === undefined ? null : { + bitStringContents: bitStringContents + }; + + // create and return asn1 object + return asn1.create(tagClass, type, constructed, value, asn1Options); +} + +/** + * Converts the given asn1 object to a buffer of bytes in DER format. + * + * @param asn1 the asn1 object to convert to bytes. + * + * @return the buffer of bytes. + */ +asn1.toDer = function(obj) { + var bytes = forge.util.createBuffer(); + + // build the first byte + var b1 = obj.tagClass | obj.type; + + // for storing the ASN.1 value + var value = forge.util.createBuffer(); + + // use BIT STRING contents if available and data not changed + var useBitStringContents = false; + if('bitStringContents' in obj) { + useBitStringContents = true; + if(obj.original) { + useBitStringContents = asn1.equals(obj, obj.original); + } + } + + if(useBitStringContents) { + value.putBytes(obj.bitStringContents); + } else if(obj.composed) { + // if composed, use each child asn1 object's DER bytes as value + // turn on 6th bit (0x20 = 32) to indicate asn1 is constructed + // from other asn1 objects + if(obj.constructed) { + b1 |= 0x20; + } else { + // type is a bit string, add unused bits of 0x00 + value.putByte(0x00); + } + + // add all of the child DER bytes together + for(var i = 0; i < obj.value.length; ++i) { + if(obj.value[i] !== undefined) { + value.putBuffer(asn1.toDer(obj.value[i])); + } + } + } else { + // use asn1.value directly + if(obj.type === asn1.Type.BMPSTRING) { + for(var i = 0; i < obj.value.length; ++i) { + value.putInt16(obj.value.charCodeAt(i)); + } + } else { + // ensure integer is minimally-encoded + // TODO: should all leading bytes be stripped vs just one? + // .. ex '00 00 01' => '01'? + if(obj.type === asn1.Type.INTEGER && + obj.value.length > 1 && + // leading 0x00 for positive integer + ((obj.value.charCodeAt(0) === 0 && + (obj.value.charCodeAt(1) & 0x80) === 0) || + // leading 0xFF for negative integer + (obj.value.charCodeAt(0) === 0xFF && + (obj.value.charCodeAt(1) & 0x80) === 0x80))) { + value.putBytes(obj.value.substr(1)); + } else { + value.putBytes(obj.value); + } + } + } + + // add tag byte + bytes.putByte(b1); + + // use "short form" encoding + if(value.length() <= 127) { + // one byte describes the length + // bit 8 = 0 and bits 7-1 = length + bytes.putByte(value.length() & 0x7F); + } else { + // use "long form" encoding + // 2 to 127 bytes describe the length + // first byte: bit 8 = 1 and bits 7-1 = # of additional bytes + // other bytes: length in base 256, big-endian + var len = value.length(); + var lenBytes = ''; + do { + lenBytes += String.fromCharCode(len & 0xFF); + len = len >>> 8; + } while(len > 0); + + // set first byte to # bytes used to store the length and turn on + // bit 8 to indicate long-form length is used + bytes.putByte(lenBytes.length | 0x80); + + // concatenate length bytes in reverse since they were generated + // little endian and we need big endian + for(var i = lenBytes.length - 1; i >= 0; --i) { + bytes.putByte(lenBytes.charCodeAt(i)); + } + } + + // concatenate value bytes + bytes.putBuffer(value); + return bytes; +}; + +/** + * Converts an OID dot-separated string to a byte buffer. The byte buffer + * contains only the DER-encoded value, not any tag or length bytes. + * + * @param oid the OID dot-separated string. + * + * @return the byte buffer. + */ +asn1.oidToDer = function(oid) { + // split OID into individual values + var values = oid.split('.'); + var bytes = forge.util.createBuffer(); + + // first byte is 40 * value1 + value2 + bytes.putByte(40 * parseInt(values[0], 10) + parseInt(values[1], 10)); + // other bytes are each value in base 128 with 8th bit set except for + // the last byte for each value + var last, valueBytes, value, b; + for(var i = 2; i < values.length; ++i) { + // produce value bytes in reverse because we don't know how many + // bytes it will take to store the value + last = true; + valueBytes = []; + value = parseInt(values[i], 10); + do { + b = value & 0x7F; + value = value >>> 7; + // if value is not last, then turn on 8th bit + if(!last) { + b |= 0x80; + } + valueBytes.push(b); + last = false; + } while(value > 0); + + // add value bytes in reverse (needs to be in big endian) + for(var n = valueBytes.length - 1; n >= 0; --n) { + bytes.putByte(valueBytes[n]); + } + } + + return bytes; +}; + +/** + * Converts a DER-encoded byte buffer to an OID dot-separated string. The + * byte buffer should contain only the DER-encoded value, not any tag or + * length bytes. + * + * @param bytes the byte buffer. + * + * @return the OID dot-separated string. + */ +asn1.derToOid = function(bytes) { + var oid; + + // wrap in buffer if needed + if(typeof bytes === 'string') { + bytes = forge.util.createBuffer(bytes); + } + + // first byte is 40 * value1 + value2 + var b = bytes.getByte(); + oid = Math.floor(b / 40) + '.' + (b % 40); + + // other bytes are each value in base 128 with 8th bit set except for + // the last byte for each value + var value = 0; + while(bytes.length() > 0) { + b = bytes.getByte(); + value = value << 7; + // not the last byte for the value + if(b & 0x80) { + value += b & 0x7F; + } else { + // last byte + oid += '.' + (value + b); + value = 0; + } + } + + return oid; +}; + +/** + * Converts a UTCTime value to a date. + * + * Note: GeneralizedTime has 4 digits for the year and is used for X.509 + * dates past 2049. Parsing that structure hasn't been implemented yet. + * + * @param utc the UTCTime value to convert. + * + * @return the date. + */ +asn1.utcTimeToDate = function(utc) { + /* The following formats can be used: + + YYMMDDhhmmZ + YYMMDDhhmm+hh'mm' + YYMMDDhhmm-hh'mm' + YYMMDDhhmmssZ + YYMMDDhhmmss+hh'mm' + YYMMDDhhmmss-hh'mm' + + Where: + + YY is the least significant two digits of the year + MM is the month (01 to 12) + DD is the day (01 to 31) + hh is the hour (00 to 23) + mm are the minutes (00 to 59) + ss are the seconds (00 to 59) + Z indicates that local time is GMT, + indicates that local time is + later than GMT, and - indicates that local time is earlier than GMT + hh' is the absolute value of the offset from GMT in hours + mm' is the absolute value of the offset from GMT in minutes */ + var date = new Date(); + + // if YY >= 50 use 19xx, if YY < 50 use 20xx + var year = parseInt(utc.substr(0, 2), 10); + year = (year >= 50) ? 1900 + year : 2000 + year; + var MM = parseInt(utc.substr(2, 2), 10) - 1; // use 0-11 for month + var DD = parseInt(utc.substr(4, 2), 10); + var hh = parseInt(utc.substr(6, 2), 10); + var mm = parseInt(utc.substr(8, 2), 10); + var ss = 0; + + // not just YYMMDDhhmmZ + if(utc.length > 11) { + // get character after minutes + var c = utc.charAt(10); + var end = 10; + + // see if seconds are present + if(c !== '+' && c !== '-') { + // get seconds + ss = parseInt(utc.substr(10, 2), 10); + end += 2; + } + } + + // update date + date.setUTCFullYear(year, MM, DD); + date.setUTCHours(hh, mm, ss, 0); + + if(end) { + // get +/- after end of time + c = utc.charAt(end); + if(c === '+' || c === '-') { + // get hours+minutes offset + var hhoffset = parseInt(utc.substr(end + 1, 2), 10); + var mmoffset = parseInt(utc.substr(end + 4, 2), 10); + + // calculate offset in milliseconds + var offset = hhoffset * 60 + mmoffset; + offset *= 60000; + + // apply offset + if(c === '+') { + date.setTime(+date - offset); + } else { + date.setTime(+date + offset); + } + } + } + + return date; +}; + +/** + * Converts a GeneralizedTime value to a date. + * + * @param gentime the GeneralizedTime value to convert. + * + * @return the date. + */ +asn1.generalizedTimeToDate = function(gentime) { + /* The following formats can be used: + + YYYYMMDDHHMMSS + YYYYMMDDHHMMSS.fff + YYYYMMDDHHMMSSZ + YYYYMMDDHHMMSS.fffZ + YYYYMMDDHHMMSS+hh'mm' + YYYYMMDDHHMMSS.fff+hh'mm' + YYYYMMDDHHMMSS-hh'mm' + YYYYMMDDHHMMSS.fff-hh'mm' + + Where: + + YYYY is the year + MM is the month (01 to 12) + DD is the day (01 to 31) + hh is the hour (00 to 23) + mm are the minutes (00 to 59) + ss are the seconds (00 to 59) + .fff is the second fraction, accurate to three decimal places + Z indicates that local time is GMT, + indicates that local time is + later than GMT, and - indicates that local time is earlier than GMT + hh' is the absolute value of the offset from GMT in hours + mm' is the absolute value of the offset from GMT in minutes */ + var date = new Date(); + + var YYYY = parseInt(gentime.substr(0, 4), 10); + var MM = parseInt(gentime.substr(4, 2), 10) - 1; // use 0-11 for month + var DD = parseInt(gentime.substr(6, 2), 10); + var hh = parseInt(gentime.substr(8, 2), 10); + var mm = parseInt(gentime.substr(10, 2), 10); + var ss = parseInt(gentime.substr(12, 2), 10); + var fff = 0; + var offset = 0; + var isUTC = false; + + if(gentime.charAt(gentime.length - 1) === 'Z') { + isUTC = true; + } + + var end = gentime.length - 5, c = gentime.charAt(end); + if(c === '+' || c === '-') { + // get hours+minutes offset + var hhoffset = parseInt(gentime.substr(end + 1, 2), 10); + var mmoffset = parseInt(gentime.substr(end + 4, 2), 10); + + // calculate offset in milliseconds + offset = hhoffset * 60 + mmoffset; + offset *= 60000; + + // apply offset + if(c === '+') { + offset *= -1; + } + + isUTC = true; + } + + // check for second fraction + if(gentime.charAt(14) === '.') { + fff = parseFloat(gentime.substr(14), 10) * 1000; + } + + if(isUTC) { + date.setUTCFullYear(YYYY, MM, DD); + date.setUTCHours(hh, mm, ss, fff); + + // apply offset + date.setTime(+date + offset); + } else { + date.setFullYear(YYYY, MM, DD); + date.setHours(hh, mm, ss, fff); + } + + return date; +}; + +/** + * Converts a date to a UTCTime value. + * + * Note: GeneralizedTime has 4 digits for the year and is used for X.509 + * dates past 2049. Converting to a GeneralizedTime hasn't been + * implemented yet. + * + * @param date the date to convert. + * + * @return the UTCTime value. + */ +asn1.dateToUtcTime = function(date) { + // TODO: validate; currently assumes proper format + if(typeof date === 'string') { + return date; + } + + var rval = ''; + + // create format YYMMDDhhmmssZ + var format = []; + format.push(('' + date.getUTCFullYear()).substr(2)); + format.push('' + (date.getUTCMonth() + 1)); + format.push('' + date.getUTCDate()); + format.push('' + date.getUTCHours()); + format.push('' + date.getUTCMinutes()); + format.push('' + date.getUTCSeconds()); + + // ensure 2 digits are used for each format entry + for(var i = 0; i < format.length; ++i) { + if(format[i].length < 2) { + rval += '0'; + } + rval += format[i]; + } + rval += 'Z'; + + return rval; +}; + +/** + * Converts a date to a GeneralizedTime value. + * + * @param date the date to convert. + * + * @return the GeneralizedTime value as a string. + */ +asn1.dateToGeneralizedTime = function(date) { + // TODO: validate; currently assumes proper format + if(typeof date === 'string') { + return date; + } + + var rval = ''; + + // create format YYYYMMDDHHMMSSZ + var format = []; + format.push('' + date.getUTCFullYear()); + format.push('' + (date.getUTCMonth() + 1)); + format.push('' + date.getUTCDate()); + format.push('' + date.getUTCHours()); + format.push('' + date.getUTCMinutes()); + format.push('' + date.getUTCSeconds()); + + // ensure 2 digits are used for each format entry + for(var i = 0; i < format.length; ++i) { + if(format[i].length < 2) { + rval += '0'; + } + rval += format[i]; + } + rval += 'Z'; + + return rval; +}; + +/** + * Converts a javascript integer to a DER-encoded byte buffer to be used + * as the value for an INTEGER type. + * + * @param x the integer. + * + * @return the byte buffer. + */ +asn1.integerToDer = function(x) { + var rval = forge.util.createBuffer(); + if(x >= -0x80 && x < 0x80) { + return rval.putSignedInt(x, 8); + } + if(x >= -0x8000 && x < 0x8000) { + return rval.putSignedInt(x, 16); + } + if(x >= -0x800000 && x < 0x800000) { + return rval.putSignedInt(x, 24); + } + if(x >= -0x80000000 && x < 0x80000000) { + return rval.putSignedInt(x, 32); + } + var error = new Error('Integer too large; max is 32-bits.'); + error.integer = x; + throw error; +}; + +/** + * Converts a DER-encoded byte buffer to a javascript integer. This is + * typically used to decode the value of an INTEGER type. + * + * @param bytes the byte buffer. + * + * @return the integer. + */ +asn1.derToInteger = function(bytes) { + // wrap in buffer if needed + if(typeof bytes === 'string') { + bytes = forge.util.createBuffer(bytes); + } + + var n = bytes.length() * 8; + if(n > 32) { + throw new Error('Integer too large; max is 32-bits.'); + } + return bytes.getSignedInt(n); +}; + +/** + * Validates that the given ASN.1 object is at least a super set of the + * given ASN.1 structure. Only tag classes and types are checked. An + * optional map may also be provided to capture ASN.1 values while the + * structure is checked. + * + * To capture an ASN.1 value, set an object in the validator's 'capture' + * parameter to the key to use in the capture map. To capture the full + * ASN.1 object, specify 'captureAsn1'. To capture BIT STRING bytes, including + * the leading unused bits counter byte, specify 'captureBitStringContents'. + * To capture BIT STRING bytes, without the leading unused bits counter byte, + * specify 'captureBitStringValue'. + * + * Objects in the validator may set a field 'optional' to true to indicate + * that it isn't necessary to pass validation. + * + * @param obj the ASN.1 object to validate. + * @param v the ASN.1 structure validator. + * @param capture an optional map to capture values in. + * @param errors an optional array for storing validation errors. + * + * @return true on success, false on failure. + */ +asn1.validate = function(obj, v, capture, errors) { + var rval = false; + + // ensure tag class and type are the same if specified + if((obj.tagClass === v.tagClass || typeof(v.tagClass) === 'undefined') && + (obj.type === v.type || typeof(v.type) === 'undefined')) { + // ensure constructed flag is the same if specified + if(obj.constructed === v.constructed || + typeof(v.constructed) === 'undefined') { + rval = true; + + // handle sub values + if(v.value && forge.util.isArray(v.value)) { + var j = 0; + for(var i = 0; rval && i < v.value.length; ++i) { + rval = v.value[i].optional || false; + if(obj.value[j]) { + rval = asn1.validate(obj.value[j], v.value[i], capture, errors); + if(rval) { + ++j; + } else if(v.value[i].optional) { + rval = true; + } + } + if(!rval && errors) { + errors.push( + '[' + v.name + '] ' + + 'Tag class "' + v.tagClass + '", type "' + + v.type + '" expected value length "' + + v.value.length + '", got "' + + obj.value.length + '"'); + } + } + } + + if(rval && capture) { + if(v.capture) { + capture[v.capture] = obj.value; + } + if(v.captureAsn1) { + capture[v.captureAsn1] = obj; + } + if(v.captureBitStringContents && 'bitStringContents' in obj) { + capture[v.captureBitStringContents] = obj.bitStringContents; + } + if(v.captureBitStringValue && 'bitStringContents' in obj) { + var value; + if(obj.bitStringContents.length < 2) { + capture[v.captureBitStringValue] = ''; + } else { + // FIXME: support unused bits with data shifting + var unused = obj.bitStringContents.charCodeAt(0); + if(unused !== 0) { + throw new Error( + 'captureBitStringValue only supported for zero unused bits'); + } + capture[v.captureBitStringValue] = obj.bitStringContents.slice(1); + } + } + } + } else if(errors) { + errors.push( + '[' + v.name + '] ' + + 'Expected constructed "' + v.constructed + '", got "' + + obj.constructed + '"'); + } + } else if(errors) { + if(obj.tagClass !== v.tagClass) { + errors.push( + '[' + v.name + '] ' + + 'Expected tag class "' + v.tagClass + '", got "' + + obj.tagClass + '"'); + } + if(obj.type !== v.type) { + errors.push( + '[' + v.name + '] ' + + 'Expected type "' + v.type + '", got "' + obj.type + '"'); + } + } + return rval; +}; + +// regex for testing for non-latin characters +var _nonLatinRegex = /[^\\u0000-\\u00ff]/; + +/** + * Pretty prints an ASN.1 object to a string. + * + * @param obj the object to write out. + * @param level the level in the tree. + * @param indentation the indentation to use. + * + * @return the string. + */ +asn1.prettyPrint = function(obj, level, indentation) { + var rval = ''; + + // set default level and indentation + level = level || 0; + indentation = indentation || 2; + + // start new line for deep levels + if(level > 0) { + rval += '\n'; + } + + // create indent + var indent = ''; + for(var i = 0; i < level * indentation; ++i) { + indent += ' '; + } + + // print class:type + rval += indent + 'Tag: '; + switch(obj.tagClass) { + case asn1.Class.UNIVERSAL: + rval += 'Universal:'; + break; + case asn1.Class.APPLICATION: + rval += 'Application:'; + break; + case asn1.Class.CONTEXT_SPECIFIC: + rval += 'Context-Specific:'; + break; + case asn1.Class.PRIVATE: + rval += 'Private:'; + break; + } + + if(obj.tagClass === asn1.Class.UNIVERSAL) { + rval += obj.type; + + // known types + switch(obj.type) { + case asn1.Type.NONE: + rval += ' (None)'; + break; + case asn1.Type.BOOLEAN: + rval += ' (Boolean)'; + break; + case asn1.Type.INTEGER: + rval += ' (Integer)'; + break; + case asn1.Type.BITSTRING: + rval += ' (Bit string)'; + break; + case asn1.Type.OCTETSTRING: + rval += ' (Octet string)'; + break; + case asn1.Type.NULL: + rval += ' (Null)'; + break; + case asn1.Type.OID: + rval += ' (Object Identifier)'; + break; + case asn1.Type.ODESC: + rval += ' (Object Descriptor)'; + break; + case asn1.Type.EXTERNAL: + rval += ' (External or Instance of)'; + break; + case asn1.Type.REAL: + rval += ' (Real)'; + break; + case asn1.Type.ENUMERATED: + rval += ' (Enumerated)'; + break; + case asn1.Type.EMBEDDED: + rval += ' (Embedded PDV)'; + break; + case asn1.Type.UTF8: + rval += ' (UTF8)'; + break; + case asn1.Type.ROID: + rval += ' (Relative Object Identifier)'; + break; + case asn1.Type.SEQUENCE: + rval += ' (Sequence)'; + break; + case asn1.Type.SET: + rval += ' (Set)'; + break; + case asn1.Type.PRINTABLESTRING: + rval += ' (Printable String)'; + break; + case asn1.Type.IA5String: + rval += ' (IA5String (ASCII))'; + break; + case asn1.Type.UTCTIME: + rval += ' (UTC time)'; + break; + case asn1.Type.GENERALIZEDTIME: + rval += ' (Generalized time)'; + break; + case asn1.Type.BMPSTRING: + rval += ' (BMP String)'; + break; + } + } else { + rval += obj.type; + } + + rval += '\n'; + rval += indent + 'Constructed: ' + obj.constructed + '\n'; + + if(obj.composed) { + var subvalues = 0; + var sub = ''; + for(var i = 0; i < obj.value.length; ++i) { + if(obj.value[i] !== undefined) { + subvalues += 1; + sub += asn1.prettyPrint(obj.value[i], level + 1, indentation); + if((i + 1) < obj.value.length) { + sub += ','; + } + } + } + rval += indent + 'Sub values: ' + subvalues + sub; + } else { + rval += indent + 'Value: '; + if(obj.type === asn1.Type.OID) { + var oid = asn1.derToOid(obj.value); + rval += oid; + if(forge.pki && forge.pki.oids) { + if(oid in forge.pki.oids) { + rval += ' (' + forge.pki.oids[oid] + ') '; + } + } + } + if(obj.type === asn1.Type.INTEGER) { + try { + rval += asn1.derToInteger(obj.value); + } catch(ex) { + rval += '0x' + forge.util.bytesToHex(obj.value); + } + } else if(obj.type === asn1.Type.BITSTRING) { + // TODO: shift bits as needed to display without padding + if(obj.value.length > 1) { + // remove unused bits field + rval += '0x' + forge.util.bytesToHex(obj.value.slice(1)); + } else { + rval += '(none)'; + } + // show unused bit count + if(obj.value.length > 0) { + var unused = obj.value.charCodeAt(0); + if(unused == 1) { + rval += ' (1 unused bit shown)'; + } else if(unused > 1) { + rval += ' (' + unused + ' unused bits shown)'; + } + } + } else if(obj.type === asn1.Type.OCTETSTRING) { + if(!_nonLatinRegex.test(obj.value)) { + rval += '(' + obj.value + ') '; + } + rval += '0x' + forge.util.bytesToHex(obj.value); + } else if(obj.type === asn1.Type.UTF8) { + try { + rval += forge.util.decodeUtf8(obj.value); + } catch(e) { + if(e.message === 'URI malformed') { + rval += + '0x' + forge.util.bytesToHex(obj.value) + ' (malformed UTF8)'; + } else { + throw e; + } + } + } else if(obj.type === asn1.Type.PRINTABLESTRING || + obj.type === asn1.Type.IA5String) { + rval += obj.value; + } else if(_nonLatinRegex.test(obj.value)) { + rval += '0x' + forge.util.bytesToHex(obj.value); + } else if(obj.value.length === 0) { + rval += '[null]'; + } else { + rval += obj.value; + } + } + + return rval; +}; + + +/***/ }), + +/***/ 8807: +/***/ (function(module) { + +/** + * Base-N/Base-X encoding/decoding functions. + * + * Original implementation from base-x: + * https://github.com/cryptocoinjs/base-x + * + * Which is MIT licensed: + * + * The MIT License (MIT) + * + * Copyright base-x contributors (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +var api = {}; +module.exports = api; + +// baseN alphabet indexes +var _reverseAlphabets = {}; + +/** + * BaseN-encodes a Uint8Array using the given alphabet. + * + * @param input the Uint8Array to encode. + * @param maxline the maximum number of encoded characters per line to use, + * defaults to none. + * + * @return the baseN-encoded output string. + */ +api.encode = function(input, alphabet, maxline) { + if(typeof alphabet !== 'string') { + throw new TypeError('"alphabet" must be a string.'); + } + if(maxline !== undefined && typeof maxline !== 'number') { + throw new TypeError('"maxline" must be a number.'); + } + + var output = ''; + + if(!(input instanceof Uint8Array)) { + // assume forge byte buffer + output = _encodeWithByteBuffer(input, alphabet); + } else { + var i = 0; + var base = alphabet.length; + var first = alphabet.charAt(0); + var digits = [0]; + for(i = 0; i < input.length; ++i) { + for(var j = 0, carry = input[i]; j < digits.length; ++j) { + carry += digits[j] << 8; + digits[j] = carry % base; + carry = (carry / base) | 0; + } + + while(carry > 0) { + digits.push(carry % base); + carry = (carry / base) | 0; + } + } + + // deal with leading zeros + for(i = 0; input[i] === 0 && i < input.length - 1; ++i) { + output += first; + } + // convert digits to a string + for(i = digits.length - 1; i >= 0; --i) { + output += alphabet[digits[i]]; + } + } + + if(maxline) { + var regex = new RegExp('.{1,' + maxline + '}', 'g'); + output = output.match(regex).join('\r\n'); + } + + return output; +}; + +/** + * Decodes a baseN-encoded (using the given alphabet) string to a + * Uint8Array. + * + * @param input the baseN-encoded input string. + * + * @return the Uint8Array. + */ +api.decode = function(input, alphabet) { + if(typeof input !== 'string') { + throw new TypeError('"input" must be a string.'); + } + if(typeof alphabet !== 'string') { + throw new TypeError('"alphabet" must be a string.'); + } + + var table = _reverseAlphabets[alphabet]; + if(!table) { + // compute reverse alphabet + table = _reverseAlphabets[alphabet] = []; + for(var i = 0; i < alphabet.length; ++i) { + table[alphabet.charCodeAt(i)] = i; + } + } + + // remove whitespace characters + input = input.replace(/\s/g, ''); + + var base = alphabet.length; + var first = alphabet.charAt(0); + var bytes = [0]; + for(var i = 0; i < input.length; i++) { + var value = table[input.charCodeAt(i)]; + if(value === undefined) { + return; + } + + for(var j = 0, carry = value; j < bytes.length; ++j) { + carry += bytes[j] * base; + bytes[j] = carry & 0xff; + carry >>= 8; + } + + while(carry > 0) { + bytes.push(carry & 0xff); + carry >>= 8; + } + } + + // deal with leading zeros + for(var k = 0; input[k] === first && k < input.length - 1; ++k) { + bytes.push(0); + } + + if(typeof Buffer !== 'undefined') { + return Buffer.from(bytes.reverse()); + } + + return new Uint8Array(bytes.reverse()); +}; + +function _encodeWithByteBuffer(input, alphabet) { + var i = 0; + var base = alphabet.length; + var first = alphabet.charAt(0); + var digits = [0]; + for(i = 0; i < input.length(); ++i) { + for(var j = 0, carry = input.at(i); j < digits.length; ++j) { + carry += digits[j] << 8; + digits[j] = carry % base; + carry = (carry / base) | 0; + } + + while(carry > 0) { + digits.push(carry % base); + carry = (carry / base) | 0; + } + } + + var output = ''; + + // deal with leading zeros + for(i = 0; input.at(i) === 0 && i < input.length() - 1; ++i) { + output += first; + } + // convert digits to a string + for(i = digits.length - 1; i >= 0; --i) { + output += alphabet[digits[i]]; + } + + return output; +} + + +/***/ }), + +/***/ 5649: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Cipher base API. + * + * @author Dave Longley + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); + +module.exports = forge.cipher = forge.cipher || {}; + +// registered algorithms +forge.cipher.algorithms = forge.cipher.algorithms || {}; + +/** + * Creates a cipher object that can be used to encrypt data using the given + * algorithm and key. The algorithm may be provided as a string value for a + * previously registered algorithm or it may be given as a cipher algorithm + * API object. + * + * @param algorithm the algorithm to use, either a string or an algorithm API + * object. + * @param key the key to use, as a binary-encoded string of bytes or a + * byte buffer. + * + * @return the cipher. + */ +forge.cipher.createCipher = function(algorithm, key) { + var api = algorithm; + if(typeof api === 'string') { + api = forge.cipher.getAlgorithm(api); + if(api) { + api = api(); + } + } + if(!api) { + throw new Error('Unsupported algorithm: ' + algorithm); + } + + // assume block cipher + return new forge.cipher.BlockCipher({ + algorithm: api, + key: key, + decrypt: false + }); +}; + +/** + * Creates a decipher object that can be used to decrypt data using the given + * algorithm and key. The algorithm may be provided as a string value for a + * previously registered algorithm or it may be given as a cipher algorithm + * API object. + * + * @param algorithm the algorithm to use, either a string or an algorithm API + * object. + * @param key the key to use, as a binary-encoded string of bytes or a + * byte buffer. + * + * @return the cipher. + */ +forge.cipher.createDecipher = function(algorithm, key) { + var api = algorithm; + if(typeof api === 'string') { + api = forge.cipher.getAlgorithm(api); + if(api) { + api = api(); + } + } + if(!api) { + throw new Error('Unsupported algorithm: ' + algorithm); + } + + // assume block cipher + return new forge.cipher.BlockCipher({ + algorithm: api, + key: key, + decrypt: true + }); +}; + +/** + * Registers an algorithm by name. If the name was already registered, the + * algorithm API object will be overwritten. + * + * @param name the name of the algorithm. + * @param algorithm the algorithm API object. + */ +forge.cipher.registerAlgorithm = function(name, algorithm) { + name = name.toUpperCase(); + forge.cipher.algorithms[name] = algorithm; +}; + +/** + * Gets a registered algorithm by name. + * + * @param name the name of the algorithm. + * + * @return the algorithm, if found, null if not. + */ +forge.cipher.getAlgorithm = function(name) { + name = name.toUpperCase(); + if(name in forge.cipher.algorithms) { + return forge.cipher.algorithms[name]; + } + return null; +}; + +var BlockCipher = forge.cipher.BlockCipher = function(options) { + this.algorithm = options.algorithm; + this.mode = this.algorithm.mode; + this.blockSize = this.mode.blockSize; + this._finish = false; + this._input = null; + this.output = null; + this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt; + this._decrypt = options.decrypt; + this.algorithm.initialize(options); +}; + +/** + * Starts or restarts the encryption or decryption process, whichever + * was previously configured. + * + * For non-GCM mode, the IV may be a binary-encoded string of bytes, an array + * of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in + * bytes, then it must be Nb (16) bytes in length. If the IV is given in as + * 32-bit integers, then it must be 4 integers long. + * + * Note: an IV is not required or used in ECB mode. + * + * For GCM-mode, the IV must be given as a binary-encoded string of bytes or + * a byte buffer. The number of bytes should be 12 (96 bits) as recommended + * by NIST SP-800-38D but another length may be given. + * + * @param options the options to use: + * iv the initialization vector to use as a binary-encoded string of + * bytes, null to reuse the last ciphered block from a previous + * update() (this "residue" method is for legacy support only). + * additionalData additional authentication data as a binary-encoded + * string of bytes, for 'GCM' mode, (default: none). + * tagLength desired length of authentication tag, in bits, for + * 'GCM' mode (0-128, default: 128). + * tag the authentication tag to check if decrypting, as a + * binary-encoded string of bytes. + * output the output the buffer to write to, null to create one. + */ +BlockCipher.prototype.start = function(options) { + options = options || {}; + var opts = {}; + for(var key in options) { + opts[key] = options[key]; + } + opts.decrypt = this._decrypt; + this._finish = false; + this._input = forge.util.createBuffer(); + this.output = options.output || forge.util.createBuffer(); + this.mode.start(opts); +}; + +/** + * Updates the next block according to the cipher mode. + * + * @param input the buffer to read from. + */ +BlockCipher.prototype.update = function(input) { + if(input) { + // input given, so empty it into the input buffer + this._input.putBuffer(input); + } + + // do cipher operation until it needs more input and not finished + while(!this._op.call(this.mode, this._input, this.output, this._finish) && + !this._finish) {} + + // free consumed memory from input buffer + this._input.compact(); +}; + +/** + * Finishes encrypting or decrypting. + * + * @param pad a padding function to use in CBC mode, null for default, + * signature(blockSize, buffer, decrypt). + * + * @return true if successful, false on error. + */ +BlockCipher.prototype.finish = function(pad) { + // backwards-compatibility w/deprecated padding API + // Note: will overwrite padding functions even after another start() call + if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) { + this.mode.pad = function(input) { + return pad(this.blockSize, input, false); + }; + this.mode.unpad = function(output) { + return pad(this.blockSize, output, true); + }; + } + + // build options for padding and afterFinish functions + var options = {}; + options.decrypt = this._decrypt; + + // get # of bytes that won't fill a block + options.overflow = this._input.length() % this.blockSize; + + if(!this._decrypt && this.mode.pad) { + if(!this.mode.pad(this._input, options)) { + return false; + } + } + + // do final update + this._finish = true; + this.update(); + + if(this._decrypt && this.mode.unpad) { + if(!this.mode.unpad(this.output, options)) { + return false; + } + } + + if(this.mode.afterFinish) { + if(!this.mode.afterFinish(this.output, options)) { + return false; + } + } + + return true; +}; + + +/***/ }), + +/***/ 1967: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Supported cipher modes. + * + * @author Dave Longley + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); + +forge.cipher = forge.cipher || {}; + +// supported cipher modes +var modes = module.exports = forge.cipher.modes = forge.cipher.modes || {}; + +/** Electronic codebook (ECB) (Don't use this; it's not secure) **/ + +modes.ecb = function(options) { + options = options || {}; + this.name = 'ECB'; + this.cipher = options.cipher; + this.blockSize = options.blockSize || 16; + this._ints = this.blockSize / 4; + this._inBlock = new Array(this._ints); + this._outBlock = new Array(this._ints); +}; + +modes.ecb.prototype.start = function(options) {}; + +modes.ecb.prototype.encrypt = function(input, output, finish) { + // not enough input to encrypt + if(input.length() < this.blockSize && !(finish && input.length() > 0)) { + return true; + } + + // get next block + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = input.getInt32(); + } + + // encrypt block + this.cipher.encrypt(this._inBlock, this._outBlock); + + // write output + for(var i = 0; i < this._ints; ++i) { + output.putInt32(this._outBlock[i]); + } +}; + +modes.ecb.prototype.decrypt = function(input, output, finish) { + // not enough input to decrypt + if(input.length() < this.blockSize && !(finish && input.length() > 0)) { + return true; + } + + // get next block + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = input.getInt32(); + } + + // decrypt block + this.cipher.decrypt(this._inBlock, this._outBlock); + + // write output + for(var i = 0; i < this._ints; ++i) { + output.putInt32(this._outBlock[i]); + } +}; + +modes.ecb.prototype.pad = function(input, options) { + // add PKCS#7 padding to block (each pad byte is the + // value of the number of pad bytes) + var padding = (input.length() === this.blockSize ? + this.blockSize : (this.blockSize - input.length())); + input.fillWithByte(padding, padding); + return true; +}; + +modes.ecb.prototype.unpad = function(output, options) { + // check for error: input data not a multiple of blockSize + if(options.overflow > 0) { + return false; + } + + // ensure padding byte count is valid + var len = output.length(); + var count = output.at(len - 1); + if(count > (this.blockSize << 2)) { + return false; + } + + // trim off padding bytes + output.truncate(count); + return true; +}; + +/** Cipher-block Chaining (CBC) **/ + +modes.cbc = function(options) { + options = options || {}; + this.name = 'CBC'; + this.cipher = options.cipher; + this.blockSize = options.blockSize || 16; + this._ints = this.blockSize / 4; + this._inBlock = new Array(this._ints); + this._outBlock = new Array(this._ints); +}; + +modes.cbc.prototype.start = function(options) { + // Note: legacy support for using IV residue (has security flaws) + // if IV is null, reuse block from previous processing + if(options.iv === null) { + // must have a previous block + if(!this._prev) { + throw new Error('Invalid IV parameter.'); + } + this._iv = this._prev.slice(0); + } else if(!('iv' in options)) { + throw new Error('Invalid IV parameter.'); + } else { + // save IV as "previous" block + this._iv = transformIV(options.iv, this.blockSize); + this._prev = this._iv.slice(0); + } +}; + +modes.cbc.prototype.encrypt = function(input, output, finish) { + // not enough input to encrypt + if(input.length() < this.blockSize && !(finish && input.length() > 0)) { + return true; + } + + // get next block + // CBC XOR's IV (or previous block) with plaintext + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = this._prev[i] ^ input.getInt32(); + } + + // encrypt block + this.cipher.encrypt(this._inBlock, this._outBlock); + + // write output, save previous block + for(var i = 0; i < this._ints; ++i) { + output.putInt32(this._outBlock[i]); + } + this._prev = this._outBlock; +}; + +modes.cbc.prototype.decrypt = function(input, output, finish) { + // not enough input to decrypt + if(input.length() < this.blockSize && !(finish && input.length() > 0)) { + return true; + } + + // get next block + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = input.getInt32(); + } + + // decrypt block + this.cipher.decrypt(this._inBlock, this._outBlock); + + // write output, save previous ciphered block + // CBC XOR's IV (or previous block) with ciphertext + for(var i = 0; i < this._ints; ++i) { + output.putInt32(this._prev[i] ^ this._outBlock[i]); + } + this._prev = this._inBlock.slice(0); +}; + +modes.cbc.prototype.pad = function(input, options) { + // add PKCS#7 padding to block (each pad byte is the + // value of the number of pad bytes) + var padding = (input.length() === this.blockSize ? + this.blockSize : (this.blockSize - input.length())); + input.fillWithByte(padding, padding); + return true; +}; + +modes.cbc.prototype.unpad = function(output, options) { + // check for error: input data not a multiple of blockSize + if(options.overflow > 0) { + return false; + } + + // ensure padding byte count is valid + var len = output.length(); + var count = output.at(len - 1); + if(count > (this.blockSize << 2)) { + return false; + } + + // trim off padding bytes + output.truncate(count); + return true; +}; + +/** Cipher feedback (CFB) **/ + +modes.cfb = function(options) { + options = options || {}; + this.name = 'CFB'; + this.cipher = options.cipher; + this.blockSize = options.blockSize || 16; + this._ints = this.blockSize / 4; + this._inBlock = null; + this._outBlock = new Array(this._ints); + this._partialBlock = new Array(this._ints); + this._partialOutput = forge.util.createBuffer(); + this._partialBytes = 0; +}; + +modes.cfb.prototype.start = function(options) { + if(!('iv' in options)) { + throw new Error('Invalid IV parameter.'); + } + // use IV as first input + this._iv = transformIV(options.iv, this.blockSize); + this._inBlock = this._iv.slice(0); + this._partialBytes = 0; +}; + +modes.cfb.prototype.encrypt = function(input, output, finish) { + // not enough input to encrypt + var inputLength = input.length(); + if(inputLength === 0) { + return true; + } + + // encrypt block + this.cipher.encrypt(this._inBlock, this._outBlock); + + // handle full block + if(this._partialBytes === 0 && inputLength >= this.blockSize) { + // XOR input with output, write input as output + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = input.getInt32() ^ this._outBlock[i]; + output.putInt32(this._inBlock[i]); + } + return; + } + + // handle partial block + var partialBytes = (this.blockSize - inputLength) % this.blockSize; + if(partialBytes > 0) { + partialBytes = this.blockSize - partialBytes; + } + + // XOR input with output, write input as partial output + this._partialOutput.clear(); + for(var i = 0; i < this._ints; ++i) { + this._partialBlock[i] = input.getInt32() ^ this._outBlock[i]; + this._partialOutput.putInt32(this._partialBlock[i]); + } + + if(partialBytes > 0) { + // block still incomplete, restore input buffer + input.read -= this.blockSize; + } else { + // block complete, update input block + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = this._partialBlock[i]; + } + } + + // skip any previous partial bytes + if(this._partialBytes > 0) { + this._partialOutput.getBytes(this._partialBytes); + } + + if(partialBytes > 0 && !finish) { + output.putBytes(this._partialOutput.getBytes( + partialBytes - this._partialBytes)); + this._partialBytes = partialBytes; + return true; + } + + output.putBytes(this._partialOutput.getBytes( + inputLength - this._partialBytes)); + this._partialBytes = 0; +}; + +modes.cfb.prototype.decrypt = function(input, output, finish) { + // not enough input to decrypt + var inputLength = input.length(); + if(inputLength === 0) { + return true; + } + + // encrypt block (CFB always uses encryption mode) + this.cipher.encrypt(this._inBlock, this._outBlock); + + // handle full block + if(this._partialBytes === 0 && inputLength >= this.blockSize) { + // XOR input with output, write input as output + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = input.getInt32(); + output.putInt32(this._inBlock[i] ^ this._outBlock[i]); + } + return; + } + + // handle partial block + var partialBytes = (this.blockSize - inputLength) % this.blockSize; + if(partialBytes > 0) { + partialBytes = this.blockSize - partialBytes; + } + + // XOR input with output, write input as partial output + this._partialOutput.clear(); + for(var i = 0; i < this._ints; ++i) { + this._partialBlock[i] = input.getInt32(); + this._partialOutput.putInt32(this._partialBlock[i] ^ this._outBlock[i]); + } + + if(partialBytes > 0) { + // block still incomplete, restore input buffer + input.read -= this.blockSize; + } else { + // block complete, update input block + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = this._partialBlock[i]; + } + } + + // skip any previous partial bytes + if(this._partialBytes > 0) { + this._partialOutput.getBytes(this._partialBytes); + } + + if(partialBytes > 0 && !finish) { + output.putBytes(this._partialOutput.getBytes( + partialBytes - this._partialBytes)); + this._partialBytes = partialBytes; + return true; + } + + output.putBytes(this._partialOutput.getBytes( + inputLength - this._partialBytes)); + this._partialBytes = 0; +}; + +/** Output feedback (OFB) **/ + +modes.ofb = function(options) { + options = options || {}; + this.name = 'OFB'; + this.cipher = options.cipher; + this.blockSize = options.blockSize || 16; + this._ints = this.blockSize / 4; + this._inBlock = null; + this._outBlock = new Array(this._ints); + this._partialOutput = forge.util.createBuffer(); + this._partialBytes = 0; +}; + +modes.ofb.prototype.start = function(options) { + if(!('iv' in options)) { + throw new Error('Invalid IV parameter.'); + } + // use IV as first input + this._iv = transformIV(options.iv, this.blockSize); + this._inBlock = this._iv.slice(0); + this._partialBytes = 0; +}; + +modes.ofb.prototype.encrypt = function(input, output, finish) { + // not enough input to encrypt + var inputLength = input.length(); + if(input.length() === 0) { + return true; + } + + // encrypt block (OFB always uses encryption mode) + this.cipher.encrypt(this._inBlock, this._outBlock); + + // handle full block + if(this._partialBytes === 0 && inputLength >= this.blockSize) { + // XOR input with output and update next input + for(var i = 0; i < this._ints; ++i) { + output.putInt32(input.getInt32() ^ this._outBlock[i]); + this._inBlock[i] = this._outBlock[i]; + } + return; + } + + // handle partial block + var partialBytes = (this.blockSize - inputLength) % this.blockSize; + if(partialBytes > 0) { + partialBytes = this.blockSize - partialBytes; + } + + // XOR input with output + this._partialOutput.clear(); + for(var i = 0; i < this._ints; ++i) { + this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); + } + + if(partialBytes > 0) { + // block still incomplete, restore input buffer + input.read -= this.blockSize; + } else { + // block complete, update input block + for(var i = 0; i < this._ints; ++i) { + this._inBlock[i] = this._outBlock[i]; + } + } + + // skip any previous partial bytes + if(this._partialBytes > 0) { + this._partialOutput.getBytes(this._partialBytes); + } + + if(partialBytes > 0 && !finish) { + output.putBytes(this._partialOutput.getBytes( + partialBytes - this._partialBytes)); + this._partialBytes = partialBytes; + return true; + } + + output.putBytes(this._partialOutput.getBytes( + inputLength - this._partialBytes)); + this._partialBytes = 0; +}; + +modes.ofb.prototype.decrypt = modes.ofb.prototype.encrypt; + +/** Counter (CTR) **/ + +modes.ctr = function(options) { + options = options || {}; + this.name = 'CTR'; + this.cipher = options.cipher; + this.blockSize = options.blockSize || 16; + this._ints = this.blockSize / 4; + this._inBlock = null; + this._outBlock = new Array(this._ints); + this._partialOutput = forge.util.createBuffer(); + this._partialBytes = 0; +}; + +modes.ctr.prototype.start = function(options) { + if(!('iv' in options)) { + throw new Error('Invalid IV parameter.'); + } + // use IV as first input + this._iv = transformIV(options.iv, this.blockSize); + this._inBlock = this._iv.slice(0); + this._partialBytes = 0; +}; + +modes.ctr.prototype.encrypt = function(input, output, finish) { + // not enough input to encrypt + var inputLength = input.length(); + if(inputLength === 0) { + return true; + } + + // encrypt block (CTR always uses encryption mode) + this.cipher.encrypt(this._inBlock, this._outBlock); + + // handle full block + if(this._partialBytes === 0 && inputLength >= this.blockSize) { + // XOR input with output + for(var i = 0; i < this._ints; ++i) { + output.putInt32(input.getInt32() ^ this._outBlock[i]); + } + } else { + // handle partial block + var partialBytes = (this.blockSize - inputLength) % this.blockSize; + if(partialBytes > 0) { + partialBytes = this.blockSize - partialBytes; + } + + // XOR input with output + this._partialOutput.clear(); + for(var i = 0; i < this._ints; ++i) { + this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); + } + + if(partialBytes > 0) { + // block still incomplete, restore input buffer + input.read -= this.blockSize; + } + + // skip any previous partial bytes + if(this._partialBytes > 0) { + this._partialOutput.getBytes(this._partialBytes); + } + + if(partialBytes > 0 && !finish) { + output.putBytes(this._partialOutput.getBytes( + partialBytes - this._partialBytes)); + this._partialBytes = partialBytes; + return true; + } + + output.putBytes(this._partialOutput.getBytes( + inputLength - this._partialBytes)); + this._partialBytes = 0; + } + + // block complete, increment counter (input block) + inc32(this._inBlock); +}; + +modes.ctr.prototype.decrypt = modes.ctr.prototype.encrypt; + +/** Galois/Counter Mode (GCM) **/ + +modes.gcm = function(options) { + options = options || {}; + this.name = 'GCM'; + this.cipher = options.cipher; + this.blockSize = options.blockSize || 16; + this._ints = this.blockSize / 4; + this._inBlock = new Array(this._ints); + this._outBlock = new Array(this._ints); + this._partialOutput = forge.util.createBuffer(); + this._partialBytes = 0; + + // R is actually this value concatenated with 120 more zero bits, but + // we only XOR against R so the other zeros have no effect -- we just + // apply this value to the first integer in a block + this._R = 0xE1000000; +}; + +modes.gcm.prototype.start = function(options) { + if(!('iv' in options)) { + throw new Error('Invalid IV parameter.'); + } + // ensure IV is a byte buffer + var iv = forge.util.createBuffer(options.iv); + + // no ciphered data processed yet + this._cipherLength = 0; + + // default additional data is none + var additionalData; + if('additionalData' in options) { + additionalData = forge.util.createBuffer(options.additionalData); + } else { + additionalData = forge.util.createBuffer(); + } + + // default tag length is 128 bits + if('tagLength' in options) { + this._tagLength = options.tagLength; + } else { + this._tagLength = 128; + } + + // if tag is given, ensure tag matches tag length + this._tag = null; + if(options.decrypt) { + // save tag to check later + this._tag = forge.util.createBuffer(options.tag).getBytes(); + if(this._tag.length !== (this._tagLength / 8)) { + throw new Error('Authentication tag does not match tag length.'); + } + } + + // create tmp storage for hash calculation + this._hashBlock = new Array(this._ints); + + // no tag generated yet + this.tag = null; + + // generate hash subkey + // (apply block cipher to "zero" block) + this._hashSubkey = new Array(this._ints); + this.cipher.encrypt([0, 0, 0, 0], this._hashSubkey); + + // generate table M + // use 4-bit tables (32 component decomposition of a 16 byte value) + // 8-bit tables take more space and are known to have security + // vulnerabilities (in native implementations) + this.componentBits = 4; + this._m = this.generateHashTable(this._hashSubkey, this.componentBits); + + // Note: support IV length different from 96 bits? (only supporting + // 96 bits is recommended by NIST SP-800-38D) + // generate J_0 + var ivLength = iv.length(); + if(ivLength === 12) { + // 96-bit IV + this._j0 = [iv.getInt32(), iv.getInt32(), iv.getInt32(), 1]; + } else { + // IV is NOT 96-bits + this._j0 = [0, 0, 0, 0]; + while(iv.length() > 0) { + this._j0 = this.ghash( + this._hashSubkey, this._j0, + [iv.getInt32(), iv.getInt32(), iv.getInt32(), iv.getInt32()]); + } + this._j0 = this.ghash( + this._hashSubkey, this._j0, [0, 0].concat(from64To32(ivLength * 8))); + } + + // generate ICB (initial counter block) + this._inBlock = this._j0.slice(0); + inc32(this._inBlock); + this._partialBytes = 0; + + // consume authentication data + additionalData = forge.util.createBuffer(additionalData); + // save additional data length as a BE 64-bit number + this._aDataLength = from64To32(additionalData.length() * 8); + // pad additional data to 128 bit (16 byte) block size + var overflow = additionalData.length() % this.blockSize; + if(overflow) { + additionalData.fillWithByte(0, this.blockSize - overflow); + } + this._s = [0, 0, 0, 0]; + while(additionalData.length() > 0) { + this._s = this.ghash(this._hashSubkey, this._s, [ + additionalData.getInt32(), + additionalData.getInt32(), + additionalData.getInt32(), + additionalData.getInt32() + ]); + } +}; + +modes.gcm.prototype.encrypt = function(input, output, finish) { + // not enough input to encrypt + var inputLength = input.length(); + if(inputLength === 0) { + return true; + } + + // encrypt block + this.cipher.encrypt(this._inBlock, this._outBlock); + + // handle full block + if(this._partialBytes === 0 && inputLength >= this.blockSize) { + // XOR input with output + for(var i = 0; i < this._ints; ++i) { + output.putInt32(this._outBlock[i] ^= input.getInt32()); + } + this._cipherLength += this.blockSize; + } else { + // handle partial block + var partialBytes = (this.blockSize - inputLength) % this.blockSize; + if(partialBytes > 0) { + partialBytes = this.blockSize - partialBytes; + } + + // XOR input with output + this._partialOutput.clear(); + for(var i = 0; i < this._ints; ++i) { + this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); + } + + if(partialBytes <= 0 || finish) { + // handle overflow prior to hashing + if(finish) { + // get block overflow + var overflow = inputLength % this.blockSize; + this._cipherLength += overflow; + // truncate for hash function + this._partialOutput.truncate(this.blockSize - overflow); + } else { + this._cipherLength += this.blockSize; + } + + // get output block for hashing + for(var i = 0; i < this._ints; ++i) { + this._outBlock[i] = this._partialOutput.getInt32(); + } + this._partialOutput.read -= this.blockSize; + } + + // skip any previous partial bytes + if(this._partialBytes > 0) { + this._partialOutput.getBytes(this._partialBytes); + } + + if(partialBytes > 0 && !finish) { + // block still incomplete, restore input buffer, get partial output, + // and return early + input.read -= this.blockSize; + output.putBytes(this._partialOutput.getBytes( + partialBytes - this._partialBytes)); + this._partialBytes = partialBytes; + return true; + } + + output.putBytes(this._partialOutput.getBytes( + inputLength - this._partialBytes)); + this._partialBytes = 0; + } + + // update hash block S + this._s = this.ghash(this._hashSubkey, this._s, this._outBlock); + + // increment counter (input block) + inc32(this._inBlock); +}; + +modes.gcm.prototype.decrypt = function(input, output, finish) { + // not enough input to decrypt + var inputLength = input.length(); + if(inputLength < this.blockSize && !(finish && inputLength > 0)) { + return true; + } + + // encrypt block (GCM always uses encryption mode) + this.cipher.encrypt(this._inBlock, this._outBlock); + + // increment counter (input block) + inc32(this._inBlock); + + // update hash block S + this._hashBlock[0] = input.getInt32(); + this._hashBlock[1] = input.getInt32(); + this._hashBlock[2] = input.getInt32(); + this._hashBlock[3] = input.getInt32(); + this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock); + + // XOR hash input with output + for(var i = 0; i < this._ints; ++i) { + output.putInt32(this._outBlock[i] ^ this._hashBlock[i]); + } + + // increment cipher data length + if(inputLength < this.blockSize) { + this._cipherLength += inputLength % this.blockSize; + } else { + this._cipherLength += this.blockSize; + } +}; + +modes.gcm.prototype.afterFinish = function(output, options) { + var rval = true; + + // handle overflow + if(options.decrypt && options.overflow) { + output.truncate(this.blockSize - options.overflow); + } + + // handle authentication tag + this.tag = forge.util.createBuffer(); + + // concatenate additional data length with cipher length + var lengths = this._aDataLength.concat(from64To32(this._cipherLength * 8)); + + // include lengths in hash + this._s = this.ghash(this._hashSubkey, this._s, lengths); + + // do GCTR(J_0, S) + var tag = []; + this.cipher.encrypt(this._j0, tag); + for(var i = 0; i < this._ints; ++i) { + this.tag.putInt32(this._s[i] ^ tag[i]); + } + + // trim tag to length + this.tag.truncate(this.tag.length() % (this._tagLength / 8)); + + // check authentication tag + if(options.decrypt && this.tag.bytes() !== this._tag) { + rval = false; + } + + return rval; +}; + +/** + * See NIST SP-800-38D 6.3 (Algorithm 1). This function performs Galois + * field multiplication. The field, GF(2^128), is defined by the polynomial: + * + * x^128 + x^7 + x^2 + x + 1 + * + * Which is represented in little-endian binary form as: 11100001 (0xe1). When + * the value of a coefficient is 1, a bit is set. The value R, is the + * concatenation of this value and 120 zero bits, yielding a 128-bit value + * which matches the block size. + * + * This function will multiply two elements (vectors of bytes), X and Y, in + * the field GF(2^128). The result is initialized to zero. For each bit of + * X (out of 128), x_i, if x_i is set, then the result is multiplied (XOR'd) + * by the current value of Y. For each bit, the value of Y will be raised by + * a power of x (multiplied by the polynomial x). This can be achieved by + * shifting Y once to the right. If the current value of Y, prior to being + * multiplied by x, has 0 as its LSB, then it is a 127th degree polynomial. + * Otherwise, we must divide by R after shifting to find the remainder. + * + * @param x the first block to multiply by the second. + * @param y the second block to multiply by the first. + * + * @return the block result of the multiplication. + */ +modes.gcm.prototype.multiply = function(x, y) { + var z_i = [0, 0, 0, 0]; + var v_i = y.slice(0); + + // calculate Z_128 (block has 128 bits) + for(var i = 0; i < 128; ++i) { + // if x_i is 0, Z_{i+1} = Z_i (unchanged) + // else Z_{i+1} = Z_i ^ V_i + // get x_i by finding 32-bit int position, then left shift 1 by remainder + var x_i = x[(i / 32) | 0] & (1 << (31 - i % 32)); + if(x_i) { + z_i[0] ^= v_i[0]; + z_i[1] ^= v_i[1]; + z_i[2] ^= v_i[2]; + z_i[3] ^= v_i[3]; + } + + // if LSB(V_i) is 1, V_i = V_i >> 1 + // else V_i = (V_i >> 1) ^ R + this.pow(v_i, v_i); + } + + return z_i; +}; + +modes.gcm.prototype.pow = function(x, out) { + // if LSB(x) is 1, x = x >>> 1 + // else x = (x >>> 1) ^ R + var lsb = x[3] & 1; + + // always do x >>> 1: + // starting with the rightmost integer, shift each integer to the right + // one bit, pulling in the bit from the integer to the left as its top + // most bit (do this for the last 3 integers) + for(var i = 3; i > 0; --i) { + out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31); + } + // shift the first integer normally + out[0] = x[0] >>> 1; + + // if lsb was not set, then polynomial had a degree of 127 and doesn't + // need to divided; otherwise, XOR with R to find the remainder; we only + // need to XOR the first integer since R technically ends w/120 zero bits + if(lsb) { + out[0] ^= this._R; + } +}; + +modes.gcm.prototype.tableMultiply = function(x) { + // assumes 4-bit tables are used + var z = [0, 0, 0, 0]; + for(var i = 0; i < 32; ++i) { + var idx = (i / 8) | 0; + var x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF; + var ah = this._m[i][x_i]; + z[0] ^= ah[0]; + z[1] ^= ah[1]; + z[2] ^= ah[2]; + z[3] ^= ah[3]; + } + return z; +}; + +/** + * A continuing version of the GHASH algorithm that operates on a single + * block. The hash block, last hash value (Ym) and the new block to hash + * are given. + * + * @param h the hash block. + * @param y the previous value for Ym, use [0, 0, 0, 0] for a new hash. + * @param x the block to hash. + * + * @return the hashed value (Ym). + */ +modes.gcm.prototype.ghash = function(h, y, x) { + y[0] ^= x[0]; + y[1] ^= x[1]; + y[2] ^= x[2]; + y[3] ^= x[3]; + return this.tableMultiply(y); + //return this.multiply(y, h); +}; + +/** + * Precomputes a table for multiplying against the hash subkey. This + * mechanism provides a substantial speed increase over multiplication + * performed without a table. The table-based multiplication this table is + * for solves X * H by multiplying each component of X by H and then + * composing the results together using XOR. + * + * This function can be used to generate tables with different bit sizes + * for the components, however, this implementation assumes there are + * 32 components of X (which is a 16 byte vector), therefore each component + * takes 4-bits (so the table is constructed with bits=4). + * + * @param h the hash subkey. + * @param bits the bit size for a component. + */ +modes.gcm.prototype.generateHashTable = function(h, bits) { + // TODO: There are further optimizations that would use only the + // first table M_0 (or some variant) along with a remainder table; + // this can be explored in the future + var multiplier = 8 / bits; + var perInt = 4 * multiplier; + var size = 16 * multiplier; + var m = new Array(size); + for(var i = 0; i < size; ++i) { + var tmp = [0, 0, 0, 0]; + var idx = (i / perInt) | 0; + var shft = ((perInt - 1 - (i % perInt)) * bits); + tmp[idx] = (1 << (bits - 1)) << shft; + m[i] = this.generateSubHashTable(this.multiply(tmp, h), bits); + } + return m; +}; + +/** + * Generates a table for multiplying against the hash subkey for one + * particular component (out of all possible component values). + * + * @param mid the pre-multiplied value for the middle key of the table. + * @param bits the bit size for a component. + */ +modes.gcm.prototype.generateSubHashTable = function(mid, bits) { + // compute the table quickly by minimizing the number of + // POW operations -- they only need to be performed for powers of 2, + // all other entries can be composed from those powers using XOR + var size = 1 << bits; + var half = size >>> 1; + var m = new Array(size); + m[half] = mid.slice(0); + var i = half >>> 1; + while(i > 0) { + // raise m0[2 * i] and store in m0[i] + this.pow(m[2 * i], m[i] = []); + i >>= 1; + } + i = 2; + while(i < half) { + for(var j = 1; j < i; ++j) { + var m_i = m[i]; + var m_j = m[j]; + m[i + j] = [ + m_i[0] ^ m_j[0], + m_i[1] ^ m_j[1], + m_i[2] ^ m_j[2], + m_i[3] ^ m_j[3] + ]; + } + i *= 2; + } + m[0] = [0, 0, 0, 0]; + /* Note: We could avoid storing these by doing composition during multiply + calculate top half using composition by speed is preferred. */ + for(i = half + 1; i < size; ++i) { + var c = m[i ^ half]; + m[i] = [mid[0] ^ c[0], mid[1] ^ c[1], mid[2] ^ c[2], mid[3] ^ c[3]]; + } + return m; +}; + +/** Utility functions */ + +function transformIV(iv, blockSize) { + if(typeof iv === 'string') { + // convert iv string into byte buffer + iv = forge.util.createBuffer(iv); + } + + if(forge.util.isArray(iv) && iv.length > 4) { + // convert iv byte array into byte buffer + var tmp = iv; + iv = forge.util.createBuffer(); + for(var i = 0; i < tmp.length; ++i) { + iv.putByte(tmp[i]); + } + } + + if(iv.length() < blockSize) { + throw new Error( + 'Invalid IV length; got ' + iv.length() + + ' bytes and expected ' + blockSize + ' bytes.'); + } + + if(!forge.util.isArray(iv)) { + // convert iv byte buffer into 32-bit integer array + var ints = []; + var blocks = blockSize / 4; + for(var i = 0; i < blocks; ++i) { + ints.push(iv.getInt32()); + } + iv = ints; + } + + return iv; +} + +function inc32(block) { + // increment last 32 bits of block only + block[block.length - 1] = (block[block.length - 1] + 1) & 0xFFFFFFFF; +} + +function from64To32(num) { + // convert 64-bit number to two BE Int32s + return [(num / 0x100000000) | 0, num & 0xFFFFFFFF]; +} + + +/***/ }), + +/***/ 3480: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * DES (Data Encryption Standard) implementation. + * + * This implementation supports DES as well as 3DES-EDE in ECB and CBC mode. + * It is based on the BSD-licensed implementation by Paul Tero: + * + * Paul Tero, July 2001 + * http://www.tero.co.uk/des/ + * + * Optimised for performance with large blocks by + * Michael Hayworth, November 2001 + * http://www.netdealing.com + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @author Stefan Siegl + * @author Dave Longley + * + * Copyright (c) 2012 Stefan Siegl + * Copyright (c) 2012-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(5649); +__webpack_require__(1967); +__webpack_require__(7116); + +/* DES API */ +module.exports = forge.des = forge.des || {}; + +/** + * Deprecated. Instead, use: + * + * var cipher = forge.cipher.createCipher('DES-', key); + * cipher.start({iv: iv}); + * + * Creates an DES cipher object to encrypt data using the given symmetric key. + * The output will be stored in the 'output' member of the returned cipher. + * + * The key and iv may be given as binary-encoded strings of bytes or + * byte buffers. + * + * @param key the symmetric key to use (64 or 192 bits). + * @param iv the initialization vector to use. + * @param output the buffer to write to, null to create one. + * @param mode the cipher mode to use (default: 'CBC' if IV is + * given, 'ECB' if null). + * + * @return the cipher. + */ +forge.des.startEncrypting = function(key, iv, output, mode) { + var cipher = _createCipher({ + key: key, + output: output, + decrypt: false, + mode: mode || (iv === null ? 'ECB' : 'CBC') + }); + cipher.start(iv); + return cipher; +}; + +/** + * Deprecated. Instead, use: + * + * var cipher = forge.cipher.createCipher('DES-', key); + * + * Creates an DES cipher object to encrypt data using the given symmetric key. + * + * The key may be given as a binary-encoded string of bytes or a byte buffer. + * + * @param key the symmetric key to use (64 or 192 bits). + * @param mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +forge.des.createEncryptionCipher = function(key, mode) { + return _createCipher({ + key: key, + output: null, + decrypt: false, + mode: mode + }); +}; + +/** + * Deprecated. Instead, use: + * + * var decipher = forge.cipher.createDecipher('DES-', key); + * decipher.start({iv: iv}); + * + * Creates an DES cipher object to decrypt data using the given symmetric key. + * The output will be stored in the 'output' member of the returned cipher. + * + * The key and iv may be given as binary-encoded strings of bytes or + * byte buffers. + * + * @param key the symmetric key to use (64 or 192 bits). + * @param iv the initialization vector to use. + * @param output the buffer to write to, null to create one. + * @param mode the cipher mode to use (default: 'CBC' if IV is + * given, 'ECB' if null). + * + * @return the cipher. + */ +forge.des.startDecrypting = function(key, iv, output, mode) { + var cipher = _createCipher({ + key: key, + output: output, + decrypt: true, + mode: mode || (iv === null ? 'ECB' : 'CBC') + }); + cipher.start(iv); + return cipher; +}; + +/** + * Deprecated. Instead, use: + * + * var decipher = forge.cipher.createDecipher('DES-', key); + * + * Creates an DES cipher object to decrypt data using the given symmetric key. + * + * The key may be given as a binary-encoded string of bytes or a byte buffer. + * + * @param key the symmetric key to use (64 or 192 bits). + * @param mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +forge.des.createDecryptionCipher = function(key, mode) { + return _createCipher({ + key: key, + output: null, + decrypt: true, + mode: mode + }); +}; + +/** + * Creates a new DES cipher algorithm object. + * + * @param name the name of the algorithm. + * @param mode the mode factory function. + * + * @return the DES algorithm object. + */ +forge.des.Algorithm = function(name, mode) { + var self = this; + self.name = name; + self.mode = new mode({ + blockSize: 8, + cipher: { + encrypt: function(inBlock, outBlock) { + return _updateBlock(self._keys, inBlock, outBlock, false); + }, + decrypt: function(inBlock, outBlock) { + return _updateBlock(self._keys, inBlock, outBlock, true); + } + } + }); + self._init = false; +}; + +/** + * Initializes this DES algorithm by expanding its key. + * + * @param options the options to use. + * key the key to use with this algorithm. + * decrypt true if the algorithm should be initialized for decryption, + * false for encryption. + */ +forge.des.Algorithm.prototype.initialize = function(options) { + if(this._init) { + return; + } + + var key = forge.util.createBuffer(options.key); + if(this.name.indexOf('3DES') === 0) { + if(key.length() !== 24) { + throw new Error('Invalid Triple-DES key size: ' + key.length() * 8); + } + } + + // do key expansion to 16 or 48 subkeys (single or triple DES) + this._keys = _createKeys(key); + this._init = true; +}; + +/** Register DES algorithms **/ + +registerAlgorithm('DES-ECB', forge.cipher.modes.ecb); +registerAlgorithm('DES-CBC', forge.cipher.modes.cbc); +registerAlgorithm('DES-CFB', forge.cipher.modes.cfb); +registerAlgorithm('DES-OFB', forge.cipher.modes.ofb); +registerAlgorithm('DES-CTR', forge.cipher.modes.ctr); + +registerAlgorithm('3DES-ECB', forge.cipher.modes.ecb); +registerAlgorithm('3DES-CBC', forge.cipher.modes.cbc); +registerAlgorithm('3DES-CFB', forge.cipher.modes.cfb); +registerAlgorithm('3DES-OFB', forge.cipher.modes.ofb); +registerAlgorithm('3DES-CTR', forge.cipher.modes.ctr); + +function registerAlgorithm(name, mode) { + var factory = function() { + return new forge.des.Algorithm(name, mode); + }; + forge.cipher.registerAlgorithm(name, factory); +} + +/** DES implementation **/ + +var spfunction1 = [0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004]; +var spfunction2 = [-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000]; +var spfunction3 = [0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200]; +var spfunction4 = [0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080]; +var spfunction5 = [0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100]; +var spfunction6 = [0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010]; +var spfunction7 = [0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002]; +var spfunction8 = [0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000]; + +/** + * Create necessary sub keys. + * + * @param key the 64-bit or 192-bit key. + * + * @return the expanded keys. + */ +function _createKeys(key) { + var pc2bytes0 = [0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204], + pc2bytes1 = [0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101], + pc2bytes2 = [0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808], + pc2bytes3 = [0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000], + pc2bytes4 = [0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010], + pc2bytes5 = [0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420], + pc2bytes6 = [0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002], + pc2bytes7 = [0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800], + pc2bytes8 = [0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002], + pc2bytes9 = [0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408], + pc2bytes10 = [0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020], + pc2bytes11 = [0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200], + pc2bytes12 = [0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010], + pc2bytes13 = [0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105]; + + // how many iterations (1 for des, 3 for triple des) + // changed by Paul 16/6/2007 to use Triple DES for 9+ byte keys + var iterations = key.length() > 8 ? 3 : 1; + + // stores the return keys + var keys = []; + + // now define the left shifts which need to be done + var shifts = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0]; + + var n = 0, tmp; + for(var j = 0; j < iterations; j++) { + var left = key.getInt32(); + var right = key.getInt32(); + + tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; + right ^= tmp; + left ^= (tmp << 4); + + tmp = ((right >>> -16) ^ left) & 0x0000ffff; + left ^= tmp; + right ^= (tmp << -16); + + tmp = ((left >>> 2) ^ right) & 0x33333333; + right ^= tmp; + left ^= (tmp << 2); + + tmp = ((right >>> -16) ^ left) & 0x0000ffff; + left ^= tmp; + right ^= (tmp << -16); + + tmp = ((left >>> 1) ^ right) & 0x55555555; + right ^= tmp; + left ^= (tmp << 1); + + tmp = ((right >>> 8) ^ left) & 0x00ff00ff; + left ^= tmp; + right ^= (tmp << 8); + + tmp = ((left >>> 1) ^ right) & 0x55555555; + right ^= tmp; + left ^= (tmp << 1); + + // right needs to be shifted and OR'd with last four bits of left + tmp = (left << 8) | ((right >>> 20) & 0x000000f0); + + // left needs to be put upside down + left = ((right << 24) | ((right << 8) & 0xff0000) | + ((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0)); + right = tmp; + + // now go through and perform these shifts on the left and right keys + for(var i = 0; i < shifts.length; ++i) { + //shift the keys either one or two bits to the left + if(shifts[i]) { + left = (left << 2) | (left >>> 26); + right = (right << 2) | (right >>> 26); + } else { + left = (left << 1) | (left >>> 27); + right = (right << 1) | (right >>> 27); + } + left &= -0xf; + right &= -0xf; + + // now apply PC-2, in such a way that E is easier when encrypting or + // decrypting this conversion will look like PC-2 except only the last 6 + // bits of each byte are used rather than 48 consecutive bits and the + // order of lines will be according to how the S selection functions will + // be applied: S2, S4, S6, S8, S1, S3, S5, S7 + var lefttmp = ( + pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf] | + pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf] | + pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf] | + pc2bytes6[(left >>> 4) & 0xf]); + var righttmp = ( + pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf] | + pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf] | + pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf] | + pc2bytes13[(right >>> 4) & 0xf]); + tmp = ((righttmp >>> 16) ^ lefttmp) & 0x0000ffff; + keys[n++] = lefttmp ^ tmp; + keys[n++] = righttmp ^ (tmp << 16); + } + } + + return keys; +} + +/** + * Updates a single block (1 byte) using DES. The update will either + * encrypt or decrypt the block. + * + * @param keys the expanded keys. + * @param input the input block (an array of 32-bit words). + * @param output the updated output block. + * @param decrypt true to decrypt the block, false to encrypt it. + */ +function _updateBlock(keys, input, output, decrypt) { + // set up loops for single or triple DES + var iterations = keys.length === 32 ? 3 : 9; + var looping; + if(iterations === 3) { + looping = decrypt ? [30, -2, -2] : [0, 32, 2]; + } else { + looping = (decrypt ? + [94, 62, -2, 32, 64, 2, 30, -2, -2] : + [0, 32, 2, 62, 30, -2, 64, 96, 2]); + } + + var tmp; + + var left = input[0]; + var right = input[1]; + + // first each 64 bit chunk of the message must be permuted according to IP + tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; + right ^= tmp; + left ^= (tmp << 4); + + tmp = ((left >>> 16) ^ right) & 0x0000ffff; + right ^= tmp; + left ^= (tmp << 16); + + tmp = ((right >>> 2) ^ left) & 0x33333333; + left ^= tmp; + right ^= (tmp << 2); + + tmp = ((right >>> 8) ^ left) & 0x00ff00ff; + left ^= tmp; + right ^= (tmp << 8); + + tmp = ((left >>> 1) ^ right) & 0x55555555; + right ^= tmp; + left ^= (tmp << 1); + + // rotate left 1 bit + left = ((left << 1) | (left >>> 31)); + right = ((right << 1) | (right >>> 31)); + + for(var j = 0; j < iterations; j += 3) { + var endloop = looping[j + 1]; + var loopinc = looping[j + 2]; + + // now go through and perform the encryption or decryption + for(var i = looping[j]; i != endloop; i += loopinc) { + var right1 = right ^ keys[i]; + var right2 = ((right >>> 4) | (right << 28)) ^ keys[i + 1]; + + // passing these bytes through the S selection functions + tmp = left; + left = right; + right = tmp ^ ( + spfunction2[(right1 >>> 24) & 0x3f] | + spfunction4[(right1 >>> 16) & 0x3f] | + spfunction6[(right1 >>> 8) & 0x3f] | + spfunction8[right1 & 0x3f] | + spfunction1[(right2 >>> 24) & 0x3f] | + spfunction3[(right2 >>> 16) & 0x3f] | + spfunction5[(right2 >>> 8) & 0x3f] | + spfunction7[right2 & 0x3f]); + } + // unreverse left and right + tmp = left; + left = right; + right = tmp; + } + + // rotate right 1 bit + left = ((left >>> 1) | (left << 31)); + right = ((right >>> 1) | (right << 31)); + + // now perform IP-1, which is IP in the opposite direction + tmp = ((left >>> 1) ^ right) & 0x55555555; + right ^= tmp; + left ^= (tmp << 1); + + tmp = ((right >>> 8) ^ left) & 0x00ff00ff; + left ^= tmp; + right ^= (tmp << 8); + + tmp = ((right >>> 2) ^ left) & 0x33333333; + left ^= tmp; + right ^= (tmp << 2); + + tmp = ((left >>> 16) ^ right) & 0x0000ffff; + right ^= tmp; + left ^= (tmp << 16); + + tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; + right ^= tmp; + left ^= (tmp << 4); + + output[0] = left; + output[1] = right; +} + +/** + * Deprecated. Instead, use: + * + * forge.cipher.createCipher('DES-', key); + * forge.cipher.createDecipher('DES-', key); + * + * Creates a deprecated DES cipher object. This object's mode will default to + * CBC (cipher-block-chaining). + * + * The key may be given as a binary-encoded string of bytes or a byte buffer. + * + * @param options the options to use. + * key the symmetric key to use (64 or 192 bits). + * output the buffer to write to. + * decrypt true for decryption, false for encryption. + * mode the cipher mode to use (default: 'CBC'). + * + * @return the cipher. + */ +function _createCipher(options) { + options = options || {}; + var mode = (options.mode || 'CBC').toUpperCase(); + var algorithm = 'DES-' + mode; + + var cipher; + if(options.decrypt) { + cipher = forge.cipher.createDecipher(algorithm, options.key); + } else { + cipher = forge.cipher.createCipher(algorithm, options.key); + } + + // backwards compatible start API + var start = cipher.start; + cipher.start = function(iv, options) { + // backwards compatibility: support second arg as output buffer + var output = null; + if(options instanceof forge.util.ByteBuffer) { + output = options; + options = {}; + } + options = options || {}; + options.output = output; + options.iv = iv; + start.call(cipher, options); + }; + + return cipher; +} + + +/***/ }), + +/***/ 69: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * JavaScript implementation of Ed25519. + * + * Copyright (c) 2017-2019 Digital Bazaar, Inc. + * + * This implementation is based on the most excellent TweetNaCl which is + * in the public domain. Many thanks to its contributors: + * + * https://github.com/dchest/tweetnacl-js + */ +var forge = __webpack_require__(3832); +__webpack_require__(5764); +__webpack_require__(9563); +__webpack_require__(3219); +__webpack_require__(7116); +var asn1Validator = __webpack_require__(9205); +var publicKeyValidator = asn1Validator.publicKeyValidator; +var privateKeyValidator = asn1Validator.privateKeyValidator; + +if(typeof BigInteger === 'undefined') { + var BigInteger = forge.jsbn.BigInteger; +} + +var ByteBuffer = forge.util.ByteBuffer; +var NativeBuffer = typeof Buffer === 'undefined' ? Uint8Array : Buffer; + +/* + * Ed25519 algorithms, see RFC 8032: + * https://tools.ietf.org/html/rfc8032 + */ +forge.pki = forge.pki || {}; +module.exports = forge.pki.ed25519 = forge.ed25519 = forge.ed25519 || {}; +var ed25519 = forge.ed25519; + +ed25519.constants = {}; +ed25519.constants.PUBLIC_KEY_BYTE_LENGTH = 32; +ed25519.constants.PRIVATE_KEY_BYTE_LENGTH = 64; +ed25519.constants.SEED_BYTE_LENGTH = 32; +ed25519.constants.SIGN_BYTE_LENGTH = 64; +ed25519.constants.HASH_BYTE_LENGTH = 64; + +ed25519.generateKeyPair = function(options) { + options = options || {}; + var seed = options.seed; + if(seed === undefined) { + // generate seed + seed = forge.random.getBytesSync(ed25519.constants.SEED_BYTE_LENGTH); + } else if(typeof seed === 'string') { + if(seed.length !== ed25519.constants.SEED_BYTE_LENGTH) { + throw new TypeError( + '"seed" must be ' + ed25519.constants.SEED_BYTE_LENGTH + + ' bytes in length.'); + } + } else if(!(seed instanceof Uint8Array)) { + throw new TypeError( + '"seed" must be a node.js Buffer, Uint8Array, or a binary string.'); + } + + seed = messageToNativeBuffer({message: seed, encoding: 'binary'}); + + var pk = new NativeBuffer(ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); + var sk = new NativeBuffer(ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); + for(var i = 0; i < 32; ++i) { + sk[i] = seed[i]; + } + crypto_sign_keypair(pk, sk); + return {publicKey: pk, privateKey: sk}; +}; + +/** + * Converts a private key from a RFC8410 ASN.1 encoding. + * + * @param obj - The asn1 representation of a private key. + * + * @returns {Object} keyInfo - The key information. + * @returns {Buffer|Uint8Array} keyInfo.privateKeyBytes - 32 private key bytes. + */ +ed25519.privateKeyFromAsn1 = function(obj) { + var capture = {}; + var errors = []; + var valid = forge.asn1.validate(obj, privateKeyValidator, capture, errors); + if(!valid) { + var error = new Error('Invalid Key.'); + error.errors = errors; + throw error; + } + var oid = forge.asn1.derToOid(capture.privateKeyOid); + var ed25519Oid = forge.oids.EdDSA25519; + if(oid !== ed25519Oid) { + throw new Error('Invalid OID "' + oid + '"; OID must be "' + + ed25519Oid + '".'); + } + var privateKey = capture.privateKey; + // manually extract the private key bytes from nested octet string, see FIXME: + // https://github.com/digitalbazaar/forge/blob/master/lib/asn1.js#L542 + var privateKeyBytes = messageToNativeBuffer({ + message: forge.asn1.fromDer(privateKey).value, + encoding: 'binary' + }); + // TODO: RFC8410 specifies a format for encoding the public key bytes along + // with the private key bytes. `publicKeyBytes` can be returned in the + // future. https://tools.ietf.org/html/rfc8410#section-10.3 + return {privateKeyBytes: privateKeyBytes}; +}; + +/** + * Converts a public key from a RFC8410 ASN.1 encoding. + * + * @param obj - The asn1 representation of a public key. + * + * @return {Buffer|Uint8Array} - 32 public key bytes. + */ +ed25519.publicKeyFromAsn1 = function(obj) { + // get SubjectPublicKeyInfo + var capture = {}; + var errors = []; + var valid = forge.asn1.validate(obj, publicKeyValidator, capture, errors); + if(!valid) { + var error = new Error('Invalid Key.'); + error.errors = errors; + throw error; + } + var oid = forge.asn1.derToOid(capture.publicKeyOid); + var ed25519Oid = forge.oids.EdDSA25519; + if(oid !== ed25519Oid) { + throw new Error('Invalid OID "' + oid + '"; OID must be "' + + ed25519Oid + '".'); + } + var publicKeyBytes = capture.ed25519PublicKey; + if(publicKeyBytes.length !== ed25519.constants.PUBLIC_KEY_BYTE_LENGTH) { + throw new Error('Key length is invalid.'); + } + return messageToNativeBuffer({ + message: publicKeyBytes, + encoding: 'binary' + }); +}; + +ed25519.publicKeyFromPrivateKey = function(options) { + options = options || {}; + var privateKey = messageToNativeBuffer({ + message: options.privateKey, encoding: 'binary' + }); + if(privateKey.length !== ed25519.constants.PRIVATE_KEY_BYTE_LENGTH) { + throw new TypeError( + '"options.privateKey" must have a byte length of ' + + ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); + } + + var pk = new NativeBuffer(ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); + for(var i = 0; i < pk.length; ++i) { + pk[i] = privateKey[32 + i]; + } + return pk; +}; + +ed25519.sign = function(options) { + options = options || {}; + var msg = messageToNativeBuffer(options); + var privateKey = messageToNativeBuffer({ + message: options.privateKey, + encoding: 'binary' + }); + if(privateKey.length === ed25519.constants.SEED_BYTE_LENGTH) { + var keyPair = ed25519.generateKeyPair({seed: privateKey}); + privateKey = keyPair.privateKey; + } else if(privateKey.length !== ed25519.constants.PRIVATE_KEY_BYTE_LENGTH) { + throw new TypeError( + '"options.privateKey" must have a byte length of ' + + ed25519.constants.SEED_BYTE_LENGTH + ' or ' + + ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); + } + + var signedMsg = new NativeBuffer( + ed25519.constants.SIGN_BYTE_LENGTH + msg.length); + crypto_sign(signedMsg, msg, msg.length, privateKey); + + var sig = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH); + for(var i = 0; i < sig.length; ++i) { + sig[i] = signedMsg[i]; + } + return sig; +}; + +ed25519.verify = function(options) { + options = options || {}; + var msg = messageToNativeBuffer(options); + if(options.signature === undefined) { + throw new TypeError( + '"options.signature" must be a node.js Buffer, a Uint8Array, a forge ' + + 'ByteBuffer, or a binary string.'); + } + var sig = messageToNativeBuffer({ + message: options.signature, + encoding: 'binary' + }); + if(sig.length !== ed25519.constants.SIGN_BYTE_LENGTH) { + throw new TypeError( + '"options.signature" must have a byte length of ' + + ed25519.constants.SIGN_BYTE_LENGTH); + } + var publicKey = messageToNativeBuffer({ + message: options.publicKey, + encoding: 'binary' + }); + if(publicKey.length !== ed25519.constants.PUBLIC_KEY_BYTE_LENGTH) { + throw new TypeError( + '"options.publicKey" must have a byte length of ' + + ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); + } + + var sm = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH + msg.length); + var m = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH + msg.length); + var i; + for(i = 0; i < ed25519.constants.SIGN_BYTE_LENGTH; ++i) { + sm[i] = sig[i]; + } + for(i = 0; i < msg.length; ++i) { + sm[i + ed25519.constants.SIGN_BYTE_LENGTH] = msg[i]; + } + return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); +}; + +function messageToNativeBuffer(options) { + var message = options.message; + if(message instanceof Uint8Array || message instanceof NativeBuffer) { + return message; + } + + var encoding = options.encoding; + if(message === undefined) { + if(options.md) { + // TODO: more rigorous validation that `md` is a MessageDigest + message = options.md.digest().getBytes(); + encoding = 'binary'; + } else { + throw new TypeError('"options.message" or "options.md" not specified.'); + } + } + + if(typeof message === 'string' && !encoding) { + throw new TypeError('"options.encoding" must be "binary" or "utf8".'); + } + + if(typeof message === 'string') { + if(typeof Buffer !== 'undefined') { + return Buffer.from(message, encoding); + } + message = new ByteBuffer(message, encoding); + } else if(!(message instanceof ByteBuffer)) { + throw new TypeError( + '"options.message" must be a node.js Buffer, a Uint8Array, a forge ' + + 'ByteBuffer, or a string with "options.encoding" specifying its ' + + 'encoding.'); + } + + // convert to native buffer + var buffer = new NativeBuffer(message.length()); + for(var i = 0; i < buffer.length; ++i) { + buffer[i] = message.at(i); + } + return buffer; +} + +var gf0 = gf(); +var gf1 = gf([1]); +var D = gf([ + 0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, + 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]); +var D2 = gf([ + 0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, + 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]); +var X = gf([ + 0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, + 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]); +var Y = gf([ + 0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, + 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]); +var L = new Float64Array([ + 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, + 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); +var I = gf([ + 0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, + 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); + +// TODO: update forge buffer implementation to use `Buffer` or `Uint8Array`, +// whichever is available, to improve performance +function sha512(msg, msgLen) { + // Note: `out` and `msg` are NativeBuffer + var md = forge.md.sha512.create(); + var buffer = new ByteBuffer(msg); + md.update(buffer.getBytes(msgLen), 'binary'); + var hash = md.digest().getBytes(); + if(typeof Buffer !== 'undefined') { + return Buffer.from(hash, 'binary'); + } + var out = new NativeBuffer(ed25519.constants.HASH_BYTE_LENGTH); + for(var i = 0; i < 64; ++i) { + out[i] = hash.charCodeAt(i); + } + return out; +} + +function crypto_sign_keypair(pk, sk) { + var p = [gf(), gf(), gf(), gf()]; + var i; + + var d = sha512(sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + scalarbase(p, d); + pack(pk, p); + + for(i = 0; i < 32; ++i) { + sk[i + 32] = pk[i]; + } + return 0; +} + +// Note: difference from C - smlen returned, not passed as argument. +function crypto_sign(sm, m, n, sk) { + var i, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; + + var d = sha512(sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + var smlen = n + 64; + for(i = 0; i < n; ++i) { + sm[64 + i] = m[i]; + } + for(i = 0; i < 32; ++i) { + sm[32 + i] = d[32 + i]; + } + + var r = sha512(sm.subarray(32), n + 32); + reduce(r); + scalarbase(p, r); + pack(sm, p); + + for(i = 32; i < 64; ++i) { + sm[i] = sk[i]; + } + var h = sha512(sm, n + 64); + reduce(h); + + for(i = 32; i < 64; ++i) { + x[i] = 0; + } + for(i = 0; i < 32; ++i) { + x[i] = r[i]; + } + for(i = 0; i < 32; ++i) { + for(j = 0; j < 32; j++) { + x[i + j] += h[i] * d[j]; + } + } + + modL(sm.subarray(32), x); + return smlen; +} + +function crypto_sign_open(m, sm, n, pk) { + var i, mlen; + var t = new NativeBuffer(32); + var p = [gf(), gf(), gf(), gf()], + q = [gf(), gf(), gf(), gf()]; + + mlen = -1; + if(n < 64) { + return -1; + } + + if(unpackneg(q, pk)) { + return -1; + } + + for(i = 0; i < n; ++i) { + m[i] = sm[i]; + } + for(i = 0; i < 32; ++i) { + m[i + 32] = pk[i]; + } + var h = sha512(m, n); + reduce(h); + scalarmult(p, q, h); + + scalarbase(q, sm.subarray(32)); + add(p, q); + pack(t, p); + + n -= 64; + if(crypto_verify_32(sm, 0, t, 0)) { + for(i = 0; i < n; ++i) { + m[i] = 0; + } + return -1; + } + + for(i = 0; i < n; ++i) { + m[i] = sm[i + 64]; + } + mlen = n; + return mlen; +} + +function modL(r, x) { + var carry, i, j, k; + for(i = 63; i >= 32; --i) { + carry = 0; + for(j = i - 32, k = i - 12; j < k; ++j) { + x[j] += carry - 16 * x[i] * L[j - (i - 32)]; + carry = (x[j] + 128) >> 8; + x[j] -= carry * 256; + } + x[j] += carry; + x[i] = 0; + } + carry = 0; + for(j = 0; j < 32; ++j) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for(j = 0; j < 32; ++j) { + x[j] -= carry * L[j]; + } + for(i = 0; i < 32; ++i) { + x[i + 1] += x[i] >> 8; + r[i] = x[i] & 255; + } +} + +function reduce(r) { + var x = new Float64Array(64); + for(var i = 0; i < 64; ++i) { + x[i] = r[i]; + r[i] = 0; + } + modL(r, x); +} + +function add(p, q) { + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(), + g = gf(), h = gf(), t = gf(); + + Z(a, p[1], p[0]); + Z(t, q[1], q[0]); + M(a, a, t); + A(b, p[0], p[1]); + A(t, q[0], q[1]); + M(b, b, t); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e, b, a); + Z(f, d, c); + A(g, d, c); + A(h, b, a); + + M(p[0], e, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e, h); +} + +function cswap(p, q, b) { + for(var i = 0; i < 4; ++i) { + sel25519(p[i], q[i], b); + } +} + +function pack(r, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r, ty); + r[31] ^= par25519(tx) << 7; +} + +function pack25519(o, n) { + var i, j, b; + var m = gf(), t = gf(); + for(i = 0; i < 16; ++i) { + t[i] = n[i]; + } + car25519(t); + car25519(t); + car25519(t); + for(j = 0; j < 2; ++j) { + m[0] = t[0] - 0xffed; + for(i = 1; i < 15; ++i) { + m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1); + m[i-1] &= 0xffff; + } + m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1); + b = (m[15] >> 16) & 1; + m[14] &= 0xffff; + sel25519(t, m, 1 - b); + } + for (i = 0; i < 16; i++) { + o[2 * i] = t[i] & 0xff; + o[2 * i + 1] = t[i] >> 8; + } +} + +function unpackneg(r, p) { + var t = gf(), chk = gf(), num = gf(), + den = gf(), den2 = gf(), den4 = gf(), + den6 = gf(); + + set25519(r[2], gf1); + unpack25519(r[1], p); + S(num, r[1]); + M(den, num, D); + Z(num, num, r[2]); + A(den, r[2], den); + + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t, den6, num); + M(t, t, den); + + pow2523(t, t); + M(t, t, num); + M(t, t, den); + M(t, t, den); + M(r[0], t, den); + + S(chk, r[0]); + M(chk, chk, den); + if(neq25519(chk, num)) { + M(r[0], r[0], I); + } + + S(chk, r[0]); + M(chk, chk, den); + if(neq25519(chk, num)) { + return -1; + } + + if(par25519(r[0]) === (p[31] >> 7)) { + Z(r[0], gf0, r[0]); + } + + M(r[3], r[0], r[1]); + return 0; +} + +function unpack25519(o, n) { + var i; + for(i = 0; i < 16; ++i) { + o[i] = n[2 * i] + (n[2 * i + 1] << 8); + } + o[15] &= 0x7fff; +} + +function pow2523(o, i) { + var c = gf(); + var a; + for(a = 0; a < 16; ++a) { + c[a] = i[a]; + } + for(a = 250; a >= 0; --a) { + S(c, c); + if(a !== 1) { + M(c, c, i); + } + } + for(a = 0; a < 16; ++a) { + o[a] = c[a]; + } +} + +function neq25519(a, b) { + var c = new NativeBuffer(32); + var d = new NativeBuffer(32); + pack25519(c, a); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); +} + +function crypto_verify_32(x, xi, y, yi) { + return vn(x, xi, y, yi, 32); +} + +function vn(x, xi, y, yi, n) { + var i, d = 0; + for(i = 0; i < n; ++i) { + d |= x[xi + i] ^ y[yi + i]; + } + return (1 & ((d - 1) >>> 8)) - 1; +} + +function par25519(a) { + var d = new NativeBuffer(32); + pack25519(d, a); + return d[0] & 1; +} + +function scalarmult(p, q, s) { + var b, i; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for(i = 255; i >= 0; --i) { + b = (s[(i / 8)|0] >> (i & 7)) & 1; + cswap(p, q, b); + add(q, p); + add(p, p); + cswap(p, q, b); + } +} + +function scalarbase(p, s) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s); +} + +function set25519(r, a) { + var i; + for(i = 0; i < 16; i++) { + r[i] = a[i] | 0; + } +} + +function inv25519(o, i) { + var c = gf(); + var a; + for(a = 0; a < 16; ++a) { + c[a] = i[a]; + } + for(a = 253; a >= 0; --a) { + S(c, c); + if(a !== 2 && a !== 4) { + M(c, c, i); + } + } + for(a = 0; a < 16; ++a) { + o[a] = c[a]; + } +} + +function car25519(o) { + var i, v, c = 1; + for(i = 0; i < 16; ++i) { + v = o[i] + c + 65535; + c = Math.floor(v / 65536); + o[i] = v - c * 65536; + } + o[0] += c - 1 + 37 * (c - 1); +} + +function sel25519(p, q, b) { + var t, c = ~(b - 1); + for(var i = 0; i < 16; ++i) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; + } +} + +function gf(init) { + var i, r = new Float64Array(16); + if(init) { + for(i = 0; i < init.length; ++i) { + r[i] = init[i]; + } + } + return r; +} + +function A(o, a, b) { + for(var i = 0; i < 16; ++i) { + o[i] = a[i] + b[i]; + } +} + +function Z(o, a, b) { + for(var i = 0; i < 16; ++i) { + o[i] = a[i] - b[i]; + } +} + +function S(o, a) { + M(o, a, a); +} + +function M(o, a, b) { + var v, c, + t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, + t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, + t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, + t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, + b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3], + b4 = b[4], + b5 = b[5], + b6 = b[6], + b7 = b[7], + b8 = b[8], + b9 = b[9], + b10 = b[10], + b11 = b[11], + b12 = b[12], + b13 = b[13], + b14 = b[14], + b15 = b[15]; + + v = a[0]; + t0 += v * b0; + t1 += v * b1; + t2 += v * b2; + t3 += v * b3; + t4 += v * b4; + t5 += v * b5; + t6 += v * b6; + t7 += v * b7; + t8 += v * b8; + t9 += v * b9; + t10 += v * b10; + t11 += v * b11; + t12 += v * b12; + t13 += v * b13; + t14 += v * b14; + t15 += v * b15; + v = a[1]; + t1 += v * b0; + t2 += v * b1; + t3 += v * b2; + t4 += v * b3; + t5 += v * b4; + t6 += v * b5; + t7 += v * b6; + t8 += v * b7; + t9 += v * b8; + t10 += v * b9; + t11 += v * b10; + t12 += v * b11; + t13 += v * b12; + t14 += v * b13; + t15 += v * b14; + t16 += v * b15; + v = a[2]; + t2 += v * b0; + t3 += v * b1; + t4 += v * b2; + t5 += v * b3; + t6 += v * b4; + t7 += v * b5; + t8 += v * b6; + t9 += v * b7; + t10 += v * b8; + t11 += v * b9; + t12 += v * b10; + t13 += v * b11; + t14 += v * b12; + t15 += v * b13; + t16 += v * b14; + t17 += v * b15; + v = a[3]; + t3 += v * b0; + t4 += v * b1; + t5 += v * b2; + t6 += v * b3; + t7 += v * b4; + t8 += v * b5; + t9 += v * b6; + t10 += v * b7; + t11 += v * b8; + t12 += v * b9; + t13 += v * b10; + t14 += v * b11; + t15 += v * b12; + t16 += v * b13; + t17 += v * b14; + t18 += v * b15; + v = a[4]; + t4 += v * b0; + t5 += v * b1; + t6 += v * b2; + t7 += v * b3; + t8 += v * b4; + t9 += v * b5; + t10 += v * b6; + t11 += v * b7; + t12 += v * b8; + t13 += v * b9; + t14 += v * b10; + t15 += v * b11; + t16 += v * b12; + t17 += v * b13; + t18 += v * b14; + t19 += v * b15; + v = a[5]; + t5 += v * b0; + t6 += v * b1; + t7 += v * b2; + t8 += v * b3; + t9 += v * b4; + t10 += v * b5; + t11 += v * b6; + t12 += v * b7; + t13 += v * b8; + t14 += v * b9; + t15 += v * b10; + t16 += v * b11; + t17 += v * b12; + t18 += v * b13; + t19 += v * b14; + t20 += v * b15; + v = a[6]; + t6 += v * b0; + t7 += v * b1; + t8 += v * b2; + t9 += v * b3; + t10 += v * b4; + t11 += v * b5; + t12 += v * b6; + t13 += v * b7; + t14 += v * b8; + t15 += v * b9; + t16 += v * b10; + t17 += v * b11; + t18 += v * b12; + t19 += v * b13; + t20 += v * b14; + t21 += v * b15; + v = a[7]; + t7 += v * b0; + t8 += v * b1; + t9 += v * b2; + t10 += v * b3; + t11 += v * b4; + t12 += v * b5; + t13 += v * b6; + t14 += v * b7; + t15 += v * b8; + t16 += v * b9; + t17 += v * b10; + t18 += v * b11; + t19 += v * b12; + t20 += v * b13; + t21 += v * b14; + t22 += v * b15; + v = a[8]; + t8 += v * b0; + t9 += v * b1; + t10 += v * b2; + t11 += v * b3; + t12 += v * b4; + t13 += v * b5; + t14 += v * b6; + t15 += v * b7; + t16 += v * b8; + t17 += v * b9; + t18 += v * b10; + t19 += v * b11; + t20 += v * b12; + t21 += v * b13; + t22 += v * b14; + t23 += v * b15; + v = a[9]; + t9 += v * b0; + t10 += v * b1; + t11 += v * b2; + t12 += v * b3; + t13 += v * b4; + t14 += v * b5; + t15 += v * b6; + t16 += v * b7; + t17 += v * b8; + t18 += v * b9; + t19 += v * b10; + t20 += v * b11; + t21 += v * b12; + t22 += v * b13; + t23 += v * b14; + t24 += v * b15; + v = a[10]; + t10 += v * b0; + t11 += v * b1; + t12 += v * b2; + t13 += v * b3; + t14 += v * b4; + t15 += v * b5; + t16 += v * b6; + t17 += v * b7; + t18 += v * b8; + t19 += v * b9; + t20 += v * b10; + t21 += v * b11; + t22 += v * b12; + t23 += v * b13; + t24 += v * b14; + t25 += v * b15; + v = a[11]; + t11 += v * b0; + t12 += v * b1; + t13 += v * b2; + t14 += v * b3; + t15 += v * b4; + t16 += v * b5; + t17 += v * b6; + t18 += v * b7; + t19 += v * b8; + t20 += v * b9; + t21 += v * b10; + t22 += v * b11; + t23 += v * b12; + t24 += v * b13; + t25 += v * b14; + t26 += v * b15; + v = a[12]; + t12 += v * b0; + t13 += v * b1; + t14 += v * b2; + t15 += v * b3; + t16 += v * b4; + t17 += v * b5; + t18 += v * b6; + t19 += v * b7; + t20 += v * b8; + t21 += v * b9; + t22 += v * b10; + t23 += v * b11; + t24 += v * b12; + t25 += v * b13; + t26 += v * b14; + t27 += v * b15; + v = a[13]; + t13 += v * b0; + t14 += v * b1; + t15 += v * b2; + t16 += v * b3; + t17 += v * b4; + t18 += v * b5; + t19 += v * b6; + t20 += v * b7; + t21 += v * b8; + t22 += v * b9; + t23 += v * b10; + t24 += v * b11; + t25 += v * b12; + t26 += v * b13; + t27 += v * b14; + t28 += v * b15; + v = a[14]; + t14 += v * b0; + t15 += v * b1; + t16 += v * b2; + t17 += v * b3; + t18 += v * b4; + t19 += v * b5; + t20 += v * b6; + t21 += v * b7; + t22 += v * b8; + t23 += v * b9; + t24 += v * b10; + t25 += v * b11; + t26 += v * b12; + t27 += v * b13; + t28 += v * b14; + t29 += v * b15; + v = a[15]; + t15 += v * b0; + t16 += v * b1; + t17 += v * b2; + t18 += v * b3; + t19 += v * b4; + t20 += v * b5; + t21 += v * b6; + t22 += v * b7; + t23 += v * b8; + t24 += v * b9; + t25 += v * b10; + t26 += v * b11; + t27 += v * b12; + t28 += v * b13; + t29 += v * b14; + t30 += v * b15; + + t0 += 38 * t16; + t1 += 38 * t17; + t2 += 38 * t18; + t3 += 38 * t19; + t4 += 38 * t20; + t5 += 38 * t21; + t6 += 38 * t22; + t7 += 38 * t23; + t8 += 38 * t24; + t9 += 38 * t25; + t10 += 38 * t26; + t11 += 38 * t27; + t12 += 38 * t28; + t13 += 38 * t29; + t14 += 38 * t30; + // t15 left as is + + // first car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + // second car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + o[ 0] = t0; + o[ 1] = t1; + o[ 2] = t2; + o[ 3] = t3; + o[ 4] = t4; + o[ 5] = t5; + o[ 6] = t6; + o[ 7] = t7; + o[ 8] = t8; + o[ 9] = t9; + o[10] = t10; + o[11] = t11; + o[12] = t12; + o[13] = t13; + o[14] = t14; + o[15] = t15; +} + + +/***/ }), + +/***/ 3832: +/***/ (function(module) { + +/** + * Node.js module for Forge. + * + * @author Dave Longley + * + * Copyright 2011-2016 Digital Bazaar, Inc. + */ +module.exports = { + // default options + options: { + usePureJavaScript: false + } +}; + + +/***/ }), + +/***/ 6607: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Hash-based Message Authentication Code implementation. Requires a message + * digest object that can be obtained, for example, from forge.md.sha1 or + * forge.md.md5. + * + * @author Dave Longley + * + * Copyright (c) 2010-2012 Digital Bazaar, Inc. All rights reserved. + */ +var forge = __webpack_require__(3832); +__webpack_require__(8991); +__webpack_require__(7116); + +/* HMAC API */ +var hmac = module.exports = forge.hmac = forge.hmac || {}; + +/** + * Creates an HMAC object that uses the given message digest object. + * + * @return an HMAC object. + */ +hmac.create = function() { + // the hmac key to use + var _key = null; + + // the message digest to use + var _md = null; + + // the inner padding + var _ipadding = null; + + // the outer padding + var _opadding = null; + + // hmac context + var ctx = {}; + + /** + * Starts or restarts the HMAC with the given key and message digest. + * + * @param md the message digest to use, null to reuse the previous one, + * a string to use builtin 'sha1', 'md5', 'sha256'. + * @param key the key to use as a string, array of bytes, byte buffer, + * or null to reuse the previous key. + */ + ctx.start = function(md, key) { + if(md !== null) { + if(typeof md === 'string') { + // create builtin message digest + md = md.toLowerCase(); + if(md in forge.md.algorithms) { + _md = forge.md.algorithms[md].create(); + } else { + throw new Error('Unknown hash algorithm "' + md + '"'); + } + } else { + // store message digest + _md = md; + } + } + + if(key === null) { + // reuse previous key + key = _key; + } else { + if(typeof key === 'string') { + // convert string into byte buffer + key = forge.util.createBuffer(key); + } else if(forge.util.isArray(key)) { + // convert byte array into byte buffer + var tmp = key; + key = forge.util.createBuffer(); + for(var i = 0; i < tmp.length; ++i) { + key.putByte(tmp[i]); + } + } + + // if key is longer than blocksize, hash it + var keylen = key.length(); + if(keylen > _md.blockLength) { + _md.start(); + _md.update(key.bytes()); + key = _md.digest(); + } + + // mix key into inner and outer padding + // ipadding = [0x36 * blocksize] ^ key + // opadding = [0x5C * blocksize] ^ key + _ipadding = forge.util.createBuffer(); + _opadding = forge.util.createBuffer(); + keylen = key.length(); + for(var i = 0; i < keylen; ++i) { + var tmp = key.at(i); + _ipadding.putByte(0x36 ^ tmp); + _opadding.putByte(0x5C ^ tmp); + } + + // if key is shorter than blocksize, add additional padding + if(keylen < _md.blockLength) { + var tmp = _md.blockLength - keylen; + for(var i = 0; i < tmp; ++i) { + _ipadding.putByte(0x36); + _opadding.putByte(0x5C); + } + } + _key = key; + _ipadding = _ipadding.bytes(); + _opadding = _opadding.bytes(); + } + + // digest is done like so: hash(opadding | hash(ipadding | message)) + + // prepare to do inner hash + // hash(ipadding | message) + _md.start(); + _md.update(_ipadding); + }; + + /** + * Updates the HMAC with the given message bytes. + * + * @param bytes the bytes to update with. + */ + ctx.update = function(bytes) { + _md.update(bytes); + }; + + /** + * Produces the Message Authentication Code (MAC). + * + * @return a byte buffer containing the digest value. + */ + ctx.getMac = function() { + // digest is done like so: hash(opadding | hash(ipadding | message)) + // here we do the outer hashing + var inner = _md.digest().bytes(); + _md.start(); + _md.update(_opadding); + _md.update(inner); + return _md.digest(); + }; + // alias for getMac + ctx.digest = ctx.getMac; + + return ctx; +}; + + +/***/ }), + +/***/ 2079: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Node.js module for Forge. + * + * @author Dave Longley + * + * Copyright 2011-2016 Digital Bazaar, Inc. + */ +module.exports = __webpack_require__(3832); +__webpack_require__(8925); +__webpack_require__(6164); +__webpack_require__(3068); +__webpack_require__(5649); +__webpack_require__(3480); +__webpack_require__(69); +__webpack_require__(6607); +__webpack_require__(6366); +__webpack_require__(4145); +__webpack_require__(3389); +__webpack_require__(3453); +__webpack_require__(8960); +__webpack_require__(6953); +__webpack_require__(8936); +__webpack_require__(5147); +__webpack_require__(9437); +__webpack_require__(4742); +__webpack_require__(9654); +__webpack_require__(4933); +__webpack_require__(6007); +__webpack_require__(9563); +__webpack_require__(9372); +__webpack_require__(7173); +__webpack_require__(4311); +__webpack_require__(7116); + + +/***/ }), + +/***/ 5764: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// Copyright (c) 2005 Tom Wu +// All Rights Reserved. +// See "LICENSE" for details. + +// Basic JavaScript BN library - subset useful for RSA encryption. + +/* +Licensing (LICENSE) +------------------- + +This software is covered under the following copyright: +*/ +/* + * Copyright (c) 2003-2005 Tom Wu + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following condition applies: + * + * All redistributions must retain an intact copy of this copyright notice + * and disclaimer. + */ +/* +Address all questions regarding this license to: + + Tom Wu + tjw@cs.Stanford.EDU +*/ +var forge = __webpack_require__(3832); + +module.exports = forge.jsbn = forge.jsbn || {}; + +// Bits per digit +var dbits; + +// JavaScript engine analysis +var canary = 0xdeadbeefcafe; +var j_lm = ((canary&0xffffff)==0xefcafe); + +// (public) Constructor +function BigInteger(a,b,c) { + this.data = []; + if(a != null) + if("number" == typeof a) this.fromNumber(a,b,c); + else if(b == null && "string" != typeof a) this.fromString(a,256); + else this.fromString(a,b); +} +forge.jsbn.BigInteger = BigInteger; + +// return new, unset BigInteger +function nbi() { return new BigInteger(null); } + +// am: Compute w_j += (x*this_i), propagate carries, +// c is initial carry, returns final carry. +// c < 3*dvalue, x < 2*dvalue, this_i < dvalue +// We need to select the fastest one that works in this environment. + +// am1: use a single mult and divide to get the high bits, +// max digit bits should be 26 because +// max internal value = 2*dvalue^2-2*dvalue (< 2^53) +function am1(i,x,w,j,c,n) { + while(--n >= 0) { + var v = x*this.data[i++]+w.data[j]+c; + c = Math.floor(v/0x4000000); + w.data[j++] = v&0x3ffffff; + } + return c; +} +// am2 avoids a big mult-and-extract completely. +// Max digit bits should be <= 30 because we do bitwise ops +// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) +function am2(i,x,w,j,c,n) { + var xl = x&0x7fff, xh = x>>15; + while(--n >= 0) { + var l = this.data[i]&0x7fff; + var h = this.data[i++]>>15; + var m = xh*l+h*xl; + l = xl*l+((m&0x7fff)<<15)+w.data[j]+(c&0x3fffffff); + c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); + w.data[j++] = l&0x3fffffff; + } + return c; +} +// Alternately, set max digit bits to 28 since some +// browsers slow down when dealing with 32-bit numbers. +function am3(i,x,w,j,c,n) { + var xl = x&0x3fff, xh = x>>14; + while(--n >= 0) { + var l = this.data[i]&0x3fff; + var h = this.data[i++]>>14; + var m = xh*l+h*xl; + l = xl*l+((m&0x3fff)<<14)+w.data[j]+c; + c = (l>>28)+(m>>14)+xh*h; + w.data[j++] = l&0xfffffff; + } + return c; +} + +// node.js (no browser) +if(typeof(navigator) === 'undefined') +{ + BigInteger.prototype.am = am3; + dbits = 28; +} else if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { + BigInteger.prototype.am = am2; + dbits = 30; +} else if(j_lm && (navigator.appName != "Netscape")) { + BigInteger.prototype.am = am1; + dbits = 26; +} else { // Mozilla/Netscape seems to prefer am3 + BigInteger.prototype.am = am3; + dbits = 28; +} + +BigInteger.prototype.DB = dbits; +BigInteger.prototype.DM = ((1<= 0; --i) r.data[i] = this.data[i]; + r.t = this.t; + r.s = this.s; +} + +// (protected) set from integer value x, -DV <= x < DV +function bnpFromInt(x) { + this.t = 1; + this.s = (x<0)?-1:0; + if(x > 0) this.data[0] = x; + else if(x < -1) this.data[0] = x+this.DV; + else this.t = 0; +} + +// return bigint initialized to value +function nbv(i) { var r = nbi(); r.fromInt(i); return r; } + +// (protected) set from string and radix +function bnpFromString(s,b) { + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 256) k = 8; // byte array + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else { this.fromRadix(s,b); return; } + this.t = 0; + this.s = 0; + var i = s.length, mi = false, sh = 0; + while(--i >= 0) { + var x = (k==8)?s[i]&0xff:intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-") mi = true; + continue; + } + mi = false; + if(sh == 0) + this.data[this.t++] = x; + else if(sh+k > this.DB) { + this.data[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); + } else + this.data[this.t-1] |= x<= this.DB) sh -= this.DB; + } + if(k == 8 && (s[0]&0x80) != 0) { + this.s = -1; + if(sh > 0) this.data[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this.data[this.t-1] == c) --this.t; +} + +// (public) return string representation in given radix +function bnToString(b) { + if(this.s < 0) return "-"+this.negate().toString(b); + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else return this.toRadix(b); + var km = (1< 0) { + if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); } + while(i >= 0) { + if(p < k) { + d = (this.data[i]&((1<>(p+=this.DB-k); + } else { + d = (this.data[i]>>(p-=k))&km; + if(p <= 0) { p += this.DB; --i; } + } + if(d > 0) m = true; + if(m) r += int2char(d); + } + } + return m?r:"0"; +} + +// (public) -this +function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } + +// (public) |this| +function bnAbs() { return (this.s<0)?this.negate():this; } + +// (public) return + if this > a, - if this < a, 0 if equal +function bnCompareTo(a) { + var r = this.s-a.s; + if(r != 0) return r; + var i = this.t; + r = i-a.t; + if(r != 0) return (this.s<0)?-r:r; + while(--i >= 0) if((r=this.data[i]-a.data[i]) != 0) return r; + return 0; +} + +// returns bit length of the integer x +function nbits(x) { + var r = 1, t; + if((t=x>>>16) != 0) { x = t; r += 16; } + if((t=x>>8) != 0) { x = t; r += 8; } + if((t=x>>4) != 0) { x = t; r += 4; } + if((t=x>>2) != 0) { x = t; r += 2; } + if((t=x>>1) != 0) { x = t; r += 1; } + return r; +} + +// (public) return the number of bits in "this" +function bnBitLength() { + if(this.t <= 0) return 0; + return this.DB*(this.t-1)+nbits(this.data[this.t-1]^(this.s&this.DM)); +} + +// (protected) r = this << n*DB +function bnpDLShiftTo(n,r) { + var i; + for(i = this.t-1; i >= 0; --i) r.data[i+n] = this.data[i]; + for(i = n-1; i >= 0; --i) r.data[i] = 0; + r.t = this.t+n; + r.s = this.s; +} + +// (protected) r = this >> n*DB +function bnpDRShiftTo(n,r) { + for(var i = n; i < this.t; ++i) r.data[i-n] = this.data[i]; + r.t = Math.max(this.t-n,0); + r.s = this.s; +} + +// (protected) r = this << n +function bnpLShiftTo(n,r) { + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<= 0; --i) { + r.data[i+ds+1] = (this.data[i]>>cbs)|c; + c = (this.data[i]&bm)<= 0; --i) r.data[i] = 0; + r.data[ds] = c; + r.t = this.t+ds+1; + r.s = this.s; + r.clamp(); +} + +// (protected) r = this >> n +function bnpRShiftTo(n,r) { + r.s = this.s; + var ds = Math.floor(n/this.DB); + if(ds >= this.t) { r.t = 0; return; } + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<>bs; + for(var i = ds+1; i < this.t; ++i) { + r.data[i-ds-1] |= (this.data[i]&bm)<>bs; + } + if(bs > 0) r.data[this.t-ds-1] |= (this.s&bm)<>= this.DB; + } + if(a.t < this.t) { + c -= a.s; + while(i < this.t) { + c += this.data[i]; + r.data[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } else { + c += this.s; + while(i < a.t) { + c -= a.data[i]; + r.data[i++] = c&this.DM; + c >>= this.DB; + } + c -= a.s; + } + r.s = (c<0)?-1:0; + if(c < -1) r.data[i++] = this.DV+c; + else if(c > 0) r.data[i++] = c; + r.t = i; + r.clamp(); +} + +// (protected) r = this * a, r != this,a (HAC 14.12) +// "this" should be the larger one if appropriate. +function bnpMultiplyTo(a,r) { + var x = this.abs(), y = a.abs(); + var i = x.t; + r.t = i+y.t; + while(--i >= 0) r.data[i] = 0; + for(i = 0; i < y.t; ++i) r.data[i+x.t] = x.am(0,y.data[i],r,i,0,x.t); + r.s = 0; + r.clamp(); + if(this.s != a.s) BigInteger.ZERO.subTo(r,r); +} + +// (protected) r = this^2, r != this (HAC 14.16) +function bnpSquareTo(r) { + var x = this.abs(); + var i = r.t = 2*x.t; + while(--i >= 0) r.data[i] = 0; + for(i = 0; i < x.t-1; ++i) { + var c = x.am(i,x.data[i],r,2*i,0,1); + if((r.data[i+x.t]+=x.am(i+1,2*x.data[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { + r.data[i+x.t] -= x.DV; + r.data[i+x.t+1] = 1; + } + } + if(r.t > 0) r.data[r.t-1] += x.am(i,x.data[i],r,2*i,0,1); + r.s = 0; + r.clamp(); +} + +// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) +// r != q, this != m. q or r may be null. +function bnpDivRemTo(m,q,r) { + var pm = m.abs(); + if(pm.t <= 0) return; + var pt = this.abs(); + if(pt.t < pm.t) { + if(q != null) q.fromInt(0); + if(r != null) this.copyTo(r); + return; + } + if(r == null) r = nbi(); + var y = nbi(), ts = this.s, ms = m.s; + var nsh = this.DB-nbits(pm.data[pm.t-1]); // normalize modulus + if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } + var ys = y.t; + var y0 = y.data[ys-1]; + if(y0 == 0) return; + var yt = y0*(1<1)?y.data[ys-2]>>this.F2:0); + var d1 = this.FV/yt, d2 = (1<= 0) { + r.data[r.t++] = 1; + r.subTo(t,r); + } + BigInteger.ONE.dlShiftTo(ys,t); + t.subTo(y,y); // "negative" y so we can replace sub with am later + while(y.t < ys) y.data[y.t++] = 0; + while(--j >= 0) { + // Estimate quotient digit + var qd = (r.data[--i]==y0)?this.DM:Math.floor(r.data[i]*d1+(r.data[i-1]+e)*d2); + if((r.data[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out + y.dlShiftTo(j,t); + r.subTo(t,r); + while(r.data[i] < --qd) r.subTo(t,r); + } + } + if(q != null) { + r.drShiftTo(ys,q); + if(ts != ms) BigInteger.ZERO.subTo(q,q); + } + r.t = ys; + r.clamp(); + if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder + if(ts < 0) BigInteger.ZERO.subTo(r,r); +} + +// (public) this mod a +function bnMod(a) { + var r = nbi(); + this.abs().divRemTo(a,null,r); + if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); + return r; +} + +// Modular reduction using "classic" algorithm +function Classic(m) { this.m = m; } +function cConvert(x) { + if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); + else return x; +} +function cRevert(x) { return x; } +function cReduce(x) { x.divRemTo(this.m,null,x); } +function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } +function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + +Classic.prototype.convert = cConvert; +Classic.prototype.revert = cRevert; +Classic.prototype.reduce = cReduce; +Classic.prototype.mulTo = cMulTo; +Classic.prototype.sqrTo = cSqrTo; + +// (protected) return "-1/this % 2^DB"; useful for Mont. reduction +// justification: +// xy == 1 (mod m) +// xy = 1+km +// xy(2-xy) = (1+km)(1-km) +// x[y(2-xy)] = 1-k^2m^2 +// x[y(2-xy)] == 1 (mod m^2) +// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 +// should reduce x and y(2-xy) by m^2 at each step to keep size bounded. +// JS multiply "overflows" differently from C/C++, so care is needed here. +function bnpInvDigit() { + if(this.t < 1) return 0; + var x = this.data[0]; + if((x&1) == 0) return 0; + var y = x&3; // y == 1/x mod 2^2 + y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 + y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 + y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 + // last step - calculate inverse mod DV directly; + // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints + y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits + // we really want the negative inverse, and -DV < y < DV + return (y>0)?this.DV-y:-y; +} + +// Montgomery reduction +function Montgomery(m) { + this.m = m; + this.mp = m.invDigit(); + this.mpl = this.mp&0x7fff; + this.mph = this.mp>>15; + this.um = (1<<(m.DB-15))-1; + this.mt2 = 2*m.t; +} + +// xR mod m +function montConvert(x) { + var r = nbi(); + x.abs().dlShiftTo(this.m.t,r); + r.divRemTo(this.m,null,r); + if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); + return r; +} + +// x/R mod m +function montRevert(x) { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; +} + +// x = x/R mod m (HAC 14.32) +function montReduce(x) { + while(x.t <= this.mt2) // pad x so am has enough room later + x.data[x.t++] = 0; + for(var i = 0; i < this.m.t; ++i) { + // faster way of calculating u0 = x.data[i]*mp mod DV + var j = x.data[i]&0x7fff; + var u0 = (j*this.mpl+(((j*this.mph+(x.data[i]>>15)*this.mpl)&this.um)<<15))&x.DM; + // use am to combine the multiply-shift-add into one call + j = i+this.m.t; + x.data[j] += this.m.am(0,u0,x,i,0,this.m.t); + // propagate carry + while(x.data[j] >= x.DV) { x.data[j] -= x.DV; x.data[++j]++; } + } + x.clamp(); + x.drShiftTo(this.m.t,x); + if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); +} + +// r = "x^2/R mod m"; x != r +function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + +// r = "xy/R mod m"; x,y != r +function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + +Montgomery.prototype.convert = montConvert; +Montgomery.prototype.revert = montRevert; +Montgomery.prototype.reduce = montReduce; +Montgomery.prototype.mulTo = montMulTo; +Montgomery.prototype.sqrTo = montSqrTo; + +// (protected) true iff this is even +function bnpIsEven() { return ((this.t>0)?(this.data[0]&1):this.s) == 0; } + +// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) +function bnpExp(e,z) { + if(e > 0xffffffff || e < 1) return BigInteger.ONE; + var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; + g.copyTo(r); + while(--i >= 0) { + z.sqrTo(r,r2); + if((e&(1< 0) z.mulTo(r2,g,r); + else { var t = r; r = r2; r2 = t; } + } + return z.revert(r); +} + +// (public) this^e % m, 0 <= e < 2^32 +function bnModPowInt(e,m) { + var z; + if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); + return this.exp(e,z); +} + +// protected +BigInteger.prototype.copyTo = bnpCopyTo; +BigInteger.prototype.fromInt = bnpFromInt; +BigInteger.prototype.fromString = bnpFromString; +BigInteger.prototype.clamp = bnpClamp; +BigInteger.prototype.dlShiftTo = bnpDLShiftTo; +BigInteger.prototype.drShiftTo = bnpDRShiftTo; +BigInteger.prototype.lShiftTo = bnpLShiftTo; +BigInteger.prototype.rShiftTo = bnpRShiftTo; +BigInteger.prototype.subTo = bnpSubTo; +BigInteger.prototype.multiplyTo = bnpMultiplyTo; +BigInteger.prototype.squareTo = bnpSquareTo; +BigInteger.prototype.divRemTo = bnpDivRemTo; +BigInteger.prototype.invDigit = bnpInvDigit; +BigInteger.prototype.isEven = bnpIsEven; +BigInteger.prototype.exp = bnpExp; + +// public +BigInteger.prototype.toString = bnToString; +BigInteger.prototype.negate = bnNegate; +BigInteger.prototype.abs = bnAbs; +BigInteger.prototype.compareTo = bnCompareTo; +BigInteger.prototype.bitLength = bnBitLength; +BigInteger.prototype.mod = bnMod; +BigInteger.prototype.modPowInt = bnModPowInt; + +// "constants" +BigInteger.ZERO = nbv(0); +BigInteger.ONE = nbv(1); + +// jsbn2 lib + +//Copyright (c) 2005-2009 Tom Wu +//All Rights Reserved. +//See "LICENSE" for details (See jsbn.js for LICENSE). + +//Extended JavaScript BN functions, required for RSA private ops. + +//Version 1.1: new BigInteger("0", 10) returns "proper" zero + +//(public) +function bnClone() { var r = nbi(); this.copyTo(r); return r; } + +//(public) return value as integer +function bnIntValue() { +if(this.s < 0) { + if(this.t == 1) return this.data[0]-this.DV; + else if(this.t == 0) return -1; +} else if(this.t == 1) return this.data[0]; +else if(this.t == 0) return 0; +// assumes 16 < DB < 32 +return ((this.data[1]&((1<<(32-this.DB))-1))<>24; } + +//(public) return value as short (assumes DB>=16) +function bnShortValue() { return (this.t==0)?this.s:(this.data[0]<<16)>>16; } + +//(protected) return x s.t. r^x < DV +function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } + +//(public) 0 if this == 0, 1 if this > 0 +function bnSigNum() { +if(this.s < 0) return -1; +else if(this.t <= 0 || (this.t == 1 && this.data[0] <= 0)) return 0; +else return 1; +} + +//(protected) convert to radix string +function bnpToRadix(b) { +if(b == null) b = 10; +if(this.signum() == 0 || b < 2 || b > 36) return "0"; +var cs = this.chunkSize(b); +var a = Math.pow(b,cs); +var d = nbv(a), y = nbi(), z = nbi(), r = ""; +this.divRemTo(d,y,z); +while(y.signum() > 0) { + r = (a+z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d,y,z); +} +return z.intValue().toString(b) + r; +} + +//(protected) convert from radix string +function bnpFromRadix(s,b) { +this.fromInt(0); +if(b == null) b = 10; +var cs = this.chunkSize(b); +var d = Math.pow(b,cs), mi = false, j = 0, w = 0; +for(var i = 0; i < s.length; ++i) { + var x = intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-" && this.signum() == 0) mi = true; + continue; + } + w = b*w+x; + if(++j >= cs) { + this.dMultiply(d); + this.dAddOffset(w,0); + j = 0; + w = 0; + } +} +if(j > 0) { + this.dMultiply(Math.pow(b,j)); + this.dAddOffset(w,0); +} +if(mi) BigInteger.ZERO.subTo(this,this); +} + +//(protected) alternate constructor +function bnpFromNumber(a,b,c) { +if("number" == typeof b) { + // new BigInteger(int,int,RNG) + if(a < 2) this.fromInt(1); + else { + this.fromNumber(a,c); + if(!this.testBit(a-1)) // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); + if(this.isEven()) this.dAddOffset(1,0); // force odd + while(!this.isProbablePrime(b)) { + this.dAddOffset(2,0); + if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); + } + } +} else { + // new BigInteger(int,RNG) + var x = new Array(), t = a&7; + x.length = (a>>3)+1; + b.nextBytes(x); + if(t > 0) x[0] &= ((1< 0) { + if(p < this.DB && (d = this.data[i]>>p) != (this.s&this.DM)>>p) + r[k++] = d|(this.s<<(this.DB-p)); + while(i >= 0) { + if(p < 8) { + d = (this.data[i]&((1<>(p+=this.DB-8); + } else { + d = (this.data[i]>>(p-=8))&0xff; + if(p <= 0) { p += this.DB; --i; } + } + if((d&0x80) != 0) d |= -256; + if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; + if(k > 0 || d != this.s) r[k++] = d; + } +} +return r; +} + +function bnEquals(a) { return(this.compareTo(a)==0); } +function bnMin(a) { return(this.compareTo(a)<0)?this:a; } +function bnMax(a) { return(this.compareTo(a)>0)?this:a; } + +//(protected) r = this op a (bitwise) +function bnpBitwiseTo(a,op,r) { +var i, f, m = Math.min(a.t,this.t); +for(i = 0; i < m; ++i) r.data[i] = op(this.data[i],a.data[i]); +if(a.t < this.t) { + f = a.s&this.DM; + for(i = m; i < this.t; ++i) r.data[i] = op(this.data[i],f); + r.t = this.t; +} else { + f = this.s&this.DM; + for(i = m; i < a.t; ++i) r.data[i] = op(f,a.data[i]); + r.t = a.t; +} +r.s = op(this.s,a.s); +r.clamp(); +} + +//(public) this & a +function op_and(x,y) { return x&y; } +function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } + +//(public) this | a +function op_or(x,y) { return x|y; } +function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } + +//(public) this ^ a +function op_xor(x,y) { return x^y; } +function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } + +//(public) this & ~a +function op_andnot(x,y) { return x&~y; } +function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } + +//(public) ~this +function bnNot() { +var r = nbi(); +for(var i = 0; i < this.t; ++i) r.data[i] = this.DM&~this.data[i]; +r.t = this.t; +r.s = ~this.s; +return r; +} + +//(public) this << n +function bnShiftLeft(n) { +var r = nbi(); +if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); +return r; +} + +//(public) this >> n +function bnShiftRight(n) { +var r = nbi(); +if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); +return r; +} + +//return index of lowest 1-bit in x, x < 2^31 +function lbit(x) { +if(x == 0) return -1; +var r = 0; +if((x&0xffff) == 0) { x >>= 16; r += 16; } +if((x&0xff) == 0) { x >>= 8; r += 8; } +if((x&0xf) == 0) { x >>= 4; r += 4; } +if((x&3) == 0) { x >>= 2; r += 2; } +if((x&1) == 0) ++r; +return r; +} + +//(public) returns index of lowest 1-bit (or -1 if none) +function bnGetLowestSetBit() { +for(var i = 0; i < this.t; ++i) + if(this.data[i] != 0) return i*this.DB+lbit(this.data[i]); +if(this.s < 0) return this.t*this.DB; +return -1; +} + +//return number of 1 bits in x +function cbit(x) { +var r = 0; +while(x != 0) { x &= x-1; ++r; } +return r; +} + +//(public) return number of set bits +function bnBitCount() { +var r = 0, x = this.s&this.DM; +for(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x); +return r; +} + +//(public) true iff nth bit is set +function bnTestBit(n) { +var j = Math.floor(n/this.DB); +if(j >= this.t) return(this.s!=0); +return((this.data[j]&(1<<(n%this.DB)))!=0); +} + +//(protected) this op (1<>= this.DB; +} +if(a.t < this.t) { + c += a.s; + while(i < this.t) { + c += this.data[i]; + r.data[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; +} else { + c += this.s; + while(i < a.t) { + c += a.data[i]; + r.data[i++] = c&this.DM; + c >>= this.DB; + } + c += a.s; +} +r.s = (c<0)?-1:0; +if(c > 0) r.data[i++] = c; +else if(c < -1) r.data[i++] = this.DV+c; +r.t = i; +r.clamp(); +} + +//(public) this + a +function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } + +//(public) this - a +function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } + +//(public) this * a +function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } + +//(public) this / a +function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } + +//(public) this % a +function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } + +//(public) [this/a,this%a] +function bnDivideAndRemainder(a) { +var q = nbi(), r = nbi(); +this.divRemTo(a,q,r); +return new Array(q,r); +} + +//(protected) this *= n, this >= 0, 1 < n < DV +function bnpDMultiply(n) { +this.data[this.t] = this.am(0,n-1,this,0,0,this.t); +++this.t; +this.clamp(); +} + +//(protected) this += n << w words, this >= 0 +function bnpDAddOffset(n,w) { +if(n == 0) return; +while(this.t <= w) this.data[this.t++] = 0; +this.data[w] += n; +while(this.data[w] >= this.DV) { + this.data[w] -= this.DV; + if(++w >= this.t) this.data[this.t++] = 0; + ++this.data[w]; +} +} + +//A "null" reducer +function NullExp() {} +function nNop(x) { return x; } +function nMulTo(x,y,r) { x.multiplyTo(y,r); } +function nSqrTo(x,r) { x.squareTo(r); } + +NullExp.prototype.convert = nNop; +NullExp.prototype.revert = nNop; +NullExp.prototype.mulTo = nMulTo; +NullExp.prototype.sqrTo = nSqrTo; + +//(public) this^e +function bnPow(e) { return this.exp(e,new NullExp()); } + +//(protected) r = lower n words of "this * a", a.t <= n +//"this" should be the larger one if appropriate. +function bnpMultiplyLowerTo(a,n,r) { +var i = Math.min(this.t+a.t,n); +r.s = 0; // assumes a,this >= 0 +r.t = i; +while(i > 0) r.data[--i] = 0; +var j; +for(j = r.t-this.t; i < j; ++i) r.data[i+this.t] = this.am(0,a.data[i],r,i,0,this.t); +for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a.data[i],r,i,0,n-i); +r.clamp(); +} + +//(protected) r = "this * a" without lower n words, n > 0 +//"this" should be the larger one if appropriate. +function bnpMultiplyUpperTo(a,n,r) { +--n; +var i = r.t = this.t+a.t-n; +r.s = 0; // assumes a,this >= 0 +while(--i >= 0) r.data[i] = 0; +for(i = Math.max(n-this.t,0); i < a.t; ++i) + r.data[this.t+i-n] = this.am(n-i,a.data[i],r,0,0,this.t+i-n); +r.clamp(); +r.drShiftTo(1,r); +} + +//Barrett modular reduction +function Barrett(m) { +// setup Barrett +this.r2 = nbi(); +this.q3 = nbi(); +BigInteger.ONE.dlShiftTo(2*m.t,this.r2); +this.mu = this.r2.divide(m); +this.m = m; +} + +function barrettConvert(x) { +if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); +else if(x.compareTo(this.m) < 0) return x; +else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } +} + +function barrettRevert(x) { return x; } + +//x = x mod m (HAC 14.42) +function barrettReduce(x) { +x.drShiftTo(this.m.t-1,this.r2); +if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } +this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); +this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); +while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); +x.subTo(this.r2,x); +while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); +} + +//r = x^2 mod m; x != r +function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + +//r = x*y mod m; x,y != r +function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + +Barrett.prototype.convert = barrettConvert; +Barrett.prototype.revert = barrettRevert; +Barrett.prototype.reduce = barrettReduce; +Barrett.prototype.mulTo = barrettMulTo; +Barrett.prototype.sqrTo = barrettSqrTo; + +//(public) this^e % m (HAC 14.85) +function bnModPow(e,m) { +var i = e.bitLength(), k, r = nbv(1), z; +if(i <= 0) return r; +else if(i < 18) k = 1; +else if(i < 48) k = 3; +else if(i < 144) k = 4; +else if(i < 768) k = 5; +else k = 6; +if(i < 8) + z = new Classic(m); +else if(m.isEven()) + z = new Barrett(m); +else + z = new Montgomery(m); + +// precomputation +var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { + var g2 = nbi(); + z.sqrTo(g[1],g2); + while(n <= km) { + g[n] = nbi(); + z.mulTo(g2,g[n-2],g[n]); + n += 2; + } +} + +var j = e.t-1, w, is1 = true, r2 = nbi(), t; +i = nbits(e.data[j])-1; +while(j >= 0) { + if(i >= k1) w = (e.data[j]>>(i-k1))&km; + else { + w = (e.data[j]&((1<<(i+1))-1))<<(k1-i); + if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1); + } + + n = k; + while((w&1) == 0) { w >>= 1; --n; } + if((i -= n) < 0) { i += this.DB; --j; } + if(is1) { // ret == 1, don't bother squaring or multiplying it + g[w].copyTo(r); + is1 = false; + } else { + while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } + if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } + z.mulTo(r2,g[w],r); + } + + while(j >= 0 && (e.data[j]&(1< 0) { + x.rShiftTo(g,x); + y.rShiftTo(g,y); +} +while(x.signum() > 0) { + if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); + if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); + if(x.compareTo(y) >= 0) { + x.subTo(y,x); + x.rShiftTo(1,x); + } else { + y.subTo(x,y); + y.rShiftTo(1,y); + } +} +if(g > 0) y.lShiftTo(g,y); +return y; +} + +//(protected) this % n, n < 2^26 +function bnpModInt(n) { +if(n <= 0) return 0; +var d = this.DV%n, r = (this.s<0)?n-1:0; +if(this.t > 0) + if(d == 0) r = this.data[0]%n; + else for(var i = this.t-1; i >= 0; --i) r = (d*r+this.data[i])%n; +return r; +} + +//(public) 1/this % m (HAC 14.61) +function bnModInverse(m) { +var ac = m.isEven(); +if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; +var u = m.clone(), v = this.clone(); +var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); +while(u.signum() != 0) { + while(u.isEven()) { + u.rShiftTo(1,u); + if(ac) { + if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } + a.rShiftTo(1,a); + } else if(!b.isEven()) b.subTo(m,b); + b.rShiftTo(1,b); + } + while(v.isEven()) { + v.rShiftTo(1,v); + if(ac) { + if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } + c.rShiftTo(1,c); + } else if(!d.isEven()) d.subTo(m,d); + d.rShiftTo(1,d); + } + if(u.compareTo(v) >= 0) { + u.subTo(v,u); + if(ac) a.subTo(c,a); + b.subTo(d,b); + } else { + v.subTo(u,v); + if(ac) c.subTo(a,c); + d.subTo(b,d); + } +} +if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; +if(d.compareTo(m) >= 0) return d.subtract(m); +if(d.signum() < 0) d.addTo(m,d); else return d; +if(d.signum() < 0) return d.add(m); else return d; +} + +var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509]; +var lplim = (1<<26)/lowprimes[lowprimes.length-1]; + +//(public) test primality with certainty >= 1-.5^t +function bnIsProbablePrime(t) { +var i, x = this.abs(); +if(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) { + for(i = 0; i < lowprimes.length; ++i) + if(x.data[0] == lowprimes[i]) return true; + return false; +} +if(x.isEven()) return false; +i = 1; +while(i < lowprimes.length) { + var m = lowprimes[i], j = i+1; + while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; + m = x.modInt(m); + while(i < j) if(m%lowprimes[i++] == 0) return false; +} +return x.millerRabin(t); +} + +//(protected) true if probably prime (HAC 4.24, Miller-Rabin) +function bnpMillerRabin(t) { +var n1 = this.subtract(BigInteger.ONE); +var k = n1.getLowestSetBit(); +if(k <= 0) return false; +var r = n1.shiftRight(k); +var prng = bnGetPrng(); +var a; +for(var i = 0; i < t; ++i) { + // select witness 'a' at random from between 1 and n1 + do { + a = new BigInteger(this.bitLength(), prng); + } + while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0); + var y = a.modPow(r,this); + if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var j = 1; + while(j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2,this); + if(y.compareTo(BigInteger.ONE) == 0) return false; + } + if(y.compareTo(n1) != 0) return false; + } +} +return true; +} + +// get pseudo random number generator +function bnGetPrng() { + // create prng with api that matches BigInteger secure random + return { + // x is an array to fill with bytes + nextBytes: function(x) { + for(var i = 0; i < x.length; ++i) { + x[i] = Math.floor(Math.random() * 0x0100); + } + } + }; +} + +//protected +BigInteger.prototype.chunkSize = bnpChunkSize; +BigInteger.prototype.toRadix = bnpToRadix; +BigInteger.prototype.fromRadix = bnpFromRadix; +BigInteger.prototype.fromNumber = bnpFromNumber; +BigInteger.prototype.bitwiseTo = bnpBitwiseTo; +BigInteger.prototype.changeBit = bnpChangeBit; +BigInteger.prototype.addTo = bnpAddTo; +BigInteger.prototype.dMultiply = bnpDMultiply; +BigInteger.prototype.dAddOffset = bnpDAddOffset; +BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; +BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; +BigInteger.prototype.modInt = bnpModInt; +BigInteger.prototype.millerRabin = bnpMillerRabin; + +//public +BigInteger.prototype.clone = bnClone; +BigInteger.prototype.intValue = bnIntValue; +BigInteger.prototype.byteValue = bnByteValue; +BigInteger.prototype.shortValue = bnShortValue; +BigInteger.prototype.signum = bnSigNum; +BigInteger.prototype.toByteArray = bnToByteArray; +BigInteger.prototype.equals = bnEquals; +BigInteger.prototype.min = bnMin; +BigInteger.prototype.max = bnMax; +BigInteger.prototype.and = bnAnd; +BigInteger.prototype.or = bnOr; +BigInteger.prototype.xor = bnXor; +BigInteger.prototype.andNot = bnAndNot; +BigInteger.prototype.not = bnNot; +BigInteger.prototype.shiftLeft = bnShiftLeft; +BigInteger.prototype.shiftRight = bnShiftRight; +BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; +BigInteger.prototype.bitCount = bnBitCount; +BigInteger.prototype.testBit = bnTestBit; +BigInteger.prototype.setBit = bnSetBit; +BigInteger.prototype.clearBit = bnClearBit; +BigInteger.prototype.flipBit = bnFlipBit; +BigInteger.prototype.add = bnAdd; +BigInteger.prototype.subtract = bnSubtract; +BigInteger.prototype.multiply = bnMultiply; +BigInteger.prototype.divide = bnDivide; +BigInteger.prototype.remainder = bnRemainder; +BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; +BigInteger.prototype.modPow = bnModPow; +BigInteger.prototype.modInverse = bnModInverse; +BigInteger.prototype.pow = bnPow; +BigInteger.prototype.gcd = bnGCD; +BigInteger.prototype.isProbablePrime = bnIsProbablePrime; + +//BigInteger interfaces not implemented in jsbn: + +//BigInteger(int signum, byte[] magnitude) +//double doubleValue() +//float floatValue() +//int hashCode() +//long longValue() +//static BigInteger valueOf(long val) + + +/***/ }), + +/***/ 6366: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of RSA-KEM. + * + * @author Lautaro Cozzani Rodriguez + * @author Dave Longley + * + * Copyright (c) 2014 Lautaro Cozzani + * Copyright (c) 2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); +__webpack_require__(9563); +__webpack_require__(5764); + +module.exports = forge.kem = forge.kem || {}; + +var BigInteger = forge.jsbn.BigInteger; + +/** + * The API for the RSA Key Encapsulation Mechanism (RSA-KEM) from ISO 18033-2. + */ +forge.kem.rsa = {}; + +/** + * Creates an RSA KEM API object for generating a secret asymmetric key. + * + * The symmetric key may be generated via a call to 'encrypt', which will + * produce a ciphertext to be transmitted to the recipient and a key to be + * kept secret. The ciphertext is a parameter to be passed to 'decrypt' which + * will produce the same secret key for the recipient to use to decrypt a + * message that was encrypted with the secret key. + * + * @param kdf the KDF API to use (eg: new forge.kem.kdf1()). + * @param options the options to use. + * [prng] a custom crypto-secure pseudo-random number generator to use, + * that must define "getBytesSync". + */ +forge.kem.rsa.create = function(kdf, options) { + options = options || {}; + var prng = options.prng || forge.random; + + var kem = {}; + + /** + * Generates a secret key and its encapsulation. + * + * @param publicKey the RSA public key to encrypt with. + * @param keyLength the length, in bytes, of the secret key to generate. + * + * @return an object with: + * encapsulation: the ciphertext for generating the secret key, as a + * binary-encoded string of bytes. + * key: the secret key to use for encrypting a message. + */ + kem.encrypt = function(publicKey, keyLength) { + // generate a random r where 1 < r < n + var byteLength = Math.ceil(publicKey.n.bitLength() / 8); + var r; + do { + r = new BigInteger( + forge.util.bytesToHex(prng.getBytesSync(byteLength)), + 16).mod(publicKey.n); + } while(r.compareTo(BigInteger.ONE) <= 0); + + // prepend r with zeros + r = forge.util.hexToBytes(r.toString(16)); + var zeros = byteLength - r.length; + if(zeros > 0) { + r = forge.util.fillString(String.fromCharCode(0), zeros) + r; + } + + // encrypt the random + var encapsulation = publicKey.encrypt(r, 'NONE'); + + // generate the secret key + var key = kdf.generate(r, keyLength); + + return {encapsulation: encapsulation, key: key}; + }; + + /** + * Decrypts an encapsulated secret key. + * + * @param privateKey the RSA private key to decrypt with. + * @param encapsulation the ciphertext for generating the secret key, as + * a binary-encoded string of bytes. + * @param keyLength the length, in bytes, of the secret key to generate. + * + * @return the secret key as a binary-encoded string of bytes. + */ + kem.decrypt = function(privateKey, encapsulation, keyLength) { + // decrypt the encapsulation and generate the secret key + var r = privateKey.decrypt(encapsulation, 'NONE'); + return kdf.generate(r, keyLength); + }; + + return kem; +}; + +// TODO: add forge.kem.kdf.create('KDF1', {md: ..., ...}) API? + +/** + * Creates a key derivation API object that implements KDF1 per ISO 18033-2. + * + * @param md the hash API to use. + * @param [digestLength] an optional digest length that must be positive and + * less than or equal to md.digestLength. + * + * @return a KDF1 API object. + */ +forge.kem.kdf1 = function(md, digestLength) { + _createKDF(this, md, 0, digestLength || md.digestLength); +}; + +/** + * Creates a key derivation API object that implements KDF2 per ISO 18033-2. + * + * @param md the hash API to use. + * @param [digestLength] an optional digest length that must be positive and + * less than or equal to md.digestLength. + * + * @return a KDF2 API object. + */ +forge.kem.kdf2 = function(md, digestLength) { + _createKDF(this, md, 1, digestLength || md.digestLength); +}; + +/** + * Creates a KDF1 or KDF2 API object. + * + * @param md the hash API to use. + * @param counterStart the starting index for the counter. + * @param digestLength the digest length to use. + * + * @return the KDF API object. + */ +function _createKDF(kdf, md, counterStart, digestLength) { + /** + * Generate a key of the specified length. + * + * @param x the binary-encoded byte string to generate a key from. + * @param length the number of bytes to generate (the size of the key). + * + * @return the key as a binary-encoded string. + */ + kdf.generate = function(x, length) { + var key = new forge.util.ByteBuffer(); + + // run counter from counterStart to ceil(length / Hash.len) + var k = Math.ceil(length / digestLength) + counterStart; + + var c = new forge.util.ByteBuffer(); + for(var i = counterStart; i < k; ++i) { + // I2OSP(i, 4): convert counter to an octet string of 4 octets + c.putInt32(i); + + // digest 'x' and the counter and add the result to the key + md.start(); + md.update(x + c.getBytes()); + var hash = md.digest(); + key.putBytes(hash.getBytes(digestLength)); + } + + // truncate to the correct key length + key.truncate(key.length() - length); + return key.getBytes(); + }; +} + + +/***/ }), + +/***/ 4145: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Cross-browser support for logging in a web application. + * + * @author David I. Lehn + * + * Copyright (c) 2008-2013 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); + +/* LOG API */ +module.exports = forge.log = forge.log || {}; + +/** + * Application logging system. + * + * Each logger level available as it's own function of the form: + * forge.log.level(category, args...) + * The category is an arbitrary string, and the args are the same as + * Firebug's console.log API. By default the call will be output as: + * 'LEVEL [category] , args[1], ...' + * This enables proper % formatting via the first argument. + * Each category is enabled by default but can be enabled or disabled with + * the setCategoryEnabled() function. + */ +// list of known levels +forge.log.levels = [ + 'none', 'error', 'warning', 'info', 'debug', 'verbose', 'max']; +// info on the levels indexed by name: +// index: level index +// name: uppercased display name +var sLevelInfo = {}; +// list of loggers +var sLoggers = []; +/** + * Standard console logger. If no console support is enabled this will + * remain null. Check before using. + */ +var sConsoleLogger = null; + +// logger flags +/** + * Lock the level at the current value. Used in cases where user config may + * set the level such that only critical messages are seen but more verbose + * messages are needed for debugging or other purposes. + */ +forge.log.LEVEL_LOCKED = (1 << 1); +/** + * Always call log function. By default, the logging system will check the + * message level against logger.level before calling the log function. This + * flag allows the function to do its own check. + */ +forge.log.NO_LEVEL_CHECK = (1 << 2); +/** + * Perform message interpolation with the passed arguments. "%" style + * fields in log messages will be replaced by arguments as needed. Some + * loggers, such as Firebug, may do this automatically. The original log + * message will be available as 'message' and the interpolated version will + * be available as 'fullMessage'. + */ +forge.log.INTERPOLATE = (1 << 3); + +// setup each log level +for(var i = 0; i < forge.log.levels.length; ++i) { + var level = forge.log.levels[i]; + sLevelInfo[level] = { + index: i, + name: level.toUpperCase() + }; +} + +/** + * Message logger. Will dispatch a message to registered loggers as needed. + * + * @param message message object + */ +forge.log.logMessage = function(message) { + var messageLevelIndex = sLevelInfo[message.level].index; + for(var i = 0; i < sLoggers.length; ++i) { + var logger = sLoggers[i]; + if(logger.flags & forge.log.NO_LEVEL_CHECK) { + logger.f(message); + } else { + // get logger level + var loggerLevelIndex = sLevelInfo[logger.level].index; + // check level + if(messageLevelIndex <= loggerLevelIndex) { + // message critical enough, call logger + logger.f(logger, message); + } + } + } +}; + +/** + * Sets the 'standard' key on a message object to: + * "LEVEL [category] " + message + * + * @param message a message log object + */ +forge.log.prepareStandard = function(message) { + if(!('standard' in message)) { + message.standard = + sLevelInfo[message.level].name + + //' ' + +message.timestamp + + ' [' + message.category + '] ' + + message.message; + } +}; + +/** + * Sets the 'full' key on a message object to the original message + * interpolated via % formatting with the message arguments. + * + * @param message a message log object. + */ +forge.log.prepareFull = function(message) { + if(!('full' in message)) { + // copy args and insert message at the front + var args = [message.message]; + args = args.concat([] || 0); + // format the message + message.full = forge.util.format.apply(this, args); + } +}; + +/** + * Applies both preparseStandard() and prepareFull() to a message object and + * store result in 'standardFull'. + * + * @param message a message log object. + */ +forge.log.prepareStandardFull = function(message) { + if(!('standardFull' in message)) { + // FIXME implement 'standardFull' logging + forge.log.prepareStandard(message); + message.standardFull = message.standard; + } +}; + +// create log level functions +if(true) { + // levels for which we want functions + var levels = ['error', 'warning', 'info', 'debug', 'verbose']; + for(var i = 0; i < levels.length; ++i) { + // wrap in a function to ensure proper level var is passed + (function(level) { + // create function for this level + forge.log[level] = function(category, message/*, args...*/) { + // convert arguments to real array, remove category and message + var args = Array.prototype.slice.call(arguments).slice(2); + // create message object + // Note: interpolation and standard formatting is done lazily + var msg = { + timestamp: new Date(), + level: level, + category: category, + message: message, + 'arguments': args + /*standard*/ + /*full*/ + /*fullMessage*/ + }; + // process this message + forge.log.logMessage(msg); + }; + })(levels[i]); + } +} + +/** + * Creates a new logger with specified custom logging function. + * + * The logging function has a signature of: + * function(logger, message) + * logger: current logger + * message: object: + * level: level id + * category: category + * message: string message + * arguments: Array of extra arguments + * fullMessage: interpolated message and arguments if INTERPOLATE flag set + * + * @param logFunction a logging function which takes a log message object + * as a parameter. + * + * @return a logger object. + */ +forge.log.makeLogger = function(logFunction) { + var logger = { + flags: 0, + f: logFunction + }; + forge.log.setLevel(logger, 'none'); + return logger; +}; + +/** + * Sets the current log level on a logger. + * + * @param logger the target logger. + * @param level the new maximum log level as a string. + * + * @return true if set, false if not. + */ +forge.log.setLevel = function(logger, level) { + var rval = false; + if(logger && !(logger.flags & forge.log.LEVEL_LOCKED)) { + for(var i = 0; i < forge.log.levels.length; ++i) { + var aValidLevel = forge.log.levels[i]; + if(level == aValidLevel) { + // set level + logger.level = level; + rval = true; + break; + } + } + } + + return rval; +}; + +/** + * Locks the log level at its current value. + * + * @param logger the target logger. + * @param lock boolean lock value, default to true. + */ +forge.log.lock = function(logger, lock) { + if(typeof lock === 'undefined' || lock) { + logger.flags |= forge.log.LEVEL_LOCKED; + } else { + logger.flags &= ~forge.log.LEVEL_LOCKED; + } +}; + +/** + * Adds a logger. + * + * @param logger the logger object. + */ +forge.log.addLogger = function(logger) { + sLoggers.push(logger); +}; + +// setup the console logger if possible, else create fake console.log +if(typeof(console) !== 'undefined' && 'log' in console) { + var logger; + if(console.error && console.warn && console.info && console.debug) { + // looks like Firebug-style logging is available + // level handlers map + var levelHandlers = { + error: console.error, + warning: console.warn, + info: console.info, + debug: console.debug, + verbose: console.debug + }; + var f = function(logger, message) { + forge.log.prepareStandard(message); + var handler = levelHandlers[message.level]; + // prepend standard message and concat args + var args = [message.standard]; + args = args.concat(message['arguments'].slice()); + // apply to low-level console function + handler.apply(console, args); + }; + logger = forge.log.makeLogger(f); + } else { + // only appear to have basic console.log + var f = function(logger, message) { + forge.log.prepareStandardFull(message); + console.log(message.standardFull); + }; + logger = forge.log.makeLogger(f); + } + forge.log.setLevel(logger, 'debug'); + forge.log.addLogger(logger); + sConsoleLogger = logger; +} else { + // define fake console.log to avoid potential script errors on + // browsers that do not have console logging + console = { + log: function() {} + }; +} + +/* + * Check for logging control query vars in current URL. + * + * console.level= + * Set's the console log level by name. Useful to override defaults and + * allow more verbose logging before a user config is loaded. + * + * console.lock= + * Lock the console log level at whatever level it is set at. This is run + * after console.level is processed. Useful to force a level of verbosity + * that could otherwise be limited by a user config. + */ +if(sConsoleLogger !== null && + typeof window !== 'undefined' && window.location +) { + var query = new URL(window.location.href).searchParams; + if(query.has('console.level')) { + // set with last value + forge.log.setLevel( + sConsoleLogger, query.get('console.level').slice(-1)[0]); + } + if(query.has('console.lock')) { + // set with last value + var lock = query.get('console.lock').slice(-1)[0]; + if(lock == 'true') { + forge.log.lock(sConsoleLogger); + } + } +} + +// provide public access to console logger +forge.log.consoleLogger = sConsoleLogger; + + +/***/ }), + +/***/ 3389: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Node.js module for all known Forge message digests. + * + * @author Dave Longley + * + * Copyright 2011-2017 Digital Bazaar, Inc. + */ +module.exports = __webpack_require__(8991); + +__webpack_require__(5063); +__webpack_require__(137); +__webpack_require__(1668); +__webpack_require__(3219); + + +/***/ }), + +/***/ 8991: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Node.js module for Forge message digests. + * + * @author Dave Longley + * + * Copyright 2011-2017 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); + +module.exports = forge.md = forge.md || {}; +forge.md.algorithms = forge.md.algorithms || {}; + + +/***/ }), + +/***/ 5063: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Message Digest Algorithm 5 with 128-bit digest (MD5) implementation. + * + * @author Dave Longley + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(8991); +__webpack_require__(7116); + +var md5 = module.exports = forge.md5 = forge.md5 || {}; +forge.md.md5 = forge.md.algorithms.md5 = md5; + +/** + * Creates an MD5 message digest object. + * + * @return a message digest object. + */ +md5.create = function() { + // do initialization as necessary + if(!_initialized) { + _init(); + } + + // MD5 state contains four 32-bit integers + var _state = null; + + // input buffer + var _input = forge.util.createBuffer(); + + // used for word storage + var _w = new Array(16); + + // message digest object + var md = { + algorithm: 'md5', + blockLength: 64, + digestLength: 16, + // 56-bit length of message so far (does not including padding) + messageLength: 0, + // true message length + fullMessageLength: null, + // size of message length in bytes + messageLengthSize: 8 + }; + + /** + * Starts the digest. + * + * @return this digest object. + */ + md.start = function() { + // up to 56-bit message length for convenience + md.messageLength = 0; + + // full message length (set md.messageLength64 for backwards-compatibility) + md.fullMessageLength = md.messageLength64 = []; + var int32s = md.messageLengthSize / 4; + for(var i = 0; i < int32s; ++i) { + md.fullMessageLength.push(0); + } + _input = forge.util.createBuffer(); + _state = { + h0: 0x67452301, + h1: 0xEFCDAB89, + h2: 0x98BADCFE, + h3: 0x10325476 + }; + return md; + }; + // start digest automatically for first time + md.start(); + + /** + * Updates the digest with the given message input. The given input can + * treated as raw input (no encoding will be applied) or an encoding of + * 'utf8' maybe given to encode the input using UTF-8. + * + * @param msg the message input to update with. + * @param encoding the encoding to use (default: 'raw', other: 'utf8'). + * + * @return this digest object. + */ + md.update = function(msg, encoding) { + if(encoding === 'utf8') { + msg = forge.util.encodeUtf8(msg); + } + + // update message length + var len = msg.length; + md.messageLength += len; + len = [(len / 0x100000000) >>> 0, len >>> 0]; + for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { + md.fullMessageLength[i] += len[1]; + len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); + md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; + len[0] = (len[1] / 0x100000000) >>> 0; + } + + // add bytes to input buffer + _input.putBytes(msg); + + // process bytes + _update(_state, _w, _input); + + // compact input buffer every 2K or if empty + if(_input.read > 2048 || _input.length() === 0) { + _input.compact(); + } + + return md; + }; + + /** + * Produces the digest. + * + * @return a byte buffer containing the digest value. + */ + md.digest = function() { + /* Note: Here we copy the remaining bytes in the input buffer and + add the appropriate MD5 padding. Then we do the final update + on a copy of the state so that if the user wants to get + intermediate digests they can do so. */ + + /* Determine the number of bytes that must be added to the message + to ensure its length is congruent to 448 mod 512. In other words, + the data to be digested must be a multiple of 512 bits (or 128 bytes). + This data includes the message, some padding, and the length of the + message. Since the length of the message will be encoded as 8 bytes (64 + bits), that means that the last segment of the data must have 56 bytes + (448 bits) of message and padding. Therefore, the length of the message + plus the padding must be congruent to 448 mod 512 because + 512 - 128 = 448. + + In order to fill up the message length it must be filled with + padding that begins with 1 bit followed by all 0 bits. Padding + must *always* be present, so if the message length is already + congruent to 448 mod 512, then 512 padding bits must be added. */ + + var finalBlock = forge.util.createBuffer(); + finalBlock.putBytes(_input.bytes()); + + // compute remaining size to be digested (include message length size) + var remaining = ( + md.fullMessageLength[md.fullMessageLength.length - 1] + + md.messageLengthSize); + + // add padding for overflow blockSize - overflow + // _padding starts with 1 byte with first bit is set (byte value 128), then + // there may be up to (blockSize - 1) other pad bytes + var overflow = remaining & (md.blockLength - 1); + finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); + + // serialize message length in bits in little-endian order; since length + // is stored in bytes we multiply by 8 and add carry + var bits, carry = 0; + for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { + bits = md.fullMessageLength[i] * 8 + carry; + carry = (bits / 0x100000000) >>> 0; + finalBlock.putInt32Le(bits >>> 0); + } + + var s2 = { + h0: _state.h0, + h1: _state.h1, + h2: _state.h2, + h3: _state.h3 + }; + _update(s2, _w, finalBlock); + var rval = forge.util.createBuffer(); + rval.putInt32Le(s2.h0); + rval.putInt32Le(s2.h1); + rval.putInt32Le(s2.h2); + rval.putInt32Le(s2.h3); + return rval; + }; + + return md; +}; + +// padding, constant tables for calculating md5 +var _padding = null; +var _g = null; +var _r = null; +var _k = null; +var _initialized = false; + +/** + * Initializes the constant tables. + */ +function _init() { + // create padding + _padding = String.fromCharCode(128); + _padding += forge.util.fillString(String.fromCharCode(0x00), 64); + + // g values + _g = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, + 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, + 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9]; + + // rounds table + _r = [ + 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, + 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, + 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, + 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]; + + // get the result of abs(sin(i + 1)) as a 32-bit integer + _k = new Array(64); + for(var i = 0; i < 64; ++i) { + _k[i] = Math.floor(Math.abs(Math.sin(i + 1)) * 0x100000000); + } + + // now initialized + _initialized = true; +} + +/** + * Updates an MD5 state with the given byte buffer. + * + * @param s the MD5 state to update. + * @param w the array to use to store words. + * @param bytes the byte buffer to update with. + */ +function _update(s, w, bytes) { + // consume 512 bit (64 byte) chunks + var t, a, b, c, d, f, r, i; + var len = bytes.length(); + while(len >= 64) { + // initialize hash value for this chunk + a = s.h0; + b = s.h1; + c = s.h2; + d = s.h3; + + // round 1 + for(i = 0; i < 16; ++i) { + w[i] = bytes.getInt32Le(); + f = d ^ (b & (c ^ d)); + t = (a + f + _k[i] + w[i]); + r = _r[i]; + a = d; + d = c; + c = b; + b += (t << r) | (t >>> (32 - r)); + } + // round 2 + for(; i < 32; ++i) { + f = c ^ (d & (b ^ c)); + t = (a + f + _k[i] + w[_g[i]]); + r = _r[i]; + a = d; + d = c; + c = b; + b += (t << r) | (t >>> (32 - r)); + } + // round 3 + for(; i < 48; ++i) { + f = b ^ c ^ d; + t = (a + f + _k[i] + w[_g[i]]); + r = _r[i]; + a = d; + d = c; + c = b; + b += (t << r) | (t >>> (32 - r)); + } + // round 4 + for(; i < 64; ++i) { + f = c ^ (b | ~d); + t = (a + f + _k[i] + w[_g[i]]); + r = _r[i]; + a = d; + d = c; + c = b; + b += (t << r) | (t >>> (32 - r)); + } + + // update hash state + s.h0 = (s.h0 + a) | 0; + s.h1 = (s.h1 + b) | 0; + s.h2 = (s.h2 + c) | 0; + s.h3 = (s.h3 + d) | 0; + + len -= 64; + } +} + + +/***/ }), + +/***/ 6971: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Node.js module for Forge mask generation functions. + * + * @author Stefan Siegl + * + * Copyright 2012 Stefan Siegl + */ +var forge = __webpack_require__(3832); +__webpack_require__(3453); + +module.exports = forge.mgf = forge.mgf || {}; +forge.mgf.mgf1 = forge.mgf1; + + +/***/ }), + +/***/ 3453: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of mask generation function MGF1. + * + * @author Stefan Siegl + * @author Dave Longley + * + * Copyright (c) 2012 Stefan Siegl + * Copyright (c) 2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); + +forge.mgf = forge.mgf || {}; +var mgf1 = module.exports = forge.mgf.mgf1 = forge.mgf1 = forge.mgf1 || {}; + +/** + * Creates a MGF1 mask generation function object. + * + * @param md the message digest API to use (eg: forge.md.sha1.create()). + * + * @return a mask generation function object. + */ +mgf1.create = function(md) { + var mgf = { + /** + * Generate mask of specified length. + * + * @param {String} seed The seed for mask generation. + * @param maskLen Number of bytes to generate. + * @return {String} The generated mask. + */ + generate: function(seed, maskLen) { + /* 2. Let T be the empty octet string. */ + var t = new forge.util.ByteBuffer(); + + /* 3. For counter from 0 to ceil(maskLen / hLen), do the following: */ + var len = Math.ceil(maskLen / md.digestLength); + for(var i = 0; i < len; i++) { + /* a. Convert counter to an octet string C of length 4 octets */ + var c = new forge.util.ByteBuffer(); + c.putInt32(i); + + /* b. Concatenate the hash of the seed mgfSeed and C to the octet + * string T: */ + md.start(); + md.update(seed + c.getBytes()); + t.putBuffer(md.digest()); + } + + /* Output the leading maskLen octets of T as the octet string mask. */ + t.truncate(t.length() - maskLen); + return t.getBytes(); + } + }; + + return mgf; +}; + + +/***/ }), + +/***/ 6270: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Object IDs for ASN.1. + * + * @author Dave Longley + * + * Copyright (c) 2010-2013 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); + +forge.pki = forge.pki || {}; +var oids = module.exports = forge.pki.oids = forge.oids = forge.oids || {}; + +// set id to name mapping and name to id mapping +function _IN(id, name) { + oids[id] = name; + oids[name] = id; +} +// set id to name mapping only +function _I_(id, name) { + oids[id] = name; +} + +// algorithm OIDs +_IN('1.2.840.113549.1.1.1', 'rsaEncryption'); +// Note: md2 & md4 not implemented +//_IN('1.2.840.113549.1.1.2', 'md2WithRSAEncryption'); +//_IN('1.2.840.113549.1.1.3', 'md4WithRSAEncryption'); +_IN('1.2.840.113549.1.1.4', 'md5WithRSAEncryption'); +_IN('1.2.840.113549.1.1.5', 'sha1WithRSAEncryption'); +_IN('1.2.840.113549.1.1.7', 'RSAES-OAEP'); +_IN('1.2.840.113549.1.1.8', 'mgf1'); +_IN('1.2.840.113549.1.1.9', 'pSpecified'); +_IN('1.2.840.113549.1.1.10', 'RSASSA-PSS'); +_IN('1.2.840.113549.1.1.11', 'sha256WithRSAEncryption'); +_IN('1.2.840.113549.1.1.12', 'sha384WithRSAEncryption'); +_IN('1.2.840.113549.1.1.13', 'sha512WithRSAEncryption'); +// Edwards-curve Digital Signature Algorithm (EdDSA) Ed25519 +_IN('1.3.101.112', 'EdDSA25519'); + +_IN('1.2.840.10040.4.3', 'dsa-with-sha1'); + +_IN('1.3.14.3.2.7', 'desCBC'); + +_IN('1.3.14.3.2.26', 'sha1'); +// Deprecated equivalent of sha1WithRSAEncryption +_IN('1.3.14.3.2.29', 'sha1WithRSASignature'); +_IN('2.16.840.1.101.3.4.2.1', 'sha256'); +_IN('2.16.840.1.101.3.4.2.2', 'sha384'); +_IN('2.16.840.1.101.3.4.2.3', 'sha512'); +_IN('2.16.840.1.101.3.4.2.4', 'sha224'); +_IN('2.16.840.1.101.3.4.2.5', 'sha512-224'); +_IN('2.16.840.1.101.3.4.2.6', 'sha512-256'); +_IN('1.2.840.113549.2.2', 'md2'); +_IN('1.2.840.113549.2.5', 'md5'); + +// pkcs#7 content types +_IN('1.2.840.113549.1.7.1', 'data'); +_IN('1.2.840.113549.1.7.2', 'signedData'); +_IN('1.2.840.113549.1.7.3', 'envelopedData'); +_IN('1.2.840.113549.1.7.4', 'signedAndEnvelopedData'); +_IN('1.2.840.113549.1.7.5', 'digestedData'); +_IN('1.2.840.113549.1.7.6', 'encryptedData'); + +// pkcs#9 oids +_IN('1.2.840.113549.1.9.1', 'emailAddress'); +_IN('1.2.840.113549.1.9.2', 'unstructuredName'); +_IN('1.2.840.113549.1.9.3', 'contentType'); +_IN('1.2.840.113549.1.9.4', 'messageDigest'); +_IN('1.2.840.113549.1.9.5', 'signingTime'); +_IN('1.2.840.113549.1.9.6', 'counterSignature'); +_IN('1.2.840.113549.1.9.7', 'challengePassword'); +_IN('1.2.840.113549.1.9.8', 'unstructuredAddress'); +_IN('1.2.840.113549.1.9.14', 'extensionRequest'); + +_IN('1.2.840.113549.1.9.20', 'friendlyName'); +_IN('1.2.840.113549.1.9.21', 'localKeyId'); +_IN('1.2.840.113549.1.9.22.1', 'x509Certificate'); + +// pkcs#12 safe bags +_IN('1.2.840.113549.1.12.10.1.1', 'keyBag'); +_IN('1.2.840.113549.1.12.10.1.2', 'pkcs8ShroudedKeyBag'); +_IN('1.2.840.113549.1.12.10.1.3', 'certBag'); +_IN('1.2.840.113549.1.12.10.1.4', 'crlBag'); +_IN('1.2.840.113549.1.12.10.1.5', 'secretBag'); +_IN('1.2.840.113549.1.12.10.1.6', 'safeContentsBag'); + +// password-based-encryption for pkcs#12 +_IN('1.2.840.113549.1.5.13', 'pkcs5PBES2'); +_IN('1.2.840.113549.1.5.12', 'pkcs5PBKDF2'); + +_IN('1.2.840.113549.1.12.1.1', 'pbeWithSHAAnd128BitRC4'); +_IN('1.2.840.113549.1.12.1.2', 'pbeWithSHAAnd40BitRC4'); +_IN('1.2.840.113549.1.12.1.3', 'pbeWithSHAAnd3-KeyTripleDES-CBC'); +_IN('1.2.840.113549.1.12.1.4', 'pbeWithSHAAnd2-KeyTripleDES-CBC'); +_IN('1.2.840.113549.1.12.1.5', 'pbeWithSHAAnd128BitRC2-CBC'); +_IN('1.2.840.113549.1.12.1.6', 'pbewithSHAAnd40BitRC2-CBC'); + +// hmac OIDs +_IN('1.2.840.113549.2.7', 'hmacWithSHA1'); +_IN('1.2.840.113549.2.8', 'hmacWithSHA224'); +_IN('1.2.840.113549.2.9', 'hmacWithSHA256'); +_IN('1.2.840.113549.2.10', 'hmacWithSHA384'); +_IN('1.2.840.113549.2.11', 'hmacWithSHA512'); + +// symmetric key algorithm oids +_IN('1.2.840.113549.3.7', 'des-EDE3-CBC'); +_IN('2.16.840.1.101.3.4.1.2', 'aes128-CBC'); +_IN('2.16.840.1.101.3.4.1.22', 'aes192-CBC'); +_IN('2.16.840.1.101.3.4.1.42', 'aes256-CBC'); + +// certificate issuer/subject OIDs +_IN('2.5.4.3', 'commonName'); +_IN('2.5.4.4', 'surname'); +_IN('2.5.4.5', 'serialNumber'); +_IN('2.5.4.6', 'countryName'); +_IN('2.5.4.7', 'localityName'); +_IN('2.5.4.8', 'stateOrProvinceName'); +_IN('2.5.4.9', 'streetAddress'); +_IN('2.5.4.10', 'organizationName'); +_IN('2.5.4.11', 'organizationalUnitName'); +_IN('2.5.4.12', 'title'); +_IN('2.5.4.13', 'description'); +_IN('2.5.4.15', 'businessCategory'); +_IN('2.5.4.17', 'postalCode'); +_IN('2.5.4.42', 'givenName'); +_IN('1.3.6.1.4.1.311.60.2.1.2', 'jurisdictionOfIncorporationStateOrProvinceName'); +_IN('1.3.6.1.4.1.311.60.2.1.3', 'jurisdictionOfIncorporationCountryName'); + +// X.509 extension OIDs +_IN('2.16.840.1.113730.1.1', 'nsCertType'); +_IN('2.16.840.1.113730.1.13', 'nsComment'); // deprecated in theory; still widely used +_I_('2.5.29.1', 'authorityKeyIdentifier'); // deprecated, use .35 +_I_('2.5.29.2', 'keyAttributes'); // obsolete use .37 or .15 +_I_('2.5.29.3', 'certificatePolicies'); // deprecated, use .32 +_I_('2.5.29.4', 'keyUsageRestriction'); // obsolete use .37 or .15 +_I_('2.5.29.5', 'policyMapping'); // deprecated use .33 +_I_('2.5.29.6', 'subtreesConstraint'); // obsolete use .30 +_I_('2.5.29.7', 'subjectAltName'); // deprecated use .17 +_I_('2.5.29.8', 'issuerAltName'); // deprecated use .18 +_I_('2.5.29.9', 'subjectDirectoryAttributes'); +_I_('2.5.29.10', 'basicConstraints'); // deprecated use .19 +_I_('2.5.29.11', 'nameConstraints'); // deprecated use .30 +_I_('2.5.29.12', 'policyConstraints'); // deprecated use .36 +_I_('2.5.29.13', 'basicConstraints'); // deprecated use .19 +_IN('2.5.29.14', 'subjectKeyIdentifier'); +_IN('2.5.29.15', 'keyUsage'); +_I_('2.5.29.16', 'privateKeyUsagePeriod'); +_IN('2.5.29.17', 'subjectAltName'); +_IN('2.5.29.18', 'issuerAltName'); +_IN('2.5.29.19', 'basicConstraints'); +_I_('2.5.29.20', 'cRLNumber'); +_I_('2.5.29.21', 'cRLReason'); +_I_('2.5.29.22', 'expirationDate'); +_I_('2.5.29.23', 'instructionCode'); +_I_('2.5.29.24', 'invalidityDate'); +_I_('2.5.29.25', 'cRLDistributionPoints'); // deprecated use .31 +_I_('2.5.29.26', 'issuingDistributionPoint'); // deprecated use .28 +_I_('2.5.29.27', 'deltaCRLIndicator'); +_I_('2.5.29.28', 'issuingDistributionPoint'); +_I_('2.5.29.29', 'certificateIssuer'); +_I_('2.5.29.30', 'nameConstraints'); +_IN('2.5.29.31', 'cRLDistributionPoints'); +_IN('2.5.29.32', 'certificatePolicies'); +_I_('2.5.29.33', 'policyMappings'); +_I_('2.5.29.34', 'policyConstraints'); // deprecated use .36 +_IN('2.5.29.35', 'authorityKeyIdentifier'); +_I_('2.5.29.36', 'policyConstraints'); +_IN('2.5.29.37', 'extKeyUsage'); +_I_('2.5.29.46', 'freshestCRL'); +_I_('2.5.29.54', 'inhibitAnyPolicy'); + +// extKeyUsage purposes +_IN('1.3.6.1.4.1.11129.2.4.2', 'timestampList'); +_IN('1.3.6.1.5.5.7.1.1', 'authorityInfoAccess'); +_IN('1.3.6.1.5.5.7.3.1', 'serverAuth'); +_IN('1.3.6.1.5.5.7.3.2', 'clientAuth'); +_IN('1.3.6.1.5.5.7.3.3', 'codeSigning'); +_IN('1.3.6.1.5.5.7.3.4', 'emailProtection'); +_IN('1.3.6.1.5.5.7.3.8', 'timeStamping'); + + +/***/ }), + +/***/ 7450: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Password-based encryption functions. + * + * @author Dave Longley + * @author Stefan Siegl + * + * Copyright (c) 2010-2013 Digital Bazaar, Inc. + * Copyright (c) 2012 Stefan Siegl + * + * An EncryptedPrivateKeyInfo: + * + * EncryptedPrivateKeyInfo ::= SEQUENCE { + * encryptionAlgorithm EncryptionAlgorithmIdentifier, + * encryptedData EncryptedData } + * + * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier + * + * EncryptedData ::= OCTET STRING + */ +var forge = __webpack_require__(3832); +__webpack_require__(8925); +__webpack_require__(3068); +__webpack_require__(3480); +__webpack_require__(8991); +__webpack_require__(6270); +__webpack_require__(8960); +__webpack_require__(6953); +__webpack_require__(9563); +__webpack_require__(9372); +__webpack_require__(8095); +__webpack_require__(7116); + +if(typeof BigInteger === 'undefined') { + var BigInteger = forge.jsbn.BigInteger; +} + +// shortcut for asn.1 API +var asn1 = forge.asn1; + +/* Password-based encryption implementation. */ +var pki = forge.pki = forge.pki || {}; +module.exports = pki.pbe = forge.pbe = forge.pbe || {}; +var oids = pki.oids; + +// validator for an EncryptedPrivateKeyInfo structure +// Note: Currently only works w/algorithm params +var encryptedPrivateKeyValidator = { + name: 'EncryptedPrivateKeyInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'EncryptedPrivateKeyInfo.encryptionAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'AlgorithmIdentifier.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'encryptionOid' + }, { + name: 'AlgorithmIdentifier.parameters', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'encryptionParams' + }] + }, { + // encryptedData + name: 'EncryptedPrivateKeyInfo.encryptedData', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'encryptedData' + }] +}; + +// validator for a PBES2Algorithms structure +// Note: Currently only works w/PBKDF2 + AES encryption schemes +var PBES2AlgorithmsValidator = { + name: 'PBES2Algorithms', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'PBES2Algorithms.keyDerivationFunc', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'PBES2Algorithms.keyDerivationFunc.oid', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'kdfOid' + }, { + name: 'PBES2Algorithms.params', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'PBES2Algorithms.params.salt', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'kdfSalt' + }, { + name: 'PBES2Algorithms.params.iterationCount', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'kdfIterationCount' + }, { + name: 'PBES2Algorithms.params.keyLength', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + optional: true, + capture: 'keyLength' + }, { + // prf + name: 'PBES2Algorithms.params.prf', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + optional: true, + value: [{ + name: 'PBES2Algorithms.params.prf.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'prfOid' + }] + }] + }] + }, { + name: 'PBES2Algorithms.encryptionScheme', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'PBES2Algorithms.encryptionScheme.oid', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'encOid' + }, { + name: 'PBES2Algorithms.encryptionScheme.iv', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'encIv' + }] + }] +}; + +var pkcs12PbeParamsValidator = { + name: 'pkcs-12PbeParams', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'pkcs-12PbeParams.salt', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'salt' + }, { + name: 'pkcs-12PbeParams.iterations', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'iterations' + }] +}; + +/** + * Encrypts a ASN.1 PrivateKeyInfo object, producing an EncryptedPrivateKeyInfo. + * + * PBES2Algorithms ALGORITHM-IDENTIFIER ::= + * { {PBES2-params IDENTIFIED BY id-PBES2}, ...} + * + * id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13} + * + * PBES2-params ::= SEQUENCE { + * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}}, + * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} + * } + * + * PBES2-KDFs ALGORITHM-IDENTIFIER ::= + * { {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ... } + * + * PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... } + * + * PBKDF2-params ::= SEQUENCE { + * salt CHOICE { + * specified OCTET STRING, + * otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}} + * }, + * iterationCount INTEGER (1..MAX), + * keyLength INTEGER (1..MAX) OPTIONAL, + * prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1 + * } + * + * @param obj the ASN.1 PrivateKeyInfo object. + * @param password the password to encrypt with. + * @param options: + * algorithm the encryption algorithm to use + * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'. + * count the iteration count to use. + * saltSize the salt size to use. + * prfAlgorithm the PRF message digest algorithm to use + * ('sha1', 'sha224', 'sha256', 'sha384', 'sha512') + * + * @return the ASN.1 EncryptedPrivateKeyInfo. + */ +pki.encryptPrivateKeyInfo = function(obj, password, options) { + // set default options + options = options || {}; + options.saltSize = options.saltSize || 8; + options.count = options.count || 2048; + options.algorithm = options.algorithm || 'aes128'; + options.prfAlgorithm = options.prfAlgorithm || 'sha1'; + + // generate PBE params + var salt = forge.random.getBytesSync(options.saltSize); + var count = options.count; + var countBytes = asn1.integerToDer(count); + var dkLen; + var encryptionAlgorithm; + var encryptedData; + if(options.algorithm.indexOf('aes') === 0 || options.algorithm === 'des') { + // do PBES2 + var ivLen, encOid, cipherFn; + switch(options.algorithm) { + case 'aes128': + dkLen = 16; + ivLen = 16; + encOid = oids['aes128-CBC']; + cipherFn = forge.aes.createEncryptionCipher; + break; + case 'aes192': + dkLen = 24; + ivLen = 16; + encOid = oids['aes192-CBC']; + cipherFn = forge.aes.createEncryptionCipher; + break; + case 'aes256': + dkLen = 32; + ivLen = 16; + encOid = oids['aes256-CBC']; + cipherFn = forge.aes.createEncryptionCipher; + break; + case 'des': + dkLen = 8; + ivLen = 8; + encOid = oids['desCBC']; + cipherFn = forge.des.createEncryptionCipher; + break; + default: + var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.'); + error.algorithm = options.algorithm; + throw error; + } + + // get PRF message digest + var prfAlgorithm = 'hmacWith' + options.prfAlgorithm.toUpperCase(); + var md = prfAlgorithmToMessageDigest(prfAlgorithm); + + // encrypt private key using pbe SHA-1 and AES/DES + var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md); + var iv = forge.random.getBytesSync(ivLen); + var cipher = cipherFn(dk); + cipher.start(iv); + cipher.update(asn1.toDer(obj)); + cipher.finish(); + encryptedData = cipher.output.getBytes(); + + // get PBKDF2-params + var params = createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm); + + encryptionAlgorithm = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(oids['pkcs5PBES2']).getBytes()), + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // keyDerivationFunc + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(oids['pkcs5PBKDF2']).getBytes()), + // PBKDF2-params + params + ]), + // encryptionScheme + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(encOid).getBytes()), + // iv + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, iv) + ]) + ]) + ]); + } else if(options.algorithm === '3des') { + // Do PKCS12 PBE + dkLen = 24; + + var saltBytes = new forge.util.ByteBuffer(salt); + var dk = pki.pbe.generatePkcs12Key(password, saltBytes, 1, count, dkLen); + var iv = pki.pbe.generatePkcs12Key(password, saltBytes, 2, count, dkLen); + var cipher = forge.des.createEncryptionCipher(dk); + cipher.start(iv); + cipher.update(asn1.toDer(obj)); + cipher.finish(); + encryptedData = cipher.output.getBytes(); + + encryptionAlgorithm = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(oids['pbeWithSHAAnd3-KeyTripleDES-CBC']).getBytes()), + // pkcs-12PbeParams + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // salt + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt), + // iteration count + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + countBytes.getBytes()) + ]) + ]); + } else { + var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.'); + error.algorithm = options.algorithm; + throw error; + } + + // EncryptedPrivateKeyInfo + var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // encryptionAlgorithm + encryptionAlgorithm, + // encryptedData + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, encryptedData) + ]); + return rval; +}; + +/** + * Decrypts a ASN.1 PrivateKeyInfo object. + * + * @param obj the ASN.1 EncryptedPrivateKeyInfo object. + * @param password the password to decrypt with. + * + * @return the ASN.1 PrivateKeyInfo on success, null on failure. + */ +pki.decryptPrivateKeyInfo = function(obj, password) { + var rval = null; + + // get PBE params + var capture = {}; + var errors = []; + if(!asn1.validate(obj, encryptedPrivateKeyValidator, capture, errors)) { + var error = new Error('Cannot read encrypted private key. ' + + 'ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); + error.errors = errors; + throw error; + } + + // get cipher + var oid = asn1.derToOid(capture.encryptionOid); + var cipher = pki.pbe.getCipher(oid, capture.encryptionParams, password); + + // get encrypted data + var encrypted = forge.util.createBuffer(capture.encryptedData); + + cipher.update(encrypted); + if(cipher.finish()) { + rval = asn1.fromDer(cipher.output); + } + + return rval; +}; + +/** + * Converts a EncryptedPrivateKeyInfo to PEM format. + * + * @param epki the EncryptedPrivateKeyInfo. + * @param maxline the maximum characters per line, defaults to 64. + * + * @return the PEM-formatted encrypted private key. + */ +pki.encryptedPrivateKeyToPem = function(epki, maxline) { + // convert to DER, then PEM-encode + var msg = { + type: 'ENCRYPTED PRIVATE KEY', + body: asn1.toDer(epki).getBytes() + }; + return forge.pem.encode(msg, {maxline: maxline}); +}; + +/** + * Converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format. Decryption + * is not performed. + * + * @param pem the EncryptedPrivateKeyInfo in PEM-format. + * + * @return the ASN.1 EncryptedPrivateKeyInfo. + */ +pki.encryptedPrivateKeyFromPem = function(pem) { + var msg = forge.pem.decode(pem)[0]; + + if(msg.type !== 'ENCRYPTED PRIVATE KEY') { + var error = new Error('Could not convert encrypted private key from PEM; ' + + 'PEM header type is "ENCRYPTED PRIVATE KEY".'); + error.headerType = msg.type; + throw error; + } + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error('Could not convert encrypted private key from PEM; ' + + 'PEM is encrypted.'); + } + + // convert DER to ASN.1 object + return asn1.fromDer(msg.body); +}; + +/** + * Encrypts an RSA private key. By default, the key will be wrapped in + * a PrivateKeyInfo and encrypted to produce a PKCS#8 EncryptedPrivateKeyInfo. + * This is the standard, preferred way to encrypt a private key. + * + * To produce a non-standard PEM-encrypted private key that uses encapsulated + * headers to indicate the encryption algorithm (old-style non-PKCS#8 OpenSSL + * private key encryption), set the 'legacy' option to true. Note: Using this + * option will cause the iteration count to be forced to 1. + * + * Note: The 'des' algorithm is supported, but it is not considered to be + * secure because it only uses a single 56-bit key. If possible, it is highly + * recommended that a different algorithm be used. + * + * @param rsaKey the RSA key to encrypt. + * @param password the password to use. + * @param options: + * algorithm: the encryption algorithm to use + * ('aes128', 'aes192', 'aes256', '3des', 'des'). + * count: the iteration count to use. + * saltSize: the salt size to use. + * legacy: output an old non-PKCS#8 PEM-encrypted+encapsulated + * headers (DEK-Info) private key. + * + * @return the PEM-encoded ASN.1 EncryptedPrivateKeyInfo. + */ +pki.encryptRsaPrivateKey = function(rsaKey, password, options) { + // standard PKCS#8 + options = options || {}; + if(!options.legacy) { + // encrypt PrivateKeyInfo + var rval = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(rsaKey)); + rval = pki.encryptPrivateKeyInfo(rval, password, options); + return pki.encryptedPrivateKeyToPem(rval); + } + + // legacy non-PKCS#8 + var algorithm; + var iv; + var dkLen; + var cipherFn; + switch(options.algorithm) { + case 'aes128': + algorithm = 'AES-128-CBC'; + dkLen = 16; + iv = forge.random.getBytesSync(16); + cipherFn = forge.aes.createEncryptionCipher; + break; + case 'aes192': + algorithm = 'AES-192-CBC'; + dkLen = 24; + iv = forge.random.getBytesSync(16); + cipherFn = forge.aes.createEncryptionCipher; + break; + case 'aes256': + algorithm = 'AES-256-CBC'; + dkLen = 32; + iv = forge.random.getBytesSync(16); + cipherFn = forge.aes.createEncryptionCipher; + break; + case '3des': + algorithm = 'DES-EDE3-CBC'; + dkLen = 24; + iv = forge.random.getBytesSync(8); + cipherFn = forge.des.createEncryptionCipher; + break; + case 'des': + algorithm = 'DES-CBC'; + dkLen = 8; + iv = forge.random.getBytesSync(8); + cipherFn = forge.des.createEncryptionCipher; + break; + default: + var error = new Error('Could not encrypt RSA private key; unsupported ' + + 'encryption algorithm "' + options.algorithm + '".'); + error.algorithm = options.algorithm; + throw error; + } + + // encrypt private key using OpenSSL legacy key derivation + var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen); + var cipher = cipherFn(dk); + cipher.start(iv); + cipher.update(asn1.toDer(pki.privateKeyToAsn1(rsaKey))); + cipher.finish(); + + var msg = { + type: 'RSA PRIVATE KEY', + procType: { + version: '4', + type: 'ENCRYPTED' + }, + dekInfo: { + algorithm: algorithm, + parameters: forge.util.bytesToHex(iv).toUpperCase() + }, + body: cipher.output.getBytes() + }; + return forge.pem.encode(msg); +}; + +/** + * Decrypts an RSA private key. + * + * @param pem the PEM-formatted EncryptedPrivateKeyInfo to decrypt. + * @param password the password to use. + * + * @return the RSA key on success, null on failure. + */ +pki.decryptRsaPrivateKey = function(pem, password) { + var rval = null; + + var msg = forge.pem.decode(pem)[0]; + + if(msg.type !== 'ENCRYPTED PRIVATE KEY' && + msg.type !== 'PRIVATE KEY' && + msg.type !== 'RSA PRIVATE KEY') { + var error = new Error('Could not convert private key from PEM; PEM header type ' + + 'is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'); + error.headerType = error; + throw error; + } + + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + var dkLen; + var cipherFn; + switch(msg.dekInfo.algorithm) { + case 'DES-CBC': + dkLen = 8; + cipherFn = forge.des.createDecryptionCipher; + break; + case 'DES-EDE3-CBC': + dkLen = 24; + cipherFn = forge.des.createDecryptionCipher; + break; + case 'AES-128-CBC': + dkLen = 16; + cipherFn = forge.aes.createDecryptionCipher; + break; + case 'AES-192-CBC': + dkLen = 24; + cipherFn = forge.aes.createDecryptionCipher; + break; + case 'AES-256-CBC': + dkLen = 32; + cipherFn = forge.aes.createDecryptionCipher; + break; + case 'RC2-40-CBC': + dkLen = 5; + cipherFn = function(key) { + return forge.rc2.createDecryptionCipher(key, 40); + }; + break; + case 'RC2-64-CBC': + dkLen = 8; + cipherFn = function(key) { + return forge.rc2.createDecryptionCipher(key, 64); + }; + break; + case 'RC2-128-CBC': + dkLen = 16; + cipherFn = function(key) { + return forge.rc2.createDecryptionCipher(key, 128); + }; + break; + default: + var error = new Error('Could not decrypt private key; unsupported ' + + 'encryption algorithm "' + msg.dekInfo.algorithm + '".'); + error.algorithm = msg.dekInfo.algorithm; + throw error; + } + + // use OpenSSL legacy key derivation + var iv = forge.util.hexToBytes(msg.dekInfo.parameters); + var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen); + var cipher = cipherFn(dk); + cipher.start(iv); + cipher.update(forge.util.createBuffer(msg.body)); + if(cipher.finish()) { + rval = cipher.output.getBytes(); + } else { + return rval; + } + } else { + rval = msg.body; + } + + if(msg.type === 'ENCRYPTED PRIVATE KEY') { + rval = pki.decryptPrivateKeyInfo(asn1.fromDer(rval), password); + } else { + // decryption already performed above + rval = asn1.fromDer(rval); + } + + if(rval !== null) { + rval = pki.privateKeyFromAsn1(rval); + } + + return rval; +}; + +/** + * Derives a PKCS#12 key. + * + * @param password the password to derive the key material from, null or + * undefined for none. + * @param salt the salt, as a ByteBuffer, to use. + * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC). + * @param iter the iteration count. + * @param n the number of bytes to derive from the password. + * @param md the message digest to use, defaults to SHA-1. + * + * @return a ByteBuffer with the bytes derived from the password. + */ +pki.pbe.generatePkcs12Key = function(password, salt, id, iter, n, md) { + var j, l; + + if(typeof md === 'undefined' || md === null) { + if(!('sha1' in forge.md)) { + throw new Error('"sha1" hash algorithm unavailable.'); + } + md = forge.md.sha1.create(); + } + + var u = md.digestLength; + var v = md.blockLength; + var result = new forge.util.ByteBuffer(); + + /* Convert password to Unicode byte buffer + trailing 0-byte. */ + var passBuf = new forge.util.ByteBuffer(); + if(password !== null && password !== undefined) { + for(l = 0; l < password.length; l++) { + passBuf.putInt16(password.charCodeAt(l)); + } + passBuf.putInt16(0); + } + + /* Length of salt and password in BYTES. */ + var p = passBuf.length(); + var s = salt.length(); + + /* 1. Construct a string, D (the "diversifier"), by concatenating + v copies of ID. */ + var D = new forge.util.ByteBuffer(); + D.fillWithByte(id, v); + + /* 2. Concatenate copies of the salt together to create a string S of length + v * ceil(s / v) bytes (the final copy of the salt may be trunacted + to create S). + Note that if the salt is the empty string, then so is S. */ + var Slen = v * Math.ceil(s / v); + var S = new forge.util.ByteBuffer(); + for(l = 0; l < Slen; l++) { + S.putByte(salt.at(l % s)); + } + + /* 3. Concatenate copies of the password together to create a string P of + length v * ceil(p / v) bytes (the final copy of the password may be + truncated to create P). + Note that if the password is the empty string, then so is P. */ + var Plen = v * Math.ceil(p / v); + var P = new forge.util.ByteBuffer(); + for(l = 0; l < Plen; l++) { + P.putByte(passBuf.at(l % p)); + } + + /* 4. Set I=S||P to be the concatenation of S and P. */ + var I = S; + I.putBuffer(P); + + /* 5. Set c=ceil(n / u). */ + var c = Math.ceil(n / u); + + /* 6. For i=1, 2, ..., c, do the following: */ + for(var i = 1; i <= c; i++) { + /* a) Set Ai=H^r(D||I). (l.e. the rth hash of D||I, H(H(H(...H(D||I)))) */ + var buf = new forge.util.ByteBuffer(); + buf.putBytes(D.bytes()); + buf.putBytes(I.bytes()); + for(var round = 0; round < iter; round++) { + md.start(); + md.update(buf.getBytes()); + buf = md.digest(); + } + + /* b) Concatenate copies of Ai to create a string B of length v bytes (the + final copy of Ai may be truncated to create B). */ + var B = new forge.util.ByteBuffer(); + for(l = 0; l < v; l++) { + B.putByte(buf.at(l % u)); + } + + /* c) Treating I as a concatenation I0, I1, ..., Ik-1 of v-byte blocks, + where k=ceil(s / v) + ceil(p / v), modify I by setting + Ij=(Ij+B+1) mod 2v for each j. */ + var k = Math.ceil(s / v) + Math.ceil(p / v); + var Inew = new forge.util.ByteBuffer(); + for(j = 0; j < k; j++) { + var chunk = new forge.util.ByteBuffer(I.getBytes(v)); + var x = 0x1ff; + for(l = B.length() - 1; l >= 0; l--) { + x = x >> 8; + x += B.at(l) + chunk.at(l); + chunk.setAt(l, x & 0xff); + } + Inew.putBuffer(chunk); + } + I = Inew; + + /* Add Ai to A. */ + result.putBuffer(buf); + } + + result.truncate(result.length() - n); + return result; +}; + +/** + * Get new Forge cipher object instance. + * + * @param oid the OID (in string notation). + * @param params the ASN.1 params object. + * @param password the password to decrypt with. + * + * @return new cipher object instance. + */ +pki.pbe.getCipher = function(oid, params, password) { + switch(oid) { + case pki.oids['pkcs5PBES2']: + return pki.pbe.getCipherForPBES2(oid, params, password); + + case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']: + case pki.oids['pbewithSHAAnd40BitRC2-CBC']: + return pki.pbe.getCipherForPKCS12PBE(oid, params, password); + + default: + var error = new Error('Cannot read encrypted PBE data block. Unsupported OID.'); + error.oid = oid; + error.supportedOids = [ + 'pkcs5PBES2', + 'pbeWithSHAAnd3-KeyTripleDES-CBC', + 'pbewithSHAAnd40BitRC2-CBC' + ]; + throw error; + } +}; + +/** + * Get new Forge cipher object instance according to PBES2 params block. + * + * The returned cipher instance is already started using the IV + * from PBES2 parameter block. + * + * @param oid the PKCS#5 PBKDF2 OID (in string notation). + * @param params the ASN.1 PBES2-params object. + * @param password the password to decrypt with. + * + * @return new cipher object instance. + */ +pki.pbe.getCipherForPBES2 = function(oid, params, password) { + // get PBE params + var capture = {}; + var errors = []; + if(!asn1.validate(params, PBES2AlgorithmsValidator, capture, errors)) { + var error = new Error('Cannot read password-based-encryption algorithm ' + + 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); + error.errors = errors; + throw error; + } + + // check oids + oid = asn1.derToOid(capture.kdfOid); + if(oid !== pki.oids['pkcs5PBKDF2']) { + var error = new Error('Cannot read encrypted private key. ' + + 'Unsupported key derivation function OID.'); + error.oid = oid; + error.supportedOids = ['pkcs5PBKDF2']; + throw error; + } + oid = asn1.derToOid(capture.encOid); + if(oid !== pki.oids['aes128-CBC'] && + oid !== pki.oids['aes192-CBC'] && + oid !== pki.oids['aes256-CBC'] && + oid !== pki.oids['des-EDE3-CBC'] && + oid !== pki.oids['desCBC']) { + var error = new Error('Cannot read encrypted private key. ' + + 'Unsupported encryption scheme OID.'); + error.oid = oid; + error.supportedOids = [ + 'aes128-CBC', 'aes192-CBC', 'aes256-CBC', 'des-EDE3-CBC', 'desCBC']; + throw error; + } + + // set PBE params + var salt = capture.kdfSalt; + var count = forge.util.createBuffer(capture.kdfIterationCount); + count = count.getInt(count.length() << 3); + var dkLen; + var cipherFn; + switch(pki.oids[oid]) { + case 'aes128-CBC': + dkLen = 16; + cipherFn = forge.aes.createDecryptionCipher; + break; + case 'aes192-CBC': + dkLen = 24; + cipherFn = forge.aes.createDecryptionCipher; + break; + case 'aes256-CBC': + dkLen = 32; + cipherFn = forge.aes.createDecryptionCipher; + break; + case 'des-EDE3-CBC': + dkLen = 24; + cipherFn = forge.des.createDecryptionCipher; + break; + case 'desCBC': + dkLen = 8; + cipherFn = forge.des.createDecryptionCipher; + break; + } + + // get PRF message digest + var md = prfOidToMessageDigest(capture.prfOid); + + // decrypt private key using pbe with chosen PRF and AES/DES + var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md); + var iv = capture.encIv; + var cipher = cipherFn(dk); + cipher.start(iv); + + return cipher; +}; + +/** + * Get new Forge cipher object instance for PKCS#12 PBE. + * + * The returned cipher instance is already started using the key & IV + * derived from the provided password and PKCS#12 PBE salt. + * + * @param oid The PKCS#12 PBE OID (in string notation). + * @param params The ASN.1 PKCS#12 PBE-params object. + * @param password The password to decrypt with. + * + * @return the new cipher object instance. + */ +pki.pbe.getCipherForPKCS12PBE = function(oid, params, password) { + // get PBE params + var capture = {}; + var errors = []; + if(!asn1.validate(params, pkcs12PbeParamsValidator, capture, errors)) { + var error = new Error('Cannot read password-based-encryption algorithm ' + + 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); + error.errors = errors; + throw error; + } + + var salt = forge.util.createBuffer(capture.salt); + var count = forge.util.createBuffer(capture.iterations); + count = count.getInt(count.length() << 3); + + var dkLen, dIvLen, cipherFn; + switch(oid) { + case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']: + dkLen = 24; + dIvLen = 8; + cipherFn = forge.des.startDecrypting; + break; + + case pki.oids['pbewithSHAAnd40BitRC2-CBC']: + dkLen = 5; + dIvLen = 8; + cipherFn = function(key, iv) { + var cipher = forge.rc2.createDecryptionCipher(key, 40); + cipher.start(iv, null); + return cipher; + }; + break; + + default: + var error = new Error('Cannot read PKCS #12 PBE data block. Unsupported OID.'); + error.oid = oid; + throw error; + } + + // get PRF message digest + var md = prfOidToMessageDigest(capture.prfOid); + var key = pki.pbe.generatePkcs12Key(password, salt, 1, count, dkLen, md); + md.start(); + var iv = pki.pbe.generatePkcs12Key(password, salt, 2, count, dIvLen, md); + + return cipherFn(key, iv); +}; + +/** + * OpenSSL's legacy key derivation function. + * + * See: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html + * + * @param password the password to derive the key from. + * @param salt the salt to use, null for none. + * @param dkLen the number of bytes needed for the derived key. + * @param [options] the options to use: + * [md] an optional message digest object to use. + */ +pki.pbe.opensslDeriveBytes = function(password, salt, dkLen, md) { + if(typeof md === 'undefined' || md === null) { + if(!('md5' in forge.md)) { + throw new Error('"md5" hash algorithm unavailable.'); + } + md = forge.md.md5.create(); + } + if(salt === null) { + salt = ''; + } + var digests = [hash(md, password + salt)]; + for(var length = 16, i = 1; length < dkLen; ++i, length += 16) { + digests.push(hash(md, digests[i - 1] + password + salt)); + } + return digests.join('').substr(0, dkLen); +}; + +function hash(md, bytes) { + return md.start().update(bytes).digest().getBytes(); +} + +function prfOidToMessageDigest(prfOid) { + // get PRF algorithm, default to SHA-1 + var prfAlgorithm; + if(!prfOid) { + prfAlgorithm = 'hmacWithSHA1'; + } else { + prfAlgorithm = pki.oids[asn1.derToOid(prfOid)]; + if(!prfAlgorithm) { + var error = new Error('Unsupported PRF OID.'); + error.oid = prfOid; + error.supported = [ + 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384', + 'hmacWithSHA512']; + throw error; + } + } + return prfAlgorithmToMessageDigest(prfAlgorithm); +} + +function prfAlgorithmToMessageDigest(prfAlgorithm) { + var factory = forge.md; + switch(prfAlgorithm) { + case 'hmacWithSHA224': + factory = forge.md.sha512; + case 'hmacWithSHA1': + case 'hmacWithSHA256': + case 'hmacWithSHA384': + case 'hmacWithSHA512': + prfAlgorithm = prfAlgorithm.substr(8).toLowerCase(); + break; + default: + var error = new Error('Unsupported PRF algorithm.'); + error.algorithm = prfAlgorithm; + error.supported = [ + 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384', + 'hmacWithSHA512']; + throw error; + } + if(!factory || !(prfAlgorithm in factory)) { + throw new Error('Unknown hash algorithm: ' + prfAlgorithm); + } + return factory[prfAlgorithm].create(); +} + +function createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm) { + var params = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // salt + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt), + // iteration count + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + countBytes.getBytes()) + ]); + // when PRF algorithm is not SHA-1 default, add key length and PRF algorithm + if(prfAlgorithm !== 'hmacWithSHA1') { + params.value.push( + // key length + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + forge.util.hexToBytes(dkLen.toString(16))), + // AlgorithmIdentifier + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids[prfAlgorithm]).getBytes()), + // parameters (null) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ])); + } + return params; +} + + +/***/ }), + +/***/ 8960: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Password-Based Key-Derivation Function #2 implementation. + * + * See RFC 2898 for details. + * + * @author Dave Longley + * + * Copyright (c) 2010-2013 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(6607); +__webpack_require__(8991); +__webpack_require__(7116); + +var pkcs5 = forge.pkcs5 = forge.pkcs5 || {}; + +var crypto; +if(forge.util.isNodejs && !forge.options.usePureJavaScript) { + crypto = __webpack_require__(5819); +} + +/** + * Derives a key from a password. + * + * @param p the password as a binary-encoded string of bytes. + * @param s the salt as a binary-encoded string of bytes. + * @param c the iteration count, a positive integer. + * @param dkLen the intended length, in bytes, of the derived key, + * (max: 2^32 - 1) * hash length of the PRF. + * @param [md] the message digest (or algorithm identifier as a string) to use + * in the PRF, defaults to SHA-1. + * @param [callback(err, key)] presence triggers asynchronous version, called + * once the operation completes. + * + * @return the derived key, as a binary-encoded string of bytes, for the + * synchronous version (if no callback is specified). + */ +module.exports = forge.pbkdf2 = pkcs5.pbkdf2 = function( + p, s, c, dkLen, md, callback) { + if(typeof md === 'function') { + callback = md; + md = null; + } + + // use native implementation if possible and not disabled, note that + // some node versions only support SHA-1, others allow digest to be changed + if(forge.util.isNodejs && !forge.options.usePureJavaScript && + crypto.pbkdf2 && (md === null || typeof md !== 'object') && + (crypto.pbkdf2Sync.length > 4 || (!md || md === 'sha1'))) { + if(typeof md !== 'string') { + // default prf to SHA-1 + md = 'sha1'; + } + p = Buffer.from(p, 'binary'); + s = Buffer.from(s, 'binary'); + if(!callback) { + if(crypto.pbkdf2Sync.length === 4) { + return crypto.pbkdf2Sync(p, s, c, dkLen).toString('binary'); + } + return crypto.pbkdf2Sync(p, s, c, dkLen, md).toString('binary'); + } + if(crypto.pbkdf2Sync.length === 4) { + return crypto.pbkdf2(p, s, c, dkLen, function(err, key) { + if(err) { + return callback(err); + } + callback(null, key.toString('binary')); + }); + } + return crypto.pbkdf2(p, s, c, dkLen, md, function(err, key) { + if(err) { + return callback(err); + } + callback(null, key.toString('binary')); + }); + } + + if(typeof md === 'undefined' || md === null) { + // default prf to SHA-1 + md = 'sha1'; + } + if(typeof md === 'string') { + if(!(md in forge.md.algorithms)) { + throw new Error('Unknown hash algorithm: ' + md); + } + md = forge.md[md].create(); + } + + var hLen = md.digestLength; + + /* 1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and + stop. */ + if(dkLen > (0xFFFFFFFF * hLen)) { + var err = new Error('Derived key is too long.'); + if(callback) { + return callback(err); + } + throw err; + } + + /* 2. Let len be the number of hLen-octet blocks in the derived key, + rounding up, and let r be the number of octets in the last + block: + + len = CEIL(dkLen / hLen), + r = dkLen - (len - 1) * hLen. */ + var len = Math.ceil(dkLen / hLen); + var r = dkLen - (len - 1) * hLen; + + /* 3. For each block of the derived key apply the function F defined + below to the password P, the salt S, the iteration count c, and + the block index to compute the block: + + T_1 = F(P, S, c, 1), + T_2 = F(P, S, c, 2), + ... + T_len = F(P, S, c, len), + + where the function F is defined as the exclusive-or sum of the + first c iterates of the underlying pseudorandom function PRF + applied to the password P and the concatenation of the salt S + and the block index i: + + F(P, S, c, i) = u_1 XOR u_2 XOR ... XOR u_c + + where + + u_1 = PRF(P, S || INT(i)), + u_2 = PRF(P, u_1), + ... + u_c = PRF(P, u_{c-1}). + + Here, INT(i) is a four-octet encoding of the integer i, most + significant octet first. */ + var prf = forge.hmac.create(); + prf.start(md, p); + var dk = ''; + var xor, u_c, u_c1; + + // sync version + if(!callback) { + for(var i = 1; i <= len; ++i) { + // PRF(P, S || INT(i)) (first iteration) + prf.start(null, null); + prf.update(s); + prf.update(forge.util.int32ToBytes(i)); + xor = u_c1 = prf.digest().getBytes(); + + // PRF(P, u_{c-1}) (other iterations) + for(var j = 2; j <= c; ++j) { + prf.start(null, null); + prf.update(u_c1); + u_c = prf.digest().getBytes(); + // F(p, s, c, i) + xor = forge.util.xorBytes(xor, u_c, hLen); + u_c1 = u_c; + } + + /* 4. Concatenate the blocks and extract the first dkLen octets to + produce a derived key DK: + + DK = T_1 || T_2 || ... || T_len<0..r-1> */ + dk += (i < len) ? xor : xor.substr(0, r); + } + /* 5. Output the derived key DK. */ + return dk; + } + + // async version + var i = 1, j; + function outer() { + if(i > len) { + // done + return callback(null, dk); + } + + // PRF(P, S || INT(i)) (first iteration) + prf.start(null, null); + prf.update(s); + prf.update(forge.util.int32ToBytes(i)); + xor = u_c1 = prf.digest().getBytes(); + + // PRF(P, u_{c-1}) (other iterations) + j = 2; + inner(); + } + + function inner() { + if(j <= c) { + prf.start(null, null); + prf.update(u_c1); + u_c = prf.digest().getBytes(); + // F(p, s, c, i) + xor = forge.util.xorBytes(xor, u_c, hLen); + u_c1 = u_c; + ++j; + return forge.util.setImmediate(inner); + } + + /* 4. Concatenate the blocks and extract the first dkLen octets to + produce a derived key DK: + + DK = T_1 || T_2 || ... || T_len<0..r-1> */ + dk += (i < len) ? xor : xor.substr(0, r); + + ++i; + outer(); + } + + outer(); +}; + + +/***/ }), + +/***/ 6953: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of basic PEM (Privacy Enhanced Mail) algorithms. + * + * See: RFC 1421. + * + * @author Dave Longley + * + * Copyright (c) 2013-2014 Digital Bazaar, Inc. + * + * A Forge PEM object has the following fields: + * + * type: identifies the type of message (eg: "RSA PRIVATE KEY"). + * + * procType: identifies the type of processing performed on the message, + * it has two subfields: version and type, eg: 4,ENCRYPTED. + * + * contentDomain: identifies the type of content in the message, typically + * only uses the value: "RFC822". + * + * dekInfo: identifies the message encryption algorithm and mode and includes + * any parameters for the algorithm, it has two subfields: algorithm and + * parameters, eg: DES-CBC,F8143EDE5960C597. + * + * headers: contains all other PEM encapsulated headers -- where order is + * significant (for pairing data like recipient ID + key info). + * + * body: the binary-encoded body. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); + +// shortcut for pem API +var pem = module.exports = forge.pem = forge.pem || {}; + +/** + * Encodes (serializes) the given PEM object. + * + * @param msg the PEM message object to encode. + * @param options the options to use: + * maxline the maximum characters per line for the body, (default: 64). + * + * @return the PEM-formatted string. + */ +pem.encode = function(msg, options) { + options = options || {}; + var rval = '-----BEGIN ' + msg.type + '-----\r\n'; + + // encode special headers + var header; + if(msg.procType) { + header = { + name: 'Proc-Type', + values: [String(msg.procType.version), msg.procType.type] + }; + rval += foldHeader(header); + } + if(msg.contentDomain) { + header = {name: 'Content-Domain', values: [msg.contentDomain]}; + rval += foldHeader(header); + } + if(msg.dekInfo) { + header = {name: 'DEK-Info', values: [msg.dekInfo.algorithm]}; + if(msg.dekInfo.parameters) { + header.values.push(msg.dekInfo.parameters); + } + rval += foldHeader(header); + } + + if(msg.headers) { + // encode all other headers + for(var i = 0; i < msg.headers.length; ++i) { + rval += foldHeader(msg.headers[i]); + } + } + + // terminate header + if(msg.procType) { + rval += '\r\n'; + } + + // add body + rval += forge.util.encode64(msg.body, options.maxline || 64) + '\r\n'; + + rval += '-----END ' + msg.type + '-----\r\n'; + return rval; +}; + +/** + * Decodes (deserializes) all PEM messages found in the given string. + * + * @param str the PEM-formatted string to decode. + * + * @return the PEM message objects in an array. + */ +pem.decode = function(str) { + var rval = []; + + // split string into PEM messages (be lenient w/EOF on BEGIN line) + var rMessage = /\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g; + var rHeader = /([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/; + var rCRLF = /\r?\n/; + var match; + while(true) { + match = rMessage.exec(str); + if(!match) { + break; + } + + // accept "NEW CERTIFICATE REQUEST" as "CERTIFICATE REQUEST" + // https://datatracker.ietf.org/doc/html/rfc7468#section-7 + var type = match[1]; + if(type === 'NEW CERTIFICATE REQUEST') { + type = 'CERTIFICATE REQUEST'; + } + + var msg = { + type: type, + procType: null, + contentDomain: null, + dekInfo: null, + headers: [], + body: forge.util.decode64(match[3]) + }; + rval.push(msg); + + // no headers + if(!match[2]) { + continue; + } + + // parse headers + var lines = match[2].split(rCRLF); + var li = 0; + while(match && li < lines.length) { + // get line, trim any rhs whitespace + var line = lines[li].replace(/\s+$/, ''); + + // RFC2822 unfold any following folded lines + for(var nl = li + 1; nl < lines.length; ++nl) { + var next = lines[nl]; + if(!/\s/.test(next[0])) { + break; + } + line += next; + li = nl; + } + + // parse header + match = line.match(rHeader); + if(match) { + var header = {name: match[1], values: []}; + var values = match[2].split(','); + for(var vi = 0; vi < values.length; ++vi) { + header.values.push(ltrim(values[vi])); + } + + // Proc-Type must be the first header + if(!msg.procType) { + if(header.name !== 'Proc-Type') { + throw new Error('Invalid PEM formatted message. The first ' + + 'encapsulated header must be "Proc-Type".'); + } else if(header.values.length !== 2) { + throw new Error('Invalid PEM formatted message. The "Proc-Type" ' + + 'header must have two subfields.'); + } + msg.procType = {version: values[0], type: values[1]}; + } else if(!msg.contentDomain && header.name === 'Content-Domain') { + // special-case Content-Domain + msg.contentDomain = values[0] || ''; + } else if(!msg.dekInfo && header.name === 'DEK-Info') { + // special-case DEK-Info + if(header.values.length === 0) { + throw new Error('Invalid PEM formatted message. The "DEK-Info" ' + + 'header must have at least one subfield.'); + } + msg.dekInfo = {algorithm: values[0], parameters: values[1] || null}; + } else { + msg.headers.push(header); + } + } + + ++li; + } + + if(msg.procType === 'ENCRYPTED' && !msg.dekInfo) { + throw new Error('Invalid PEM formatted message. The "DEK-Info" ' + + 'header must be present if "Proc-Type" is "ENCRYPTED".'); + } + } + + if(rval.length === 0) { + throw new Error('Invalid PEM formatted message.'); + } + + return rval; +}; + +function foldHeader(header) { + var rval = header.name + ': '; + + // ensure values with CRLF are folded + var values = []; + var insertSpace = function(match, $1) { + return ' ' + $1; + }; + for(var i = 0; i < header.values.length; ++i) { + values.push(header.values[i].replace(/^(\S+\r\n)/, insertSpace)); + } + rval += values.join(',') + '\r\n'; + + // do folding + var length = 0; + var candidate = -1; + for(var i = 0; i < rval.length; ++i, ++length) { + if(length > 65 && candidate !== -1) { + var insert = rval[candidate]; + if(insert === ',') { + ++candidate; + rval = rval.substr(0, candidate) + '\r\n ' + rval.substr(candidate); + } else { + rval = rval.substr(0, candidate) + + '\r\n' + insert + rval.substr(candidate + 1); + } + length = (i - candidate - 1); + candidate = -1; + ++i; + } else if(rval[i] === ' ' || rval[i] === '\t' || rval[i] === ',') { + candidate = i; + } + } + + return rval; +} + +function ltrim(str) { + return str.replace(/^\s+/, ''); +} + + +/***/ }), + +/***/ 8936: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Partial implementation of PKCS#1 v2.2: RSA-OEAP + * + * Modified but based on the following MIT and BSD licensed code: + * + * https://github.com/kjur/jsjws/blob/master/rsa.js: + * + * The 'jsjws'(JSON Web Signature JavaScript Library) License + * + * Copyright (c) 2012 Kenji Urushima + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * http://webrsa.cvs.sourceforge.net/viewvc/webrsa/Client/RSAES-OAEP.js?content-type=text%2Fplain: + * + * RSAES-OAEP.js + * $Id: RSAES-OAEP.js,v 1.1.1.1 2003/03/19 15:37:20 ellispritchard Exp $ + * JavaScript Implementation of PKCS #1 v2.1 RSA CRYPTOGRAPHY STANDARD (RSA Laboratories, June 14, 2002) + * Copyright (C) Ellis Pritchard, Guardian Unlimited 2003. + * Contact: ellis@nukinetics.com + * Distributed under the BSD License. + * + * Official documentation: http://www.rsa.com/rsalabs/node.asp?id=2125 + * + * @author Evan Jones (http://evanjones.ca/) + * @author Dave Longley + * + * Copyright (c) 2013-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); +__webpack_require__(9563); +__webpack_require__(137); + +// shortcut for PKCS#1 API +var pkcs1 = module.exports = forge.pkcs1 = forge.pkcs1 || {}; + +/** + * Encode the given RSAES-OAEP message (M) using key, with optional label (L) + * and seed. + * + * This method does not perform RSA encryption, it only encodes the message + * using RSAES-OAEP. + * + * @param key the RSA key to use. + * @param message the message to encode. + * @param options the options to use: + * label an optional label to use. + * seed the seed to use. + * md the message digest object to use, undefined for SHA-1. + * mgf1 optional mgf1 parameters: + * md the message digest object to use for MGF1. + * + * @return the encoded message bytes. + */ +pkcs1.encode_rsa_oaep = function(key, message, options) { + // parse arguments + var label; + var seed; + var md; + var mgf1Md; + // legacy args (label, seed, md) + if(typeof options === 'string') { + label = options; + seed = arguments[3] || undefined; + md = arguments[4] || undefined; + } else if(options) { + label = options.label || undefined; + seed = options.seed || undefined; + md = options.md || undefined; + if(options.mgf1 && options.mgf1.md) { + mgf1Md = options.mgf1.md; + } + } + + // default OAEP to SHA-1 message digest + if(!md) { + md = forge.md.sha1.create(); + } else { + md.start(); + } + + // default MGF-1 to same as OAEP + if(!mgf1Md) { + mgf1Md = md; + } + + // compute length in bytes and check output + var keyLength = Math.ceil(key.n.bitLength() / 8); + var maxLength = keyLength - 2 * md.digestLength - 2; + if(message.length > maxLength) { + var error = new Error('RSAES-OAEP input message length is too long.'); + error.length = message.length; + error.maxLength = maxLength; + throw error; + } + + if(!label) { + label = ''; + } + md.update(label, 'raw'); + var lHash = md.digest(); + + var PS = ''; + var PS_length = maxLength - message.length; + for(var i = 0; i < PS_length; i++) { + PS += '\x00'; + } + + var DB = lHash.getBytes() + PS + '\x01' + message; + + if(!seed) { + seed = forge.random.getBytes(md.digestLength); + } else if(seed.length !== md.digestLength) { + var error = new Error('Invalid RSAES-OAEP seed. The seed length must ' + + 'match the digest length.'); + error.seedLength = seed.length; + error.digestLength = md.digestLength; + throw error; + } + + var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md); + var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length); + + var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md); + var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length); + + // return encoded message + return '\x00' + maskedSeed + maskedDB; +}; + +/** + * Decode the given RSAES-OAEP encoded message (EM) using key, with optional + * label (L). + * + * This method does not perform RSA decryption, it only decodes the message + * using RSAES-OAEP. + * + * @param key the RSA key to use. + * @param em the encoded message to decode. + * @param options the options to use: + * label an optional label to use. + * md the message digest object to use for OAEP, undefined for SHA-1. + * mgf1 optional mgf1 parameters: + * md the message digest object to use for MGF1. + * + * @return the decoded message bytes. + */ +pkcs1.decode_rsa_oaep = function(key, em, options) { + // parse args + var label; + var md; + var mgf1Md; + // legacy args + if(typeof options === 'string') { + label = options; + md = arguments[3] || undefined; + } else if(options) { + label = options.label || undefined; + md = options.md || undefined; + if(options.mgf1 && options.mgf1.md) { + mgf1Md = options.mgf1.md; + } + } + + // compute length in bytes + var keyLength = Math.ceil(key.n.bitLength() / 8); + + if(em.length !== keyLength) { + var error = new Error('RSAES-OAEP encoded message length is invalid.'); + error.length = em.length; + error.expectedLength = keyLength; + throw error; + } + + // default OAEP to SHA-1 message digest + if(md === undefined) { + md = forge.md.sha1.create(); + } else { + md.start(); + } + + // default MGF-1 to same as OAEP + if(!mgf1Md) { + mgf1Md = md; + } + + if(keyLength < 2 * md.digestLength + 2) { + throw new Error('RSAES-OAEP key is too short for the hash function.'); + } + + if(!label) { + label = ''; + } + md.update(label, 'raw'); + var lHash = md.digest().getBytes(); + + // split the message into its parts + var y = em.charAt(0); + var maskedSeed = em.substring(1, md.digestLength + 1); + var maskedDB = em.substring(1 + md.digestLength); + + var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md); + var seed = forge.util.xorBytes(maskedSeed, seedMask, maskedSeed.length); + + var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md); + var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length); + + var lHashPrime = db.substring(0, md.digestLength); + + // constant time check that all values match what is expected + var error = (y !== '\x00'); + + // constant time check lHash vs lHashPrime + for(var i = 0; i < md.digestLength; ++i) { + error |= (lHash.charAt(i) !== lHashPrime.charAt(i)); + } + + // "constant time" find the 0x1 byte separating the padding (zeros) from the + // message + // TODO: It must be possible to do this in a better/smarter way? + var in_ps = 1; + var index = md.digestLength; + for(var j = md.digestLength; j < db.length; j++) { + var code = db.charCodeAt(j); + + var is_0 = (code & 0x1) ^ 0x1; + + // non-zero if not 0 or 1 in the ps section + var error_mask = in_ps ? 0xfffe : 0x0000; + error |= (code & error_mask); + + // latch in_ps to zero after we find 0x1 + in_ps = in_ps & is_0; + index += in_ps; + } + + if(error || db.charCodeAt(index) !== 0x1) { + throw new Error('Invalid RSAES-OAEP padding.'); + } + + return db.substring(index + 1); +}; + +function rsa_mgf1(seed, maskLength, hash) { + // default to SHA-1 message digest + if(!hash) { + hash = forge.md.sha1.create(); + } + var t = ''; + var count = Math.ceil(maskLength / hash.digestLength); + for(var i = 0; i < count; ++i) { + var c = String.fromCharCode( + (i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF); + hash.start(); + hash.update(seed + c); + t += hash.digest().getBytes(); + } + return t.substring(0, maskLength); +} + + +/***/ }), + +/***/ 5147: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of PKCS#12. + * + * @author Dave Longley + * @author Stefan Siegl + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + * Copyright (c) 2012 Stefan Siegl + * + * The ASN.1 representation of PKCS#12 is as follows + * (see ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12-tc1.pdf for details) + * + * PFX ::= SEQUENCE { + * version INTEGER {v3(3)}(v3,...), + * authSafe ContentInfo, + * macData MacData OPTIONAL + * } + * + * MacData ::= SEQUENCE { + * mac DigestInfo, + * macSalt OCTET STRING, + * iterations INTEGER DEFAULT 1 + * } + * Note: The iterations default is for historical reasons and its use is + * deprecated. A higher value, like 1024, is recommended. + * + * DigestInfo is defined in PKCS#7 as follows: + * + * DigestInfo ::= SEQUENCE { + * digestAlgorithm DigestAlgorithmIdentifier, + * digest Digest + * } + * + * DigestAlgorithmIdentifier ::= AlgorithmIdentifier + * + * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters + * for the algorithm, if any. In the case of SHA1 there is none. + * + * AlgorithmIdentifer ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL + * } + * + * Digest ::= OCTET STRING + * + * + * ContentInfo ::= SEQUENCE { + * contentType ContentType, + * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL + * } + * + * ContentType ::= OBJECT IDENTIFIER + * + * AuthenticatedSafe ::= SEQUENCE OF ContentInfo + * -- Data if unencrypted + * -- EncryptedData if password-encrypted + * -- EnvelopedData if public key-encrypted + * + * + * SafeContents ::= SEQUENCE OF SafeBag + * + * SafeBag ::= SEQUENCE { + * bagId BAG-TYPE.&id ({PKCS12BagSet}) + * bagValue [0] EXPLICIT BAG-TYPE.&Type({PKCS12BagSet}{@bagId}), + * bagAttributes SET OF PKCS12Attribute OPTIONAL + * } + * + * PKCS12Attribute ::= SEQUENCE { + * attrId ATTRIBUTE.&id ({PKCS12AttrSet}), + * attrValues SET OF ATTRIBUTE.&Type ({PKCS12AttrSet}{@attrId}) + * } -- This type is compatible with the X.500 type 'Attribute' + * + * PKCS12AttrSet ATTRIBUTE ::= { + * friendlyName | -- from PKCS #9 + * localKeyId, -- from PKCS #9 + * ... -- Other attributes are allowed + * } + * + * CertBag ::= SEQUENCE { + * certId BAG-TYPE.&id ({CertTypes}), + * certValue [0] EXPLICIT BAG-TYPE.&Type ({CertTypes}{@certId}) + * } + * + * x509Certificate BAG-TYPE ::= {OCTET STRING IDENTIFIED BY {certTypes 1}} + * -- DER-encoded X.509 certificate stored in OCTET STRING + * + * sdsiCertificate BAG-TYPE ::= {IA5String IDENTIFIED BY {certTypes 2}} + * -- Base64-encoded SDSI certificate stored in IA5String + * + * CertTypes BAG-TYPE ::= { + * x509Certificate | + * sdsiCertificate, + * ... -- For future extensions + * } + */ +var forge = __webpack_require__(3832); +__webpack_require__(3068); +__webpack_require__(6607); +__webpack_require__(6270); +__webpack_require__(5496); +__webpack_require__(7450); +__webpack_require__(9563); +__webpack_require__(8095); +__webpack_require__(137); +__webpack_require__(7116); +__webpack_require__(5414); + +// shortcut for asn.1 & PKI API +var asn1 = forge.asn1; +var pki = forge.pki; + +// shortcut for PKCS#12 API +var p12 = module.exports = forge.pkcs12 = forge.pkcs12 || {}; + +var contentInfoValidator = { + name: 'ContentInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, // a ContentInfo + constructed: true, + value: [{ + name: 'ContentInfo.contentType', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'contentType' + }, { + name: 'ContentInfo.content', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + constructed: true, + captureAsn1: 'content' + }] +}; + +var pfxValidator = { + name: 'PFX', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'PFX.version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'version' + }, + contentInfoValidator, { + name: 'PFX.macData', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + optional: true, + captureAsn1: 'mac', + value: [{ + name: 'PFX.macData.mac', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, // DigestInfo + constructed: true, + value: [{ + name: 'PFX.macData.mac.digestAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, // DigestAlgorithmIdentifier + constructed: true, + value: [{ + name: 'PFX.macData.mac.digestAlgorithm.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'macAlgorithm' + }, { + name: 'PFX.macData.mac.digestAlgorithm.parameters', + tagClass: asn1.Class.UNIVERSAL, + captureAsn1: 'macAlgorithmParameters' + }] + }, { + name: 'PFX.macData.mac.digest', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'macDigest' + }] + }, { + name: 'PFX.macData.macSalt', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'macSalt' + }, { + name: 'PFX.macData.iterations', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + optional: true, + capture: 'macIterations' + }] + }] +}; + +var safeBagValidator = { + name: 'SafeBag', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'SafeBag.bagId', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'bagId' + }, { + name: 'SafeBag.bagValue', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + constructed: true, + captureAsn1: 'bagValue' + }, { + name: 'SafeBag.bagAttributes', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SET, + constructed: true, + optional: true, + capture: 'bagAttributes' + }] +}; + +var attributeValidator = { + name: 'Attribute', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'Attribute.attrId', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'oid' + }, { + name: 'Attribute.attrValues', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SET, + constructed: true, + capture: 'values' + }] +}; + +var certBagValidator = { + name: 'CertBag', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'CertBag.certId', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'certId' + }, { + name: 'CertBag.certValue', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + constructed: true, + /* So far we only support X.509 certificates (which are wrapped in + an OCTET STRING, hence hard code that here). */ + value: [{ + name: 'CertBag.certValue[0]', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Class.OCTETSTRING, + constructed: false, + capture: 'cert' + }] + }] +}; + +/** + * Search SafeContents structure for bags with matching attributes. + * + * The search can optionally be narrowed by a certain bag type. + * + * @param safeContents the SafeContents structure to search in. + * @param attrName the name of the attribute to compare against. + * @param attrValue the attribute value to search for. + * @param [bagType] bag type to narrow search by. + * + * @return an array of matching bags. + */ +function _getBagsByAttribute(safeContents, attrName, attrValue, bagType) { + var result = []; + + for(var i = 0; i < safeContents.length; i++) { + for(var j = 0; j < safeContents[i].safeBags.length; j++) { + var bag = safeContents[i].safeBags[j]; + if(bagType !== undefined && bag.type !== bagType) { + continue; + } + // only filter by bag type, no attribute specified + if(attrName === null) { + result.push(bag); + continue; + } + if(bag.attributes[attrName] !== undefined && + bag.attributes[attrName].indexOf(attrValue) >= 0) { + result.push(bag); + } + } + } + + return result; +} + +/** + * Converts a PKCS#12 PFX in ASN.1 notation into a PFX object. + * + * @param obj The PKCS#12 PFX in ASN.1 notation. + * @param strict true to use strict DER decoding, false not to (default: true). + * @param {String} password Password to decrypt with (optional). + * + * @return PKCS#12 PFX object. + */ +p12.pkcs12FromAsn1 = function(obj, strict, password) { + // handle args + if(typeof strict === 'string') { + password = strict; + strict = true; + } else if(strict === undefined) { + strict = true; + } + + // validate PFX and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(obj, pfxValidator, capture, errors)) { + var error = new Error('Cannot read PKCS#12 PFX. ' + + 'ASN.1 object is not an PKCS#12 PFX.'); + error.errors = error; + throw error; + } + + var pfx = { + version: capture.version.charCodeAt(0), + safeContents: [], + + /** + * Gets bags with matching attributes. + * + * @param filter the attributes to filter by: + * [localKeyId] the localKeyId to search for. + * [localKeyIdHex] the localKeyId in hex to search for. + * [friendlyName] the friendly name to search for. + * [bagType] bag type to narrow each attribute search by. + * + * @return a map of attribute type to an array of matching bags or, if no + * attribute was given but a bag type, the map key will be the + * bag type. + */ + getBags: function(filter) { + var rval = {}; + + var localKeyId; + if('localKeyId' in filter) { + localKeyId = filter.localKeyId; + } else if('localKeyIdHex' in filter) { + localKeyId = forge.util.hexToBytes(filter.localKeyIdHex); + } + + // filter on bagType only + if(localKeyId === undefined && !('friendlyName' in filter) && + 'bagType' in filter) { + rval[filter.bagType] = _getBagsByAttribute( + pfx.safeContents, null, null, filter.bagType); + } + + if(localKeyId !== undefined) { + rval.localKeyId = _getBagsByAttribute( + pfx.safeContents, 'localKeyId', + localKeyId, filter.bagType); + } + if('friendlyName' in filter) { + rval.friendlyName = _getBagsByAttribute( + pfx.safeContents, 'friendlyName', + filter.friendlyName, filter.bagType); + } + + return rval; + }, + + /** + * DEPRECATED: use getBags() instead. + * + * Get bags with matching friendlyName attribute. + * + * @param friendlyName the friendly name to search for. + * @param [bagType] bag type to narrow search by. + * + * @return an array of bags with matching friendlyName attribute. + */ + getBagsByFriendlyName: function(friendlyName, bagType) { + return _getBagsByAttribute( + pfx.safeContents, 'friendlyName', friendlyName, bagType); + }, + + /** + * DEPRECATED: use getBags() instead. + * + * Get bags with matching localKeyId attribute. + * + * @param localKeyId the localKeyId to search for. + * @param [bagType] bag type to narrow search by. + * + * @return an array of bags with matching localKeyId attribute. + */ + getBagsByLocalKeyId: function(localKeyId, bagType) { + return _getBagsByAttribute( + pfx.safeContents, 'localKeyId', localKeyId, bagType); + } + }; + + if(capture.version.charCodeAt(0) !== 3) { + var error = new Error('PKCS#12 PFX of version other than 3 not supported.'); + error.version = capture.version.charCodeAt(0); + throw error; + } + + if(asn1.derToOid(capture.contentType) !== pki.oids.data) { + var error = new Error('Only PKCS#12 PFX in password integrity mode supported.'); + error.oid = asn1.derToOid(capture.contentType); + throw error; + } + + var data = capture.content.value[0]; + if(data.tagClass !== asn1.Class.UNIVERSAL || + data.type !== asn1.Type.OCTETSTRING) { + throw new Error('PKCS#12 authSafe content data is not an OCTET STRING.'); + } + data = _decodePkcs7Data(data); + + // check for MAC + if(capture.mac) { + var md = null; + var macKeyBytes = 0; + var macAlgorithm = asn1.derToOid(capture.macAlgorithm); + switch(macAlgorithm) { + case pki.oids.sha1: + md = forge.md.sha1.create(); + macKeyBytes = 20; + break; + case pki.oids.sha256: + md = forge.md.sha256.create(); + macKeyBytes = 32; + break; + case pki.oids.sha384: + md = forge.md.sha384.create(); + macKeyBytes = 48; + break; + case pki.oids.sha512: + md = forge.md.sha512.create(); + macKeyBytes = 64; + break; + case pki.oids.md5: + md = forge.md.md5.create(); + macKeyBytes = 16; + break; + } + if(md === null) { + throw new Error('PKCS#12 uses unsupported MAC algorithm: ' + macAlgorithm); + } + + // verify MAC (iterations default to 1) + var macSalt = new forge.util.ByteBuffer(capture.macSalt); + var macIterations = (('macIterations' in capture) ? + parseInt(forge.util.bytesToHex(capture.macIterations), 16) : 1); + var macKey = p12.generateKey( + password, macSalt, 3, macIterations, macKeyBytes, md); + var mac = forge.hmac.create(); + mac.start(md, macKey); + mac.update(data.value); + var macValue = mac.getMac(); + if(macValue.getBytes() !== capture.macDigest) { + throw new Error('PKCS#12 MAC could not be verified. Invalid password?'); + } + } + + _decodeAuthenticatedSafe(pfx, data.value, strict, password); + return pfx; +}; + +/** + * Decodes PKCS#7 Data. PKCS#7 (RFC 2315) defines "Data" as an OCTET STRING, + * but it is sometimes an OCTET STRING that is composed/constructed of chunks, + * each its own OCTET STRING. This is BER-encoding vs. DER-encoding. This + * function transforms this corner-case into the usual simple, + * non-composed/constructed OCTET STRING. + * + * This function may be moved to ASN.1 at some point to better deal with + * more BER-encoding issues, should they arise. + * + * @param data the ASN.1 Data object to transform. + */ +function _decodePkcs7Data(data) { + // handle special case of "chunked" data content: an octet string composed + // of other octet strings + if(data.composed || data.constructed) { + var value = forge.util.createBuffer(); + for(var i = 0; i < data.value.length; ++i) { + value.putBytes(data.value[i].value); + } + data.composed = data.constructed = false; + data.value = value.getBytes(); + } + return data; +} + +/** + * Decode PKCS#12 AuthenticatedSafe (BER encoded) into PFX object. + * + * The AuthenticatedSafe is a BER-encoded SEQUENCE OF ContentInfo. + * + * @param pfx The PKCS#12 PFX object to fill. + * @param {String} authSafe BER-encoded AuthenticatedSafe. + * @param strict true to use strict DER decoding, false not to. + * @param {String} password Password to decrypt with (optional). + */ +function _decodeAuthenticatedSafe(pfx, authSafe, strict, password) { + authSafe = asn1.fromDer(authSafe, strict); /* actually it's BER encoded */ + + if(authSafe.tagClass !== asn1.Class.UNIVERSAL || + authSafe.type !== asn1.Type.SEQUENCE || + authSafe.constructed !== true) { + throw new Error('PKCS#12 AuthenticatedSafe expected to be a ' + + 'SEQUENCE OF ContentInfo'); + } + + for(var i = 0; i < authSafe.value.length; i++) { + var contentInfo = authSafe.value[i]; + + // validate contentInfo and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(contentInfo, contentInfoValidator, capture, errors)) { + var error = new Error('Cannot read ContentInfo.'); + error.errors = errors; + throw error; + } + + var obj = { + encrypted: false + }; + var safeContents = null; + var data = capture.content.value[0]; + switch(asn1.derToOid(capture.contentType)) { + case pki.oids.data: + if(data.tagClass !== asn1.Class.UNIVERSAL || + data.type !== asn1.Type.OCTETSTRING) { + throw new Error('PKCS#12 SafeContents Data is not an OCTET STRING.'); + } + safeContents = _decodePkcs7Data(data).value; + break; + case pki.oids.encryptedData: + safeContents = _decryptSafeContents(data, password); + obj.encrypted = true; + break; + default: + var error = new Error('Unsupported PKCS#12 contentType.'); + error.contentType = asn1.derToOid(capture.contentType); + throw error; + } + + obj.safeBags = _decodeSafeContents(safeContents, strict, password); + pfx.safeContents.push(obj); + } +} + +/** + * Decrypt PKCS#7 EncryptedData structure. + * + * @param data ASN.1 encoded EncryptedContentInfo object. + * @param password The user-provided password. + * + * @return The decrypted SafeContents (ASN.1 object). + */ +function _decryptSafeContents(data, password) { + var capture = {}; + var errors = []; + if(!asn1.validate( + data, forge.pkcs7.asn1.encryptedDataValidator, capture, errors)) { + var error = new Error('Cannot read EncryptedContentInfo.'); + error.errors = errors; + throw error; + } + + var oid = asn1.derToOid(capture.contentType); + if(oid !== pki.oids.data) { + var error = new Error( + 'PKCS#12 EncryptedContentInfo ContentType is not Data.'); + error.oid = oid; + throw error; + } + + // get cipher + oid = asn1.derToOid(capture.encAlgorithm); + var cipher = pki.pbe.getCipher(oid, capture.encParameter, password); + + // get encrypted data + var encryptedContentAsn1 = _decodePkcs7Data(capture.encryptedContentAsn1); + var encrypted = forge.util.createBuffer(encryptedContentAsn1.value); + + cipher.update(encrypted); + if(!cipher.finish()) { + throw new Error('Failed to decrypt PKCS#12 SafeContents.'); + } + + return cipher.output.getBytes(); +} + +/** + * Decode PKCS#12 SafeContents (BER-encoded) into array of Bag objects. + * + * The safeContents is a BER-encoded SEQUENCE OF SafeBag. + * + * @param {String} safeContents BER-encoded safeContents. + * @param strict true to use strict DER decoding, false not to. + * @param {String} password Password to decrypt with (optional). + * + * @return {Array} Array of Bag objects. + */ +function _decodeSafeContents(safeContents, strict, password) { + // if strict and no safe contents, return empty safes + if(!strict && safeContents.length === 0) { + return []; + } + + // actually it's BER-encoded + safeContents = asn1.fromDer(safeContents, strict); + + if(safeContents.tagClass !== asn1.Class.UNIVERSAL || + safeContents.type !== asn1.Type.SEQUENCE || + safeContents.constructed !== true) { + throw new Error( + 'PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.'); + } + + var res = []; + for(var i = 0; i < safeContents.value.length; i++) { + var safeBag = safeContents.value[i]; + + // validate SafeBag and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(safeBag, safeBagValidator, capture, errors)) { + var error = new Error('Cannot read SafeBag.'); + error.errors = errors; + throw error; + } + + /* Create bag object and push to result array. */ + var bag = { + type: asn1.derToOid(capture.bagId), + attributes: _decodeBagAttributes(capture.bagAttributes) + }; + res.push(bag); + + var validator, decoder; + var bagAsn1 = capture.bagValue.value[0]; + switch(bag.type) { + case pki.oids.pkcs8ShroudedKeyBag: + /* bagAsn1 has a EncryptedPrivateKeyInfo, which we need to decrypt. + Afterwards we can handle it like a keyBag, + which is a PrivateKeyInfo. */ + bagAsn1 = pki.decryptPrivateKeyInfo(bagAsn1, password); + if(bagAsn1 === null) { + throw new Error( + 'Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?'); + } + + /* fall through */ + case pki.oids.keyBag: + /* A PKCS#12 keyBag is a simple PrivateKeyInfo as understood by our + PKI module, hence we don't have to do validation/capturing here, + just pass what we already got. */ + try { + bag.key = pki.privateKeyFromAsn1(bagAsn1); + } catch(e) { + // ignore unknown key type, pass asn1 value + bag.key = null; + bag.asn1 = bagAsn1; + } + continue; /* Nothing more to do. */ + + case pki.oids.certBag: + /* A PKCS#12 certBag can wrap both X.509 and sdsi certificates. + Therefore put the SafeBag content through another validator to + capture the fields. Afterwards check & store the results. */ + validator = certBagValidator; + decoder = function() { + if(asn1.derToOid(capture.certId) !== pki.oids.x509Certificate) { + var error = new Error( + 'Unsupported certificate type, only X.509 supported.'); + error.oid = asn1.derToOid(capture.certId); + throw error; + } + + // true=produce cert hash + var certAsn1 = asn1.fromDer(capture.cert, strict); + try { + bag.cert = pki.certificateFromAsn1(certAsn1, true); + } catch(e) { + // ignore unknown cert type, pass asn1 value + bag.cert = null; + bag.asn1 = certAsn1; + } + }; + break; + + default: + var error = new Error('Unsupported PKCS#12 SafeBag type.'); + error.oid = bag.type; + throw error; + } + + /* Validate SafeBag value (i.e. CertBag, etc.) and capture data if needed. */ + if(validator !== undefined && + !asn1.validate(bagAsn1, validator, capture, errors)) { + var error = new Error('Cannot read PKCS#12 ' + validator.name); + error.errors = errors; + throw error; + } + + /* Call decoder function from above to store the results. */ + decoder(); + } + + return res; +} + +/** + * Decode PKCS#12 SET OF PKCS12Attribute into JavaScript object. + * + * @param attributes SET OF PKCS12Attribute (ASN.1 object). + * + * @return the decoded attributes. + */ +function _decodeBagAttributes(attributes) { + var decodedAttrs = {}; + + if(attributes !== undefined) { + for(var i = 0; i < attributes.length; ++i) { + var capture = {}; + var errors = []; + if(!asn1.validate(attributes[i], attributeValidator, capture, errors)) { + var error = new Error('Cannot read PKCS#12 BagAttribute.'); + error.errors = errors; + throw error; + } + + var oid = asn1.derToOid(capture.oid); + if(pki.oids[oid] === undefined) { + // unsupported attribute type, ignore. + continue; + } + + decodedAttrs[pki.oids[oid]] = []; + for(var j = 0; j < capture.values.length; ++j) { + decodedAttrs[pki.oids[oid]].push(capture.values[j].value); + } + } + } + + return decodedAttrs; +} + +/** + * Wraps a private key and certificate in a PKCS#12 PFX wrapper. If a + * password is provided then the private key will be encrypted. + * + * An entire certificate chain may also be included. To do this, pass + * an array for the "cert" parameter where the first certificate is + * the one that is paired with the private key and each subsequent one + * verifies the previous one. The certificates may be in PEM format or + * have been already parsed by Forge. + * + * @todo implement password-based-encryption for the whole package + * + * @param key the private key. + * @param cert the certificate (may be an array of certificates in order + * to specify a certificate chain). + * @param password the password to use, null for none. + * @param options: + * algorithm the encryption algorithm to use + * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'. + * count the iteration count to use. + * saltSize the salt size to use. + * useMac true to include a MAC, false not to, defaults to true. + * localKeyId the local key ID to use, in hex. + * friendlyName the friendly name to use. + * generateLocalKeyId true to generate a random local key ID, + * false not to, defaults to true. + * + * @return the PKCS#12 PFX ASN.1 object. + */ +p12.toPkcs12Asn1 = function(key, cert, password, options) { + // set default options + options = options || {}; + options.saltSize = options.saltSize || 8; + options.count = options.count || 2048; + options.algorithm = options.algorithm || options.encAlgorithm || 'aes128'; + if(!('useMac' in options)) { + options.useMac = true; + } + if(!('localKeyId' in options)) { + options.localKeyId = null; + } + if(!('generateLocalKeyId' in options)) { + options.generateLocalKeyId = true; + } + + var localKeyId = options.localKeyId; + var bagAttrs; + if(localKeyId !== null) { + localKeyId = forge.util.hexToBytes(localKeyId); + } else if(options.generateLocalKeyId) { + // use SHA-1 of paired cert, if available + if(cert) { + var pairedCert = forge.util.isArray(cert) ? cert[0] : cert; + if(typeof pairedCert === 'string') { + pairedCert = pki.certificateFromPem(pairedCert); + } + var sha1 = forge.md.sha1.create(); + sha1.update(asn1.toDer(pki.certificateToAsn1(pairedCert)).getBytes()); + localKeyId = sha1.digest().getBytes(); + } else { + // FIXME: consider using SHA-1 of public key (which can be generated + // from private key components), see: cert.generateSubjectKeyIdentifier + // generate random bytes + localKeyId = forge.random.getBytes(20); + } + } + + var attrs = []; + if(localKeyId !== null) { + attrs.push( + // localKeyID + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // attrId + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.localKeyId).getBytes()), + // attrValues + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + localKeyId) + ]) + ])); + } + if('friendlyName' in options) { + attrs.push( + // friendlyName + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // attrId + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.friendlyName).getBytes()), + // attrValues + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BMPSTRING, false, + options.friendlyName) + ]) + ])); + } + + if(attrs.length > 0) { + bagAttrs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, attrs); + } + + // collect contents for AuthenticatedSafe + var contents = []; + + // create safe bag(s) for certificate chain + var chain = []; + if(cert !== null) { + if(forge.util.isArray(cert)) { + chain = cert; + } else { + chain = [cert]; + } + } + + var certSafeBags = []; + for(var i = 0; i < chain.length; ++i) { + // convert cert from PEM as necessary + cert = chain[i]; + if(typeof cert === 'string') { + cert = pki.certificateFromPem(cert); + } + + // SafeBag + var certBagAttrs = (i === 0) ? bagAttrs : undefined; + var certAsn1 = pki.certificateToAsn1(cert); + var certSafeBag = + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // bagId + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.certBag).getBytes()), + // bagValue + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + // CertBag + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // certId + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.x509Certificate).getBytes()), + // certValue (x509Certificate) + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + asn1.toDer(certAsn1).getBytes()) + ])])]), + // bagAttributes (OPTIONAL) + certBagAttrs + ]); + certSafeBags.push(certSafeBag); + } + + if(certSafeBags.length > 0) { + // SafeContents + var certSafeContents = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, certSafeBags); + + // ContentInfo + var certCI = + // PKCS#7 ContentInfo + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // contentType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + // OID for the content type is 'data' + asn1.oidToDer(pki.oids.data).getBytes()), + // content + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + asn1.toDer(certSafeContents).getBytes()) + ]) + ]); + contents.push(certCI); + } + + // create safe contents for private key + var keyBag = null; + if(key !== null) { + // SafeBag + var pkAsn1 = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(key)); + if(password === null) { + // no encryption + keyBag = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // bagId + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.keyBag).getBytes()), + // bagValue + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + // PrivateKeyInfo + pkAsn1 + ]), + // bagAttributes (OPTIONAL) + bagAttrs + ]); + } else { + // encrypted PrivateKeyInfo + keyBag = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // bagId + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.pkcs8ShroudedKeyBag).getBytes()), + // bagValue + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + // EncryptedPrivateKeyInfo + pki.encryptPrivateKeyInfo(pkAsn1, password, options) + ]), + // bagAttributes (OPTIONAL) + bagAttrs + ]); + } + + // SafeContents + var keySafeContents = + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [keyBag]); + + // ContentInfo + var keyCI = + // PKCS#7 ContentInfo + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // contentType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + // OID for the content type is 'data' + asn1.oidToDer(pki.oids.data).getBytes()), + // content + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + asn1.toDer(keySafeContents).getBytes()) + ]) + ]); + contents.push(keyCI); + } + + // create AuthenticatedSafe by stringing together the contents + var safe = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, contents); + + var macData; + if(options.useMac) { + // MacData + var sha1 = forge.md.sha1.create(); + var macSalt = new forge.util.ByteBuffer( + forge.random.getBytes(options.saltSize)); + var count = options.count; + // 160-bit key + var key = p12.generateKey(password, macSalt, 3, count, 20); + var mac = forge.hmac.create(); + mac.start(sha1, key); + mac.update(asn1.toDer(safe).getBytes()); + var macValue = mac.getMac(); + macData = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // mac DigestInfo + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // digestAlgorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm = SHA-1 + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.sha1).getBytes()), + // parameters = Null + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ]), + // digest + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, + false, macValue.getBytes()) + ]), + // macSalt OCTET STRING + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, macSalt.getBytes()), + // iterations INTEGER (XXX: Only support count < 65536) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(count).getBytes() + ) + ]); + } + + // PFX + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // version (3) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(3).getBytes()), + // PKCS#7 ContentInfo + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // contentType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + // OID for the content type is 'data' + asn1.oidToDer(pki.oids.data).getBytes()), + // content + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + asn1.toDer(safe).getBytes()) + ]) + ]), + macData + ]); +}; + +/** + * Derives a PKCS#12 key. + * + * @param password the password to derive the key material from, null or + * undefined for none. + * @param salt the salt, as a ByteBuffer, to use. + * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC). + * @param iter the iteration count. + * @param n the number of bytes to derive from the password. + * @param md the message digest to use, defaults to SHA-1. + * + * @return a ByteBuffer with the bytes derived from the password. + */ +p12.generateKey = forge.pbe.generatePkcs12Key; + + +/***/ }), + +/***/ 9437: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of PKCS#7 v1.5. + * + * @author Stefan Siegl + * @author Dave Longley + * + * Copyright (c) 2012 Stefan Siegl + * Copyright (c) 2012-2015 Digital Bazaar, Inc. + * + * Currently this implementation only supports ContentType of EnvelopedData, + * EncryptedData, or SignedData at the root level. The top level elements may + * contain only a ContentInfo of ContentType Data, i.e. plain data. Further + * nesting is not (yet) supported. + * + * The Forge validators for PKCS #7's ASN.1 structures are available from + * a separate file pkcs7asn1.js, since those are referenced from other + * PKCS standards like PKCS #12. + */ +var forge = __webpack_require__(3832); +__webpack_require__(8925); +__webpack_require__(3068); +__webpack_require__(3480); +__webpack_require__(6270); +__webpack_require__(6953); +__webpack_require__(5496); +__webpack_require__(9563); +__webpack_require__(7116); +__webpack_require__(5414); + +// shortcut for ASN.1 API +var asn1 = forge.asn1; + +// shortcut for PKCS#7 API +var p7 = module.exports = forge.pkcs7 = forge.pkcs7 || {}; + +/** + * Converts a PKCS#7 message from PEM format. + * + * @param pem the PEM-formatted PKCS#7 message. + * + * @return the PKCS#7 message. + */ +p7.messageFromPem = function(pem) { + var msg = forge.pem.decode(pem)[0]; + + if(msg.type !== 'PKCS7') { + var error = new Error('Could not convert PKCS#7 message from PEM; PEM ' + + 'header type is not "PKCS#7".'); + error.headerType = msg.type; + throw error; + } + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error('Could not convert PKCS#7 message from PEM; PEM is encrypted.'); + } + + // convert DER to ASN.1 object + var obj = asn1.fromDer(msg.body); + + return p7.messageFromAsn1(obj); +}; + +/** + * Converts a PKCS#7 message to PEM format. + * + * @param msg The PKCS#7 message object + * @param maxline The maximum characters per line, defaults to 64. + * + * @return The PEM-formatted PKCS#7 message. + */ +p7.messageToPem = function(msg, maxline) { + // convert to ASN.1, then DER, then PEM-encode + var pemObj = { + type: 'PKCS7', + body: asn1.toDer(msg.toAsn1()).getBytes() + }; + return forge.pem.encode(pemObj, {maxline: maxline}); +}; + +/** + * Converts a PKCS#7 message from an ASN.1 object. + * + * @param obj the ASN.1 representation of a ContentInfo. + * + * @return the PKCS#7 message. + */ +p7.messageFromAsn1 = function(obj) { + // validate root level ContentInfo and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(obj, p7.asn1.contentInfoValidator, capture, errors)) { + var error = new Error('Cannot read PKCS#7 message. ' + + 'ASN.1 object is not an PKCS#7 ContentInfo.'); + error.errors = errors; + throw error; + } + + var contentType = asn1.derToOid(capture.contentType); + var msg; + + switch(contentType) { + case forge.pki.oids.envelopedData: + msg = p7.createEnvelopedData(); + break; + + case forge.pki.oids.encryptedData: + msg = p7.createEncryptedData(); + break; + + case forge.pki.oids.signedData: + msg = p7.createSignedData(); + break; + + default: + throw new Error('Cannot read PKCS#7 message. ContentType with OID ' + + contentType + ' is not (yet) supported.'); + } + + msg.fromAsn1(capture.content.value[0]); + return msg; +}; + +p7.createSignedData = function() { + var msg = null; + msg = { + type: forge.pki.oids.signedData, + version: 1, + certificates: [], + crls: [], + // TODO: add json-formatted signer stuff here? + signers: [], + // populated during sign() + digestAlgorithmIdentifiers: [], + contentInfo: null, + signerInfos: [], + + fromAsn1: function(obj) { + // validate SignedData content block and capture data. + _fromAsn1(msg, obj, p7.asn1.signedDataValidator); + msg.certificates = []; + msg.crls = []; + msg.digestAlgorithmIdentifiers = []; + msg.contentInfo = null; + msg.signerInfos = []; + + if(msg.rawCapture.certificates) { + var certs = msg.rawCapture.certificates.value; + for(var i = 0; i < certs.length; ++i) { + msg.certificates.push(forge.pki.certificateFromAsn1(certs[i])); + } + } + + // TODO: parse crls + }, + + toAsn1: function() { + // degenerate case with no content + if(!msg.contentInfo) { + msg.sign(); + } + + var certs = []; + for(var i = 0; i < msg.certificates.length; ++i) { + certs.push(forge.pki.certificateToAsn1(msg.certificates[i])); + } + + var crls = []; + // TODO: implement CRLs + + // [0] SignedData + var signedData = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // Version + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(msg.version).getBytes()), + // DigestAlgorithmIdentifiers + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SET, true, + msg.digestAlgorithmIdentifiers), + // ContentInfo + msg.contentInfo + ]) + ]); + if(certs.length > 0) { + // [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL + signedData.value[0].value.push( + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, certs)); + } + if(crls.length > 0) { + // [1] IMPLICIT CertificateRevocationLists OPTIONAL + signedData.value[0].value.push( + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, crls)); + } + // SignerInfos + signedData.value[0].value.push( + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, + msg.signerInfos)); + + // ContentInfo + return asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // ContentType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(msg.type).getBytes()), + // [0] SignedData + signedData + ]); + }, + + /** + * Add (another) entity to list of signers. + * + * Note: If authenticatedAttributes are provided, then, per RFC 2315, + * they must include at least two attributes: content type and + * message digest. The message digest attribute value will be + * auto-calculated during signing and will be ignored if provided. + * + * Here's an example of providing these two attributes: + * + * forge.pkcs7.createSignedData(); + * p7.addSigner({ + * issuer: cert.issuer.attributes, + * serialNumber: cert.serialNumber, + * key: privateKey, + * digestAlgorithm: forge.pki.oids.sha1, + * authenticatedAttributes: [{ + * type: forge.pki.oids.contentType, + * value: forge.pki.oids.data + * }, { + * type: forge.pki.oids.messageDigest + * }] + * }); + * + * TODO: Support [subjectKeyIdentifier] as signer's ID. + * + * @param signer the signer information: + * key the signer's private key. + * [certificate] a certificate containing the public key + * associated with the signer's private key; use this option as + * an alternative to specifying signer.issuer and + * signer.serialNumber. + * [issuer] the issuer attributes (eg: cert.issuer.attributes). + * [serialNumber] the signer's certificate's serial number in + * hexadecimal (eg: cert.serialNumber). + * [digestAlgorithm] the message digest OID, as a string, to use + * (eg: forge.pki.oids.sha1). + * [authenticatedAttributes] an optional array of attributes + * to also sign along with the content. + */ + addSigner: function(signer) { + var issuer = signer.issuer; + var serialNumber = signer.serialNumber; + if(signer.certificate) { + var cert = signer.certificate; + if(typeof cert === 'string') { + cert = forge.pki.certificateFromPem(cert); + } + issuer = cert.issuer.attributes; + serialNumber = cert.serialNumber; + } + var key = signer.key; + if(!key) { + throw new Error( + 'Could not add PKCS#7 signer; no private key specified.'); + } + if(typeof key === 'string') { + key = forge.pki.privateKeyFromPem(key); + } + + // ensure OID known for digest algorithm + var digestAlgorithm = signer.digestAlgorithm || forge.pki.oids.sha1; + switch(digestAlgorithm) { + case forge.pki.oids.sha1: + case forge.pki.oids.sha256: + case forge.pki.oids.sha384: + case forge.pki.oids.sha512: + case forge.pki.oids.md5: + break; + default: + throw new Error( + 'Could not add PKCS#7 signer; unknown message digest algorithm: ' + + digestAlgorithm); + } + + // if authenticatedAttributes is present, then the attributes + // must contain at least PKCS #9 content-type and message-digest + var authenticatedAttributes = signer.authenticatedAttributes || []; + if(authenticatedAttributes.length > 0) { + var contentType = false; + var messageDigest = false; + for(var i = 0; i < authenticatedAttributes.length; ++i) { + var attr = authenticatedAttributes[i]; + if(!contentType && attr.type === forge.pki.oids.contentType) { + contentType = true; + if(messageDigest) { + break; + } + continue; + } + if(!messageDigest && attr.type === forge.pki.oids.messageDigest) { + messageDigest = true; + if(contentType) { + break; + } + continue; + } + } + + if(!contentType || !messageDigest) { + throw new Error('Invalid signer.authenticatedAttributes. If ' + + 'signer.authenticatedAttributes is specified, then it must ' + + 'contain at least two attributes, PKCS #9 content-type and ' + + 'PKCS #9 message-digest.'); + } + } + + msg.signers.push({ + key: key, + version: 1, + issuer: issuer, + serialNumber: serialNumber, + digestAlgorithm: digestAlgorithm, + signatureAlgorithm: forge.pki.oids.rsaEncryption, + signature: null, + authenticatedAttributes: authenticatedAttributes, + unauthenticatedAttributes: [] + }); + }, + + /** + * Signs the content. + * @param options Options to apply when signing: + * [detached] boolean. If signing should be done in detached mode. Defaults to false. + */ + sign: function(options) { + options = options || {}; + // auto-generate content info + if(typeof msg.content !== 'object' || msg.contentInfo === null) { + // use Data ContentInfo + msg.contentInfo = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // ContentType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(forge.pki.oids.data).getBytes()) + ]); + + // add actual content, if present + if('content' in msg) { + var content; + if(msg.content instanceof forge.util.ByteBuffer) { + content = msg.content.bytes(); + } else if(typeof msg.content === 'string') { + content = forge.util.encodeUtf8(msg.content); + } + + if (options.detached) { + msg.detachedContent = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, content); + } else { + msg.contentInfo.value.push( + // [0] EXPLICIT content + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + content) + ])); + } + } + } + + // no signers, return early (degenerate case for certificate container) + if(msg.signers.length === 0) { + return; + } + + // generate digest algorithm identifiers + var mds = addDigestAlgorithmIds(); + + // generate signerInfos + addSignerInfos(mds); + }, + + verify: function() { + throw new Error('PKCS#7 signature verification not yet implemented.'); + }, + + /** + * Add a certificate. + * + * @param cert the certificate to add. + */ + addCertificate: function(cert) { + // convert from PEM + if(typeof cert === 'string') { + cert = forge.pki.certificateFromPem(cert); + } + msg.certificates.push(cert); + }, + + /** + * Add a certificate revokation list. + * + * @param crl the certificate revokation list to add. + */ + addCertificateRevokationList: function(crl) { + throw new Error('PKCS#7 CRL support not yet implemented.'); + } + }; + return msg; + + function addDigestAlgorithmIds() { + var mds = {}; + + for(var i = 0; i < msg.signers.length; ++i) { + var signer = msg.signers[i]; + var oid = signer.digestAlgorithm; + if(!(oid in mds)) { + // content digest + mds[oid] = forge.md[forge.pki.oids[oid]].create(); + } + if(signer.authenticatedAttributes.length === 0) { + // no custom attributes to digest; use content message digest + signer.md = mds[oid]; + } else { + // custom attributes to be digested; use own message digest + // TODO: optimize to just copy message digest state if that + // feature is ever supported with message digests + signer.md = forge.md[forge.pki.oids[oid]].create(); + } + } + + // add unique digest algorithm identifiers + msg.digestAlgorithmIdentifiers = []; + for(var oid in mds) { + msg.digestAlgorithmIdentifiers.push( + // AlgorithmIdentifier + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(oid).getBytes()), + // parameters (null) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ])); + } + + return mds; + } + + function addSignerInfos(mds) { + var content; + + if (msg.detachedContent) { + // Signature has been made in detached mode. + content = msg.detachedContent; + } else { + // Note: ContentInfo is a SEQUENCE with 2 values, second value is + // the content field and is optional for a ContentInfo but required here + // since signers are present + // get ContentInfo content + content = msg.contentInfo.value[1]; + // skip [0] EXPLICIT content wrapper + content = content.value[0]; + } + + if(!content) { + throw new Error( + 'Could not sign PKCS#7 message; there is no content to sign.'); + } + + // get ContentInfo content type + var contentType = asn1.derToOid(msg.contentInfo.value[0].value); + + // serialize content + var bytes = asn1.toDer(content); + + // skip identifier and length per RFC 2315 9.3 + // skip identifier (1 byte) + bytes.getByte(); + // read and discard length bytes + asn1.getBerValueLength(bytes); + bytes = bytes.getBytes(); + + // digest content DER value bytes + for(var oid in mds) { + mds[oid].start().update(bytes); + } + + // sign content + var signingTime = new Date(); + for(var i = 0; i < msg.signers.length; ++i) { + var signer = msg.signers[i]; + + if(signer.authenticatedAttributes.length === 0) { + // if ContentInfo content type is not "Data", then + // authenticatedAttributes must be present per RFC 2315 + if(contentType !== forge.pki.oids.data) { + throw new Error( + 'Invalid signer; authenticatedAttributes must be present ' + + 'when the ContentInfo content type is not PKCS#7 Data.'); + } + } else { + // process authenticated attributes + // [0] IMPLICIT + signer.authenticatedAttributesAsn1 = asn1.create( + asn1.Class.CONTEXT_SPECIFIC, 0, true, []); + + // per RFC 2315, attributes are to be digested using a SET container + // not the above [0] IMPLICIT container + var attrsAsn1 = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SET, true, []); + + for(var ai = 0; ai < signer.authenticatedAttributes.length; ++ai) { + var attr = signer.authenticatedAttributes[ai]; + if(attr.type === forge.pki.oids.messageDigest) { + // use content message digest as value + attr.value = mds[signer.digestAlgorithm].digest(); + } else if(attr.type === forge.pki.oids.signingTime) { + // auto-populate signing time if not already set + if(!attr.value) { + attr.value = signingTime; + } + } + + // convert to ASN.1 and push onto Attributes SET (for signing) and + // onto authenticatedAttributesAsn1 to complete SignedData ASN.1 + // TODO: optimize away duplication + attrsAsn1.value.push(_attributeToAsn1(attr)); + signer.authenticatedAttributesAsn1.value.push(_attributeToAsn1(attr)); + } + + // DER-serialize and digest SET OF attributes only + bytes = asn1.toDer(attrsAsn1).getBytes(); + signer.md.start().update(bytes); + } + + // sign digest + signer.signature = signer.key.sign(signer.md, 'RSASSA-PKCS1-V1_5'); + } + + // add signer info + msg.signerInfos = _signersToAsn1(msg.signers); + } +}; + +/** + * Creates an empty PKCS#7 message of type EncryptedData. + * + * @return the message. + */ +p7.createEncryptedData = function() { + var msg = null; + msg = { + type: forge.pki.oids.encryptedData, + version: 0, + encryptedContent: { + algorithm: forge.pki.oids['aes256-CBC'] + }, + + /** + * Reads an EncryptedData content block (in ASN.1 format) + * + * @param obj The ASN.1 representation of the EncryptedData content block + */ + fromAsn1: function(obj) { + // Validate EncryptedData content block and capture data. + _fromAsn1(msg, obj, p7.asn1.encryptedDataValidator); + }, + + /** + * Decrypt encrypted content + * + * @param key The (symmetric) key as a byte buffer + */ + decrypt: function(key) { + if(key !== undefined) { + msg.encryptedContent.key = key; + } + _decryptContent(msg); + } + }; + return msg; +}; + +/** + * Creates an empty PKCS#7 message of type EnvelopedData. + * + * @return the message. + */ +p7.createEnvelopedData = function() { + var msg = null; + msg = { + type: forge.pki.oids.envelopedData, + version: 0, + recipients: [], + encryptedContent: { + algorithm: forge.pki.oids['aes256-CBC'] + }, + + /** + * Reads an EnvelopedData content block (in ASN.1 format) + * + * @param obj the ASN.1 representation of the EnvelopedData content block. + */ + fromAsn1: function(obj) { + // validate EnvelopedData content block and capture data + var capture = _fromAsn1(msg, obj, p7.asn1.envelopedDataValidator); + msg.recipients = _recipientsFromAsn1(capture.recipientInfos.value); + }, + + toAsn1: function() { + // ContentInfo + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // ContentType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(msg.type).getBytes()), + // [0] EnvelopedData + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // Version + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(msg.version).getBytes()), + // RecipientInfos + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, + _recipientsToAsn1(msg.recipients)), + // EncryptedContentInfo + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, + _encryptedContentToAsn1(msg.encryptedContent)) + ]) + ]) + ]); + }, + + /** + * Find recipient by X.509 certificate's issuer. + * + * @param cert the certificate with the issuer to look for. + * + * @return the recipient object. + */ + findRecipient: function(cert) { + var sAttr = cert.issuer.attributes; + + for(var i = 0; i < msg.recipients.length; ++i) { + var r = msg.recipients[i]; + var rAttr = r.issuer; + + if(r.serialNumber !== cert.serialNumber) { + continue; + } + + if(rAttr.length !== sAttr.length) { + continue; + } + + var match = true; + for(var j = 0; j < sAttr.length; ++j) { + if(rAttr[j].type !== sAttr[j].type || + rAttr[j].value !== sAttr[j].value) { + match = false; + break; + } + } + + if(match) { + return r; + } + } + + return null; + }, + + /** + * Decrypt enveloped content + * + * @param recipient The recipient object related to the private key + * @param privKey The (RSA) private key object + */ + decrypt: function(recipient, privKey) { + if(msg.encryptedContent.key === undefined && recipient !== undefined && + privKey !== undefined) { + switch(recipient.encryptedContent.algorithm) { + case forge.pki.oids.rsaEncryption: + case forge.pki.oids.desCBC: + var key = privKey.decrypt(recipient.encryptedContent.content); + msg.encryptedContent.key = forge.util.createBuffer(key); + break; + + default: + throw new Error('Unsupported asymmetric cipher, ' + + 'OID ' + recipient.encryptedContent.algorithm); + } + } + + _decryptContent(msg); + }, + + /** + * Add (another) entity to list of recipients. + * + * @param cert The certificate of the entity to add. + */ + addRecipient: function(cert) { + msg.recipients.push({ + version: 0, + issuer: cert.issuer.attributes, + serialNumber: cert.serialNumber, + encryptedContent: { + // We simply assume rsaEncryption here, since forge.pki only + // supports RSA so far. If the PKI module supports other + // ciphers one day, we need to modify this one as well. + algorithm: forge.pki.oids.rsaEncryption, + key: cert.publicKey + } + }); + }, + + /** + * Encrypt enveloped content. + * + * This function supports two optional arguments, cipher and key, which + * can be used to influence symmetric encryption. Unless cipher is + * provided, the cipher specified in encryptedContent.algorithm is used + * (defaults to AES-256-CBC). If no key is provided, encryptedContent.key + * is (re-)used. If that one's not set, a random key will be generated + * automatically. + * + * @param [key] The key to be used for symmetric encryption. + * @param [cipher] The OID of the symmetric cipher to use. + */ + encrypt: function(key, cipher) { + // Part 1: Symmetric encryption + if(msg.encryptedContent.content === undefined) { + cipher = cipher || msg.encryptedContent.algorithm; + key = key || msg.encryptedContent.key; + + var keyLen, ivLen, ciphFn; + switch(cipher) { + case forge.pki.oids['aes128-CBC']: + keyLen = 16; + ivLen = 16; + ciphFn = forge.aes.createEncryptionCipher; + break; + + case forge.pki.oids['aes192-CBC']: + keyLen = 24; + ivLen = 16; + ciphFn = forge.aes.createEncryptionCipher; + break; + + case forge.pki.oids['aes256-CBC']: + keyLen = 32; + ivLen = 16; + ciphFn = forge.aes.createEncryptionCipher; + break; + + case forge.pki.oids['des-EDE3-CBC']: + keyLen = 24; + ivLen = 8; + ciphFn = forge.des.createEncryptionCipher; + break; + + default: + throw new Error('Unsupported symmetric cipher, OID ' + cipher); + } + + if(key === undefined) { + key = forge.util.createBuffer(forge.random.getBytes(keyLen)); + } else if(key.length() != keyLen) { + throw new Error('Symmetric key has wrong length; ' + + 'got ' + key.length() + ' bytes, expected ' + keyLen + '.'); + } + + // Keep a copy of the key & IV in the object, so the caller can + // use it for whatever reason. + msg.encryptedContent.algorithm = cipher; + msg.encryptedContent.key = key; + msg.encryptedContent.parameter = forge.util.createBuffer( + forge.random.getBytes(ivLen)); + + var ciph = ciphFn(key); + ciph.start(msg.encryptedContent.parameter.copy()); + ciph.update(msg.content); + + // The finish function does PKCS#7 padding by default, therefore + // no action required by us. + if(!ciph.finish()) { + throw new Error('Symmetric encryption failed.'); + } + + msg.encryptedContent.content = ciph.output; + } + + // Part 2: asymmetric encryption for each recipient + for(var i = 0; i < msg.recipients.length; ++i) { + var recipient = msg.recipients[i]; + + // Nothing to do, encryption already done. + if(recipient.encryptedContent.content !== undefined) { + continue; + } + + switch(recipient.encryptedContent.algorithm) { + case forge.pki.oids.rsaEncryption: + recipient.encryptedContent.content = + recipient.encryptedContent.key.encrypt( + msg.encryptedContent.key.data); + break; + + default: + throw new Error('Unsupported asymmetric cipher, OID ' + + recipient.encryptedContent.algorithm); + } + } + } + }; + return msg; +}; + +/** + * Converts a single recipient from an ASN.1 object. + * + * @param obj the ASN.1 RecipientInfo. + * + * @return the recipient object. + */ +function _recipientFromAsn1(obj) { + // validate EnvelopedData content block and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(obj, p7.asn1.recipientInfoValidator, capture, errors)) { + var error = new Error('Cannot read PKCS#7 RecipientInfo. ' + + 'ASN.1 object is not an PKCS#7 RecipientInfo.'); + error.errors = errors; + throw error; + } + + return { + version: capture.version.charCodeAt(0), + issuer: forge.pki.RDNAttributesAsArray(capture.issuer), + serialNumber: forge.util.createBuffer(capture.serial).toHex(), + encryptedContent: { + algorithm: asn1.derToOid(capture.encAlgorithm), + parameter: capture.encParameter ? capture.encParameter.value : undefined, + content: capture.encKey + } + }; +} + +/** + * Converts a single recipient object to an ASN.1 object. + * + * @param obj the recipient object. + * + * @return the ASN.1 RecipientInfo. + */ +function _recipientToAsn1(obj) { + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // Version + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(obj.version).getBytes()), + // IssuerAndSerialNumber + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // Name + forge.pki.distinguishedNameToAsn1({attributes: obj.issuer}), + // Serial + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + forge.util.hexToBytes(obj.serialNumber)) + ]), + // KeyEncryptionAlgorithmIdentifier + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // Algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(obj.encryptedContent.algorithm).getBytes()), + // Parameter, force NULL, only RSA supported for now. + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ]), + // EncryptedKey + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + obj.encryptedContent.content) + ]); +} + +/** + * Map a set of RecipientInfo ASN.1 objects to recipient objects. + * + * @param infos an array of ASN.1 representations RecipientInfo (i.e. SET OF). + * + * @return an array of recipient objects. + */ +function _recipientsFromAsn1(infos) { + var ret = []; + for(var i = 0; i < infos.length; ++i) { + ret.push(_recipientFromAsn1(infos[i])); + } + return ret; +} + +/** + * Map an array of recipient objects to ASN.1 RecipientInfo objects. + * + * @param recipients an array of recipientInfo objects. + * + * @return an array of ASN.1 RecipientInfos. + */ +function _recipientsToAsn1(recipients) { + var ret = []; + for(var i = 0; i < recipients.length; ++i) { + ret.push(_recipientToAsn1(recipients[i])); + } + return ret; +} + +/** + * Converts a single signer from an ASN.1 object. + * + * @param obj the ASN.1 representation of a SignerInfo. + * + * @return the signer object. + */ +function _signerFromAsn1(obj) { + // validate EnvelopedData content block and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(obj, p7.asn1.signerInfoValidator, capture, errors)) { + var error = new Error('Cannot read PKCS#7 SignerInfo. ' + + 'ASN.1 object is not an PKCS#7 SignerInfo.'); + error.errors = errors; + throw error; + } + + var rval = { + version: capture.version.charCodeAt(0), + issuer: forge.pki.RDNAttributesAsArray(capture.issuer), + serialNumber: forge.util.createBuffer(capture.serial).toHex(), + digestAlgorithm: asn1.derToOid(capture.digestAlgorithm), + signatureAlgorithm: asn1.derToOid(capture.signatureAlgorithm), + signature: capture.signature, + authenticatedAttributes: [], + unauthenticatedAttributes: [] + }; + + // TODO: convert attributes + var authenticatedAttributes = capture.authenticatedAttributes || []; + var unauthenticatedAttributes = capture.unauthenticatedAttributes || []; + + return rval; +} + +/** + * Converts a single signerInfo object to an ASN.1 object. + * + * @param obj the signerInfo object. + * + * @return the ASN.1 representation of a SignerInfo. + */ +function _signerToAsn1(obj) { + // SignerInfo + var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // version + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(obj.version).getBytes()), + // issuerAndSerialNumber + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // name + forge.pki.distinguishedNameToAsn1({attributes: obj.issuer}), + // serial + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + forge.util.hexToBytes(obj.serialNumber)) + ]), + // digestAlgorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(obj.digestAlgorithm).getBytes()), + // parameters (null) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ]) + ]); + + // authenticatedAttributes (OPTIONAL) + if(obj.authenticatedAttributesAsn1) { + // add ASN.1 previously generated during signing + rval.value.push(obj.authenticatedAttributesAsn1); + } + + // digestEncryptionAlgorithm + rval.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(obj.signatureAlgorithm).getBytes()), + // parameters (null) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ])); + + // encryptedDigest + rval.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, obj.signature)); + + // unauthenticatedAttributes (OPTIONAL) + if(obj.unauthenticatedAttributes.length > 0) { + // [1] IMPLICIT + var attrsAsn1 = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, []); + for(var i = 0; i < obj.unauthenticatedAttributes.length; ++i) { + var attr = obj.unauthenticatedAttributes[i]; + attrsAsn1.values.push(_attributeToAsn1(attr)); + } + rval.value.push(attrsAsn1); + } + + return rval; +} + +/** + * Map a set of SignerInfo ASN.1 objects to an array of signer objects. + * + * @param signerInfoAsn1s an array of ASN.1 SignerInfos (i.e. SET OF). + * + * @return an array of signers objects. + */ +function _signersFromAsn1(signerInfoAsn1s) { + var ret = []; + for(var i = 0; i < signerInfoAsn1s.length; ++i) { + ret.push(_signerFromAsn1(signerInfoAsn1s[i])); + } + return ret; +} + +/** + * Map an array of signer objects to ASN.1 objects. + * + * @param signers an array of signer objects. + * + * @return an array of ASN.1 SignerInfos. + */ +function _signersToAsn1(signers) { + var ret = []; + for(var i = 0; i < signers.length; ++i) { + ret.push(_signerToAsn1(signers[i])); + } + return ret; +} + +/** + * Convert an attribute object to an ASN.1 Attribute. + * + * @param attr the attribute object. + * + * @return the ASN.1 Attribute. + */ +function _attributeToAsn1(attr) { + var value; + + // TODO: generalize to support more attributes + if(attr.type === forge.pki.oids.contentType) { + value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(attr.value).getBytes()); + } else if(attr.type === forge.pki.oids.messageDigest) { + value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + attr.value.bytes()); + } else if(attr.type === forge.pki.oids.signingTime) { + /* Note per RFC 2985: Dates between 1 January 1950 and 31 December 2049 + (inclusive) MUST be encoded as UTCTime. Any dates with year values + before 1950 or after 2049 MUST be encoded as GeneralizedTime. [Further,] + UTCTime values MUST be expressed in Greenwich Mean Time (Zulu) and MUST + include seconds (i.e., times are YYMMDDHHMMSSZ), even where the + number of seconds is zero. Midnight (GMT) must be represented as + "YYMMDD000000Z". */ + // TODO: make these module-level constants + var jan_1_1950 = new Date('1950-01-01T00:00:00Z'); + var jan_1_2050 = new Date('2050-01-01T00:00:00Z'); + var date = attr.value; + if(typeof date === 'string') { + // try to parse date + var timestamp = Date.parse(date); + if(!isNaN(timestamp)) { + date = new Date(timestamp); + } else if(date.length === 13) { + // YYMMDDHHMMSSZ (13 chars for UTCTime) + date = asn1.utcTimeToDate(date); + } else { + // assume generalized time + date = asn1.generalizedTimeToDate(date); + } + } + + if(date >= jan_1_1950 && date < jan_1_2050) { + value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false, + asn1.dateToUtcTime(date)); + } else { + value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false, + asn1.dateToGeneralizedTime(date)); + } + } + + // TODO: expose as common API call + // create a RelativeDistinguishedName set + // each value in the set is an AttributeTypeAndValue first + // containing the type (an OID) and second the value + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // AttributeType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(attr.type).getBytes()), + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ + // AttributeValue + value + ]) + ]); +} + +/** + * Map messages encrypted content to ASN.1 objects. + * + * @param ec The encryptedContent object of the message. + * + * @return ASN.1 representation of the encryptedContent object (SEQUENCE). + */ +function _encryptedContentToAsn1(ec) { + return [ + // ContentType, always Data for the moment + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(forge.pki.oids.data).getBytes()), + // ContentEncryptionAlgorithmIdentifier + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // Algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(ec.algorithm).getBytes()), + // Parameters (IV) + !ec.parameter ? + undefined : + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + ec.parameter.getBytes()) + ]), + // [0] EncryptedContent + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + ec.content.getBytes()) + ]) + ]; +} + +/** + * Reads the "common part" of an PKCS#7 content block (in ASN.1 format) + * + * This function reads the "common part" of the PKCS#7 content blocks + * EncryptedData and EnvelopedData, i.e. version number and symmetrically + * encrypted content block. + * + * The result of the ASN.1 validate and capture process is returned + * to allow the caller to extract further data, e.g. the list of recipients + * in case of a EnvelopedData object. + * + * @param msg the PKCS#7 object to read the data to. + * @param obj the ASN.1 representation of the content block. + * @param validator the ASN.1 structure validator object to use. + * + * @return the value map captured by validator object. + */ +function _fromAsn1(msg, obj, validator) { + var capture = {}; + var errors = []; + if(!asn1.validate(obj, validator, capture, errors)) { + var error = new Error('Cannot read PKCS#7 message. ' + + 'ASN.1 object is not a supported PKCS#7 message.'); + error.errors = error; + throw error; + } + + // Check contentType, so far we only support (raw) Data. + var contentType = asn1.derToOid(capture.contentType); + if(contentType !== forge.pki.oids.data) { + throw new Error('Unsupported PKCS#7 message. ' + + 'Only wrapped ContentType Data supported.'); + } + + if(capture.encryptedContent) { + var content = ''; + if(forge.util.isArray(capture.encryptedContent)) { + for(var i = 0; i < capture.encryptedContent.length; ++i) { + if(capture.encryptedContent[i].type !== asn1.Type.OCTETSTRING) { + throw new Error('Malformed PKCS#7 message, expecting encrypted ' + + 'content constructed of only OCTET STRING objects.'); + } + content += capture.encryptedContent[i].value; + } + } else { + content = capture.encryptedContent; + } + msg.encryptedContent = { + algorithm: asn1.derToOid(capture.encAlgorithm), + parameter: forge.util.createBuffer(capture.encParameter.value), + content: forge.util.createBuffer(content) + }; + } + + if(capture.content) { + var content = ''; + if(forge.util.isArray(capture.content)) { + for(var i = 0; i < capture.content.length; ++i) { + if(capture.content[i].type !== asn1.Type.OCTETSTRING) { + throw new Error('Malformed PKCS#7 message, expecting ' + + 'content constructed of only OCTET STRING objects.'); + } + content += capture.content[i].value; + } + } else { + content = capture.content; + } + msg.content = forge.util.createBuffer(content); + } + + msg.version = capture.version.charCodeAt(0); + msg.rawCapture = capture; + + return capture; +} + +/** + * Decrypt the symmetrically encrypted content block of the PKCS#7 message. + * + * Decryption is skipped in case the PKCS#7 message object already has a + * (decrypted) content attribute. The algorithm, key and cipher parameters + * (probably the iv) are taken from the encryptedContent attribute of the + * message object. + * + * @param The PKCS#7 message object. + */ +function _decryptContent(msg) { + if(msg.encryptedContent.key === undefined) { + throw new Error('Symmetric key not available.'); + } + + if(msg.content === undefined) { + var ciph; + + switch(msg.encryptedContent.algorithm) { + case forge.pki.oids['aes128-CBC']: + case forge.pki.oids['aes192-CBC']: + case forge.pki.oids['aes256-CBC']: + ciph = forge.aes.createDecryptionCipher(msg.encryptedContent.key); + break; + + case forge.pki.oids['desCBC']: + case forge.pki.oids['des-EDE3-CBC']: + ciph = forge.des.createDecryptionCipher(msg.encryptedContent.key); + break; + + default: + throw new Error('Unsupported symmetric cipher, OID ' + + msg.encryptedContent.algorithm); + } + ciph.start(msg.encryptedContent.parameter); + ciph.update(msg.encryptedContent.content); + + if(!ciph.finish()) { + throw new Error('Symmetric decryption failed.'); + } + + msg.content = ciph.output; + } +} + + +/***/ }), + +/***/ 5496: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of ASN.1 validators for PKCS#7 v1.5. + * + * @author Dave Longley + * @author Stefan Siegl + * + * Copyright (c) 2012-2015 Digital Bazaar, Inc. + * Copyright (c) 2012 Stefan Siegl + * + * The ASN.1 representation of PKCS#7 is as follows + * (see RFC #2315 for details, http://www.ietf.org/rfc/rfc2315.txt): + * + * A PKCS#7 message consists of a ContentInfo on root level, which may + * contain any number of further ContentInfo nested into it. + * + * ContentInfo ::= SEQUENCE { + * contentType ContentType, + * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL + * } + * + * ContentType ::= OBJECT IDENTIFIER + * + * EnvelopedData ::= SEQUENCE { + * version Version, + * recipientInfos RecipientInfos, + * encryptedContentInfo EncryptedContentInfo + * } + * + * EncryptedData ::= SEQUENCE { + * version Version, + * encryptedContentInfo EncryptedContentInfo + * } + * + * id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) + * us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } + * + * SignedData ::= SEQUENCE { + * version INTEGER, + * digestAlgorithms DigestAlgorithmIdentifiers, + * contentInfo ContentInfo, + * certificates [0] IMPLICIT Certificates OPTIONAL, + * crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, + * signerInfos SignerInfos + * } + * + * SignerInfos ::= SET OF SignerInfo + * + * SignerInfo ::= SEQUENCE { + * version Version, + * issuerAndSerialNumber IssuerAndSerialNumber, + * digestAlgorithm DigestAlgorithmIdentifier, + * authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, + * digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier, + * encryptedDigest EncryptedDigest, + * unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL + * } + * + * EncryptedDigest ::= OCTET STRING + * + * Attributes ::= SET OF Attribute + * + * Attribute ::= SEQUENCE { + * attrType OBJECT IDENTIFIER, + * attrValues SET OF AttributeValue + * } + * + * AttributeValue ::= ANY + * + * Version ::= INTEGER + * + * RecipientInfos ::= SET OF RecipientInfo + * + * EncryptedContentInfo ::= SEQUENCE { + * contentType ContentType, + * contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, + * encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL + * } + * + * ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier + * + * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters + * for the algorithm, if any. In the case of AES and DES3, there is only one, + * the IV. + * + * AlgorithmIdentifer ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL + * } + * + * EncryptedContent ::= OCTET STRING + * + * RecipientInfo ::= SEQUENCE { + * version Version, + * issuerAndSerialNumber IssuerAndSerialNumber, + * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, + * encryptedKey EncryptedKey + * } + * + * IssuerAndSerialNumber ::= SEQUENCE { + * issuer Name, + * serialNumber CertificateSerialNumber + * } + * + * CertificateSerialNumber ::= INTEGER + * + * KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier + * + * EncryptedKey ::= OCTET STRING + */ +var forge = __webpack_require__(3832); +__webpack_require__(3068); +__webpack_require__(7116); + +// shortcut for ASN.1 API +var asn1 = forge.asn1; + +// shortcut for PKCS#7 API +var p7v = module.exports = forge.pkcs7asn1 = forge.pkcs7asn1 || {}; +forge.pkcs7 = forge.pkcs7 || {}; +forge.pkcs7.asn1 = p7v; + +var contentInfoValidator = { + name: 'ContentInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'ContentInfo.ContentType', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'contentType' + }, { + name: 'ContentInfo.content', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 0, + constructed: true, + optional: true, + captureAsn1: 'content' + }] +}; +p7v.contentInfoValidator = contentInfoValidator; + +var encryptedContentInfoValidator = { + name: 'EncryptedContentInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'EncryptedContentInfo.contentType', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'contentType' + }, { + name: 'EncryptedContentInfo.contentEncryptionAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'EncryptedContentInfo.contentEncryptionAlgorithm.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'encAlgorithm' + }, { + name: 'EncryptedContentInfo.contentEncryptionAlgorithm.parameter', + tagClass: asn1.Class.UNIVERSAL, + captureAsn1: 'encParameter' + }] + }, { + name: 'EncryptedContentInfo.encryptedContent', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 0, + /* The PKCS#7 structure output by OpenSSL somewhat differs from what + * other implementations do generate. + * + * OpenSSL generates a structure like this: + * SEQUENCE { + * ... + * [0] + * 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38 + * C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45 + * ... + * } + * + * Whereas other implementations (and this PKCS#7 module) generate: + * SEQUENCE { + * ... + * [0] { + * OCTET STRING + * 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38 + * C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45 + * ... + * } + * } + * + * In order to support both, we just capture the context specific + * field here. The OCTET STRING bit is removed below. + */ + capture: 'encryptedContent', + captureAsn1: 'encryptedContentAsn1' + }] +}; + +p7v.envelopedDataValidator = { + name: 'EnvelopedData', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'EnvelopedData.Version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'version' + }, { + name: 'EnvelopedData.RecipientInfos', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SET, + constructed: true, + captureAsn1: 'recipientInfos' + }].concat(encryptedContentInfoValidator) +}; + +p7v.encryptedDataValidator = { + name: 'EncryptedData', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'EncryptedData.Version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'version' + }].concat(encryptedContentInfoValidator) +}; + +var signerValidator = { + name: 'SignerInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'SignerInfo.version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false + }, { + name: 'SignerInfo.issuerAndSerialNumber', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'SignerInfo.issuerAndSerialNumber.issuer', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'issuer' + }, { + name: 'SignerInfo.issuerAndSerialNumber.serialNumber', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'serial' + }] + }, { + name: 'SignerInfo.digestAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'SignerInfo.digestAlgorithm.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'digestAlgorithm' + }, { + name: 'SignerInfo.digestAlgorithm.parameter', + tagClass: asn1.Class.UNIVERSAL, + constructed: false, + captureAsn1: 'digestParameter', + optional: true + }] + }, { + name: 'SignerInfo.authenticatedAttributes', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 0, + constructed: true, + optional: true, + capture: 'authenticatedAttributes' + }, { + name: 'SignerInfo.digestEncryptionAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + capture: 'signatureAlgorithm' + }, { + name: 'SignerInfo.encryptedDigest', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'signature' + }, { + name: 'SignerInfo.unauthenticatedAttributes', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 1, + constructed: true, + optional: true, + capture: 'unauthenticatedAttributes' + }] +}; + +p7v.signedDataValidator = { + name: 'SignedData', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'SignedData.Version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'version' + }, { + name: 'SignedData.DigestAlgorithms', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SET, + constructed: true, + captureAsn1: 'digestAlgorithms' + }, + contentInfoValidator, + { + name: 'SignedData.Certificates', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 0, + optional: true, + captureAsn1: 'certificates' + }, { + name: 'SignedData.CertificateRevocationLists', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 1, + optional: true, + captureAsn1: 'crls' + }, { + name: 'SignedData.SignerInfos', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SET, + capture: 'signerInfos', + optional: true, + value: [signerValidator] + }] +}; + +p7v.recipientInfoValidator = { + name: 'RecipientInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'RecipientInfo.version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'version' + }, { + name: 'RecipientInfo.issuerAndSerial', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'RecipientInfo.issuerAndSerial.issuer', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'issuer' + }, { + name: 'RecipientInfo.issuerAndSerial.serialNumber', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'serial' + }] + }, { + name: 'RecipientInfo.keyEncryptionAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'RecipientInfo.keyEncryptionAlgorithm.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'encAlgorithm' + }, { + name: 'RecipientInfo.keyEncryptionAlgorithm.parameter', + tagClass: asn1.Class.UNIVERSAL, + constructed: false, + captureAsn1: 'encParameter', + optional: true + }] + }, { + name: 'RecipientInfo.encryptedKey', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'encKey' + }] +}; + + +/***/ }), + +/***/ 4742: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of a basic Public Key Infrastructure, including + * support for RSA public and private keys. + * + * @author Dave Longley + * + * Copyright (c) 2010-2013 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(3068); +__webpack_require__(6270); +__webpack_require__(7450); +__webpack_require__(6953); +__webpack_require__(8960); +__webpack_require__(5147); +__webpack_require__(6007); +__webpack_require__(8095); +__webpack_require__(7116); +__webpack_require__(5414); + +// shortcut for asn.1 API +var asn1 = forge.asn1; + +/* Public Key Infrastructure (PKI) implementation. */ +var pki = module.exports = forge.pki = forge.pki || {}; + +/** + * NOTE: THIS METHOD IS DEPRECATED. Use pem.decode() instead. + * + * Converts PEM-formatted data to DER. + * + * @param pem the PEM-formatted data. + * + * @return the DER-formatted data. + */ +pki.pemToDer = function(pem) { + var msg = forge.pem.decode(pem)[0]; + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error('Could not convert PEM to DER; PEM is encrypted.'); + } + return forge.util.createBuffer(msg.body); +}; + +/** + * Converts an RSA private key from PEM format. + * + * @param pem the PEM-formatted private key. + * + * @return the private key. + */ +pki.privateKeyFromPem = function(pem) { + var msg = forge.pem.decode(pem)[0]; + + if(msg.type !== 'PRIVATE KEY' && msg.type !== 'RSA PRIVATE KEY') { + var error = new Error('Could not convert private key from PEM; PEM ' + + 'header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".'); + error.headerType = msg.type; + throw error; + } + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error('Could not convert private key from PEM; PEM is encrypted.'); + } + + // convert DER to ASN.1 object + var obj = asn1.fromDer(msg.body); + + return pki.privateKeyFromAsn1(obj); +}; + +/** + * Converts an RSA private key to PEM format. + * + * @param key the private key. + * @param maxline the maximum characters per line, defaults to 64. + * + * @return the PEM-formatted private key. + */ +pki.privateKeyToPem = function(key, maxline) { + // convert to ASN.1, then DER, then PEM-encode + var msg = { + type: 'RSA PRIVATE KEY', + body: asn1.toDer(pki.privateKeyToAsn1(key)).getBytes() + }; + return forge.pem.encode(msg, {maxline: maxline}); +}; + +/** + * Converts a PrivateKeyInfo to PEM format. + * + * @param pki the PrivateKeyInfo. + * @param maxline the maximum characters per line, defaults to 64. + * + * @return the PEM-formatted private key. + */ +pki.privateKeyInfoToPem = function(pki, maxline) { + // convert to DER, then PEM-encode + var msg = { + type: 'PRIVATE KEY', + body: asn1.toDer(pki).getBytes() + }; + return forge.pem.encode(msg, {maxline: maxline}); +}; + + +/***/ }), + +/***/ 9654: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Prime number generation API. + * + * @author Dave Longley + * + * Copyright (c) 2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); +__webpack_require__(5764); +__webpack_require__(9563); + +(function() { + +// forge.prime already defined +if(forge.prime) { + module.exports = forge.prime; + return; +} + +/* PRIME API */ +var prime = module.exports = forge.prime = forge.prime || {}; + +var BigInteger = forge.jsbn.BigInteger; + +// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 +var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; +var THIRTY = new BigInteger(null); +THIRTY.fromInt(30); +var op_or = function(x, y) {return x|y;}; + +/** + * Generates a random probable prime with the given number of bits. + * + * Alternative algorithms can be specified by name as a string or as an + * object with custom options like so: + * + * { + * name: 'PRIMEINC', + * options: { + * maxBlockTime: , + * millerRabinTests: , + * workerScript: , + * workers: . + * workLoad: the size of the work load, ie: number of possible prime + * numbers for each web worker to check per work assignment, + * (default: 100). + * } + * } + * + * @param bits the number of bits for the prime number. + * @param options the options to use. + * [algorithm] the algorithm to use (default: 'PRIMEINC'). + * [prng] a custom crypto-secure pseudo-random number generator to use, + * that must define "getBytesSync". + * + * @return callback(err, num) called once the operation completes. + */ +prime.generateProbablePrime = function(bits, options, callback) { + if(typeof options === 'function') { + callback = options; + options = {}; + } + options = options || {}; + + // default to PRIMEINC algorithm + var algorithm = options.algorithm || 'PRIMEINC'; + if(typeof algorithm === 'string') { + algorithm = {name: algorithm}; + } + algorithm.options = algorithm.options || {}; + + // create prng with api that matches BigInteger secure random + var prng = options.prng || forge.random; + var rng = { + // x is an array to fill with bytes + nextBytes: function(x) { + var b = prng.getBytesSync(x.length); + for(var i = 0; i < x.length; ++i) { + x[i] = b.charCodeAt(i); + } + } + }; + + if(algorithm.name === 'PRIMEINC') { + return primeincFindPrime(bits, rng, algorithm.options, callback); + } + + throw new Error('Invalid prime generation algorithm: ' + algorithm.name); +}; + +function primeincFindPrime(bits, rng, options, callback) { + if('workers' in options) { + return primeincFindPrimeWithWorkers(bits, rng, options, callback); + } + return primeincFindPrimeWithoutWorkers(bits, rng, options, callback); +} + +function primeincFindPrimeWithoutWorkers(bits, rng, options, callback) { + // initialize random number + var num = generateRandom(bits, rng); + + /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The + number we are given is always aligned at 30k + 1. Each time the number is + determined not to be prime we add to get to the next 'i', eg: if the number + was at 30k + 1 we add 6. */ + var deltaIdx = 0; + + // get required number of MR tests + var mrTests = getMillerRabinTests(num.bitLength()); + if('millerRabinTests' in options) { + mrTests = options.millerRabinTests; + } + + // find prime nearest to 'num' for maxBlockTime ms + // 10 ms gives 5ms of leeway for other calculations before dropping + // below 60fps (1000/60 == 16.67), but in reality, the number will + // likely be higher due to an 'atomic' big int modPow + var maxBlockTime = 10; + if('maxBlockTime' in options) { + maxBlockTime = options.maxBlockTime; + } + + _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback); +} + +function _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback) { + var start = +new Date(); + do { + // overflow, regenerate random number + if(num.bitLength() > bits) { + num = generateRandom(bits, rng); + } + // do primality test + if(num.isProbablePrime(mrTests)) { + return callback(null, num); + } + // get next potential prime + num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); + } while(maxBlockTime < 0 || (+new Date() - start < maxBlockTime)); + + // keep trying later + forge.util.setImmediate(function() { + _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback); + }); +} + +// NOTE: This algorithm is indeterminate in nature because workers +// run in parallel looking at different segments of numbers. Even if this +// algorithm is run twice with the same input from a predictable RNG, it +// may produce different outputs. +function primeincFindPrimeWithWorkers(bits, rng, options, callback) { + // web workers unavailable + if(typeof Worker === 'undefined') { + return primeincFindPrimeWithoutWorkers(bits, rng, options, callback); + } + + // initialize random number + var num = generateRandom(bits, rng); + + // use web workers to generate keys + var numWorkers = options.workers; + var workLoad = options.workLoad || 100; + var range = workLoad * 30 / 8; + var workerScript = options.workerScript || 'forge/prime.worker.js'; + if(numWorkers === -1) { + return forge.util.estimateCores(function(err, cores) { + if(err) { + // default to 2 + cores = 2; + } + numWorkers = cores - 1; + generate(); + }); + } + generate(); + + function generate() { + // require at least 1 worker + numWorkers = Math.max(1, numWorkers); + + // TODO: consider optimizing by starting workers outside getPrime() ... + // note that in order to clean up they will have to be made internally + // asynchronous which may actually be slower + + // start workers immediately + var workers = []; + for(var i = 0; i < numWorkers; ++i) { + // FIXME: fix path or use blob URLs + workers[i] = new Worker(workerScript); + } + var running = numWorkers; + + // listen for requests from workers and assign ranges to find prime + for(var i = 0; i < numWorkers; ++i) { + workers[i].addEventListener('message', workerMessage); + } + + /* Note: The distribution of random numbers is unknown. Therefore, each + web worker is continuously allocated a range of numbers to check for a + random number until one is found. + + Every 30 numbers will be checked just 8 times, because prime numbers + have the form: + + 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this) + + Therefore, if we want a web worker to run N checks before asking for + a new range of numbers, each range must contain N*30/8 numbers. + + For 100 checks (workLoad), this is a range of 375. */ + + var found = false; + function workerMessage(e) { + // ignore message, prime already found + if(found) { + return; + } + + --running; + var data = e.data; + if(data.found) { + // terminate all workers + for(var i = 0; i < workers.length; ++i) { + workers[i].terminate(); + } + found = true; + return callback(null, new BigInteger(data.prime, 16)); + } + + // overflow, regenerate random number + if(num.bitLength() > bits) { + num = generateRandom(bits, rng); + } + + // assign new range to check + var hex = num.toString(16); + + // start prime search + e.target.postMessage({ + hex: hex, + workLoad: workLoad + }); + + num.dAddOffset(range, 0); + } + } +} + +/** + * Generates a random number using the given number of bits and RNG. + * + * @param bits the number of bits for the number. + * @param rng the random number generator to use. + * + * @return the random number. + */ +function generateRandom(bits, rng) { + var num = new BigInteger(bits, rng); + // force MSB set + var bits1 = bits - 1; + if(!num.testBit(bits1)) { + num.bitwiseTo(BigInteger.ONE.shiftLeft(bits1), op_or, num); + } + // align number on 30k+1 boundary + num.dAddOffset(31 - num.mod(THIRTY).byteValue(), 0); + return num; +} + +/** + * Returns the required number of Miller-Rabin tests to generate a + * prime with an error probability of (1/2)^80. + * + * See Handbook of Applied Cryptography Chapter 4, Table 4.4. + * + * @param bits the bit size. + * + * @return the required number of iterations. + */ +function getMillerRabinTests(bits) { + if(bits <= 100) return 27; + if(bits <= 150) return 18; + if(bits <= 200) return 15; + if(bits <= 250) return 12; + if(bits <= 300) return 9; + if(bits <= 350) return 8; + if(bits <= 400) return 7; + if(bits <= 500) return 6; + if(bits <= 600) return 5; + if(bits <= 800) return 4; + if(bits <= 1250) return 3; + return 2; +} + +})(); + + +/***/ }), + +/***/ 4933: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var process = __webpack_require__(4155); +/** + * A javascript implementation of a cryptographically-secure + * Pseudo Random Number Generator (PRNG). The Fortuna algorithm is followed + * here though the use of SHA-256 is not enforced; when generating an + * a PRNG context, the hashing algorithm and block cipher used for + * the generator are specified via a plugin. + * + * @author Dave Longley + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); + +var _crypto = null; +if(forge.util.isNodejs && !forge.options.usePureJavaScript && + !process.versions['node-webkit']) { + _crypto = __webpack_require__(5819); +} + +/* PRNG API */ +var prng = module.exports = forge.prng = forge.prng || {}; + +/** + * Creates a new PRNG context. + * + * A PRNG plugin must be passed in that will provide: + * + * 1. A function that initializes the key and seed of a PRNG context. It + * will be given a 16 byte key and a 16 byte seed. Any key expansion + * or transformation of the seed from a byte string into an array of + * integers (or similar) should be performed. + * 2. The cryptographic function used by the generator. It takes a key and + * a seed. + * 3. A seed increment function. It takes the seed and returns seed + 1. + * 4. An api to create a message digest. + * + * For an example, see random.js. + * + * @param plugin the PRNG plugin to use. + */ +prng.create = function(plugin) { + var ctx = { + plugin: plugin, + key: null, + seed: null, + time: null, + // number of reseeds so far + reseeds: 0, + // amount of data generated so far + generated: 0, + // no initial key bytes + keyBytes: '' + }; + + // create 32 entropy pools (each is a message digest) + var md = plugin.md; + var pools = new Array(32); + for(var i = 0; i < 32; ++i) { + pools[i] = md.create(); + } + ctx.pools = pools; + + // entropy pools are written to cyclically, starting at index 0 + ctx.pool = 0; + + /** + * Generates random bytes. The bytes may be generated synchronously or + * asynchronously. Web workers must use the asynchronous interface or + * else the behavior is undefined. + * + * @param count the number of random bytes to generate. + * @param [callback(err, bytes)] called once the operation completes. + * + * @return count random bytes as a string. + */ + ctx.generate = function(count, callback) { + // do synchronously + if(!callback) { + return ctx.generateSync(count); + } + + // simple generator using counter-based CBC + var cipher = ctx.plugin.cipher; + var increment = ctx.plugin.increment; + var formatKey = ctx.plugin.formatKey; + var formatSeed = ctx.plugin.formatSeed; + var b = forge.util.createBuffer(); + + // paranoid deviation from Fortuna: + // reset key for every request to protect previously + // generated random bytes should the key be discovered; + // there is no 100ms based reseeding because of this + // forced reseed for every `generate` call + ctx.key = null; + + generate(); + + function generate(err) { + if(err) { + return callback(err); + } + + // sufficient bytes generated + if(b.length() >= count) { + return callback(null, b.getBytes(count)); + } + + // if amount of data generated is greater than 1 MiB, trigger reseed + if(ctx.generated > 0xfffff) { + ctx.key = null; + } + + if(ctx.key === null) { + // prevent stack overflow + return forge.util.nextTick(function() { + _reseed(generate); + }); + } + + // generate the random bytes + var bytes = cipher(ctx.key, ctx.seed); + ctx.generated += bytes.length; + b.putBytes(bytes); + + // generate bytes for a new key and seed + ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed))); + ctx.seed = formatSeed(cipher(ctx.key, ctx.seed)); + + forge.util.setImmediate(generate); + } + }; + + /** + * Generates random bytes synchronously. + * + * @param count the number of random bytes to generate. + * + * @return count random bytes as a string. + */ + ctx.generateSync = function(count) { + // simple generator using counter-based CBC + var cipher = ctx.plugin.cipher; + var increment = ctx.plugin.increment; + var formatKey = ctx.plugin.formatKey; + var formatSeed = ctx.plugin.formatSeed; + + // paranoid deviation from Fortuna: + // reset key for every request to protect previously + // generated random bytes should the key be discovered; + // there is no 100ms based reseeding because of this + // forced reseed for every `generateSync` call + ctx.key = null; + + var b = forge.util.createBuffer(); + while(b.length() < count) { + // if amount of data generated is greater than 1 MiB, trigger reseed + if(ctx.generated > 0xfffff) { + ctx.key = null; + } + + if(ctx.key === null) { + _reseedSync(); + } + + // generate the random bytes + var bytes = cipher(ctx.key, ctx.seed); + ctx.generated += bytes.length; + b.putBytes(bytes); + + // generate bytes for a new key and seed + ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed))); + ctx.seed = formatSeed(cipher(ctx.key, ctx.seed)); + } + + return b.getBytes(count); + }; + + /** + * Private function that asynchronously reseeds a generator. + * + * @param callback(err) called once the operation completes. + */ + function _reseed(callback) { + if(ctx.pools[0].messageLength >= 32) { + _seed(); + return callback(); + } + // not enough seed data... + var needed = (32 - ctx.pools[0].messageLength) << 5; + ctx.seedFile(needed, function(err, bytes) { + if(err) { + return callback(err); + } + ctx.collect(bytes); + _seed(); + callback(); + }); + } + + /** + * Private function that synchronously reseeds a generator. + */ + function _reseedSync() { + if(ctx.pools[0].messageLength >= 32) { + return _seed(); + } + // not enough seed data... + var needed = (32 - ctx.pools[0].messageLength) << 5; + ctx.collect(ctx.seedFileSync(needed)); + _seed(); + } + + /** + * Private function that seeds a generator once enough bytes are available. + */ + function _seed() { + // update reseed count + ctx.reseeds = (ctx.reseeds === 0xffffffff) ? 0 : ctx.reseeds + 1; + + // goal is to update `key` via: + // key = hash(key + s) + // where 's' is all collected entropy from selected pools, then... + + // create a plugin-based message digest + var md = ctx.plugin.md.create(); + + // consume current key bytes + md.update(ctx.keyBytes); + + // digest the entropy of pools whose index k meet the + // condition 'n mod 2^k == 0' where n is the number of reseeds + var _2powK = 1; + for(var k = 0; k < 32; ++k) { + if(ctx.reseeds % _2powK === 0) { + md.update(ctx.pools[k].digest().getBytes()); + ctx.pools[k].start(); + } + _2powK = _2powK << 1; + } + + // get digest for key bytes + ctx.keyBytes = md.digest().getBytes(); + + // paranoid deviation from Fortuna: + // update `seed` via `seed = hash(key)` + // instead of initializing to zero once and only + // ever incrementing it + md.start(); + md.update(ctx.keyBytes); + var seedBytes = md.digest().getBytes(); + + // update state + ctx.key = ctx.plugin.formatKey(ctx.keyBytes); + ctx.seed = ctx.plugin.formatSeed(seedBytes); + ctx.generated = 0; + } + + /** + * The built-in default seedFile. This seedFile is used when entropy + * is needed immediately. + * + * @param needed the number of bytes that are needed. + * + * @return the random bytes. + */ + function defaultSeedFile(needed) { + // use window.crypto.getRandomValues strong source of entropy if available + var getRandomValues = null; + var globalScope = forge.util.globalScope; + var _crypto = globalScope.crypto || globalScope.msCrypto; + if(_crypto && _crypto.getRandomValues) { + getRandomValues = function(arr) { + return _crypto.getRandomValues(arr); + }; + } + + var b = forge.util.createBuffer(); + if(getRandomValues) { + while(b.length() < needed) { + // max byte length is 65536 before QuotaExceededError is thrown + // http://www.w3.org/TR/WebCryptoAPI/#RandomSource-method-getRandomValues + var count = Math.max(1, Math.min(needed - b.length(), 65536) / 4); + var entropy = new Uint32Array(Math.floor(count)); + try { + getRandomValues(entropy); + for(var i = 0; i < entropy.length; ++i) { + b.putInt32(entropy[i]); + } + } catch(e) { + /* only ignore QuotaExceededError */ + if(!(typeof QuotaExceededError !== 'undefined' && + e instanceof QuotaExceededError)) { + throw e; + } + } + } + } + + // be sad and add some weak random data + if(b.length() < needed) { + /* Draws from Park-Miller "minimal standard" 31 bit PRNG, + implemented with David G. Carta's optimization: with 32 bit math + and without division (Public Domain). */ + var hi, lo, next; + var seed = Math.floor(Math.random() * 0x010000); + while(b.length() < needed) { + lo = 16807 * (seed & 0xFFFF); + hi = 16807 * (seed >> 16); + lo += (hi & 0x7FFF) << 16; + lo += hi >> 15; + lo = (lo & 0x7FFFFFFF) + (lo >> 31); + seed = lo & 0xFFFFFFFF; + + // consume lower 3 bytes of seed + for(var i = 0; i < 3; ++i) { + // throw in more pseudo random + next = seed >>> (i << 3); + next ^= Math.floor(Math.random() * 0x0100); + b.putByte(next & 0xFF); + } + } + } + + return b.getBytes(needed); + } + // initialize seed file APIs + if(_crypto) { + // use nodejs async API + ctx.seedFile = function(needed, callback) { + _crypto.randomBytes(needed, function(err, bytes) { + if(err) { + return callback(err); + } + callback(null, bytes.toString()); + }); + }; + // use nodejs sync API + ctx.seedFileSync = function(needed) { + return _crypto.randomBytes(needed).toString(); + }; + } else { + ctx.seedFile = function(needed, callback) { + try { + callback(null, defaultSeedFile(needed)); + } catch(e) { + callback(e); + } + }; + ctx.seedFileSync = defaultSeedFile; + } + + /** + * Adds entropy to a prng ctx's accumulator. + * + * @param bytes the bytes of entropy as a string. + */ + ctx.collect = function(bytes) { + // iterate over pools distributing entropy cyclically + var count = bytes.length; + for(var i = 0; i < count; ++i) { + ctx.pools[ctx.pool].update(bytes.substr(i, 1)); + ctx.pool = (ctx.pool === 31) ? 0 : ctx.pool + 1; + } + }; + + /** + * Collects an integer of n bits. + * + * @param i the integer entropy. + * @param n the number of bits in the integer. + */ + ctx.collectInt = function(i, n) { + var bytes = ''; + for(var x = 0; x < n; x += 8) { + bytes += String.fromCharCode((i >> x) & 0xFF); + } + ctx.collect(bytes); + }; + + /** + * Registers a Web Worker to receive immediate entropy from the main thread. + * This method is required until Web Workers can access the native crypto + * API. This method should be called twice for each created worker, once in + * the main thread, and once in the worker itself. + * + * @param worker the worker to register. + */ + ctx.registerWorker = function(worker) { + // worker receives random bytes + if(worker === self) { + ctx.seedFile = function(needed, callback) { + function listener(e) { + var data = e.data; + if(data.forge && data.forge.prng) { + self.removeEventListener('message', listener); + callback(data.forge.prng.err, data.forge.prng.bytes); + } + } + self.addEventListener('message', listener); + self.postMessage({forge: {prng: {needed: needed}}}); + }; + } else { + // main thread sends random bytes upon request + var listener = function(e) { + var data = e.data; + if(data.forge && data.forge.prng) { + ctx.seedFile(data.forge.prng.needed, function(err, bytes) { + worker.postMessage({forge: {prng: {err: err, bytes: bytes}}}); + }); + } + }; + // TODO: do we need to remove the event listener when the worker dies? + worker.addEventListener('message', listener); + } + }; + + return ctx; +}; + + +/***/ }), + +/***/ 6007: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of PKCS#1 PSS signature padding. + * + * @author Stefan Siegl + * + * Copyright (c) 2012 Stefan Siegl + */ +var forge = __webpack_require__(3832); +__webpack_require__(9563); +__webpack_require__(7116); + +// shortcut for PSS API +var pss = module.exports = forge.pss = forge.pss || {}; + +/** + * Creates a PSS signature scheme object. + * + * There are several ways to provide a salt for encoding: + * + * 1. Specify the saltLength only and the built-in PRNG will generate it. + * 2. Specify the saltLength and a custom PRNG with 'getBytesSync' defined that + * will be used. + * 3. Specify the salt itself as a forge.util.ByteBuffer. + * + * @param options the options to use: + * md the message digest object to use, a forge md instance. + * mgf the mask generation function to use, a forge mgf instance. + * [saltLength] the length of the salt in octets. + * [prng] the pseudo-random number generator to use to produce a salt. + * [salt] the salt to use when encoding. + * + * @return a signature scheme object. + */ +pss.create = function(options) { + // backwards compatibility w/legacy args: hash, mgf, sLen + if(arguments.length === 3) { + options = { + md: arguments[0], + mgf: arguments[1], + saltLength: arguments[2] + }; + } + + var hash = options.md; + var mgf = options.mgf; + var hLen = hash.digestLength; + + var salt_ = options.salt || null; + if(typeof salt_ === 'string') { + // assume binary-encoded string + salt_ = forge.util.createBuffer(salt_); + } + + var sLen; + if('saltLength' in options) { + sLen = options.saltLength; + } else if(salt_ !== null) { + sLen = salt_.length(); + } else { + throw new Error('Salt length not specified or specific salt not given.'); + } + + if(salt_ !== null && salt_.length() !== sLen) { + throw new Error('Given salt length does not match length of given salt.'); + } + + var prng = options.prng || forge.random; + + var pssobj = {}; + + /** + * Encodes a PSS signature. + * + * This function implements EMSA-PSS-ENCODE as per RFC 3447, section 9.1.1. + * + * @param md the message digest object with the hash to sign. + * @param modsBits the length of the RSA modulus in bits. + * + * @return the encoded message as a binary-encoded string of length + * ceil((modBits - 1) / 8). + */ + pssobj.encode = function(md, modBits) { + var i; + var emBits = modBits - 1; + var emLen = Math.ceil(emBits / 8); + + /* 2. Let mHash = Hash(M), an octet string of length hLen. */ + var mHash = md.digest().getBytes(); + + /* 3. If emLen < hLen + sLen + 2, output "encoding error" and stop. */ + if(emLen < hLen + sLen + 2) { + throw new Error('Message is too long to encrypt.'); + } + + /* 4. Generate a random octet string salt of length sLen; if sLen = 0, + * then salt is the empty string. */ + var salt; + if(salt_ === null) { + salt = prng.getBytesSync(sLen); + } else { + salt = salt_.bytes(); + } + + /* 5. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt; */ + var m_ = new forge.util.ByteBuffer(); + m_.fillWithByte(0, 8); + m_.putBytes(mHash); + m_.putBytes(salt); + + /* 6. Let H = Hash(M'), an octet string of length hLen. */ + hash.start(); + hash.update(m_.getBytes()); + var h = hash.digest().getBytes(); + + /* 7. Generate an octet string PS consisting of emLen - sLen - hLen - 2 + * zero octets. The length of PS may be 0. */ + var ps = new forge.util.ByteBuffer(); + ps.fillWithByte(0, emLen - sLen - hLen - 2); + + /* 8. Let DB = PS || 0x01 || salt; DB is an octet string of length + * emLen - hLen - 1. */ + ps.putByte(0x01); + ps.putBytes(salt); + var db = ps.getBytes(); + + /* 9. Let dbMask = MGF(H, emLen - hLen - 1). */ + var maskLen = emLen - hLen - 1; + var dbMask = mgf.generate(h, maskLen); + + /* 10. Let maskedDB = DB \xor dbMask. */ + var maskedDB = ''; + for(i = 0; i < maskLen; i++) { + maskedDB += String.fromCharCode(db.charCodeAt(i) ^ dbMask.charCodeAt(i)); + } + + /* 11. Set the leftmost 8emLen - emBits bits of the leftmost octet in + * maskedDB to zero. */ + var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF; + maskedDB = String.fromCharCode(maskedDB.charCodeAt(0) & ~mask) + + maskedDB.substr(1); + + /* 12. Let EM = maskedDB || H || 0xbc. + * 13. Output EM. */ + return maskedDB + h + String.fromCharCode(0xbc); + }; + + /** + * Verifies a PSS signature. + * + * This function implements EMSA-PSS-VERIFY as per RFC 3447, section 9.1.2. + * + * @param mHash the message digest hash, as a binary-encoded string, to + * compare against the signature. + * @param em the encoded message, as a binary-encoded string + * (RSA decryption result). + * @param modsBits the length of the RSA modulus in bits. + * + * @return true if the signature was verified, false if not. + */ + pssobj.verify = function(mHash, em, modBits) { + var i; + var emBits = modBits - 1; + var emLen = Math.ceil(emBits / 8); + + /* c. Convert the message representative m to an encoded message EM + * of length emLen = ceil((modBits - 1) / 8) octets, where modBits + * is the length in bits of the RSA modulus n */ + em = em.substr(-emLen); + + /* 3. If emLen < hLen + sLen + 2, output "inconsistent" and stop. */ + if(emLen < hLen + sLen + 2) { + throw new Error('Inconsistent parameters to PSS signature verification.'); + } + + /* 4. If the rightmost octet of EM does not have hexadecimal value + * 0xbc, output "inconsistent" and stop. */ + if(em.charCodeAt(emLen - 1) !== 0xbc) { + throw new Error('Encoded message does not end in 0xBC.'); + } + + /* 5. Let maskedDB be the leftmost emLen - hLen - 1 octets of EM, and + * let H be the next hLen octets. */ + var maskLen = emLen - hLen - 1; + var maskedDB = em.substr(0, maskLen); + var h = em.substr(maskLen, hLen); + + /* 6. If the leftmost 8emLen - emBits bits of the leftmost octet in + * maskedDB are not all equal to zero, output "inconsistent" and stop. */ + var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF; + if((maskedDB.charCodeAt(0) & mask) !== 0) { + throw new Error('Bits beyond keysize not zero as expected.'); + } + + /* 7. Let dbMask = MGF(H, emLen - hLen - 1). */ + var dbMask = mgf.generate(h, maskLen); + + /* 8. Let DB = maskedDB \xor dbMask. */ + var db = ''; + for(i = 0; i < maskLen; i++) { + db += String.fromCharCode(maskedDB.charCodeAt(i) ^ dbMask.charCodeAt(i)); + } + + /* 9. Set the leftmost 8emLen - emBits bits of the leftmost octet + * in DB to zero. */ + db = String.fromCharCode(db.charCodeAt(0) & ~mask) + db.substr(1); + + /* 10. If the emLen - hLen - sLen - 2 leftmost octets of DB are not zero + * or if the octet at position emLen - hLen - sLen - 1 (the leftmost + * position is "position 1") does not have hexadecimal value 0x01, + * output "inconsistent" and stop. */ + var checkLen = emLen - hLen - sLen - 2; + for(i = 0; i < checkLen; i++) { + if(db.charCodeAt(i) !== 0x00) { + throw new Error('Leftmost octets not zero as expected'); + } + } + + if(db.charCodeAt(checkLen) !== 0x01) { + throw new Error('Inconsistent PSS signature, 0x01 marker not found'); + } + + /* 11. Let salt be the last sLen octets of DB. */ + var salt = db.substr(-sLen); + + /* 12. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt */ + var m_ = new forge.util.ByteBuffer(); + m_.fillWithByte(0, 8); + m_.putBytes(mHash); + m_.putBytes(salt); + + /* 13. Let H' = Hash(M'), an octet string of length hLen. */ + hash.start(); + hash.update(m_.getBytes()); + var h_ = hash.digest().getBytes(); + + /* 14. If H = H', output "consistent." Otherwise, output "inconsistent." */ + return h === h_; + }; + + return pssobj; +}; + + +/***/ }), + +/***/ 9563: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * An API for getting cryptographically-secure random bytes. The bytes are + * generated using the Fortuna algorithm devised by Bruce Schneier and + * Niels Ferguson. + * + * Getting strong random bytes is not yet easy to do in javascript. The only + * truish random entropy that can be collected is from the mouse, keyboard, or + * from timing with respect to page loads, etc. This generator makes a poor + * attempt at providing random bytes when those sources haven't yet provided + * enough entropy to initially seed or to reseed the PRNG. + * + * @author Dave Longley + * + * Copyright (c) 2009-2014 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(8925); +__webpack_require__(1668); +__webpack_require__(4933); +__webpack_require__(7116); + +(function() { + +// forge.random already defined +if(forge.random && forge.random.getBytes) { + module.exports = forge.random; + return; +} + +(function(jQuery) { + +// the default prng plugin, uses AES-128 +var prng_aes = {}; +var _prng_aes_output = new Array(4); +var _prng_aes_buffer = forge.util.createBuffer(); +prng_aes.formatKey = function(key) { + // convert the key into 32-bit integers + var tmp = forge.util.createBuffer(key); + key = new Array(4); + key[0] = tmp.getInt32(); + key[1] = tmp.getInt32(); + key[2] = tmp.getInt32(); + key[3] = tmp.getInt32(); + + // return the expanded key + return forge.aes._expandKey(key, false); +}; +prng_aes.formatSeed = function(seed) { + // convert seed into 32-bit integers + var tmp = forge.util.createBuffer(seed); + seed = new Array(4); + seed[0] = tmp.getInt32(); + seed[1] = tmp.getInt32(); + seed[2] = tmp.getInt32(); + seed[3] = tmp.getInt32(); + return seed; +}; +prng_aes.cipher = function(key, seed) { + forge.aes._updateBlock(key, seed, _prng_aes_output, false); + _prng_aes_buffer.putInt32(_prng_aes_output[0]); + _prng_aes_buffer.putInt32(_prng_aes_output[1]); + _prng_aes_buffer.putInt32(_prng_aes_output[2]); + _prng_aes_buffer.putInt32(_prng_aes_output[3]); + return _prng_aes_buffer.getBytes(); +}; +prng_aes.increment = function(seed) { + // FIXME: do we care about carry or signed issues? + ++seed[3]; + return seed; +}; +prng_aes.md = forge.md.sha256; + +/** + * Creates a new PRNG. + */ +function spawnPrng() { + var ctx = forge.prng.create(prng_aes); + + /** + * Gets random bytes. If a native secure crypto API is unavailable, this + * method tries to make the bytes more unpredictable by drawing from data that + * can be collected from the user of the browser, eg: mouse movement. + * + * If a callback is given, this method will be called asynchronously. + * + * @param count the number of random bytes to get. + * @param [callback(err, bytes)] called once the operation completes. + * + * @return the random bytes in a string. + */ + ctx.getBytes = function(count, callback) { + return ctx.generate(count, callback); + }; + + /** + * Gets random bytes asynchronously. If a native secure crypto API is + * unavailable, this method tries to make the bytes more unpredictable by + * drawing from data that can be collected from the user of the browser, + * eg: mouse movement. + * + * @param count the number of random bytes to get. + * + * @return the random bytes in a string. + */ + ctx.getBytesSync = function(count) { + return ctx.generate(count); + }; + + return ctx; +} + +// create default prng context +var _ctx = spawnPrng(); + +// add other sources of entropy only if window.crypto.getRandomValues is not +// available -- otherwise this source will be automatically used by the prng +var getRandomValues = null; +var globalScope = forge.util.globalScope; +var _crypto = globalScope.crypto || globalScope.msCrypto; +if(_crypto && _crypto.getRandomValues) { + getRandomValues = function(arr) { + return _crypto.getRandomValues(arr); + }; +} + +if(forge.options.usePureJavaScript || + (!forge.util.isNodejs && !getRandomValues)) { + // if this is a web worker, do not use weak entropy, instead register to + // receive strong entropy asynchronously from the main thread + if(typeof window === 'undefined' || window.document === undefined) { + // FIXME: + } + + // get load time entropy + _ctx.collectInt(+new Date(), 32); + + // add some entropy from navigator object + if(typeof(navigator) !== 'undefined') { + var _navBytes = ''; + for(var key in navigator) { + try { + if(typeof(navigator[key]) == 'string') { + _navBytes += navigator[key]; + } + } catch(e) { + /* Some navigator keys might not be accessible, e.g. the geolocation + attribute throws an exception if touched in Mozilla chrome:// + context. + + Silently ignore this and just don't use this as a source of + entropy. */ + } + } + _ctx.collect(_navBytes); + _navBytes = null; + } + + // add mouse and keyboard collectors if jquery is available + if(jQuery) { + // set up mouse entropy capture + jQuery().mousemove(function(e) { + // add mouse coords + _ctx.collectInt(e.clientX, 16); + _ctx.collectInt(e.clientY, 16); + }); + + // set up keyboard entropy capture + jQuery().keypress(function(e) { + _ctx.collectInt(e.charCode, 8); + }); + } +} + +/* Random API */ +if(!forge.random) { + forge.random = _ctx; +} else { + // extend forge.random with _ctx + for(var key in _ctx) { + forge.random[key] = _ctx[key]; + } +} + +// expose spawn PRNG +forge.random.createInstance = spawnPrng; + +module.exports = forge.random; + +})(typeof(jQuery) !== 'undefined' ? jQuery : null); + +})(); + + +/***/ }), + +/***/ 9372: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * RC2 implementation. + * + * @author Stefan Siegl + * + * Copyright (c) 2012 Stefan Siegl + * + * Information on the RC2 cipher is available from RFC #2268, + * http://www.ietf.org/rfc/rfc2268.txt + */ +var forge = __webpack_require__(3832); +__webpack_require__(7116); + +var piTable = [ + 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d, + 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2, + 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32, + 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82, + 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc, + 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26, + 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03, + 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7, + 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a, + 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec, + 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39, + 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31, + 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9, + 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9, + 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e, + 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad +]; + +var s = [1, 2, 3, 5]; + +/** + * Rotate a word left by given number of bits. + * + * Bits that are shifted out on the left are put back in on the right + * hand side. + * + * @param word The word to shift left. + * @param bits The number of bits to shift by. + * @return The rotated word. + */ +var rol = function(word, bits) { + return ((word << bits) & 0xffff) | ((word & 0xffff) >> (16 - bits)); +}; + +/** + * Rotate a word right by given number of bits. + * + * Bits that are shifted out on the right are put back in on the left + * hand side. + * + * @param word The word to shift right. + * @param bits The number of bits to shift by. + * @return The rotated word. + */ +var ror = function(word, bits) { + return ((word & 0xffff) >> bits) | ((word << (16 - bits)) & 0xffff); +}; + +/* RC2 API */ +module.exports = forge.rc2 = forge.rc2 || {}; + +/** + * Perform RC2 key expansion as per RFC #2268, section 2. + * + * @param key variable-length user key (between 1 and 128 bytes) + * @param effKeyBits number of effective key bits (default: 128) + * @return the expanded RC2 key (ByteBuffer of 128 bytes) + */ +forge.rc2.expandKey = function(key, effKeyBits) { + if(typeof key === 'string') { + key = forge.util.createBuffer(key); + } + effKeyBits = effKeyBits || 128; + + /* introduce variables that match the names used in RFC #2268 */ + var L = key; + var T = key.length(); + var T1 = effKeyBits; + var T8 = Math.ceil(T1 / 8); + var TM = 0xff >> (T1 & 0x07); + var i; + + for(i = T; i < 128; i++) { + L.putByte(piTable[(L.at(i - 1) + L.at(i - T)) & 0xff]); + } + + L.setAt(128 - T8, piTable[L.at(128 - T8) & TM]); + + for(i = 127 - T8; i >= 0; i--) { + L.setAt(i, piTable[L.at(i + 1) ^ L.at(i + T8)]); + } + + return L; +}; + +/** + * Creates a RC2 cipher object. + * + * @param key the symmetric key to use (as base for key generation). + * @param bits the number of effective key bits. + * @param encrypt false for decryption, true for encryption. + * + * @return the cipher. + */ +var createCipher = function(key, bits, encrypt) { + var _finish = false, _input = null, _output = null, _iv = null; + var mixRound, mashRound; + var i, j, K = []; + + /* Expand key and fill into K[] Array */ + key = forge.rc2.expandKey(key, bits); + for(i = 0; i < 64; i++) { + K.push(key.getInt16Le()); + } + + if(encrypt) { + /** + * Perform one mixing round "in place". + * + * @param R Array of four words to perform mixing on. + */ + mixRound = function(R) { + for(i = 0; i < 4; i++) { + R[i] += K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + + ((~R[(i + 3) % 4]) & R[(i + 1) % 4]); + R[i] = rol(R[i], s[i]); + j++; + } + }; + + /** + * Perform one mashing round "in place". + * + * @param R Array of four words to perform mashing on. + */ + mashRound = function(R) { + for(i = 0; i < 4; i++) { + R[i] += K[R[(i + 3) % 4] & 63]; + } + }; + } else { + /** + * Perform one r-mixing round "in place". + * + * @param R Array of four words to perform mixing on. + */ + mixRound = function(R) { + for(i = 3; i >= 0; i--) { + R[i] = ror(R[i], s[i]); + R[i] -= K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + + ((~R[(i + 3) % 4]) & R[(i + 1) % 4]); + j--; + } + }; + + /** + * Perform one r-mashing round "in place". + * + * @param R Array of four words to perform mashing on. + */ + mashRound = function(R) { + for(i = 3; i >= 0; i--) { + R[i] -= K[R[(i + 3) % 4] & 63]; + } + }; + } + + /** + * Run the specified cipher execution plan. + * + * This function takes four words from the input buffer, applies the IV on + * it (if requested) and runs the provided execution plan. + * + * The plan must be put together in form of a array of arrays. Where the + * outer one is simply a list of steps to perform and the inner one needs + * to have two elements: the first one telling how many rounds to perform, + * the second one telling what to do (i.e. the function to call). + * + * @param {Array} plan The plan to execute. + */ + var runPlan = function(plan) { + var R = []; + + /* Get data from input buffer and fill the four words into R */ + for(i = 0; i < 4; i++) { + var val = _input.getInt16Le(); + + if(_iv !== null) { + if(encrypt) { + /* We're encrypting, apply the IV first. */ + val ^= _iv.getInt16Le(); + } else { + /* We're decryption, keep cipher text for next block. */ + _iv.putInt16Le(val); + } + } + + R.push(val & 0xffff); + } + + /* Reset global "j" variable as per spec. */ + j = encrypt ? 0 : 63; + + /* Run execution plan. */ + for(var ptr = 0; ptr < plan.length; ptr++) { + for(var ctr = 0; ctr < plan[ptr][0]; ctr++) { + plan[ptr][1](R); + } + } + + /* Write back result to output buffer. */ + for(i = 0; i < 4; i++) { + if(_iv !== null) { + if(encrypt) { + /* We're encrypting in CBC-mode, feed back encrypted bytes into + IV buffer to carry it forward to next block. */ + _iv.putInt16Le(R[i]); + } else { + R[i] ^= _iv.getInt16Le(); + } + } + + _output.putInt16Le(R[i]); + } + }; + + /* Create cipher object */ + var cipher = null; + cipher = { + /** + * Starts or restarts the encryption or decryption process, whichever + * was previously configured. + * + * To use the cipher in CBC mode, iv may be given either as a string + * of bytes, or as a byte buffer. For ECB mode, give null as iv. + * + * @param iv the initialization vector to use, null for ECB mode. + * @param output the output the buffer to write to, null to create one. + */ + start: function(iv, output) { + if(iv) { + /* CBC mode */ + if(typeof iv === 'string') { + iv = forge.util.createBuffer(iv); + } + } + + _finish = false; + _input = forge.util.createBuffer(); + _output = output || new forge.util.createBuffer(); + _iv = iv; + + cipher.output = _output; + }, + + /** + * Updates the next block. + * + * @param input the buffer to read from. + */ + update: function(input) { + if(!_finish) { + // not finishing, so fill the input buffer with more input + _input.putBuffer(input); + } + + while(_input.length() >= 8) { + runPlan([ + [ 5, mixRound ], + [ 1, mashRound ], + [ 6, mixRound ], + [ 1, mashRound ], + [ 5, mixRound ] + ]); + } + }, + + /** + * Finishes encrypting or decrypting. + * + * @param pad a padding function to use, null for PKCS#7 padding, + * signature(blockSize, buffer, decrypt). + * + * @return true if successful, false on error. + */ + finish: function(pad) { + var rval = true; + + if(encrypt) { + if(pad) { + rval = pad(8, _input, !encrypt); + } else { + // add PKCS#7 padding to block (each pad byte is the + // value of the number of pad bytes) + var padding = (_input.length() === 8) ? 8 : (8 - _input.length()); + _input.fillWithByte(padding, padding); + } + } + + if(rval) { + // do final update + _finish = true; + cipher.update(); + } + + if(!encrypt) { + // check for error: input data not a multiple of block size + rval = (_input.length() === 0); + if(rval) { + if(pad) { + rval = pad(8, _output, !encrypt); + } else { + // ensure padding byte count is valid + var len = _output.length(); + var count = _output.at(len - 1); + + if(count > len) { + rval = false; + } else { + // trim off padding bytes + _output.truncate(count); + } + } + } + } + + return rval; + } + }; + + return cipher; +}; + +/** + * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the + * given symmetric key. The output will be stored in the 'output' member + * of the returned cipher. + * + * The key and iv may be given as a string of bytes or a byte buffer. + * The cipher is initialized to use 128 effective key bits. + * + * @param key the symmetric key to use. + * @param iv the initialization vector to use. + * @param output the buffer to write to, null to create one. + * + * @return the cipher. + */ +forge.rc2.startEncrypting = function(key, iv, output) { + var cipher = forge.rc2.createEncryptionCipher(key, 128); + cipher.start(iv, output); + return cipher; +}; + +/** + * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the + * given symmetric key. + * + * The key may be given as a string of bytes or a byte buffer. + * + * To start encrypting call start() on the cipher with an iv and optional + * output buffer. + * + * @param key the symmetric key to use. + * + * @return the cipher. + */ +forge.rc2.createEncryptionCipher = function(key, bits) { + return createCipher(key, bits, true); +}; + +/** + * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the + * given symmetric key. The output will be stored in the 'output' member + * of the returned cipher. + * + * The key and iv may be given as a string of bytes or a byte buffer. + * The cipher is initialized to use 128 effective key bits. + * + * @param key the symmetric key to use. + * @param iv the initialization vector to use. + * @param output the buffer to write to, null to create one. + * + * @return the cipher. + */ +forge.rc2.startDecrypting = function(key, iv, output) { + var cipher = forge.rc2.createDecryptionCipher(key, 128); + cipher.start(iv, output); + return cipher; +}; + +/** + * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the + * given symmetric key. + * + * The key may be given as a string of bytes or a byte buffer. + * + * To start decrypting call start() on the cipher with an iv and optional + * output buffer. + * + * @param key the symmetric key to use. + * + * @return the cipher. + */ +forge.rc2.createDecryptionCipher = function(key, bits) { + return createCipher(key, bits, false); +}; + + +/***/ }), + +/***/ 8095: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of basic RSA algorithms. + * + * @author Dave Longley + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + * + * The only algorithm currently supported for PKI is RSA. + * + * An RSA key is often stored in ASN.1 DER format. The SubjectPublicKeyInfo + * ASN.1 structure is composed of an algorithm of type AlgorithmIdentifier + * and a subjectPublicKey of type bit string. + * + * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters + * for the algorithm, if any. In the case of RSA, there aren't any. + * + * SubjectPublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * subjectPublicKey BIT STRING + * } + * + * AlgorithmIdentifer ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL + * } + * + * For an RSA public key, the subjectPublicKey is: + * + * RSAPublicKey ::= SEQUENCE { + * modulus INTEGER, -- n + * publicExponent INTEGER -- e + * } + * + * PrivateKeyInfo ::= SEQUENCE { + * version Version, + * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, + * privateKey PrivateKey, + * attributes [0] IMPLICIT Attributes OPTIONAL + * } + * + * Version ::= INTEGER + * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier + * PrivateKey ::= OCTET STRING + * Attributes ::= SET OF Attribute + * + * An RSA private key as the following structure: + * + * RSAPrivateKey ::= SEQUENCE { + * version Version, + * modulus INTEGER, -- n + * publicExponent INTEGER, -- e + * privateExponent INTEGER, -- d + * prime1 INTEGER, -- p + * prime2 INTEGER, -- q + * exponent1 INTEGER, -- d mod (p-1) + * exponent2 INTEGER, -- d mod (q-1) + * coefficient INTEGER -- (inverse of q) mod p + * } + * + * Version ::= INTEGER + * + * The OID for the RSA key algorithm is: 1.2.840.113549.1.1.1 + */ +var forge = __webpack_require__(3832); +__webpack_require__(3068); +__webpack_require__(5764); +__webpack_require__(6270); +__webpack_require__(8936); +__webpack_require__(9654); +__webpack_require__(9563); +__webpack_require__(7116); + +if(typeof BigInteger === 'undefined') { + var BigInteger = forge.jsbn.BigInteger; +} + +var _crypto = forge.util.isNodejs ? __webpack_require__(5819) : null; + +// shortcut for asn.1 API +var asn1 = forge.asn1; + +// shortcut for util API +var util = forge.util; + +/* + * RSA encryption and decryption, see RFC 2313. + */ +forge.pki = forge.pki || {}; +module.exports = forge.pki.rsa = forge.rsa = forge.rsa || {}; +var pki = forge.pki; + +// for finding primes, which are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 +var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; + +// validator for a PrivateKeyInfo structure +var privateKeyValidator = { + // PrivateKeyInfo + name: 'PrivateKeyInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + // Version (INTEGER) + name: 'PrivateKeyInfo.version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyVersion' + }, { + // privateKeyAlgorithm + name: 'PrivateKeyInfo.privateKeyAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'AlgorithmIdentifier.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'privateKeyOid' + }] + }, { + // PrivateKey + name: 'PrivateKeyInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'privateKey' + }] +}; + +// validator for an RSA private key +var rsaPrivateKeyValidator = { + // RSAPrivateKey + name: 'RSAPrivateKey', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + // Version (INTEGER) + name: 'RSAPrivateKey.version', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyVersion' + }, { + // modulus (n) + name: 'RSAPrivateKey.modulus', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyModulus' + }, { + // publicExponent (e) + name: 'RSAPrivateKey.publicExponent', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyPublicExponent' + }, { + // privateExponent (d) + name: 'RSAPrivateKey.privateExponent', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyPrivateExponent' + }, { + // prime1 (p) + name: 'RSAPrivateKey.prime1', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyPrime1' + }, { + // prime2 (q) + name: 'RSAPrivateKey.prime2', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyPrime2' + }, { + // exponent1 (d mod (p-1)) + name: 'RSAPrivateKey.exponent1', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyExponent1' + }, { + // exponent2 (d mod (q-1)) + name: 'RSAPrivateKey.exponent2', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyExponent2' + }, { + // coefficient ((inverse of q) mod p) + name: 'RSAPrivateKey.coefficient', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'privateKeyCoefficient' + }] +}; + +// validator for an RSA public key +var rsaPublicKeyValidator = { + // RSAPublicKey + name: 'RSAPublicKey', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + // modulus (n) + name: 'RSAPublicKey.modulus', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'publicKeyModulus' + }, { + // publicExponent (e) + name: 'RSAPublicKey.exponent', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'publicKeyExponent' + }] +}; + +// validator for an SubjectPublicKeyInfo structure +// Note: Currently only works with an RSA public key +var publicKeyValidator = forge.pki.rsa.publicKeyValidator = { + name: 'SubjectPublicKeyInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'subjectPublicKeyInfo', + value: [{ + name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'AlgorithmIdentifier.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'publicKeyOid' + }] + }, { + // subjectPublicKey + name: 'SubjectPublicKeyInfo.subjectPublicKey', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.BITSTRING, + constructed: false, + value: [{ + // RSAPublicKey + name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + optional: true, + captureAsn1: 'rsaPublicKey' + }] + }] +}; + +// validator for a DigestInfo structure +var digestInfoValidator = { + name: 'DigestInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'DigestInfo.DigestAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'DigestInfo.DigestAlgorithm.algorithmIdentifier', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'algorithmIdentifier' + }, { + // NULL paramters + name: 'DigestInfo.DigestAlgorithm.parameters', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.NULL, + // captured only to check existence for md2 and md5 + capture: 'parameters', + optional: true, + constructed: false + }] + }, { + // digest + name: 'DigestInfo.digest', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OCTETSTRING, + constructed: false, + capture: 'digest' + }] +}; + +/** + * Wrap digest in DigestInfo object. + * + * This function implements EMSA-PKCS1-v1_5-ENCODE as per RFC 3447. + * + * DigestInfo ::= SEQUENCE { + * digestAlgorithm DigestAlgorithmIdentifier, + * digest Digest + * } + * + * DigestAlgorithmIdentifier ::= AlgorithmIdentifier + * Digest ::= OCTET STRING + * + * @param md the message digest object with the hash to sign. + * + * @return the encoded message (ready for RSA encrytion) + */ +var emsaPkcs1v15encode = function(md) { + // get the oid for the algorithm + var oid; + if(md.algorithm in pki.oids) { + oid = pki.oids[md.algorithm]; + } else { + var error = new Error('Unknown message digest algorithm.'); + error.algorithm = md.algorithm; + throw error; + } + var oidBytes = asn1.oidToDer(oid).getBytes(); + + // create the digest info + var digestInfo = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + var digestAlgorithm = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + digestAlgorithm.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OID, false, oidBytes)); + digestAlgorithm.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')); + var digest = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, + false, md.digest().getBytes()); + digestInfo.value.push(digestAlgorithm); + digestInfo.value.push(digest); + + // encode digest info + return asn1.toDer(digestInfo).getBytes(); +}; + +/** + * Performs x^c mod n (RSA encryption or decryption operation). + * + * @param x the number to raise and mod. + * @param key the key to use. + * @param pub true if the key is public, false if private. + * + * @return the result of x^c mod n. + */ +var _modPow = function(x, key, pub) { + if(pub) { + return x.modPow(key.e, key.n); + } + + if(!key.p || !key.q) { + // allow calculation without CRT params (slow) + return x.modPow(key.d, key.n); + } + + // pre-compute dP, dQ, and qInv if necessary + if(!key.dP) { + key.dP = key.d.mod(key.p.subtract(BigInteger.ONE)); + } + if(!key.dQ) { + key.dQ = key.d.mod(key.q.subtract(BigInteger.ONE)); + } + if(!key.qInv) { + key.qInv = key.q.modInverse(key.p); + } + + /* Chinese remainder theorem (CRT) states: + + Suppose n1, n2, ..., nk are positive integers which are pairwise + coprime (n1 and n2 have no common factors other than 1). For any + integers x1, x2, ..., xk there exists an integer x solving the + system of simultaneous congruences (where ~= means modularly + congruent so a ~= b mod n means a mod n = b mod n): + + x ~= x1 mod n1 + x ~= x2 mod n2 + ... + x ~= xk mod nk + + This system of congruences has a single simultaneous solution x + between 0 and n - 1. Furthermore, each xk solution and x itself + is congruent modulo the product n = n1*n2*...*nk. + So x1 mod n = x2 mod n = xk mod n = x mod n. + + The single simultaneous solution x can be solved with the following + equation: + + x = sum(xi*ri*si) mod n where ri = n/ni and si = ri^-1 mod ni. + + Where x is less than n, xi = x mod ni. + + For RSA we are only concerned with k = 2. The modulus n = pq, where + p and q are coprime. The RSA decryption algorithm is: + + y = x^d mod n + + Given the above: + + x1 = x^d mod p + r1 = n/p = q + s1 = q^-1 mod p + x2 = x^d mod q + r2 = n/q = p + s2 = p^-1 mod q + + So y = (x1r1s1 + x2r2s2) mod n + = ((x^d mod p)q(q^-1 mod p) + (x^d mod q)p(p^-1 mod q)) mod n + + According to Fermat's Little Theorem, if the modulus P is prime, + for any integer A not evenly divisible by P, A^(P-1) ~= 1 mod P. + Since A is not divisible by P it follows that if: + N ~= M mod (P - 1), then A^N mod P = A^M mod P. Therefore: + + A^N mod P = A^(M mod (P - 1)) mod P. (The latter takes less effort + to calculate). In order to calculate x^d mod p more quickly the + exponent d mod (p - 1) is stored in the RSA private key (the same + is done for x^d mod q). These values are referred to as dP and dQ + respectively. Therefore we now have: + + y = ((x^dP mod p)q(q^-1 mod p) + (x^dQ mod q)p(p^-1 mod q)) mod n + + Since we'll be reducing x^dP by modulo p (same for q) we can also + reduce x by p (and q respectively) before hand. Therefore, let + + xp = ((x mod p)^dP mod p), and + xq = ((x mod q)^dQ mod q), yielding: + + y = (xp*q*(q^-1 mod p) + xq*p*(p^-1 mod q)) mod n + + This can be further reduced to a simple algorithm that only + requires 1 inverse (the q inverse is used) to be used and stored. + The algorithm is called Garner's algorithm. If qInv is the + inverse of q, we simply calculate: + + y = (qInv*(xp - xq) mod p) * q + xq + + However, there are two further complications. First, we need to + ensure that xp > xq to prevent signed BigIntegers from being used + so we add p until this is true (since we will be mod'ing with + p anyway). Then, there is a known timing attack on algorithms + using the CRT. To mitigate this risk, "cryptographic blinding" + should be used. This requires simply generating a random number r + between 0 and n-1 and its inverse and multiplying x by r^e before + calculating y and then multiplying y by r^-1 afterwards. Note that + r must be coprime with n (gcd(r, n) === 1) in order to have an + inverse. + */ + + // cryptographic blinding + var r; + do { + r = new BigInteger( + forge.util.bytesToHex(forge.random.getBytes(key.n.bitLength() / 8)), + 16); + } while(r.compareTo(key.n) >= 0 || !r.gcd(key.n).equals(BigInteger.ONE)); + x = x.multiply(r.modPow(key.e, key.n)).mod(key.n); + + // calculate xp and xq + var xp = x.mod(key.p).modPow(key.dP, key.p); + var xq = x.mod(key.q).modPow(key.dQ, key.q); + + // xp must be larger than xq to avoid signed bit usage + while(xp.compareTo(xq) < 0) { + xp = xp.add(key.p); + } + + // do last step + var y = xp.subtract(xq) + .multiply(key.qInv).mod(key.p) + .multiply(key.q).add(xq); + + // remove effect of random for cryptographic blinding + y = y.multiply(r.modInverse(key.n)).mod(key.n); + + return y; +}; + +/** + * NOTE: THIS METHOD IS DEPRECATED, use 'sign' on a private key object or + * 'encrypt' on a public key object instead. + * + * Performs RSA encryption. + * + * The parameter bt controls whether to put padding bytes before the + * message passed in. Set bt to either true or false to disable padding + * completely (in order to handle e.g. EMSA-PSS encoding seperately before), + * signaling whether the encryption operation is a public key operation + * (i.e. encrypting data) or not, i.e. private key operation (data signing). + * + * For PKCS#1 v1.5 padding pass in the block type to use, i.e. either 0x01 + * (for signing) or 0x02 (for encryption). The key operation mode (private + * or public) is derived from this flag in that case). + * + * @param m the message to encrypt as a byte string. + * @param key the RSA key to use. + * @param bt for PKCS#1 v1.5 padding, the block type to use + * (0x01 for private key, 0x02 for public), + * to disable padding: true = public key, false = private key. + * + * @return the encrypted bytes as a string. + */ +pki.rsa.encrypt = function(m, key, bt) { + var pub = bt; + var eb; + + // get the length of the modulus in bytes + var k = Math.ceil(key.n.bitLength() / 8); + + if(bt !== false && bt !== true) { + // legacy, default to PKCS#1 v1.5 padding + pub = (bt === 0x02); + eb = _encodePkcs1_v1_5(m, key, bt); + } else { + eb = forge.util.createBuffer(); + eb.putBytes(m); + } + + // load encryption block as big integer 'x' + // FIXME: hex conversion inefficient, get BigInteger w/byte strings + var x = new BigInteger(eb.toHex(), 16); + + // do RSA encryption + var y = _modPow(x, key, pub); + + // convert y into the encrypted data byte string, if y is shorter in + // bytes than k, then prepend zero bytes to fill up ed + // FIXME: hex conversion inefficient, get BigInteger w/byte strings + var yhex = y.toString(16); + var ed = forge.util.createBuffer(); + var zeros = k - Math.ceil(yhex.length / 2); + while(zeros > 0) { + ed.putByte(0x00); + --zeros; + } + ed.putBytes(forge.util.hexToBytes(yhex)); + return ed.getBytes(); +}; + +/** + * NOTE: THIS METHOD IS DEPRECATED, use 'decrypt' on a private key object or + * 'verify' on a public key object instead. + * + * Performs RSA decryption. + * + * The parameter ml controls whether to apply PKCS#1 v1.5 padding + * or not. Set ml = false to disable padding removal completely + * (in order to handle e.g. EMSA-PSS later on) and simply pass back + * the RSA encryption block. + * + * @param ed the encrypted data to decrypt in as a byte string. + * @param key the RSA key to use. + * @param pub true for a public key operation, false for private. + * @param ml the message length, if known, false to disable padding. + * + * @return the decrypted message as a byte string. + */ +pki.rsa.decrypt = function(ed, key, pub, ml) { + // get the length of the modulus in bytes + var k = Math.ceil(key.n.bitLength() / 8); + + // error if the length of the encrypted data ED is not k + if(ed.length !== k) { + var error = new Error('Encrypted message length is invalid.'); + error.length = ed.length; + error.expected = k; + throw error; + } + + // convert encrypted data into a big integer + // FIXME: hex conversion inefficient, get BigInteger w/byte strings + var y = new BigInteger(forge.util.createBuffer(ed).toHex(), 16); + + // y must be less than the modulus or it wasn't the result of + // a previous mod operation (encryption) using that modulus + if(y.compareTo(key.n) >= 0) { + throw new Error('Encrypted message is invalid.'); + } + + // do RSA decryption + var x = _modPow(y, key, pub); + + // create the encryption block, if x is shorter in bytes than k, then + // prepend zero bytes to fill up eb + // FIXME: hex conversion inefficient, get BigInteger w/byte strings + var xhex = x.toString(16); + var eb = forge.util.createBuffer(); + var zeros = k - Math.ceil(xhex.length / 2); + while(zeros > 0) { + eb.putByte(0x00); + --zeros; + } + eb.putBytes(forge.util.hexToBytes(xhex)); + + if(ml !== false) { + // legacy, default to PKCS#1 v1.5 padding + return _decodePkcs1_v1_5(eb.getBytes(), key, pub); + } + + // return message + return eb.getBytes(); +}; + +/** + * Creates an RSA key-pair generation state object. It is used to allow + * key-generation to be performed in steps. It also allows for a UI to + * display progress updates. + * + * @param bits the size for the private key in bits, defaults to 2048. + * @param e the public exponent to use, defaults to 65537 (0x10001). + * @param [options] the options to use. + * prng a custom crypto-secure pseudo-random number generator to use, + * that must define "getBytesSync". + * algorithm the algorithm to use (default: 'PRIMEINC'). + * + * @return the state object to use to generate the key-pair. + */ +pki.rsa.createKeyPairGenerationState = function(bits, e, options) { + // TODO: migrate step-based prime generation code to forge.prime + + // set default bits + if(typeof(bits) === 'string') { + bits = parseInt(bits, 10); + } + bits = bits || 2048; + + // create prng with api that matches BigInteger secure random + options = options || {}; + var prng = options.prng || forge.random; + var rng = { + // x is an array to fill with bytes + nextBytes: function(x) { + var b = prng.getBytesSync(x.length); + for(var i = 0; i < x.length; ++i) { + x[i] = b.charCodeAt(i); + } + } + }; + + var algorithm = options.algorithm || 'PRIMEINC'; + + // create PRIMEINC algorithm state + var rval; + if(algorithm === 'PRIMEINC') { + rval = { + algorithm: algorithm, + state: 0, + bits: bits, + rng: rng, + eInt: e || 65537, + e: new BigInteger(null), + p: null, + q: null, + qBits: bits >> 1, + pBits: bits - (bits >> 1), + pqState: 0, + num: null, + keys: null + }; + rval.e.fromInt(rval.eInt); + } else { + throw new Error('Invalid key generation algorithm: ' + algorithm); + } + + return rval; +}; + +/** + * Attempts to runs the key-generation algorithm for at most n seconds + * (approximately) using the given state. When key-generation has completed, + * the keys will be stored in state.keys. + * + * To use this function to update a UI while generating a key or to prevent + * causing browser lockups/warnings, set "n" to a value other than 0. A + * simple pattern for generating a key and showing a progress indicator is: + * + * var state = pki.rsa.createKeyPairGenerationState(2048); + * var step = function() { + * // step key-generation, run algorithm for 100 ms, repeat + * if(!forge.pki.rsa.stepKeyPairGenerationState(state, 100)) { + * setTimeout(step, 1); + * } else { + * // key-generation complete + * // TODO: turn off progress indicator here + * // TODO: use the generated key-pair in "state.keys" + * } + * }; + * // TODO: turn on progress indicator here + * setTimeout(step, 0); + * + * @param state the state to use. + * @param n the maximum number of milliseconds to run the algorithm for, 0 + * to run the algorithm to completion. + * + * @return true if the key-generation completed, false if not. + */ +pki.rsa.stepKeyPairGenerationState = function(state, n) { + // set default algorithm if not set + if(!('algorithm' in state)) { + state.algorithm = 'PRIMEINC'; + } + + // TODO: migrate step-based prime generation code to forge.prime + // TODO: abstract as PRIMEINC algorithm + + // do key generation (based on Tom Wu's rsa.js, see jsbn.js license) + // with some minor optimizations and designed to run in steps + + // local state vars + var THIRTY = new BigInteger(null); + THIRTY.fromInt(30); + var deltaIdx = 0; + var op_or = function(x, y) {return x | y;}; + + // keep stepping until time limit is reached or done + var t1 = +new Date(); + var t2; + var total = 0; + while(state.keys === null && (n <= 0 || total < n)) { + // generate p or q + if(state.state === 0) { + /* Note: All primes are of the form: + + 30k+i, for i < 30 and gcd(30, i)=1, where there are 8 values for i + + When we generate a random number, we always align it at 30k + 1. Each + time the number is determined not to be prime we add to get to the + next 'i', eg: if the number was at 30k + 1 we add 6. */ + var bits = (state.p === null) ? state.pBits : state.qBits; + var bits1 = bits - 1; + + // get a random number + if(state.pqState === 0) { + state.num = new BigInteger(bits, state.rng); + // force MSB set + if(!state.num.testBit(bits1)) { + state.num.bitwiseTo( + BigInteger.ONE.shiftLeft(bits1), op_or, state.num); + } + // align number on 30k+1 boundary + state.num.dAddOffset(31 - state.num.mod(THIRTY).byteValue(), 0); + deltaIdx = 0; + + ++state.pqState; + } else if(state.pqState === 1) { + // try to make the number a prime + if(state.num.bitLength() > bits) { + // overflow, try again + state.pqState = 0; + // do primality test + } else if(state.num.isProbablePrime( + _getMillerRabinTests(state.num.bitLength()))) { + ++state.pqState; + } else { + // get next potential prime + state.num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); + } + } else if(state.pqState === 2) { + // ensure number is coprime with e + state.pqState = + (state.num.subtract(BigInteger.ONE).gcd(state.e) + .compareTo(BigInteger.ONE) === 0) ? 3 : 0; + } else if(state.pqState === 3) { + // store p or q + state.pqState = 0; + if(state.p === null) { + state.p = state.num; + } else { + state.q = state.num; + } + + // advance state if both p and q are ready + if(state.p !== null && state.q !== null) { + ++state.state; + } + state.num = null; + } + } else if(state.state === 1) { + // ensure p is larger than q (swap them if not) + if(state.p.compareTo(state.q) < 0) { + state.num = state.p; + state.p = state.q; + state.q = state.num; + } + ++state.state; + } else if(state.state === 2) { + // compute phi: (p - 1)(q - 1) (Euler's totient function) + state.p1 = state.p.subtract(BigInteger.ONE); + state.q1 = state.q.subtract(BigInteger.ONE); + state.phi = state.p1.multiply(state.q1); + ++state.state; + } else if(state.state === 3) { + // ensure e and phi are coprime + if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) === 0) { + // phi and e are coprime, advance + ++state.state; + } else { + // phi and e aren't coprime, so generate a new p and q + state.p = null; + state.q = null; + state.state = 0; + } + } else if(state.state === 4) { + // create n, ensure n is has the right number of bits + state.n = state.p.multiply(state.q); + + // ensure n is right number of bits + if(state.n.bitLength() === state.bits) { + // success, advance + ++state.state; + } else { + // failed, get new q + state.q = null; + state.state = 0; + } + } else if(state.state === 5) { + // set keys + var d = state.e.modInverse(state.phi); + state.keys = { + privateKey: pki.rsa.setPrivateKey( + state.n, state.e, d, state.p, state.q, + d.mod(state.p1), d.mod(state.q1), + state.q.modInverse(state.p)), + publicKey: pki.rsa.setPublicKey(state.n, state.e) + }; + } + + // update timing + t2 = +new Date(); + total += t2 - t1; + t1 = t2; + } + + return state.keys !== null; +}; + +/** + * Generates an RSA public-private key pair in a single call. + * + * To generate a key-pair in steps (to allow for progress updates and to + * prevent blocking or warnings in slow browsers) then use the key-pair + * generation state functions. + * + * To generate a key-pair asynchronously (either through web-workers, if + * available, or by breaking up the work on the main thread), pass a + * callback function. + * + * @param [bits] the size for the private key in bits, defaults to 2048. + * @param [e] the public exponent to use, defaults to 65537. + * @param [options] options for key-pair generation, if given then 'bits' + * and 'e' must *not* be given: + * bits the size for the private key in bits, (default: 2048). + * e the public exponent to use, (default: 65537 (0x10001)). + * workerScript the worker script URL. + * workers the number of web workers (if supported) to use, + * (default: 2). + * workLoad the size of the work load, ie: number of possible prime + * numbers for each web worker to check per work assignment, + * (default: 100). + * prng a custom crypto-secure pseudo-random number generator to use, + * that must define "getBytesSync". Disables use of native APIs. + * algorithm the algorithm to use (default: 'PRIMEINC'). + * @param [callback(err, keypair)] called once the operation completes. + * + * @return an object with privateKey and publicKey properties. + */ +pki.rsa.generateKeyPair = function(bits, e, options, callback) { + // (bits), (options), (callback) + if(arguments.length === 1) { + if(typeof bits === 'object') { + options = bits; + bits = undefined; + } else if(typeof bits === 'function') { + callback = bits; + bits = undefined; + } + } else if(arguments.length === 2) { + // (bits, e), (bits, options), (bits, callback), (options, callback) + if(typeof bits === 'number') { + if(typeof e === 'function') { + callback = e; + e = undefined; + } else if(typeof e !== 'number') { + options = e; + e = undefined; + } + } else { + options = bits; + callback = e; + bits = undefined; + e = undefined; + } + } else if(arguments.length === 3) { + // (bits, e, options), (bits, e, callback), (bits, options, callback) + if(typeof e === 'number') { + if(typeof options === 'function') { + callback = options; + options = undefined; + } + } else { + callback = options; + options = e; + e = undefined; + } + } + options = options || {}; + if(bits === undefined) { + bits = options.bits || 2048; + } + if(e === undefined) { + e = options.e || 0x10001; + } + + // use native code if permitted, available, and parameters are acceptable + if(!forge.options.usePureJavaScript && !options.prng && + bits >= 256 && bits <= 16384 && (e === 0x10001 || e === 3)) { + if(callback) { + // try native async + if(_detectNodeCrypto('generateKeyPair')) { + return _crypto.generateKeyPair('rsa', { + modulusLength: bits, + publicExponent: e, + publicKeyEncoding: { + type: 'spki', + format: 'pem' + }, + privateKeyEncoding: { + type: 'pkcs8', + format: 'pem' + } + }, function(err, pub, priv) { + if(err) { + return callback(err); + } + callback(null, { + privateKey: pki.privateKeyFromPem(priv), + publicKey: pki.publicKeyFromPem(pub) + }); + }); + } + if(_detectSubtleCrypto('generateKey') && + _detectSubtleCrypto('exportKey')) { + // use standard native generateKey + return util.globalScope.crypto.subtle.generateKey({ + name: 'RSASSA-PKCS1-v1_5', + modulusLength: bits, + publicExponent: _intToUint8Array(e), + hash: {name: 'SHA-256'} + }, true /* key can be exported*/, ['sign', 'verify']) + .then(function(pair) { + return util.globalScope.crypto.subtle.exportKey( + 'pkcs8', pair.privateKey); + // avoiding catch(function(err) {...}) to support IE <= 8 + }).then(undefined, function(err) { + callback(err); + }).then(function(pkcs8) { + if(pkcs8) { + var privateKey = pki.privateKeyFromAsn1( + asn1.fromDer(forge.util.createBuffer(pkcs8))); + callback(null, { + privateKey: privateKey, + publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e) + }); + } + }); + } + if(_detectSubtleMsCrypto('generateKey') && + _detectSubtleMsCrypto('exportKey')) { + var genOp = util.globalScope.msCrypto.subtle.generateKey({ + name: 'RSASSA-PKCS1-v1_5', + modulusLength: bits, + publicExponent: _intToUint8Array(e), + hash: {name: 'SHA-256'} + }, true /* key can be exported*/, ['sign', 'verify']); + genOp.oncomplete = function(e) { + var pair = e.target.result; + var exportOp = util.globalScope.msCrypto.subtle.exportKey( + 'pkcs8', pair.privateKey); + exportOp.oncomplete = function(e) { + var pkcs8 = e.target.result; + var privateKey = pki.privateKeyFromAsn1( + asn1.fromDer(forge.util.createBuffer(pkcs8))); + callback(null, { + privateKey: privateKey, + publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e) + }); + }; + exportOp.onerror = function(err) { + callback(err); + }; + }; + genOp.onerror = function(err) { + callback(err); + }; + return; + } + } else { + // try native sync + if(_detectNodeCrypto('generateKeyPairSync')) { + var keypair = _crypto.generateKeyPairSync('rsa', { + modulusLength: bits, + publicExponent: e, + publicKeyEncoding: { + type: 'spki', + format: 'pem' + }, + privateKeyEncoding: { + type: 'pkcs8', + format: 'pem' + } + }); + return { + privateKey: pki.privateKeyFromPem(keypair.privateKey), + publicKey: pki.publicKeyFromPem(keypair.publicKey) + }; + } + } + } + + // use JavaScript implementation + var state = pki.rsa.createKeyPairGenerationState(bits, e, options); + if(!callback) { + pki.rsa.stepKeyPairGenerationState(state, 0); + return state.keys; + } + _generateKeyPair(state, options, callback); +}; + +/** + * Sets an RSA public key from BigIntegers modulus and exponent. + * + * @param n the modulus. + * @param e the exponent. + * + * @return the public key. + */ +pki.setRsaPublicKey = pki.rsa.setPublicKey = function(n, e) { + var key = { + n: n, + e: e + }; + + /** + * Encrypts the given data with this public key. Newer applications + * should use the 'RSA-OAEP' decryption scheme, 'RSAES-PKCS1-V1_5' is for + * legacy applications. + * + * @param data the byte string to encrypt. + * @param scheme the encryption scheme to use: + * 'RSAES-PKCS1-V1_5' (default), + * 'RSA-OAEP', + * 'RAW', 'NONE', or null to perform raw RSA encryption, + * an object with an 'encode' property set to a function + * with the signature 'function(data, key)' that returns + * a binary-encoded string representing the encoded data. + * @param schemeOptions any scheme-specific options. + * + * @return the encrypted byte string. + */ + key.encrypt = function(data, scheme, schemeOptions) { + if(typeof scheme === 'string') { + scheme = scheme.toUpperCase(); + } else if(scheme === undefined) { + scheme = 'RSAES-PKCS1-V1_5'; + } + + if(scheme === 'RSAES-PKCS1-V1_5') { + scheme = { + encode: function(m, key, pub) { + return _encodePkcs1_v1_5(m, key, 0x02).getBytes(); + } + }; + } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') { + scheme = { + encode: function(m, key) { + return forge.pkcs1.encode_rsa_oaep(key, m, schemeOptions); + } + }; + } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { + scheme = {encode: function(e) {return e;}}; + } else if(typeof scheme === 'string') { + throw new Error('Unsupported encryption scheme: "' + scheme + '".'); + } + + // do scheme-based encoding then rsa encryption + var e = scheme.encode(data, key, true); + return pki.rsa.encrypt(e, key, true); + }; + + /** + * Verifies the given signature against the given digest. + * + * PKCS#1 supports multiple (currently two) signature schemes: + * RSASSA-PKCS1-V1_5 and RSASSA-PSS. + * + * By default this implementation uses the "old scheme", i.e. + * RSASSA-PKCS1-V1_5, in which case once RSA-decrypted, the + * signature is an OCTET STRING that holds a DigestInfo. + * + * DigestInfo ::= SEQUENCE { + * digestAlgorithm DigestAlgorithmIdentifier, + * digest Digest + * } + * DigestAlgorithmIdentifier ::= AlgorithmIdentifier + * Digest ::= OCTET STRING + * + * To perform PSS signature verification, provide an instance + * of Forge PSS object as the scheme parameter. + * + * @param digest the message digest hash to compare against the signature, + * as a binary-encoded string. + * @param signature the signature to verify, as a binary-encoded string. + * @param scheme signature verification scheme to use: + * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5, + * a Forge PSS object for RSASSA-PSS, + * 'NONE' or null for none, DigestInfo will not be expected, but + * PKCS#1 v1.5 padding will still be used. + * @param options optional verify options + * _parseAllDigestBytes testing flag to control parsing of all + * digest bytes. Unsupported and not for general usage. + * (default: true) + * + * @return true if the signature was verified, false if not. + */ + key.verify = function(digest, signature, scheme, options) { + if(typeof scheme === 'string') { + scheme = scheme.toUpperCase(); + } else if(scheme === undefined) { + scheme = 'RSASSA-PKCS1-V1_5'; + } + if(options === undefined) { + options = { + _parseAllDigestBytes: true + }; + } + if(!('_parseAllDigestBytes' in options)) { + options._parseAllDigestBytes = true; + } + + if(scheme === 'RSASSA-PKCS1-V1_5') { + scheme = { + verify: function(digest, d) { + // remove padding + d = _decodePkcs1_v1_5(d, key, true); + // d is ASN.1 BER-encoded DigestInfo + var obj = asn1.fromDer(d, { + parseAllBytes: options._parseAllDigestBytes + }); + + // validate DigestInfo + var capture = {}; + var errors = []; + if(!asn1.validate(obj, digestInfoValidator, capture, errors)) { + var error = new Error( + 'ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 ' + + 'DigestInfo value.'); + error.errors = errors; + throw error; + } + // check hash algorithm identifier + // see PKCS1-v1-5DigestAlgorithms in RFC 8017 + // FIXME: add support to vaidator for strict value choices + var oid = asn1.derToOid(capture.algorithmIdentifier); + if(!(oid === forge.oids.md2 || + oid === forge.oids.md5 || + oid === forge.oids.sha1 || + oid === forge.oids.sha224 || + oid === forge.oids.sha256 || + oid === forge.oids.sha384 || + oid === forge.oids.sha512 || + oid === forge.oids['sha512-224'] || + oid === forge.oids['sha512-256'])) { + var error = new Error( + 'Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.'); + error.oid = oid; + throw error; + } + + // special check for md2 and md5 that NULL parameters exist + if(oid === forge.oids.md2 || oid === forge.oids.md5) { + if(!('parameters' in capture)) { + throw new Error( + 'ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 ' + + 'DigestInfo value. ' + + 'Missing algorithm identifer NULL parameters.'); + } + } + + // compare the given digest to the decrypted one + return digest === capture.digest; + } + }; + } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { + scheme = { + verify: function(digest, d) { + // remove padding + d = _decodePkcs1_v1_5(d, key, true); + return digest === d; + } + }; + } + + // do rsa decryption w/o any decoding, then verify -- which does decoding + var d = pki.rsa.decrypt(signature, key, true, false); + return scheme.verify(digest, d, key.n.bitLength()); + }; + + return key; +}; + +/** + * Sets an RSA private key from BigIntegers modulus, exponent, primes, + * prime exponents, and modular multiplicative inverse. + * + * @param n the modulus. + * @param e the public exponent. + * @param d the private exponent ((inverse of e) mod n). + * @param p the first prime. + * @param q the second prime. + * @param dP exponent1 (d mod (p-1)). + * @param dQ exponent2 (d mod (q-1)). + * @param qInv ((inverse of q) mod p) + * + * @return the private key. + */ +pki.setRsaPrivateKey = pki.rsa.setPrivateKey = function( + n, e, d, p, q, dP, dQ, qInv) { + var key = { + n: n, + e: e, + d: d, + p: p, + q: q, + dP: dP, + dQ: dQ, + qInv: qInv + }; + + /** + * Decrypts the given data with this private key. The decryption scheme + * must match the one used to encrypt the data. + * + * @param data the byte string to decrypt. + * @param scheme the decryption scheme to use: + * 'RSAES-PKCS1-V1_5' (default), + * 'RSA-OAEP', + * 'RAW', 'NONE', or null to perform raw RSA decryption. + * @param schemeOptions any scheme-specific options. + * + * @return the decrypted byte string. + */ + key.decrypt = function(data, scheme, schemeOptions) { + if(typeof scheme === 'string') { + scheme = scheme.toUpperCase(); + } else if(scheme === undefined) { + scheme = 'RSAES-PKCS1-V1_5'; + } + + // do rsa decryption w/o any decoding + var d = pki.rsa.decrypt(data, key, false, false); + + if(scheme === 'RSAES-PKCS1-V1_5') { + scheme = {decode: _decodePkcs1_v1_5}; + } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') { + scheme = { + decode: function(d, key) { + return forge.pkcs1.decode_rsa_oaep(key, d, schemeOptions); + } + }; + } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { + scheme = {decode: function(d) {return d;}}; + } else { + throw new Error('Unsupported encryption scheme: "' + scheme + '".'); + } + + // decode according to scheme + return scheme.decode(d, key, false); + }; + + /** + * Signs the given digest, producing a signature. + * + * PKCS#1 supports multiple (currently two) signature schemes: + * RSASSA-PKCS1-V1_5 and RSASSA-PSS. + * + * By default this implementation uses the "old scheme", i.e. + * RSASSA-PKCS1-V1_5. In order to generate a PSS signature, provide + * an instance of Forge PSS object as the scheme parameter. + * + * @param md the message digest object with the hash to sign. + * @param scheme the signature scheme to use: + * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5, + * a Forge PSS object for RSASSA-PSS, + * 'NONE' or null for none, DigestInfo will not be used but + * PKCS#1 v1.5 padding will still be used. + * + * @return the signature as a byte string. + */ + key.sign = function(md, scheme) { + /* Note: The internal implementation of RSA operations is being + transitioned away from a PKCS#1 v1.5 hard-coded scheme. Some legacy + code like the use of an encoding block identifier 'bt' will eventually + be removed. */ + + // private key operation + var bt = false; + + if(typeof scheme === 'string') { + scheme = scheme.toUpperCase(); + } + + if(scheme === undefined || scheme === 'RSASSA-PKCS1-V1_5') { + scheme = {encode: emsaPkcs1v15encode}; + bt = 0x01; + } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { + scheme = {encode: function() {return md;}}; + bt = 0x01; + } + + // encode and then encrypt + var d = scheme.encode(md, key.n.bitLength()); + return pki.rsa.encrypt(d, key, bt); + }; + + return key; +}; + +/** + * Wraps an RSAPrivateKey ASN.1 object in an ASN.1 PrivateKeyInfo object. + * + * @param rsaKey the ASN.1 RSAPrivateKey. + * + * @return the ASN.1 PrivateKeyInfo. + */ +pki.wrapRsaPrivateKey = function(rsaKey) { + // PrivateKeyInfo + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // version (0) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(0).getBytes()), + // privateKeyAlgorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.rsaEncryption).getBytes()), + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ]), + // PrivateKey + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, + asn1.toDer(rsaKey).getBytes()) + ]); +}; + +/** + * Converts a private key from an ASN.1 object. + * + * @param obj the ASN.1 representation of a PrivateKeyInfo containing an + * RSAPrivateKey or an RSAPrivateKey. + * + * @return the private key. + */ +pki.privateKeyFromAsn1 = function(obj) { + // get PrivateKeyInfo + var capture = {}; + var errors = []; + if(asn1.validate(obj, privateKeyValidator, capture, errors)) { + obj = asn1.fromDer(forge.util.createBuffer(capture.privateKey)); + } + + // get RSAPrivateKey + capture = {}; + errors = []; + if(!asn1.validate(obj, rsaPrivateKeyValidator, capture, errors)) { + var error = new Error('Cannot read private key. ' + + 'ASN.1 object does not contain an RSAPrivateKey.'); + error.errors = errors; + throw error; + } + + // Note: Version is currently ignored. + // capture.privateKeyVersion + // FIXME: inefficient, get a BigInteger that uses byte strings + var n, e, d, p, q, dP, dQ, qInv; + n = forge.util.createBuffer(capture.privateKeyModulus).toHex(); + e = forge.util.createBuffer(capture.privateKeyPublicExponent).toHex(); + d = forge.util.createBuffer(capture.privateKeyPrivateExponent).toHex(); + p = forge.util.createBuffer(capture.privateKeyPrime1).toHex(); + q = forge.util.createBuffer(capture.privateKeyPrime2).toHex(); + dP = forge.util.createBuffer(capture.privateKeyExponent1).toHex(); + dQ = forge.util.createBuffer(capture.privateKeyExponent2).toHex(); + qInv = forge.util.createBuffer(capture.privateKeyCoefficient).toHex(); + + // set private key + return pki.setRsaPrivateKey( + new BigInteger(n, 16), + new BigInteger(e, 16), + new BigInteger(d, 16), + new BigInteger(p, 16), + new BigInteger(q, 16), + new BigInteger(dP, 16), + new BigInteger(dQ, 16), + new BigInteger(qInv, 16)); +}; + +/** + * Converts a private key to an ASN.1 RSAPrivateKey. + * + * @param key the private key. + * + * @return the ASN.1 representation of an RSAPrivateKey. + */ +pki.privateKeyToAsn1 = pki.privateKeyToRSAPrivateKey = function(key) { + // RSAPrivateKey + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // version (0 = only 2 primes, 1 multiple primes) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(0).getBytes()), + // modulus (n) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.n)), + // publicExponent (e) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.e)), + // privateExponent (d) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.d)), + // privateKeyPrime1 (p) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.p)), + // privateKeyPrime2 (q) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.q)), + // privateKeyExponent1 (dP) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.dP)), + // privateKeyExponent2 (dQ) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.dQ)), + // coefficient (qInv) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.qInv)) + ]); +}; + +/** + * Converts a public key from an ASN.1 SubjectPublicKeyInfo or RSAPublicKey. + * + * @param obj the asn1 representation of a SubjectPublicKeyInfo or RSAPublicKey. + * + * @return the public key. + */ +pki.publicKeyFromAsn1 = function(obj) { + // get SubjectPublicKeyInfo + var capture = {}; + var errors = []; + if(asn1.validate(obj, publicKeyValidator, capture, errors)) { + // get oid + var oid = asn1.derToOid(capture.publicKeyOid); + if(oid !== pki.oids.rsaEncryption) { + var error = new Error('Cannot read public key. Unknown OID.'); + error.oid = oid; + throw error; + } + obj = capture.rsaPublicKey; + } + + // get RSA params + errors = []; + if(!asn1.validate(obj, rsaPublicKeyValidator, capture, errors)) { + var error = new Error('Cannot read public key. ' + + 'ASN.1 object does not contain an RSAPublicKey.'); + error.errors = errors; + throw error; + } + + // FIXME: inefficient, get a BigInteger that uses byte strings + var n = forge.util.createBuffer(capture.publicKeyModulus).toHex(); + var e = forge.util.createBuffer(capture.publicKeyExponent).toHex(); + + // set public key + return pki.setRsaPublicKey( + new BigInteger(n, 16), + new BigInteger(e, 16)); +}; + +/** + * Converts a public key to an ASN.1 SubjectPublicKeyInfo. + * + * @param key the public key. + * + * @return the asn1 representation of a SubjectPublicKeyInfo. + */ +pki.publicKeyToAsn1 = pki.publicKeyToSubjectPublicKeyInfo = function(key) { + // SubjectPublicKeyInfo + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // AlgorithmIdentifier + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(pki.oids.rsaEncryption).getBytes()), + // parameters (null) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ]), + // subjectPublicKey + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, [ + pki.publicKeyToRSAPublicKey(key) + ]) + ]); +}; + +/** + * Converts a public key to an ASN.1 RSAPublicKey. + * + * @param key the public key. + * + * @return the asn1 representation of a RSAPublicKey. + */ +pki.publicKeyToRSAPublicKey = function(key) { + // RSAPublicKey + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // modulus (n) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.n)), + // publicExponent (e) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + _bnToBytes(key.e)) + ]); +}; + +/** + * Encodes a message using PKCS#1 v1.5 padding. + * + * @param m the message to encode. + * @param key the RSA key to use. + * @param bt the block type to use, i.e. either 0x01 (for signing) or 0x02 + * (for encryption). + * + * @return the padded byte buffer. + */ +function _encodePkcs1_v1_5(m, key, bt) { + var eb = forge.util.createBuffer(); + + // get the length of the modulus in bytes + var k = Math.ceil(key.n.bitLength() / 8); + + /* use PKCS#1 v1.5 padding */ + if(m.length > (k - 11)) { + var error = new Error('Message is too long for PKCS#1 v1.5 padding.'); + error.length = m.length; + error.max = k - 11; + throw error; + } + + /* A block type BT, a padding string PS, and the data D shall be + formatted into an octet string EB, the encryption block: + + EB = 00 || BT || PS || 00 || D + + The block type BT shall be a single octet indicating the structure of + the encryption block. For this version of the document it shall have + value 00, 01, or 02. For a private-key operation, the block type + shall be 00 or 01. For a public-key operation, it shall be 02. + + The padding string PS shall consist of k-3-||D|| octets. For block + type 00, the octets shall have value 00; for block type 01, they + shall have value FF; and for block type 02, they shall be + pseudorandomly generated and nonzero. This makes the length of the + encryption block EB equal to k. */ + + // build the encryption block + eb.putByte(0x00); + eb.putByte(bt); + + // create the padding + var padNum = k - 3 - m.length; + var padByte; + // private key op + if(bt === 0x00 || bt === 0x01) { + padByte = (bt === 0x00) ? 0x00 : 0xFF; + for(var i = 0; i < padNum; ++i) { + eb.putByte(padByte); + } + } else { + // public key op + // pad with random non-zero values + while(padNum > 0) { + var numZeros = 0; + var padBytes = forge.random.getBytes(padNum); + for(var i = 0; i < padNum; ++i) { + padByte = padBytes.charCodeAt(i); + if(padByte === 0) { + ++numZeros; + } else { + eb.putByte(padByte); + } + } + padNum = numZeros; + } + } + + // zero followed by message + eb.putByte(0x00); + eb.putBytes(m); + + return eb; +} + +/** + * Decodes a message using PKCS#1 v1.5 padding. + * + * @param em the message to decode. + * @param key the RSA key to use. + * @param pub true if the key is a public key, false if it is private. + * @param ml the message length, if specified. + * + * @return the decoded bytes. + */ +function _decodePkcs1_v1_5(em, key, pub, ml) { + // get the length of the modulus in bytes + var k = Math.ceil(key.n.bitLength() / 8); + + /* It is an error if any of the following conditions occurs: + + 1. The encryption block EB cannot be parsed unambiguously. + 2. The padding string PS consists of fewer than eight octets + or is inconsisent with the block type BT. + 3. The decryption process is a public-key operation and the block + type BT is not 00 or 01, or the decryption process is a + private-key operation and the block type is not 02. + */ + + // parse the encryption block + var eb = forge.util.createBuffer(em); + var first = eb.getByte(); + var bt = eb.getByte(); + if(first !== 0x00 || + (pub && bt !== 0x00 && bt !== 0x01) || + (!pub && bt != 0x02) || + (pub && bt === 0x00 && typeof(ml) === 'undefined')) { + throw new Error('Encryption block is invalid.'); + } + + var padNum = 0; + if(bt === 0x00) { + // check all padding bytes for 0x00 + padNum = k - 3 - ml; + for(var i = 0; i < padNum; ++i) { + if(eb.getByte() !== 0x00) { + throw new Error('Encryption block is invalid.'); + } + } + } else if(bt === 0x01) { + // find the first byte that isn't 0xFF, should be after all padding + padNum = 0; + while(eb.length() > 1) { + if(eb.getByte() !== 0xFF) { + --eb.read; + break; + } + ++padNum; + } + } else if(bt === 0x02) { + // look for 0x00 byte + padNum = 0; + while(eb.length() > 1) { + if(eb.getByte() === 0x00) { + --eb.read; + break; + } + ++padNum; + } + } + + // zero must be 0x00 and padNum must be (k - 3 - message length) + var zero = eb.getByte(); + if(zero !== 0x00 || padNum !== (k - 3 - eb.length())) { + throw new Error('Encryption block is invalid.'); + } + + return eb.getBytes(); +} + +/** + * Runs the key-generation algorithm asynchronously, either in the background + * via Web Workers, or using the main thread and setImmediate. + * + * @param state the key-pair generation state. + * @param [options] options for key-pair generation: + * workerScript the worker script URL. + * workers the number of web workers (if supported) to use, + * (default: 2, -1 to use estimated cores minus one). + * workLoad the size of the work load, ie: number of possible prime + * numbers for each web worker to check per work assignment, + * (default: 100). + * @param callback(err, keypair) called once the operation completes. + */ +function _generateKeyPair(state, options, callback) { + if(typeof options === 'function') { + callback = options; + options = {}; + } + options = options || {}; + + var opts = { + algorithm: { + name: options.algorithm || 'PRIMEINC', + options: { + workers: options.workers || 2, + workLoad: options.workLoad || 100, + workerScript: options.workerScript + } + } + }; + if('prng' in options) { + opts.prng = options.prng; + } + + generate(); + + function generate() { + // find p and then q (done in series to simplify) + getPrime(state.pBits, function(err, num) { + if(err) { + return callback(err); + } + state.p = num; + if(state.q !== null) { + return finish(err, state.q); + } + getPrime(state.qBits, finish); + }); + } + + function getPrime(bits, callback) { + forge.prime.generateProbablePrime(bits, opts, callback); + } + + function finish(err, num) { + if(err) { + return callback(err); + } + + // set q + state.q = num; + + // ensure p is larger than q (swap them if not) + if(state.p.compareTo(state.q) < 0) { + var tmp = state.p; + state.p = state.q; + state.q = tmp; + } + + // ensure p is coprime with e + if(state.p.subtract(BigInteger.ONE).gcd(state.e) + .compareTo(BigInteger.ONE) !== 0) { + state.p = null; + generate(); + return; + } + + // ensure q is coprime with e + if(state.q.subtract(BigInteger.ONE).gcd(state.e) + .compareTo(BigInteger.ONE) !== 0) { + state.q = null; + getPrime(state.qBits, finish); + return; + } + + // compute phi: (p - 1)(q - 1) (Euler's totient function) + state.p1 = state.p.subtract(BigInteger.ONE); + state.q1 = state.q.subtract(BigInteger.ONE); + state.phi = state.p1.multiply(state.q1); + + // ensure e and phi are coprime + if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) !== 0) { + // phi and e aren't coprime, so generate a new p and q + state.p = state.q = null; + generate(); + return; + } + + // create n, ensure n is has the right number of bits + state.n = state.p.multiply(state.q); + if(state.n.bitLength() !== state.bits) { + // failed, get new q + state.q = null; + getPrime(state.qBits, finish); + return; + } + + // set keys + var d = state.e.modInverse(state.phi); + state.keys = { + privateKey: pki.rsa.setPrivateKey( + state.n, state.e, d, state.p, state.q, + d.mod(state.p1), d.mod(state.q1), + state.q.modInverse(state.p)), + publicKey: pki.rsa.setPublicKey(state.n, state.e) + }; + + callback(null, state.keys); + } +} + +/** + * Converts a positive BigInteger into 2's-complement big-endian bytes. + * + * @param b the big integer to convert. + * + * @return the bytes. + */ +function _bnToBytes(b) { + // prepend 0x00 if first byte >= 0x80 + var hex = b.toString(16); + if(hex[0] >= '8') { + hex = '00' + hex; + } + var bytes = forge.util.hexToBytes(hex); + + // ensure integer is minimally-encoded + if(bytes.length > 1 && + // leading 0x00 for positive integer + ((bytes.charCodeAt(0) === 0 && + (bytes.charCodeAt(1) & 0x80) === 0) || + // leading 0xFF for negative integer + (bytes.charCodeAt(0) === 0xFF && + (bytes.charCodeAt(1) & 0x80) === 0x80))) { + return bytes.substr(1); + } + return bytes; +} + +/** + * Returns the required number of Miller-Rabin tests to generate a + * prime with an error probability of (1/2)^80. + * + * See Handbook of Applied Cryptography Chapter 4, Table 4.4. + * + * @param bits the bit size. + * + * @return the required number of iterations. + */ +function _getMillerRabinTests(bits) { + if(bits <= 100) return 27; + if(bits <= 150) return 18; + if(bits <= 200) return 15; + if(bits <= 250) return 12; + if(bits <= 300) return 9; + if(bits <= 350) return 8; + if(bits <= 400) return 7; + if(bits <= 500) return 6; + if(bits <= 600) return 5; + if(bits <= 800) return 4; + if(bits <= 1250) return 3; + return 2; +} + +/** + * Performs feature detection on the Node crypto interface. + * + * @param fn the feature (function) to detect. + * + * @return true if detected, false if not. + */ +function _detectNodeCrypto(fn) { + return forge.util.isNodejs && typeof _crypto[fn] === 'function'; +} + +/** + * Performs feature detection on the SubtleCrypto interface. + * + * @param fn the feature (function) to detect. + * + * @return true if detected, false if not. + */ +function _detectSubtleCrypto(fn) { + return (typeof util.globalScope !== 'undefined' && + typeof util.globalScope.crypto === 'object' && + typeof util.globalScope.crypto.subtle === 'object' && + typeof util.globalScope.crypto.subtle[fn] === 'function'); +} + +/** + * Performs feature detection on the deprecated Microsoft Internet Explorer + * outdated SubtleCrypto interface. This function should only be used after + * checking for the modern, standard SubtleCrypto interface. + * + * @param fn the feature (function) to detect. + * + * @return true if detected, false if not. + */ +function _detectSubtleMsCrypto(fn) { + return (typeof util.globalScope !== 'undefined' && + typeof util.globalScope.msCrypto === 'object' && + typeof util.globalScope.msCrypto.subtle === 'object' && + typeof util.globalScope.msCrypto.subtle[fn] === 'function'); +} + +function _intToUint8Array(x) { + var bytes = forge.util.hexToBytes(x.toString(16)); + var buffer = new Uint8Array(bytes.length); + for(var i = 0; i < bytes.length; ++i) { + buffer[i] = bytes.charCodeAt(i); + } + return buffer; +} + +function _privateKeyFromJwk(jwk) { + if(jwk.kty !== 'RSA') { + throw new Error( + 'Unsupported key algorithm "' + jwk.kty + '"; algorithm must be "RSA".'); + } + return pki.setRsaPrivateKey( + _base64ToBigInt(jwk.n), + _base64ToBigInt(jwk.e), + _base64ToBigInt(jwk.d), + _base64ToBigInt(jwk.p), + _base64ToBigInt(jwk.q), + _base64ToBigInt(jwk.dp), + _base64ToBigInt(jwk.dq), + _base64ToBigInt(jwk.qi)); +} + +function _publicKeyFromJwk(jwk) { + if(jwk.kty !== 'RSA') { + throw new Error('Key algorithm must be "RSA".'); + } + return pki.setRsaPublicKey( + _base64ToBigInt(jwk.n), + _base64ToBigInt(jwk.e)); +} + +function _base64ToBigInt(b64) { + return new BigInteger(forge.util.bytesToHex(forge.util.decode64(b64)), 16); +} + + +/***/ }), + +/***/ 137: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Secure Hash Algorithm with 160-bit digest (SHA-1) implementation. + * + * @author Dave Longley + * + * Copyright (c) 2010-2015 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(8991); +__webpack_require__(7116); + +var sha1 = module.exports = forge.sha1 = forge.sha1 || {}; +forge.md.sha1 = forge.md.algorithms.sha1 = sha1; + +/** + * Creates a SHA-1 message digest object. + * + * @return a message digest object. + */ +sha1.create = function() { + // do initialization as necessary + if(!_initialized) { + _init(); + } + + // SHA-1 state contains five 32-bit integers + var _state = null; + + // input buffer + var _input = forge.util.createBuffer(); + + // used for word storage + var _w = new Array(80); + + // message digest object + var md = { + algorithm: 'sha1', + blockLength: 64, + digestLength: 20, + // 56-bit length of message so far (does not including padding) + messageLength: 0, + // true message length + fullMessageLength: null, + // size of message length in bytes + messageLengthSize: 8 + }; + + /** + * Starts the digest. + * + * @return this digest object. + */ + md.start = function() { + // up to 56-bit message length for convenience + md.messageLength = 0; + + // full message length (set md.messageLength64 for backwards-compatibility) + md.fullMessageLength = md.messageLength64 = []; + var int32s = md.messageLengthSize / 4; + for(var i = 0; i < int32s; ++i) { + md.fullMessageLength.push(0); + } + _input = forge.util.createBuffer(); + _state = { + h0: 0x67452301, + h1: 0xEFCDAB89, + h2: 0x98BADCFE, + h3: 0x10325476, + h4: 0xC3D2E1F0 + }; + return md; + }; + // start digest automatically for first time + md.start(); + + /** + * Updates the digest with the given message input. The given input can + * treated as raw input (no encoding will be applied) or an encoding of + * 'utf8' maybe given to encode the input using UTF-8. + * + * @param msg the message input to update with. + * @param encoding the encoding to use (default: 'raw', other: 'utf8'). + * + * @return this digest object. + */ + md.update = function(msg, encoding) { + if(encoding === 'utf8') { + msg = forge.util.encodeUtf8(msg); + } + + // update message length + var len = msg.length; + md.messageLength += len; + len = [(len / 0x100000000) >>> 0, len >>> 0]; + for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { + md.fullMessageLength[i] += len[1]; + len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); + md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; + len[0] = ((len[1] / 0x100000000) >>> 0); + } + + // add bytes to input buffer + _input.putBytes(msg); + + // process bytes + _update(_state, _w, _input); + + // compact input buffer every 2K or if empty + if(_input.read > 2048 || _input.length() === 0) { + _input.compact(); + } + + return md; + }; + + /** + * Produces the digest. + * + * @return a byte buffer containing the digest value. + */ + md.digest = function() { + /* Note: Here we copy the remaining bytes in the input buffer and + add the appropriate SHA-1 padding. Then we do the final update + on a copy of the state so that if the user wants to get + intermediate digests they can do so. */ + + /* Determine the number of bytes that must be added to the message + to ensure its length is congruent to 448 mod 512. In other words, + the data to be digested must be a multiple of 512 bits (or 128 bytes). + This data includes the message, some padding, and the length of the + message. Since the length of the message will be encoded as 8 bytes (64 + bits), that means that the last segment of the data must have 56 bytes + (448 bits) of message and padding. Therefore, the length of the message + plus the padding must be congruent to 448 mod 512 because + 512 - 128 = 448. + + In order to fill up the message length it must be filled with + padding that begins with 1 bit followed by all 0 bits. Padding + must *always* be present, so if the message length is already + congruent to 448 mod 512, then 512 padding bits must be added. */ + + var finalBlock = forge.util.createBuffer(); + finalBlock.putBytes(_input.bytes()); + + // compute remaining size to be digested (include message length size) + var remaining = ( + md.fullMessageLength[md.fullMessageLength.length - 1] + + md.messageLengthSize); + + // add padding for overflow blockSize - overflow + // _padding starts with 1 byte with first bit is set (byte value 128), then + // there may be up to (blockSize - 1) other pad bytes + var overflow = remaining & (md.blockLength - 1); + finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); + + // serialize message length in bits in big-endian order; since length + // is stored in bytes we multiply by 8 and add carry from next int + var next, carry; + var bits = md.fullMessageLength[0] * 8; + for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { + next = md.fullMessageLength[i + 1] * 8; + carry = (next / 0x100000000) >>> 0; + bits += carry; + finalBlock.putInt32(bits >>> 0); + bits = next >>> 0; + } + finalBlock.putInt32(bits); + + var s2 = { + h0: _state.h0, + h1: _state.h1, + h2: _state.h2, + h3: _state.h3, + h4: _state.h4 + }; + _update(s2, _w, finalBlock); + var rval = forge.util.createBuffer(); + rval.putInt32(s2.h0); + rval.putInt32(s2.h1); + rval.putInt32(s2.h2); + rval.putInt32(s2.h3); + rval.putInt32(s2.h4); + return rval; + }; + + return md; +}; + +// sha-1 padding bytes not initialized yet +var _padding = null; +var _initialized = false; + +/** + * Initializes the constant tables. + */ +function _init() { + // create padding + _padding = String.fromCharCode(128); + _padding += forge.util.fillString(String.fromCharCode(0x00), 64); + + // now initialized + _initialized = true; +} + +/** + * Updates a SHA-1 state with the given byte buffer. + * + * @param s the SHA-1 state to update. + * @param w the array to use to store words. + * @param bytes the byte buffer to update with. + */ +function _update(s, w, bytes) { + // consume 512 bit (64 byte) chunks + var t, a, b, c, d, e, f, i; + var len = bytes.length(); + while(len >= 64) { + // the w array will be populated with sixteen 32-bit big-endian words + // and then extended into 80 32-bit words according to SHA-1 algorithm + // and for 32-79 using Max Locktyukhin's optimization + + // initialize hash value for this chunk + a = s.h0; + b = s.h1; + c = s.h2; + d = s.h3; + e = s.h4; + + // round 1 + for(i = 0; i < 16; ++i) { + t = bytes.getInt32(); + w[i] = t; + f = d ^ (b & (c ^ d)); + t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t; + e = d; + d = c; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + c = ((b << 30) | (b >>> 2)) >>> 0; + b = a; + a = t; + } + for(; i < 20; ++i) { + t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]); + t = (t << 1) | (t >>> 31); + w[i] = t; + f = d ^ (b & (c ^ d)); + t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t; + e = d; + d = c; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + c = ((b << 30) | (b >>> 2)) >>> 0; + b = a; + a = t; + } + // round 2 + for(; i < 32; ++i) { + t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]); + t = (t << 1) | (t >>> 31); + w[i] = t; + f = b ^ c ^ d; + t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t; + e = d; + d = c; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + c = ((b << 30) | (b >>> 2)) >>> 0; + b = a; + a = t; + } + for(; i < 40; ++i) { + t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); + t = (t << 2) | (t >>> 30); + w[i] = t; + f = b ^ c ^ d; + t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t; + e = d; + d = c; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + c = ((b << 30) | (b >>> 2)) >>> 0; + b = a; + a = t; + } + // round 3 + for(; i < 60; ++i) { + t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); + t = (t << 2) | (t >>> 30); + w[i] = t; + f = (b & c) | (d & (b ^ c)); + t = ((a << 5) | (a >>> 27)) + f + e + 0x8F1BBCDC + t; + e = d; + d = c; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + c = ((b << 30) | (b >>> 2)) >>> 0; + b = a; + a = t; + } + // round 4 + for(; i < 80; ++i) { + t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); + t = (t << 2) | (t >>> 30); + w[i] = t; + f = b ^ c ^ d; + t = ((a << 5) | (a >>> 27)) + f + e + 0xCA62C1D6 + t; + e = d; + d = c; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + c = ((b << 30) | (b >>> 2)) >>> 0; + b = a; + a = t; + } + + // update hash state + s.h0 = (s.h0 + a) | 0; + s.h1 = (s.h1 + b) | 0; + s.h2 = (s.h2 + c) | 0; + s.h3 = (s.h3 + d) | 0; + s.h4 = (s.h4 + e) | 0; + + len -= 64; + } +} + + +/***/ }), + +/***/ 1668: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Secure Hash Algorithm with 256-bit digest (SHA-256) implementation. + * + * See FIPS 180-2 for details. + * + * @author Dave Longley + * + * Copyright (c) 2010-2015 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(8991); +__webpack_require__(7116); + +var sha256 = module.exports = forge.sha256 = forge.sha256 || {}; +forge.md.sha256 = forge.md.algorithms.sha256 = sha256; + +/** + * Creates a SHA-256 message digest object. + * + * @return a message digest object. + */ +sha256.create = function() { + // do initialization as necessary + if(!_initialized) { + _init(); + } + + // SHA-256 state contains eight 32-bit integers + var _state = null; + + // input buffer + var _input = forge.util.createBuffer(); + + // used for word storage + var _w = new Array(64); + + // message digest object + var md = { + algorithm: 'sha256', + blockLength: 64, + digestLength: 32, + // 56-bit length of message so far (does not including padding) + messageLength: 0, + // true message length + fullMessageLength: null, + // size of message length in bytes + messageLengthSize: 8 + }; + + /** + * Starts the digest. + * + * @return this digest object. + */ + md.start = function() { + // up to 56-bit message length for convenience + md.messageLength = 0; + + // full message length (set md.messageLength64 for backwards-compatibility) + md.fullMessageLength = md.messageLength64 = []; + var int32s = md.messageLengthSize / 4; + for(var i = 0; i < int32s; ++i) { + md.fullMessageLength.push(0); + } + _input = forge.util.createBuffer(); + _state = { + h0: 0x6A09E667, + h1: 0xBB67AE85, + h2: 0x3C6EF372, + h3: 0xA54FF53A, + h4: 0x510E527F, + h5: 0x9B05688C, + h6: 0x1F83D9AB, + h7: 0x5BE0CD19 + }; + return md; + }; + // start digest automatically for first time + md.start(); + + /** + * Updates the digest with the given message input. The given input can + * treated as raw input (no encoding will be applied) or an encoding of + * 'utf8' maybe given to encode the input using UTF-8. + * + * @param msg the message input to update with. + * @param encoding the encoding to use (default: 'raw', other: 'utf8'). + * + * @return this digest object. + */ + md.update = function(msg, encoding) { + if(encoding === 'utf8') { + msg = forge.util.encodeUtf8(msg); + } + + // update message length + var len = msg.length; + md.messageLength += len; + len = [(len / 0x100000000) >>> 0, len >>> 0]; + for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { + md.fullMessageLength[i] += len[1]; + len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); + md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; + len[0] = ((len[1] / 0x100000000) >>> 0); + } + + // add bytes to input buffer + _input.putBytes(msg); + + // process bytes + _update(_state, _w, _input); + + // compact input buffer every 2K or if empty + if(_input.read > 2048 || _input.length() === 0) { + _input.compact(); + } + + return md; + }; + + /** + * Produces the digest. + * + * @return a byte buffer containing the digest value. + */ + md.digest = function() { + /* Note: Here we copy the remaining bytes in the input buffer and + add the appropriate SHA-256 padding. Then we do the final update + on a copy of the state so that if the user wants to get + intermediate digests they can do so. */ + + /* Determine the number of bytes that must be added to the message + to ensure its length is congruent to 448 mod 512. In other words, + the data to be digested must be a multiple of 512 bits (or 128 bytes). + This data includes the message, some padding, and the length of the + message. Since the length of the message will be encoded as 8 bytes (64 + bits), that means that the last segment of the data must have 56 bytes + (448 bits) of message and padding. Therefore, the length of the message + plus the padding must be congruent to 448 mod 512 because + 512 - 128 = 448. + + In order to fill up the message length it must be filled with + padding that begins with 1 bit followed by all 0 bits. Padding + must *always* be present, so if the message length is already + congruent to 448 mod 512, then 512 padding bits must be added. */ + + var finalBlock = forge.util.createBuffer(); + finalBlock.putBytes(_input.bytes()); + + // compute remaining size to be digested (include message length size) + var remaining = ( + md.fullMessageLength[md.fullMessageLength.length - 1] + + md.messageLengthSize); + + // add padding for overflow blockSize - overflow + // _padding starts with 1 byte with first bit is set (byte value 128), then + // there may be up to (blockSize - 1) other pad bytes + var overflow = remaining & (md.blockLength - 1); + finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); + + // serialize message length in bits in big-endian order; since length + // is stored in bytes we multiply by 8 and add carry from next int + var next, carry; + var bits = md.fullMessageLength[0] * 8; + for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { + next = md.fullMessageLength[i + 1] * 8; + carry = (next / 0x100000000) >>> 0; + bits += carry; + finalBlock.putInt32(bits >>> 0); + bits = next >>> 0; + } + finalBlock.putInt32(bits); + + var s2 = { + h0: _state.h0, + h1: _state.h1, + h2: _state.h2, + h3: _state.h3, + h4: _state.h4, + h5: _state.h5, + h6: _state.h6, + h7: _state.h7 + }; + _update(s2, _w, finalBlock); + var rval = forge.util.createBuffer(); + rval.putInt32(s2.h0); + rval.putInt32(s2.h1); + rval.putInt32(s2.h2); + rval.putInt32(s2.h3); + rval.putInt32(s2.h4); + rval.putInt32(s2.h5); + rval.putInt32(s2.h6); + rval.putInt32(s2.h7); + return rval; + }; + + return md; +}; + +// sha-256 padding bytes not initialized yet +var _padding = null; +var _initialized = false; + +// table of constants +var _k = null; + +/** + * Initializes the constant tables. + */ +function _init() { + // create padding + _padding = String.fromCharCode(128); + _padding += forge.util.fillString(String.fromCharCode(0x00), 64); + + // create K table for SHA-256 + _k = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; + + // now initialized + _initialized = true; +} + +/** + * Updates a SHA-256 state with the given byte buffer. + * + * @param s the SHA-256 state to update. + * @param w the array to use to store words. + * @param bytes the byte buffer to update with. + */ +function _update(s, w, bytes) { + // consume 512 bit (64 byte) chunks + var t1, t2, s0, s1, ch, maj, i, a, b, c, d, e, f, g, h; + var len = bytes.length(); + while(len >= 64) { + // the w array will be populated with sixteen 32-bit big-endian words + // and then extended into 64 32-bit words according to SHA-256 + for(i = 0; i < 16; ++i) { + w[i] = bytes.getInt32(); + } + for(; i < 64; ++i) { + // XOR word 2 words ago rot right 17, rot right 19, shft right 10 + t1 = w[i - 2]; + t1 = + ((t1 >>> 17) | (t1 << 15)) ^ + ((t1 >>> 19) | (t1 << 13)) ^ + (t1 >>> 10); + // XOR word 15 words ago rot right 7, rot right 18, shft right 3 + t2 = w[i - 15]; + t2 = + ((t2 >>> 7) | (t2 << 25)) ^ + ((t2 >>> 18) | (t2 << 14)) ^ + (t2 >>> 3); + // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^32 + w[i] = (t1 + w[i - 7] + t2 + w[i - 16]) | 0; + } + + // initialize hash value for this chunk + a = s.h0; + b = s.h1; + c = s.h2; + d = s.h3; + e = s.h4; + f = s.h5; + g = s.h6; + h = s.h7; + + // round function + for(i = 0; i < 64; ++i) { + // Sum1(e) + s1 = + ((e >>> 6) | (e << 26)) ^ + ((e >>> 11) | (e << 21)) ^ + ((e >>> 25) | (e << 7)); + // Ch(e, f, g) (optimized the same way as SHA-1) + ch = g ^ (e & (f ^ g)); + // Sum0(a) + s0 = + ((a >>> 2) | (a << 30)) ^ + ((a >>> 13) | (a << 19)) ^ + ((a >>> 22) | (a << 10)); + // Maj(a, b, c) (optimized the same way as SHA-1) + maj = (a & b) | (c & (a ^ b)); + + // main algorithm + t1 = h + s1 + ch + _k[i] + w[i]; + t2 = s0 + maj; + h = g; + g = f; + f = e; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + // can't truncate with `| 0` + e = (d + t1) >>> 0; + d = c; + c = b; + b = a; + // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug + // can't truncate with `| 0` + a = (t1 + t2) >>> 0; + } + + // update hash state + s.h0 = (s.h0 + a) | 0; + s.h1 = (s.h1 + b) | 0; + s.h2 = (s.h2 + c) | 0; + s.h3 = (s.h3 + d) | 0; + s.h4 = (s.h4 + e) | 0; + s.h5 = (s.h5 + f) | 0; + s.h6 = (s.h6 + g) | 0; + s.h7 = (s.h7 + h) | 0; + len -= 64; + } +} + + +/***/ }), + +/***/ 3219: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Secure Hash Algorithm with a 1024-bit block size implementation. + * + * This includes: SHA-512, SHA-384, SHA-512/224, and SHA-512/256. For + * SHA-256 (block size 512 bits), see sha256.js. + * + * See FIPS 180-4 for details. + * + * @author Dave Longley + * + * Copyright (c) 2014-2015 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +__webpack_require__(8991); +__webpack_require__(7116); + +var sha512 = module.exports = forge.sha512 = forge.sha512 || {}; + +// SHA-512 +forge.md.sha512 = forge.md.algorithms.sha512 = sha512; + +// SHA-384 +var sha384 = forge.sha384 = forge.sha512.sha384 = forge.sha512.sha384 || {}; +sha384.create = function() { + return sha512.create('SHA-384'); +}; +forge.md.sha384 = forge.md.algorithms.sha384 = sha384; + +// SHA-512/256 +forge.sha512.sha256 = forge.sha512.sha256 || { + create: function() { + return sha512.create('SHA-512/256'); + } +}; +forge.md['sha512/256'] = forge.md.algorithms['sha512/256'] = + forge.sha512.sha256; + +// SHA-512/224 +forge.sha512.sha224 = forge.sha512.sha224 || { + create: function() { + return sha512.create('SHA-512/224'); + } +}; +forge.md['sha512/224'] = forge.md.algorithms['sha512/224'] = + forge.sha512.sha224; + +/** + * Creates a SHA-2 message digest object. + * + * @param algorithm the algorithm to use (SHA-512, SHA-384, SHA-512/224, + * SHA-512/256). + * + * @return a message digest object. + */ +sha512.create = function(algorithm) { + // do initialization as necessary + if(!_initialized) { + _init(); + } + + if(typeof algorithm === 'undefined') { + algorithm = 'SHA-512'; + } + + if(!(algorithm in _states)) { + throw new Error('Invalid SHA-512 algorithm: ' + algorithm); + } + + // SHA-512 state contains eight 64-bit integers (each as two 32-bit ints) + var _state = _states[algorithm]; + var _h = null; + + // input buffer + var _input = forge.util.createBuffer(); + + // used for 64-bit word storage + var _w = new Array(80); + for(var wi = 0; wi < 80; ++wi) { + _w[wi] = new Array(2); + } + + // determine digest length by algorithm name (default) + var digestLength = 64; + switch(algorithm) { + case 'SHA-384': + digestLength = 48; + break; + case 'SHA-512/256': + digestLength = 32; + break; + case 'SHA-512/224': + digestLength = 28; + break; + } + + // message digest object + var md = { + // SHA-512 => sha512 + algorithm: algorithm.replace('-', '').toLowerCase(), + blockLength: 128, + digestLength: digestLength, + // 56-bit length of message so far (does not including padding) + messageLength: 0, + // true message length + fullMessageLength: null, + // size of message length in bytes + messageLengthSize: 16 + }; + + /** + * Starts the digest. + * + * @return this digest object. + */ + md.start = function() { + // up to 56-bit message length for convenience + md.messageLength = 0; + + // full message length (set md.messageLength128 for backwards-compatibility) + md.fullMessageLength = md.messageLength128 = []; + var int32s = md.messageLengthSize / 4; + for(var i = 0; i < int32s; ++i) { + md.fullMessageLength.push(0); + } + _input = forge.util.createBuffer(); + _h = new Array(_state.length); + for(var i = 0; i < _state.length; ++i) { + _h[i] = _state[i].slice(0); + } + return md; + }; + // start digest automatically for first time + md.start(); + + /** + * Updates the digest with the given message input. The given input can + * treated as raw input (no encoding will be applied) or an encoding of + * 'utf8' maybe given to encode the input using UTF-8. + * + * @param msg the message input to update with. + * @param encoding the encoding to use (default: 'raw', other: 'utf8'). + * + * @return this digest object. + */ + md.update = function(msg, encoding) { + if(encoding === 'utf8') { + msg = forge.util.encodeUtf8(msg); + } + + // update message length + var len = msg.length; + md.messageLength += len; + len = [(len / 0x100000000) >>> 0, len >>> 0]; + for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { + md.fullMessageLength[i] += len[1]; + len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); + md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; + len[0] = ((len[1] / 0x100000000) >>> 0); + } + + // add bytes to input buffer + _input.putBytes(msg); + + // process bytes + _update(_h, _w, _input); + + // compact input buffer every 2K or if empty + if(_input.read > 2048 || _input.length() === 0) { + _input.compact(); + } + + return md; + }; + + /** + * Produces the digest. + * + * @return a byte buffer containing the digest value. + */ + md.digest = function() { + /* Note: Here we copy the remaining bytes in the input buffer and + add the appropriate SHA-512 padding. Then we do the final update + on a copy of the state so that if the user wants to get + intermediate digests they can do so. */ + + /* Determine the number of bytes that must be added to the message + to ensure its length is congruent to 896 mod 1024. In other words, + the data to be digested must be a multiple of 1024 bits (or 128 bytes). + This data includes the message, some padding, and the length of the + message. Since the length of the message will be encoded as 16 bytes (128 + bits), that means that the last segment of the data must have 112 bytes + (896 bits) of message and padding. Therefore, the length of the message + plus the padding must be congruent to 896 mod 1024 because + 1024 - 128 = 896. + + In order to fill up the message length it must be filled with + padding that begins with 1 bit followed by all 0 bits. Padding + must *always* be present, so if the message length is already + congruent to 896 mod 1024, then 1024 padding bits must be added. */ + + var finalBlock = forge.util.createBuffer(); + finalBlock.putBytes(_input.bytes()); + + // compute remaining size to be digested (include message length size) + var remaining = ( + md.fullMessageLength[md.fullMessageLength.length - 1] + + md.messageLengthSize); + + // add padding for overflow blockSize - overflow + // _padding starts with 1 byte with first bit is set (byte value 128), then + // there may be up to (blockSize - 1) other pad bytes + var overflow = remaining & (md.blockLength - 1); + finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); + + // serialize message length in bits in big-endian order; since length + // is stored in bytes we multiply by 8 and add carry from next int + var next, carry; + var bits = md.fullMessageLength[0] * 8; + for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { + next = md.fullMessageLength[i + 1] * 8; + carry = (next / 0x100000000) >>> 0; + bits += carry; + finalBlock.putInt32(bits >>> 0); + bits = next >>> 0; + } + finalBlock.putInt32(bits); + + var h = new Array(_h.length); + for(var i = 0; i < _h.length; ++i) { + h[i] = _h[i].slice(0); + } + _update(h, _w, finalBlock); + var rval = forge.util.createBuffer(); + var hlen; + if(algorithm === 'SHA-512') { + hlen = h.length; + } else if(algorithm === 'SHA-384') { + hlen = h.length - 2; + } else { + hlen = h.length - 4; + } + for(var i = 0; i < hlen; ++i) { + rval.putInt32(h[i][0]); + if(i !== hlen - 1 || algorithm !== 'SHA-512/224') { + rval.putInt32(h[i][1]); + } + } + return rval; + }; + + return md; +}; + +// sha-512 padding bytes not initialized yet +var _padding = null; +var _initialized = false; + +// table of constants +var _k = null; + +// initial hash states +var _states = null; + +/** + * Initializes the constant tables. + */ +function _init() { + // create padding + _padding = String.fromCharCode(128); + _padding += forge.util.fillString(String.fromCharCode(0x00), 128); + + // create K table for SHA-512 + _k = [ + [0x428a2f98, 0xd728ae22], [0x71374491, 0x23ef65cd], + [0xb5c0fbcf, 0xec4d3b2f], [0xe9b5dba5, 0x8189dbbc], + [0x3956c25b, 0xf348b538], [0x59f111f1, 0xb605d019], + [0x923f82a4, 0xaf194f9b], [0xab1c5ed5, 0xda6d8118], + [0xd807aa98, 0xa3030242], [0x12835b01, 0x45706fbe], + [0x243185be, 0x4ee4b28c], [0x550c7dc3, 0xd5ffb4e2], + [0x72be5d74, 0xf27b896f], [0x80deb1fe, 0x3b1696b1], + [0x9bdc06a7, 0x25c71235], [0xc19bf174, 0xcf692694], + [0xe49b69c1, 0x9ef14ad2], [0xefbe4786, 0x384f25e3], + [0x0fc19dc6, 0x8b8cd5b5], [0x240ca1cc, 0x77ac9c65], + [0x2de92c6f, 0x592b0275], [0x4a7484aa, 0x6ea6e483], + [0x5cb0a9dc, 0xbd41fbd4], [0x76f988da, 0x831153b5], + [0x983e5152, 0xee66dfab], [0xa831c66d, 0x2db43210], + [0xb00327c8, 0x98fb213f], [0xbf597fc7, 0xbeef0ee4], + [0xc6e00bf3, 0x3da88fc2], [0xd5a79147, 0x930aa725], + [0x06ca6351, 0xe003826f], [0x14292967, 0x0a0e6e70], + [0x27b70a85, 0x46d22ffc], [0x2e1b2138, 0x5c26c926], + [0x4d2c6dfc, 0x5ac42aed], [0x53380d13, 0x9d95b3df], + [0x650a7354, 0x8baf63de], [0x766a0abb, 0x3c77b2a8], + [0x81c2c92e, 0x47edaee6], [0x92722c85, 0x1482353b], + [0xa2bfe8a1, 0x4cf10364], [0xa81a664b, 0xbc423001], + [0xc24b8b70, 0xd0f89791], [0xc76c51a3, 0x0654be30], + [0xd192e819, 0xd6ef5218], [0xd6990624, 0x5565a910], + [0xf40e3585, 0x5771202a], [0x106aa070, 0x32bbd1b8], + [0x19a4c116, 0xb8d2d0c8], [0x1e376c08, 0x5141ab53], + [0x2748774c, 0xdf8eeb99], [0x34b0bcb5, 0xe19b48a8], + [0x391c0cb3, 0xc5c95a63], [0x4ed8aa4a, 0xe3418acb], + [0x5b9cca4f, 0x7763e373], [0x682e6ff3, 0xd6b2b8a3], + [0x748f82ee, 0x5defb2fc], [0x78a5636f, 0x43172f60], + [0x84c87814, 0xa1f0ab72], [0x8cc70208, 0x1a6439ec], + [0x90befffa, 0x23631e28], [0xa4506ceb, 0xde82bde9], + [0xbef9a3f7, 0xb2c67915], [0xc67178f2, 0xe372532b], + [0xca273ece, 0xea26619c], [0xd186b8c7, 0x21c0c207], + [0xeada7dd6, 0xcde0eb1e], [0xf57d4f7f, 0xee6ed178], + [0x06f067aa, 0x72176fba], [0x0a637dc5, 0xa2c898a6], + [0x113f9804, 0xbef90dae], [0x1b710b35, 0x131c471b], + [0x28db77f5, 0x23047d84], [0x32caab7b, 0x40c72493], + [0x3c9ebe0a, 0x15c9bebc], [0x431d67c4, 0x9c100d4c], + [0x4cc5d4be, 0xcb3e42b6], [0x597f299c, 0xfc657e2a], + [0x5fcb6fab, 0x3ad6faec], [0x6c44198c, 0x4a475817] + ]; + + // initial hash states + _states = {}; + _states['SHA-512'] = [ + [0x6a09e667, 0xf3bcc908], + [0xbb67ae85, 0x84caa73b], + [0x3c6ef372, 0xfe94f82b], + [0xa54ff53a, 0x5f1d36f1], + [0x510e527f, 0xade682d1], + [0x9b05688c, 0x2b3e6c1f], + [0x1f83d9ab, 0xfb41bd6b], + [0x5be0cd19, 0x137e2179] + ]; + _states['SHA-384'] = [ + [0xcbbb9d5d, 0xc1059ed8], + [0x629a292a, 0x367cd507], + [0x9159015a, 0x3070dd17], + [0x152fecd8, 0xf70e5939], + [0x67332667, 0xffc00b31], + [0x8eb44a87, 0x68581511], + [0xdb0c2e0d, 0x64f98fa7], + [0x47b5481d, 0xbefa4fa4] + ]; + _states['SHA-512/256'] = [ + [0x22312194, 0xFC2BF72C], + [0x9F555FA3, 0xC84C64C2], + [0x2393B86B, 0x6F53B151], + [0x96387719, 0x5940EABD], + [0x96283EE2, 0xA88EFFE3], + [0xBE5E1E25, 0x53863992], + [0x2B0199FC, 0x2C85B8AA], + [0x0EB72DDC, 0x81C52CA2] + ]; + _states['SHA-512/224'] = [ + [0x8C3D37C8, 0x19544DA2], + [0x73E19966, 0x89DCD4D6], + [0x1DFAB7AE, 0x32FF9C82], + [0x679DD514, 0x582F9FCF], + [0x0F6D2B69, 0x7BD44DA8], + [0x77E36F73, 0x04C48942], + [0x3F9D85A8, 0x6A1D36C8], + [0x1112E6AD, 0x91D692A1] + ]; + + // now initialized + _initialized = true; +} + +/** + * Updates a SHA-512 state with the given byte buffer. + * + * @param s the SHA-512 state to update. + * @param w the array to use to store words. + * @param bytes the byte buffer to update with. + */ +function _update(s, w, bytes) { + // consume 512 bit (128 byte) chunks + var t1_hi, t1_lo; + var t2_hi, t2_lo; + var s0_hi, s0_lo; + var s1_hi, s1_lo; + var ch_hi, ch_lo; + var maj_hi, maj_lo; + var a_hi, a_lo; + var b_hi, b_lo; + var c_hi, c_lo; + var d_hi, d_lo; + var e_hi, e_lo; + var f_hi, f_lo; + var g_hi, g_lo; + var h_hi, h_lo; + var i, hi, lo, w2, w7, w15, w16; + var len = bytes.length(); + while(len >= 128) { + // the w array will be populated with sixteen 64-bit big-endian words + // and then extended into 64 64-bit words according to SHA-512 + for(i = 0; i < 16; ++i) { + w[i][0] = bytes.getInt32() >>> 0; + w[i][1] = bytes.getInt32() >>> 0; + } + for(; i < 80; ++i) { + // for word 2 words ago: ROTR 19(x) ^ ROTR 61(x) ^ SHR 6(x) + w2 = w[i - 2]; + hi = w2[0]; + lo = w2[1]; + + // high bits + t1_hi = ( + ((hi >>> 19) | (lo << 13)) ^ // ROTR 19 + ((lo >>> 29) | (hi << 3)) ^ // ROTR 61/(swap + ROTR 29) + (hi >>> 6)) >>> 0; // SHR 6 + // low bits + t1_lo = ( + ((hi << 13) | (lo >>> 19)) ^ // ROTR 19 + ((lo << 3) | (hi >>> 29)) ^ // ROTR 61/(swap + ROTR 29) + ((hi << 26) | (lo >>> 6))) >>> 0; // SHR 6 + + // for word 15 words ago: ROTR 1(x) ^ ROTR 8(x) ^ SHR 7(x) + w15 = w[i - 15]; + hi = w15[0]; + lo = w15[1]; + + // high bits + t2_hi = ( + ((hi >>> 1) | (lo << 31)) ^ // ROTR 1 + ((hi >>> 8) | (lo << 24)) ^ // ROTR 8 + (hi >>> 7)) >>> 0; // SHR 7 + // low bits + t2_lo = ( + ((hi << 31) | (lo >>> 1)) ^ // ROTR 1 + ((hi << 24) | (lo >>> 8)) ^ // ROTR 8 + ((hi << 25) | (lo >>> 7))) >>> 0; // SHR 7 + + // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^64 (carry lo overflow) + w7 = w[i - 7]; + w16 = w[i - 16]; + lo = (t1_lo + w7[1] + t2_lo + w16[1]); + w[i][0] = (t1_hi + w7[0] + t2_hi + w16[0] + + ((lo / 0x100000000) >>> 0)) >>> 0; + w[i][1] = lo >>> 0; + } + + // initialize hash value for this chunk + a_hi = s[0][0]; + a_lo = s[0][1]; + b_hi = s[1][0]; + b_lo = s[1][1]; + c_hi = s[2][0]; + c_lo = s[2][1]; + d_hi = s[3][0]; + d_lo = s[3][1]; + e_hi = s[4][0]; + e_lo = s[4][1]; + f_hi = s[5][0]; + f_lo = s[5][1]; + g_hi = s[6][0]; + g_lo = s[6][1]; + h_hi = s[7][0]; + h_lo = s[7][1]; + + // round function + for(i = 0; i < 80; ++i) { + // Sum1(e) = ROTR 14(e) ^ ROTR 18(e) ^ ROTR 41(e) + s1_hi = ( + ((e_hi >>> 14) | (e_lo << 18)) ^ // ROTR 14 + ((e_hi >>> 18) | (e_lo << 14)) ^ // ROTR 18 + ((e_lo >>> 9) | (e_hi << 23))) >>> 0; // ROTR 41/(swap + ROTR 9) + s1_lo = ( + ((e_hi << 18) | (e_lo >>> 14)) ^ // ROTR 14 + ((e_hi << 14) | (e_lo >>> 18)) ^ // ROTR 18 + ((e_lo << 23) | (e_hi >>> 9))) >>> 0; // ROTR 41/(swap + ROTR 9) + + // Ch(e, f, g) (optimized the same way as SHA-1) + ch_hi = (g_hi ^ (e_hi & (f_hi ^ g_hi))) >>> 0; + ch_lo = (g_lo ^ (e_lo & (f_lo ^ g_lo))) >>> 0; + + // Sum0(a) = ROTR 28(a) ^ ROTR 34(a) ^ ROTR 39(a) + s0_hi = ( + ((a_hi >>> 28) | (a_lo << 4)) ^ // ROTR 28 + ((a_lo >>> 2) | (a_hi << 30)) ^ // ROTR 34/(swap + ROTR 2) + ((a_lo >>> 7) | (a_hi << 25))) >>> 0; // ROTR 39/(swap + ROTR 7) + s0_lo = ( + ((a_hi << 4) | (a_lo >>> 28)) ^ // ROTR 28 + ((a_lo << 30) | (a_hi >>> 2)) ^ // ROTR 34/(swap + ROTR 2) + ((a_lo << 25) | (a_hi >>> 7))) >>> 0; // ROTR 39/(swap + ROTR 7) + + // Maj(a, b, c) (optimized the same way as SHA-1) + maj_hi = ((a_hi & b_hi) | (c_hi & (a_hi ^ b_hi))) >>> 0; + maj_lo = ((a_lo & b_lo) | (c_lo & (a_lo ^ b_lo))) >>> 0; + + // main algorithm + // t1 = (h + s1 + ch + _k[i] + _w[i]) modulo 2^64 (carry lo overflow) + lo = (h_lo + s1_lo + ch_lo + _k[i][1] + w[i][1]); + t1_hi = (h_hi + s1_hi + ch_hi + _k[i][0] + w[i][0] + + ((lo / 0x100000000) >>> 0)) >>> 0; + t1_lo = lo >>> 0; + + // t2 = s0 + maj modulo 2^64 (carry lo overflow) + lo = s0_lo + maj_lo; + t2_hi = (s0_hi + maj_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + t2_lo = lo >>> 0; + + h_hi = g_hi; + h_lo = g_lo; + + g_hi = f_hi; + g_lo = f_lo; + + f_hi = e_hi; + f_lo = e_lo; + + // e = (d + t1) modulo 2^64 (carry lo overflow) + lo = d_lo + t1_lo; + e_hi = (d_hi + t1_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + e_lo = lo >>> 0; + + d_hi = c_hi; + d_lo = c_lo; + + c_hi = b_hi; + c_lo = b_lo; + + b_hi = a_hi; + b_lo = a_lo; + + // a = (t1 + t2) modulo 2^64 (carry lo overflow) + lo = t1_lo + t2_lo; + a_hi = (t1_hi + t2_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + a_lo = lo >>> 0; + } + + // update hash state (additional modulo 2^64) + lo = s[0][1] + a_lo; + s[0][0] = (s[0][0] + a_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[0][1] = lo >>> 0; + + lo = s[1][1] + b_lo; + s[1][0] = (s[1][0] + b_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[1][1] = lo >>> 0; + + lo = s[2][1] + c_lo; + s[2][0] = (s[2][0] + c_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[2][1] = lo >>> 0; + + lo = s[3][1] + d_lo; + s[3][0] = (s[3][0] + d_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[3][1] = lo >>> 0; + + lo = s[4][1] + e_lo; + s[4][0] = (s[4][0] + e_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[4][1] = lo >>> 0; + + lo = s[5][1] + f_lo; + s[5][0] = (s[5][0] + f_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[5][1] = lo >>> 0; + + lo = s[6][1] + g_lo; + s[6][0] = (s[6][0] + g_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[6][1] = lo >>> 0; + + lo = s[7][1] + h_lo; + s[7][0] = (s[7][0] + h_hi + ((lo / 0x100000000) >>> 0)) >>> 0; + s[7][1] = lo >>> 0; + + len -= 128; + } +} + + +/***/ }), + +/***/ 7173: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Functions to output keys in SSH-friendly formats. + * + * This is part of the Forge project which may be used under the terms of + * either the BSD License or the GNU General Public License (GPL) Version 2. + * + * See: https://github.com/digitalbazaar/forge/blob/cbebca3780658703d925b61b2caffb1d263a6c1d/LICENSE + * + * @author https://github.com/shellac + */ +var forge = __webpack_require__(3832); +__webpack_require__(8925); +__webpack_require__(6607); +__webpack_require__(5063); +__webpack_require__(137); +__webpack_require__(7116); + +var ssh = module.exports = forge.ssh = forge.ssh || {}; + +/** + * Encodes (and optionally encrypts) a private RSA key as a Putty PPK file. + * + * @param privateKey the key. + * @param passphrase a passphrase to protect the key (falsy for no encryption). + * @param comment a comment to include in the key file. + * + * @return the PPK file as a string. + */ +ssh.privateKeyToPutty = function(privateKey, passphrase, comment) { + comment = comment || ''; + passphrase = passphrase || ''; + var algorithm = 'ssh-rsa'; + var encryptionAlgorithm = (passphrase === '') ? 'none' : 'aes256-cbc'; + + var ppk = 'PuTTY-User-Key-File-2: ' + algorithm + '\r\n'; + ppk += 'Encryption: ' + encryptionAlgorithm + '\r\n'; + ppk += 'Comment: ' + comment + '\r\n'; + + // public key into buffer for ppk + var pubbuffer = forge.util.createBuffer(); + _addStringToBuffer(pubbuffer, algorithm); + _addBigIntegerToBuffer(pubbuffer, privateKey.e); + _addBigIntegerToBuffer(pubbuffer, privateKey.n); + + // write public key + var pub = forge.util.encode64(pubbuffer.bytes(), 64); + var length = Math.floor(pub.length / 66) + 1; // 66 = 64 + \r\n + ppk += 'Public-Lines: ' + length + '\r\n'; + ppk += pub; + + // private key into a buffer + var privbuffer = forge.util.createBuffer(); + _addBigIntegerToBuffer(privbuffer, privateKey.d); + _addBigIntegerToBuffer(privbuffer, privateKey.p); + _addBigIntegerToBuffer(privbuffer, privateKey.q); + _addBigIntegerToBuffer(privbuffer, privateKey.qInv); + + // optionally encrypt the private key + var priv; + if(!passphrase) { + // use the unencrypted buffer + priv = forge.util.encode64(privbuffer.bytes(), 64); + } else { + // encrypt RSA key using passphrase + var encLen = privbuffer.length() + 16 - 1; + encLen -= encLen % 16; + + // pad private key with sha1-d data -- needs to be a multiple of 16 + var padding = _sha1(privbuffer.bytes()); + + padding.truncate(padding.length() - encLen + privbuffer.length()); + privbuffer.putBuffer(padding); + + var aeskey = forge.util.createBuffer(); + aeskey.putBuffer(_sha1('\x00\x00\x00\x00', passphrase)); + aeskey.putBuffer(_sha1('\x00\x00\x00\x01', passphrase)); + + // encrypt some bytes using CBC mode + // key is 40 bytes, so truncate *by* 8 bytes + var cipher = forge.aes.createEncryptionCipher(aeskey.truncate(8), 'CBC'); + cipher.start(forge.util.createBuffer().fillWithByte(0, 16)); + cipher.update(privbuffer.copy()); + cipher.finish(); + var encrypted = cipher.output; + + // Note: this appears to differ from Putty -- is forge wrong, or putty? + // due to padding we finish as an exact multiple of 16 + encrypted.truncate(16); // all padding + + priv = forge.util.encode64(encrypted.bytes(), 64); + } + + // output private key + length = Math.floor(priv.length / 66) + 1; // 64 + \r\n + ppk += '\r\nPrivate-Lines: ' + length + '\r\n'; + ppk += priv; + + // MAC + var mackey = _sha1('putty-private-key-file-mac-key', passphrase); + + var macbuffer = forge.util.createBuffer(); + _addStringToBuffer(macbuffer, algorithm); + _addStringToBuffer(macbuffer, encryptionAlgorithm); + _addStringToBuffer(macbuffer, comment); + macbuffer.putInt32(pubbuffer.length()); + macbuffer.putBuffer(pubbuffer); + macbuffer.putInt32(privbuffer.length()); + macbuffer.putBuffer(privbuffer); + + var hmac = forge.hmac.create(); + hmac.start('sha1', mackey); + hmac.update(macbuffer.bytes()); + + ppk += '\r\nPrivate-MAC: ' + hmac.digest().toHex() + '\r\n'; + + return ppk; +}; + +/** + * Encodes a public RSA key as an OpenSSH file. + * + * @param key the key. + * @param comment a comment. + * + * @return the public key in OpenSSH format. + */ +ssh.publicKeyToOpenSSH = function(key, comment) { + var type = 'ssh-rsa'; + comment = comment || ''; + + var buffer = forge.util.createBuffer(); + _addStringToBuffer(buffer, type); + _addBigIntegerToBuffer(buffer, key.e); + _addBigIntegerToBuffer(buffer, key.n); + + return type + ' ' + forge.util.encode64(buffer.bytes()) + ' ' + comment; +}; + +/** + * Encodes a private RSA key as an OpenSSH file. + * + * @param key the key. + * @param passphrase a passphrase to protect the key (falsy for no encryption). + * + * @return the public key in OpenSSH format. + */ +ssh.privateKeyToOpenSSH = function(privateKey, passphrase) { + if(!passphrase) { + return forge.pki.privateKeyToPem(privateKey); + } + // OpenSSH private key is just a legacy format, it seems + return forge.pki.encryptRsaPrivateKey(privateKey, passphrase, + {legacy: true, algorithm: 'aes128'}); +}; + +/** + * Gets the SSH fingerprint for the given public key. + * + * @param options the options to use. + * [md] the message digest object to use (defaults to forge.md.md5). + * [encoding] an alternative output encoding, such as 'hex' + * (defaults to none, outputs a byte buffer). + * [delimiter] the delimiter to use between bytes for 'hex' encoded + * output, eg: ':' (defaults to none). + * + * @return the fingerprint as a byte buffer or other encoding based on options. + */ +ssh.getPublicKeyFingerprint = function(key, options) { + options = options || {}; + var md = options.md || forge.md.md5.create(); + + var type = 'ssh-rsa'; + var buffer = forge.util.createBuffer(); + _addStringToBuffer(buffer, type); + _addBigIntegerToBuffer(buffer, key.e); + _addBigIntegerToBuffer(buffer, key.n); + + // hash public key bytes + md.start(); + md.update(buffer.getBytes()); + var digest = md.digest(); + if(options.encoding === 'hex') { + var hex = digest.toHex(); + if(options.delimiter) { + return hex.match(/.{2}/g).join(options.delimiter); + } + return hex; + } else if(options.encoding === 'binary') { + return digest.getBytes(); + } else if(options.encoding) { + throw new Error('Unknown encoding "' + options.encoding + '".'); + } + return digest; +}; + +/** + * Adds len(val) then val to a buffer. + * + * @param buffer the buffer to add to. + * @param val a big integer. + */ +function _addBigIntegerToBuffer(buffer, val) { + var hexVal = val.toString(16); + // ensure 2s complement +ve + if(hexVal[0] >= '8') { + hexVal = '00' + hexVal; + } + var bytes = forge.util.hexToBytes(hexVal); + buffer.putInt32(bytes.length); + buffer.putBytes(bytes); +} + +/** + * Adds len(val) then val to a buffer. + * + * @param buffer the buffer to add to. + * @param val a string. + */ +function _addStringToBuffer(buffer, val) { + buffer.putInt32(val.length); + buffer.putString(val); +} + +/** + * Hashes the arguments into one value using SHA-1. + * + * @return the sha1 hash of the provided arguments. + */ +function _sha1() { + var sha = forge.md.sha1.create(); + var num = arguments.length; + for (var i = 0; i < num; ++i) { + sha.update(arguments[i]); + } + return sha.digest(); +} + + +/***/ }), + +/***/ 4311: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * A Javascript implementation of Transport Layer Security (TLS). + * + * @author Dave Longley + * + * Copyright (c) 2009-2014 Digital Bazaar, Inc. + * + * The TLS Handshake Protocol involves the following steps: + * + * - Exchange hello messages to agree on algorithms, exchange random values, + * and check for session resumption. + * + * - Exchange the necessary cryptographic parameters to allow the client and + * server to agree on a premaster secret. + * + * - Exchange certificates and cryptographic information to allow the client + * and server to authenticate themselves. + * + * - Generate a master secret from the premaster secret and exchanged random + * values. + * + * - Provide security parameters to the record layer. + * + * - Allow the client and server to verify that their peer has calculated the + * same security parameters and that the handshake occurred without tampering + * by an attacker. + * + * Up to 4 different messages may be sent during a key exchange. The server + * certificate, the server key exchange, the client certificate, and the + * client key exchange. + * + * A typical handshake (from the client's perspective). + * + * 1. Client sends ClientHello. + * 2. Client receives ServerHello. + * 3. Client receives optional Certificate. + * 4. Client receives optional ServerKeyExchange. + * 5. Client receives ServerHelloDone. + * 6. Client sends optional Certificate. + * 7. Client sends ClientKeyExchange. + * 8. Client sends optional CertificateVerify. + * 9. Client sends ChangeCipherSpec. + * 10. Client sends Finished. + * 11. Client receives ChangeCipherSpec. + * 12. Client receives Finished. + * 13. Client sends/receives application data. + * + * To reuse an existing session: + * + * 1. Client sends ClientHello with session ID for reuse. + * 2. Client receives ServerHello with same session ID if reusing. + * 3. Client receives ChangeCipherSpec message if reusing. + * 4. Client receives Finished. + * 5. Client sends ChangeCipherSpec. + * 6. Client sends Finished. + * + * Note: Client ignores HelloRequest if in the middle of a handshake. + * + * Record Layer: + * + * The record layer fragments information blocks into TLSPlaintext records + * carrying data in chunks of 2^14 bytes or less. Client message boundaries are + * not preserved in the record layer (i.e., multiple client messages of the + * same ContentType MAY be coalesced into a single TLSPlaintext record, or a + * single message MAY be fragmented across several records). + * + * struct { + * uint8 major; + * uint8 minor; + * } ProtocolVersion; + * + * struct { + * ContentType type; + * ProtocolVersion version; + * uint16 length; + * opaque fragment[TLSPlaintext.length]; + * } TLSPlaintext; + * + * type: + * The higher-level protocol used to process the enclosed fragment. + * + * version: + * The version of the protocol being employed. TLS Version 1.2 uses version + * {3, 3}. TLS Version 1.0 uses version {3, 1}. Note that a client that + * supports multiple versions of TLS may not know what version will be + * employed before it receives the ServerHello. + * + * length: + * The length (in bytes) of the following TLSPlaintext.fragment. The length + * MUST NOT exceed 2^14 = 16384 bytes. + * + * fragment: + * The application data. This data is transparent and treated as an + * independent block to be dealt with by the higher-level protocol specified + * by the type field. + * + * Implementations MUST NOT send zero-length fragments of Handshake, Alert, or + * ChangeCipherSpec content types. Zero-length fragments of Application data + * MAY be sent as they are potentially useful as a traffic analysis + * countermeasure. + * + * Note: Data of different TLS record layer content types MAY be interleaved. + * Application data is generally of lower precedence for transmission than + * other content types. However, records MUST be delivered to the network in + * the same order as they are protected by the record layer. Recipients MUST + * receive and process interleaved application layer traffic during handshakes + * subsequent to the first one on a connection. + * + * struct { + * ContentType type; // same as TLSPlaintext.type + * ProtocolVersion version;// same as TLSPlaintext.version + * uint16 length; + * opaque fragment[TLSCompressed.length]; + * } TLSCompressed; + * + * length: + * The length (in bytes) of the following TLSCompressed.fragment. + * The length MUST NOT exceed 2^14 + 1024. + * + * fragment: + * The compressed form of TLSPlaintext.fragment. + * + * Note: A CompressionMethod.null operation is an identity operation; no fields + * are altered. In this implementation, since no compression is supported, + * uncompressed records are always the same as compressed records. + * + * Encryption Information: + * + * The encryption and MAC functions translate a TLSCompressed structure into a + * TLSCiphertext. The decryption functions reverse the process. The MAC of the + * record also includes a sequence number so that missing, extra, or repeated + * messages are detectable. + * + * struct { + * ContentType type; + * ProtocolVersion version; + * uint16 length; + * select (SecurityParameters.cipher_type) { + * case stream: GenericStreamCipher; + * case block: GenericBlockCipher; + * case aead: GenericAEADCipher; + * } fragment; + * } TLSCiphertext; + * + * type: + * The type field is identical to TLSCompressed.type. + * + * version: + * The version field is identical to TLSCompressed.version. + * + * length: + * The length (in bytes) of the following TLSCiphertext.fragment. + * The length MUST NOT exceed 2^14 + 2048. + * + * fragment: + * The encrypted form of TLSCompressed.fragment, with the MAC. + * + * Note: Only CBC Block Ciphers are supported by this implementation. + * + * The TLSCompressed.fragment structures are converted to/from block + * TLSCiphertext.fragment structures. + * + * struct { + * opaque IV[SecurityParameters.record_iv_length]; + * block-ciphered struct { + * opaque content[TLSCompressed.length]; + * opaque MAC[SecurityParameters.mac_length]; + * uint8 padding[GenericBlockCipher.padding_length]; + * uint8 padding_length; + * }; + * } GenericBlockCipher; + * + * The MAC is generated as described in Section 6.2.3.1. + * + * IV: + * The Initialization Vector (IV) SHOULD be chosen at random, and MUST be + * unpredictable. Note that in versions of TLS prior to 1.1, there was no + * IV field, and the last ciphertext block of the previous record (the "CBC + * residue") was used as the IV. This was changed to prevent the attacks + * described in [CBCATT]. For block ciphers, the IV length is of length + * SecurityParameters.record_iv_length, which is equal to the + * SecurityParameters.block_size. + * + * padding: + * Padding that is added to force the length of the plaintext to be an + * integral multiple of the block cipher's block length. The padding MAY be + * any length up to 255 bytes, as long as it results in the + * TLSCiphertext.length being an integral multiple of the block length. + * Lengths longer than necessary might be desirable to frustrate attacks on + * a protocol that are based on analysis of the lengths of exchanged + * messages. Each uint8 in the padding data vector MUST be filled with the + * padding length value. The receiver MUST check this padding and MUST use + * the bad_record_mac alert to indicate padding errors. + * + * padding_length: + * The padding length MUST be such that the total size of the + * GenericBlockCipher structure is a multiple of the cipher's block length. + * Legal values range from zero to 255, inclusive. This length specifies the + * length of the padding field exclusive of the padding_length field itself. + * + * The encrypted data length (TLSCiphertext.length) is one more than the sum of + * SecurityParameters.block_length, TLSCompressed.length, + * SecurityParameters.mac_length, and padding_length. + * + * Example: If the block length is 8 bytes, the content length + * (TLSCompressed.length) is 61 bytes, and the MAC length is 20 bytes, then the + * length before padding is 82 bytes (this does not include the IV. Thus, the + * padding length modulo 8 must be equal to 6 in order to make the total length + * an even multiple of 8 bytes (the block length). The padding length can be + * 6, 14, 22, and so on, through 254. If the padding length were the minimum + * necessary, 6, the padding would be 6 bytes, each containing the value 6. + * Thus, the last 8 octets of the GenericBlockCipher before block encryption + * would be xx 06 06 06 06 06 06 06, where xx is the last octet of the MAC. + * + * Note: With block ciphers in CBC mode (Cipher Block Chaining), it is critical + * that the entire plaintext of the record be known before any ciphertext is + * transmitted. Otherwise, it is possible for the attacker to mount the attack + * described in [CBCATT]. + * + * Implementation note: Canvel et al. [CBCTIME] have demonstrated a timing + * attack on CBC padding based on the time required to compute the MAC. In + * order to defend against this attack, implementations MUST ensure that + * record processing time is essentially the same whether or not the padding + * is correct. In general, the best way to do this is to compute the MAC even + * if the padding is incorrect, and only then reject the packet. For instance, + * if the pad appears to be incorrect, the implementation might assume a + * zero-length pad and then compute the MAC. This leaves a small timing + * channel, since MAC performance depends, to some extent, on the size of the + * data fragment, but it is not believed to be large enough to be exploitable, + * due to the large block size of existing MACs and the small size of the + * timing signal. + */ +var forge = __webpack_require__(3832); +__webpack_require__(3068); +__webpack_require__(6607); +__webpack_require__(5063); +__webpack_require__(6953); +__webpack_require__(4742); +__webpack_require__(9563); +__webpack_require__(137); +__webpack_require__(7116); + +/** + * Generates pseudo random bytes by mixing the result of two hash functions, + * MD5 and SHA-1. + * + * prf_TLS1(secret, label, seed) = + * P_MD5(S1, label + seed) XOR P_SHA-1(S2, label + seed); + * + * Each P_hash function functions as follows: + * + * P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + + * HMAC_hash(secret, A(2) + seed) + + * HMAC_hash(secret, A(3) + seed) + ... + * A() is defined as: + * A(0) = seed + * A(i) = HMAC_hash(secret, A(i-1)) + * + * The '+' operator denotes concatenation. + * + * As many iterations A(N) as are needed are performed to generate enough + * pseudo random byte output. If an iteration creates more data than is + * necessary, then it is truncated. + * + * Therefore: + * A(1) = HMAC_hash(secret, A(0)) + * = HMAC_hash(secret, seed) + * A(2) = HMAC_hash(secret, A(1)) + * = HMAC_hash(secret, HMAC_hash(secret, seed)) + * + * Therefore: + * P_hash(secret, seed) = + * HMAC_hash(secret, HMAC_hash(secret, A(0)) + seed) + + * HMAC_hash(secret, HMAC_hash(secret, A(1)) + seed) + + * ... + * + * Therefore: + * P_hash(secret, seed) = + * HMAC_hash(secret, HMAC_hash(secret, seed) + seed) + + * HMAC_hash(secret, HMAC_hash(secret, HMAC_hash(secret, seed)) + seed) + + * ... + * + * @param secret the secret to use. + * @param label the label to use. + * @param seed the seed value to use. + * @param length the number of bytes to generate. + * + * @return the pseudo random bytes in a byte buffer. + */ +var prf_TLS1 = function(secret, label, seed, length) { + var rval = forge.util.createBuffer(); + + /* For TLS 1.0, the secret is split in half, into two secrets of equal + length. If the secret has an odd length then the last byte of the first + half will be the same as the first byte of the second. The length of the + two secrets is half of the secret rounded up. */ + var idx = (secret.length >> 1); + var slen = idx + (secret.length & 1); + var s1 = secret.substr(0, slen); + var s2 = secret.substr(idx, slen); + var ai = forge.util.createBuffer(); + var hmac = forge.hmac.create(); + seed = label + seed; + + // determine the number of iterations that must be performed to generate + // enough output bytes, md5 creates 16 byte hashes, sha1 creates 20 + var md5itr = Math.ceil(length / 16); + var sha1itr = Math.ceil(length / 20); + + // do md5 iterations + hmac.start('MD5', s1); + var md5bytes = forge.util.createBuffer(); + ai.putBytes(seed); + for(var i = 0; i < md5itr; ++i) { + // HMAC_hash(secret, A(i-1)) + hmac.start(null, null); + hmac.update(ai.getBytes()); + ai.putBuffer(hmac.digest()); + + // HMAC_hash(secret, A(i) + seed) + hmac.start(null, null); + hmac.update(ai.bytes() + seed); + md5bytes.putBuffer(hmac.digest()); + } + + // do sha1 iterations + hmac.start('SHA1', s2); + var sha1bytes = forge.util.createBuffer(); + ai.clear(); + ai.putBytes(seed); + for(var i = 0; i < sha1itr; ++i) { + // HMAC_hash(secret, A(i-1)) + hmac.start(null, null); + hmac.update(ai.getBytes()); + ai.putBuffer(hmac.digest()); + + // HMAC_hash(secret, A(i) + seed) + hmac.start(null, null); + hmac.update(ai.bytes() + seed); + sha1bytes.putBuffer(hmac.digest()); + } + + // XOR the md5 bytes with the sha1 bytes + rval.putBytes(forge.util.xorBytes( + md5bytes.getBytes(), sha1bytes.getBytes(), length)); + + return rval; +}; + +/** + * Generates pseudo random bytes using a SHA256 algorithm. For TLS 1.2. + * + * @param secret the secret to use. + * @param label the label to use. + * @param seed the seed value to use. + * @param length the number of bytes to generate. + * + * @return the pseudo random bytes in a byte buffer. + */ +var prf_sha256 = function(secret, label, seed, length) { + // FIXME: implement me for TLS 1.2 +}; + +/** + * Gets a MAC for a record using the SHA-1 hash algorithm. + * + * @param key the mac key. + * @param state the sequence number (array of two 32-bit integers). + * @param record the record. + * + * @return the sha-1 hash (20 bytes) for the given record. + */ +var hmac_sha1 = function(key, seqNum, record) { + /* MAC is computed like so: + HMAC_hash( + key, seqNum + + TLSCompressed.type + + TLSCompressed.version + + TLSCompressed.length + + TLSCompressed.fragment) + */ + var hmac = forge.hmac.create(); + hmac.start('SHA1', key); + var b = forge.util.createBuffer(); + b.putInt32(seqNum[0]); + b.putInt32(seqNum[1]); + b.putByte(record.type); + b.putByte(record.version.major); + b.putByte(record.version.minor); + b.putInt16(record.length); + b.putBytes(record.fragment.bytes()); + hmac.update(b.getBytes()); + return hmac.digest().getBytes(); +}; + +/** + * Compresses the TLSPlaintext record into a TLSCompressed record using the + * deflate algorithm. + * + * @param c the TLS connection. + * @param record the TLSPlaintext record to compress. + * @param s the ConnectionState to use. + * + * @return true on success, false on failure. + */ +var deflate = function(c, record, s) { + var rval = false; + + try { + var bytes = c.deflate(record.fragment.getBytes()); + record.fragment = forge.util.createBuffer(bytes); + record.length = bytes.length; + rval = true; + } catch(ex) { + // deflate error, fail out + } + + return rval; +}; + +/** + * Decompresses the TLSCompressed record into a TLSPlaintext record using the + * deflate algorithm. + * + * @param c the TLS connection. + * @param record the TLSCompressed record to decompress. + * @param s the ConnectionState to use. + * + * @return true on success, false on failure. + */ +var inflate = function(c, record, s) { + var rval = false; + + try { + var bytes = c.inflate(record.fragment.getBytes()); + record.fragment = forge.util.createBuffer(bytes); + record.length = bytes.length; + rval = true; + } catch(ex) { + // inflate error, fail out + } + + return rval; +}; + +/** + * Reads a TLS variable-length vector from a byte buffer. + * + * Variable-length vectors are defined by specifying a subrange of legal + * lengths, inclusively, using the notation . When these are + * encoded, the actual length precedes the vector's contents in the byte + * stream. The length will be in the form of a number consuming as many bytes + * as required to hold the vector's specified maximum (ceiling) length. A + * variable-length vector with an actual length field of zero is referred to + * as an empty vector. + * + * @param b the byte buffer. + * @param lenBytes the number of bytes required to store the length. + * + * @return the resulting byte buffer. + */ +var readVector = function(b, lenBytes) { + var len = 0; + switch(lenBytes) { + case 1: + len = b.getByte(); + break; + case 2: + len = b.getInt16(); + break; + case 3: + len = b.getInt24(); + break; + case 4: + len = b.getInt32(); + break; + } + + // read vector bytes into a new buffer + return forge.util.createBuffer(b.getBytes(len)); +}; + +/** + * Writes a TLS variable-length vector to a byte buffer. + * + * @param b the byte buffer. + * @param lenBytes the number of bytes required to store the length. + * @param v the byte buffer vector. + */ +var writeVector = function(b, lenBytes, v) { + // encode length at the start of the vector, where the number of bytes for + // the length is the maximum number of bytes it would take to encode the + // vector's ceiling + b.putInt(v.length(), lenBytes << 3); + b.putBuffer(v); +}; + +/** + * The tls implementation. + */ +var tls = {}; + +/** + * Version: TLS 1.2 = 3.3, TLS 1.1 = 3.2, TLS 1.0 = 3.1. Both TLS 1.1 and + * TLS 1.2 were still too new (ie: openSSL didn't implement them) at the time + * of this implementation so TLS 1.0 was implemented instead. + */ +tls.Versions = { + TLS_1_0: {major: 3, minor: 1}, + TLS_1_1: {major: 3, minor: 2}, + TLS_1_2: {major: 3, minor: 3} +}; +tls.SupportedVersions = [ + tls.Versions.TLS_1_1, + tls.Versions.TLS_1_0 +]; +tls.Version = tls.SupportedVersions[0]; + +/** + * Maximum fragment size. True maximum is 16384, but we fragment before that + * to allow for unusual small increases during compression. + */ +tls.MaxFragment = 16384 - 1024; + +/** + * Whether this entity is considered the "client" or "server". + * enum { server, client } ConnectionEnd; + */ +tls.ConnectionEnd = { + server: 0, + client: 1 +}; + +/** + * Pseudo-random function algorithm used to generate keys from the master + * secret. + * enum { tls_prf_sha256 } PRFAlgorithm; + */ +tls.PRFAlgorithm = { + tls_prf_sha256: 0 +}; + +/** + * Bulk encryption algorithms. + * enum { null, rc4, des3, aes } BulkCipherAlgorithm; + */ +tls.BulkCipherAlgorithm = { + none: null, + rc4: 0, + des3: 1, + aes: 2 +}; + +/** + * Cipher types. + * enum { stream, block, aead } CipherType; + */ +tls.CipherType = { + stream: 0, + block: 1, + aead: 2 +}; + +/** + * MAC (Message Authentication Code) algorithms. + * enum { null, hmac_md5, hmac_sha1, hmac_sha256, + * hmac_sha384, hmac_sha512} MACAlgorithm; + */ +tls.MACAlgorithm = { + none: null, + hmac_md5: 0, + hmac_sha1: 1, + hmac_sha256: 2, + hmac_sha384: 3, + hmac_sha512: 4 +}; + +/** + * Compression algorithms. + * enum { null(0), deflate(1), (255) } CompressionMethod; + */ +tls.CompressionMethod = { + none: 0, + deflate: 1 +}; + +/** + * TLS record content types. + * enum { + * change_cipher_spec(20), alert(21), handshake(22), + * application_data(23), (255) + * } ContentType; + */ +tls.ContentType = { + change_cipher_spec: 20, + alert: 21, + handshake: 22, + application_data: 23, + heartbeat: 24 +}; + +/** + * TLS handshake types. + * enum { + * hello_request(0), client_hello(1), server_hello(2), + * certificate(11), server_key_exchange (12), + * certificate_request(13), server_hello_done(14), + * certificate_verify(15), client_key_exchange(16), + * finished(20), (255) + * } HandshakeType; + */ +tls.HandshakeType = { + hello_request: 0, + client_hello: 1, + server_hello: 2, + certificate: 11, + server_key_exchange: 12, + certificate_request: 13, + server_hello_done: 14, + certificate_verify: 15, + client_key_exchange: 16, + finished: 20 +}; + +/** + * TLS Alert Protocol. + * + * enum { warning(1), fatal(2), (255) } AlertLevel; + * + * enum { + * close_notify(0), + * unexpected_message(10), + * bad_record_mac(20), + * decryption_failed(21), + * record_overflow(22), + * decompression_failure(30), + * handshake_failure(40), + * bad_certificate(42), + * unsupported_certificate(43), + * certificate_revoked(44), + * certificate_expired(45), + * certificate_unknown(46), + * illegal_parameter(47), + * unknown_ca(48), + * access_denied(49), + * decode_error(50), + * decrypt_error(51), + * export_restriction(60), + * protocol_version(70), + * insufficient_security(71), + * internal_error(80), + * user_canceled(90), + * no_renegotiation(100), + * (255) + * } AlertDescription; + * + * struct { + * AlertLevel level; + * AlertDescription description; + * } Alert; + */ +tls.Alert = {}; +tls.Alert.Level = { + warning: 1, + fatal: 2 +}; +tls.Alert.Description = { + close_notify: 0, + unexpected_message: 10, + bad_record_mac: 20, + decryption_failed: 21, + record_overflow: 22, + decompression_failure: 30, + handshake_failure: 40, + bad_certificate: 42, + unsupported_certificate: 43, + certificate_revoked: 44, + certificate_expired: 45, + certificate_unknown: 46, + illegal_parameter: 47, + unknown_ca: 48, + access_denied: 49, + decode_error: 50, + decrypt_error: 51, + export_restriction: 60, + protocol_version: 70, + insufficient_security: 71, + internal_error: 80, + user_canceled: 90, + no_renegotiation: 100 +}; + +/** + * TLS Heartbeat Message types. + * enum { + * heartbeat_request(1), + * heartbeat_response(2), + * (255) + * } HeartbeatMessageType; + */ +tls.HeartbeatMessageType = { + heartbeat_request: 1, + heartbeat_response: 2 +}; + +/** + * Supported cipher suites. + */ +tls.CipherSuites = {}; + +/** + * Gets a supported cipher suite from its 2 byte ID. + * + * @param twoBytes two bytes in a string. + * + * @return the matching supported cipher suite or null. + */ +tls.getCipherSuite = function(twoBytes) { + var rval = null; + for(var key in tls.CipherSuites) { + var cs = tls.CipherSuites[key]; + if(cs.id[0] === twoBytes.charCodeAt(0) && + cs.id[1] === twoBytes.charCodeAt(1)) { + rval = cs; + break; + } + } + return rval; +}; + +/** + * Called when an unexpected record is encountered. + * + * @param c the connection. + * @param record the record. + */ +tls.handleUnexpected = function(c, record) { + // if connection is client and closed, ignore unexpected messages + var ignore = (!c.open && c.entity === tls.ConnectionEnd.client); + if(!ignore) { + c.error(c, { + message: 'Unexpected message. Received TLS record out of order.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.unexpected_message + } + }); + } +}; + +/** + * Called when a client receives a HelloRequest record. + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleHelloRequest = function(c, record, length) { + // ignore renegotiation requests from the server during a handshake, but + // if handshaking, send a warning alert that renegotation is denied + if(!c.handshaking && c.handshakes > 0) { + // send alert warning + tls.queue(c, tls.createAlert(c, { + level: tls.Alert.Level.warning, + description: tls.Alert.Description.no_renegotiation + })); + tls.flush(c); + } + + // continue + c.process(); +}; + +/** + * Parses a hello message from a ClientHello or ServerHello record. + * + * @param record the record to parse. + * + * @return the parsed message. + */ +tls.parseHelloMessage = function(c, record, length) { + var msg = null; + + var client = (c.entity === tls.ConnectionEnd.client); + + // minimum of 38 bytes in message + if(length < 38) { + c.error(c, { + message: client ? + 'Invalid ServerHello message. Message too short.' : + 'Invalid ClientHello message. Message too short.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.illegal_parameter + } + }); + } else { + // use 'remaining' to calculate # of remaining bytes in the message + var b = record.fragment; + var remaining = b.length(); + msg = { + version: { + major: b.getByte(), + minor: b.getByte() + }, + random: forge.util.createBuffer(b.getBytes(32)), + session_id: readVector(b, 1), + extensions: [] + }; + if(client) { + msg.cipher_suite = b.getBytes(2); + msg.compression_method = b.getByte(); + } else { + msg.cipher_suites = readVector(b, 2); + msg.compression_methods = readVector(b, 1); + } + + // read extensions if there are any bytes left in the message + remaining = length - (remaining - b.length()); + if(remaining > 0) { + // parse extensions + var exts = readVector(b, 2); + while(exts.length() > 0) { + msg.extensions.push({ + type: [exts.getByte(), exts.getByte()], + data: readVector(exts, 2) + }); + } + + // TODO: make extension support modular + if(!client) { + for(var i = 0; i < msg.extensions.length; ++i) { + var ext = msg.extensions[i]; + + // support SNI extension + if(ext.type[0] === 0x00 && ext.type[1] === 0x00) { + // get server name list + var snl = readVector(ext.data, 2); + while(snl.length() > 0) { + // read server name type + var snType = snl.getByte(); + + // only HostName type (0x00) is known, break out if + // another type is detected + if(snType !== 0x00) { + break; + } + + // add host name to server name list + c.session.extensions.server_name.serverNameList.push( + readVector(snl, 2).getBytes()); + } + } + } + } + } + + // version already set, do not allow version change + if(c.session.version) { + if(msg.version.major !== c.session.version.major || + msg.version.minor !== c.session.version.minor) { + return c.error(c, { + message: 'TLS version change is disallowed during renegotiation.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.protocol_version + } + }); + } + } + + // get the chosen (ServerHello) cipher suite + if(client) { + // FIXME: should be checking configured acceptable cipher suites + c.session.cipherSuite = tls.getCipherSuite(msg.cipher_suite); + } else { + // get a supported preferred (ClientHello) cipher suite + // choose the first supported cipher suite + var tmp = forge.util.createBuffer(msg.cipher_suites.bytes()); + while(tmp.length() > 0) { + // FIXME: should be checking configured acceptable suites + // cipher suites take up 2 bytes + c.session.cipherSuite = tls.getCipherSuite(tmp.getBytes(2)); + if(c.session.cipherSuite !== null) { + break; + } + } + } + + // cipher suite not supported + if(c.session.cipherSuite === null) { + return c.error(c, { + message: 'No cipher suites in common.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.handshake_failure + }, + cipherSuite: forge.util.bytesToHex(msg.cipher_suite) + }); + } + + // TODO: handle compression methods + if(client) { + c.session.compressionMethod = msg.compression_method; + } else { + // no compression + c.session.compressionMethod = tls.CompressionMethod.none; + } + } + + return msg; +}; + +/** + * Creates security parameters for the given connection based on the given + * hello message. + * + * @param c the TLS connection. + * @param msg the hello message. + */ +tls.createSecurityParameters = function(c, msg) { + /* Note: security params are from TLS 1.2, some values like prf_algorithm + are ignored for TLS 1.0/1.1 and the builtin as specified in the spec is + used. */ + + // TODO: handle other options from server when more supported + + // get client and server randoms + var client = (c.entity === tls.ConnectionEnd.client); + var msgRandom = msg.random.bytes(); + var cRandom = client ? c.session.sp.client_random : msgRandom; + var sRandom = client ? msgRandom : tls.createRandom().getBytes(); + + // create new security parameters + c.session.sp = { + entity: c.entity, + prf_algorithm: tls.PRFAlgorithm.tls_prf_sha256, + bulk_cipher_algorithm: null, + cipher_type: null, + enc_key_length: null, + block_length: null, + fixed_iv_length: null, + record_iv_length: null, + mac_algorithm: null, + mac_length: null, + mac_key_length: null, + compression_algorithm: c.session.compressionMethod, + pre_master_secret: null, + master_secret: null, + client_random: cRandom, + server_random: sRandom + }; +}; + +/** + * Called when a client receives a ServerHello record. + * + * When a ServerHello message will be sent: + * The server will send this message in response to a client hello message + * when it was able to find an acceptable set of algorithms. If it cannot + * find such a match, it will respond with a handshake failure alert. + * + * uint24 length; + * struct { + * ProtocolVersion server_version; + * Random random; + * SessionID session_id; + * CipherSuite cipher_suite; + * CompressionMethod compression_method; + * select(extensions_present) { + * case false: + * struct {}; + * case true: + * Extension extensions<0..2^16-1>; + * }; + * } ServerHello; + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleServerHello = function(c, record, length) { + var msg = tls.parseHelloMessage(c, record, length); + if(c.fail) { + return; + } + + // ensure server version is compatible + if(msg.version.minor <= c.version.minor) { + c.version.minor = msg.version.minor; + } else { + return c.error(c, { + message: 'Incompatible TLS version.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.protocol_version + } + }); + } + + // indicate session version has been set + c.session.version = c.version; + + // get the session ID from the message + var sessionId = msg.session_id.bytes(); + + // if the session ID is not blank and matches the cached one, resume + // the session + if(sessionId.length > 0 && sessionId === c.session.id) { + // resuming session, expect a ChangeCipherSpec next + c.expect = SCC; + c.session.resuming = true; + + // get new server random + c.session.sp.server_random = msg.random.bytes(); + } else { + // not resuming, expect a server Certificate message next + c.expect = SCE; + c.session.resuming = false; + + // create new security parameters + tls.createSecurityParameters(c, msg); + } + + // set new session ID + c.session.id = sessionId; + + // continue + c.process(); +}; + +/** + * Called when a server receives a ClientHello record. + * + * When a ClientHello message will be sent: + * When a client first connects to a server it is required to send the + * client hello as its first message. The client can also send a client + * hello in response to a hello request or on its own initiative in order + * to renegotiate the security parameters in an existing connection. + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleClientHello = function(c, record, length) { + var msg = tls.parseHelloMessage(c, record, length); + if(c.fail) { + return; + } + + // get the session ID from the message + var sessionId = msg.session_id.bytes(); + + // see if the given session ID is in the cache + var session = null; + if(c.sessionCache) { + session = c.sessionCache.getSession(sessionId); + if(session === null) { + // session ID not found + sessionId = ''; + } else if(session.version.major !== msg.version.major || + session.version.minor > msg.version.minor) { + // if session version is incompatible with client version, do not resume + session = null; + sessionId = ''; + } + } + + // no session found to resume, generate a new session ID + if(sessionId.length === 0) { + sessionId = forge.random.getBytes(32); + } + + // update session + c.session.id = sessionId; + c.session.clientHelloVersion = msg.version; + c.session.sp = {}; + if(session) { + // use version and security parameters from resumed session + c.version = c.session.version = session.version; + c.session.sp = session.sp; + } else { + // use highest compatible minor version + var version; + for(var i = 1; i < tls.SupportedVersions.length; ++i) { + version = tls.SupportedVersions[i]; + if(version.minor <= msg.version.minor) { + break; + } + } + c.version = {major: version.major, minor: version.minor}; + c.session.version = c.version; + } + + // if a session is set, resume it + if(session !== null) { + // resuming session, expect a ChangeCipherSpec next + c.expect = CCC; + c.session.resuming = true; + + // get new client random + c.session.sp.client_random = msg.random.bytes(); + } else { + // not resuming, expect a Certificate or ClientKeyExchange + c.expect = (c.verifyClient !== false) ? CCE : CKE; + c.session.resuming = false; + + // create new security parameters + tls.createSecurityParameters(c, msg); + } + + // connection now open + c.open = true; + + // queue server hello + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createServerHello(c) + })); + + if(c.session.resuming) { + // queue change cipher spec message + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.change_cipher_spec, + data: tls.createChangeCipherSpec() + })); + + // create pending state + c.state.pending = tls.createConnectionState(c); + + // change current write state to pending write state + c.state.current.write = c.state.pending.write; + + // queue finished + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createFinished(c) + })); + } else { + // queue server certificate + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createCertificate(c) + })); + + if(!c.fail) { + // queue server key exchange + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createServerKeyExchange(c) + })); + + // request client certificate if set + if(c.verifyClient !== false) { + // queue certificate request + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createCertificateRequest(c) + })); + } + + // queue server hello done + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createServerHelloDone(c) + })); + } + } + + // send records + tls.flush(c); + + // continue + c.process(); +}; + +/** + * Called when a client receives a Certificate record. + * + * When this message will be sent: + * The server must send a certificate whenever the agreed-upon key exchange + * method is not an anonymous one. This message will always immediately + * follow the server hello message. + * + * Meaning of this message: + * The certificate type must be appropriate for the selected cipher suite's + * key exchange algorithm, and is generally an X.509v3 certificate. It must + * contain a key which matches the key exchange method, as follows. Unless + * otherwise specified, the signing algorithm for the certificate must be + * the same as the algorithm for the certificate key. Unless otherwise + * specified, the public key may be of any length. + * + * opaque ASN.1Cert<1..2^24-1>; + * struct { + * ASN.1Cert certificate_list<1..2^24-1>; + * } Certificate; + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleCertificate = function(c, record, length) { + // minimum of 3 bytes in message + if(length < 3) { + return c.error(c, { + message: 'Invalid Certificate message. Message too short.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.illegal_parameter + } + }); + } + + var b = record.fragment; + var msg = { + certificate_list: readVector(b, 3) + }; + + /* The sender's certificate will be first in the list (chain), each + subsequent one that follows will certify the previous one, but root + certificates (self-signed) that specify the certificate authority may + be omitted under the assumption that clients must already possess it. */ + var cert, asn1; + var certs = []; + try { + while(msg.certificate_list.length() > 0) { + // each entry in msg.certificate_list is a vector with 3 len bytes + cert = readVector(msg.certificate_list, 3); + asn1 = forge.asn1.fromDer(cert); + cert = forge.pki.certificateFromAsn1(asn1, true); + certs.push(cert); + } + } catch(ex) { + return c.error(c, { + message: 'Could not parse certificate list.', + cause: ex, + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.bad_certificate + } + }); + } + + // ensure at least 1 certificate was provided if in client-mode + // or if verifyClient was set to true to require a certificate + // (as opposed to 'optional') + var client = (c.entity === tls.ConnectionEnd.client); + if((client || c.verifyClient === true) && certs.length === 0) { + // error, no certificate + c.error(c, { + message: client ? + 'No server certificate provided.' : + 'No client certificate provided.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.illegal_parameter + } + }); + } else if(certs.length === 0) { + // no certs to verify + // expect a ServerKeyExchange or ClientKeyExchange message next + c.expect = client ? SKE : CKE; + } else { + // save certificate in session + if(client) { + c.session.serverCertificate = certs[0]; + } else { + c.session.clientCertificate = certs[0]; + } + + if(tls.verifyCertificateChain(c, certs)) { + // expect a ServerKeyExchange or ClientKeyExchange message next + c.expect = client ? SKE : CKE; + } + } + + // continue + c.process(); +}; + +/** + * Called when a client receives a ServerKeyExchange record. + * + * When this message will be sent: + * This message will be sent immediately after the server certificate + * message (or the server hello message, if this is an anonymous + * negotiation). + * + * The server key exchange message is sent by the server only when the + * server certificate message (if sent) does not contain enough data to + * allow the client to exchange a premaster secret. + * + * Meaning of this message: + * This message conveys cryptographic information to allow the client to + * communicate the premaster secret: either an RSA public key to encrypt + * the premaster secret with, or a Diffie-Hellman public key with which the + * client can complete a key exchange (with the result being the premaster + * secret.) + * + * enum { + * dhe_dss, dhe_rsa, dh_anon, rsa, dh_dss, dh_rsa + * } KeyExchangeAlgorithm; + * + * struct { + * opaque dh_p<1..2^16-1>; + * opaque dh_g<1..2^16-1>; + * opaque dh_Ys<1..2^16-1>; + * } ServerDHParams; + * + * struct { + * select(KeyExchangeAlgorithm) { + * case dh_anon: + * ServerDHParams params; + * case dhe_dss: + * case dhe_rsa: + * ServerDHParams params; + * digitally-signed struct { + * opaque client_random[32]; + * opaque server_random[32]; + * ServerDHParams params; + * } signed_params; + * case rsa: + * case dh_dss: + * case dh_rsa: + * struct {}; + * }; + * } ServerKeyExchange; + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleServerKeyExchange = function(c, record, length) { + // this implementation only supports RSA, no Diffie-Hellman support + // so any length > 0 is invalid + if(length > 0) { + return c.error(c, { + message: 'Invalid key parameters. Only RSA is supported.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.unsupported_certificate + } + }); + } + + // expect an optional CertificateRequest message next + c.expect = SCR; + + // continue + c.process(); +}; + +/** + * Called when a client receives a ClientKeyExchange record. + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleClientKeyExchange = function(c, record, length) { + // this implementation only supports RSA, no Diffie-Hellman support + // so any length < 48 is invalid + if(length < 48) { + return c.error(c, { + message: 'Invalid key parameters. Only RSA is supported.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.unsupported_certificate + } + }); + } + + var b = record.fragment; + var msg = { + enc_pre_master_secret: readVector(b, 2).getBytes() + }; + + // do rsa decryption + var privateKey = null; + if(c.getPrivateKey) { + try { + privateKey = c.getPrivateKey(c, c.session.serverCertificate); + privateKey = forge.pki.privateKeyFromPem(privateKey); + } catch(ex) { + c.error(c, { + message: 'Could not get private key.', + cause: ex, + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.internal_error + } + }); + } + } + + if(privateKey === null) { + return c.error(c, { + message: 'No private key set.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.internal_error + } + }); + } + + try { + // decrypt 48-byte pre-master secret + var sp = c.session.sp; + sp.pre_master_secret = privateKey.decrypt(msg.enc_pre_master_secret); + + // ensure client hello version matches first 2 bytes + var version = c.session.clientHelloVersion; + if(version.major !== sp.pre_master_secret.charCodeAt(0) || + version.minor !== sp.pre_master_secret.charCodeAt(1)) { + // error, do not send alert (see BLEI attack below) + throw new Error('TLS version rollback attack detected.'); + } + } catch(ex) { + /* Note: Daniel Bleichenbacher [BLEI] can be used to attack a + TLS server which is using PKCS#1 encoded RSA, so instead of + failing here, we generate 48 random bytes and use that as + the pre-master secret. */ + sp.pre_master_secret = forge.random.getBytes(48); + } + + // expect a CertificateVerify message if a Certificate was received that + // does not have fixed Diffie-Hellman params, otherwise expect + // ChangeCipherSpec + c.expect = CCC; + if(c.session.clientCertificate !== null) { + // only RSA support, so expect CertificateVerify + // TODO: support Diffie-Hellman + c.expect = CCV; + } + + // continue + c.process(); +}; + +/** + * Called when a client receives a CertificateRequest record. + * + * When this message will be sent: + * A non-anonymous server can optionally request a certificate from the + * client, if appropriate for the selected cipher suite. This message, if + * sent, will immediately follow the Server Key Exchange message (if it is + * sent; otherwise, the Server Certificate message). + * + * enum { + * rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), + * rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), + * fortezza_dms_RESERVED(20), (255) + * } ClientCertificateType; + * + * opaque DistinguishedName<1..2^16-1>; + * + * struct { + * ClientCertificateType certificate_types<1..2^8-1>; + * SignatureAndHashAlgorithm supported_signature_algorithms<2^16-1>; + * DistinguishedName certificate_authorities<0..2^16-1>; + * } CertificateRequest; + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleCertificateRequest = function(c, record, length) { + // minimum of 3 bytes in message + if(length < 3) { + return c.error(c, { + message: 'Invalid CertificateRequest. Message too short.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.illegal_parameter + } + }); + } + + // TODO: TLS 1.2+ has different format including + // SignatureAndHashAlgorithm after cert types + var b = record.fragment; + var msg = { + certificate_types: readVector(b, 1), + certificate_authorities: readVector(b, 2) + }; + + // save certificate request in session + c.session.certificateRequest = msg; + + // expect a ServerHelloDone message next + c.expect = SHD; + + // continue + c.process(); +}; + +/** + * Called when a server receives a CertificateVerify record. + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleCertificateVerify = function(c, record, length) { + if(length < 2) { + return c.error(c, { + message: 'Invalid CertificateVerify. Message too short.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.illegal_parameter + } + }); + } + + // rewind to get full bytes for message so it can be manually + // digested below (special case for CertificateVerify messages because + // they must be digested *after* handling as opposed to all others) + var b = record.fragment; + b.read -= 4; + var msgBytes = b.bytes(); + b.read += 4; + + var msg = { + signature: readVector(b, 2).getBytes() + }; + + // TODO: add support for DSA + + // generate data to verify + var verify = forge.util.createBuffer(); + verify.putBuffer(c.session.md5.digest()); + verify.putBuffer(c.session.sha1.digest()); + verify = verify.getBytes(); + + try { + var cert = c.session.clientCertificate; + /*b = forge.pki.rsa.decrypt( + msg.signature, cert.publicKey, true, verify.length); + if(b !== verify) {*/ + if(!cert.publicKey.verify(verify, msg.signature, 'NONE')) { + throw new Error('CertificateVerify signature does not match.'); + } + + // digest message now that it has been handled + c.session.md5.update(msgBytes); + c.session.sha1.update(msgBytes); + } catch(ex) { + return c.error(c, { + message: 'Bad signature in CertificateVerify.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.handshake_failure + } + }); + } + + // expect ChangeCipherSpec + c.expect = CCC; + + // continue + c.process(); +}; + +/** + * Called when a client receives a ServerHelloDone record. + * + * When this message will be sent: + * The server hello done message is sent by the server to indicate the end + * of the server hello and associated messages. After sending this message + * the server will wait for a client response. + * + * Meaning of this message: + * This message means that the server is done sending messages to support + * the key exchange, and the client can proceed with its phase of the key + * exchange. + * + * Upon receipt of the server hello done message the client should verify + * that the server provided a valid certificate if required and check that + * the server hello parameters are acceptable. + * + * struct {} ServerHelloDone; + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleServerHelloDone = function(c, record, length) { + // len must be 0 bytes + if(length > 0) { + return c.error(c, { + message: 'Invalid ServerHelloDone message. Invalid length.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.record_overflow + } + }); + } + + if(c.serverCertificate === null) { + // no server certificate was provided + var error = { + message: 'No server certificate provided. Not enough security.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.insufficient_security + } + }; + + // call application callback + var depth = 0; + var ret = c.verify(c, error.alert.description, depth, []); + if(ret !== true) { + // check for custom alert info + if(ret || ret === 0) { + // set custom message and alert description + if(typeof ret === 'object' && !forge.util.isArray(ret)) { + if(ret.message) { + error.message = ret.message; + } + if(ret.alert) { + error.alert.description = ret.alert; + } + } else if(typeof ret === 'number') { + // set custom alert description + error.alert.description = ret; + } + } + + // send error + return c.error(c, error); + } + } + + // create client certificate message if requested + if(c.session.certificateRequest !== null) { + record = tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createCertificate(c) + }); + tls.queue(c, record); + } + + // create client key exchange message + record = tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createClientKeyExchange(c) + }); + tls.queue(c, record); + + // expect no messages until the following callback has been called + c.expect = SER; + + // create callback to handle client signature (for client-certs) + var callback = function(c, signature) { + if(c.session.certificateRequest !== null && + c.session.clientCertificate !== null) { + // create certificate verify message + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createCertificateVerify(c, signature) + })); + } + + // create change cipher spec message + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.change_cipher_spec, + data: tls.createChangeCipherSpec() + })); + + // create pending state + c.state.pending = tls.createConnectionState(c); + + // change current write state to pending write state + c.state.current.write = c.state.pending.write; + + // create finished message + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createFinished(c) + })); + + // expect a server ChangeCipherSpec message next + c.expect = SCC; + + // send records + tls.flush(c); + + // continue + c.process(); + }; + + // if there is no certificate request or no client certificate, do + // callback immediately + if(c.session.certificateRequest === null || + c.session.clientCertificate === null) { + return callback(c, null); + } + + // otherwise get the client signature + tls.getClientSignature(c, callback); +}; + +/** + * Called when a ChangeCipherSpec record is received. + * + * @param c the connection. + * @param record the record. + */ +tls.handleChangeCipherSpec = function(c, record) { + if(record.fragment.getByte() !== 0x01) { + return c.error(c, { + message: 'Invalid ChangeCipherSpec message received.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.illegal_parameter + } + }); + } + + // create pending state if: + // 1. Resuming session in client mode OR + // 2. NOT resuming session in server mode + var client = (c.entity === tls.ConnectionEnd.client); + if((c.session.resuming && client) || (!c.session.resuming && !client)) { + c.state.pending = tls.createConnectionState(c); + } + + // change current read state to pending read state + c.state.current.read = c.state.pending.read; + + // clear pending state if: + // 1. NOT resuming session in client mode OR + // 2. resuming a session in server mode + if((!c.session.resuming && client) || (c.session.resuming && !client)) { + c.state.pending = null; + } + + // expect a Finished record next + c.expect = client ? SFI : CFI; + + // continue + c.process(); +}; + +/** + * Called when a Finished record is received. + * + * When this message will be sent: + * A finished message is always sent immediately after a change + * cipher spec message to verify that the key exchange and + * authentication processes were successful. It is essential that a + * change cipher spec message be received between the other + * handshake messages and the Finished message. + * + * Meaning of this message: + * The finished message is the first protected with the just- + * negotiated algorithms, keys, and secrets. Recipients of finished + * messages must verify that the contents are correct. Once a side + * has sent its Finished message and received and validated the + * Finished message from its peer, it may begin to send and receive + * application data over the connection. + * + * struct { + * opaque verify_data[verify_data_length]; + * } Finished; + * + * verify_data + * PRF(master_secret, finished_label, Hash(handshake_messages)) + * [0..verify_data_length-1]; + * + * finished_label + * For Finished messages sent by the client, the string + * "client finished". For Finished messages sent by the server, the + * string "server finished". + * + * verify_data_length depends on the cipher suite. If it is not specified + * by the cipher suite, then it is 12. Versions of TLS < 1.2 always used + * 12 bytes. + * + * @param c the connection. + * @param record the record. + * @param length the length of the handshake message. + */ +tls.handleFinished = function(c, record, length) { + // rewind to get full bytes for message so it can be manually + // digested below (special case for Finished messages because they + // must be digested *after* handling as opposed to all others) + var b = record.fragment; + b.read -= 4; + var msgBytes = b.bytes(); + b.read += 4; + + // message contains only verify_data + var vd = record.fragment.getBytes(); + + // ensure verify data is correct + b = forge.util.createBuffer(); + b.putBuffer(c.session.md5.digest()); + b.putBuffer(c.session.sha1.digest()); + + // set label based on entity type + var client = (c.entity === tls.ConnectionEnd.client); + var label = client ? 'server finished' : 'client finished'; + + // TODO: determine prf function and verify length for TLS 1.2 + var sp = c.session.sp; + var vdl = 12; + var prf = prf_TLS1; + b = prf(sp.master_secret, label, b.getBytes(), vdl); + if(b.getBytes() !== vd) { + return c.error(c, { + message: 'Invalid verify_data in Finished message.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.decrypt_error + } + }); + } + + // digest finished message now that it has been handled + c.session.md5.update(msgBytes); + c.session.sha1.update(msgBytes); + + // resuming session as client or NOT resuming session as server + if((c.session.resuming && client) || (!c.session.resuming && !client)) { + // create change cipher spec message + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.change_cipher_spec, + data: tls.createChangeCipherSpec() + })); + + // change current write state to pending write state, clear pending + c.state.current.write = c.state.pending.write; + c.state.pending = null; + + // create finished message + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createFinished(c) + })); + } + + // expect application data next + c.expect = client ? SAD : CAD; + + // handshake complete + c.handshaking = false; + ++c.handshakes; + + // save access to peer certificate + c.peerCertificate = client ? + c.session.serverCertificate : c.session.clientCertificate; + + // send records + tls.flush(c); + + // now connected + c.isConnected = true; + c.connected(c); + + // continue + c.process(); +}; + +/** + * Called when an Alert record is received. + * + * @param c the connection. + * @param record the record. + */ +tls.handleAlert = function(c, record) { + // read alert + var b = record.fragment; + var alert = { + level: b.getByte(), + description: b.getByte() + }; + + // TODO: consider using a table? + // get appropriate message + var msg; + switch(alert.description) { + case tls.Alert.Description.close_notify: + msg = 'Connection closed.'; + break; + case tls.Alert.Description.unexpected_message: + msg = 'Unexpected message.'; + break; + case tls.Alert.Description.bad_record_mac: + msg = 'Bad record MAC.'; + break; + case tls.Alert.Description.decryption_failed: + msg = 'Decryption failed.'; + break; + case tls.Alert.Description.record_overflow: + msg = 'Record overflow.'; + break; + case tls.Alert.Description.decompression_failure: + msg = 'Decompression failed.'; + break; + case tls.Alert.Description.handshake_failure: + msg = 'Handshake failure.'; + break; + case tls.Alert.Description.bad_certificate: + msg = 'Bad certificate.'; + break; + case tls.Alert.Description.unsupported_certificate: + msg = 'Unsupported certificate.'; + break; + case tls.Alert.Description.certificate_revoked: + msg = 'Certificate revoked.'; + break; + case tls.Alert.Description.certificate_expired: + msg = 'Certificate expired.'; + break; + case tls.Alert.Description.certificate_unknown: + msg = 'Certificate unknown.'; + break; + case tls.Alert.Description.illegal_parameter: + msg = 'Illegal parameter.'; + break; + case tls.Alert.Description.unknown_ca: + msg = 'Unknown certificate authority.'; + break; + case tls.Alert.Description.access_denied: + msg = 'Access denied.'; + break; + case tls.Alert.Description.decode_error: + msg = 'Decode error.'; + break; + case tls.Alert.Description.decrypt_error: + msg = 'Decrypt error.'; + break; + case tls.Alert.Description.export_restriction: + msg = 'Export restriction.'; + break; + case tls.Alert.Description.protocol_version: + msg = 'Unsupported protocol version.'; + break; + case tls.Alert.Description.insufficient_security: + msg = 'Insufficient security.'; + break; + case tls.Alert.Description.internal_error: + msg = 'Internal error.'; + break; + case tls.Alert.Description.user_canceled: + msg = 'User canceled.'; + break; + case tls.Alert.Description.no_renegotiation: + msg = 'Renegotiation not supported.'; + break; + default: + msg = 'Unknown error.'; + break; + } + + // close connection on close_notify, not an error + if(alert.description === tls.Alert.Description.close_notify) { + return c.close(); + } + + // call error handler + c.error(c, { + message: msg, + send: false, + // origin is the opposite end + origin: (c.entity === tls.ConnectionEnd.client) ? 'server' : 'client', + alert: alert + }); + + // continue + c.process(); +}; + +/** + * Called when a Handshake record is received. + * + * @param c the connection. + * @param record the record. + */ +tls.handleHandshake = function(c, record) { + // get the handshake type and message length + var b = record.fragment; + var type = b.getByte(); + var length = b.getInt24(); + + // see if the record fragment doesn't yet contain the full message + if(length > b.length()) { + // cache the record, clear its fragment, and reset the buffer read + // pointer before the type and length were read + c.fragmented = record; + record.fragment = forge.util.createBuffer(); + b.read -= 4; + + // continue + return c.process(); + } + + // full message now available, clear cache, reset read pointer to + // before type and length + c.fragmented = null; + b.read -= 4; + + // save the handshake bytes for digestion after handler is found + // (include type and length of handshake msg) + var bytes = b.bytes(length + 4); + + // restore read pointer + b.read += 4; + + // handle expected message + if(type in hsTable[c.entity][c.expect]) { + // initialize server session + if(c.entity === tls.ConnectionEnd.server && !c.open && !c.fail) { + c.handshaking = true; + c.session = { + version: null, + extensions: { + server_name: { + serverNameList: [] + } + }, + cipherSuite: null, + compressionMethod: null, + serverCertificate: null, + clientCertificate: null, + md5: forge.md.md5.create(), + sha1: forge.md.sha1.create() + }; + } + + /* Update handshake messages digest. Finished and CertificateVerify + messages are not digested here. They can't be digested as part of + the verify_data that they contain. These messages are manually + digested in their handlers. HelloRequest messages are simply never + included in the handshake message digest according to spec. */ + if(type !== tls.HandshakeType.hello_request && + type !== tls.HandshakeType.certificate_verify && + type !== tls.HandshakeType.finished) { + c.session.md5.update(bytes); + c.session.sha1.update(bytes); + } + + // handle specific handshake type record + hsTable[c.entity][c.expect][type](c, record, length); + } else { + // unexpected record + tls.handleUnexpected(c, record); + } +}; + +/** + * Called when an ApplicationData record is received. + * + * @param c the connection. + * @param record the record. + */ +tls.handleApplicationData = function(c, record) { + // buffer data, notify that its ready + c.data.putBuffer(record.fragment); + c.dataReady(c); + + // continue + c.process(); +}; + +/** + * Called when a Heartbeat record is received. + * + * @param c the connection. + * @param record the record. + */ +tls.handleHeartbeat = function(c, record) { + // get the heartbeat type and payload + var b = record.fragment; + var type = b.getByte(); + var length = b.getInt16(); + var payload = b.getBytes(length); + + if(type === tls.HeartbeatMessageType.heartbeat_request) { + // discard request during handshake or if length is too large + if(c.handshaking || length > payload.length) { + // continue + return c.process(); + } + // retransmit payload + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.heartbeat, + data: tls.createHeartbeat( + tls.HeartbeatMessageType.heartbeat_response, payload) + })); + tls.flush(c); + } else if(type === tls.HeartbeatMessageType.heartbeat_response) { + // check payload against expected payload, discard heartbeat if no match + if(payload !== c.expectedHeartbeatPayload) { + // continue + return c.process(); + } + + // notify that a valid heartbeat was received + if(c.heartbeatReceived) { + c.heartbeatReceived(c, forge.util.createBuffer(payload)); + } + } + + // continue + c.process(); +}; + +/** + * The transistional state tables for receiving TLS records. It maps the + * current TLS engine state and a received record to a function to handle the + * record and update the state. + * + * For instance, if the current state is SHE, then the TLS engine is expecting + * a ServerHello record. Once a record is received, the handler function is + * looked up using the state SHE and the record's content type. + * + * The resulting function will either be an error handler or a record handler. + * The function will take whatever action is appropriate and update the state + * for the next record. + * + * The states are all based on possible server record types. Note that the + * client will never specifically expect to receive a HelloRequest or an alert + * from the server so there is no state that reflects this. These messages may + * occur at any time. + * + * There are two tables for mapping states because there is a second tier of + * types for handshake messages. Once a record with a content type of handshake + * is received, the handshake record handler will look up the handshake type in + * the secondary map to get its appropriate handler. + * + * Valid message orders are as follows: + * + * =======================FULL HANDSHAKE====================== + * Client Server + * + * ClientHello --------> + * ServerHello + * Certificate* + * ServerKeyExchange* + * CertificateRequest* + * <-------- ServerHelloDone + * Certificate* + * ClientKeyExchange + * CertificateVerify* + * [ChangeCipherSpec] + * Finished --------> + * [ChangeCipherSpec] + * <-------- Finished + * Application Data <-------> Application Data + * + * =====================SESSION RESUMPTION===================== + * Client Server + * + * ClientHello --------> + * ServerHello + * [ChangeCipherSpec] + * <-------- Finished + * [ChangeCipherSpec] + * Finished --------> + * Application Data <-------> Application Data + */ +// client expect states (indicate which records are expected to be received) +var SHE = 0; // rcv server hello +var SCE = 1; // rcv server certificate +var SKE = 2; // rcv server key exchange +var SCR = 3; // rcv certificate request +var SHD = 4; // rcv server hello done +var SCC = 5; // rcv change cipher spec +var SFI = 6; // rcv finished +var SAD = 7; // rcv application data +var SER = 8; // not expecting any messages at this point + +// server expect states +var CHE = 0; // rcv client hello +var CCE = 1; // rcv client certificate +var CKE = 2; // rcv client key exchange +var CCV = 3; // rcv certificate verify +var CCC = 4; // rcv change cipher spec +var CFI = 5; // rcv finished +var CAD = 6; // rcv application data +var CER = 7; // not expecting any messages at this point + +// map client current expect state and content type to function +var __ = tls.handleUnexpected; +var R0 = tls.handleChangeCipherSpec; +var R1 = tls.handleAlert; +var R2 = tls.handleHandshake; +var R3 = tls.handleApplicationData; +var R4 = tls.handleHeartbeat; +var ctTable = []; +ctTable[tls.ConnectionEnd.client] = [ +// CC,AL,HS,AD,HB +/*SHE*/[__,R1,R2,__,R4], +/*SCE*/[__,R1,R2,__,R4], +/*SKE*/[__,R1,R2,__,R4], +/*SCR*/[__,R1,R2,__,R4], +/*SHD*/[__,R1,R2,__,R4], +/*SCC*/[R0,R1,__,__,R4], +/*SFI*/[__,R1,R2,__,R4], +/*SAD*/[__,R1,R2,R3,R4], +/*SER*/[__,R1,R2,__,R4] +]; + +// map server current expect state and content type to function +ctTable[tls.ConnectionEnd.server] = [ +// CC,AL,HS,AD +/*CHE*/[__,R1,R2,__,R4], +/*CCE*/[__,R1,R2,__,R4], +/*CKE*/[__,R1,R2,__,R4], +/*CCV*/[__,R1,R2,__,R4], +/*CCC*/[R0,R1,__,__,R4], +/*CFI*/[__,R1,R2,__,R4], +/*CAD*/[__,R1,R2,R3,R4], +/*CER*/[__,R1,R2,__,R4] +]; + +// map client current expect state and handshake type to function +var H0 = tls.handleHelloRequest; +var H1 = tls.handleServerHello; +var H2 = tls.handleCertificate; +var H3 = tls.handleServerKeyExchange; +var H4 = tls.handleCertificateRequest; +var H5 = tls.handleServerHelloDone; +var H6 = tls.handleFinished; +var hsTable = []; +hsTable[tls.ConnectionEnd.client] = [ +// HR,01,SH,03,04,05,06,07,08,09,10,SC,SK,CR,HD,15,CK,17,18,19,FI +/*SHE*/[__,__,H1,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], +/*SCE*/[H0,__,__,__,__,__,__,__,__,__,__,H2,H3,H4,H5,__,__,__,__,__,__], +/*SKE*/[H0,__,__,__,__,__,__,__,__,__,__,__,H3,H4,H5,__,__,__,__,__,__], +/*SCR*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,H4,H5,__,__,__,__,__,__], +/*SHD*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,H5,__,__,__,__,__,__], +/*SCC*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], +/*SFI*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H6], +/*SAD*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], +/*SER*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__] +]; + +// map server current expect state and handshake type to function +// Note: CAD[CH] does not map to FB because renegotation is prohibited +var H7 = tls.handleClientHello; +var H8 = tls.handleClientKeyExchange; +var H9 = tls.handleCertificateVerify; +hsTable[tls.ConnectionEnd.server] = [ +// 01,CH,02,03,04,05,06,07,08,09,10,CC,12,13,14,CV,CK,17,18,19,FI +/*CHE*/[__,H7,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], +/*CCE*/[__,__,__,__,__,__,__,__,__,__,__,H2,__,__,__,__,__,__,__,__,__], +/*CKE*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H8,__,__,__,__], +/*CCV*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H9,__,__,__,__,__], +/*CCC*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], +/*CFI*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H6], +/*CAD*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], +/*CER*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__] +]; + +/** + * Generates the master_secret and keys using the given security parameters. + * + * The security parameters for a TLS connection state are defined as such: + * + * struct { + * ConnectionEnd entity; + * PRFAlgorithm prf_algorithm; + * BulkCipherAlgorithm bulk_cipher_algorithm; + * CipherType cipher_type; + * uint8 enc_key_length; + * uint8 block_length; + * uint8 fixed_iv_length; + * uint8 record_iv_length; + * MACAlgorithm mac_algorithm; + * uint8 mac_length; + * uint8 mac_key_length; + * CompressionMethod compression_algorithm; + * opaque master_secret[48]; + * opaque client_random[32]; + * opaque server_random[32]; + * } SecurityParameters; + * + * Note that this definition is from TLS 1.2. In TLS 1.0 some of these + * parameters are ignored because, for instance, the PRFAlgorithm is a + * builtin-fixed algorithm combining iterations of MD5 and SHA-1 in TLS 1.0. + * + * The Record Protocol requires an algorithm to generate keys required by the + * current connection state. + * + * The master secret is expanded into a sequence of secure bytes, which is then + * split to a client write MAC key, a server write MAC key, a client write + * encryption key, and a server write encryption key. In TLS 1.0 a client write + * IV and server write IV are also generated. Each of these is generated from + * the byte sequence in that order. Unused values are empty. In TLS 1.2, some + * AEAD ciphers may additionally require a client write IV and a server write + * IV (see Section 6.2.3.3). + * + * When keys, MAC keys, and IVs are generated, the master secret is used as an + * entropy source. + * + * To generate the key material, compute: + * + * master_secret = PRF(pre_master_secret, "master secret", + * ClientHello.random + ServerHello.random) + * + * key_block = PRF(SecurityParameters.master_secret, + * "key expansion", + * SecurityParameters.server_random + + * SecurityParameters.client_random); + * + * until enough output has been generated. Then, the key_block is + * partitioned as follows: + * + * client_write_MAC_key[SecurityParameters.mac_key_length] + * server_write_MAC_key[SecurityParameters.mac_key_length] + * client_write_key[SecurityParameters.enc_key_length] + * server_write_key[SecurityParameters.enc_key_length] + * client_write_IV[SecurityParameters.fixed_iv_length] + * server_write_IV[SecurityParameters.fixed_iv_length] + * + * In TLS 1.2, the client_write_IV and server_write_IV are only generated for + * implicit nonce techniques as described in Section 3.2.1 of [AEAD]. This + * implementation uses TLS 1.0 so IVs are generated. + * + * Implementation note: The currently defined cipher suite which requires the + * most material is AES_256_CBC_SHA256. It requires 2 x 32 byte keys and 2 x 32 + * byte MAC keys, for a total 128 bytes of key material. In TLS 1.0 it also + * requires 2 x 16 byte IVs, so it actually takes 160 bytes of key material. + * + * @param c the connection. + * @param sp the security parameters to use. + * + * @return the security keys. + */ +tls.generateKeys = function(c, sp) { + // TLS_RSA_WITH_AES_128_CBC_SHA (required to be compliant with TLS 1.2) & + // TLS_RSA_WITH_AES_256_CBC_SHA are the only cipher suites implemented + // at present + + // TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA is required to be compliant with + // TLS 1.0 but we don't care right now because AES is better and we have + // an implementation for it + + // TODO: TLS 1.2 implementation + /* + // determine the PRF + var prf; + switch(sp.prf_algorithm) { + case tls.PRFAlgorithm.tls_prf_sha256: + prf = prf_sha256; + break; + default: + // should never happen + throw new Error('Invalid PRF'); + } + */ + + // TLS 1.0/1.1 implementation + var prf = prf_TLS1; + + // concatenate server and client random + var random = sp.client_random + sp.server_random; + + // only create master secret if session is new + if(!c.session.resuming) { + // create master secret, clean up pre-master secret + sp.master_secret = prf( + sp.pre_master_secret, 'master secret', random, 48).bytes(); + sp.pre_master_secret = null; + } + + // generate the amount of key material needed + random = sp.server_random + sp.client_random; + var length = 2 * sp.mac_key_length + 2 * sp.enc_key_length; + + // include IV for TLS/1.0 + var tls10 = (c.version.major === tls.Versions.TLS_1_0.major && + c.version.minor === tls.Versions.TLS_1_0.minor); + if(tls10) { + length += 2 * sp.fixed_iv_length; + } + var km = prf(sp.master_secret, 'key expansion', random, length); + + // split the key material into the MAC and encryption keys + var rval = { + client_write_MAC_key: km.getBytes(sp.mac_key_length), + server_write_MAC_key: km.getBytes(sp.mac_key_length), + client_write_key: km.getBytes(sp.enc_key_length), + server_write_key: km.getBytes(sp.enc_key_length) + }; + + // include TLS 1.0 IVs + if(tls10) { + rval.client_write_IV = km.getBytes(sp.fixed_iv_length); + rval.server_write_IV = km.getBytes(sp.fixed_iv_length); + } + + return rval; +}; + +/** + * Creates a new initialized TLS connection state. A connection state has + * a read mode and a write mode. + * + * compression state: + * The current state of the compression algorithm. + * + * cipher state: + * The current state of the encryption algorithm. This will consist of the + * scheduled key for that connection. For stream ciphers, this will also + * contain whatever state information is necessary to allow the stream to + * continue to encrypt or decrypt data. + * + * MAC key: + * The MAC key for the connection. + * + * sequence number: + * Each connection state contains a sequence number, which is maintained + * separately for read and write states. The sequence number MUST be set to + * zero whenever a connection state is made the active state. Sequence + * numbers are of type uint64 and may not exceed 2^64-1. Sequence numbers do + * not wrap. If a TLS implementation would need to wrap a sequence number, + * it must renegotiate instead. A sequence number is incremented after each + * record: specifically, the first record transmitted under a particular + * connection state MUST use sequence number 0. + * + * @param c the connection. + * + * @return the new initialized TLS connection state. + */ +tls.createConnectionState = function(c) { + var client = (c.entity === tls.ConnectionEnd.client); + + var createMode = function() { + var mode = { + // two 32-bit numbers, first is most significant + sequenceNumber: [0, 0], + macKey: null, + macLength: 0, + macFunction: null, + cipherState: null, + cipherFunction: function(record) {return true;}, + compressionState: null, + compressFunction: function(record) {return true;}, + updateSequenceNumber: function() { + if(mode.sequenceNumber[1] === 0xFFFFFFFF) { + mode.sequenceNumber[1] = 0; + ++mode.sequenceNumber[0]; + } else { + ++mode.sequenceNumber[1]; + } + } + }; + return mode; + }; + var state = { + read: createMode(), + write: createMode() + }; + + // update function in read mode will decrypt then decompress a record + state.read.update = function(c, record) { + if(!state.read.cipherFunction(record, state.read)) { + c.error(c, { + message: 'Could not decrypt record or bad MAC.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + // doesn't matter if decryption failed or MAC was + // invalid, return the same error so as not to reveal + // which one occurred + description: tls.Alert.Description.bad_record_mac + } + }); + } else if(!state.read.compressFunction(c, record, state.read)) { + c.error(c, { + message: 'Could not decompress record.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.decompression_failure + } + }); + } + return !c.fail; + }; + + // update function in write mode will compress then encrypt a record + state.write.update = function(c, record) { + if(!state.write.compressFunction(c, record, state.write)) { + // error, but do not send alert since it would require + // compression as well + c.error(c, { + message: 'Could not compress record.', + send: false, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.internal_error + } + }); + } else if(!state.write.cipherFunction(record, state.write)) { + // error, but do not send alert since it would require + // encryption as well + c.error(c, { + message: 'Could not encrypt record.', + send: false, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.internal_error + } + }); + } + return !c.fail; + }; + + // handle security parameters + if(c.session) { + var sp = c.session.sp; + c.session.cipherSuite.initSecurityParameters(sp); + + // generate keys + sp.keys = tls.generateKeys(c, sp); + state.read.macKey = client ? + sp.keys.server_write_MAC_key : sp.keys.client_write_MAC_key; + state.write.macKey = client ? + sp.keys.client_write_MAC_key : sp.keys.server_write_MAC_key; + + // cipher suite setup + c.session.cipherSuite.initConnectionState(state, c, sp); + + // compression setup + switch(sp.compression_algorithm) { + case tls.CompressionMethod.none: + break; + case tls.CompressionMethod.deflate: + state.read.compressFunction = inflate; + state.write.compressFunction = deflate; + break; + default: + throw new Error('Unsupported compression algorithm.'); + } + } + + return state; +}; + +/** + * Creates a Random structure. + * + * struct { + * uint32 gmt_unix_time; + * opaque random_bytes[28]; + * } Random; + * + * gmt_unix_time: + * The current time and date in standard UNIX 32-bit format (seconds since + * the midnight starting Jan 1, 1970, UTC, ignoring leap seconds) according + * to the sender's internal clock. Clocks are not required to be set + * correctly by the basic TLS protocol; higher-level or application + * protocols may define additional requirements. Note that, for historical + * reasons, the data element is named using GMT, the predecessor of the + * current worldwide time base, UTC. + * random_bytes: + * 28 bytes generated by a secure random number generator. + * + * @return the Random structure as a byte array. + */ +tls.createRandom = function() { + // get UTC milliseconds + var d = new Date(); + var utc = +d + d.getTimezoneOffset() * 60000; + var rval = forge.util.createBuffer(); + rval.putInt32(utc); + rval.putBytes(forge.random.getBytes(28)); + return rval; +}; + +/** + * Creates a TLS record with the given type and data. + * + * @param c the connection. + * @param options: + * type: the record type. + * data: the plain text data in a byte buffer. + * + * @return the created record. + */ +tls.createRecord = function(c, options) { + if(!options.data) { + return null; + } + var record = { + type: options.type, + version: { + major: c.version.major, + minor: c.version.minor + }, + length: options.data.length(), + fragment: options.data + }; + return record; +}; + +/** + * Creates a TLS alert record. + * + * @param c the connection. + * @param alert: + * level: the TLS alert level. + * description: the TLS alert description. + * + * @return the created alert record. + */ +tls.createAlert = function(c, alert) { + var b = forge.util.createBuffer(); + b.putByte(alert.level); + b.putByte(alert.description); + return tls.createRecord(c, { + type: tls.ContentType.alert, + data: b + }); +}; + +/* The structure of a TLS handshake message. + * + * struct { + * HandshakeType msg_type; // handshake type + * uint24 length; // bytes in message + * select(HandshakeType) { + * case hello_request: HelloRequest; + * case client_hello: ClientHello; + * case server_hello: ServerHello; + * case certificate: Certificate; + * case server_key_exchange: ServerKeyExchange; + * case certificate_request: CertificateRequest; + * case server_hello_done: ServerHelloDone; + * case certificate_verify: CertificateVerify; + * case client_key_exchange: ClientKeyExchange; + * case finished: Finished; + * } body; + * } Handshake; + */ + +/** + * Creates a ClientHello message. + * + * opaque SessionID<0..32>; + * enum { null(0), deflate(1), (255) } CompressionMethod; + * uint8 CipherSuite[2]; + * + * struct { + * ProtocolVersion client_version; + * Random random; + * SessionID session_id; + * CipherSuite cipher_suites<2..2^16-2>; + * CompressionMethod compression_methods<1..2^8-1>; + * select(extensions_present) { + * case false: + * struct {}; + * case true: + * Extension extensions<0..2^16-1>; + * }; + * } ClientHello; + * + * The extension format for extended client hellos and server hellos is: + * + * struct { + * ExtensionType extension_type; + * opaque extension_data<0..2^16-1>; + * } Extension; + * + * Here: + * + * - "extension_type" identifies the particular extension type. + * - "extension_data" contains information specific to the particular + * extension type. + * + * The extension types defined in this document are: + * + * enum { + * server_name(0), max_fragment_length(1), + * client_certificate_url(2), trusted_ca_keys(3), + * truncated_hmac(4), status_request(5), (65535) + * } ExtensionType; + * + * @param c the connection. + * + * @return the ClientHello byte buffer. + */ +tls.createClientHello = function(c) { + // save hello version + c.session.clientHelloVersion = { + major: c.version.major, + minor: c.version.minor + }; + + // create supported cipher suites + var cipherSuites = forge.util.createBuffer(); + for(var i = 0; i < c.cipherSuites.length; ++i) { + var cs = c.cipherSuites[i]; + cipherSuites.putByte(cs.id[0]); + cipherSuites.putByte(cs.id[1]); + } + var cSuites = cipherSuites.length(); + + // create supported compression methods, null always supported, but + // also support deflate if connection has inflate and deflate methods + var compressionMethods = forge.util.createBuffer(); + compressionMethods.putByte(tls.CompressionMethod.none); + // FIXME: deflate support disabled until issues with raw deflate data + // without zlib headers are resolved + /* + if(c.inflate !== null && c.deflate !== null) { + compressionMethods.putByte(tls.CompressionMethod.deflate); + } + */ + var cMethods = compressionMethods.length(); + + // create TLS SNI (server name indication) extension if virtual host + // has been specified, see RFC 3546 + var extensions = forge.util.createBuffer(); + if(c.virtualHost) { + // create extension struct + var ext = forge.util.createBuffer(); + ext.putByte(0x00); // type server_name (ExtensionType is 2 bytes) + ext.putByte(0x00); + + /* In order to provide the server name, clients MAY include an + * extension of type "server_name" in the (extended) client hello. + * The "extension_data" field of this extension SHALL contain + * "ServerNameList" where: + * + * struct { + * NameType name_type; + * select(name_type) { + * case host_name: HostName; + * } name; + * } ServerName; + * + * enum { + * host_name(0), (255) + * } NameType; + * + * opaque HostName<1..2^16-1>; + * + * struct { + * ServerName server_name_list<1..2^16-1> + * } ServerNameList; + */ + var serverName = forge.util.createBuffer(); + serverName.putByte(0x00); // type host_name + writeVector(serverName, 2, forge.util.createBuffer(c.virtualHost)); + + // ServerNameList is in extension_data + var snList = forge.util.createBuffer(); + writeVector(snList, 2, serverName); + writeVector(ext, 2, snList); + extensions.putBuffer(ext); + } + var extLength = extensions.length(); + if(extLength > 0) { + // add extension vector length + extLength += 2; + } + + // determine length of the handshake message + // cipher suites and compression methods size will need to be + // updated if more get added to the list + var sessionId = c.session.id; + var length = + sessionId.length + 1 + // session ID vector + 2 + // version (major + minor) + 4 + 28 + // random time and random bytes + 2 + cSuites + // cipher suites vector + 1 + cMethods + // compression methods vector + extLength; // extensions vector + + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.client_hello); + rval.putInt24(length); // handshake length + rval.putByte(c.version.major); // major version + rval.putByte(c.version.minor); // minor version + rval.putBytes(c.session.sp.client_random); // random time + bytes + writeVector(rval, 1, forge.util.createBuffer(sessionId)); + writeVector(rval, 2, cipherSuites); + writeVector(rval, 1, compressionMethods); + if(extLength > 0) { + writeVector(rval, 2, extensions); + } + return rval; +}; + +/** + * Creates a ServerHello message. + * + * @param c the connection. + * + * @return the ServerHello byte buffer. + */ +tls.createServerHello = function(c) { + // determine length of the handshake message + var sessionId = c.session.id; + var length = + sessionId.length + 1 + // session ID vector + 2 + // version (major + minor) + 4 + 28 + // random time and random bytes + 2 + // chosen cipher suite + 1; // chosen compression method + + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.server_hello); + rval.putInt24(length); // handshake length + rval.putByte(c.version.major); // major version + rval.putByte(c.version.minor); // minor version + rval.putBytes(c.session.sp.server_random); // random time + bytes + writeVector(rval, 1, forge.util.createBuffer(sessionId)); + rval.putByte(c.session.cipherSuite.id[0]); + rval.putByte(c.session.cipherSuite.id[1]); + rval.putByte(c.session.compressionMethod); + return rval; +}; + +/** + * Creates a Certificate message. + * + * When this message will be sent: + * This is the first message the client can send after receiving a server + * hello done message and the first message the server can send after + * sending a ServerHello. This client message is only sent if the server + * requests a certificate. If no suitable certificate is available, the + * client should send a certificate message containing no certificates. If + * client authentication is required by the server for the handshake to + * continue, it may respond with a fatal handshake failure alert. + * + * opaque ASN.1Cert<1..2^24-1>; + * + * struct { + * ASN.1Cert certificate_list<0..2^24-1>; + * } Certificate; + * + * @param c the connection. + * + * @return the Certificate byte buffer. + */ +tls.createCertificate = function(c) { + // TODO: check certificate request to ensure types are supported + + // get a certificate (a certificate as a PEM string) + var client = (c.entity === tls.ConnectionEnd.client); + var cert = null; + if(c.getCertificate) { + var hint; + if(client) { + hint = c.session.certificateRequest; + } else { + hint = c.session.extensions.server_name.serverNameList; + } + cert = c.getCertificate(c, hint); + } + + // buffer to hold certificate list + var certList = forge.util.createBuffer(); + if(cert !== null) { + try { + // normalize cert to a chain of certificates + if(!forge.util.isArray(cert)) { + cert = [cert]; + } + var asn1 = null; + for(var i = 0; i < cert.length; ++i) { + var msg = forge.pem.decode(cert[i])[0]; + if(msg.type !== 'CERTIFICATE' && + msg.type !== 'X509 CERTIFICATE' && + msg.type !== 'TRUSTED CERTIFICATE') { + var error = new Error('Could not convert certificate from PEM; PEM ' + + 'header type is not "CERTIFICATE", "X509 CERTIFICATE", or ' + + '"TRUSTED CERTIFICATE".'); + error.headerType = msg.type; + throw error; + } + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error('Could not convert certificate from PEM; PEM is encrypted.'); + } + + var der = forge.util.createBuffer(msg.body); + if(asn1 === null) { + asn1 = forge.asn1.fromDer(der.bytes(), false); + } + + // certificate entry is itself a vector with 3 length bytes + var certBuffer = forge.util.createBuffer(); + writeVector(certBuffer, 3, der); + + // add cert vector to cert list vector + certList.putBuffer(certBuffer); + } + + // save certificate + cert = forge.pki.certificateFromAsn1(asn1); + if(client) { + c.session.clientCertificate = cert; + } else { + c.session.serverCertificate = cert; + } + } catch(ex) { + return c.error(c, { + message: 'Could not send certificate list.', + cause: ex, + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.bad_certificate + } + }); + } + } + + // determine length of the handshake message + var length = 3 + certList.length(); // cert list vector + + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.certificate); + rval.putInt24(length); + writeVector(rval, 3, certList); + return rval; +}; + +/** + * Creates a ClientKeyExchange message. + * + * When this message will be sent: + * This message is always sent by the client. It will immediately follow the + * client certificate message, if it is sent. Otherwise it will be the first + * message sent by the client after it receives the server hello done + * message. + * + * Meaning of this message: + * With this message, the premaster secret is set, either though direct + * transmission of the RSA-encrypted secret, or by the transmission of + * Diffie-Hellman parameters which will allow each side to agree upon the + * same premaster secret. When the key exchange method is DH_RSA or DH_DSS, + * client certification has been requested, and the client was able to + * respond with a certificate which contained a Diffie-Hellman public key + * whose parameters (group and generator) matched those specified by the + * server in its certificate, this message will not contain any data. + * + * Meaning of this message: + * If RSA is being used for key agreement and authentication, the client + * generates a 48-byte premaster secret, encrypts it using the public key + * from the server's certificate or the temporary RSA key provided in a + * server key exchange message, and sends the result in an encrypted + * premaster secret message. This structure is a variant of the client + * key exchange message, not a message in itself. + * + * struct { + * select(KeyExchangeAlgorithm) { + * case rsa: EncryptedPreMasterSecret; + * case diffie_hellman: ClientDiffieHellmanPublic; + * } exchange_keys; + * } ClientKeyExchange; + * + * struct { + * ProtocolVersion client_version; + * opaque random[46]; + * } PreMasterSecret; + * + * struct { + * public-key-encrypted PreMasterSecret pre_master_secret; + * } EncryptedPreMasterSecret; + * + * A public-key-encrypted element is encoded as a vector <0..2^16-1>. + * + * @param c the connection. + * + * @return the ClientKeyExchange byte buffer. + */ +tls.createClientKeyExchange = function(c) { + // create buffer to encrypt + var b = forge.util.createBuffer(); + + // add highest client-supported protocol to help server avoid version + // rollback attacks + b.putByte(c.session.clientHelloVersion.major); + b.putByte(c.session.clientHelloVersion.minor); + + // generate and add 46 random bytes + b.putBytes(forge.random.getBytes(46)); + + // save pre-master secret + var sp = c.session.sp; + sp.pre_master_secret = b.getBytes(); + + // RSA-encrypt the pre-master secret + var key = c.session.serverCertificate.publicKey; + b = key.encrypt(sp.pre_master_secret); + + /* Note: The encrypted pre-master secret will be stored in a + public-key-encrypted opaque vector that has the length prefixed using + 2 bytes, so include those 2 bytes in the handshake message length. This + is done as a minor optimization instead of calling writeVector(). */ + + // determine length of the handshake message + var length = b.length + 2; + + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.client_key_exchange); + rval.putInt24(length); + // add vector length bytes + rval.putInt16(b.length); + rval.putBytes(b); + return rval; +}; + +/** + * Creates a ServerKeyExchange message. + * + * @param c the connection. + * + * @return the ServerKeyExchange byte buffer. + */ +tls.createServerKeyExchange = function(c) { + // this implementation only supports RSA, no Diffie-Hellman support, + // so this record is empty + + // determine length of the handshake message + var length = 0; + + // build record fragment + var rval = forge.util.createBuffer(); + if(length > 0) { + rval.putByte(tls.HandshakeType.server_key_exchange); + rval.putInt24(length); + } + return rval; +}; + +/** + * Gets the signed data used to verify a client-side certificate. See + * tls.createCertificateVerify() for details. + * + * @param c the connection. + * @param callback the callback to call once the signed data is ready. + */ +tls.getClientSignature = function(c, callback) { + // generate data to RSA encrypt + var b = forge.util.createBuffer(); + b.putBuffer(c.session.md5.digest()); + b.putBuffer(c.session.sha1.digest()); + b = b.getBytes(); + + // create default signing function as necessary + c.getSignature = c.getSignature || function(c, b, callback) { + // do rsa encryption, call callback + var privateKey = null; + if(c.getPrivateKey) { + try { + privateKey = c.getPrivateKey(c, c.session.clientCertificate); + privateKey = forge.pki.privateKeyFromPem(privateKey); + } catch(ex) { + c.error(c, { + message: 'Could not get private key.', + cause: ex, + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.internal_error + } + }); + } + } + if(privateKey === null) { + c.error(c, { + message: 'No private key set.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.internal_error + } + }); + } else { + b = privateKey.sign(b, null); + } + callback(c, b); + }; + + // get client signature + c.getSignature(c, b, callback); +}; + +/** + * Creates a CertificateVerify message. + * + * Meaning of this message: + * This structure conveys the client's Diffie-Hellman public value + * (Yc) if it was not already included in the client's certificate. + * The encoding used for Yc is determined by the enumerated + * PublicValueEncoding. This structure is a variant of the client + * key exchange message, not a message in itself. + * + * When this message will be sent: + * This message is used to provide explicit verification of a client + * certificate. This message is only sent following a client + * certificate that has signing capability (i.e. all certificates + * except those containing fixed Diffie-Hellman parameters). When + * sent, it will immediately follow the client key exchange message. + * + * struct { + * Signature signature; + * } CertificateVerify; + * + * CertificateVerify.signature.md5_hash + * MD5(handshake_messages); + * + * Certificate.signature.sha_hash + * SHA(handshake_messages); + * + * Here handshake_messages refers to all handshake messages sent or + * received starting at client hello up to but not including this + * message, including the type and length fields of the handshake + * messages. + * + * select(SignatureAlgorithm) { + * case anonymous: struct { }; + * case rsa: + * digitally-signed struct { + * opaque md5_hash[16]; + * opaque sha_hash[20]; + * }; + * case dsa: + * digitally-signed struct { + * opaque sha_hash[20]; + * }; + * } Signature; + * + * In digital signing, one-way hash functions are used as input for a + * signing algorithm. A digitally-signed element is encoded as an opaque + * vector <0..2^16-1>, where the length is specified by the signing + * algorithm and key. + * + * In RSA signing, a 36-byte structure of two hashes (one SHA and one + * MD5) is signed (encrypted with the private key). It is encoded with + * PKCS #1 block type 0 or type 1 as described in [PKCS1]. + * + * In DSS, the 20 bytes of the SHA hash are run directly through the + * Digital Signing Algorithm with no additional hashing. + * + * @param c the connection. + * @param signature the signature to include in the message. + * + * @return the CertificateVerify byte buffer. + */ +tls.createCertificateVerify = function(c, signature) { + /* Note: The signature will be stored in a "digitally-signed" opaque + vector that has the length prefixed using 2 bytes, so include those + 2 bytes in the handshake message length. This is done as a minor + optimization instead of calling writeVector(). */ + + // determine length of the handshake message + var length = signature.length + 2; + + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.certificate_verify); + rval.putInt24(length); + // add vector length bytes + rval.putInt16(signature.length); + rval.putBytes(signature); + return rval; +}; + +/** + * Creates a CertificateRequest message. + * + * @param c the connection. + * + * @return the CertificateRequest byte buffer. + */ +tls.createCertificateRequest = function(c) { + // TODO: support other certificate types + var certTypes = forge.util.createBuffer(); + + // common RSA certificate type + certTypes.putByte(0x01); + + // add distinguished names from CA store + var cAs = forge.util.createBuffer(); + for(var key in c.caStore.certs) { + var cert = c.caStore.certs[key]; + var dn = forge.pki.distinguishedNameToAsn1(cert.subject); + var byteBuffer = forge.asn1.toDer(dn); + cAs.putInt16(byteBuffer.length()); + cAs.putBuffer(byteBuffer); + } + + // TODO: TLS 1.2+ has a different format + + // determine length of the handshake message + var length = + 1 + certTypes.length() + + 2 + cAs.length(); + + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.certificate_request); + rval.putInt24(length); + writeVector(rval, 1, certTypes); + writeVector(rval, 2, cAs); + return rval; +}; + +/** + * Creates a ServerHelloDone message. + * + * @param c the connection. + * + * @return the ServerHelloDone byte buffer. + */ +tls.createServerHelloDone = function(c) { + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.server_hello_done); + rval.putInt24(0); + return rval; +}; + +/** + * Creates a ChangeCipherSpec message. + * + * The change cipher spec protocol exists to signal transitions in + * ciphering strategies. The protocol consists of a single message, + * which is encrypted and compressed under the current (not the pending) + * connection state. The message consists of a single byte of value 1. + * + * struct { + * enum { change_cipher_spec(1), (255) } type; + * } ChangeCipherSpec; + * + * @return the ChangeCipherSpec byte buffer. + */ +tls.createChangeCipherSpec = function() { + var rval = forge.util.createBuffer(); + rval.putByte(0x01); + return rval; +}; + +/** + * Creates a Finished message. + * + * struct { + * opaque verify_data[12]; + * } Finished; + * + * verify_data + * PRF(master_secret, finished_label, MD5(handshake_messages) + + * SHA-1(handshake_messages)) [0..11]; + * + * finished_label + * For Finished messages sent by the client, the string "client + * finished". For Finished messages sent by the server, the + * string "server finished". + * + * handshake_messages + * All of the data from all handshake messages up to but not + * including this message. This is only data visible at the + * handshake layer and does not include record layer headers. + * This is the concatenation of all the Handshake structures as + * defined in 7.4 exchanged thus far. + * + * @param c the connection. + * + * @return the Finished byte buffer. + */ +tls.createFinished = function(c) { + // generate verify_data + var b = forge.util.createBuffer(); + b.putBuffer(c.session.md5.digest()); + b.putBuffer(c.session.sha1.digest()); + + // TODO: determine prf function and verify length for TLS 1.2 + var client = (c.entity === tls.ConnectionEnd.client); + var sp = c.session.sp; + var vdl = 12; + var prf = prf_TLS1; + var label = client ? 'client finished' : 'server finished'; + b = prf(sp.master_secret, label, b.getBytes(), vdl); + + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(tls.HandshakeType.finished); + rval.putInt24(b.length()); + rval.putBuffer(b); + return rval; +}; + +/** + * Creates a HeartbeatMessage (See RFC 6520). + * + * struct { + * HeartbeatMessageType type; + * uint16 payload_length; + * opaque payload[HeartbeatMessage.payload_length]; + * opaque padding[padding_length]; + * } HeartbeatMessage; + * + * The total length of a HeartbeatMessage MUST NOT exceed 2^14 or + * max_fragment_length when negotiated as defined in [RFC6066]. + * + * type: The message type, either heartbeat_request or heartbeat_response. + * + * payload_length: The length of the payload. + * + * payload: The payload consists of arbitrary content. + * + * padding: The padding is random content that MUST be ignored by the + * receiver. The length of a HeartbeatMessage is TLSPlaintext.length + * for TLS and DTLSPlaintext.length for DTLS. Furthermore, the + * length of the type field is 1 byte, and the length of the + * payload_length is 2. Therefore, the padding_length is + * TLSPlaintext.length - payload_length - 3 for TLS and + * DTLSPlaintext.length - payload_length - 3 for DTLS. The + * padding_length MUST be at least 16. + * + * The sender of a HeartbeatMessage MUST use a random padding of at + * least 16 bytes. The padding of a received HeartbeatMessage message + * MUST be ignored. + * + * If the payload_length of a received HeartbeatMessage is too large, + * the received HeartbeatMessage MUST be discarded silently. + * + * @param c the connection. + * @param type the tls.HeartbeatMessageType. + * @param payload the heartbeat data to send as the payload. + * @param [payloadLength] the payload length to use, defaults to the + * actual payload length. + * + * @return the HeartbeatRequest byte buffer. + */ +tls.createHeartbeat = function(type, payload, payloadLength) { + if(typeof payloadLength === 'undefined') { + payloadLength = payload.length; + } + // build record fragment + var rval = forge.util.createBuffer(); + rval.putByte(type); // heartbeat message type + rval.putInt16(payloadLength); // payload length + rval.putBytes(payload); // payload + // padding + var plaintextLength = rval.length(); + var paddingLength = Math.max(16, plaintextLength - payloadLength - 3); + rval.putBytes(forge.random.getBytes(paddingLength)); + return rval; +}; + +/** + * Fragments, compresses, encrypts, and queues a record for delivery. + * + * @param c the connection. + * @param record the record to queue. + */ +tls.queue = function(c, record) { + // error during record creation + if(!record) { + return; + } + + if(record.fragment.length() === 0) { + if(record.type === tls.ContentType.handshake || + record.type === tls.ContentType.alert || + record.type === tls.ContentType.change_cipher_spec) { + // Empty handshake, alert of change cipher spec messages are not allowed per the TLS specification and should not be sent. + return; + } + } + + // if the record is a handshake record, update handshake hashes + if(record.type === tls.ContentType.handshake) { + var bytes = record.fragment.bytes(); + c.session.md5.update(bytes); + c.session.sha1.update(bytes); + bytes = null; + } + + // handle record fragmentation + var records; + if(record.fragment.length() <= tls.MaxFragment) { + records = [record]; + } else { + // fragment data as long as it is too long + records = []; + var data = record.fragment.bytes(); + while(data.length > tls.MaxFragment) { + records.push(tls.createRecord(c, { + type: record.type, + data: forge.util.createBuffer(data.slice(0, tls.MaxFragment)) + })); + data = data.slice(tls.MaxFragment); + } + // add last record + if(data.length > 0) { + records.push(tls.createRecord(c, { + type: record.type, + data: forge.util.createBuffer(data) + })); + } + } + + // compress and encrypt all fragmented records + for(var i = 0; i < records.length && !c.fail; ++i) { + // update the record using current write state + var rec = records[i]; + var s = c.state.current.write; + if(s.update(c, rec)) { + // store record + c.records.push(rec); + } + } +}; + +/** + * Flushes all queued records to the output buffer and calls the + * tlsDataReady() handler on the given connection. + * + * @param c the connection. + * + * @return true on success, false on failure. + */ +tls.flush = function(c) { + for(var i = 0; i < c.records.length; ++i) { + var record = c.records[i]; + + // add record header and fragment + c.tlsData.putByte(record.type); + c.tlsData.putByte(record.version.major); + c.tlsData.putByte(record.version.minor); + c.tlsData.putInt16(record.fragment.length()); + c.tlsData.putBuffer(c.records[i].fragment); + } + c.records = []; + return c.tlsDataReady(c); +}; + +/** + * Maps a pki.certificateError to a tls.Alert.Description. + * + * @param error the error to map. + * + * @return the alert description. + */ +var _certErrorToAlertDesc = function(error) { + switch(error) { + case true: + return true; + case forge.pki.certificateError.bad_certificate: + return tls.Alert.Description.bad_certificate; + case forge.pki.certificateError.unsupported_certificate: + return tls.Alert.Description.unsupported_certificate; + case forge.pki.certificateError.certificate_revoked: + return tls.Alert.Description.certificate_revoked; + case forge.pki.certificateError.certificate_expired: + return tls.Alert.Description.certificate_expired; + case forge.pki.certificateError.certificate_unknown: + return tls.Alert.Description.certificate_unknown; + case forge.pki.certificateError.unknown_ca: + return tls.Alert.Description.unknown_ca; + default: + return tls.Alert.Description.bad_certificate; + } +}; + +/** + * Maps a tls.Alert.Description to a pki.certificateError. + * + * @param desc the alert description. + * + * @return the certificate error. + */ +var _alertDescToCertError = function(desc) { + switch(desc) { + case true: + return true; + case tls.Alert.Description.bad_certificate: + return forge.pki.certificateError.bad_certificate; + case tls.Alert.Description.unsupported_certificate: + return forge.pki.certificateError.unsupported_certificate; + case tls.Alert.Description.certificate_revoked: + return forge.pki.certificateError.certificate_revoked; + case tls.Alert.Description.certificate_expired: + return forge.pki.certificateError.certificate_expired; + case tls.Alert.Description.certificate_unknown: + return forge.pki.certificateError.certificate_unknown; + case tls.Alert.Description.unknown_ca: + return forge.pki.certificateError.unknown_ca; + default: + return forge.pki.certificateError.bad_certificate; + } +}; + +/** + * Verifies a certificate chain against the given connection's + * Certificate Authority store. + * + * @param c the TLS connection. + * @param chain the certificate chain to verify, with the root or highest + * authority at the end. + * + * @return true if successful, false if not. + */ +tls.verifyCertificateChain = function(c, chain) { + try { + // Make a copy of c.verifyOptions so that we can modify options.verify + // without modifying c.verifyOptions. + var options = {}; + for (var key in c.verifyOptions) { + options[key] = c.verifyOptions[key]; + } + + options.verify = function(vfd, depth, chain) { + // convert pki.certificateError to tls alert description + var desc = _certErrorToAlertDesc(vfd); + + // call application callback + var ret = c.verify(c, vfd, depth, chain); + if(ret !== true) { + if(typeof ret === 'object' && !forge.util.isArray(ret)) { + // throw custom error + var error = new Error('The application rejected the certificate.'); + error.send = true; + error.alert = { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.bad_certificate + }; + if(ret.message) { + error.message = ret.message; + } + if(ret.alert) { + error.alert.description = ret.alert; + } + throw error; + } + + // convert tls alert description to pki.certificateError + if(ret !== vfd) { + ret = _alertDescToCertError(ret); + } + } + + return ret; + }; + + // verify chain + forge.pki.verifyCertificateChain(c.caStore, chain, options); + } catch(ex) { + // build tls error if not already customized + var err = ex; + if(typeof err !== 'object' || forge.util.isArray(err)) { + err = { + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: _certErrorToAlertDesc(ex) + } + }; + } + if(!('send' in err)) { + err.send = true; + } + if(!('alert' in err)) { + err.alert = { + level: tls.Alert.Level.fatal, + description: _certErrorToAlertDesc(err.error) + }; + } + + // send error + c.error(c, err); + } + + return !c.fail; +}; + +/** + * Creates a new TLS session cache. + * + * @param cache optional map of session ID to cached session. + * @param capacity the maximum size for the cache (default: 100). + * + * @return the new TLS session cache. + */ +tls.createSessionCache = function(cache, capacity) { + var rval = null; + + // assume input is already a session cache object + if(cache && cache.getSession && cache.setSession && cache.order) { + rval = cache; + } else { + // create cache + rval = {}; + rval.cache = cache || {}; + rval.capacity = Math.max(capacity || 100, 1); + rval.order = []; + + // store order for sessions, delete session overflow + for(var key in cache) { + if(rval.order.length <= capacity) { + rval.order.push(key); + } else { + delete cache[key]; + } + } + + // get a session from a session ID (or get any session) + rval.getSession = function(sessionId) { + var session = null; + var key = null; + + // if session ID provided, use it + if(sessionId) { + key = forge.util.bytesToHex(sessionId); + } else if(rval.order.length > 0) { + // get first session from cache + key = rval.order[0]; + } + + if(key !== null && key in rval.cache) { + // get cached session and remove from cache + session = rval.cache[key]; + delete rval.cache[key]; + for(var i in rval.order) { + if(rval.order[i] === key) { + rval.order.splice(i, 1); + break; + } + } + } + + return session; + }; + + // set a session in the cache + rval.setSession = function(sessionId, session) { + // remove session from cache if at capacity + if(rval.order.length === rval.capacity) { + var key = rval.order.shift(); + delete rval.cache[key]; + } + // add session to cache + var key = forge.util.bytesToHex(sessionId); + rval.order.push(key); + rval.cache[key] = session; + }; + } + + return rval; +}; + +/** + * Creates a new TLS connection. + * + * See public createConnection() docs for more details. + * + * @param options the options for this connection. + * + * @return the new TLS connection. + */ +tls.createConnection = function(options) { + var caStore = null; + if(options.caStore) { + // if CA store is an array, convert it to a CA store object + if(forge.util.isArray(options.caStore)) { + caStore = forge.pki.createCaStore(options.caStore); + } else { + caStore = options.caStore; + } + } else { + // create empty CA store + caStore = forge.pki.createCaStore(); + } + + // setup default cipher suites + var cipherSuites = options.cipherSuites || null; + if(cipherSuites === null) { + cipherSuites = []; + for(var key in tls.CipherSuites) { + cipherSuites.push(tls.CipherSuites[key]); + } + } + + // set default entity + var entity = (options.server || false) ? + tls.ConnectionEnd.server : tls.ConnectionEnd.client; + + // create session cache if requested + var sessionCache = options.sessionCache ? + tls.createSessionCache(options.sessionCache) : null; + + // create TLS connection + var c = { + version: {major: tls.Version.major, minor: tls.Version.minor}, + entity: entity, + sessionId: options.sessionId, + caStore: caStore, + sessionCache: sessionCache, + cipherSuites: cipherSuites, + connected: options.connected, + virtualHost: options.virtualHost || null, + verifyClient: options.verifyClient || false, + verify: options.verify || function(cn, vfd, dpth, cts) {return vfd;}, + verifyOptions: options.verifyOptions || {}, + getCertificate: options.getCertificate || null, + getPrivateKey: options.getPrivateKey || null, + getSignature: options.getSignature || null, + input: forge.util.createBuffer(), + tlsData: forge.util.createBuffer(), + data: forge.util.createBuffer(), + tlsDataReady: options.tlsDataReady, + dataReady: options.dataReady, + heartbeatReceived: options.heartbeatReceived, + closed: options.closed, + error: function(c, ex) { + // set origin if not set + ex.origin = ex.origin || + ((c.entity === tls.ConnectionEnd.client) ? 'client' : 'server'); + + // send TLS alert + if(ex.send) { + tls.queue(c, tls.createAlert(c, ex.alert)); + tls.flush(c); + } + + // error is fatal by default + var fatal = (ex.fatal !== false); + if(fatal) { + // set fail flag + c.fail = true; + } + + // call error handler first + options.error(c, ex); + + if(fatal) { + // fatal error, close connection, do not clear fail + c.close(false); + } + }, + deflate: options.deflate || null, + inflate: options.inflate || null + }; + + /** + * Resets a closed TLS connection for reuse. Called in c.close(). + * + * @param clearFail true to clear the fail flag (default: true). + */ + c.reset = function(clearFail) { + c.version = {major: tls.Version.major, minor: tls.Version.minor}; + c.record = null; + c.session = null; + c.peerCertificate = null; + c.state = { + pending: null, + current: null + }; + c.expect = (c.entity === tls.ConnectionEnd.client) ? SHE : CHE; + c.fragmented = null; + c.records = []; + c.open = false; + c.handshakes = 0; + c.handshaking = false; + c.isConnected = false; + c.fail = !(clearFail || typeof(clearFail) === 'undefined'); + c.input.clear(); + c.tlsData.clear(); + c.data.clear(); + c.state.current = tls.createConnectionState(c); + }; + + // do initial reset of connection + c.reset(); + + /** + * Updates the current TLS engine state based on the given record. + * + * @param c the TLS connection. + * @param record the TLS record to act on. + */ + var _update = function(c, record) { + // get record handler (align type in table by subtracting lowest) + var aligned = record.type - tls.ContentType.change_cipher_spec; + var handlers = ctTable[c.entity][c.expect]; + if(aligned in handlers) { + handlers[aligned](c, record); + } else { + // unexpected record + tls.handleUnexpected(c, record); + } + }; + + /** + * Reads the record header and initializes the next record on the given + * connection. + * + * @param c the TLS connection with the next record. + * + * @return 0 if the input data could be processed, otherwise the + * number of bytes required for data to be processed. + */ + var _readRecordHeader = function(c) { + var rval = 0; + + // get input buffer and its length + var b = c.input; + var len = b.length(); + + // need at least 5 bytes to initialize a record + if(len < 5) { + rval = 5 - len; + } else { + // enough bytes for header + // initialize record + c.record = { + type: b.getByte(), + version: { + major: b.getByte(), + minor: b.getByte() + }, + length: b.getInt16(), + fragment: forge.util.createBuffer(), + ready: false + }; + + // check record version + var compatibleVersion = (c.record.version.major === c.version.major); + if(compatibleVersion && c.session && c.session.version) { + // session version already set, require same minor version + compatibleVersion = (c.record.version.minor === c.version.minor); + } + if(!compatibleVersion) { + c.error(c, { + message: 'Incompatible TLS version.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: tls.Alert.Description.protocol_version + } + }); + } + } + + return rval; + }; + + /** + * Reads the next record's contents and appends its message to any + * previously fragmented message. + * + * @param c the TLS connection with the next record. + * + * @return 0 if the input data could be processed, otherwise the + * number of bytes required for data to be processed. + */ + var _readRecord = function(c) { + var rval = 0; + + // ensure there is enough input data to get the entire record + var b = c.input; + var len = b.length(); + if(len < c.record.length) { + // not enough data yet, return how much is required + rval = c.record.length - len; + } else { + // there is enough data to parse the pending record + // fill record fragment and compact input buffer + c.record.fragment.putBytes(b.getBytes(c.record.length)); + b.compact(); + + // update record using current read state + var s = c.state.current.read; + if(s.update(c, c.record)) { + // see if there is a previously fragmented message that the + // new record's message fragment should be appended to + if(c.fragmented !== null) { + // if the record type matches a previously fragmented + // record, append the record fragment to it + if(c.fragmented.type === c.record.type) { + // concatenate record fragments + c.fragmented.fragment.putBuffer(c.record.fragment); + c.record = c.fragmented; + } else { + // error, invalid fragmented record + c.error(c, { + message: 'Invalid fragmented record.', + send: true, + alert: { + level: tls.Alert.Level.fatal, + description: + tls.Alert.Description.unexpected_message + } + }); + } + } + + // record is now ready + c.record.ready = true; + } + } + + return rval; + }; + + /** + * Performs a handshake using the TLS Handshake Protocol, as a client. + * + * This method should only be called if the connection is in client mode. + * + * @param sessionId the session ID to use, null to start a new one. + */ + c.handshake = function(sessionId) { + // error to call this in non-client mode + if(c.entity !== tls.ConnectionEnd.client) { + // not fatal error + c.error(c, { + message: 'Cannot initiate handshake as a server.', + fatal: false + }); + } else if(c.handshaking) { + // handshake is already in progress, fail but not fatal error + c.error(c, { + message: 'Handshake already in progress.', + fatal: false + }); + } else { + // clear fail flag on reuse + if(c.fail && !c.open && c.handshakes === 0) { + c.fail = false; + } + + // now handshaking + c.handshaking = true; + + // default to blank (new session) + sessionId = sessionId || ''; + + // if a session ID was specified, try to find it in the cache + var session = null; + if(sessionId.length > 0) { + if(c.sessionCache) { + session = c.sessionCache.getSession(sessionId); + } + + // matching session not found in cache, clear session ID + if(session === null) { + sessionId = ''; + } + } + + // no session given, grab a session from the cache, if available + if(sessionId.length === 0 && c.sessionCache) { + session = c.sessionCache.getSession(); + if(session !== null) { + sessionId = session.id; + } + } + + // set up session + c.session = { + id: sessionId, + version: null, + cipherSuite: null, + compressionMethod: null, + serverCertificate: null, + certificateRequest: null, + clientCertificate: null, + sp: {}, + md5: forge.md.md5.create(), + sha1: forge.md.sha1.create() + }; + + // use existing session information + if(session) { + // only update version on connection, session version not yet set + c.version = session.version; + c.session.sp = session.sp; + } + + // generate new client random + c.session.sp.client_random = tls.createRandom().getBytes(); + + // connection now open + c.open = true; + + // send hello + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.handshake, + data: tls.createClientHello(c) + })); + tls.flush(c); + } + }; + + /** + * Called when TLS protocol data has been received from somewhere and should + * be processed by the TLS engine. + * + * @param data the TLS protocol data, as a string, to process. + * + * @return 0 if the data could be processed, otherwise the number of bytes + * required for data to be processed. + */ + c.process = function(data) { + var rval = 0; + + // buffer input data + if(data) { + c.input.putBytes(data); + } + + // process next record if no failure, process will be called after + // each record is handled (since handling can be asynchronous) + if(!c.fail) { + // reset record if ready and now empty + if(c.record !== null && + c.record.ready && c.record.fragment.isEmpty()) { + c.record = null; + } + + // if there is no pending record, try to read record header + if(c.record === null) { + rval = _readRecordHeader(c); + } + + // read the next record (if record not yet ready) + if(!c.fail && c.record !== null && !c.record.ready) { + rval = _readRecord(c); + } + + // record ready to be handled, update engine state + if(!c.fail && c.record !== null && c.record.ready) { + _update(c, c.record); + } + } + + return rval; + }; + + /** + * Requests that application data be packaged into a TLS record. The + * tlsDataReady handler will be called when the TLS record(s) have been + * prepared. + * + * @param data the application data, as a raw 'binary' encoded string, to + * be sent; to send utf-16/utf-8 string data, use the return value + * of util.encodeUtf8(str). + * + * @return true on success, false on failure. + */ + c.prepare = function(data) { + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.application_data, + data: forge.util.createBuffer(data) + })); + return tls.flush(c); + }; + + /** + * Requests that a heartbeat request be packaged into a TLS record for + * transmission. The tlsDataReady handler will be called when TLS record(s) + * have been prepared. + * + * When a heartbeat response has been received, the heartbeatReceived + * handler will be called with the matching payload. This handler can + * be used to clear a retransmission timer, etc. + * + * @param payload the heartbeat data to send as the payload in the message. + * @param [payloadLength] the payload length to use, defaults to the + * actual payload length. + * + * @return true on success, false on failure. + */ + c.prepareHeartbeatRequest = function(payload, payloadLength) { + if(payload instanceof forge.util.ByteBuffer) { + payload = payload.bytes(); + } + if(typeof payloadLength === 'undefined') { + payloadLength = payload.length; + } + c.expectedHeartbeatPayload = payload; + tls.queue(c, tls.createRecord(c, { + type: tls.ContentType.heartbeat, + data: tls.createHeartbeat( + tls.HeartbeatMessageType.heartbeat_request, payload, payloadLength) + })); + return tls.flush(c); + }; + + /** + * Closes the connection (sends a close_notify alert). + * + * @param clearFail true to clear the fail flag (default: true). + */ + c.close = function(clearFail) { + // save session if connection didn't fail + if(!c.fail && c.sessionCache && c.session) { + // only need to preserve session ID, version, and security params + var session = { + id: c.session.id, + version: c.session.version, + sp: c.session.sp + }; + session.sp.keys = null; + c.sessionCache.setSession(session.id, session); + } + + if(c.open) { + // connection no longer open, clear input + c.open = false; + c.input.clear(); + + // if connected or handshaking, send an alert + if(c.isConnected || c.handshaking) { + c.isConnected = c.handshaking = false; + + // send close_notify alert + tls.queue(c, tls.createAlert(c, { + level: tls.Alert.Level.warning, + description: tls.Alert.Description.close_notify + })); + tls.flush(c); + } + + // call handler + c.closed(c); + } + + // reset TLS connection, do not clear fail flag + c.reset(clearFail); + }; + + return c; +}; + +/* TLS API */ +module.exports = forge.tls = forge.tls || {}; + +// expose non-functions +for(var key in tls) { + if(typeof tls[key] !== 'function') { + forge.tls[key] = tls[key]; + } +} + +// expose prf_tls1 for testing +forge.tls.prf_tls1 = prf_TLS1; + +// expose sha1 hmac method +forge.tls.hmac_sha1 = hmac_sha1; + +// expose session cache creation +forge.tls.createSessionCache = tls.createSessionCache; + +/** + * Creates a new TLS connection. This does not make any assumptions about the + * transport layer that TLS is working on top of, ie: it does not assume there + * is a TCP/IP connection or establish one. A TLS connection is totally + * abstracted away from the layer is runs on top of, it merely establishes a + * secure channel between a client" and a "server". + * + * A TLS connection contains 4 connection states: pending read and write, and + * current read and write. + * + * At initialization, the current read and write states will be null. Only once + * the security parameters have been set and the keys have been generated can + * the pending states be converted into current states. Current states will be + * updated for each record processed. + * + * A custom certificate verify callback may be provided to check information + * like the common name on the server's certificate. It will be called for + * every certificate in the chain. It has the following signature: + * + * variable func(c, certs, index, preVerify) + * Where: + * c The TLS connection + * verified Set to true if certificate was verified, otherwise the alert + * tls.Alert.Description for why the certificate failed. + * depth The current index in the chain, where 0 is the server's cert. + * certs The certificate chain, *NOTE* if the server was anonymous then + * the chain will be empty. + * + * The function returns true on success and on failure either the appropriate + * tls.Alert.Description or an object with 'alert' set to the appropriate + * tls.Alert.Description and 'message' set to a custom error message. If true + * is not returned then the connection will abort using, in order of + * availability, first the returned alert description, second the preVerify + * alert description, and lastly the default 'bad_certificate'. + * + * There are three callbacks that can be used to make use of client-side + * certificates where each takes the TLS connection as the first parameter: + * + * getCertificate(conn, hint) + * The second parameter is a hint as to which certificate should be + * returned. If the connection entity is a client, then the hint will be + * the CertificateRequest message from the server that is part of the + * TLS protocol. If the connection entity is a server, then it will be + * the servername list provided via an SNI extension the ClientHello, if + * one was provided (empty array if not). The hint can be examined to + * determine which certificate to use (advanced). Most implementations + * will just return a certificate. The return value must be a + * PEM-formatted certificate or an array of PEM-formatted certificates + * that constitute a certificate chain, with the first in the array/chain + * being the client's certificate. + * getPrivateKey(conn, certificate) + * The second parameter is an forge.pki X.509 certificate object that + * is associated with the requested private key. The return value must + * be a PEM-formatted private key. + * getSignature(conn, bytes, callback) + * This callback can be used instead of getPrivateKey if the private key + * is not directly accessible in javascript or should not be. For + * instance, a secure external web service could provide the signature + * in exchange for appropriate credentials. The second parameter is a + * string of bytes to be signed that are part of the TLS protocol. These + * bytes are used to verify that the private key for the previously + * provided client-side certificate is accessible to the client. The + * callback is a function that takes 2 parameters, the TLS connection + * and the RSA encrypted (signed) bytes as a string. This callback must + * be called once the signature is ready. + * + * @param options the options for this connection: + * server: true if the connection is server-side, false for client. + * sessionId: a session ID to reuse, null for a new connection. + * caStore: an array of certificates to trust. + * sessionCache: a session cache to use. + * cipherSuites: an optional array of cipher suites to use, + * see tls.CipherSuites. + * connected: function(conn) called when the first handshake completes. + * virtualHost: the virtual server name to use in a TLS SNI extension. + * verifyClient: true to require a client certificate in server mode, + * 'optional' to request one, false not to (default: false). + * verify: a handler used to custom verify certificates in the chain. + * verifyOptions: an object with options for the certificate chain validation. + * See documentation of pki.verifyCertificateChain for possible options. + * verifyOptions.verify is ignored. If you wish to specify a verify handler + * use the verify key. + * getCertificate: an optional callback used to get a certificate or + * a chain of certificates (as an array). + * getPrivateKey: an optional callback used to get a private key. + * getSignature: an optional callback used to get a signature. + * tlsDataReady: function(conn) called when TLS protocol data has been + * prepared and is ready to be used (typically sent over a socket + * connection to its destination), read from conn.tlsData buffer. + * dataReady: function(conn) called when application data has + * been parsed from a TLS record and should be consumed by the + * application, read from conn.data buffer. + * closed: function(conn) called when the connection has been closed. + * error: function(conn, error) called when there was an error. + * deflate: function(inBytes) if provided, will deflate TLS records using + * the deflate algorithm if the server supports it. + * inflate: function(inBytes) if provided, will inflate TLS records using + * the deflate algorithm if the server supports it. + * + * @return the new TLS connection. + */ +forge.tls.createConnection = tls.createConnection; + + +/***/ }), + +/***/ 7116: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var process = __webpack_require__(4155); +/** + * Utility functions for web applications. + * + * @author Dave Longley + * + * Copyright (c) 2010-2018 Digital Bazaar, Inc. + */ +var forge = __webpack_require__(3832); +var baseN = __webpack_require__(8807); + +/* Utilities API */ +var util = module.exports = forge.util = forge.util || {}; + +// define setImmediate and nextTick +(function() { + // use native nextTick (unless we're in webpack) + // webpack (or better node-libs-browser polyfill) sets process.browser. + // this way we can detect webpack properly + if(typeof process !== 'undefined' && process.nextTick && !process.browser) { + util.nextTick = process.nextTick; + if(typeof setImmediate === 'function') { + util.setImmediate = setImmediate; + } else { + // polyfill setImmediate with nextTick, older versions of node + // (those w/o setImmediate) won't totally starve IO + util.setImmediate = util.nextTick; + } + return; + } + + // polyfill nextTick with native setImmediate + if(typeof setImmediate === 'function') { + util.setImmediate = function() { return setImmediate.apply(undefined, arguments); }; + util.nextTick = function(callback) { + return setImmediate(callback); + }; + return; + } + + /* Note: A polyfill upgrade pattern is used here to allow combining + polyfills. For example, MutationObserver is fast, but blocks UI updates, + so it needs to allow UI updates periodically, so it falls back on + postMessage or setTimeout. */ + + // polyfill with setTimeout + util.setImmediate = function(callback) { + setTimeout(callback, 0); + }; + + // upgrade polyfill to use postMessage + if(typeof window !== 'undefined' && + typeof window.postMessage === 'function') { + var msg = 'forge.setImmediate'; + var callbacks = []; + util.setImmediate = function(callback) { + callbacks.push(callback); + // only send message when one hasn't been sent in + // the current turn of the event loop + if(callbacks.length === 1) { + window.postMessage(msg, '*'); + } + }; + function handler(event) { + if(event.source === window && event.data === msg) { + event.stopPropagation(); + var copy = callbacks.slice(); + callbacks.length = 0; + copy.forEach(function(callback) { + callback(); + }); + } + } + window.addEventListener('message', handler, true); + } + + // upgrade polyfill to use MutationObserver + if(typeof MutationObserver !== 'undefined') { + // polyfill with MutationObserver + var now = Date.now(); + var attr = true; + var div = document.createElement('div'); + var callbacks = []; + new MutationObserver(function() { + var copy = callbacks.slice(); + callbacks.length = 0; + copy.forEach(function(callback) { + callback(); + }); + }).observe(div, {attributes: true}); + var oldSetImmediate = util.setImmediate; + util.setImmediate = function(callback) { + if(Date.now() - now > 15) { + now = Date.now(); + oldSetImmediate(callback); + } else { + callbacks.push(callback); + // only trigger observer when it hasn't been triggered in + // the current turn of the event loop + if(callbacks.length === 1) { + div.setAttribute('a', attr = !attr); + } + } + }; + } + + util.nextTick = util.setImmediate; +})(); + +// check if running under Node.js +util.isNodejs = + typeof process !== 'undefined' && process.versions && process.versions.node; + + +// 'self' will also work in Web Workers (instance of WorkerGlobalScope) while +// it will point to `window` in the main thread. +// To remain compatible with older browsers, we fall back to 'window' if 'self' +// is not available. +util.globalScope = (function() { + if(util.isNodejs) { + return __webpack_require__.g; + } + + return typeof self === 'undefined' ? window : self; +})(); + +// define isArray +util.isArray = Array.isArray || function(x) { + return Object.prototype.toString.call(x) === '[object Array]'; +}; + +// define isArrayBuffer +util.isArrayBuffer = function(x) { + return typeof ArrayBuffer !== 'undefined' && x instanceof ArrayBuffer; +}; + +// define isArrayBufferView +util.isArrayBufferView = function(x) { + return x && util.isArrayBuffer(x.buffer) && x.byteLength !== undefined; +}; + +/** + * Ensure a bits param is 8, 16, 24, or 32. Used to validate input for + * algorithms where bit manipulation, JavaScript limitations, and/or algorithm + * design only allow for byte operations of a limited size. + * + * @param n number of bits. + * + * Throw Error if n invalid. + */ +function _checkBitsParam(n) { + if(!(n === 8 || n === 16 || n === 24 || n === 32)) { + throw new Error('Only 8, 16, 24, or 32 bits supported: ' + n); + } +} + +// TODO: set ByteBuffer to best available backing +util.ByteBuffer = ByteStringBuffer; + +/** Buffer w/BinaryString backing */ + +/** + * Constructor for a binary string backed byte buffer. + * + * @param [b] the bytes to wrap (either encoded as string, one byte per + * character, or as an ArrayBuffer or Typed Array). + */ +function ByteStringBuffer(b) { + // TODO: update to match DataBuffer API + + // the data in this buffer + this.data = ''; + // the pointer for reading from this buffer + this.read = 0; + + if(typeof b === 'string') { + this.data = b; + } else if(util.isArrayBuffer(b) || util.isArrayBufferView(b)) { + if(typeof Buffer !== 'undefined' && b instanceof Buffer) { + this.data = b.toString('binary'); + } else { + // convert native buffer to forge buffer + // FIXME: support native buffers internally instead + var arr = new Uint8Array(b); + try { + this.data = String.fromCharCode.apply(null, arr); + } catch(e) { + for(var i = 0; i < arr.length; ++i) { + this.putByte(arr[i]); + } + } + } + } else if(b instanceof ByteStringBuffer || + (typeof b === 'object' && typeof b.data === 'string' && + typeof b.read === 'number')) { + // copy existing buffer + this.data = b.data; + this.read = b.read; + } + + // used for v8 optimization + this._constructedStringLength = 0; +} +util.ByteStringBuffer = ByteStringBuffer; + +/* Note: This is an optimization for V8-based browsers. When V8 concatenates + a string, the strings are only joined logically using a "cons string" or + "constructed/concatenated string". These containers keep references to one + another and can result in very large memory usage. For example, if a 2MB + string is constructed by concatenating 4 bytes together at a time, the + memory usage will be ~44MB; so ~22x increase. The strings are only joined + together when an operation requiring their joining takes place, such as + substr(). This function is called when adding data to this buffer to ensure + these types of strings are periodically joined to reduce the memory + footprint. */ +var _MAX_CONSTRUCTED_STRING_LENGTH = 4096; +util.ByteStringBuffer.prototype._optimizeConstructedString = function(x) { + this._constructedStringLength += x; + if(this._constructedStringLength > _MAX_CONSTRUCTED_STRING_LENGTH) { + // this substr() should cause the constructed string to join + this.data.substr(0, 1); + this._constructedStringLength = 0; + } +}; + +/** + * Gets the number of bytes in this buffer. + * + * @return the number of bytes in this buffer. + */ +util.ByteStringBuffer.prototype.length = function() { + return this.data.length - this.read; +}; + +/** + * Gets whether or not this buffer is empty. + * + * @return true if this buffer is empty, false if not. + */ +util.ByteStringBuffer.prototype.isEmpty = function() { + return this.length() <= 0; +}; + +/** + * Puts a byte in this buffer. + * + * @param b the byte to put. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putByte = function(b) { + return this.putBytes(String.fromCharCode(b)); +}; + +/** + * Puts a byte in this buffer N times. + * + * @param b the byte to put. + * @param n the number of bytes of value b to put. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.fillWithByte = function(b, n) { + b = String.fromCharCode(b); + var d = this.data; + while(n > 0) { + if(n & 1) { + d += b; + } + n >>>= 1; + if(n > 0) { + b += b; + } + } + this.data = d; + this._optimizeConstructedString(n); + return this; +}; + +/** + * Puts bytes in this buffer. + * + * @param bytes the bytes (as a binary encoded string) to put. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putBytes = function(bytes) { + this.data += bytes; + this._optimizeConstructedString(bytes.length); + return this; +}; + +/** + * Puts a UTF-16 encoded string into this buffer. + * + * @param str the string to put. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putString = function(str) { + return this.putBytes(util.encodeUtf8(str)); +}; + +/** + * Puts a 16-bit integer in this buffer in big-endian order. + * + * @param i the 16-bit integer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putInt16 = function(i) { + return this.putBytes( + String.fromCharCode(i >> 8 & 0xFF) + + String.fromCharCode(i & 0xFF)); +}; + +/** + * Puts a 24-bit integer in this buffer in big-endian order. + * + * @param i the 24-bit integer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putInt24 = function(i) { + return this.putBytes( + String.fromCharCode(i >> 16 & 0xFF) + + String.fromCharCode(i >> 8 & 0xFF) + + String.fromCharCode(i & 0xFF)); +}; + +/** + * Puts a 32-bit integer in this buffer in big-endian order. + * + * @param i the 32-bit integer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putInt32 = function(i) { + return this.putBytes( + String.fromCharCode(i >> 24 & 0xFF) + + String.fromCharCode(i >> 16 & 0xFF) + + String.fromCharCode(i >> 8 & 0xFF) + + String.fromCharCode(i & 0xFF)); +}; + +/** + * Puts a 16-bit integer in this buffer in little-endian order. + * + * @param i the 16-bit integer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putInt16Le = function(i) { + return this.putBytes( + String.fromCharCode(i & 0xFF) + + String.fromCharCode(i >> 8 & 0xFF)); +}; + +/** + * Puts a 24-bit integer in this buffer in little-endian order. + * + * @param i the 24-bit integer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putInt24Le = function(i) { + return this.putBytes( + String.fromCharCode(i & 0xFF) + + String.fromCharCode(i >> 8 & 0xFF) + + String.fromCharCode(i >> 16 & 0xFF)); +}; + +/** + * Puts a 32-bit integer in this buffer in little-endian order. + * + * @param i the 32-bit integer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putInt32Le = function(i) { + return this.putBytes( + String.fromCharCode(i & 0xFF) + + String.fromCharCode(i >> 8 & 0xFF) + + String.fromCharCode(i >> 16 & 0xFF) + + String.fromCharCode(i >> 24 & 0xFF)); +}; + +/** + * Puts an n-bit integer in this buffer in big-endian order. + * + * @param i the n-bit integer. + * @param n the number of bits in the integer (8, 16, 24, or 32). + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putInt = function(i, n) { + _checkBitsParam(n); + var bytes = ''; + do { + n -= 8; + bytes += String.fromCharCode((i >> n) & 0xFF); + } while(n > 0); + return this.putBytes(bytes); +}; + +/** + * Puts a signed n-bit integer in this buffer in big-endian order. Two's + * complement representation is used. + * + * @param i the n-bit integer. + * @param n the number of bits in the integer (8, 16, 24, or 32). + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putSignedInt = function(i, n) { + // putInt checks n + if(i < 0) { + i += 2 << (n - 1); + } + return this.putInt(i, n); +}; + +/** + * Puts the given buffer into this buffer. + * + * @param buffer the buffer to put into this one. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.putBuffer = function(buffer) { + return this.putBytes(buffer.getBytes()); +}; + +/** + * Gets a byte from this buffer and advances the read pointer by 1. + * + * @return the byte. + */ +util.ByteStringBuffer.prototype.getByte = function() { + return this.data.charCodeAt(this.read++); +}; + +/** + * Gets a uint16 from this buffer in big-endian order and advances the read + * pointer by 2. + * + * @return the uint16. + */ +util.ByteStringBuffer.prototype.getInt16 = function() { + var rval = ( + this.data.charCodeAt(this.read) << 8 ^ + this.data.charCodeAt(this.read + 1)); + this.read += 2; + return rval; +}; + +/** + * Gets a uint24 from this buffer in big-endian order and advances the read + * pointer by 3. + * + * @return the uint24. + */ +util.ByteStringBuffer.prototype.getInt24 = function() { + var rval = ( + this.data.charCodeAt(this.read) << 16 ^ + this.data.charCodeAt(this.read + 1) << 8 ^ + this.data.charCodeAt(this.read + 2)); + this.read += 3; + return rval; +}; + +/** + * Gets a uint32 from this buffer in big-endian order and advances the read + * pointer by 4. + * + * @return the word. + */ +util.ByteStringBuffer.prototype.getInt32 = function() { + var rval = ( + this.data.charCodeAt(this.read) << 24 ^ + this.data.charCodeAt(this.read + 1) << 16 ^ + this.data.charCodeAt(this.read + 2) << 8 ^ + this.data.charCodeAt(this.read + 3)); + this.read += 4; + return rval; +}; + +/** + * Gets a uint16 from this buffer in little-endian order and advances the read + * pointer by 2. + * + * @return the uint16. + */ +util.ByteStringBuffer.prototype.getInt16Le = function() { + var rval = ( + this.data.charCodeAt(this.read) ^ + this.data.charCodeAt(this.read + 1) << 8); + this.read += 2; + return rval; +}; + +/** + * Gets a uint24 from this buffer in little-endian order and advances the read + * pointer by 3. + * + * @return the uint24. + */ +util.ByteStringBuffer.prototype.getInt24Le = function() { + var rval = ( + this.data.charCodeAt(this.read) ^ + this.data.charCodeAt(this.read + 1) << 8 ^ + this.data.charCodeAt(this.read + 2) << 16); + this.read += 3; + return rval; +}; + +/** + * Gets a uint32 from this buffer in little-endian order and advances the read + * pointer by 4. + * + * @return the word. + */ +util.ByteStringBuffer.prototype.getInt32Le = function() { + var rval = ( + this.data.charCodeAt(this.read) ^ + this.data.charCodeAt(this.read + 1) << 8 ^ + this.data.charCodeAt(this.read + 2) << 16 ^ + this.data.charCodeAt(this.read + 3) << 24); + this.read += 4; + return rval; +}; + +/** + * Gets an n-bit integer from this buffer in big-endian order and advances the + * read pointer by ceil(n/8). + * + * @param n the number of bits in the integer (8, 16, 24, or 32). + * + * @return the integer. + */ +util.ByteStringBuffer.prototype.getInt = function(n) { + _checkBitsParam(n); + var rval = 0; + do { + // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits. + rval = (rval << 8) + this.data.charCodeAt(this.read++); + n -= 8; + } while(n > 0); + return rval; +}; + +/** + * Gets a signed n-bit integer from this buffer in big-endian order, using + * two's complement, and advances the read pointer by n/8. + * + * @param n the number of bits in the integer (8, 16, 24, or 32). + * + * @return the integer. + */ +util.ByteStringBuffer.prototype.getSignedInt = function(n) { + // getInt checks n + var x = this.getInt(n); + var max = 2 << (n - 2); + if(x >= max) { + x -= max << 1; + } + return x; +}; + +/** + * Reads bytes out as a binary encoded string and clears them from the + * buffer. Note that the resulting string is binary encoded (in node.js this + * encoding is referred to as `binary`, it is *not* `utf8`). + * + * @param count the number of bytes to read, undefined or null for all. + * + * @return a binary encoded string of bytes. + */ +util.ByteStringBuffer.prototype.getBytes = function(count) { + var rval; + if(count) { + // read count bytes + count = Math.min(this.length(), count); + rval = this.data.slice(this.read, this.read + count); + this.read += count; + } else if(count === 0) { + rval = ''; + } else { + // read all bytes, optimize to only copy when needed + rval = (this.read === 0) ? this.data : this.data.slice(this.read); + this.clear(); + } + return rval; +}; + +/** + * Gets a binary encoded string of the bytes from this buffer without + * modifying the read pointer. + * + * @param count the number of bytes to get, omit to get all. + * + * @return a string full of binary encoded characters. + */ +util.ByteStringBuffer.prototype.bytes = function(count) { + return (typeof(count) === 'undefined' ? + this.data.slice(this.read) : + this.data.slice(this.read, this.read + count)); +}; + +/** + * Gets a byte at the given index without modifying the read pointer. + * + * @param i the byte index. + * + * @return the byte. + */ +util.ByteStringBuffer.prototype.at = function(i) { + return this.data.charCodeAt(this.read + i); +}; + +/** + * Puts a byte at the given index without modifying the read pointer. + * + * @param i the byte index. + * @param b the byte to put. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.setAt = function(i, b) { + this.data = this.data.substr(0, this.read + i) + + String.fromCharCode(b) + + this.data.substr(this.read + i + 1); + return this; +}; + +/** + * Gets the last byte without modifying the read pointer. + * + * @return the last byte. + */ +util.ByteStringBuffer.prototype.last = function() { + return this.data.charCodeAt(this.data.length - 1); +}; + +/** + * Creates a copy of this buffer. + * + * @return the copy. + */ +util.ByteStringBuffer.prototype.copy = function() { + var c = util.createBuffer(this.data); + c.read = this.read; + return c; +}; + +/** + * Compacts this buffer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.compact = function() { + if(this.read > 0) { + this.data = this.data.slice(this.read); + this.read = 0; + } + return this; +}; + +/** + * Clears this buffer. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.clear = function() { + this.data = ''; + this.read = 0; + return this; +}; + +/** + * Shortens this buffer by triming bytes off of the end of this buffer. + * + * @param count the number of bytes to trim off. + * + * @return this buffer. + */ +util.ByteStringBuffer.prototype.truncate = function(count) { + var len = Math.max(0, this.length() - count); + this.data = this.data.substr(this.read, len); + this.read = 0; + return this; +}; + +/** + * Converts this buffer to a hexadecimal string. + * + * @return a hexadecimal string. + */ +util.ByteStringBuffer.prototype.toHex = function() { + var rval = ''; + for(var i = this.read; i < this.data.length; ++i) { + var b = this.data.charCodeAt(i); + if(b < 16) { + rval += '0'; + } + rval += b.toString(16); + } + return rval; +}; + +/** + * Converts this buffer to a UTF-16 string (standard JavaScript string). + * + * @return a UTF-16 string. + */ +util.ByteStringBuffer.prototype.toString = function() { + return util.decodeUtf8(this.bytes()); +}; + +/** End Buffer w/BinaryString backing */ + +/** Buffer w/UInt8Array backing */ + +/** + * FIXME: Experimental. Do not use yet. + * + * Constructor for an ArrayBuffer-backed byte buffer. + * + * The buffer may be constructed from a string, an ArrayBuffer, DataView, or a + * TypedArray. + * + * If a string is given, its encoding should be provided as an option, + * otherwise it will default to 'binary'. A 'binary' string is encoded such + * that each character is one byte in length and size. + * + * If an ArrayBuffer, DataView, or TypedArray is given, it will be used + * *directly* without any copying. Note that, if a write to the buffer requires + * more space, the buffer will allocate a new backing ArrayBuffer to + * accommodate. The starting read and write offsets for the buffer may be + * given as options. + * + * @param [b] the initial bytes for this buffer. + * @param options the options to use: + * [readOffset] the starting read offset to use (default: 0). + * [writeOffset] the starting write offset to use (default: the + * length of the first parameter). + * [growSize] the minimum amount, in bytes, to grow the buffer by to + * accommodate writes (default: 1024). + * [encoding] the encoding ('binary', 'utf8', 'utf16', 'hex') for the + * first parameter, if it is a string (default: 'binary'). + */ +function DataBuffer(b, options) { + // default options + options = options || {}; + + // pointers for read from/write to buffer + this.read = options.readOffset || 0; + this.growSize = options.growSize || 1024; + + var isArrayBuffer = util.isArrayBuffer(b); + var isArrayBufferView = util.isArrayBufferView(b); + if(isArrayBuffer || isArrayBufferView) { + // use ArrayBuffer directly + if(isArrayBuffer) { + this.data = new DataView(b); + } else { + // TODO: adjust read/write offset based on the type of view + // or specify that this must be done in the options ... that the + // offsets are byte-based + this.data = new DataView(b.buffer, b.byteOffset, b.byteLength); + } + this.write = ('writeOffset' in options ? + options.writeOffset : this.data.byteLength); + return; + } + + // initialize to empty array buffer and add any given bytes using putBytes + this.data = new DataView(new ArrayBuffer(0)); + this.write = 0; + + if(b !== null && b !== undefined) { + this.putBytes(b); + } + + if('writeOffset' in options) { + this.write = options.writeOffset; + } +} +util.DataBuffer = DataBuffer; + +/** + * Gets the number of bytes in this buffer. + * + * @return the number of bytes in this buffer. + */ +util.DataBuffer.prototype.length = function() { + return this.write - this.read; +}; + +/** + * Gets whether or not this buffer is empty. + * + * @return true if this buffer is empty, false if not. + */ +util.DataBuffer.prototype.isEmpty = function() { + return this.length() <= 0; +}; + +/** + * Ensures this buffer has enough empty space to accommodate the given number + * of bytes. An optional parameter may be given that indicates a minimum + * amount to grow the buffer if necessary. If the parameter is not given, + * the buffer will be grown by some previously-specified default amount + * or heuristic. + * + * @param amount the number of bytes to accommodate. + * @param [growSize] the minimum amount, in bytes, to grow the buffer by if + * necessary. + */ +util.DataBuffer.prototype.accommodate = function(amount, growSize) { + if(this.length() >= amount) { + return this; + } + growSize = Math.max(growSize || this.growSize, amount); + + // grow buffer + var src = new Uint8Array( + this.data.buffer, this.data.byteOffset, this.data.byteLength); + var dst = new Uint8Array(this.length() + growSize); + dst.set(src); + this.data = new DataView(dst.buffer); + + return this; +}; + +/** + * Puts a byte in this buffer. + * + * @param b the byte to put. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putByte = function(b) { + this.accommodate(1); + this.data.setUint8(this.write++, b); + return this; +}; + +/** + * Puts a byte in this buffer N times. + * + * @param b the byte to put. + * @param n the number of bytes of value b to put. + * + * @return this buffer. + */ +util.DataBuffer.prototype.fillWithByte = function(b, n) { + this.accommodate(n); + for(var i = 0; i < n; ++i) { + this.data.setUint8(b); + } + return this; +}; + +/** + * Puts bytes in this buffer. The bytes may be given as a string, an + * ArrayBuffer, a DataView, or a TypedArray. + * + * @param bytes the bytes to put. + * @param [encoding] the encoding for the first parameter ('binary', 'utf8', + * 'utf16', 'hex'), if it is a string (default: 'binary'). + * + * @return this buffer. + */ +util.DataBuffer.prototype.putBytes = function(bytes, encoding) { + if(util.isArrayBufferView(bytes)) { + var src = new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength); + var len = src.byteLength - src.byteOffset; + this.accommodate(len); + var dst = new Uint8Array(this.data.buffer, this.write); + dst.set(src); + this.write += len; + return this; + } + + if(util.isArrayBuffer(bytes)) { + var src = new Uint8Array(bytes); + this.accommodate(src.byteLength); + var dst = new Uint8Array(this.data.buffer); + dst.set(src, this.write); + this.write += src.byteLength; + return this; + } + + // bytes is a util.DataBuffer or equivalent + if(bytes instanceof util.DataBuffer || + (typeof bytes === 'object' && + typeof bytes.read === 'number' && typeof bytes.write === 'number' && + util.isArrayBufferView(bytes.data))) { + var src = new Uint8Array(bytes.data.byteLength, bytes.read, bytes.length()); + this.accommodate(src.byteLength); + var dst = new Uint8Array(bytes.data.byteLength, this.write); + dst.set(src); + this.write += src.byteLength; + return this; + } + + if(bytes instanceof util.ByteStringBuffer) { + // copy binary string and process as the same as a string parameter below + bytes = bytes.data; + encoding = 'binary'; + } + + // string conversion + encoding = encoding || 'binary'; + if(typeof bytes === 'string') { + var view; + + // decode from string + if(encoding === 'hex') { + this.accommodate(Math.ceil(bytes.length / 2)); + view = new Uint8Array(this.data.buffer, this.write); + this.write += util.binary.hex.decode(bytes, view, this.write); + return this; + } + if(encoding === 'base64') { + this.accommodate(Math.ceil(bytes.length / 4) * 3); + view = new Uint8Array(this.data.buffer, this.write); + this.write += util.binary.base64.decode(bytes, view, this.write); + return this; + } + + // encode text as UTF-8 bytes + if(encoding === 'utf8') { + // encode as UTF-8 then decode string as raw binary + bytes = util.encodeUtf8(bytes); + encoding = 'binary'; + } + + // decode string as raw binary + if(encoding === 'binary' || encoding === 'raw') { + // one byte per character + this.accommodate(bytes.length); + view = new Uint8Array(this.data.buffer, this.write); + this.write += util.binary.raw.decode(view); + return this; + } + + // encode text as UTF-16 bytes + if(encoding === 'utf16') { + // two bytes per character + this.accommodate(bytes.length * 2); + view = new Uint16Array(this.data.buffer, this.write); + this.write += util.text.utf16.encode(view); + return this; + } + + throw new Error('Invalid encoding: ' + encoding); + } + + throw Error('Invalid parameter: ' + bytes); +}; + +/** + * Puts the given buffer into this buffer. + * + * @param buffer the buffer to put into this one. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putBuffer = function(buffer) { + this.putBytes(buffer); + buffer.clear(); + return this; +}; + +/** + * Puts a string into this buffer. + * + * @param str the string to put. + * @param [encoding] the encoding for the string (default: 'utf16'). + * + * @return this buffer. + */ +util.DataBuffer.prototype.putString = function(str) { + return this.putBytes(str, 'utf16'); +}; + +/** + * Puts a 16-bit integer in this buffer in big-endian order. + * + * @param i the 16-bit integer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putInt16 = function(i) { + this.accommodate(2); + this.data.setInt16(this.write, i); + this.write += 2; + return this; +}; + +/** + * Puts a 24-bit integer in this buffer in big-endian order. + * + * @param i the 24-bit integer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putInt24 = function(i) { + this.accommodate(3); + this.data.setInt16(this.write, i >> 8 & 0xFFFF); + this.data.setInt8(this.write, i >> 16 & 0xFF); + this.write += 3; + return this; +}; + +/** + * Puts a 32-bit integer in this buffer in big-endian order. + * + * @param i the 32-bit integer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putInt32 = function(i) { + this.accommodate(4); + this.data.setInt32(this.write, i); + this.write += 4; + return this; +}; + +/** + * Puts a 16-bit integer in this buffer in little-endian order. + * + * @param i the 16-bit integer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putInt16Le = function(i) { + this.accommodate(2); + this.data.setInt16(this.write, i, true); + this.write += 2; + return this; +}; + +/** + * Puts a 24-bit integer in this buffer in little-endian order. + * + * @param i the 24-bit integer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putInt24Le = function(i) { + this.accommodate(3); + this.data.setInt8(this.write, i >> 16 & 0xFF); + this.data.setInt16(this.write, i >> 8 & 0xFFFF, true); + this.write += 3; + return this; +}; + +/** + * Puts a 32-bit integer in this buffer in little-endian order. + * + * @param i the 32-bit integer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putInt32Le = function(i) { + this.accommodate(4); + this.data.setInt32(this.write, i, true); + this.write += 4; + return this; +}; + +/** + * Puts an n-bit integer in this buffer in big-endian order. + * + * @param i the n-bit integer. + * @param n the number of bits in the integer (8, 16, 24, or 32). + * + * @return this buffer. + */ +util.DataBuffer.prototype.putInt = function(i, n) { + _checkBitsParam(n); + this.accommodate(n / 8); + do { + n -= 8; + this.data.setInt8(this.write++, (i >> n) & 0xFF); + } while(n > 0); + return this; +}; + +/** + * Puts a signed n-bit integer in this buffer in big-endian order. Two's + * complement representation is used. + * + * @param i the n-bit integer. + * @param n the number of bits in the integer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.putSignedInt = function(i, n) { + _checkBitsParam(n); + this.accommodate(n / 8); + if(i < 0) { + i += 2 << (n - 1); + } + return this.putInt(i, n); +}; + +/** + * Gets a byte from this buffer and advances the read pointer by 1. + * + * @return the byte. + */ +util.DataBuffer.prototype.getByte = function() { + return this.data.getInt8(this.read++); +}; + +/** + * Gets a uint16 from this buffer in big-endian order and advances the read + * pointer by 2. + * + * @return the uint16. + */ +util.DataBuffer.prototype.getInt16 = function() { + var rval = this.data.getInt16(this.read); + this.read += 2; + return rval; +}; + +/** + * Gets a uint24 from this buffer in big-endian order and advances the read + * pointer by 3. + * + * @return the uint24. + */ +util.DataBuffer.prototype.getInt24 = function() { + var rval = ( + this.data.getInt16(this.read) << 8 ^ + this.data.getInt8(this.read + 2)); + this.read += 3; + return rval; +}; + +/** + * Gets a uint32 from this buffer in big-endian order and advances the read + * pointer by 4. + * + * @return the word. + */ +util.DataBuffer.prototype.getInt32 = function() { + var rval = this.data.getInt32(this.read); + this.read += 4; + return rval; +}; + +/** + * Gets a uint16 from this buffer in little-endian order and advances the read + * pointer by 2. + * + * @return the uint16. + */ +util.DataBuffer.prototype.getInt16Le = function() { + var rval = this.data.getInt16(this.read, true); + this.read += 2; + return rval; +}; + +/** + * Gets a uint24 from this buffer in little-endian order and advances the read + * pointer by 3. + * + * @return the uint24. + */ +util.DataBuffer.prototype.getInt24Le = function() { + var rval = ( + this.data.getInt8(this.read) ^ + this.data.getInt16(this.read + 1, true) << 8); + this.read += 3; + return rval; +}; + +/** + * Gets a uint32 from this buffer in little-endian order and advances the read + * pointer by 4. + * + * @return the word. + */ +util.DataBuffer.prototype.getInt32Le = function() { + var rval = this.data.getInt32(this.read, true); + this.read += 4; + return rval; +}; + +/** + * Gets an n-bit integer from this buffer in big-endian order and advances the + * read pointer by n/8. + * + * @param n the number of bits in the integer (8, 16, 24, or 32). + * + * @return the integer. + */ +util.DataBuffer.prototype.getInt = function(n) { + _checkBitsParam(n); + var rval = 0; + do { + // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits. + rval = (rval << 8) + this.data.getInt8(this.read++); + n -= 8; + } while(n > 0); + return rval; +}; + +/** + * Gets a signed n-bit integer from this buffer in big-endian order, using + * two's complement, and advances the read pointer by n/8. + * + * @param n the number of bits in the integer (8, 16, 24, or 32). + * + * @return the integer. + */ +util.DataBuffer.prototype.getSignedInt = function(n) { + // getInt checks n + var x = this.getInt(n); + var max = 2 << (n - 2); + if(x >= max) { + x -= max << 1; + } + return x; +}; + +/** + * Reads bytes out as a binary encoded string and clears them from the + * buffer. + * + * @param count the number of bytes to read, undefined or null for all. + * + * @return a binary encoded string of bytes. + */ +util.DataBuffer.prototype.getBytes = function(count) { + // TODO: deprecate this method, it is poorly named and + // this.toString('binary') replaces it + // add a toTypedArray()/toArrayBuffer() function + var rval; + if(count) { + // read count bytes + count = Math.min(this.length(), count); + rval = this.data.slice(this.read, this.read + count); + this.read += count; + } else if(count === 0) { + rval = ''; + } else { + // read all bytes, optimize to only copy when needed + rval = (this.read === 0) ? this.data : this.data.slice(this.read); + this.clear(); + } + return rval; +}; + +/** + * Gets a binary encoded string of the bytes from this buffer without + * modifying the read pointer. + * + * @param count the number of bytes to get, omit to get all. + * + * @return a string full of binary encoded characters. + */ +util.DataBuffer.prototype.bytes = function(count) { + // TODO: deprecate this method, it is poorly named, add "getString()" + return (typeof(count) === 'undefined' ? + this.data.slice(this.read) : + this.data.slice(this.read, this.read + count)); +}; + +/** + * Gets a byte at the given index without modifying the read pointer. + * + * @param i the byte index. + * + * @return the byte. + */ +util.DataBuffer.prototype.at = function(i) { + return this.data.getUint8(this.read + i); +}; + +/** + * Puts a byte at the given index without modifying the read pointer. + * + * @param i the byte index. + * @param b the byte to put. + * + * @return this buffer. + */ +util.DataBuffer.prototype.setAt = function(i, b) { + this.data.setUint8(i, b); + return this; +}; + +/** + * Gets the last byte without modifying the read pointer. + * + * @return the last byte. + */ +util.DataBuffer.prototype.last = function() { + return this.data.getUint8(this.write - 1); +}; + +/** + * Creates a copy of this buffer. + * + * @return the copy. + */ +util.DataBuffer.prototype.copy = function() { + return new util.DataBuffer(this); +}; + +/** + * Compacts this buffer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.compact = function() { + if(this.read > 0) { + var src = new Uint8Array(this.data.buffer, this.read); + var dst = new Uint8Array(src.byteLength); + dst.set(src); + this.data = new DataView(dst); + this.write -= this.read; + this.read = 0; + } + return this; +}; + +/** + * Clears this buffer. + * + * @return this buffer. + */ +util.DataBuffer.prototype.clear = function() { + this.data = new DataView(new ArrayBuffer(0)); + this.read = this.write = 0; + return this; +}; + +/** + * Shortens this buffer by triming bytes off of the end of this buffer. + * + * @param count the number of bytes to trim off. + * + * @return this buffer. + */ +util.DataBuffer.prototype.truncate = function(count) { + this.write = Math.max(0, this.length() - count); + this.read = Math.min(this.read, this.write); + return this; +}; + +/** + * Converts this buffer to a hexadecimal string. + * + * @return a hexadecimal string. + */ +util.DataBuffer.prototype.toHex = function() { + var rval = ''; + for(var i = this.read; i < this.data.byteLength; ++i) { + var b = this.data.getUint8(i); + if(b < 16) { + rval += '0'; + } + rval += b.toString(16); + } + return rval; +}; + +/** + * Converts this buffer to a string, using the given encoding. If no + * encoding is given, 'utf8' (UTF-8) is used. + * + * @param [encoding] the encoding to use: 'binary', 'utf8', 'utf16', 'hex', + * 'base64' (default: 'utf8'). + * + * @return a string representation of the bytes in this buffer. + */ +util.DataBuffer.prototype.toString = function(encoding) { + var view = new Uint8Array(this.data, this.read, this.length()); + encoding = encoding || 'utf8'; + + // encode to string + if(encoding === 'binary' || encoding === 'raw') { + return util.binary.raw.encode(view); + } + if(encoding === 'hex') { + return util.binary.hex.encode(view); + } + if(encoding === 'base64') { + return util.binary.base64.encode(view); + } + + // decode to text + if(encoding === 'utf8') { + return util.text.utf8.decode(view); + } + if(encoding === 'utf16') { + return util.text.utf16.decode(view); + } + + throw new Error('Invalid encoding: ' + encoding); +}; + +/** End Buffer w/UInt8Array backing */ + +/** + * Creates a buffer that stores bytes. A value may be given to populate the + * buffer with data. This value can either be string of encoded bytes or a + * regular string of characters. When passing a string of binary encoded + * bytes, the encoding `raw` should be given. This is also the default. When + * passing a string of characters, the encoding `utf8` should be given. + * + * @param [input] a string with encoded bytes to store in the buffer. + * @param [encoding] (default: 'raw', other: 'utf8'). + */ +util.createBuffer = function(input, encoding) { + // TODO: deprecate, use new ByteBuffer() instead + encoding = encoding || 'raw'; + if(input !== undefined && encoding === 'utf8') { + input = util.encodeUtf8(input); + } + return new util.ByteBuffer(input); +}; + +/** + * Fills a string with a particular value. If you want the string to be a byte + * string, pass in String.fromCharCode(theByte). + * + * @param c the character to fill the string with, use String.fromCharCode + * to fill the string with a byte value. + * @param n the number of characters of value c to fill with. + * + * @return the filled string. + */ +util.fillString = function(c, n) { + var s = ''; + while(n > 0) { + if(n & 1) { + s += c; + } + n >>>= 1; + if(n > 0) { + c += c; + } + } + return s; +}; + +/** + * Performs a per byte XOR between two byte strings and returns the result as a + * string of bytes. + * + * @param s1 first string of bytes. + * @param s2 second string of bytes. + * @param n the number of bytes to XOR. + * + * @return the XOR'd result. + */ +util.xorBytes = function(s1, s2, n) { + var s3 = ''; + var b = ''; + var t = ''; + var i = 0; + var c = 0; + for(; n > 0; --n, ++i) { + b = s1.charCodeAt(i) ^ s2.charCodeAt(i); + if(c >= 10) { + s3 += t; + t = ''; + c = 0; + } + t += String.fromCharCode(b); + ++c; + } + s3 += t; + return s3; +}; + +/** + * Converts a hex string into a 'binary' encoded string of bytes. + * + * @param hex the hexadecimal string to convert. + * + * @return the binary-encoded string of bytes. + */ +util.hexToBytes = function(hex) { + // TODO: deprecate: "Deprecated. Use util.binary.hex.decode instead." + var rval = ''; + var i = 0; + if(hex.length & 1 == 1) { + // odd number of characters, convert first character alone + i = 1; + rval += String.fromCharCode(parseInt(hex[0], 16)); + } + // convert 2 characters (1 byte) at a time + for(; i < hex.length; i += 2) { + rval += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); + } + return rval; +}; + +/** + * Converts a 'binary' encoded string of bytes to hex. + * + * @param bytes the byte string to convert. + * + * @return the string of hexadecimal characters. + */ +util.bytesToHex = function(bytes) { + // TODO: deprecate: "Deprecated. Use util.binary.hex.encode instead." + return util.createBuffer(bytes).toHex(); +}; + +/** + * Converts an 32-bit integer to 4-big-endian byte string. + * + * @param i the integer. + * + * @return the byte string. + */ +util.int32ToBytes = function(i) { + return ( + String.fromCharCode(i >> 24 & 0xFF) + + String.fromCharCode(i >> 16 & 0xFF) + + String.fromCharCode(i >> 8 & 0xFF) + + String.fromCharCode(i & 0xFF)); +}; + +// base64 characters, reverse mapping +var _base64 = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +var _base64Idx = [ +/*43 -43 = 0*/ +/*'+', 1, 2, 3,'/' */ + 62, -1, -1, -1, 63, + +/*'0','1','2','3','4','5','6','7','8','9' */ + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + +/*15, 16, 17,'=', 19, 20, 21 */ + -1, -1, -1, 64, -1, -1, -1, + +/*65 - 43 = 22*/ +/*'A','B','C','D','E','F','G','H','I','J','K','L','M', */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + +/*'N','O','P','Q','R','S','T','U','V','W','X','Y','Z' */ + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + +/*91 - 43 = 48 */ +/*48, 49, 50, 51, 52, 53 */ + -1, -1, -1, -1, -1, -1, + +/*97 - 43 = 54*/ +/*'a','b','c','d','e','f','g','h','i','j','k','l','m' */ + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + +/*'n','o','p','q','r','s','t','u','v','w','x','y','z' */ + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 +]; + +// base58 characters (Bitcoin alphabet) +var _base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; + +/** + * Base64 encodes a 'binary' encoded string of bytes. + * + * @param input the binary encoded string of bytes to base64-encode. + * @param maxline the maximum number of encoded characters per line to use, + * defaults to none. + * + * @return the base64-encoded output. + */ +util.encode64 = function(input, maxline) { + // TODO: deprecate: "Deprecated. Use util.binary.base64.encode instead." + var line = ''; + var output = ''; + var chr1, chr2, chr3; + var i = 0; + while(i < input.length) { + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + // encode 4 character group + line += _base64.charAt(chr1 >> 2); + line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4)); + if(isNaN(chr2)) { + line += '=='; + } else { + line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6)); + line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63); + } + + if(maxline && line.length > maxline) { + output += line.substr(0, maxline) + '\r\n'; + line = line.substr(maxline); + } + } + output += line; + return output; +}; + +/** + * Base64 decodes a string into a 'binary' encoded string of bytes. + * + * @param input the base64-encoded input. + * + * @return the binary encoded string. + */ +util.decode64 = function(input) { + // TODO: deprecate: "Deprecated. Use util.binary.base64.decode instead." + + // remove all non-base64 characters + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); + + var output = ''; + var enc1, enc2, enc3, enc4; + var i = 0; + + while(i < input.length) { + enc1 = _base64Idx[input.charCodeAt(i++) - 43]; + enc2 = _base64Idx[input.charCodeAt(i++) - 43]; + enc3 = _base64Idx[input.charCodeAt(i++) - 43]; + enc4 = _base64Idx[input.charCodeAt(i++) - 43]; + + output += String.fromCharCode((enc1 << 2) | (enc2 >> 4)); + if(enc3 !== 64) { + // decoded at least 2 bytes + output += String.fromCharCode(((enc2 & 15) << 4) | (enc3 >> 2)); + if(enc4 !== 64) { + // decoded 3 bytes + output += String.fromCharCode(((enc3 & 3) << 6) | enc4); + } + } + } + + return output; +}; + +/** + * Encodes the given string of characters (a standard JavaScript + * string) as a binary encoded string where the bytes represent + * a UTF-8 encoded string of characters. Non-ASCII characters will be + * encoded as multiple bytes according to UTF-8. + * + * @param str a standard string of characters to encode. + * + * @return the binary encoded string. + */ +util.encodeUtf8 = function(str) { + return unescape(encodeURIComponent(str)); +}; + +/** + * Decodes a binary encoded string that contains bytes that + * represent a UTF-8 encoded string of characters -- into a + * string of characters (a standard JavaScript string). + * + * @param str the binary encoded string to decode. + * + * @return the resulting standard string of characters. + */ +util.decodeUtf8 = function(str) { + return decodeURIComponent(escape(str)); +}; + +// binary encoding/decoding tools +// FIXME: Experimental. Do not use yet. +util.binary = { + raw: {}, + hex: {}, + base64: {}, + base58: {}, + baseN : { + encode: baseN.encode, + decode: baseN.decode + } +}; + +/** + * Encodes a Uint8Array as a binary-encoded string. This encoding uses + * a value between 0 and 255 for each character. + * + * @param bytes the Uint8Array to encode. + * + * @return the binary-encoded string. + */ +util.binary.raw.encode = function(bytes) { + return String.fromCharCode.apply(null, bytes); +}; + +/** + * Decodes a binary-encoded string to a Uint8Array. This encoding uses + * a value between 0 and 255 for each character. + * + * @param str the binary-encoded string to decode. + * @param [output] an optional Uint8Array to write the output to; if it + * is too small, an exception will be thrown. + * @param [offset] the start offset for writing to the output (default: 0). + * + * @return the Uint8Array or the number of bytes written if output was given. + */ +util.binary.raw.decode = function(str, output, offset) { + var out = output; + if(!out) { + out = new Uint8Array(str.length); + } + offset = offset || 0; + var j = offset; + for(var i = 0; i < str.length; ++i) { + out[j++] = str.charCodeAt(i); + } + return output ? (j - offset) : out; +}; + +/** + * Encodes a 'binary' string, ArrayBuffer, DataView, TypedArray, or + * ByteBuffer as a string of hexadecimal characters. + * + * @param bytes the bytes to convert. + * + * @return the string of hexadecimal characters. + */ +util.binary.hex.encode = util.bytesToHex; + +/** + * Decodes a hex-encoded string to a Uint8Array. + * + * @param hex the hexadecimal string to convert. + * @param [output] an optional Uint8Array to write the output to; if it + * is too small, an exception will be thrown. + * @param [offset] the start offset for writing to the output (default: 0). + * + * @return the Uint8Array or the number of bytes written if output was given. + */ +util.binary.hex.decode = function(hex, output, offset) { + var out = output; + if(!out) { + out = new Uint8Array(Math.ceil(hex.length / 2)); + } + offset = offset || 0; + var i = 0, j = offset; + if(hex.length & 1) { + // odd number of characters, convert first character alone + i = 1; + out[j++] = parseInt(hex[0], 16); + } + // convert 2 characters (1 byte) at a time + for(; i < hex.length; i += 2) { + out[j++] = parseInt(hex.substr(i, 2), 16); + } + return output ? (j - offset) : out; +}; + +/** + * Base64-encodes a Uint8Array. + * + * @param input the Uint8Array to encode. + * @param maxline the maximum number of encoded characters per line to use, + * defaults to none. + * + * @return the base64-encoded output string. + */ +util.binary.base64.encode = function(input, maxline) { + var line = ''; + var output = ''; + var chr1, chr2, chr3; + var i = 0; + while(i < input.byteLength) { + chr1 = input[i++]; + chr2 = input[i++]; + chr3 = input[i++]; + + // encode 4 character group + line += _base64.charAt(chr1 >> 2); + line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4)); + if(isNaN(chr2)) { + line += '=='; + } else { + line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6)); + line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63); + } + + if(maxline && line.length > maxline) { + output += line.substr(0, maxline) + '\r\n'; + line = line.substr(maxline); + } + } + output += line; + return output; +}; + +/** + * Decodes a base64-encoded string to a Uint8Array. + * + * @param input the base64-encoded input string. + * @param [output] an optional Uint8Array to write the output to; if it + * is too small, an exception will be thrown. + * @param [offset] the start offset for writing to the output (default: 0). + * + * @return the Uint8Array or the number of bytes written if output was given. + */ +util.binary.base64.decode = function(input, output, offset) { + var out = output; + if(!out) { + out = new Uint8Array(Math.ceil(input.length / 4) * 3); + } + + // remove all non-base64 characters + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); + + offset = offset || 0; + var enc1, enc2, enc3, enc4; + var i = 0, j = offset; + + while(i < input.length) { + enc1 = _base64Idx[input.charCodeAt(i++) - 43]; + enc2 = _base64Idx[input.charCodeAt(i++) - 43]; + enc3 = _base64Idx[input.charCodeAt(i++) - 43]; + enc4 = _base64Idx[input.charCodeAt(i++) - 43]; + + out[j++] = (enc1 << 2) | (enc2 >> 4); + if(enc3 !== 64) { + // decoded at least 2 bytes + out[j++] = ((enc2 & 15) << 4) | (enc3 >> 2); + if(enc4 !== 64) { + // decoded 3 bytes + out[j++] = ((enc3 & 3) << 6) | enc4; + } + } + } + + // make sure result is the exact decoded length + return output ? (j - offset) : out.subarray(0, j); +}; + +// add support for base58 encoding/decoding with Bitcoin alphabet +util.binary.base58.encode = function(input, maxline) { + return util.binary.baseN.encode(input, _base58, maxline); +}; +util.binary.base58.decode = function(input, maxline) { + return util.binary.baseN.decode(input, _base58, maxline); +}; + +// text encoding/decoding tools +// FIXME: Experimental. Do not use yet. +util.text = { + utf8: {}, + utf16: {} +}; + +/** + * Encodes the given string as UTF-8 in a Uint8Array. + * + * @param str the string to encode. + * @param [output] an optional Uint8Array to write the output to; if it + * is too small, an exception will be thrown. + * @param [offset] the start offset for writing to the output (default: 0). + * + * @return the Uint8Array or the number of bytes written if output was given. + */ +util.text.utf8.encode = function(str, output, offset) { + str = util.encodeUtf8(str); + var out = output; + if(!out) { + out = new Uint8Array(str.length); + } + offset = offset || 0; + var j = offset; + for(var i = 0; i < str.length; ++i) { + out[j++] = str.charCodeAt(i); + } + return output ? (j - offset) : out; +}; + +/** + * Decodes the UTF-8 contents from a Uint8Array. + * + * @param bytes the Uint8Array to decode. + * + * @return the resulting string. + */ +util.text.utf8.decode = function(bytes) { + return util.decodeUtf8(String.fromCharCode.apply(null, bytes)); +}; + +/** + * Encodes the given string as UTF-16 in a Uint8Array. + * + * @param str the string to encode. + * @param [output] an optional Uint8Array to write the output to; if it + * is too small, an exception will be thrown. + * @param [offset] the start offset for writing to the output (default: 0). + * + * @return the Uint8Array or the number of bytes written if output was given. + */ +util.text.utf16.encode = function(str, output, offset) { + var out = output; + if(!out) { + out = new Uint8Array(str.length * 2); + } + var view = new Uint16Array(out.buffer); + offset = offset || 0; + var j = offset; + var k = offset; + for(var i = 0; i < str.length; ++i) { + view[k++] = str.charCodeAt(i); + j += 2; + } + return output ? (j - offset) : out; +}; + +/** + * Decodes the UTF-16 contents from a Uint8Array. + * + * @param bytes the Uint8Array to decode. + * + * @return the resulting string. + */ +util.text.utf16.decode = function(bytes) { + return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer)); +}; + +/** + * Deflates the given data using a flash interface. + * + * @param api the flash interface. + * @param bytes the data. + * @param raw true to return only raw deflate data, false to include zlib + * header and trailer. + * + * @return the deflated data as a string. + */ +util.deflate = function(api, bytes, raw) { + bytes = util.decode64(api.deflate(util.encode64(bytes)).rval); + + // strip zlib header and trailer if necessary + if(raw) { + // zlib header is 2 bytes (CMF,FLG) where FLG indicates that + // there is a 4-byte DICT (alder-32) block before the data if + // its 5th bit is set + var start = 2; + var flg = bytes.charCodeAt(1); + if(flg & 0x20) { + start = 6; + } + // zlib trailer is 4 bytes of adler-32 + bytes = bytes.substring(start, bytes.length - 4); + } + + return bytes; +}; + +/** + * Inflates the given data using a flash interface. + * + * @param api the flash interface. + * @param bytes the data. + * @param raw true if the incoming data has no zlib header or trailer and is + * raw DEFLATE data. + * + * @return the inflated data as a string, null on error. + */ +util.inflate = function(api, bytes, raw) { + // TODO: add zlib header and trailer if necessary/possible + var rval = api.inflate(util.encode64(bytes)).rval; + return (rval === null) ? null : util.decode64(rval); +}; + +/** + * Sets a storage object. + * + * @param api the storage interface. + * @param id the storage ID to use. + * @param obj the storage object, null to remove. + */ +var _setStorageObject = function(api, id, obj) { + if(!api) { + throw new Error('WebStorage not available.'); + } + + var rval; + if(obj === null) { + rval = api.removeItem(id); + } else { + // json-encode and base64-encode object + obj = util.encode64(JSON.stringify(obj)); + rval = api.setItem(id, obj); + } + + // handle potential flash error + if(typeof(rval) !== 'undefined' && rval.rval !== true) { + var error = new Error(rval.error.message); + error.id = rval.error.id; + error.name = rval.error.name; + throw error; + } +}; + +/** + * Gets a storage object. + * + * @param api the storage interface. + * @param id the storage ID to use. + * + * @return the storage object entry or null if none exists. + */ +var _getStorageObject = function(api, id) { + if(!api) { + throw new Error('WebStorage not available.'); + } + + // get the existing entry + var rval = api.getItem(id); + + /* Note: We check api.init because we can't do (api == localStorage) + on IE because of "Class doesn't support Automation" exception. Only + the flash api has an init method so this works too, but we need a + better solution in the future. */ + + // flash returns item wrapped in an object, handle special case + if(api.init) { + if(rval.rval === null) { + if(rval.error) { + var error = new Error(rval.error.message); + error.id = rval.error.id; + error.name = rval.error.name; + throw error; + } + // no error, but also no item + rval = null; + } else { + rval = rval.rval; + } + } + + // handle decoding + if(rval !== null) { + // base64-decode and json-decode data + rval = JSON.parse(util.decode64(rval)); + } + + return rval; +}; + +/** + * Stores an item in local storage. + * + * @param api the storage interface. + * @param id the storage ID to use. + * @param key the key for the item. + * @param data the data for the item (any javascript object/primitive). + */ +var _setItem = function(api, id, key, data) { + // get storage object + var obj = _getStorageObject(api, id); + if(obj === null) { + // create a new storage object + obj = {}; + } + // update key + obj[key] = data; + + // set storage object + _setStorageObject(api, id, obj); +}; + +/** + * Gets an item from local storage. + * + * @param api the storage interface. + * @param id the storage ID to use. + * @param key the key for the item. + * + * @return the item. + */ +var _getItem = function(api, id, key) { + // get storage object + var rval = _getStorageObject(api, id); + if(rval !== null) { + // return data at key + rval = (key in rval) ? rval[key] : null; + } + + return rval; +}; + +/** + * Removes an item from local storage. + * + * @param api the storage interface. + * @param id the storage ID to use. + * @param key the key for the item. + */ +var _removeItem = function(api, id, key) { + // get storage object + var obj = _getStorageObject(api, id); + if(obj !== null && key in obj) { + // remove key + delete obj[key]; + + // see if entry has no keys remaining + var empty = true; + for(var prop in obj) { + empty = false; + break; + } + if(empty) { + // remove entry entirely if no keys are left + obj = null; + } + + // set storage object + _setStorageObject(api, id, obj); + } +}; + +/** + * Clears the local disk storage identified by the given ID. + * + * @param api the storage interface. + * @param id the storage ID to use. + */ +var _clearItems = function(api, id) { + _setStorageObject(api, id, null); +}; + +/** + * Calls a storage function. + * + * @param func the function to call. + * @param args the arguments for the function. + * @param location the location argument. + * + * @return the return value from the function. + */ +var _callStorageFunction = function(func, args, location) { + var rval = null; + + // default storage types + if(typeof(location) === 'undefined') { + location = ['web', 'flash']; + } + + // apply storage types in order of preference + var type; + var done = false; + var exception = null; + for(var idx in location) { + type = location[idx]; + try { + if(type === 'flash' || type === 'both') { + if(args[0] === null) { + throw new Error('Flash local storage not available.'); + } + rval = func.apply(this, args); + done = (type === 'flash'); + } + if(type === 'web' || type === 'both') { + args[0] = localStorage; + rval = func.apply(this, args); + done = true; + } + } catch(ex) { + exception = ex; + } + if(done) { + break; + } + } + + if(!done) { + throw exception; + } + + return rval; +}; + +/** + * Stores an item on local disk. + * + * The available types of local storage include 'flash', 'web', and 'both'. + * + * The type 'flash' refers to flash local storage (SharedObject). In order + * to use flash local storage, the 'api' parameter must be valid. The type + * 'web' refers to WebStorage, if supported by the browser. The type 'both' + * refers to storing using both 'flash' and 'web', not just one or the + * other. + * + * The location array should list the storage types to use in order of + * preference: + * + * ['flash']: flash only storage + * ['web']: web only storage + * ['both']: try to store in both + * ['flash','web']: store in flash first, but if not available, 'web' + * ['web','flash']: store in web first, but if not available, 'flash' + * + * The location array defaults to: ['web', 'flash'] + * + * @param api the flash interface, null to use only WebStorage. + * @param id the storage ID to use. + * @param key the key for the item. + * @param data the data for the item (any javascript object/primitive). + * @param location an array with the preferred types of storage to use. + */ +util.setItem = function(api, id, key, data, location) { + _callStorageFunction(_setItem, arguments, location); +}; + +/** + * Gets an item on local disk. + * + * Set setItem() for details on storage types. + * + * @param api the flash interface, null to use only WebStorage. + * @param id the storage ID to use. + * @param key the key for the item. + * @param location an array with the preferred types of storage to use. + * + * @return the item. + */ +util.getItem = function(api, id, key, location) { + return _callStorageFunction(_getItem, arguments, location); +}; + +/** + * Removes an item on local disk. + * + * Set setItem() for details on storage types. + * + * @param api the flash interface. + * @param id the storage ID to use. + * @param key the key for the item. + * @param location an array with the preferred types of storage to use. + */ +util.removeItem = function(api, id, key, location) { + _callStorageFunction(_removeItem, arguments, location); +}; + +/** + * Clears the local disk storage identified by the given ID. + * + * Set setItem() for details on storage types. + * + * @param api the flash interface if flash is available. + * @param id the storage ID to use. + * @param location an array with the preferred types of storage to use. + */ +util.clearItems = function(api, id, location) { + _callStorageFunction(_clearItems, arguments, location); +}; + +/** + * Check if an object is empty. + * + * Taken from: + * http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object-from-json/679937#679937 + * + * @param object the object to check. + */ +util.isEmpty = function(obj) { + for(var prop in obj) { + if(obj.hasOwnProperty(prop)) { + return false; + } + } + return true; +}; + +/** + * Format with simple printf-style interpolation. + * + * %%: literal '%' + * %s,%o: convert next argument into a string. + * + * @param format the string to format. + * @param ... arguments to interpolate into the format string. + */ +util.format = function(format) { + var re = /%./g; + // current match + var match; + // current part + var part; + // current arg index + var argi = 0; + // collected parts to recombine later + var parts = []; + // last index found + var last = 0; + // loop while matches remain + while((match = re.exec(format))) { + part = format.substring(last, re.lastIndex - 2); + // don't add empty strings (ie, parts between %s%s) + if(part.length > 0) { + parts.push(part); + } + last = re.lastIndex; + // switch on % code + var code = match[0][1]; + switch(code) { + case 's': + case 'o': + // check if enough arguments were given + if(argi < arguments.length) { + parts.push(arguments[argi++ + 1]); + } else { + parts.push(''); + } + break; + // FIXME: do proper formating for numbers, etc + //case 'f': + //case 'd': + case '%': + parts.push('%'); + break; + default: + parts.push('<%' + code + '?>'); + } + } + // add trailing part of format string + parts.push(format.substring(last)); + return parts.join(''); +}; + +/** + * Formats a number. + * + * http://snipplr.com/view/5945/javascript-numberformat--ported-from-php/ + */ +util.formatNumber = function(number, decimals, dec_point, thousands_sep) { + // http://kevin.vanzonneveld.net + // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) + // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) + // + bugfix by: Michael White (http://crestidg.com) + // + bugfix by: Benjamin Lupton + // + bugfix by: Allan Jensen (http://www.winternet.no) + // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) + // * example 1: number_format(1234.5678, 2, '.', ''); + // * returns 1: 1234.57 + + var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals; + var d = dec_point === undefined ? ',' : dec_point; + var t = thousands_sep === undefined ? + '.' : thousands_sep, s = n < 0 ? '-' : ''; + var i = parseInt((n = Math.abs(+n || 0).toFixed(c)), 10) + ''; + var j = (i.length > 3) ? i.length % 3 : 0; + return s + (j ? i.substr(0, j) + t : '') + + i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + t) + + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ''); +}; + +/** + * Formats a byte size. + * + * http://snipplr.com/view/5949/format-humanize-file-byte-size-presentation-in-javascript/ + */ +util.formatSize = function(size) { + if(size >= 1073741824) { + size = util.formatNumber(size / 1073741824, 2, '.', '') + ' GiB'; + } else if(size >= 1048576) { + size = util.formatNumber(size / 1048576, 2, '.', '') + ' MiB'; + } else if(size >= 1024) { + size = util.formatNumber(size / 1024, 0) + ' KiB'; + } else { + size = util.formatNumber(size, 0) + ' bytes'; + } + return size; +}; + +/** + * Converts an IPv4 or IPv6 string representation into bytes (in network order). + * + * @param ip the IPv4 or IPv6 address to convert. + * + * @return the 4-byte IPv6 or 16-byte IPv6 address or null if the address can't + * be parsed. + */ +util.bytesFromIP = function(ip) { + if(ip.indexOf('.') !== -1) { + return util.bytesFromIPv4(ip); + } + if(ip.indexOf(':') !== -1) { + return util.bytesFromIPv6(ip); + } + return null; +}; + +/** + * Converts an IPv4 string representation into bytes (in network order). + * + * @param ip the IPv4 address to convert. + * + * @return the 4-byte address or null if the address can't be parsed. + */ +util.bytesFromIPv4 = function(ip) { + ip = ip.split('.'); + if(ip.length !== 4) { + return null; + } + var b = util.createBuffer(); + for(var i = 0; i < ip.length; ++i) { + var num = parseInt(ip[i], 10); + if(isNaN(num)) { + return null; + } + b.putByte(num); + } + return b.getBytes(); +}; + +/** + * Converts an IPv6 string representation into bytes (in network order). + * + * @param ip the IPv6 address to convert. + * + * @return the 16-byte address or null if the address can't be parsed. + */ +util.bytesFromIPv6 = function(ip) { + var blanks = 0; + ip = ip.split(':').filter(function(e) { + if(e.length === 0) ++blanks; + return true; + }); + var zeros = (8 - ip.length + blanks) * 2; + var b = util.createBuffer(); + for(var i = 0; i < 8; ++i) { + if(!ip[i] || ip[i].length === 0) { + b.fillWithByte(0, zeros); + zeros = 0; + continue; + } + var bytes = util.hexToBytes(ip[i]); + if(bytes.length < 2) { + b.putByte(0); + } + b.putBytes(bytes); + } + return b.getBytes(); +}; + +/** + * Converts 4-bytes into an IPv4 string representation or 16-bytes into + * an IPv6 string representation. The bytes must be in network order. + * + * @param bytes the bytes to convert. + * + * @return the IPv4 or IPv6 string representation if 4 or 16 bytes, + * respectively, are given, otherwise null. + */ +util.bytesToIP = function(bytes) { + if(bytes.length === 4) { + return util.bytesToIPv4(bytes); + } + if(bytes.length === 16) { + return util.bytesToIPv6(bytes); + } + return null; +}; + +/** + * Converts 4-bytes into an IPv4 string representation. The bytes must be + * in network order. + * + * @param bytes the bytes to convert. + * + * @return the IPv4 string representation or null for an invalid # of bytes. + */ +util.bytesToIPv4 = function(bytes) { + if(bytes.length !== 4) { + return null; + } + var ip = []; + for(var i = 0; i < bytes.length; ++i) { + ip.push(bytes.charCodeAt(i)); + } + return ip.join('.'); +}; + +/** + * Converts 16-bytes into an IPv16 string representation. The bytes must be + * in network order. + * + * @param bytes the bytes to convert. + * + * @return the IPv16 string representation or null for an invalid # of bytes. + */ +util.bytesToIPv6 = function(bytes) { + if(bytes.length !== 16) { + return null; + } + var ip = []; + var zeroGroups = []; + var zeroMaxGroup = 0; + for(var i = 0; i < bytes.length; i += 2) { + var hex = util.bytesToHex(bytes[i] + bytes[i + 1]); + // canonicalize zero representation + while(hex[0] === '0' && hex !== '0') { + hex = hex.substr(1); + } + if(hex === '0') { + var last = zeroGroups[zeroGroups.length - 1]; + var idx = ip.length; + if(!last || idx !== last.end + 1) { + zeroGroups.push({start: idx, end: idx}); + } else { + last.end = idx; + if((last.end - last.start) > + (zeroGroups[zeroMaxGroup].end - zeroGroups[zeroMaxGroup].start)) { + zeroMaxGroup = zeroGroups.length - 1; + } + } + } + ip.push(hex); + } + if(zeroGroups.length > 0) { + var group = zeroGroups[zeroMaxGroup]; + // only shorten group of length > 0 + if(group.end - group.start > 0) { + ip.splice(group.start, group.end - group.start + 1, ''); + if(group.start === 0) { + ip.unshift(''); + } + if(group.end === 7) { + ip.push(''); + } + } + } + return ip.join(':'); +}; + +/** + * Estimates the number of processes that can be run concurrently. If + * creating Web Workers, keep in mind that the main JavaScript process needs + * its own core. + * + * @param options the options to use: + * update true to force an update (not use the cached value). + * @param callback(err, max) called once the operation completes. + */ +util.estimateCores = function(options, callback) { + if(typeof options === 'function') { + callback = options; + options = {}; + } + options = options || {}; + if('cores' in util && !options.update) { + return callback(null, util.cores); + } + if(typeof navigator !== 'undefined' && + 'hardwareConcurrency' in navigator && + navigator.hardwareConcurrency > 0) { + util.cores = navigator.hardwareConcurrency; + return callback(null, util.cores); + } + if(typeof Worker === 'undefined') { + // workers not available + util.cores = 1; + return callback(null, util.cores); + } + if(typeof Blob === 'undefined') { + // can't estimate, default to 2 + util.cores = 2; + return callback(null, util.cores); + } + + // create worker concurrency estimation code as blob + var blobUrl = URL.createObjectURL(new Blob(['(', + function() { + self.addEventListener('message', function(e) { + // run worker for 4 ms + var st = Date.now(); + var et = st + 4; + while(Date.now() < et); + self.postMessage({st: st, et: et}); + }); + }.toString(), + ')()'], {type: 'application/javascript'})); + + // take 5 samples using 16 workers + sample([], 5, 16); + + function sample(max, samples, numWorkers) { + if(samples === 0) { + // get overlap average + var avg = Math.floor(max.reduce(function(avg, x) { + return avg + x; + }, 0) / max.length); + util.cores = Math.max(1, avg); + URL.revokeObjectURL(blobUrl); + return callback(null, util.cores); + } + map(numWorkers, function(err, results) { + max.push(reduce(numWorkers, results)); + sample(max, samples - 1, numWorkers); + }); + } + + function map(numWorkers, callback) { + var workers = []; + var results = []; + for(var i = 0; i < numWorkers; ++i) { + var worker = new Worker(blobUrl); + worker.addEventListener('message', function(e) { + results.push(e.data); + if(results.length === numWorkers) { + for(var i = 0; i < numWorkers; ++i) { + workers[i].terminate(); + } + callback(null, results); + } + }); + workers.push(worker); + } + for(var i = 0; i < numWorkers; ++i) { + workers[i].postMessage(i); + } + } + + function reduce(numWorkers, results) { + // find overlapping time windows + var overlaps = []; + for(var n = 0; n < numWorkers; ++n) { + var r1 = results[n]; + var overlap = overlaps[n] = []; + for(var i = 0; i < numWorkers; ++i) { + if(n === i) { + continue; + } + var r2 = results[i]; + if((r1.st > r2.st && r1.st < r2.et) || + (r2.st > r1.st && r2.st < r1.et)) { + overlap.push(i); + } + } + } + // get maximum overlaps ... don't include overlapping worker itself + // as the main JS process was also being scheduled during the work and + // would have to be subtracted from the estimate anyway + return overlaps.reduce(function(max, overlap) { + return Math.max(max, overlap.length); + }, 0); + } +}; + + +/***/ }), + +/***/ 5414: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * Javascript implementation of X.509 and related components (such as + * Certification Signing Requests) of a Public Key Infrastructure. + * + * @author Dave Longley + * + * Copyright (c) 2010-2014 Digital Bazaar, Inc. + * + * The ASN.1 representation of an X.509v3 certificate is as follows + * (see RFC 2459): + * + * Certificate ::= SEQUENCE { + * tbsCertificate TBSCertificate, + * signatureAlgorithm AlgorithmIdentifier, + * signatureValue BIT STRING + * } + * + * TBSCertificate ::= SEQUENCE { + * version [0] EXPLICIT Version DEFAULT v1, + * serialNumber CertificateSerialNumber, + * signature AlgorithmIdentifier, + * issuer Name, + * validity Validity, + * subject Name, + * subjectPublicKeyInfo SubjectPublicKeyInfo, + * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + * extensions [3] EXPLICIT Extensions OPTIONAL + * -- If present, version shall be v3 + * } + * + * Version ::= INTEGER { v1(0), v2(1), v3(2) } + * + * CertificateSerialNumber ::= INTEGER + * + * Name ::= CHOICE { + * // only one possible choice for now + * RDNSequence + * } + * + * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName + * + * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue + * + * AttributeTypeAndValue ::= SEQUENCE { + * type AttributeType, + * value AttributeValue + * } + * AttributeType ::= OBJECT IDENTIFIER + * AttributeValue ::= ANY DEFINED BY AttributeType + * + * Validity ::= SEQUENCE { + * notBefore Time, + * notAfter Time + * } + * + * Time ::= CHOICE { + * utcTime UTCTime, + * generalTime GeneralizedTime + * } + * + * UniqueIdentifier ::= BIT STRING + * + * SubjectPublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * subjectPublicKey BIT STRING + * } + * + * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension + * + * Extension ::= SEQUENCE { + * extnID OBJECT IDENTIFIER, + * critical BOOLEAN DEFAULT FALSE, + * extnValue OCTET STRING + * } + * + * The only key algorithm currently supported for PKI is RSA. + * + * RSASSA-PSS signatures are described in RFC 3447 and RFC 4055. + * + * PKCS#10 v1.7 describes certificate signing requests: + * + * CertificationRequestInfo: + * + * CertificationRequestInfo ::= SEQUENCE { + * version INTEGER { v1(0) } (v1,...), + * subject Name, + * subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }}, + * attributes [0] Attributes{{ CRIAttributes }} + * } + * + * Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }} + * + * CRIAttributes ATTRIBUTE ::= { + * ... -- add any locally defined attributes here -- } + * + * Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE { + * type ATTRIBUTE.&id({IOSet}), + * values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type}) + * } + * + * CertificationRequest ::= SEQUENCE { + * certificationRequestInfo CertificationRequestInfo, + * signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }}, + * signature BIT STRING + * } + */ +var forge = __webpack_require__(3832); +__webpack_require__(8925); +__webpack_require__(3068); +__webpack_require__(3480); +__webpack_require__(8991); +__webpack_require__(6971); +__webpack_require__(6270); +__webpack_require__(6953); +__webpack_require__(6007); +__webpack_require__(8095); +__webpack_require__(7116); + +// shortcut for asn.1 API +var asn1 = forge.asn1; + +/* Public Key Infrastructure (PKI) implementation. */ +var pki = module.exports = forge.pki = forge.pki || {}; +var oids = pki.oids; + +// short name OID mappings +var _shortNames = {}; +_shortNames['CN'] = oids['commonName']; +_shortNames['commonName'] = 'CN'; +_shortNames['C'] = oids['countryName']; +_shortNames['countryName'] = 'C'; +_shortNames['L'] = oids['localityName']; +_shortNames['localityName'] = 'L'; +_shortNames['ST'] = oids['stateOrProvinceName']; +_shortNames['stateOrProvinceName'] = 'ST'; +_shortNames['O'] = oids['organizationName']; +_shortNames['organizationName'] = 'O'; +_shortNames['OU'] = oids['organizationalUnitName']; +_shortNames['organizationalUnitName'] = 'OU'; +_shortNames['E'] = oids['emailAddress']; +_shortNames['emailAddress'] = 'E'; + +// validator for an SubjectPublicKeyInfo structure +// Note: Currently only works with an RSA public key +var publicKeyValidator = forge.pki.rsa.publicKeyValidator; + +// validator for an X.509v3 certificate +var x509CertificateValidator = { + name: 'Certificate', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'Certificate.TBSCertificate', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'tbsCertificate', + value: [{ + name: 'Certificate.TBSCertificate.version', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 0, + constructed: true, + optional: true, + value: [{ + name: 'Certificate.TBSCertificate.version.integer', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'certVersion' + }] + }, { + name: 'Certificate.TBSCertificate.serialNumber', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'certSerialNumber' + }, { + name: 'Certificate.TBSCertificate.signature', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'Certificate.TBSCertificate.signature.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'certinfoSignatureOid' + }, { + name: 'Certificate.TBSCertificate.signature.parameters', + tagClass: asn1.Class.UNIVERSAL, + optional: true, + captureAsn1: 'certinfoSignatureParams' + }] + }, { + name: 'Certificate.TBSCertificate.issuer', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'certIssuer' + }, { + name: 'Certificate.TBSCertificate.validity', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + // Note: UTC and generalized times may both appear so the capture + // names are based on their detected order, the names used below + // are only for the common case, which validity time really means + // "notBefore" and which means "notAfter" will be determined by order + value: [{ + // notBefore (Time) (UTC time case) + name: 'Certificate.TBSCertificate.validity.notBefore (utc)', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.UTCTIME, + constructed: false, + optional: true, + capture: 'certValidity1UTCTime' + }, { + // notBefore (Time) (generalized time case) + name: 'Certificate.TBSCertificate.validity.notBefore (generalized)', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.GENERALIZEDTIME, + constructed: false, + optional: true, + capture: 'certValidity2GeneralizedTime' + }, { + // notAfter (Time) (only UTC time is supported) + name: 'Certificate.TBSCertificate.validity.notAfter (utc)', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.UTCTIME, + constructed: false, + optional: true, + capture: 'certValidity3UTCTime' + }, { + // notAfter (Time) (only UTC time is supported) + name: 'Certificate.TBSCertificate.validity.notAfter (generalized)', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.GENERALIZEDTIME, + constructed: false, + optional: true, + capture: 'certValidity4GeneralizedTime' + }] + }, { + // Name (subject) (RDNSequence) + name: 'Certificate.TBSCertificate.subject', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'certSubject' + }, + // SubjectPublicKeyInfo + publicKeyValidator, + { + // issuerUniqueID (optional) + name: 'Certificate.TBSCertificate.issuerUniqueID', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 1, + constructed: true, + optional: true, + value: [{ + name: 'Certificate.TBSCertificate.issuerUniqueID.id', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.BITSTRING, + constructed: false, + // TODO: support arbitrary bit length ids + captureBitStringValue: 'certIssuerUniqueId' + }] + }, { + // subjectUniqueID (optional) + name: 'Certificate.TBSCertificate.subjectUniqueID', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 2, + constructed: true, + optional: true, + value: [{ + name: 'Certificate.TBSCertificate.subjectUniqueID.id', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.BITSTRING, + constructed: false, + // TODO: support arbitrary bit length ids + captureBitStringValue: 'certSubjectUniqueId' + }] + }, { + // Extensions (optional) + name: 'Certificate.TBSCertificate.extensions', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 3, + constructed: true, + captureAsn1: 'certExtensions', + optional: true + }] + }, { + // AlgorithmIdentifier (signature algorithm) + name: 'Certificate.signatureAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + // algorithm + name: 'Certificate.signatureAlgorithm.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'certSignatureOid' + }, { + name: 'Certificate.TBSCertificate.signature.parameters', + tagClass: asn1.Class.UNIVERSAL, + optional: true, + captureAsn1: 'certSignatureParams' + }] + }, { + // SignatureValue + name: 'Certificate.signatureValue', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.BITSTRING, + constructed: false, + captureBitStringValue: 'certSignature' + }] +}; + +var rsassaPssParameterValidator = { + name: 'rsapss', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'rsapss.hashAlgorithm', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 0, + constructed: true, + value: [{ + name: 'rsapss.hashAlgorithm.AlgorithmIdentifier', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Class.SEQUENCE, + constructed: true, + optional: true, + value: [{ + name: 'rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'hashOid' + /* parameter block omitted, for SHA1 NULL anyhow. */ + }] + }] + }, { + name: 'rsapss.maskGenAlgorithm', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 1, + constructed: true, + value: [{ + name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Class.SEQUENCE, + constructed: true, + optional: true, + value: [{ + name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'maskGenOid' + }, { + name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'maskGenHashOid' + /* parameter block omitted, for SHA1 NULL anyhow. */ + }] + }] + }] + }, { + name: 'rsapss.saltLength', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 2, + optional: true, + value: [{ + name: 'rsapss.saltLength.saltLength', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Class.INTEGER, + constructed: false, + capture: 'saltLength' + }] + }, { + name: 'rsapss.trailerField', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 3, + optional: true, + value: [{ + name: 'rsapss.trailer.trailer', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Class.INTEGER, + constructed: false, + capture: 'trailer' + }] + }] +}; + +// validator for a CertificationRequestInfo structure +var certificationRequestInfoValidator = { + name: 'CertificationRequestInfo', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'certificationRequestInfo', + value: [{ + name: 'CertificationRequestInfo.integer', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.INTEGER, + constructed: false, + capture: 'certificationRequestInfoVersion' + }, { + // Name (subject) (RDNSequence) + name: 'CertificationRequestInfo.subject', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'certificationRequestInfoSubject' + }, + // SubjectPublicKeyInfo + publicKeyValidator, + { + name: 'CertificationRequestInfo.attributes', + tagClass: asn1.Class.CONTEXT_SPECIFIC, + type: 0, + constructed: true, + optional: true, + capture: 'certificationRequestInfoAttributes', + value: [{ + name: 'CertificationRequestInfo.attributes', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + name: 'CertificationRequestInfo.attributes.type', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false + }, { + name: 'CertificationRequestInfo.attributes.value', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SET, + constructed: true + }] + }] + }] +}; + +// validator for a CertificationRequest structure +var certificationRequestValidator = { + name: 'CertificationRequest', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + captureAsn1: 'csr', + value: [ + certificationRequestInfoValidator, { + // AlgorithmIdentifier (signature algorithm) + name: 'CertificationRequest.signatureAlgorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.SEQUENCE, + constructed: true, + value: [{ + // algorithm + name: 'CertificationRequest.signatureAlgorithm.algorithm', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.OID, + constructed: false, + capture: 'csrSignatureOid' + }, { + name: 'CertificationRequest.signatureAlgorithm.parameters', + tagClass: asn1.Class.UNIVERSAL, + optional: true, + captureAsn1: 'csrSignatureParams' + }] + }, { + // signature + name: 'CertificationRequest.signature', + tagClass: asn1.Class.UNIVERSAL, + type: asn1.Type.BITSTRING, + constructed: false, + captureBitStringValue: 'csrSignature' + } + ] +}; + +/** + * Converts an RDNSequence of ASN.1 DER-encoded RelativeDistinguishedName + * sets into an array with objects that have type and value properties. + * + * @param rdn the RDNSequence to convert. + * @param md a message digest to append type and value to if provided. + */ +pki.RDNAttributesAsArray = function(rdn, md) { + var rval = []; + + // each value in 'rdn' in is a SET of RelativeDistinguishedName + var set, attr, obj; + for(var si = 0; si < rdn.value.length; ++si) { + // get the RelativeDistinguishedName set + set = rdn.value[si]; + + // each value in the SET is an AttributeTypeAndValue sequence + // containing first a type (an OID) and second a value (defined by + // the OID) + for(var i = 0; i < set.value.length; ++i) { + obj = {}; + attr = set.value[i]; + obj.type = asn1.derToOid(attr.value[0].value); + obj.value = attr.value[1].value; + obj.valueTagClass = attr.value[1].type; + // if the OID is known, get its name and short name + if(obj.type in oids) { + obj.name = oids[obj.type]; + if(obj.name in _shortNames) { + obj.shortName = _shortNames[obj.name]; + } + } + if(md) { + md.update(obj.type); + md.update(obj.value); + } + rval.push(obj); + } + } + + return rval; +}; + +/** + * Converts ASN.1 CRIAttributes into an array with objects that have type and + * value properties. + * + * @param attributes the CRIAttributes to convert. + */ +pki.CRIAttributesAsArray = function(attributes) { + var rval = []; + + // each value in 'attributes' in is a SEQUENCE with an OID and a SET + for(var si = 0; si < attributes.length; ++si) { + // get the attribute sequence + var seq = attributes[si]; + + // each value in the SEQUENCE containing first a type (an OID) and + // second a set of values (defined by the OID) + var type = asn1.derToOid(seq.value[0].value); + var values = seq.value[1].value; + for(var vi = 0; vi < values.length; ++vi) { + var obj = {}; + obj.type = type; + obj.value = values[vi].value; + obj.valueTagClass = values[vi].type; + // if the OID is known, get its name and short name + if(obj.type in oids) { + obj.name = oids[obj.type]; + if(obj.name in _shortNames) { + obj.shortName = _shortNames[obj.name]; + } + } + // parse extensions + if(obj.type === oids.extensionRequest) { + obj.extensions = []; + for(var ei = 0; ei < obj.value.length; ++ei) { + obj.extensions.push(pki.certificateExtensionFromAsn1(obj.value[ei])); + } + } + rval.push(obj); + } + } + + return rval; +}; + +/** + * Gets an issuer or subject attribute from its name, type, or short name. + * + * @param obj the issuer or subject object. + * @param options a short name string or an object with: + * shortName the short name for the attribute. + * name the name for the attribute. + * type the type for the attribute. + * + * @return the attribute. + */ +function _getAttribute(obj, options) { + if(typeof options === 'string') { + options = {shortName: options}; + } + + var rval = null; + var attr; + for(var i = 0; rval === null && i < obj.attributes.length; ++i) { + attr = obj.attributes[i]; + if(options.type && options.type === attr.type) { + rval = attr; + } else if(options.name && options.name === attr.name) { + rval = attr; + } else if(options.shortName && options.shortName === attr.shortName) { + rval = attr; + } + } + return rval; +} + +/** + * Converts signature parameters from ASN.1 structure. + * + * Currently only RSASSA-PSS supported. The PKCS#1 v1.5 signature scheme had + * no parameters. + * + * RSASSA-PSS-params ::= SEQUENCE { + * hashAlgorithm [0] HashAlgorithm DEFAULT + * sha1Identifier, + * maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT + * mgf1SHA1Identifier, + * saltLength [2] INTEGER DEFAULT 20, + * trailerField [3] INTEGER DEFAULT 1 + * } + * + * HashAlgorithm ::= AlgorithmIdentifier + * + * MaskGenAlgorithm ::= AlgorithmIdentifier + * + * AlgorithmIdentifer ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL + * } + * + * @param oid The OID specifying the signature algorithm + * @param obj The ASN.1 structure holding the parameters + * @param fillDefaults Whether to use return default values where omitted + * @return signature parameter object + */ +var _readSignatureParameters = function(oid, obj, fillDefaults) { + var params = {}; + + if(oid !== oids['RSASSA-PSS']) { + return params; + } + + if(fillDefaults) { + params = { + hash: { + algorithmOid: oids['sha1'] + }, + mgf: { + algorithmOid: oids['mgf1'], + hash: { + algorithmOid: oids['sha1'] + } + }, + saltLength: 20 + }; + } + + var capture = {}; + var errors = []; + if(!asn1.validate(obj, rsassaPssParameterValidator, capture, errors)) { + var error = new Error('Cannot read RSASSA-PSS parameter block.'); + error.errors = errors; + throw error; + } + + if(capture.hashOid !== undefined) { + params.hash = params.hash || {}; + params.hash.algorithmOid = asn1.derToOid(capture.hashOid); + } + + if(capture.maskGenOid !== undefined) { + params.mgf = params.mgf || {}; + params.mgf.algorithmOid = asn1.derToOid(capture.maskGenOid); + params.mgf.hash = params.mgf.hash || {}; + params.mgf.hash.algorithmOid = asn1.derToOid(capture.maskGenHashOid); + } + + if(capture.saltLength !== undefined) { + params.saltLength = capture.saltLength.charCodeAt(0); + } + + return params; +}; + +/** + * Create signature digest for OID. + * + * @param options + * signatureOid: the OID specifying the signature algorithm. + * type: a human readable type for error messages + * @return a created md instance. throws if unknown oid. + */ +var _createSignatureDigest = function(options) { + switch(oids[options.signatureOid]) { + case 'sha1WithRSAEncryption': + // deprecated alias + case 'sha1WithRSASignature': + return forge.md.sha1.create(); + case 'md5WithRSAEncryption': + return forge.md.md5.create(); + case 'sha256WithRSAEncryption': + return forge.md.sha256.create(); + case 'sha384WithRSAEncryption': + return forge.md.sha384.create(); + case 'sha512WithRSAEncryption': + return forge.md.sha512.create(); + case 'RSASSA-PSS': + return forge.md.sha256.create(); + default: + var error = new Error( + 'Could not compute ' + options.type + ' digest. ' + + 'Unknown signature OID.'); + error.signatureOid = options.signatureOid; + throw error; + } +}; + +/** + * Verify signature on certificate or CSR. + * + * @param options: + * certificate the certificate or CSR to verify. + * md the signature digest. + * signature the signature + * @return a created md instance. throws if unknown oid. + */ +var _verifySignature = function(options) { + var cert = options.certificate; + var scheme; + + switch(cert.signatureOid) { + case oids.sha1WithRSAEncryption: + // deprecated alias + case oids.sha1WithRSASignature: + /* use PKCS#1 v1.5 padding scheme */ + break; + case oids['RSASSA-PSS']: + var hash, mgf; + + /* initialize mgf */ + hash = oids[cert.signatureParameters.mgf.hash.algorithmOid]; + if(hash === undefined || forge.md[hash] === undefined) { + var error = new Error('Unsupported MGF hash function.'); + error.oid = cert.signatureParameters.mgf.hash.algorithmOid; + error.name = hash; + throw error; + } + + mgf = oids[cert.signatureParameters.mgf.algorithmOid]; + if(mgf === undefined || forge.mgf[mgf] === undefined) { + var error = new Error('Unsupported MGF function.'); + error.oid = cert.signatureParameters.mgf.algorithmOid; + error.name = mgf; + throw error; + } + + mgf = forge.mgf[mgf].create(forge.md[hash].create()); + + /* initialize hash function */ + hash = oids[cert.signatureParameters.hash.algorithmOid]; + if(hash === undefined || forge.md[hash] === undefined) { + var error = new Error('Unsupported RSASSA-PSS hash function.'); + error.oid = cert.signatureParameters.hash.algorithmOid; + error.name = hash; + throw error; + } + + scheme = forge.pss.create( + forge.md[hash].create(), mgf, cert.signatureParameters.saltLength + ); + break; + } + + // verify signature on cert using public key + return cert.publicKey.verify( + options.md.digest().getBytes(), options.signature, scheme + ); +}; + +/** + * Converts an X.509 certificate from PEM format. + * + * Note: If the certificate is to be verified then compute hash should + * be set to true. This will scan the TBSCertificate part of the ASN.1 + * object while it is converted so it doesn't need to be converted back + * to ASN.1-DER-encoding later. + * + * @param pem the PEM-formatted certificate. + * @param computeHash true to compute the hash for verification. + * @param strict true to be strict when checking ASN.1 value lengths, false to + * allow truncated values (default: true). + * + * @return the certificate. + */ +pki.certificateFromPem = function(pem, computeHash, strict) { + var msg = forge.pem.decode(pem)[0]; + + if(msg.type !== 'CERTIFICATE' && + msg.type !== 'X509 CERTIFICATE' && + msg.type !== 'TRUSTED CERTIFICATE') { + var error = new Error( + 'Could not convert certificate from PEM; PEM header type ' + + 'is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'); + error.headerType = msg.type; + throw error; + } + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error( + 'Could not convert certificate from PEM; PEM is encrypted.'); + } + + // convert DER to ASN.1 object + var obj = asn1.fromDer(msg.body, strict); + + return pki.certificateFromAsn1(obj, computeHash); +}; + +/** + * Converts an X.509 certificate to PEM format. + * + * @param cert the certificate. + * @param maxline the maximum characters per line, defaults to 64. + * + * @return the PEM-formatted certificate. + */ +pki.certificateToPem = function(cert, maxline) { + // convert to ASN.1, then DER, then PEM-encode + var msg = { + type: 'CERTIFICATE', + body: asn1.toDer(pki.certificateToAsn1(cert)).getBytes() + }; + return forge.pem.encode(msg, {maxline: maxline}); +}; + +/** + * Converts an RSA public key from PEM format. + * + * @param pem the PEM-formatted public key. + * + * @return the public key. + */ +pki.publicKeyFromPem = function(pem) { + var msg = forge.pem.decode(pem)[0]; + + if(msg.type !== 'PUBLIC KEY' && msg.type !== 'RSA PUBLIC KEY') { + var error = new Error('Could not convert public key from PEM; PEM header ' + + 'type is not "PUBLIC KEY" or "RSA PUBLIC KEY".'); + error.headerType = msg.type; + throw error; + } + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error('Could not convert public key from PEM; PEM is encrypted.'); + } + + // convert DER to ASN.1 object + var obj = asn1.fromDer(msg.body); + + return pki.publicKeyFromAsn1(obj); +}; + +/** + * Converts an RSA public key to PEM format (using a SubjectPublicKeyInfo). + * + * @param key the public key. + * @param maxline the maximum characters per line, defaults to 64. + * + * @return the PEM-formatted public key. + */ +pki.publicKeyToPem = function(key, maxline) { + // convert to ASN.1, then DER, then PEM-encode + var msg = { + type: 'PUBLIC KEY', + body: asn1.toDer(pki.publicKeyToAsn1(key)).getBytes() + }; + return forge.pem.encode(msg, {maxline: maxline}); +}; + +/** + * Converts an RSA public key to PEM format (using an RSAPublicKey). + * + * @param key the public key. + * @param maxline the maximum characters per line, defaults to 64. + * + * @return the PEM-formatted public key. + */ +pki.publicKeyToRSAPublicKeyPem = function(key, maxline) { + // convert to ASN.1, then DER, then PEM-encode + var msg = { + type: 'RSA PUBLIC KEY', + body: asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes() + }; + return forge.pem.encode(msg, {maxline: maxline}); +}; + +/** + * Gets a fingerprint for the given public key. + * + * @param options the options to use. + * [md] the message digest object to use (defaults to forge.md.sha1). + * [type] the type of fingerprint, such as 'RSAPublicKey', + * 'SubjectPublicKeyInfo' (defaults to 'RSAPublicKey'). + * [encoding] an alternative output encoding, such as 'hex' + * (defaults to none, outputs a byte buffer). + * [delimiter] the delimiter to use between bytes for 'hex' encoded + * output, eg: ':' (defaults to none). + * + * @return the fingerprint as a byte buffer or other encoding based on options. + */ +pki.getPublicKeyFingerprint = function(key, options) { + options = options || {}; + var md = options.md || forge.md.sha1.create(); + var type = options.type || 'RSAPublicKey'; + + var bytes; + switch(type) { + case 'RSAPublicKey': + bytes = asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes(); + break; + case 'SubjectPublicKeyInfo': + bytes = asn1.toDer(pki.publicKeyToAsn1(key)).getBytes(); + break; + default: + throw new Error('Unknown fingerprint type "' + options.type + '".'); + } + + // hash public key bytes + md.start(); + md.update(bytes); + var digest = md.digest(); + if(options.encoding === 'hex') { + var hex = digest.toHex(); + if(options.delimiter) { + return hex.match(/.{2}/g).join(options.delimiter); + } + return hex; + } else if(options.encoding === 'binary') { + return digest.getBytes(); + } else if(options.encoding) { + throw new Error('Unknown encoding "' + options.encoding + '".'); + } + return digest; +}; + +/** + * Converts a PKCS#10 certification request (CSR) from PEM format. + * + * Note: If the certification request is to be verified then compute hash + * should be set to true. This will scan the CertificationRequestInfo part of + * the ASN.1 object while it is converted so it doesn't need to be converted + * back to ASN.1-DER-encoding later. + * + * @param pem the PEM-formatted certificate. + * @param computeHash true to compute the hash for verification. + * @param strict true to be strict when checking ASN.1 value lengths, false to + * allow truncated values (default: true). + * + * @return the certification request (CSR). + */ +pki.certificationRequestFromPem = function(pem, computeHash, strict) { + var msg = forge.pem.decode(pem)[0]; + + if(msg.type !== 'CERTIFICATE REQUEST') { + var error = new Error('Could not convert certification request from PEM; ' + + 'PEM header type is not "CERTIFICATE REQUEST".'); + error.headerType = msg.type; + throw error; + } + if(msg.procType && msg.procType.type === 'ENCRYPTED') { + throw new Error('Could not convert certification request from PEM; ' + + 'PEM is encrypted.'); + } + + // convert DER to ASN.1 object + var obj = asn1.fromDer(msg.body, strict); + + return pki.certificationRequestFromAsn1(obj, computeHash); +}; + +/** + * Converts a PKCS#10 certification request (CSR) to PEM format. + * + * @param csr the certification request. + * @param maxline the maximum characters per line, defaults to 64. + * + * @return the PEM-formatted certification request. + */ +pki.certificationRequestToPem = function(csr, maxline) { + // convert to ASN.1, then DER, then PEM-encode + var msg = { + type: 'CERTIFICATE REQUEST', + body: asn1.toDer(pki.certificationRequestToAsn1(csr)).getBytes() + }; + return forge.pem.encode(msg, {maxline: maxline}); +}; + +/** + * Creates an empty X.509v3 RSA certificate. + * + * @return the certificate. + */ +pki.createCertificate = function() { + var cert = {}; + cert.version = 0x02; + cert.serialNumber = '00'; + cert.signatureOid = null; + cert.signature = null; + cert.siginfo = {}; + cert.siginfo.algorithmOid = null; + cert.validity = {}; + cert.validity.notBefore = new Date(); + cert.validity.notAfter = new Date(); + + cert.issuer = {}; + cert.issuer.getField = function(sn) { + return _getAttribute(cert.issuer, sn); + }; + cert.issuer.addField = function(attr) { + _fillMissingFields([attr]); + cert.issuer.attributes.push(attr); + }; + cert.issuer.attributes = []; + cert.issuer.hash = null; + + cert.subject = {}; + cert.subject.getField = function(sn) { + return _getAttribute(cert.subject, sn); + }; + cert.subject.addField = function(attr) { + _fillMissingFields([attr]); + cert.subject.attributes.push(attr); + }; + cert.subject.attributes = []; + cert.subject.hash = null; + + cert.extensions = []; + cert.publicKey = null; + cert.md = null; + + /** + * Sets the subject of this certificate. + * + * @param attrs the array of subject attributes to use. + * @param uniqueId an optional a unique ID to use. + */ + cert.setSubject = function(attrs, uniqueId) { + // set new attributes, clear hash + _fillMissingFields(attrs); + cert.subject.attributes = attrs; + delete cert.subject.uniqueId; + if(uniqueId) { + // TODO: support arbitrary bit length ids + cert.subject.uniqueId = uniqueId; + } + cert.subject.hash = null; + }; + + /** + * Sets the issuer of this certificate. + * + * @param attrs the array of issuer attributes to use. + * @param uniqueId an optional a unique ID to use. + */ + cert.setIssuer = function(attrs, uniqueId) { + // set new attributes, clear hash + _fillMissingFields(attrs); + cert.issuer.attributes = attrs; + delete cert.issuer.uniqueId; + if(uniqueId) { + // TODO: support arbitrary bit length ids + cert.issuer.uniqueId = uniqueId; + } + cert.issuer.hash = null; + }; + + /** + * Sets the extensions of this certificate. + * + * @param exts the array of extensions to use. + */ + cert.setExtensions = function(exts) { + for(var i = 0; i < exts.length; ++i) { + _fillMissingExtensionFields(exts[i], {cert: cert}); + } + // set new extensions + cert.extensions = exts; + }; + + /** + * Gets an extension by its name or id. + * + * @param options the name to use or an object with: + * name the name to use. + * id the id to use. + * + * @return the extension or null if not found. + */ + cert.getExtension = function(options) { + if(typeof options === 'string') { + options = {name: options}; + } + + var rval = null; + var ext; + for(var i = 0; rval === null && i < cert.extensions.length; ++i) { + ext = cert.extensions[i]; + if(options.id && ext.id === options.id) { + rval = ext; + } else if(options.name && ext.name === options.name) { + rval = ext; + } + } + return rval; + }; + + /** + * Signs this certificate using the given private key. + * + * @param key the private key to sign with. + * @param md the message digest object to use (defaults to forge.md.sha1). + */ + cert.sign = function(key, md) { + // TODO: get signature OID from private key + cert.md = md || forge.md.sha1.create(); + var algorithmOid = oids[cert.md.algorithm + 'WithRSAEncryption']; + if(!algorithmOid) { + var error = new Error('Could not compute certificate digest. ' + + 'Unknown message digest algorithm OID.'); + error.algorithm = cert.md.algorithm; + throw error; + } + cert.signatureOid = cert.siginfo.algorithmOid = algorithmOid; + + // get TBSCertificate, convert to DER + cert.tbsCertificate = pki.getTBSCertificate(cert); + var bytes = asn1.toDer(cert.tbsCertificate); + + // digest and sign + cert.md.update(bytes.getBytes()); + cert.signature = key.sign(cert.md); + }; + + /** + * Attempts verify the signature on the passed certificate using this + * certificate's public key. + * + * @param child the certificate to verify. + * + * @return true if verified, false if not. + */ + cert.verify = function(child) { + var rval = false; + + if(!cert.issued(child)) { + var issuer = child.issuer; + var subject = cert.subject; + var error = new Error( + 'The parent certificate did not issue the given child ' + + 'certificate; the child certificate\'s issuer does not match the ' + + 'parent\'s subject.'); + error.expectedIssuer = subject.attributes; + error.actualIssuer = issuer.attributes; + throw error; + } + + var md = child.md; + if(md === null) { + // create digest for OID signature types + md = _createSignatureDigest({ + signatureOid: child.signatureOid, + type: 'certificate' + }); + + // produce DER formatted TBSCertificate and digest it + var tbsCertificate = child.tbsCertificate || pki.getTBSCertificate(child); + var bytes = asn1.toDer(tbsCertificate); + md.update(bytes.getBytes()); + } + + if(md !== null) { + rval = _verifySignature({ + certificate: cert, md: md, signature: child.signature + }); + } + + return rval; + }; + + /** + * Returns true if this certificate's issuer matches the passed + * certificate's subject. Note that no signature check is performed. + * + * @param parent the certificate to check. + * + * @return true if this certificate's issuer matches the passed certificate's + * subject. + */ + cert.isIssuer = function(parent) { + var rval = false; + + var i = cert.issuer; + var s = parent.subject; + + // compare hashes if present + if(i.hash && s.hash) { + rval = (i.hash === s.hash); + } else if(i.attributes.length === s.attributes.length) { + // all attributes are the same so issuer matches subject + rval = true; + var iattr, sattr; + for(var n = 0; rval && n < i.attributes.length; ++n) { + iattr = i.attributes[n]; + sattr = s.attributes[n]; + if(iattr.type !== sattr.type || iattr.value !== sattr.value) { + // attribute mismatch + rval = false; + } + } + } + + return rval; + }; + + /** + * Returns true if this certificate's subject matches the issuer of the + * given certificate). Note that not signature check is performed. + * + * @param child the certificate to check. + * + * @return true if this certificate's subject matches the passed + * certificate's issuer. + */ + cert.issued = function(child) { + return child.isIssuer(cert); + }; + + /** + * Generates the subjectKeyIdentifier for this certificate as byte buffer. + * + * @return the subjectKeyIdentifier for this certificate as byte buffer. + */ + cert.generateSubjectKeyIdentifier = function() { + /* See: 4.2.1.2 section of the the RFC3280, keyIdentifier is either: + + (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the + value of the BIT STRING subjectPublicKey (excluding the tag, + length, and number of unused bits). + + (2) The keyIdentifier is composed of a four bit type field with + the value 0100 followed by the least significant 60 bits of the + SHA-1 hash of the value of the BIT STRING subjectPublicKey + (excluding the tag, length, and number of unused bit string bits). + */ + + // skipping the tag, length, and number of unused bits is the same + // as just using the RSAPublicKey (for RSA keys, which are the + // only ones supported) + return pki.getPublicKeyFingerprint(cert.publicKey, {type: 'RSAPublicKey'}); + }; + + /** + * Verifies the subjectKeyIdentifier extension value for this certificate + * against its public key. If no extension is found, false will be + * returned. + * + * @return true if verified, false if not. + */ + cert.verifySubjectKeyIdentifier = function() { + var oid = oids['subjectKeyIdentifier']; + for(var i = 0; i < cert.extensions.length; ++i) { + var ext = cert.extensions[i]; + if(ext.id === oid) { + var ski = cert.generateSubjectKeyIdentifier().getBytes(); + return (forge.util.hexToBytes(ext.subjectKeyIdentifier) === ski); + } + } + return false; + }; + + return cert; +}; + +/** + * Converts an X.509v3 RSA certificate from an ASN.1 object. + * + * Note: If the certificate is to be verified then compute hash should + * be set to true. There is currently no implementation for converting + * a certificate back to ASN.1 so the TBSCertificate part of the ASN.1 + * object needs to be scanned before the cert object is created. + * + * @param obj the asn1 representation of an X.509v3 RSA certificate. + * @param computeHash true to compute the hash for verification. + * + * @return the certificate. + */ +pki.certificateFromAsn1 = function(obj, computeHash) { + // validate certificate and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(obj, x509CertificateValidator, capture, errors)) { + var error = new Error('Cannot read X.509 certificate. ' + + 'ASN.1 object is not an X509v3 Certificate.'); + error.errors = errors; + throw error; + } + + // get oid + var oid = asn1.derToOid(capture.publicKeyOid); + if(oid !== pki.oids.rsaEncryption) { + throw new Error('Cannot read public key. OID is not RSA.'); + } + + // create certificate + var cert = pki.createCertificate(); + cert.version = capture.certVersion ? + capture.certVersion.charCodeAt(0) : 0; + var serial = forge.util.createBuffer(capture.certSerialNumber); + cert.serialNumber = serial.toHex(); + cert.signatureOid = forge.asn1.derToOid(capture.certSignatureOid); + cert.signatureParameters = _readSignatureParameters( + cert.signatureOid, capture.certSignatureParams, true); + cert.siginfo.algorithmOid = forge.asn1.derToOid(capture.certinfoSignatureOid); + cert.siginfo.parameters = _readSignatureParameters(cert.siginfo.algorithmOid, + capture.certinfoSignatureParams, false); + cert.signature = capture.certSignature; + + var validity = []; + if(capture.certValidity1UTCTime !== undefined) { + validity.push(asn1.utcTimeToDate(capture.certValidity1UTCTime)); + } + if(capture.certValidity2GeneralizedTime !== undefined) { + validity.push(asn1.generalizedTimeToDate( + capture.certValidity2GeneralizedTime)); + } + if(capture.certValidity3UTCTime !== undefined) { + validity.push(asn1.utcTimeToDate(capture.certValidity3UTCTime)); + } + if(capture.certValidity4GeneralizedTime !== undefined) { + validity.push(asn1.generalizedTimeToDate( + capture.certValidity4GeneralizedTime)); + } + if(validity.length > 2) { + throw new Error('Cannot read notBefore/notAfter validity times; more ' + + 'than two times were provided in the certificate.'); + } + if(validity.length < 2) { + throw new Error('Cannot read notBefore/notAfter validity times; they ' + + 'were not provided as either UTCTime or GeneralizedTime.'); + } + cert.validity.notBefore = validity[0]; + cert.validity.notAfter = validity[1]; + + // keep TBSCertificate to preserve signature when exporting + cert.tbsCertificate = capture.tbsCertificate; + + if(computeHash) { + // create digest for OID signature type + cert.md = _createSignatureDigest({ + signatureOid: cert.signatureOid, + type: 'certificate' + }); + + // produce DER formatted TBSCertificate and digest it + var bytes = asn1.toDer(cert.tbsCertificate); + cert.md.update(bytes.getBytes()); + } + + // handle issuer, build issuer message digest + var imd = forge.md.sha1.create(); + var ibytes = asn1.toDer(capture.certIssuer); + imd.update(ibytes.getBytes()); + cert.issuer.getField = function(sn) { + return _getAttribute(cert.issuer, sn); + }; + cert.issuer.addField = function(attr) { + _fillMissingFields([attr]); + cert.issuer.attributes.push(attr); + }; + cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer); + if(capture.certIssuerUniqueId) { + cert.issuer.uniqueId = capture.certIssuerUniqueId; + } + cert.issuer.hash = imd.digest().toHex(); + + // handle subject, build subject message digest + var smd = forge.md.sha1.create(); + var sbytes = asn1.toDer(capture.certSubject); + smd.update(sbytes.getBytes()); + cert.subject.getField = function(sn) { + return _getAttribute(cert.subject, sn); + }; + cert.subject.addField = function(attr) { + _fillMissingFields([attr]); + cert.subject.attributes.push(attr); + }; + cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject); + if(capture.certSubjectUniqueId) { + cert.subject.uniqueId = capture.certSubjectUniqueId; + } + cert.subject.hash = smd.digest().toHex(); + + // handle extensions + if(capture.certExtensions) { + cert.extensions = pki.certificateExtensionsFromAsn1(capture.certExtensions); + } else { + cert.extensions = []; + } + + // convert RSA public key from ASN.1 + cert.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo); + + return cert; +}; + +/** + * Converts an ASN.1 extensions object (with extension sequences as its + * values) into an array of extension objects with types and values. + * + * Supported extensions: + * + * id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 } + * KeyUsage ::= BIT STRING { + * digitalSignature (0), + * nonRepudiation (1), + * keyEncipherment (2), + * dataEncipherment (3), + * keyAgreement (4), + * keyCertSign (5), + * cRLSign (6), + * encipherOnly (7), + * decipherOnly (8) + * } + * + * id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 } + * BasicConstraints ::= SEQUENCE { + * cA BOOLEAN DEFAULT FALSE, + * pathLenConstraint INTEGER (0..MAX) OPTIONAL + * } + * + * subjectAltName EXTENSION ::= { + * SYNTAX GeneralNames + * IDENTIFIED BY id-ce-subjectAltName + * } + * + * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + * + * GeneralName ::= CHOICE { + * otherName [0] INSTANCE OF OTHER-NAME, + * rfc822Name [1] IA5String, + * dNSName [2] IA5String, + * x400Address [3] ORAddress, + * directoryName [4] Name, + * ediPartyName [5] EDIPartyName, + * uniformResourceIdentifier [6] IA5String, + * IPAddress [7] OCTET STRING, + * registeredID [8] OBJECT IDENTIFIER + * } + * + * OTHER-NAME ::= TYPE-IDENTIFIER + * + * EDIPartyName ::= SEQUENCE { + * nameAssigner [0] DirectoryString {ub-name} OPTIONAL, + * partyName [1] DirectoryString {ub-name} + * } + * + * @param exts the extensions ASN.1 with extension sequences to parse. + * + * @return the array. + */ +pki.certificateExtensionsFromAsn1 = function(exts) { + var rval = []; + for(var i = 0; i < exts.value.length; ++i) { + // get extension sequence + var extseq = exts.value[i]; + for(var ei = 0; ei < extseq.value.length; ++ei) { + rval.push(pki.certificateExtensionFromAsn1(extseq.value[ei])); + } + } + + return rval; +}; + +/** + * Parses a single certificate extension from ASN.1. + * + * @param ext the extension in ASN.1 format. + * + * @return the parsed extension as an object. + */ +pki.certificateExtensionFromAsn1 = function(ext) { + // an extension has: + // [0] extnID OBJECT IDENTIFIER + // [1] critical BOOLEAN DEFAULT FALSE + // [2] extnValue OCTET STRING + var e = {}; + e.id = asn1.derToOid(ext.value[0].value); + e.critical = false; + if(ext.value[1].type === asn1.Type.BOOLEAN) { + e.critical = (ext.value[1].value.charCodeAt(0) !== 0x00); + e.value = ext.value[2].value; + } else { + e.value = ext.value[1].value; + } + // if the oid is known, get its name + if(e.id in oids) { + e.name = oids[e.id]; + + // handle key usage + if(e.name === 'keyUsage') { + // get value as BIT STRING + var ev = asn1.fromDer(e.value); + var b2 = 0x00; + var b3 = 0x00; + if(ev.value.length > 1) { + // skip first byte, just indicates unused bits which + // will be padded with 0s anyway + // get bytes with flag bits + b2 = ev.value.charCodeAt(1); + b3 = ev.value.length > 2 ? ev.value.charCodeAt(2) : 0; + } + // set flags + e.digitalSignature = (b2 & 0x80) === 0x80; + e.nonRepudiation = (b2 & 0x40) === 0x40; + e.keyEncipherment = (b2 & 0x20) === 0x20; + e.dataEncipherment = (b2 & 0x10) === 0x10; + e.keyAgreement = (b2 & 0x08) === 0x08; + e.keyCertSign = (b2 & 0x04) === 0x04; + e.cRLSign = (b2 & 0x02) === 0x02; + e.encipherOnly = (b2 & 0x01) === 0x01; + e.decipherOnly = (b3 & 0x80) === 0x80; + } else if(e.name === 'basicConstraints') { + // handle basic constraints + // get value as SEQUENCE + var ev = asn1.fromDer(e.value); + // get cA BOOLEAN flag (defaults to false) + if(ev.value.length > 0 && ev.value[0].type === asn1.Type.BOOLEAN) { + e.cA = (ev.value[0].value.charCodeAt(0) !== 0x00); + } else { + e.cA = false; + } + // get path length constraint + var value = null; + if(ev.value.length > 0 && ev.value[0].type === asn1.Type.INTEGER) { + value = ev.value[0].value; + } else if(ev.value.length > 1) { + value = ev.value[1].value; + } + if(value !== null) { + e.pathLenConstraint = asn1.derToInteger(value); + } + } else if(e.name === 'extKeyUsage') { + // handle extKeyUsage + // value is a SEQUENCE of OIDs + var ev = asn1.fromDer(e.value); + for(var vi = 0; vi < ev.value.length; ++vi) { + var oid = asn1.derToOid(ev.value[vi].value); + if(oid in oids) { + e[oids[oid]] = true; + } else { + e[oid] = true; + } + } + } else if(e.name === 'nsCertType') { + // handle nsCertType + // get value as BIT STRING + var ev = asn1.fromDer(e.value); + var b2 = 0x00; + if(ev.value.length > 1) { + // skip first byte, just indicates unused bits which + // will be padded with 0s anyway + // get bytes with flag bits + b2 = ev.value.charCodeAt(1); + } + // set flags + e.client = (b2 & 0x80) === 0x80; + e.server = (b2 & 0x40) === 0x40; + e.email = (b2 & 0x20) === 0x20; + e.objsign = (b2 & 0x10) === 0x10; + e.reserved = (b2 & 0x08) === 0x08; + e.sslCA = (b2 & 0x04) === 0x04; + e.emailCA = (b2 & 0x02) === 0x02; + e.objCA = (b2 & 0x01) === 0x01; + } else if( + e.name === 'subjectAltName' || + e.name === 'issuerAltName') { + // handle subjectAltName/issuerAltName + e.altNames = []; + + // ev is a SYNTAX SEQUENCE + var gn; + var ev = asn1.fromDer(e.value); + for(var n = 0; n < ev.value.length; ++n) { + // get GeneralName + gn = ev.value[n]; + + var altName = { + type: gn.type, + value: gn.value + }; + e.altNames.push(altName); + + // Note: Support for types 1,2,6,7,8 + switch(gn.type) { + // rfc822Name + case 1: + // dNSName + case 2: + // uniformResourceIdentifier (URI) + case 6: + break; + // IPAddress + case 7: + // convert to IPv4/IPv6 string representation + altName.ip = forge.util.bytesToIP(gn.value); + break; + // registeredID + case 8: + altName.oid = asn1.derToOid(gn.value); + break; + default: + // unsupported + } + } + } else if(e.name === 'subjectKeyIdentifier') { + // value is an OCTETSTRING w/the hash of the key-type specific + // public key structure (eg: RSAPublicKey) + var ev = asn1.fromDer(e.value); + e.subjectKeyIdentifier = forge.util.bytesToHex(ev.value); + } + } + return e; +}; + +/** + * Converts a PKCS#10 certification request (CSR) from an ASN.1 object. + * + * Note: If the certification request is to be verified then compute hash + * should be set to true. There is currently no implementation for converting + * a certificate back to ASN.1 so the CertificationRequestInfo part of the + * ASN.1 object needs to be scanned before the csr object is created. + * + * @param obj the asn1 representation of a PKCS#10 certification request (CSR). + * @param computeHash true to compute the hash for verification. + * + * @return the certification request (CSR). + */ +pki.certificationRequestFromAsn1 = function(obj, computeHash) { + // validate certification request and capture data + var capture = {}; + var errors = []; + if(!asn1.validate(obj, certificationRequestValidator, capture, errors)) { + var error = new Error('Cannot read PKCS#10 certificate request. ' + + 'ASN.1 object is not a PKCS#10 CertificationRequest.'); + error.errors = errors; + throw error; + } + + // get oid + var oid = asn1.derToOid(capture.publicKeyOid); + if(oid !== pki.oids.rsaEncryption) { + throw new Error('Cannot read public key. OID is not RSA.'); + } + + // create certification request + var csr = pki.createCertificationRequest(); + csr.version = capture.csrVersion ? capture.csrVersion.charCodeAt(0) : 0; + csr.signatureOid = forge.asn1.derToOid(capture.csrSignatureOid); + csr.signatureParameters = _readSignatureParameters( + csr.signatureOid, capture.csrSignatureParams, true); + csr.siginfo.algorithmOid = forge.asn1.derToOid(capture.csrSignatureOid); + csr.siginfo.parameters = _readSignatureParameters( + csr.siginfo.algorithmOid, capture.csrSignatureParams, false); + csr.signature = capture.csrSignature; + + // keep CertificationRequestInfo to preserve signature when exporting + csr.certificationRequestInfo = capture.certificationRequestInfo; + + if(computeHash) { + // create digest for OID signature type + csr.md = _createSignatureDigest({ + signatureOid: csr.signatureOid, + type: 'certification request' + }); + + // produce DER formatted CertificationRequestInfo and digest it + var bytes = asn1.toDer(csr.certificationRequestInfo); + csr.md.update(bytes.getBytes()); + } + + // handle subject, build subject message digest + var smd = forge.md.sha1.create(); + csr.subject.getField = function(sn) { + return _getAttribute(csr.subject, sn); + }; + csr.subject.addField = function(attr) { + _fillMissingFields([attr]); + csr.subject.attributes.push(attr); + }; + csr.subject.attributes = pki.RDNAttributesAsArray( + capture.certificationRequestInfoSubject, smd); + csr.subject.hash = smd.digest().toHex(); + + // convert RSA public key from ASN.1 + csr.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo); + + // convert attributes from ASN.1 + csr.getAttribute = function(sn) { + return _getAttribute(csr, sn); + }; + csr.addAttribute = function(attr) { + _fillMissingFields([attr]); + csr.attributes.push(attr); + }; + csr.attributes = pki.CRIAttributesAsArray( + capture.certificationRequestInfoAttributes || []); + + return csr; +}; + +/** + * Creates an empty certification request (a CSR or certificate signing + * request). Once created, its public key and attributes can be set and then + * it can be signed. + * + * @return the empty certification request. + */ +pki.createCertificationRequest = function() { + var csr = {}; + csr.version = 0x00; + csr.signatureOid = null; + csr.signature = null; + csr.siginfo = {}; + csr.siginfo.algorithmOid = null; + + csr.subject = {}; + csr.subject.getField = function(sn) { + return _getAttribute(csr.subject, sn); + }; + csr.subject.addField = function(attr) { + _fillMissingFields([attr]); + csr.subject.attributes.push(attr); + }; + csr.subject.attributes = []; + csr.subject.hash = null; + + csr.publicKey = null; + csr.attributes = []; + csr.getAttribute = function(sn) { + return _getAttribute(csr, sn); + }; + csr.addAttribute = function(attr) { + _fillMissingFields([attr]); + csr.attributes.push(attr); + }; + csr.md = null; + + /** + * Sets the subject of this certification request. + * + * @param attrs the array of subject attributes to use. + */ + csr.setSubject = function(attrs) { + // set new attributes + _fillMissingFields(attrs); + csr.subject.attributes = attrs; + csr.subject.hash = null; + }; + + /** + * Sets the attributes of this certification request. + * + * @param attrs the array of attributes to use. + */ + csr.setAttributes = function(attrs) { + // set new attributes + _fillMissingFields(attrs); + csr.attributes = attrs; + }; + + /** + * Signs this certification request using the given private key. + * + * @param key the private key to sign with. + * @param md the message digest object to use (defaults to forge.md.sha1). + */ + csr.sign = function(key, md) { + // TODO: get signature OID from private key + csr.md = md || forge.md.sha1.create(); + var algorithmOid = oids[csr.md.algorithm + 'WithRSAEncryption']; + if(!algorithmOid) { + var error = new Error('Could not compute certification request digest. ' + + 'Unknown message digest algorithm OID.'); + error.algorithm = csr.md.algorithm; + throw error; + } + csr.signatureOid = csr.siginfo.algorithmOid = algorithmOid; + + // get CertificationRequestInfo, convert to DER + csr.certificationRequestInfo = pki.getCertificationRequestInfo(csr); + var bytes = asn1.toDer(csr.certificationRequestInfo); + + // digest and sign + csr.md.update(bytes.getBytes()); + csr.signature = key.sign(csr.md); + }; + + /** + * Attempts verify the signature on the passed certification request using + * its public key. + * + * A CSR that has been exported to a file in PEM format can be verified using + * OpenSSL using this command: + * + * openssl req -in -verify -noout -text + * + * @return true if verified, false if not. + */ + csr.verify = function() { + var rval = false; + + var md = csr.md; + if(md === null) { + md = _createSignatureDigest({ + signatureOid: csr.signatureOid, + type: 'certification request' + }); + + // produce DER formatted CertificationRequestInfo and digest it + var cri = csr.certificationRequestInfo || + pki.getCertificationRequestInfo(csr); + var bytes = asn1.toDer(cri); + md.update(bytes.getBytes()); + } + + if(md !== null) { + rval = _verifySignature({ + certificate: csr, md: md, signature: csr.signature + }); + } + + return rval; + }; + + return csr; +}; + +/** + * Converts an X.509 subject or issuer to an ASN.1 RDNSequence. + * + * @param obj the subject or issuer (distinguished name). + * + * @return the ASN.1 RDNSequence. + */ +function _dnToAsn1(obj) { + // create an empty RDNSequence + var rval = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + + // iterate over attributes + var attr, set; + var attrs = obj.attributes; + for(var i = 0; i < attrs.length; ++i) { + attr = attrs[i]; + var value = attr.value; + + // reuse tag class for attribute value if available + var valueTagClass = asn1.Type.PRINTABLESTRING; + if('valueTagClass' in attr) { + valueTagClass = attr.valueTagClass; + + if(valueTagClass === asn1.Type.UTF8) { + value = forge.util.encodeUtf8(value); + } + // FIXME: handle more encodings + } + + // create a RelativeDistinguishedName set + // each value in the set is an AttributeTypeAndValue first + // containing the type (an OID) and second the value + set = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // AttributeType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(attr.type).getBytes()), + // AttributeValue + asn1.create(asn1.Class.UNIVERSAL, valueTagClass, false, value) + ]) + ]); + rval.value.push(set); + } + + return rval; +} + +/** + * Gets all printable attributes (typically of an issuer or subject) in a + * simplified JSON format for display. + * + * @param attrs the attributes. + * + * @return the JSON for display. + */ +function _getAttributesAsJson(attrs) { + var rval = {}; + for(var i = 0; i < attrs.length; ++i) { + var attr = attrs[i]; + if(attr.shortName && ( + attr.valueTagClass === asn1.Type.UTF8 || + attr.valueTagClass === asn1.Type.PRINTABLESTRING || + attr.valueTagClass === asn1.Type.IA5STRING)) { + var value = attr.value; + if(attr.valueTagClass === asn1.Type.UTF8) { + value = forge.util.encodeUtf8(attr.value); + } + if(!(attr.shortName in rval)) { + rval[attr.shortName] = value; + } else if(forge.util.isArray(rval[attr.shortName])) { + rval[attr.shortName].push(value); + } else { + rval[attr.shortName] = [rval[attr.shortName], value]; + } + } + } + return rval; +} + +/** + * Fills in missing fields in attributes. + * + * @param attrs the attributes to fill missing fields in. + */ +function _fillMissingFields(attrs) { + var attr; + for(var i = 0; i < attrs.length; ++i) { + attr = attrs[i]; + + // populate missing name + if(typeof attr.name === 'undefined') { + if(attr.type && attr.type in pki.oids) { + attr.name = pki.oids[attr.type]; + } else if(attr.shortName && attr.shortName in _shortNames) { + attr.name = pki.oids[_shortNames[attr.shortName]]; + } + } + + // populate missing type (OID) + if(typeof attr.type === 'undefined') { + if(attr.name && attr.name in pki.oids) { + attr.type = pki.oids[attr.name]; + } else { + var error = new Error('Attribute type not specified.'); + error.attribute = attr; + throw error; + } + } + + // populate missing shortname + if(typeof attr.shortName === 'undefined') { + if(attr.name && attr.name in _shortNames) { + attr.shortName = _shortNames[attr.name]; + } + } + + // convert extensions to value + if(attr.type === oids.extensionRequest) { + attr.valueConstructed = true; + attr.valueTagClass = asn1.Type.SEQUENCE; + if(!attr.value && attr.extensions) { + attr.value = []; + for(var ei = 0; ei < attr.extensions.length; ++ei) { + attr.value.push(pki.certificateExtensionToAsn1( + _fillMissingExtensionFields(attr.extensions[ei]))); + } + } + } + + if(typeof attr.value === 'undefined') { + var error = new Error('Attribute value not specified.'); + error.attribute = attr; + throw error; + } + } +} + +/** + * Fills in missing fields in certificate extensions. + * + * @param e the extension. + * @param [options] the options to use. + * [cert] the certificate the extensions are for. + * + * @return the extension. + */ +function _fillMissingExtensionFields(e, options) { + options = options || {}; + + // populate missing name + if(typeof e.name === 'undefined') { + if(e.id && e.id in pki.oids) { + e.name = pki.oids[e.id]; + } + } + + // populate missing id + if(typeof e.id === 'undefined') { + if(e.name && e.name in pki.oids) { + e.id = pki.oids[e.name]; + } else { + var error = new Error('Extension ID not specified.'); + error.extension = e; + throw error; + } + } + + if(typeof e.value !== 'undefined') { + return e; + } + + // handle missing value: + + // value is a BIT STRING + if(e.name === 'keyUsage') { + // build flags + var unused = 0; + var b2 = 0x00; + var b3 = 0x00; + if(e.digitalSignature) { + b2 |= 0x80; + unused = 7; + } + if(e.nonRepudiation) { + b2 |= 0x40; + unused = 6; + } + if(e.keyEncipherment) { + b2 |= 0x20; + unused = 5; + } + if(e.dataEncipherment) { + b2 |= 0x10; + unused = 4; + } + if(e.keyAgreement) { + b2 |= 0x08; + unused = 3; + } + if(e.keyCertSign) { + b2 |= 0x04; + unused = 2; + } + if(e.cRLSign) { + b2 |= 0x02; + unused = 1; + } + if(e.encipherOnly) { + b2 |= 0x01; + unused = 0; + } + if(e.decipherOnly) { + b3 |= 0x80; + unused = 7; + } + + // create bit string + var value = String.fromCharCode(unused); + if(b3 !== 0) { + value += String.fromCharCode(b2) + String.fromCharCode(b3); + } else if(b2 !== 0) { + value += String.fromCharCode(b2); + } + e.value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value); + } else if(e.name === 'basicConstraints') { + // basicConstraints is a SEQUENCE + e.value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + // cA BOOLEAN flag defaults to false + if(e.cA) { + e.value.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, + String.fromCharCode(0xFF))); + } + if('pathLenConstraint' in e) { + e.value.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(e.pathLenConstraint).getBytes())); + } + } else if(e.name === 'extKeyUsage') { + // extKeyUsage is a SEQUENCE of OIDs + e.value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + var seq = e.value.value; + for(var key in e) { + if(e[key] !== true) { + continue; + } + // key is name in OID map + if(key in oids) { + seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, + false, asn1.oidToDer(oids[key]).getBytes())); + } else if(key.indexOf('.') !== -1) { + // assume key is an OID + seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, + false, asn1.oidToDer(key).getBytes())); + } + } + } else if(e.name === 'nsCertType') { + // nsCertType is a BIT STRING + // build flags + var unused = 0; + var b2 = 0x00; + + if(e.client) { + b2 |= 0x80; + unused = 7; + } + if(e.server) { + b2 |= 0x40; + unused = 6; + } + if(e.email) { + b2 |= 0x20; + unused = 5; + } + if(e.objsign) { + b2 |= 0x10; + unused = 4; + } + if(e.reserved) { + b2 |= 0x08; + unused = 3; + } + if(e.sslCA) { + b2 |= 0x04; + unused = 2; + } + if(e.emailCA) { + b2 |= 0x02; + unused = 1; + } + if(e.objCA) { + b2 |= 0x01; + unused = 0; + } + + // create bit string + var value = String.fromCharCode(unused); + if(b2 !== 0) { + value += String.fromCharCode(b2); + } + e.value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value); + } else if(e.name === 'subjectAltName' || e.name === 'issuerAltName') { + // SYNTAX SEQUENCE + e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + + var altName; + for(var n = 0; n < e.altNames.length; ++n) { + altName = e.altNames[n]; + var value = altName.value; + // handle IP + if(altName.type === 7 && altName.ip) { + value = forge.util.bytesFromIP(altName.ip); + if(value === null) { + var error = new Error( + 'Extension "ip" value is not a valid IPv4 or IPv6 address.'); + error.extension = e; + throw error; + } + } else if(altName.type === 8) { + // handle OID + if(altName.oid) { + value = asn1.oidToDer(asn1.oidToDer(altName.oid)); + } else { + // deprecated ... convert value to OID + value = asn1.oidToDer(value); + } + } + e.value.value.push(asn1.create( + asn1.Class.CONTEXT_SPECIFIC, altName.type, false, + value)); + } + } else if(e.name === 'nsComment' && options.cert) { + // sanity check value is ASCII (req'd) and not too big + if(!(/^[\x00-\x7F]*$/.test(e.comment)) || + (e.comment.length < 1) || (e.comment.length > 128)) { + throw new Error('Invalid "nsComment" content.'); + } + // IA5STRING opaque comment + e.value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.IA5STRING, false, e.comment); + } else if(e.name === 'subjectKeyIdentifier' && options.cert) { + var ski = options.cert.generateSubjectKeyIdentifier(); + e.subjectKeyIdentifier = ski.toHex(); + // OCTETSTRING w/digest + e.value = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, ski.getBytes()); + } else if(e.name === 'authorityKeyIdentifier' && options.cert) { + // SYNTAX SEQUENCE + e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + var seq = e.value.value; + + if(e.keyIdentifier) { + var keyIdentifier = (e.keyIdentifier === true ? + options.cert.generateSubjectKeyIdentifier().getBytes() : + e.keyIdentifier); + seq.push( + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, false, keyIdentifier)); + } + + if(e.authorityCertIssuer) { + var authorityCertIssuer = [ + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 4, true, [ + _dnToAsn1(e.authorityCertIssuer === true ? + options.cert.issuer : e.authorityCertIssuer) + ]) + ]; + seq.push( + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, authorityCertIssuer)); + } + + if(e.serialNumber) { + var serialNumber = forge.util.hexToBytes(e.serialNumber === true ? + options.cert.serialNumber : e.serialNumber); + seq.push( + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, false, serialNumber)); + } + } else if(e.name === 'cRLDistributionPoints') { + e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + var seq = e.value.value; + + // Create sub SEQUENCE of DistributionPointName + var subSeq = asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + + // Create fullName CHOICE + var fullNameGeneralNames = asn1.create( + asn1.Class.CONTEXT_SPECIFIC, 0, true, []); + var altName; + for(var n = 0; n < e.altNames.length; ++n) { + altName = e.altNames[n]; + var value = altName.value; + // handle IP + if(altName.type === 7 && altName.ip) { + value = forge.util.bytesFromIP(altName.ip); + if(value === null) { + var error = new Error( + 'Extension "ip" value is not a valid IPv4 or IPv6 address.'); + error.extension = e; + throw error; + } + } else if(altName.type === 8) { + // handle OID + if(altName.oid) { + value = asn1.oidToDer(asn1.oidToDer(altName.oid)); + } else { + // deprecated ... convert value to OID + value = asn1.oidToDer(value); + } + } + fullNameGeneralNames.value.push(asn1.create( + asn1.Class.CONTEXT_SPECIFIC, altName.type, false, + value)); + } + + // Add to the parent SEQUENCE + subSeq.value.push(asn1.create( + asn1.Class.CONTEXT_SPECIFIC, 0, true, [fullNameGeneralNames])); + seq.push(subSeq); + } + + // ensure value has been defined by now + if(typeof e.value === 'undefined') { + var error = new Error('Extension value not specified.'); + error.extension = e; + throw error; + } + + return e; +} + +/** + * Convert signature parameters object to ASN.1 + * + * @param {String} oid Signature algorithm OID + * @param params The signature parametrs object + * @return ASN.1 object representing signature parameters + */ +function _signatureParametersToAsn1(oid, params) { + switch(oid) { + case oids['RSASSA-PSS']: + var parts = []; + + if(params.hash.algorithmOid !== undefined) { + parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(params.hash.algorithmOid).getBytes()), + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ]) + ])); + } + + if(params.mgf.algorithmOid !== undefined) { + parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(params.mgf.algorithmOid).getBytes()), + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(params.mgf.hash.algorithmOid).getBytes()), + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') + ]) + ]) + ])); + } + + if(params.saltLength !== undefined) { + parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(params.saltLength).getBytes()) + ])); + } + + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, parts); + + default: + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, ''); + } +} + +/** + * Converts a certification request's attributes to an ASN.1 set of + * CRIAttributes. + * + * @param csr certification request. + * + * @return the ASN.1 set of CRIAttributes. + */ +function _CRIAttributesToAsn1(csr) { + // create an empty context-specific container + var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []); + + // no attributes, return empty container + if(csr.attributes.length === 0) { + return rval; + } + + // each attribute has a sequence with a type and a set of values + var attrs = csr.attributes; + for(var i = 0; i < attrs.length; ++i) { + var attr = attrs[i]; + var value = attr.value; + + // reuse tag class for attribute value if available + var valueTagClass = asn1.Type.UTF8; + if('valueTagClass' in attr) { + valueTagClass = attr.valueTagClass; + } + if(valueTagClass === asn1.Type.UTF8) { + value = forge.util.encodeUtf8(value); + } + var valueConstructed = false; + if('valueConstructed' in attr) { + valueConstructed = attr.valueConstructed; + } + // FIXME: handle more encodings + + // create a RelativeDistinguishedName set + // each value in the set is an AttributeTypeAndValue first + // containing the type (an OID) and second the value + var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // AttributeType + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(attr.type).getBytes()), + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ + // AttributeValue + asn1.create( + asn1.Class.UNIVERSAL, valueTagClass, valueConstructed, value) + ]) + ]); + rval.value.push(seq); + } + + return rval; +} + +var jan_1_1950 = new Date('1950-01-01T00:00:00Z'); +var jan_1_2050 = new Date('2050-01-01T00:00:00Z'); + +/** + * Converts a Date object to ASN.1 + * Handles the different format before and after 1st January 2050 + * + * @param date date object. + * + * @return the ASN.1 object representing the date. + */ +function _dateToAsn1(date) { + if(date >= jan_1_1950 && date < jan_1_2050) { + return asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false, + asn1.dateToUtcTime(date)); + } else { + return asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false, + asn1.dateToGeneralizedTime(date)); + } +} + +/** + * Gets the ASN.1 TBSCertificate part of an X.509v3 certificate. + * + * @param cert the certificate. + * + * @return the asn1 TBSCertificate. + */ +pki.getTBSCertificate = function(cert) { + // TBSCertificate + var notBefore = _dateToAsn1(cert.validity.notBefore); + var notAfter = _dateToAsn1(cert.validity.notAfter); + var tbs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // version + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ + // integer + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(cert.version).getBytes()) + ]), + // serialNumber + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + forge.util.hexToBytes(cert.serialNumber)), + // signature + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(cert.siginfo.algorithmOid).getBytes()), + // parameters + _signatureParametersToAsn1( + cert.siginfo.algorithmOid, cert.siginfo.parameters) + ]), + // issuer + _dnToAsn1(cert.issuer), + // validity + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + notBefore, + notAfter + ]), + // subject + _dnToAsn1(cert.subject), + // SubjectPublicKeyInfo + pki.publicKeyToAsn1(cert.publicKey) + ]); + + if(cert.issuer.uniqueId) { + // issuerUniqueID (optional) + tbs.value.push( + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, + // TODO: support arbitrary bit length ids + String.fromCharCode(0x00) + + cert.issuer.uniqueId + ) + ]) + ); + } + if(cert.subject.uniqueId) { + // subjectUniqueID (optional) + tbs.value.push( + asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [ + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, + // TODO: support arbitrary bit length ids + String.fromCharCode(0x00) + + cert.subject.uniqueId + ) + ]) + ); + } + + if(cert.extensions.length > 0) { + // extensions (optional) + tbs.value.push(pki.certificateExtensionsToAsn1(cert.extensions)); + } + + return tbs; +}; + +/** + * Gets the ASN.1 CertificationRequestInfo part of a + * PKCS#10 CertificationRequest. + * + * @param csr the certification request. + * + * @return the asn1 CertificationRequestInfo. + */ +pki.getCertificationRequestInfo = function(csr) { + // CertificationRequestInfo + var cri = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // version + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, + asn1.integerToDer(csr.version).getBytes()), + // subject + _dnToAsn1(csr.subject), + // SubjectPublicKeyInfo + pki.publicKeyToAsn1(csr.publicKey), + // attributes + _CRIAttributesToAsn1(csr) + ]); + + return cri; +}; + +/** + * Converts a DistinguishedName (subject or issuer) to an ASN.1 object. + * + * @param dn the DistinguishedName. + * + * @return the asn1 representation of a DistinguishedName. + */ +pki.distinguishedNameToAsn1 = function(dn) { + return _dnToAsn1(dn); +}; + +/** + * Converts an X.509v3 RSA certificate to an ASN.1 object. + * + * @param cert the certificate. + * + * @return the asn1 representation of an X.509v3 RSA certificate. + */ +pki.certificateToAsn1 = function(cert) { + // prefer cached TBSCertificate over generating one + var tbsCertificate = cert.tbsCertificate || pki.getTBSCertificate(cert); + + // Certificate + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // TBSCertificate + tbsCertificate, + // AlgorithmIdentifier (signature algorithm) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(cert.signatureOid).getBytes()), + // parameters + _signatureParametersToAsn1(cert.signatureOid, cert.signatureParameters) + ]), + // SignatureValue + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, + String.fromCharCode(0x00) + cert.signature) + ]); +}; + +/** + * Converts X.509v3 certificate extensions to ASN.1. + * + * @param exts the extensions to convert. + * + * @return the extensions in ASN.1 format. + */ +pki.certificateExtensionsToAsn1 = function(exts) { + // create top-level extension container + var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []); + + // create extension sequence (stores a sequence for each extension) + var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + rval.value.push(seq); + + for(var i = 0; i < exts.length; ++i) { + seq.value.push(pki.certificateExtensionToAsn1(exts[i])); + } + + return rval; +}; + +/** + * Converts a single certificate extension to ASN.1. + * + * @param ext the extension to convert. + * + * @return the extension in ASN.1 format. + */ +pki.certificateExtensionToAsn1 = function(ext) { + // create a sequence for each extension + var extseq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); + + // extnID (OID) + extseq.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(ext.id).getBytes())); + + // critical defaults to false + if(ext.critical) { + // critical BOOLEAN DEFAULT FALSE + extseq.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, + String.fromCharCode(0xFF))); + } + + var value = ext.value; + if(typeof ext.value !== 'string') { + // value is asn.1 + value = asn1.toDer(value).getBytes(); + } + + // extnValue (OCTET STRING) + extseq.value.push(asn1.create( + asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, value)); + + return extseq; +}; + +/** + * Converts a PKCS#10 certification request to an ASN.1 object. + * + * @param csr the certification request. + * + * @return the asn1 representation of a certification request. + */ +pki.certificationRequestToAsn1 = function(csr) { + // prefer cached CertificationRequestInfo over generating one + var cri = csr.certificationRequestInfo || + pki.getCertificationRequestInfo(csr); + + // Certificate + return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // CertificationRequestInfo + cri, + // AlgorithmIdentifier (signature algorithm) + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ + // algorithm + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, + asn1.oidToDer(csr.signatureOid).getBytes()), + // parameters + _signatureParametersToAsn1(csr.signatureOid, csr.signatureParameters) + ]), + // signature + asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, + String.fromCharCode(0x00) + csr.signature) + ]); +}; + +/** + * Creates a CA store. + * + * @param certs an optional array of certificate objects or PEM-formatted + * certificate strings to add to the CA store. + * + * @return the CA store. + */ +pki.createCaStore = function(certs) { + // create CA store + var caStore = { + // stored certificates + certs: {} + }; + + /** + * Gets the certificate that issued the passed certificate or its + * 'parent'. + * + * @param cert the certificate to get the parent for. + * + * @return the parent certificate or null if none was found. + */ + caStore.getIssuer = function(cert) { + var rval = getBySubject(cert.issuer); + + // see if there are multiple matches + /*if(forge.util.isArray(rval)) { + // TODO: resolve multiple matches by checking + // authorityKey/subjectKey/issuerUniqueID/other identifiers, etc. + // FIXME: or alternatively do authority key mapping + // if possible (X.509v1 certs can't work?) + throw new Error('Resolving multiple issuer matches not implemented yet.'); + }*/ + + return rval; + }; + + /** + * Adds a trusted certificate to the store. + * + * @param cert the certificate to add as a trusted certificate (either a + * pki.certificate object or a PEM-formatted certificate). + */ + caStore.addCertificate = function(cert) { + // convert from pem if necessary + if(typeof cert === 'string') { + cert = forge.pki.certificateFromPem(cert); + } + + ensureSubjectHasHash(cert.subject); + + if(!caStore.hasCertificate(cert)) { // avoid duplicate certificates in store + if(cert.subject.hash in caStore.certs) { + // subject hash already exists, append to array + var tmp = caStore.certs[cert.subject.hash]; + if(!forge.util.isArray(tmp)) { + tmp = [tmp]; + } + tmp.push(cert); + caStore.certs[cert.subject.hash] = tmp; + } else { + caStore.certs[cert.subject.hash] = cert; + } + } + }; + + /** + * Checks to see if the given certificate is in the store. + * + * @param cert the certificate to check (either a pki.certificate or a + * PEM-formatted certificate). + * + * @return true if the certificate is in the store, false if not. + */ + caStore.hasCertificate = function(cert) { + // convert from pem if necessary + if(typeof cert === 'string') { + cert = forge.pki.certificateFromPem(cert); + } + + var match = getBySubject(cert.subject); + if(!match) { + return false; + } + if(!forge.util.isArray(match)) { + match = [match]; + } + // compare DER-encoding of certificates + var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes(); + for(var i = 0; i < match.length; ++i) { + var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes(); + if(der1 === der2) { + return true; + } + } + return false; + }; + + /** + * Lists all of the certificates kept in the store. + * + * @return an array of all of the pki.certificate objects in the store. + */ + caStore.listAllCertificates = function() { + var certList = []; + + for(var hash in caStore.certs) { + if(caStore.certs.hasOwnProperty(hash)) { + var value = caStore.certs[hash]; + if(!forge.util.isArray(value)) { + certList.push(value); + } else { + for(var i = 0; i < value.length; ++i) { + certList.push(value[i]); + } + } + } + } + + return certList; + }; + + /** + * Removes a certificate from the store. + * + * @param cert the certificate to remove (either a pki.certificate or a + * PEM-formatted certificate). + * + * @return the certificate that was removed or null if the certificate + * wasn't in store. + */ + caStore.removeCertificate = function(cert) { + var result; + + // convert from pem if necessary + if(typeof cert === 'string') { + cert = forge.pki.certificateFromPem(cert); + } + ensureSubjectHasHash(cert.subject); + if(!caStore.hasCertificate(cert)) { + return null; + } + + var match = getBySubject(cert.subject); + + if(!forge.util.isArray(match)) { + result = caStore.certs[cert.subject.hash]; + delete caStore.certs[cert.subject.hash]; + return result; + } + + // compare DER-encoding of certificates + var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes(); + for(var i = 0; i < match.length; ++i) { + var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes(); + if(der1 === der2) { + result = match[i]; + match.splice(i, 1); + } + } + if(match.length === 0) { + delete caStore.certs[cert.subject.hash]; + } + + return result; + }; + + function getBySubject(subject) { + ensureSubjectHasHash(subject); + return caStore.certs[subject.hash] || null; + } + + function ensureSubjectHasHash(subject) { + // produce subject hash if it doesn't exist + if(!subject.hash) { + var md = forge.md.sha1.create(); + subject.attributes = pki.RDNAttributesAsArray(_dnToAsn1(subject), md); + subject.hash = md.digest().toHex(); + } + } + + // auto-add passed in certs + if(certs) { + // parse PEM-formatted certificates as necessary + for(var i = 0; i < certs.length; ++i) { + var cert = certs[i]; + caStore.addCertificate(cert); + } + } + + return caStore; +}; + +/** + * Certificate verification errors, based on TLS. + */ +pki.certificateError = { + bad_certificate: 'forge.pki.BadCertificate', + unsupported_certificate: 'forge.pki.UnsupportedCertificate', + certificate_revoked: 'forge.pki.CertificateRevoked', + certificate_expired: 'forge.pki.CertificateExpired', + certificate_unknown: 'forge.pki.CertificateUnknown', + unknown_ca: 'forge.pki.UnknownCertificateAuthority' +}; + +/** + * Verifies a certificate chain against the given Certificate Authority store + * with an optional custom verify callback. + * + * @param caStore a certificate store to verify against. + * @param chain the certificate chain to verify, with the root or highest + * authority at the end (an array of certificates). + * @param options a callback to be called for every certificate in the chain or + * an object with: + * verify a callback to be called for every certificate in the + * chain + * validityCheckDate the date against which the certificate + * validity period should be checked. Pass null to not check + * the validity period. By default, the current date is used. + * + * The verify callback has the following signature: + * + * verified - Set to true if certificate was verified, otherwise the + * pki.certificateError for why the certificate failed. + * depth - The current index in the chain, where 0 is the end point's cert. + * certs - The certificate chain, *NOTE* an empty chain indicates an anonymous + * end point. + * + * The function returns true on success and on failure either the appropriate + * pki.certificateError or an object with 'error' set to the appropriate + * pki.certificateError and 'message' set to a custom error message. + * + * @return true if successful, error thrown if not. + */ +pki.verifyCertificateChain = function(caStore, chain, options) { + /* From: RFC3280 - Internet X.509 Public Key Infrastructure Certificate + Section 6: Certification Path Validation + See inline parentheticals related to this particular implementation. + + The primary goal of path validation is to verify the binding between + a subject distinguished name or a subject alternative name and subject + public key, as represented in the end entity certificate, based on the + public key of the trust anchor. This requires obtaining a sequence of + certificates that support that binding. That sequence should be provided + in the passed 'chain'. The trust anchor should be in the given CA + store. The 'end entity' certificate is the certificate provided by the + end point (typically a server) and is the first in the chain. + + To meet this goal, the path validation process verifies, among other + things, that a prospective certification path (a sequence of n + certificates or a 'chain') satisfies the following conditions: + + (a) for all x in {1, ..., n-1}, the subject of certificate x is + the issuer of certificate x+1; + + (b) certificate 1 is issued by the trust anchor; + + (c) certificate n is the certificate to be validated; and + + (d) for all x in {1, ..., n}, the certificate was valid at the + time in question. + + Note that here 'n' is index 0 in the chain and 1 is the last certificate + in the chain and it must be signed by a certificate in the connection's + CA store. + + The path validation process also determines the set of certificate + policies that are valid for this path, based on the certificate policies + extension, policy mapping extension, policy constraints extension, and + inhibit any-policy extension. + + Note: Policy mapping extension not supported (Not Required). + + Note: If the certificate has an unsupported critical extension, then it + must be rejected. + + Note: A certificate is self-issued if the DNs that appear in the subject + and issuer fields are identical and are not empty. + + The path validation algorithm assumes the following seven inputs are + provided to the path processing logic. What this specific implementation + will use is provided parenthetically: + + (a) a prospective certification path of length n (the 'chain') + (b) the current date/time: ('now'). + (c) user-initial-policy-set: A set of certificate policy identifiers + naming the policies that are acceptable to the certificate user. + The user-initial-policy-set contains the special value any-policy + if the user is not concerned about certificate policy + (Not implemented. Any policy is accepted). + (d) trust anchor information, describing a CA that serves as a trust + anchor for the certification path. The trust anchor information + includes: + + (1) the trusted issuer name, + (2) the trusted public key algorithm, + (3) the trusted public key, and + (4) optionally, the trusted public key parameters associated + with the public key. + + (Trust anchors are provided via certificates in the CA store). + + The trust anchor information may be provided to the path processing + procedure in the form of a self-signed certificate. The trusted anchor + information is trusted because it was delivered to the path processing + procedure by some trustworthy out-of-band procedure. If the trusted + public key algorithm requires parameters, then the parameters are + provided along with the trusted public key (No parameters used in this + implementation). + + (e) initial-policy-mapping-inhibit, which indicates if policy mapping is + allowed in the certification path. + (Not implemented, no policy checking) + + (f) initial-explicit-policy, which indicates if the path must be valid + for at least one of the certificate policies in the user-initial- + policy-set. + (Not implemented, no policy checking) + + (g) initial-any-policy-inhibit, which indicates whether the + anyPolicy OID should be processed if it is included in a + certificate. + (Not implemented, so any policy is valid provided that it is + not marked as critical) */ + + /* Basic Path Processing: + + For each certificate in the 'chain', the following is checked: + + 1. The certificate validity period includes the current time. + 2. The certificate was signed by its parent (where the parent is either + the next in the chain or from the CA store). Allow processing to + continue to the next step if no parent is found but the certificate is + in the CA store. + 3. TODO: The certificate has not been revoked. + 4. The certificate issuer name matches the parent's subject name. + 5. TODO: If the certificate is self-issued and not the final certificate + in the chain, skip this step, otherwise verify that the subject name + is within one of the permitted subtrees of X.500 distinguished names + and that each of the alternative names in the subjectAltName extension + (critical or non-critical) is within one of the permitted subtrees for + that name type. + 6. TODO: If the certificate is self-issued and not the final certificate + in the chain, skip this step, otherwise verify that the subject name + is not within one of the excluded subtrees for X.500 distinguished + names and none of the subjectAltName extension names are excluded for + that name type. + 7. The other steps in the algorithm for basic path processing involve + handling the policy extension which is not presently supported in this + implementation. Instead, if a critical policy extension is found, the + certificate is rejected as not supported. + 8. If the certificate is not the first or if its the only certificate in + the chain (having no parent from the CA store or is self-signed) and it + has a critical key usage extension, verify that the keyCertSign bit is + set. If the key usage extension exists, verify that the basic + constraints extension exists. If the basic constraints extension exists, + verify that the cA flag is set. If pathLenConstraint is set, ensure that + the number of certificates that precede in the chain (come earlier + in the chain as implemented below), excluding the very first in the + chain (typically the end-entity one), isn't greater than the + pathLenConstraint. This constraint limits the number of intermediate + CAs that may appear below a CA before only end-entity certificates + may be issued. */ + + // if a verify callback is passed as the third parameter, package it within + // the options object. This is to support a legacy function signature that + // expected the verify callback as the third parameter. + if(typeof options === 'function') { + options = {verify: options}; + } + options = options || {}; + + // copy cert chain references to another array to protect against changes + // in verify callback + chain = chain.slice(0); + var certs = chain.slice(0); + + var validityCheckDate = options.validityCheckDate; + // if no validityCheckDate is specified, default to the current date. Make + // sure to maintain the value null because it indicates that the validity + // period should not be checked. + if(typeof validityCheckDate === 'undefined') { + validityCheckDate = new Date(); + } + + // verify each cert in the chain using its parent, where the parent + // is either the next in the chain or from the CA store + var first = true; + var error = null; + var depth = 0; + do { + var cert = chain.shift(); + var parent = null; + var selfSigned = false; + + if(validityCheckDate) { + // 1. check valid time + if(validityCheckDate < cert.validity.notBefore || + validityCheckDate > cert.validity.notAfter) { + error = { + message: 'Certificate is not valid yet or has expired.', + error: pki.certificateError.certificate_expired, + notBefore: cert.validity.notBefore, + notAfter: cert.validity.notAfter, + // TODO: we might want to reconsider renaming 'now' to + // 'validityCheckDate' should this API be changed in the future. + now: validityCheckDate + }; + } + } + + // 2. verify with parent from chain or CA store + if(error === null) { + parent = chain[0] || caStore.getIssuer(cert); + if(parent === null) { + // check for self-signed cert + if(cert.isIssuer(cert)) { + selfSigned = true; + parent = cert; + } + } + + if(parent) { + // FIXME: current CA store implementation might have multiple + // certificates where the issuer can't be determined from the + // certificate (happens rarely with, eg: old certificates) so normalize + // by always putting parents into an array + // TODO: there's may be an extreme degenerate case currently uncovered + // where an old intermediate certificate seems to have a matching parent + // but none of the parents actually verify ... but the intermediate + // is in the CA and it should pass this check; needs investigation + var parents = parent; + if(!forge.util.isArray(parents)) { + parents = [parents]; + } + + // try to verify with each possible parent (typically only one) + var verified = false; + while(!verified && parents.length > 0) { + parent = parents.shift(); + try { + verified = parent.verify(cert); + } catch(ex) { + // failure to verify, don't care why, try next one + } + } + + if(!verified) { + error = { + message: 'Certificate signature is invalid.', + error: pki.certificateError.bad_certificate + }; + } + } + + if(error === null && (!parent || selfSigned) && + !caStore.hasCertificate(cert)) { + // no parent issuer and certificate itself is not trusted + error = { + message: 'Certificate is not trusted.', + error: pki.certificateError.unknown_ca + }; + } + } + + // TODO: 3. check revoked + + // 4. check for matching issuer/subject + if(error === null && parent && !cert.isIssuer(parent)) { + // parent is not issuer + error = { + message: 'Certificate issuer is invalid.', + error: pki.certificateError.bad_certificate + }; + } + + // 5. TODO: check names with permitted names tree + + // 6. TODO: check names against excluded names tree + + // 7. check for unsupported critical extensions + if(error === null) { + // supported extensions + var se = { + keyUsage: true, + basicConstraints: true + }; + for(var i = 0; error === null && i < cert.extensions.length; ++i) { + var ext = cert.extensions[i]; + if(ext.critical && !(ext.name in se)) { + error = { + message: + 'Certificate has an unsupported critical extension.', + error: pki.certificateError.unsupported_certificate + }; + } + } + } + + // 8. check for CA if cert is not first or is the only certificate + // remaining in chain with no parent or is self-signed + if(error === null && + (!first || (chain.length === 0 && (!parent || selfSigned)))) { + // first check keyUsage extension and then basic constraints + var bcExt = cert.getExtension('basicConstraints'); + var keyUsageExt = cert.getExtension('keyUsage'); + if(keyUsageExt !== null) { + // keyCertSign must be true and there must be a basic + // constraints extension + if(!keyUsageExt.keyCertSign || bcExt === null) { + // bad certificate + error = { + message: + 'Certificate keyUsage or basicConstraints conflict ' + + 'or indicate that the certificate is not a CA. ' + + 'If the certificate is the only one in the chain or ' + + 'isn\'t the first then the certificate must be a ' + + 'valid CA.', + error: pki.certificateError.bad_certificate + }; + } + } + // basic constraints cA flag must be set + if(error === null && bcExt !== null && !bcExt.cA) { + // bad certificate + error = { + message: + 'Certificate basicConstraints indicates the certificate ' + + 'is not a CA.', + error: pki.certificateError.bad_certificate + }; + } + // if error is not null and keyUsage is available, then we know it + // has keyCertSign and there is a basic constraints extension too, + // which means we can check pathLenConstraint (if it exists) + if(error === null && keyUsageExt !== null && + 'pathLenConstraint' in bcExt) { + // pathLen is the maximum # of intermediate CA certs that can be + // found between the current certificate and the end-entity (depth 0) + // certificate; this number does not include the end-entity (depth 0, + // last in the chain) even if it happens to be a CA certificate itself + var pathLen = depth - 1; + if(pathLen > bcExt.pathLenConstraint) { + // pathLenConstraint violated, bad certificate + error = { + message: + 'Certificate basicConstraints pathLenConstraint violated.', + error: pki.certificateError.bad_certificate + }; + } + } + } + + // call application callback + var vfd = (error === null) ? true : error.error; + var ret = options.verify ? options.verify(vfd, depth, certs) : vfd; + if(ret === true) { + // clear any set error + error = null; + } else { + // if passed basic tests, set default message and alert + if(vfd === true) { + error = { + message: 'The application rejected the certificate.', + error: pki.certificateError.bad_certificate + }; + } + + // check for custom error info + if(ret || ret === 0) { + // set custom message and error + if(typeof ret === 'object' && !forge.util.isArray(ret)) { + if(ret.message) { + error.message = ret.message; + } + if(ret.error) { + error.error = ret.error; + } + } else if(typeof ret === 'string') { + // set custom error + error.error = ret; + } + } + + // throw error + throw error; + } + + // no longer first cert in chain + first = false; + ++depth; + } while(chain.length > 0); + + return true; +}; + + +/***/ }), + +/***/ 2818: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js +// Fedor, you are amazing. + + + +var asn1 = __webpack_require__(9809); + +exports.certificate = __webpack_require__(1934); + +var RSAPrivateKey = asn1.define('RSAPrivateKey', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('modulus')['int'](), + this.key('publicExponent')['int'](), + this.key('privateExponent')['int'](), + this.key('prime1')['int'](), + this.key('prime2')['int'](), + this.key('exponent1')['int'](), + this.key('exponent2')['int'](), + this.key('coefficient')['int']() + ); +}); +exports.RSAPrivateKey = RSAPrivateKey; + +var RSAPublicKey = asn1.define('RSAPublicKey', function () { + this.seq().obj( + this.key('modulus')['int'](), + this.key('publicExponent')['int']() + ); +}); +exports.RSAPublicKey = RSAPublicKey; + +var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () { + this.seq().obj( + this.key('algorithm').objid(), + this.key('none').null_().optional(), + this.key('curve').objid().optional(), + this.key('params').seq().obj( + this.key('p')['int'](), + this.key('q')['int'](), + this.key('g')['int']() + ).optional() + ); +}); + +var PublicKey = asn1.define('SubjectPublicKeyInfo', function () { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ); +}); +exports.PublicKey = PublicKey; + +var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPrivateKey').octstr() + ); +}); +exports.PrivateKey = PrivateKeyInfo; +var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () { + this.seq().obj( + this.key('algorithm').seq().obj( + this.key('id').objid(), + this.key('decrypt').seq().obj( + this.key('kde').seq().obj( + this.key('id').objid(), + this.key('kdeparams').seq().obj( + this.key('salt').octstr(), + this.key('iters')['int']() + ) + ), + this.key('cipher').seq().obj( + this.key('algo').objid(), + this.key('iv').octstr() + ) + ) + ), + this.key('subjectPrivateKey').octstr() + ); +}); + +exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo; + +var DSAPrivateKey = asn1.define('DSAPrivateKey', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('p')['int'](), + this.key('q')['int'](), + this.key('g')['int'](), + this.key('pub_key')['int'](), + this.key('priv_key')['int']() + ); +}); +exports.DSAPrivateKey = DSAPrivateKey; + +exports.DSAparam = asn1.define('DSAparam', function () { + this['int'](); +}); + +var ECParameters = asn1.define('ECParameters', function () { + this.choice({ + namedCurve: this.objid() + }); +}); + +var ECPrivateKey = asn1.define('ECPrivateKey', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('privateKey').octstr(), + this.key('parameters').optional().explicit(0).use(ECParameters), + this.key('publicKey').optional().explicit(1).bitstr() + ); +}); +exports.ECPrivateKey = ECPrivateKey; + +exports.signature = asn1.define('signature', function () { + this.seq().obj( + this.key('r')['int'](), + this.key('s')['int']() + ); +}); + + +/***/ }), + +/***/ 1934: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js +// thanks to @Rantanen + + + +var asn = __webpack_require__(9809); + +var Time = asn.define('Time', function () { + this.choice({ + utcTime: this.utctime(), + generalTime: this.gentime() + }); +}); + +var AttributeTypeValue = asn.define('AttributeTypeValue', function () { + this.seq().obj( + this.key('type').objid(), + this.key('value').any() + ); +}); + +var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () { + this.seq().obj( + this.key('algorithm').objid(), + this.key('parameters').optional(), + this.key('curve').objid().optional() + ); +}); + +var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ); +}); + +var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () { + this.setof(AttributeTypeValue); +}); + +var RDNSequence = asn.define('RDNSequence', function () { + this.seqof(RelativeDistinguishedName); +}); + +var Name = asn.define('Name', function () { + this.choice({ + rdnSequence: this.use(RDNSequence) + }); +}); + +var Validity = asn.define('Validity', function () { + this.seq().obj( + this.key('notBefore').use(Time), + this.key('notAfter').use(Time) + ); +}); + +var Extension = asn.define('Extension', function () { + this.seq().obj( + this.key('extnID').objid(), + this.key('critical').bool().def(false), + this.key('extnValue').octstr() + ); +}); + +var TBSCertificate = asn.define('TBSCertificate', function () { + this.seq().obj( + this.key('version').explicit(0)['int']().optional(), + this.key('serialNumber')['int'](), + this.key('signature').use(AlgorithmIdentifier), + this.key('issuer').use(Name), + this.key('validity').use(Validity), + this.key('subject').use(Name), + this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), + this.key('issuerUniqueID').implicit(1).bitstr().optional(), + this.key('subjectUniqueID').implicit(2).bitstr().optional(), + this.key('extensions').explicit(3).seqof(Extension).optional() + ); +}); + +var X509Certificate = asn.define('X509Certificate', function () { + this.seq().obj( + this.key('tbsCertificate').use(TBSCertificate), + this.key('signatureAlgorithm').use(AlgorithmIdentifier), + this.key('signatureValue').bitstr() + ); +}); + +module.exports = X509Certificate; + + +/***/ }), + +/***/ 7631: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +// adapted from https://github.com/apatil/pemstrip +var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m; +var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m; +var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m; +var evp = __webpack_require__(3048); +var ciphers = __webpack_require__(4696); +var Buffer = (__webpack_require__(9509).Buffer); +module.exports = function (okey, password) { + var key = okey.toString(); + var match = key.match(findProc); + var decrypted; + if (!match) { + var match2 = key.match(fullRegex); + decrypted = Buffer.from(match2[2].replace(/[\r\n]/g, ''), 'base64'); + } else { + var suite = 'aes' + match[1]; + var iv = Buffer.from(match[2], 'hex'); + var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64'); + var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key; + var out = []; + var cipher = ciphers.createDecipheriv(suite, cipherKey, iv); + out.push(cipher.update(cipherText)); + out.push(cipher['final']()); + decrypted = Buffer.concat(out); + } + var tag = key.match(startRegex)[1]; + return { + tag: tag, + data: decrypted + }; +}; + + +/***/ }), + +/***/ 980: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var asn1 = __webpack_require__(2818); +var aesid = __webpack_require__(2562); +var fixProc = __webpack_require__(7631); +var ciphers = __webpack_require__(4696); +var compat = __webpack_require__(5632); +var Buffer = (__webpack_require__(9509).Buffer); + +function decrypt(data, password) { + var salt = data.algorithm.decrypt.kde.kdeparams.salt; + var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10); + var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]; + var iv = data.algorithm.decrypt.cipher.iv; + var cipherText = data.subjectPrivateKey; + var keylen = parseInt(algo.split('-')[1], 10) / 8; + var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1'); + var cipher = ciphers.createDecipheriv(algo, key, iv); + var out = []; + out.push(cipher.update(cipherText)); + out.push(cipher['final']()); + return Buffer.concat(out); +} + +function parseKeys(buffer) { + var password; + if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { + password = buffer.passphrase; + buffer = buffer.key; + } + if (typeof buffer === 'string') { + buffer = Buffer.from(buffer); + } + + var stripped = fixProc(buffer, password); + + var type = stripped.tag; + var data = stripped.data; + var subtype, ndata; + switch (type) { + case 'CERTIFICATE': + ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo; + // falls through + case 'PUBLIC KEY': + if (!ndata) { + ndata = asn1.PublicKey.decode(data, 'der'); + } + subtype = ndata.algorithm.algorithm.join('.'); + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der'); + case '1.2.840.10045.2.1': + ndata.subjectPrivateKey = ndata.subjectPublicKey; + return { + type: 'ec', + data: ndata + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der'); + return { + type: 'dsa', + data: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + // throw new Error('unknown key type ' + type) + case 'ENCRYPTED PRIVATE KEY': + data = asn1.EncryptedPrivateKey.decode(data, 'der'); + data = decrypt(data, password); + // falls through + case 'PRIVATE KEY': + ndata = asn1.PrivateKey.decode(data, 'der'); + subtype = ndata.algorithm.algorithm.join('.'); + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der'); + case '1.2.840.10045.2.1': + return { + curve: ndata.algorithm.curve, + privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der'); + return { + type: 'dsa', + params: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + // throw new Error('unknown key type ' + type) + case 'RSA PUBLIC KEY': + return asn1.RSAPublicKey.decode(data, 'der'); + case 'RSA PRIVATE KEY': + return asn1.RSAPrivateKey.decode(data, 'der'); + case 'DSA PRIVATE KEY': + return { + type: 'dsa', + params: asn1.DSAPrivateKey.decode(data, 'der') + }; + case 'EC PRIVATE KEY': + data = asn1.ECPrivateKey.decode(data, 'der'); + return { + curve: data.parameters.value, + privateKey: data.privateKey + }; + default: throw new Error('unknown key type ' + type); + } +} +parseKeys.signature = asn1.signature; + +module.exports = parseKeys; + + +/***/ }), + +/***/ 5632: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +exports.pbkdf2 = __webpack_require__(8638) +exports.pbkdf2Sync = __webpack_require__(1257) + + +/***/ }), + +/***/ 8638: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var Buffer = (__webpack_require__(9509).Buffer) + +var checkParameters = __webpack_require__(7357) +var defaultEncoding = __webpack_require__(2368) +var sync = __webpack_require__(1257) +var toBuffer = __webpack_require__(7777) + +var ZERO_BUF +var subtle = __webpack_require__.g.crypto && __webpack_require__.g.crypto.subtle +var toBrowser = { + sha: 'SHA-1', + 'sha-1': 'SHA-1', + sha1: 'SHA-1', + sha256: 'SHA-256', + 'sha-256': 'SHA-256', + sha384: 'SHA-384', + 'sha-384': 'SHA-384', + 'sha-512': 'SHA-512', + sha512: 'SHA-512' +} +var checks = [] +function checkNative (algo) { + if (__webpack_require__.g.process && !__webpack_require__.g.process.browser) { + return Promise.resolve(false) + } + if (!subtle || !subtle.importKey || !subtle.deriveBits) { + return Promise.resolve(false) + } + if (checks[algo] !== undefined) { + return checks[algo] + } + ZERO_BUF = ZERO_BUF || Buffer.alloc(8) + var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo) + .then(function () { + return true + }).catch(function () { + return false + }) + checks[algo] = prom + return prom +} +var nextTick +function getNextTick () { + if (nextTick) { + return nextTick + } + if (__webpack_require__.g.process && __webpack_require__.g.process.nextTick) { + nextTick = __webpack_require__.g.process.nextTick + } else if (__webpack_require__.g.queueMicrotask) { + nextTick = __webpack_require__.g.queueMicrotask + } else if (__webpack_require__.g.setImmediate) { + nextTick = __webpack_require__.g.setImmediate + } else { + nextTick = __webpack_require__.g.setTimeout + } + return nextTick +} +function browserPbkdf2 (password, salt, iterations, length, algo) { + return subtle.importKey( + 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits'] + ).then(function (key) { + return subtle.deriveBits({ + name: 'PBKDF2', + salt: salt, + iterations: iterations, + hash: { + name: algo + } + }, key, length << 3) + }).then(function (res) { + return Buffer.from(res) + }) +} + +function resolvePromise (promise, callback) { + promise.then(function (out) { + getNextTick()(function () { + callback(null, out) + }) + }, function (e) { + getNextTick()(function () { + callback(e) + }) + }) +} +module.exports = function (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = undefined + } + + digest = digest || 'sha1' + var algo = toBrowser[digest.toLowerCase()] + + if (!algo || typeof __webpack_require__.g.Promise !== 'function') { + getNextTick()(function () { + var out + try { + out = sync(password, salt, iterations, keylen, digest) + } catch (e) { + return callback(e) + } + callback(null, out) + }) + return + } + + checkParameters(iterations, keylen) + password = toBuffer(password, defaultEncoding, 'Password') + salt = toBuffer(salt, defaultEncoding, 'Salt') + if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2') + + resolvePromise(checkNative(algo).then(function (resp) { + if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo) + + return sync(password, salt, iterations, keylen, digest) + }), callback) +} + + +/***/ }), + +/***/ 2368: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* provided dependency */ var process = __webpack_require__(4155); +var defaultEncoding +/* istanbul ignore next */ +if (__webpack_require__.g.process && __webpack_require__.g.process.browser) { + defaultEncoding = 'utf-8' +} else if (__webpack_require__.g.process && __webpack_require__.g.process.version) { + var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) + + defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary' +} else { + defaultEncoding = 'utf-8' +} +module.exports = defaultEncoding + + +/***/ }), + +/***/ 7357: +/***/ (function(module) { + +var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs + +module.exports = function (iterations, keylen) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number') + } + + if (iterations < 0) { + throw new TypeError('Bad iterations') + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number') + } + + if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */ + throw new TypeError('Bad key length') + } +} + + +/***/ }), + +/***/ 1257: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var md5 = __webpack_require__(8028) +var RIPEMD160 = __webpack_require__(9785) +var sha = __webpack_require__(9072) +var Buffer = (__webpack_require__(9509).Buffer) + +var checkParameters = __webpack_require__(7357) +var defaultEncoding = __webpack_require__(2368) +var toBuffer = __webpack_require__(7777) + +var ZEROS = Buffer.alloc(128) +var sizes = { + md5: 16, + sha1: 20, + sha224: 28, + sha256: 32, + sha384: 48, + sha512: 64, + rmd160: 20, + ripemd160: 20 +} + +function Hmac (alg, key, saltLen) { + var hash = getDigest(alg) + var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 + + if (key.length > blocksize) { + key = hash(key) + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } + + var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]) + var opad = Buffer.allocUnsafe(blocksize + sizes[alg]) + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } + + var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4) + ipad.copy(ipad1, 0, 0, blocksize) + this.ipad1 = ipad1 + this.ipad2 = ipad + this.opad = opad + this.alg = alg + this.blocksize = blocksize + this.hash = hash + this.size = sizes[alg] +} + +Hmac.prototype.run = function (data, ipad) { + data.copy(ipad, this.blocksize) + var h = this.hash(ipad) + h.copy(this.opad, this.blocksize) + return this.hash(this.opad) +} + +function getDigest (alg) { + function shaFunc (data) { + return sha(alg).update(data).digest() + } + function rmd160Func (data) { + return new RIPEMD160().update(data).digest() + } + + if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func + if (alg === 'md5') return md5 + return shaFunc +} + +function pbkdf2 (password, salt, iterations, keylen, digest) { + checkParameters(iterations, keylen) + password = toBuffer(password, defaultEncoding, 'Password') + salt = toBuffer(salt, defaultEncoding, 'Salt') + + digest = digest || 'sha1' + + var hmac = new Hmac(digest, password, salt.length) + + var DK = Buffer.allocUnsafe(keylen) + var block1 = Buffer.allocUnsafe(salt.length + 4) + salt.copy(block1, 0, 0, salt.length) + + var destPos = 0 + var hLen = sizes[digest] + var l = Math.ceil(keylen / hLen) + + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length) + + var T = hmac.run(block1, hmac.ipad1) + var U = T + + for (var j = 1; j < iterations; j++) { + U = hmac.run(U, hmac.ipad2) + for (var k = 0; k < hLen; k++) T[k] ^= U[k] + } + + T.copy(DK, destPos) + destPos += hLen + } + + return DK +} + +module.exports = pbkdf2 + + +/***/ }), + +/***/ 7777: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var Buffer = (__webpack_require__(9509).Buffer) + +module.exports = function (thing, encoding, name) { + if (Buffer.isBuffer(thing)) { + return thing + } else if (typeof thing === 'string') { + return Buffer.from(thing, encoding) + } else if (ArrayBuffer.isView(thing)) { + return Buffer.from(thing.buffer) + } else { + throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView') + } +} + + +/***/ }), + +/***/ 8212: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); + + +if (typeof process === 'undefined' || + !process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + + + +/***/ }), + +/***/ 4155: +/***/ (function(module) { + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), + +/***/ 2100: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// minimal library entry point. + + +module.exports = __webpack_require__(9482); + + +/***/ }), + +/***/ 9482: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var protobuf = exports; + +/** + * Build type, one of `"full"`, `"light"` or `"minimal"`. + * @name build + * @type {string} + * @const + */ +protobuf.build = "minimal"; + +// Serialization +protobuf.Writer = __webpack_require__(1173); +protobuf.BufferWriter = __webpack_require__(3155); +protobuf.Reader = __webpack_require__(1408); +protobuf.BufferReader = __webpack_require__(593); + +// Utility +protobuf.util = __webpack_require__(9693); +protobuf.rpc = __webpack_require__(5994); +protobuf.roots = __webpack_require__(5054); +protobuf.configure = configure; + +/* istanbul ignore next */ +/** + * Reconfigures the library according to the environment. + * @returns {undefined} + */ +function configure() { + protobuf.util._configure(); + protobuf.Writer._configure(protobuf.BufferWriter); + protobuf.Reader._configure(protobuf.BufferReader); +} + +// Set up buffer utility according to the environment +configure(); + + +/***/ }), + +/***/ 1408: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +module.exports = Reader; + +var util = __webpack_require__(9693); + +var BufferReader; // cyclic + +var LongBits = util.LongBits, + utf8 = util.utf8; + +/* istanbul ignore next */ +function indexOutOfRange(reader, writeLength) { + return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); +} + +/** + * Constructs a new reader instance using the specified buffer. + * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. + * @constructor + * @param {Uint8Array} buffer Buffer to read from + */ +function Reader(buffer) { + + /** + * Read buffer. + * @type {Uint8Array} + */ + this.buf = buffer; + + /** + * Read buffer position. + * @type {number} + */ + this.pos = 0; + + /** + * Read buffer length. + * @type {number} + */ + this.len = buffer.length; +} + +var create_array = typeof Uint8Array !== "undefined" + ? function create_typed_array(buffer) { + if (buffer instanceof Uint8Array || Array.isArray(buffer)) + return new Reader(buffer); + throw Error("illegal buffer"); + } + /* istanbul ignore next */ + : function create_array(buffer) { + if (Array.isArray(buffer)) + return new Reader(buffer); + throw Error("illegal buffer"); + }; + +var create = function create() { + return util.Buffer + ? function create_buffer_setup(buffer) { + return (Reader.create = function create_buffer(buffer) { + return util.Buffer.isBuffer(buffer) + ? new BufferReader(buffer) + /* istanbul ignore next */ + : create_array(buffer); + })(buffer); + } + /* istanbul ignore next */ + : create_array; +}; + +/** + * Creates a new reader using the specified buffer. + * @function + * @param {Uint8Array|Buffer} buffer Buffer to read from + * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} + * @throws {Error} If `buffer` is not a valid buffer + */ +Reader.create = create(); + +Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; + +/** + * Reads a varint as an unsigned 32 bit value. + * @function + * @returns {number} Value read + */ +Reader.prototype.uint32 = (function read_uint32_setup() { + var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) + return function read_uint32() { + value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; + + /* istanbul ignore if */ + if ((this.pos += 5) > this.len) { + this.pos = this.len; + throw indexOutOfRange(this, 10); + } + return value; + }; +})(); + +/** + * Reads a varint as a signed 32 bit value. + * @returns {number} Value read + */ +Reader.prototype.int32 = function read_int32() { + return this.uint32() | 0; +}; + +/** + * Reads a zig-zag encoded varint as a signed 32 bit value. + * @returns {number} Value read + */ +Reader.prototype.sint32 = function read_sint32() { + var value = this.uint32(); + return value >>> 1 ^ -(value & 1) | 0; +}; + +/* eslint-disable no-invalid-this */ + +function readLongVarint() { + // tends to deopt with local vars for octet etc. + var bits = new LongBits(0, 0); + var i = 0; + if (this.len - this.pos > 4) { // fast route (lo) + for (; i < 4; ++i) { + // 1st..4th + bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + // 5th + bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; + bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + i = 0; + } else { + for (; i < 3; ++i) { + /* istanbul ignore if */ + if (this.pos >= this.len) + throw indexOutOfRange(this); + // 1st..3th + bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + // 4th + bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; + return bits; + } + if (this.len - this.pos > 4) { // fast route (hi) + for (; i < 5; ++i) { + // 6th..10th + bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + } else { + for (; i < 5; ++i) { + /* istanbul ignore if */ + if (this.pos >= this.len) + throw indexOutOfRange(this); + // 6th..10th + bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + } + /* istanbul ignore next */ + throw Error("invalid varint encoding"); +} + +/* eslint-enable no-invalid-this */ + +/** + * Reads a varint as a signed 64 bit value. + * @name Reader#int64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a varint as an unsigned 64 bit value. + * @name Reader#uint64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a zig-zag encoded varint as a signed 64 bit value. + * @name Reader#sint64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a varint as a boolean. + * @returns {boolean} Value read + */ +Reader.prototype.bool = function read_bool() { + return this.uint32() !== 0; +}; + +function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` + return (buf[end - 4] + | buf[end - 3] << 8 + | buf[end - 2] << 16 + | buf[end - 1] << 24) >>> 0; +} + +/** + * Reads fixed 32 bits as an unsigned 32 bit integer. + * @returns {number} Value read + */ +Reader.prototype.fixed32 = function read_fixed32() { + + /* istanbul ignore if */ + if (this.pos + 4 > this.len) + throw indexOutOfRange(this, 4); + + return readFixed32_end(this.buf, this.pos += 4); +}; + +/** + * Reads fixed 32 bits as a signed 32 bit integer. + * @returns {number} Value read + */ +Reader.prototype.sfixed32 = function read_sfixed32() { + + /* istanbul ignore if */ + if (this.pos + 4 > this.len) + throw indexOutOfRange(this, 4); + + return readFixed32_end(this.buf, this.pos += 4) | 0; +}; + +/* eslint-disable no-invalid-this */ + +function readFixed64(/* this: Reader */) { + + /* istanbul ignore if */ + if (this.pos + 8 > this.len) + throw indexOutOfRange(this, 8); + + return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); +} + +/* eslint-enable no-invalid-this */ + +/** + * Reads fixed 64 bits. + * @name Reader#fixed64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads zig-zag encoded fixed 64 bits. + * @name Reader#sfixed64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a float (32 bit) as a number. + * @function + * @returns {number} Value read + */ +Reader.prototype.float = function read_float() { + + /* istanbul ignore if */ + if (this.pos + 4 > this.len) + throw indexOutOfRange(this, 4); + + var value = util.float.readFloatLE(this.buf, this.pos); + this.pos += 4; + return value; +}; + +/** + * Reads a double (64 bit float) as a number. + * @function + * @returns {number} Value read + */ +Reader.prototype.double = function read_double() { + + /* istanbul ignore if */ + if (this.pos + 8 > this.len) + throw indexOutOfRange(this, 4); + + var value = util.float.readDoubleLE(this.buf, this.pos); + this.pos += 8; + return value; +}; + +/** + * Reads a sequence of bytes preceeded by its length as a varint. + * @returns {Uint8Array} Value read + */ +Reader.prototype.bytes = function read_bytes() { + var length = this.uint32(), + start = this.pos, + end = this.pos + length; + + /* istanbul ignore if */ + if (end > this.len) + throw indexOutOfRange(this, length); + + this.pos += length; + if (Array.isArray(this.buf)) // plain array + return this.buf.slice(start, end); + + if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1 + var nativeBuffer = util.Buffer; + return nativeBuffer + ? nativeBuffer.alloc(0) + : new this.buf.constructor(0); + } + return this._slice.call(this.buf, start, end); +}; + +/** + * Reads a string preceeded by its byte length as a varint. + * @returns {string} Value read + */ +Reader.prototype.string = function read_string() { + var bytes = this.bytes(); + return utf8.read(bytes, 0, bytes.length); +}; + +/** + * Skips the specified number of bytes if specified, otherwise skips a varint. + * @param {number} [length] Length if known, otherwise a varint is assumed + * @returns {Reader} `this` + */ +Reader.prototype.skip = function skip(length) { + if (typeof length === "number") { + /* istanbul ignore if */ + if (this.pos + length > this.len) + throw indexOutOfRange(this, length); + this.pos += length; + } else { + do { + /* istanbul ignore if */ + if (this.pos >= this.len) + throw indexOutOfRange(this); + } while (this.buf[this.pos++] & 128); + } + return this; +}; + +/** + * Skips the next element of the specified wire type. + * @param {number} wireType Wire type received + * @returns {Reader} `this` + */ +Reader.prototype.skipType = function(wireType) { + switch (wireType) { + case 0: + this.skip(); + break; + case 1: + this.skip(8); + break; + case 2: + this.skip(this.uint32()); + break; + case 3: + while ((wireType = this.uint32() & 7) !== 4) { + this.skipType(wireType); + } + break; + case 5: + this.skip(4); + break; + + /* istanbul ignore next */ + default: + throw Error("invalid wire type " + wireType + " at offset " + this.pos); + } + return this; +}; + +Reader._configure = function(BufferReader_) { + BufferReader = BufferReader_; + Reader.create = create(); + BufferReader._configure(); + + var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; + util.merge(Reader.prototype, { + + int64: function read_int64() { + return readLongVarint.call(this)[fn](false); + }, + + uint64: function read_uint64() { + return readLongVarint.call(this)[fn](true); + }, + + sint64: function read_sint64() { + return readLongVarint.call(this).zzDecode()[fn](false); + }, + + fixed64: function read_fixed64() { + return readFixed64.call(this)[fn](true); + }, + + sfixed64: function read_sfixed64() { + return readFixed64.call(this)[fn](false); + } + + }); +}; + + +/***/ }), + +/***/ 593: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +module.exports = BufferReader; + +// extends Reader +var Reader = __webpack_require__(1408); +(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; + +var util = __webpack_require__(9693); + +/** + * Constructs a new buffer reader instance. + * @classdesc Wire format reader using node buffers. + * @extends Reader + * @constructor + * @param {Buffer} buffer Buffer to read from + */ +function BufferReader(buffer) { + Reader.call(this, buffer); + + /** + * Read buffer. + * @name BufferReader#buf + * @type {Buffer} + */ +} + +BufferReader._configure = function () { + /* istanbul ignore else */ + if (util.Buffer) + BufferReader.prototype._slice = util.Buffer.prototype.slice; +}; + + +/** + * @override + */ +BufferReader.prototype.string = function read_string_buffer() { + var len = this.uint32(); // modifies pos + return this.buf.utf8Slice + ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) + : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); +}; + +/** + * Reads a sequence of bytes preceeded by its length as a varint. + * @name BufferReader#bytes + * @function + * @returns {Buffer} Value read + */ + +BufferReader._configure(); + + +/***/ }), + +/***/ 5054: +/***/ (function(module) { + +"use strict"; + +module.exports = {}; + +/** + * Named roots. + * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). + * Can also be used manually to make roots available across modules. + * @name roots + * @type {Object.} + * @example + * // pbjs -r myroot -o compiled.js ... + * + * // in another module: + * require("./compiled.js"); + * + * // in any subsequent module: + * var root = protobuf.roots["myroot"]; + */ + + +/***/ }), + +/***/ 5994: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Streaming RPC helpers. + * @namespace + */ +var rpc = exports; + +/** + * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. + * @typedef RPCImpl + * @type {function} + * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called + * @param {Uint8Array} requestData Request data + * @param {RPCImplCallback} callback Callback function + * @returns {undefined} + * @example + * function rpcImpl(method, requestData, callback) { + * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code + * throw Error("no such method"); + * asynchronouslyObtainAResponse(requestData, function(err, responseData) { + * callback(err, responseData); + * }); + * } + */ + +/** + * Node-style callback as used by {@link RPCImpl}. + * @typedef RPCImplCallback + * @type {function} + * @param {Error|null} error Error, if any, otherwise `null` + * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error + * @returns {undefined} + */ + +rpc.Service = __webpack_require__(7948); + + +/***/ }), + +/***/ 7948: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +module.exports = Service; + +var util = __webpack_require__(9693); + +// Extends EventEmitter +(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; + +/** + * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. + * + * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. + * @typedef rpc.ServiceMethodCallback + * @template TRes extends Message + * @type {function} + * @param {Error|null} error Error, if any + * @param {TRes} [response] Response message + * @returns {undefined} + */ + +/** + * A service method part of a {@link rpc.Service} as created by {@link Service.create}. + * @typedef rpc.ServiceMethod + * @template TReq extends Message + * @template TRes extends Message + * @type {function} + * @param {TReq|Properties} request Request message or plain object + * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message + * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` + */ + +/** + * Constructs a new RPC service instance. + * @classdesc An RPC service as returned by {@link Service#create}. + * @exports rpc.Service + * @extends util.EventEmitter + * @constructor + * @param {RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ +function Service(rpcImpl, requestDelimited, responseDelimited) { + + if (typeof rpcImpl !== "function") + throw TypeError("rpcImpl must be a function"); + + util.EventEmitter.call(this); + + /** + * RPC implementation. Becomes `null` once the service is ended. + * @type {RPCImpl|null} + */ + this.rpcImpl = rpcImpl; + + /** + * Whether requests are length-delimited. + * @type {boolean} + */ + this.requestDelimited = Boolean(requestDelimited); + + /** + * Whether responses are length-delimited. + * @type {boolean} + */ + this.responseDelimited = Boolean(responseDelimited); +} + +/** + * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. + * @param {Method|rpc.ServiceMethod} method Reflected or static method + * @param {Constructor} requestCtor Request constructor + * @param {Constructor} responseCtor Response constructor + * @param {TReq|Properties} request Request message or plain object + * @param {rpc.ServiceMethodCallback} callback Service callback + * @returns {undefined} + * @template TReq extends Message + * @template TRes extends Message + */ +Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { + + if (!request) + throw TypeError("request must be specified"); + + var self = this; + if (!callback) + return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); + + if (!self.rpcImpl) { + setTimeout(function() { callback(Error("already ended")); }, 0); + return undefined; + } + + try { + return self.rpcImpl( + method, + requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), + function rpcCallback(err, response) { + + if (err) { + self.emit("error", err, method); + return callback(err); + } + + if (response === null) { + self.end(/* endedByRPC */ true); + return undefined; + } + + if (!(response instanceof responseCtor)) { + try { + response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); + } catch (err) { + self.emit("error", err, method); + return callback(err); + } + } + + self.emit("data", response, method); + return callback(null, response); + } + ); + } catch (err) { + self.emit("error", err, method); + setTimeout(function() { callback(err); }, 0); + return undefined; + } +}; + +/** + * Ends this service and emits the `end` event. + * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. + * @returns {rpc.Service} `this` + */ +Service.prototype.end = function end(endedByRPC) { + if (this.rpcImpl) { + if (!endedByRPC) // signal end to rpcImpl + this.rpcImpl(null, null, null); + this.rpcImpl = null; + this.emit("end").off(); + } + return this; +}; + + +/***/ }), + +/***/ 1945: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +module.exports = LongBits; + +var util = __webpack_require__(9693); + +/** + * Constructs new long bits. + * @classdesc Helper class for working with the low and high bits of a 64 bit value. + * @memberof util + * @constructor + * @param {number} lo Low 32 bits, unsigned + * @param {number} hi High 32 bits, unsigned + */ +function LongBits(lo, hi) { + + // note that the casts below are theoretically unnecessary as of today, but older statically + // generated converter code might still call the ctor with signed 32bits. kept for compat. + + /** + * Low bits. + * @type {number} + */ + this.lo = lo >>> 0; + + /** + * High bits. + * @type {number} + */ + this.hi = hi >>> 0; +} + +/** + * Zero bits. + * @memberof util.LongBits + * @type {util.LongBits} + */ +var zero = LongBits.zero = new LongBits(0, 0); + +zero.toNumber = function() { return 0; }; +zero.zzEncode = zero.zzDecode = function() { return this; }; +zero.length = function() { return 1; }; + +/** + * Zero hash. + * @memberof util.LongBits + * @type {string} + */ +var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; + +/** + * Constructs new long bits from the specified number. + * @param {number} value Value + * @returns {util.LongBits} Instance + */ +LongBits.fromNumber = function fromNumber(value) { + if (value === 0) + return zero; + var sign = value < 0; + if (sign) + value = -value; + var lo = value >>> 0, + hi = (value - lo) / 4294967296 >>> 0; + if (sign) { + hi = ~hi >>> 0; + lo = ~lo >>> 0; + if (++lo > 4294967295) { + lo = 0; + if (++hi > 4294967295) + hi = 0; + } + } + return new LongBits(lo, hi); +}; + +/** + * Constructs new long bits from a number, long or string. + * @param {Long|number|string} value Value + * @returns {util.LongBits} Instance + */ +LongBits.from = function from(value) { + if (typeof value === "number") + return LongBits.fromNumber(value); + if (util.isString(value)) { + /* istanbul ignore else */ + if (util.Long) + value = util.Long.fromString(value); + else + return LongBits.fromNumber(parseInt(value, 10)); + } + return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; +}; + +/** + * Converts this long bits to a possibly unsafe JavaScript number. + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {number} Possibly unsafe number + */ +LongBits.prototype.toNumber = function toNumber(unsigned) { + if (!unsigned && this.hi >>> 31) { + var lo = ~this.lo + 1 >>> 0, + hi = ~this.hi >>> 0; + if (!lo) + hi = hi + 1 >>> 0; + return -(lo + hi * 4294967296); + } + return this.lo + this.hi * 4294967296; +}; + +/** + * Converts this long bits to a long. + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {Long} Long + */ +LongBits.prototype.toLong = function toLong(unsigned) { + return util.Long + ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) + /* istanbul ignore next */ + : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; +}; + +var charCodeAt = String.prototype.charCodeAt; + +/** + * Constructs new long bits from the specified 8 characters long hash. + * @param {string} hash Hash + * @returns {util.LongBits} Bits + */ +LongBits.fromHash = function fromHash(hash) { + if (hash === zeroHash) + return zero; + return new LongBits( + ( charCodeAt.call(hash, 0) + | charCodeAt.call(hash, 1) << 8 + | charCodeAt.call(hash, 2) << 16 + | charCodeAt.call(hash, 3) << 24) >>> 0 + , + ( charCodeAt.call(hash, 4) + | charCodeAt.call(hash, 5) << 8 + | charCodeAt.call(hash, 6) << 16 + | charCodeAt.call(hash, 7) << 24) >>> 0 + ); +}; + +/** + * Converts this long bits to a 8 characters long hash. + * @returns {string} Hash + */ +LongBits.prototype.toHash = function toHash() { + return String.fromCharCode( + this.lo & 255, + this.lo >>> 8 & 255, + this.lo >>> 16 & 255, + this.lo >>> 24 , + this.hi & 255, + this.hi >>> 8 & 255, + this.hi >>> 16 & 255, + this.hi >>> 24 + ); +}; + +/** + * Zig-zag encodes this long bits. + * @returns {util.LongBits} `this` + */ +LongBits.prototype.zzEncode = function zzEncode() { + var mask = this.hi >> 31; + this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; + this.lo = ( this.lo << 1 ^ mask) >>> 0; + return this; +}; + +/** + * Zig-zag decodes this long bits. + * @returns {util.LongBits} `this` + */ +LongBits.prototype.zzDecode = function zzDecode() { + var mask = -(this.lo & 1); + this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; + this.hi = ( this.hi >>> 1 ^ mask) >>> 0; + return this; +}; + +/** + * Calculates the length of this longbits when encoded as a varint. + * @returns {number} Length + */ +LongBits.prototype.length = function length() { + var part0 = this.lo, + part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, + part2 = this.hi >>> 24; + return part2 === 0 + ? part1 === 0 + ? part0 < 16384 + ? part0 < 128 ? 1 : 2 + : part0 < 2097152 ? 3 : 4 + : part1 < 16384 + ? part1 < 128 ? 5 : 6 + : part1 < 2097152 ? 7 : 8 + : part2 < 128 ? 9 : 10; +}; + + +/***/ }), + +/***/ 9693: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var util = exports; + +// used to return a Promise where callback is omitted +util.asPromise = __webpack_require__(4537); + +// converts to / from base64 encoded strings +util.base64 = __webpack_require__(7419); + +// base class of rpc.Service +util.EventEmitter = __webpack_require__(9211); + +// float handling accross browsers +util.float = __webpack_require__(945); + +// requires modules optionally and hides the call from bundlers +util.inquire = __webpack_require__(7199); + +// converts to / from utf8 encoded strings +util.utf8 = __webpack_require__(4997); + +// provides a node-like buffer pool in the browser +util.pool = __webpack_require__(6662); + +// utility to work with the low and high bits of a 64 bit value +util.LongBits = __webpack_require__(1945); + +/** + * Whether running within node or not. + * @memberof util + * @type {boolean} + */ +util.isNode = Boolean(typeof __webpack_require__.g !== "undefined" + && __webpack_require__.g + && __webpack_require__.g.process + && __webpack_require__.g.process.versions + && __webpack_require__.g.process.versions.node); + +/** + * Global object reference. + * @memberof util + * @type {Object} + */ +util.global = util.isNode && __webpack_require__.g + || typeof window !== "undefined" && window + || typeof self !== "undefined" && self + || this; // eslint-disable-line no-invalid-this + +/** + * An immuable empty array. + * @memberof util + * @type {Array.<*>} + * @const + */ +util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes + +/** + * An immutable empty object. + * @type {Object} + * @const + */ +util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes + +/** + * Tests if the specified value is an integer. + * @function + * @param {*} value Value to test + * @returns {boolean} `true` if the value is an integer + */ +util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { + return typeof value === "number" && isFinite(value) && Math.floor(value) === value; +}; + +/** + * Tests if the specified value is a string. + * @param {*} value Value to test + * @returns {boolean} `true` if the value is a string + */ +util.isString = function isString(value) { + return typeof value === "string" || value instanceof String; +}; + +/** + * Tests if the specified value is a non-null object. + * @param {*} value Value to test + * @returns {boolean} `true` if the value is a non-null object + */ +util.isObject = function isObject(value) { + return value && typeof value === "object"; +}; + +/** + * Checks if a property on a message is considered to be present. + * This is an alias of {@link util.isSet}. + * @function + * @param {Object} obj Plain object or message instance + * @param {string} prop Property name + * @returns {boolean} `true` if considered to be present, otherwise `false` + */ +util.isset = + +/** + * Checks if a property on a message is considered to be present. + * @param {Object} obj Plain object or message instance + * @param {string} prop Property name + * @returns {boolean} `true` if considered to be present, otherwise `false` + */ +util.isSet = function isSet(obj, prop) { + var value = obj[prop]; + if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins + return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; + return false; +}; + +/** + * Any compatible Buffer instance. + * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. + * @interface Buffer + * @extends Uint8Array + */ + +/** + * Node's Buffer class if available. + * @type {Constructor} + */ +util.Buffer = (function() { + try { + var Buffer = util.inquire("buffer").Buffer; + // refuse to use non-node buffers if not explicitly assigned (perf reasons): + return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; + } catch (e) { + /* istanbul ignore next */ + return null; + } +})(); + +// Internal alias of or polyfull for Buffer.from. +util._Buffer_from = null; + +// Internal alias of or polyfill for Buffer.allocUnsafe. +util._Buffer_allocUnsafe = null; + +/** + * Creates a new buffer of whatever type supported by the environment. + * @param {number|number[]} [sizeOrArray=0] Buffer size or number array + * @returns {Uint8Array|Buffer} Buffer + */ +util.newBuffer = function newBuffer(sizeOrArray) { + /* istanbul ignore next */ + return typeof sizeOrArray === "number" + ? util.Buffer + ? util._Buffer_allocUnsafe(sizeOrArray) + : new util.Array(sizeOrArray) + : util.Buffer + ? util._Buffer_from(sizeOrArray) + : typeof Uint8Array === "undefined" + ? sizeOrArray + : new Uint8Array(sizeOrArray); +}; + +/** + * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. + * @type {Constructor} + */ +util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; + +/** + * Any compatible Long instance. + * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. + * @interface Long + * @property {number} low Low bits + * @property {number} high High bits + * @property {boolean} unsigned Whether unsigned or not + */ + +/** + * Long.js's Long class if available. + * @type {Constructor} + */ +util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long + || /* istanbul ignore next */ util.global.Long + || util.inquire("long"); + +/** + * Regular expression used to verify 2 bit (`bool`) map keys. + * @type {RegExp} + * @const + */ +util.key2Re = /^true|false|0|1$/; + +/** + * Regular expression used to verify 32 bit (`int32` etc.) map keys. + * @type {RegExp} + * @const + */ +util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; + +/** + * Regular expression used to verify 64 bit (`int64` etc.) map keys. + * @type {RegExp} + * @const + */ +util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; + +/** + * Converts a number or long to an 8 characters long hash string. + * @param {Long|number} value Value to convert + * @returns {string} Hash + */ +util.longToHash = function longToHash(value) { + return value + ? util.LongBits.from(value).toHash() + : util.LongBits.zeroHash; +}; + +/** + * Converts an 8 characters long hash string to a long or number. + * @param {string} hash Hash + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {Long|number} Original value + */ +util.longFromHash = function longFromHash(hash, unsigned) { + var bits = util.LongBits.fromHash(hash); + if (util.Long) + return util.Long.fromBits(bits.lo, bits.hi, unsigned); + return bits.toNumber(Boolean(unsigned)); +}; + +/** + * Merges the properties of the source object into the destination object. + * @memberof util + * @param {Object.} dst Destination object + * @param {Object.} src Source object + * @param {boolean} [ifNotSet=false] Merges only if the key is not already set + * @returns {Object.} Destination object + */ +function merge(dst, src, ifNotSet) { // used by converters + for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) + if (dst[keys[i]] === undefined || !ifNotSet) + dst[keys[i]] = src[keys[i]]; + return dst; +} + +util.merge = merge; + +/** + * Converts the first character of a string to lower case. + * @param {string} str String to convert + * @returns {string} Converted string + */ +util.lcFirst = function lcFirst(str) { + return str.charAt(0).toLowerCase() + str.substring(1); +}; + +/** + * Creates a custom error constructor. + * @memberof util + * @param {string} name Error name + * @returns {Constructor} Custom error constructor + */ +function newError(name) { + + function CustomError(message, properties) { + + if (!(this instanceof CustomError)) + return new CustomError(message, properties); + + // Error.call(this, message); + // ^ just returns a new error instance because the ctor can be called as a function + + Object.defineProperty(this, "message", { get: function() { return message; } }); + + /* istanbul ignore next */ + if (Error.captureStackTrace) // node + Error.captureStackTrace(this, CustomError); + else + Object.defineProperty(this, "stack", { value: new Error().stack || "" }); + + if (properties) + merge(this, properties); + } + + CustomError.prototype = Object.create(Error.prototype, { + constructor: { + value: CustomError, + writable: true, + enumerable: false, + configurable: true, + }, + name: { + get: function get() { return name; }, + set: undefined, + enumerable: false, + // configurable: false would accurately preserve the behavior of + // the original, but I'm guessing that was not intentional. + // For an actual error subclass, this property would + // be configurable. + configurable: true, + }, + toString: { + value: function value() { return this.name + ": " + this.message; }, + writable: true, + enumerable: false, + configurable: true, + }, + }); + + return CustomError; +} + +util.newError = newError; + +/** + * Constructs a new protocol error. + * @classdesc Error subclass indicating a protocol specifc error. + * @memberof util + * @extends Error + * @template T extends Message + * @constructor + * @param {string} message Error message + * @param {Object.} [properties] Additional properties + * @example + * try { + * MyMessage.decode(someBuffer); // throws if required fields are missing + * } catch (e) { + * if (e instanceof ProtocolError && e.instance) + * console.log("decoded so far: " + JSON.stringify(e.instance)); + * } + */ +util.ProtocolError = newError("ProtocolError"); + +/** + * So far decoded message instance. + * @name util.ProtocolError#instance + * @type {Message} + */ + +/** + * A OneOf getter as returned by {@link util.oneOfGetter}. + * @typedef OneOfGetter + * @type {function} + * @returns {string|undefined} Set field name, if any + */ + +/** + * Builds a getter for a oneof's present field name. + * @param {string[]} fieldNames Field names + * @returns {OneOfGetter} Unbound getter + */ +util.oneOfGetter = function getOneOf(fieldNames) { + var fieldMap = {}; + for (var i = 0; i < fieldNames.length; ++i) + fieldMap[fieldNames[i]] = 1; + + /** + * @returns {string|undefined} Set field name, if any + * @this Object + * @ignore + */ + return function() { // eslint-disable-line consistent-return + for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) + if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) + return keys[i]; + }; +}; + +/** + * A OneOf setter as returned by {@link util.oneOfSetter}. + * @typedef OneOfSetter + * @type {function} + * @param {string|undefined} value Field name + * @returns {undefined} + */ + +/** + * Builds a setter for a oneof's present field name. + * @param {string[]} fieldNames Field names + * @returns {OneOfSetter} Unbound setter + */ +util.oneOfSetter = function setOneOf(fieldNames) { + + /** + * @param {string} name Field name + * @returns {undefined} + * @this Object + * @ignore + */ + return function(name) { + for (var i = 0; i < fieldNames.length; ++i) + if (fieldNames[i] !== name) + delete this[fieldNames[i]]; + }; +}; + +/** + * Default conversion options used for {@link Message#toJSON} implementations. + * + * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: + * + * - Longs become strings + * - Enums become string keys + * - Bytes become base64 encoded strings + * - (Sub-)Messages become plain objects + * - Maps become plain objects with all string keys + * - Repeated fields become arrays + * - NaN and Infinity for float and double fields become strings + * + * @type {IConversionOptions} + * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json + */ +util.toJSONOptions = { + longs: String, + enums: String, + bytes: String, + json: true +}; + +// Sets up buffer utility according to the environment (called in index-minimal) +util._configure = function() { + var Buffer = util.Buffer; + /* istanbul ignore if */ + if (!Buffer) { + util._Buffer_from = util._Buffer_allocUnsafe = null; + return; + } + // because node 4.x buffers are incompatible & immutable + // see: https://github.com/dcodeIO/protobuf.js/pull/665 + util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || + /* istanbul ignore next */ + function Buffer_from(value, encoding) { + return new Buffer(value, encoding); + }; + util._Buffer_allocUnsafe = Buffer.allocUnsafe || + /* istanbul ignore next */ + function Buffer_allocUnsafe(size) { + return new Buffer(size); + }; +}; + + +/***/ }), + +/***/ 1173: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +module.exports = Writer; + +var util = __webpack_require__(9693); + +var BufferWriter; // cyclic + +var LongBits = util.LongBits, + base64 = util.base64, + utf8 = util.utf8; + +/** + * Constructs a new writer operation instance. + * @classdesc Scheduled writer operation. + * @constructor + * @param {function(*, Uint8Array, number)} fn Function to call + * @param {number} len Value byte length + * @param {*} val Value to write + * @ignore + */ +function Op(fn, len, val) { + + /** + * Function to call. + * @type {function(Uint8Array, number, *)} + */ + this.fn = fn; + + /** + * Value byte length. + * @type {number} + */ + this.len = len; + + /** + * Next operation. + * @type {Writer.Op|undefined} + */ + this.next = undefined; + + /** + * Value to write. + * @type {*} + */ + this.val = val; // type varies +} + +/* istanbul ignore next */ +function noop() {} // eslint-disable-line no-empty-function + +/** + * Constructs a new writer state instance. + * @classdesc Copied writer state. + * @memberof Writer + * @constructor + * @param {Writer} writer Writer to copy state from + * @ignore + */ +function State(writer) { + + /** + * Current head. + * @type {Writer.Op} + */ + this.head = writer.head; + + /** + * Current tail. + * @type {Writer.Op} + */ + this.tail = writer.tail; + + /** + * Current buffer length. + * @type {number} + */ + this.len = writer.len; + + /** + * Next state. + * @type {State|null} + */ + this.next = writer.states; +} + +/** + * Constructs a new writer instance. + * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. + * @constructor + */ +function Writer() { + + /** + * Current length. + * @type {number} + */ + this.len = 0; + + /** + * Operations head. + * @type {Object} + */ + this.head = new Op(noop, 0, 0); + + /** + * Operations tail + * @type {Object} + */ + this.tail = this.head; + + /** + * Linked forked states. + * @type {Object|null} + */ + this.states = null; + + // When a value is written, the writer calculates its byte length and puts it into a linked + // list of operations to perform when finish() is called. This both allows us to allocate + // buffers of the exact required size and reduces the amount of work we have to do compared + // to first calculating over objects and then encoding over objects. In our case, the encoding + // part is just a linked list walk calling operations with already prepared values. +} + +var create = function create() { + return util.Buffer + ? function create_buffer_setup() { + return (Writer.create = function create_buffer() { + return new BufferWriter(); + })(); + } + /* istanbul ignore next */ + : function create_array() { + return new Writer(); + }; +}; + +/** + * Creates a new writer. + * @function + * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} + */ +Writer.create = create(); + +/** + * Allocates a buffer of the specified size. + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ +Writer.alloc = function alloc(size) { + return new util.Array(size); +}; + +// Use Uint8Array buffer pool in the browser, just like node does with buffers +/* istanbul ignore else */ +if (util.Array !== Array) + Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); + +/** + * Pushes a new operation to the queue. + * @param {function(Uint8Array, number, *)} fn Function to call + * @param {number} len Value byte length + * @param {number} val Value to write + * @returns {Writer} `this` + * @private + */ +Writer.prototype._push = function push(fn, len, val) { + this.tail = this.tail.next = new Op(fn, len, val); + this.len += len; + return this; +}; + +function writeByte(val, buf, pos) { + buf[pos] = val & 255; +} + +function writeVarint32(val, buf, pos) { + while (val > 127) { + buf[pos++] = val & 127 | 128; + val >>>= 7; + } + buf[pos] = val; +} + +/** + * Constructs a new varint writer operation instance. + * @classdesc Scheduled varint writer operation. + * @extends Op + * @constructor + * @param {number} len Value byte length + * @param {number} val Value to write + * @ignore + */ +function VarintOp(len, val) { + this.len = len; + this.next = undefined; + this.val = val; +} + +VarintOp.prototype = Object.create(Op.prototype); +VarintOp.prototype.fn = writeVarint32; + +/** + * Writes an unsigned 32 bit value as a varint. + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.uint32 = function write_uint32(value) { + // here, the call to this.push has been inlined and a varint specific Op subclass is used. + // uint32 is by far the most frequently used operation and benefits significantly from this. + this.len += (this.tail = this.tail.next = new VarintOp( + (value = value >>> 0) + < 128 ? 1 + : value < 16384 ? 2 + : value < 2097152 ? 3 + : value < 268435456 ? 4 + : 5, + value)).len; + return this; +}; + +/** + * Writes a signed 32 bit value as a varint. + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.int32 = function write_int32(value) { + return value < 0 + ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec + : this.uint32(value); +}; + +/** + * Writes a 32 bit value as a varint, zig-zag encoded. + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.sint32 = function write_sint32(value) { + return this.uint32((value << 1 ^ value >> 31) >>> 0); +}; + +function writeVarint64(val, buf, pos) { + while (val.hi) { + buf[pos++] = val.lo & 127 | 128; + val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; + val.hi >>>= 7; + } + while (val.lo > 127) { + buf[pos++] = val.lo & 127 | 128; + val.lo = val.lo >>> 7; + } + buf[pos++] = val.lo; +} + +/** + * Writes an unsigned 64 bit value as a varint. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.uint64 = function write_uint64(value) { + var bits = LongBits.from(value); + return this._push(writeVarint64, bits.length(), bits); +}; + +/** + * Writes a signed 64 bit value as a varint. + * @function + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.int64 = Writer.prototype.uint64; + +/** + * Writes a signed 64 bit value as a varint, zig-zag encoded. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.sint64 = function write_sint64(value) { + var bits = LongBits.from(value).zzEncode(); + return this._push(writeVarint64, bits.length(), bits); +}; + +/** + * Writes a boolish value as a varint. + * @param {boolean} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.bool = function write_bool(value) { + return this._push(writeByte, 1, value ? 1 : 0); +}; + +function writeFixed32(val, buf, pos) { + buf[pos ] = val & 255; + buf[pos + 1] = val >>> 8 & 255; + buf[pos + 2] = val >>> 16 & 255; + buf[pos + 3] = val >>> 24; +} + +/** + * Writes an unsigned 32 bit value as fixed 32 bits. + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.fixed32 = function write_fixed32(value) { + return this._push(writeFixed32, 4, value >>> 0); +}; + +/** + * Writes a signed 32 bit value as fixed 32 bits. + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.sfixed32 = Writer.prototype.fixed32; + +/** + * Writes an unsigned 64 bit value as fixed 64 bits. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.fixed64 = function write_fixed64(value) { + var bits = LongBits.from(value); + return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); +}; + +/** + * Writes a signed 64 bit value as fixed 64 bits. + * @function + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.sfixed64 = Writer.prototype.fixed64; + +/** + * Writes a float (32 bit). + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.float = function write_float(value) { + return this._push(util.float.writeFloatLE, 4, value); +}; + +/** + * Writes a double (64 bit float). + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.double = function write_double(value) { + return this._push(util.float.writeDoubleLE, 8, value); +}; + +var writeBytes = util.Array.prototype.set + ? function writeBytes_set(val, buf, pos) { + buf.set(val, pos); // also works for plain array values + } + /* istanbul ignore next */ + : function writeBytes_for(val, buf, pos) { + for (var i = 0; i < val.length; ++i) + buf[pos + i] = val[i]; + }; + +/** + * Writes a sequence of bytes. + * @param {Uint8Array|string} value Buffer or base64 encoded string to write + * @returns {Writer} `this` + */ +Writer.prototype.bytes = function write_bytes(value) { + var len = value.length >>> 0; + if (!len) + return this._push(writeByte, 1, 0); + if (util.isString(value)) { + var buf = Writer.alloc(len = base64.length(value)); + base64.decode(value, buf, 0); + value = buf; + } + return this.uint32(len)._push(writeBytes, len, value); +}; + +/** + * Writes a string. + * @param {string} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.string = function write_string(value) { + var len = utf8.length(value); + return len + ? this.uint32(len)._push(utf8.write, len, value) + : this._push(writeByte, 1, 0); +}; + +/** + * Forks this writer's state by pushing it to a stack. + * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. + * @returns {Writer} `this` + */ +Writer.prototype.fork = function fork() { + this.states = new State(this); + this.head = this.tail = new Op(noop, 0, 0); + this.len = 0; + return this; +}; + +/** + * Resets this instance to the last state. + * @returns {Writer} `this` + */ +Writer.prototype.reset = function reset() { + if (this.states) { + this.head = this.states.head; + this.tail = this.states.tail; + this.len = this.states.len; + this.states = this.states.next; + } else { + this.head = this.tail = new Op(noop, 0, 0); + this.len = 0; + } + return this; +}; + +/** + * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. + * @returns {Writer} `this` + */ +Writer.prototype.ldelim = function ldelim() { + var head = this.head, + tail = this.tail, + len = this.len; + this.reset().uint32(len); + if (len) { + this.tail.next = head.next; // skip noop + this.tail = tail; + this.len += len; + } + return this; +}; + +/** + * Finishes the write operation. + * @returns {Uint8Array} Finished buffer + */ +Writer.prototype.finish = function finish() { + var head = this.head.next, // skip noop + buf = this.constructor.alloc(this.len), + pos = 0; + while (head) { + head.fn(head.val, buf, pos); + pos += head.len; + head = head.next; + } + // this.head = this.tail = null; + return buf; +}; + +Writer._configure = function(BufferWriter_) { + BufferWriter = BufferWriter_; + Writer.create = create(); + BufferWriter._configure(); +}; + + +/***/ }), + +/***/ 3155: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +module.exports = BufferWriter; + +// extends Writer +var Writer = __webpack_require__(1173); +(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; + +var util = __webpack_require__(9693); + +/** + * Constructs a new buffer writer instance. + * @classdesc Wire format writer using node buffers. + * @extends Writer + * @constructor + */ +function BufferWriter() { + Writer.call(this); +} + +BufferWriter._configure = function () { + /** + * Allocates a buffer of the specified size. + * @function + * @param {number} size Buffer size + * @returns {Buffer} Buffer + */ + BufferWriter.alloc = util._Buffer_allocUnsafe; + + BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" + ? function writeBytesBuffer_set(val, buf, pos) { + buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) + // also works for plain array values + } + /* istanbul ignore next */ + : function writeBytesBuffer_copy(val, buf, pos) { + if (val.copy) // Buffer values + val.copy(buf, pos, 0, val.length); + else for (var i = 0; i < val.length;) // plain array values + buf[pos++] = val[i++]; + }; +}; + + +/** + * @override + */ +BufferWriter.prototype.bytes = function write_bytes_buffer(value) { + if (util.isString(value)) + value = util._Buffer_from(value, "base64"); + var len = value.length >>> 0; + this.uint32(len); + if (len) + this._push(BufferWriter.writeBytesBuffer, len, value); + return this; +}; + +function writeStringBuffer(val, buf, pos) { + if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) + util.utf8.write(val, buf, pos); + else if (buf.utf8Write) + buf.utf8Write(val, pos); + else + buf.write(val, pos); +} + +/** + * @override + */ +BufferWriter.prototype.string = function write_string_buffer(value) { + var len = util.Buffer.byteLength(value); + this.uint32(len); + if (len) + this._push(writeStringBuffer, len, value); + return this; +}; + + +/** + * Finishes the write operation. + * @name BufferWriter#finish + * @function + * @returns {Buffer} Finished buffer + */ + +BufferWriter._configure(); + + +/***/ }), + +/***/ 7900: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +exports.publicEncrypt = __webpack_require__(5902) +exports.privateDecrypt = __webpack_require__(6138) + +exports.privateEncrypt = function privateEncrypt (key, buf) { + return exports.publicEncrypt(key, buf, true) +} + +exports.publicDecrypt = function publicDecrypt (key, buf) { + return exports.privateDecrypt(key, buf, true) +} + + +/***/ }), + +/***/ 9199: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var createHash = __webpack_require__(3482) +var Buffer = (__webpack_require__(9509).Buffer) + +module.exports = function (seed, len) { + var t = Buffer.alloc(0) + var i = 0 + var c + while (t.length < len) { + c = i2ops(i++) + t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]) + } + return t.slice(0, len) +} + +function i2ops (c) { + var out = Buffer.allocUnsafe(4) + out.writeUInt32BE(c, 0) + return out +} + + +/***/ }), + +/***/ 6138: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var parseKeys = __webpack_require__(980) +var mgf = __webpack_require__(9199) +var xor = __webpack_require__(7859) +var BN = __webpack_require__(3550) +var crt = __webpack_require__(3663) +var createHash = __webpack_require__(3482) +var withPublic = __webpack_require__(4818) +var Buffer = (__webpack_require__(9509).Buffer) + +module.exports = function privateDecrypt (privateKey, enc, reverse) { + var padding + if (privateKey.padding) { + padding = privateKey.padding + } else if (reverse) { + padding = 1 + } else { + padding = 4 + } + + var key = parseKeys(privateKey) + var k = key.modulus.byteLength() + if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) { + throw new Error('decryption error') + } + var msg + if (reverse) { + msg = withPublic(new BN(enc), key) + } else { + msg = crt(enc, key) + } + var zBuffer = Buffer.alloc(k - msg.length) + msg = Buffer.concat([zBuffer, msg], k) + if (padding === 4) { + return oaep(key, msg) + } else if (padding === 1) { + return pkcs1(key, msg, reverse) + } else if (padding === 3) { + return msg + } else { + throw new Error('unknown padding') + } +} + +function oaep (key, msg) { + var k = key.modulus.byteLength() + var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() + var hLen = iHash.length + if (msg[0] !== 0) { + throw new Error('decryption error') + } + var maskedSeed = msg.slice(1, hLen + 1) + var maskedDb = msg.slice(hLen + 1) + var seed = xor(maskedSeed, mgf(maskedDb, hLen)) + var db = xor(maskedDb, mgf(seed, k - hLen - 1)) + if (compare(iHash, db.slice(0, hLen))) { + throw new Error('decryption error') + } + var i = hLen + while (db[i] === 0) { + i++ + } + if (db[i++] !== 1) { + throw new Error('decryption error') + } + return db.slice(i) +} + +function pkcs1 (key, msg, reverse) { + var p1 = msg.slice(0, 2) + var i = 2 + var status = 0 + while (msg[i++] !== 0) { + if (i >= msg.length) { + status++ + break + } + } + var ps = msg.slice(2, i - 1) + + if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) { + status++ + } + if (ps.length < 8) { + status++ + } + if (status) { + throw new Error('decryption error') + } + return msg.slice(i) +} +function compare (a, b) { + a = Buffer.from(a) + b = Buffer.from(b) + var dif = 0 + var len = a.length + if (a.length !== b.length) { + dif++ + len = Math.min(a.length, b.length) + } + var i = -1 + while (++i < len) { + dif += (a[i] ^ b[i]) + } + return dif +} + + +/***/ }), + +/***/ 5902: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var parseKeys = __webpack_require__(980) +var randomBytes = __webpack_require__(1798) +var createHash = __webpack_require__(3482) +var mgf = __webpack_require__(9199) +var xor = __webpack_require__(7859) +var BN = __webpack_require__(3550) +var withPublic = __webpack_require__(4818) +var crt = __webpack_require__(3663) +var Buffer = (__webpack_require__(9509).Buffer) + +module.exports = function publicEncrypt (publicKey, msg, reverse) { + var padding + if (publicKey.padding) { + padding = publicKey.padding + } else if (reverse) { + padding = 1 + } else { + padding = 4 + } + var key = parseKeys(publicKey) + var paddedMsg + if (padding === 4) { + paddedMsg = oaep(key, msg) + } else if (padding === 1) { + paddedMsg = pkcs1(key, msg, reverse) + } else if (padding === 3) { + paddedMsg = new BN(msg) + if (paddedMsg.cmp(key.modulus) >= 0) { + throw new Error('data too long for modulus') + } + } else { + throw new Error('unknown padding') + } + if (reverse) { + return crt(paddedMsg, key) + } else { + return withPublic(paddedMsg, key) + } +} + +function oaep (key, msg) { + var k = key.modulus.byteLength() + var mLen = msg.length + var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() + var hLen = iHash.length + var hLen2 = 2 * hLen + if (mLen > k - hLen2 - 2) { + throw new Error('message too long') + } + var ps = Buffer.alloc(k - mLen - hLen2 - 2) + var dblen = k - hLen - 1 + var seed = randomBytes(hLen) + var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen)) + var maskedSeed = xor(seed, mgf(maskedDb, hLen)) + return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k)) +} +function pkcs1 (key, msg, reverse) { + var mLen = msg.length + var k = key.modulus.byteLength() + if (mLen > k - 11) { + throw new Error('message too long') + } + var ps + if (reverse) { + ps = Buffer.alloc(k - mLen - 3, 0xff) + } else { + ps = nonZero(k - mLen - 3) + } + return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k)) +} +function nonZero (len) { + var out = Buffer.allocUnsafe(len) + var i = 0 + var cache = randomBytes(len * 2) + var cur = 0 + var num + while (i < len) { + if (cur === cache.length) { + cache = randomBytes(len * 2) + cur = 0 + } + num = cache[cur++] + if (num) { + out[i++] = num + } + } + return out +} + + +/***/ }), + +/***/ 4818: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var BN = __webpack_require__(3550) +var Buffer = (__webpack_require__(9509).Buffer) + +function withPublic (paddedMsg, key) { + return Buffer.from(paddedMsg + .toRed(BN.mont(key.modulus)) + .redPow(new BN(key.publicExponent)) + .fromRed() + .toArray()) +} + +module.exports = withPublic + + +/***/ }), + +/***/ 7859: +/***/ (function(module) { + +module.exports = function xor (a, b) { + var len = a.length + var i = -1 + while (++i < len) { + a[i] ^= b[i] + } + return a +} + + +/***/ }), + +/***/ 2043: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; +var __webpack_unused_export__; +/*! + * MIT License + * + * Copyright (c) 2017-2022 Peculiar Ventures, LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + + + +const ARRAY_BUFFER_NAME = "[object ArrayBuffer]"; +class BufferSourceConverter { + static isArrayBuffer(data) { + return Object.prototype.toString.call(data) === ARRAY_BUFFER_NAME; + } + static toArrayBuffer(data) { + if (this.isArrayBuffer(data)) { + return data; + } + if (data.byteLength === data.buffer.byteLength) { + return data.buffer; + } + if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) { + return data.buffer; + } + return this.toUint8Array(data.buffer) + .slice(data.byteOffset, data.byteOffset + data.byteLength) + .buffer; + } + static toUint8Array(data) { + return this.toView(data, Uint8Array); + } + static toView(data, type) { + if (data.constructor === type) { + return data; + } + if (this.isArrayBuffer(data)) { + return new type(data); + } + if (this.isArrayBufferView(data)) { + return new type(data.buffer, data.byteOffset, data.byteLength); + } + throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + static isBufferSource(data) { + return this.isArrayBufferView(data) + || this.isArrayBuffer(data); + } + static isArrayBufferView(data) { + return ArrayBuffer.isView(data) + || (data && this.isArrayBuffer(data.buffer)); + } + static isEqual(a, b) { + const aView = BufferSourceConverter.toUint8Array(a); + const bView = BufferSourceConverter.toUint8Array(b); + if (aView.length !== bView.byteLength) { + return false; + } + for (let i = 0; i < aView.length; i++) { + if (aView[i] !== bView[i]) { + return false; + } + } + return true; + } + static concat(...args) { + let buffers; + if (Array.isArray(args[0]) && !(args[1] instanceof Function)) { + buffers = args[0]; + } + else if (Array.isArray(args[0]) && args[1] instanceof Function) { + buffers = args[0]; + } + else { + if (args[args.length - 1] instanceof Function) { + buffers = args.slice(0, args.length - 1); + } + else { + buffers = args; + } + } + let size = 0; + for (const buffer of buffers) { + size += buffer.byteLength; + } + const res = new Uint8Array(size); + let offset = 0; + for (const buffer of buffers) { + const view = this.toUint8Array(buffer); + res.set(view, offset); + offset += view.length; + } + if (args[args.length - 1] instanceof Function) { + return this.toView(res, args[args.length - 1]); + } + return res.buffer; + } +} + +const STRING_TYPE = "string"; +const HEX_REGEX = /^[0-9a-f]+$/i; +const BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; +const BASE64URL_REGEX = /^[a-zA-Z0-9-_]+$/; +class Utf8Converter { + static fromString(text) { + const s = unescape(encodeURIComponent(text)); + const uintArray = new Uint8Array(s.length); + for (let i = 0; i < s.length; i++) { + uintArray[i] = s.charCodeAt(i); + } + return uintArray.buffer; + } + static toString(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let encodedString = ""; + for (let i = 0; i < buf.length; i++) { + encodedString += String.fromCharCode(buf[i]); + } + const decodedString = decodeURIComponent(escape(encodedString)); + return decodedString; + } +} +class Utf16Converter { + static toString(buffer, littleEndian = false) { + const arrayBuffer = BufferSourceConverter.toArrayBuffer(buffer); + const dataView = new DataView(arrayBuffer); + let res = ""; + for (let i = 0; i < arrayBuffer.byteLength; i += 2) { + const code = dataView.getUint16(i, littleEndian); + res += String.fromCharCode(code); + } + return res; + } + static fromString(text, littleEndian = false) { + const res = new ArrayBuffer(text.length * 2); + const dataView = new DataView(res); + for (let i = 0; i < text.length; i++) { + dataView.setUint16(i * 2, text.charCodeAt(i), littleEndian); + } + return res; + } +} +class Convert { + static isHex(data) { + return typeof data === STRING_TYPE + && HEX_REGEX.test(data); + } + static isBase64(data) { + return typeof data === STRING_TYPE + && BASE64_REGEX.test(data); + } + static isBase64Url(data) { + return typeof data === STRING_TYPE + && BASE64URL_REGEX.test(data); + } + static ToString(buffer, enc = "utf8") { + const buf = BufferSourceConverter.toUint8Array(buffer); + switch (enc.toLowerCase()) { + case "utf8": + return this.ToUtf8String(buf); + case "binary": + return this.ToBinary(buf); + case "hex": + return this.ToHex(buf); + case "base64": + return this.ToBase64(buf); + case "base64url": + return this.ToBase64Url(buf); + case "utf16le": + return Utf16Converter.toString(buf, true); + case "utf16": + case "utf16be": + return Utf16Converter.toString(buf); + default: + throw new Error(`Unknown type of encoding '${enc}'`); + } + } + static FromString(str, enc = "utf8") { + if (!str) { + return new ArrayBuffer(0); + } + switch (enc.toLowerCase()) { + case "utf8": + return this.FromUtf8String(str); + case "binary": + return this.FromBinary(str); + case "hex": + return this.FromHex(str); + case "base64": + return this.FromBase64(str); + case "base64url": + return this.FromBase64Url(str); + case "utf16le": + return Utf16Converter.fromString(str, true); + case "utf16": + case "utf16be": + return Utf16Converter.fromString(str); + default: + throw new Error(`Unknown type of encoding '${enc}'`); + } + } + static ToBase64(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + if (typeof btoa !== "undefined") { + const binary = this.ToString(buf, "binary"); + return btoa(binary); + } + else { + return Buffer.from(buf).toString("base64"); + } + } + static FromBase64(base64) { + const formatted = this.formatString(base64); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isBase64(formatted)) { + throw new TypeError("Argument 'base64Text' is not Base64 encoded"); + } + if (typeof atob !== "undefined") { + return this.FromBinary(atob(formatted)); + } + else { + return new Uint8Array(Buffer.from(formatted, "base64")).buffer; + } + } + static FromBase64Url(base64url) { + const formatted = this.formatString(base64url); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isBase64Url(formatted)) { + throw new TypeError("Argument 'base64url' is not Base64Url encoded"); + } + return this.FromBase64(this.Base64Padding(formatted.replace(/\-/g, "+").replace(/\_/g, "/"))); + } + static ToBase64Url(data) { + return this.ToBase64(data).replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, ""); + } + static FromUtf8String(text, encoding = Convert.DEFAULT_UTF8_ENCODING) { + switch (encoding) { + case "ascii": + return this.FromBinary(text); + case "utf8": + return Utf8Converter.fromString(text); + case "utf16": + case "utf16be": + return Utf16Converter.fromString(text); + case "utf16le": + case "usc2": + return Utf16Converter.fromString(text, true); + default: + throw new Error(`Unknown type of encoding '${encoding}'`); + } + } + static ToUtf8String(buffer, encoding = Convert.DEFAULT_UTF8_ENCODING) { + switch (encoding) { + case "ascii": + return this.ToBinary(buffer); + case "utf8": + return Utf8Converter.toString(buffer); + case "utf16": + case "utf16be": + return Utf16Converter.toString(buffer); + case "utf16le": + case "usc2": + return Utf16Converter.toString(buffer, true); + default: + throw new Error(`Unknown type of encoding '${encoding}'`); + } + } + static FromBinary(text) { + const stringLength = text.length; + const resultView = new Uint8Array(stringLength); + for (let i = 0; i < stringLength; i++) { + resultView[i] = text.charCodeAt(i); + } + return resultView.buffer; + } + static ToBinary(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let res = ""; + for (let i = 0; i < buf.length; i++) { + res += String.fromCharCode(buf[i]); + } + return res; + } + static ToHex(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let result = ""; + const len = buf.length; + for (let i = 0; i < len; i++) { + const byte = buf[i]; + if (byte < 16) { + result += "0"; + } + result += byte.toString(16); + } + return result; + } + static FromHex(hexString) { + let formatted = this.formatString(hexString); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isHex(formatted)) { + throw new TypeError("Argument 'hexString' is not HEX encoded"); + } + if (formatted.length % 2) { + formatted = `0${formatted}`; + } + const res = new Uint8Array(formatted.length / 2); + for (let i = 0; i < formatted.length; i = i + 2) { + const c = formatted.slice(i, i + 2); + res[i / 2] = parseInt(c, 16); + } + return res.buffer; + } + static ToUtf16String(buffer, littleEndian = false) { + return Utf16Converter.toString(buffer, littleEndian); + } + static FromUtf16String(text, littleEndian = false) { + return Utf16Converter.fromString(text, littleEndian); + } + static Base64Padding(base64) { + const padCount = 4 - (base64.length % 4); + if (padCount < 4) { + for (let i = 0; i < padCount; i++) { + base64 += "="; + } + } + return base64; + } + static formatString(data) { + return (data === null || data === void 0 ? void 0 : data.replace(/[\n\r\t ]/g, "")) || ""; + } +} +Convert.DEFAULT_UTF8_ENCODING = "utf8"; + +function assign(target, ...sources) { + const res = arguments[0]; + for (let i = 1; i < arguments.length; i++) { + const obj = arguments[i]; + for (const prop in obj) { + res[prop] = obj[prop]; + } + } + return res; +} +function combine(...buf) { + const totalByteLength = buf.map((item) => item.byteLength).reduce((prev, cur) => prev + cur); + const res = new Uint8Array(totalByteLength); + let currentPos = 0; + buf.map((item) => new Uint8Array(item)).forEach((arr) => { + for (const item2 of arr) { + res[currentPos++] = item2; + } + }); + return res.buffer; +} +function isEqual(bytes1, bytes2) { + if (!(bytes1 && bytes2)) { + return false; + } + if (bytes1.byteLength !== bytes2.byteLength) { + return false; + } + const b1 = new Uint8Array(bytes1); + const b2 = new Uint8Array(bytes2); + for (let i = 0; i < bytes1.byteLength; i++) { + if (b1[i] !== b2[i]) { + return false; + } + } + return true; +} + +exports.vJ = BufferSourceConverter; +exports.ep = Convert; +__webpack_unused_export__ = assign; +__webpack_unused_export__ = combine; +__webpack_unused_export__ = isEqual; + + +/***/ }), + +/***/ 5346: +/***/ (function(module) { + +"use strict"; + +function tryStringify (o) { + try { return JSON.stringify(o) } catch(e) { return '"[Circular]"' } +} + +module.exports = format + +function format(f, args, opts) { + var ss = (opts && opts.stringify) || tryStringify + var offset = 1 + if (typeof f === 'object' && f !== null) { + var len = args.length + offset + if (len === 1) return f + var objects = new Array(len) + objects[0] = ss(f) + for (var index = 1; index < len; index++) { + objects[index] = ss(args[index]) + } + return objects.join(' ') + } + if (typeof f !== 'string') { + return f + } + var argLen = args.length + if (argLen === 0) return f + var str = '' + var a = 1 - offset + var lastPos = -1 + var flen = (f && f.length) || 0 + for (var i = 0; i < flen;) { + if (f.charCodeAt(i) === 37 && i + 1 < flen) { + lastPos = lastPos > -1 ? lastPos : 0 + switch (f.charCodeAt(i + 1)) { + case 100: // 'd' + case 102: // 'f' + if (a >= argLen) + break + if (args[a] == null) break + if (lastPos < i) + str += f.slice(lastPos, i) + str += Number(args[a]) + lastPos = i + 2 + i++ + break + case 105: // 'i' + if (a >= argLen) + break + if (args[a] == null) break + if (lastPos < i) + str += f.slice(lastPos, i) + str += Math.floor(Number(args[a])) + lastPos = i + 2 + i++ + break + case 79: // 'O' + case 111: // 'o' + case 106: // 'j' + if (a >= argLen) + break + if (args[a] === undefined) break + if (lastPos < i) + str += f.slice(lastPos, i) + var type = typeof args[a] + if (type === 'string') { + str += '\'' + args[a] + '\'' + lastPos = i + 2 + i++ + break + } + if (type === 'function') { + str += args[a].name || '' + lastPos = i + 2 + i++ + break + } + str += ss(args[a]) + lastPos = i + 2 + i++ + break + case 115: // 's' + if (a >= argLen) + break + if (lastPos < i) + str += f.slice(lastPos, i) + str += String(args[a]) + lastPos = i + 2 + i++ + break + case 37: // '%' + if (lastPos < i) + str += f.slice(lastPos, i) + str += '%' + lastPos = i + 2 + i++ + a-- + break + } + ++a + } + ++i + } + if (lastPos === -1) + return f + else if (lastPos < flen) { + str += f.slice(lastPos) + } + + return str +} + + +/***/ }), + +/***/ 1798: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); + + +// limit of Crypto.getRandomValues() +// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues +var MAX_BYTES = 65536 + +// Node supports requesting up to this number of bytes +// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48 +var MAX_UINT32 = 4294967295 + +function oldBrowser () { + throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11') +} + +var Buffer = (__webpack_require__(9509).Buffer) +var crypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto + +if (crypto && crypto.getRandomValues) { + module.exports = randomBytes +} else { + module.exports = oldBrowser +} + +function randomBytes (size, cb) { + // phantomjs needs to throw + if (size > MAX_UINT32) throw new RangeError('requested too many random bytes') + + var bytes = Buffer.allocUnsafe(size) + + if (size > 0) { // getRandomValues fails on IE if size == 0 + if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues + // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues + for (var generated = 0; generated < size; generated += MAX_BYTES) { + // buffer.slice automatically checks if the end is past the end of + // the buffer so we don't have to here + crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES)) + } + } else { + crypto.getRandomValues(bytes) + } + } + + if (typeof cb === 'function') { + return process.nextTick(function () { + cb(null, bytes) + }) + } + + return bytes +} + + +/***/ }), + +/***/ 7963: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); + + +function oldBrowser () { + throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') +} +var safeBuffer = __webpack_require__(9509) +var randombytes = __webpack_require__(1798) +var Buffer = safeBuffer.Buffer +var kBufferMaxLength = safeBuffer.kMaxLength +var crypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto +var kMaxUint32 = Math.pow(2, 32) - 1 +function assertOffset (offset, length) { + if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare + throw new TypeError('offset must be a number') + } + + if (offset > kMaxUint32 || offset < 0) { + throw new TypeError('offset must be a uint32') + } + + if (offset > kBufferMaxLength || offset > length) { + throw new RangeError('offset out of range') + } +} + +function assertSize (size, offset, length) { + if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare + throw new TypeError('size must be a number') + } + + if (size > kMaxUint32 || size < 0) { + throw new TypeError('size must be a uint32') + } + + if (size + offset > length || size > kBufferMaxLength) { + throw new RangeError('buffer too small') + } +} +if ((crypto && crypto.getRandomValues) || !process.browser) { + exports.randomFill = randomFill + exports.randomFillSync = randomFillSync +} else { + exports.randomFill = oldBrowser + exports.randomFillSync = oldBrowser +} +function randomFill (buf, offset, size, cb) { + if (!Buffer.isBuffer(buf) && !(buf instanceof __webpack_require__.g.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array') + } + + if (typeof offset === 'function') { + cb = offset + offset = 0 + size = buf.length + } else if (typeof size === 'function') { + cb = size + size = buf.length - offset + } else if (typeof cb !== 'function') { + throw new TypeError('"cb" argument must be a function') + } + assertOffset(offset, buf.length) + assertSize(size, offset, buf.length) + return actualFill(buf, offset, size, cb) +} + +function actualFill (buf, offset, size, cb) { + if (process.browser) { + var ourBuf = buf.buffer + var uint = new Uint8Array(ourBuf, offset, size) + crypto.getRandomValues(uint) + if (cb) { + process.nextTick(function () { + cb(null, buf) + }) + return + } + return buf + } + if (cb) { + randombytes(size, function (err, bytes) { + if (err) { + return cb(err) + } + bytes.copy(buf, offset) + cb(null, buf) + }) + return + } + var bytes = randombytes(size) + bytes.copy(buf, offset) + return buf +} +function randomFillSync (buf, offset, size) { + if (typeof offset === 'undefined') { + offset = 0 + } + if (!Buffer.isBuffer(buf) && !(buf instanceof __webpack_require__.g.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array') + } + + assertOffset(offset, buf.length) + + if (size === undefined) size = buf.length - offset + + assertSize(size, offset, buf.length) + + return actualFill(buf, offset, size) +} + + +/***/ }), + +/***/ 6753: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ + +var pna = __webpack_require__(8212); +/**/ + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var util = Object.create(__webpack_require__(6497)); +util.inherits = __webpack_require__(5717); +/**/ + +var Readable = __webpack_require__(9481); +var Writable = __webpack_require__(4229); + +util.inherits(Duplex, Readable); + +{ + // avoid scope creep, the keys array can then be collected + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); + + pna.nextTick(cb, err); +}; + +/***/ }), + +/***/ 2725: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; + +var Transform = __webpack_require__(4605); + +/**/ +var util = Object.create(__webpack_require__(6497)); +util.inherits = __webpack_require__(5717); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ 9481: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var pna = __webpack_require__(8212); +/**/ + +module.exports = Readable; + +/**/ +var isArray = __webpack_require__(5309); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = (__webpack_require__(7187).EventEmitter); + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(2503); +/**/ + +/**/ + +var Buffer = (__webpack_require__(3545).Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +/**/ +var util = Object.create(__webpack_require__(6497)); +util.inherits = __webpack_require__(5717); +/**/ + +/**/ +var debugUtil = __webpack_require__(4616); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = __webpack_require__(5057); +var destroyImpl = __webpack_require__(1195); +var StringDecoder; + +util.inherits(Readable, Stream); + +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream) { + Duplex = Duplex || __webpack_require__(6753); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = (__webpack_require__(2553)/* .StringDecoder */ .s); + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || __webpack_require__(6753); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); + +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + this.push(null); + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit('error', new Error('stream.push() after EOF')); + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + } + } + + return needMoreData(state); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} + +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = (__webpack_require__(2553)/* .StringDecoder */ .s); + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + pna.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('_read() is not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { hasUnpiped: false }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, { hasUnpiped: false }); + }return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this, unpipeInfo); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + pna.nextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + + var state = this._readableState; + var paused = false; + + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + + _this.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return this; +}; + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._readableState.highWaterMark; + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = Buffer.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +/***/ }), + +/***/ 4605: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; + +var Duplex = __webpack_require__(6753); + +/**/ +var util = Object.create(__webpack_require__(6497)); +util.inherits = __webpack_require__(5717); +/**/ + +util.inherits(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + + ts.writechunk = null; + ts.writecb = null; + + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + + cb(er); + + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +Transform.prototype._destroy = function (err, cb) { + var _this2 = this; + + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} + +/***/ }), + +/***/ 4229: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +/**/ + +var pna = __webpack_require__(8212); +/**/ + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = Object.create(__webpack_require__(6497)); +util.inherits = __webpack_require__(5717); +/**/ + +/**/ +var internalUtil = { + deprecate: __webpack_require__(4927) +}; +/**/ + +/**/ +var Stream = __webpack_require__(2503); +/**/ + +/**/ + +var Buffer = (__webpack_require__(3545).Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +var destroyImpl = __webpack_require__(1195); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(6753); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || __webpack_require__(6753); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + + if (typeof options.final === 'function') this._final = options.final; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + pna.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + stream.emit('error', err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function') { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); + +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + this.end(); + cb(err); +}; + +/***/ }), + +/***/ 5057: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = (__webpack_require__(3545).Buffer); +var util = __webpack_require__(2361); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); +} + +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + BufferList.prototype.push = function push(v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + }; + + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + }; + + return BufferList; +}(); + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} + +/***/ }), + +/***/ 1195: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +/**/ + +var pna = __webpack_require__(8212); +/**/ + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + pna.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + pna.nextTick(emitErrorNT, this, err); + } + } + + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + pna.nextTick(emitErrorNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + pna.nextTick(emitErrorNT, _this, err); + } + } else if (cb) { + cb(err); + } + }); + + return this; +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy +}; + +/***/ }), + +/***/ 2503: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = __webpack_require__(7187).EventEmitter; + + +/***/ }), + +/***/ 5309: +/***/ (function(module) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ 3545: +/***/ (function(module, exports, __webpack_require__) { + +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(8764) +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ 8473: +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(9481); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(4229); +exports.Duplex = __webpack_require__(6753); +exports.Transform = __webpack_require__(4605); +exports.PassThrough = __webpack_require__(2725); + + +/***/ }), + +/***/ 9785: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + +var Buffer = (__webpack_require__(8764).Buffer) +var inherits = __webpack_require__(5717) +var HashBase = __webpack_require__(3349) + +var ARRAY16 = new Array(16) + +var zl = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +] + +var zr = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +] + +var sl = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +] + +var sr = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +] + +var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e] +var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000] + +function RIPEMD160 () { + HashBase.call(this, 64) + + // state + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 +} + +inherits(RIPEMD160, HashBase) + +RIPEMD160.prototype._update = function () { + var words = ARRAY16 + for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4) + + var al = this._a | 0 + var bl = this._b | 0 + var cl = this._c | 0 + var dl = this._d | 0 + var el = this._e | 0 + + var ar = this._a | 0 + var br = this._b | 0 + var cr = this._c | 0 + var dr = this._d | 0 + var er = this._e | 0 + + // computation + for (var i = 0; i < 80; i += 1) { + var tl + var tr + if (i < 16) { + tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]) + tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]) + } else if (i < 32) { + tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]) + tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]) + } else if (i < 48) { + tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]) + tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]) + } else if (i < 64) { + tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]) + tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]) + } else { // if (i<80) { + tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]) + tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]) + } + + al = el + el = dl + dl = rotl(cl, 10) + cl = bl + bl = tl + + ar = er + er = dr + dr = rotl(cr, 10) + cr = br + br = tr + } + + // update state + var t = (this._b + cl + dr) | 0 + this._b = (this._c + dl + er) | 0 + this._c = (this._d + el + ar) | 0 + this._d = (this._e + al + br) | 0 + this._e = (this._a + bl + cr) | 0 + this._a = t +} + +RIPEMD160.prototype._digest = function () { + // create padding and handle blocks + this._block[this._blockOffset++] = 0x80 + if (this._blockOffset > 56) { + this._block.fill(0, this._blockOffset, 64) + this._update() + this._blockOffset = 0 + } + + this._block.fill(0, this._blockOffset, 56) + this._block.writeUInt32LE(this._length[0], 56) + this._block.writeUInt32LE(this._length[1], 60) + this._update() + + // produce result + var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20) + buffer.writeInt32LE(this._a, 0) + buffer.writeInt32LE(this._b, 4) + buffer.writeInt32LE(this._c, 8) + buffer.writeInt32LE(this._d, 12) + buffer.writeInt32LE(this._e, 16) + return buffer +} + +function rotl (x, n) { + return (x << n) | (x >>> (32 - n)) +} + +function fn1 (a, b, c, d, e, m, k, s) { + return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0 +} + +function fn2 (a, b, c, d, e, m, k, s) { + return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0 +} + +function fn3 (a, b, c, d, e, m, k, s) { + return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0 +} + +function fn4 (a, b, c, d, e, m, k, s) { + return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0 +} + +function fn5 (a, b, c, d, e, m, k, s) { + return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0 +} + +module.exports = RIPEMD160 + + +/***/ }), + +/***/ 9509: +/***/ (function(module, exports, __webpack_require__) { + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(8764) +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ 7635: +/***/ (function(module) { + +"use strict"; + + +(function(root) { + const MAX_VALUE = 0x7fffffff; + + // The SHA256 and PBKDF2 implementation are from scrypt-async-js: + // See: https://github.com/dchest/scrypt-async-js + function SHA256(m) { + const K = new Uint32Array([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, + 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, + 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, + 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, + 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, + 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, + 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, + 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, + 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 + ]); + + let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a; + let h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19; + const w = new Uint32Array(64); + + function blocks(p) { + let off = 0, len = p.length; + while (len >= 64) { + let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i, j, t1, t2; + + for (i = 0; i < 16; i++) { + j = off + i*4; + w[i] = ((p[j] & 0xff)<<24) | ((p[j+1] & 0xff)<<16) | + ((p[j+2] & 0xff)<<8) | (p[j+3] & 0xff); + } + + for (i = 16; i < 64; i++) { + u = w[i-2]; + t1 = ((u>>>17) | (u<<(32-17))) ^ ((u>>>19) | (u<<(32-19))) ^ (u>>>10); + + u = w[i-15]; + t2 = ((u>>>7) | (u<<(32-7))) ^ ((u>>>18) | (u<<(32-18))) ^ (u>>>3); + + w[i] = (((t1 + w[i-7]) | 0) + ((t2 + w[i-16]) | 0)) | 0; + } + + for (i = 0; i < 64; i++) { + t1 = ((((((e>>>6) | (e<<(32-6))) ^ ((e>>>11) | (e<<(32-11))) ^ + ((e>>>25) | (e<<(32-25)))) + ((e & f) ^ (~e & g))) | 0) + + ((h + ((K[i] + w[i]) | 0)) | 0)) | 0; + + t2 = ((((a>>>2) | (a<<(32-2))) ^ ((a>>>13) | (a<<(32-13))) ^ + ((a>>>22) | (a<<(32-22)))) + ((a & b) ^ (a & c) ^ (b & c))) | 0; + + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + + h0 = (h0 + a) | 0; + h1 = (h1 + b) | 0; + h2 = (h2 + c) | 0; + h3 = (h3 + d) | 0; + h4 = (h4 + e) | 0; + h5 = (h5 + f) | 0; + h6 = (h6 + g) | 0; + h7 = (h7 + h) | 0; + + off += 64; + len -= 64; + } + } + + blocks(m); + + let i, bytesLeft = m.length % 64, + bitLenHi = (m.length / 0x20000000) | 0, + bitLenLo = m.length << 3, + numZeros = (bytesLeft < 56) ? 56 : 120, + p = m.slice(m.length - bytesLeft, m.length); + + p.push(0x80); + for (i = bytesLeft + 1; i < numZeros; i++) { p.push(0); } + p.push((bitLenHi >>> 24) & 0xff); + p.push((bitLenHi >>> 16) & 0xff); + p.push((bitLenHi >>> 8) & 0xff); + p.push((bitLenHi >>> 0) & 0xff); + p.push((bitLenLo >>> 24) & 0xff); + p.push((bitLenLo >>> 16) & 0xff); + p.push((bitLenLo >>> 8) & 0xff); + p.push((bitLenLo >>> 0) & 0xff); + + blocks(p); + + return [ + (h0 >>> 24) & 0xff, (h0 >>> 16) & 0xff, (h0 >>> 8) & 0xff, (h0 >>> 0) & 0xff, + (h1 >>> 24) & 0xff, (h1 >>> 16) & 0xff, (h1 >>> 8) & 0xff, (h1 >>> 0) & 0xff, + (h2 >>> 24) & 0xff, (h2 >>> 16) & 0xff, (h2 >>> 8) & 0xff, (h2 >>> 0) & 0xff, + (h3 >>> 24) & 0xff, (h3 >>> 16) & 0xff, (h3 >>> 8) & 0xff, (h3 >>> 0) & 0xff, + (h4 >>> 24) & 0xff, (h4 >>> 16) & 0xff, (h4 >>> 8) & 0xff, (h4 >>> 0) & 0xff, + (h5 >>> 24) & 0xff, (h5 >>> 16) & 0xff, (h5 >>> 8) & 0xff, (h5 >>> 0) & 0xff, + (h6 >>> 24) & 0xff, (h6 >>> 16) & 0xff, (h6 >>> 8) & 0xff, (h6 >>> 0) & 0xff, + (h7 >>> 24) & 0xff, (h7 >>> 16) & 0xff, (h7 >>> 8) & 0xff, (h7 >>> 0) & 0xff + ]; + } + + function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) { + // compress password if it's longer than hash block length + password = (password.length <= 64) ? password : SHA256(password); + + const innerLen = 64 + salt.length + 4; + const inner = new Array(innerLen); + const outerKey = new Array(64); + + let i; + let dk = []; + + // inner = (password ^ ipad) || salt || counter + for (i = 0; i < 64; i++) { inner[i] = 0x36; } + for (i = 0; i < password.length; i++) { inner[i] ^= password[i]; } + for (i = 0; i < salt.length; i++) { inner[64 + i] = salt[i]; } + for (i = innerLen - 4; i < innerLen; i++) { inner[i] = 0; } + + // outerKey = password ^ opad + for (i = 0; i < 64; i++) outerKey[i] = 0x5c; + for (i = 0; i < password.length; i++) outerKey[i] ^= password[i]; + + // increments counter inside inner + function incrementCounter() { + for (let i = innerLen - 1; i >= innerLen - 4; i--) { + inner[i]++; + if (inner[i] <= 0xff) return; + inner[i] = 0; + } + } + + // output blocks = SHA256(outerKey || SHA256(inner)) ... + while (dkLen >= 32) { + incrementCounter(); + dk = dk.concat(SHA256(outerKey.concat(SHA256(inner)))); + dkLen -= 32; + } + if (dkLen > 0) { + incrementCounter(); + dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0, dkLen)); + } + + return dk; + } + + // The following is an adaptation of scryptsy + // See: https://www.npmjs.com/package/scryptsy + function blockmix_salsa8(BY, Yi, r, x, _X) { + let i; + + arraycopy(BY, (2 * r - 1) * 16, _X, 0, 16); + for (i = 0; i < 2 * r; i++) { + blockxor(BY, i * 16, _X, 16); + salsa20_8(_X, x); + arraycopy(_X, 0, BY, Yi + (i * 16), 16); + } + + for (i = 0; i < r; i++) { + arraycopy(BY, Yi + (i * 2) * 16, BY, (i * 16), 16); + } + + for (i = 0; i < r; i++) { + arraycopy(BY, Yi + (i * 2 + 1) * 16, BY, (i + r) * 16, 16); + } + } + + function R(a, b) { + return (a << b) | (a >>> (32 - b)); + } + + function salsa20_8(B, x) { + arraycopy(B, 0, x, 0, 16); + + for (let i = 8; i > 0; i -= 2) { + x[ 4] ^= R(x[ 0] + x[12], 7); + x[ 8] ^= R(x[ 4] + x[ 0], 9); + x[12] ^= R(x[ 8] + x[ 4], 13); + x[ 0] ^= R(x[12] + x[ 8], 18); + x[ 9] ^= R(x[ 5] + x[ 1], 7); + x[13] ^= R(x[ 9] + x[ 5], 9); + x[ 1] ^= R(x[13] + x[ 9], 13); + x[ 5] ^= R(x[ 1] + x[13], 18); + x[14] ^= R(x[10] + x[ 6], 7); + x[ 2] ^= R(x[14] + x[10], 9); + x[ 6] ^= R(x[ 2] + x[14], 13); + x[10] ^= R(x[ 6] + x[ 2], 18); + x[ 3] ^= R(x[15] + x[11], 7); + x[ 7] ^= R(x[ 3] + x[15], 9); + x[11] ^= R(x[ 7] + x[ 3], 13); + x[15] ^= R(x[11] + x[ 7], 18); + x[ 1] ^= R(x[ 0] + x[ 3], 7); + x[ 2] ^= R(x[ 1] + x[ 0], 9); + x[ 3] ^= R(x[ 2] + x[ 1], 13); + x[ 0] ^= R(x[ 3] + x[ 2], 18); + x[ 6] ^= R(x[ 5] + x[ 4], 7); + x[ 7] ^= R(x[ 6] + x[ 5], 9); + x[ 4] ^= R(x[ 7] + x[ 6], 13); + x[ 5] ^= R(x[ 4] + x[ 7], 18); + x[11] ^= R(x[10] + x[ 9], 7); + x[ 8] ^= R(x[11] + x[10], 9); + x[ 9] ^= R(x[ 8] + x[11], 13); + x[10] ^= R(x[ 9] + x[ 8], 18); + x[12] ^= R(x[15] + x[14], 7); + x[13] ^= R(x[12] + x[15], 9); + x[14] ^= R(x[13] + x[12], 13); + x[15] ^= R(x[14] + x[13], 18); + } + + for (let i = 0; i < 16; ++i) { + B[i] += x[i]; + } + } + + // naive approach... going back to loop unrolling may yield additional performance + function blockxor(S, Si, D, len) { + for (let i = 0; i < len; i++) { + D[i] ^= S[Si + i] + } + } + + function arraycopy(src, srcPos, dest, destPos, length) { + while (length--) { + dest[destPos++] = src[srcPos++]; + } + } + + function checkBufferish(o) { + if (!o || typeof(o.length) !== 'number') { return false; } + + for (let i = 0; i < o.length; i++) { + const v = o[i]; + if (typeof(v) !== 'number' || v % 1 || v < 0 || v >= 256) { + return false; + } + } + + return true; + } + + function ensureInteger(value, name) { + if (typeof(value) !== "number" || (value % 1)) { throw new Error('invalid ' + name); } + return value; + } + + // N = Cpu cost, r = Memory cost, p = parallelization cost + // callback(error, progress, key) + function _scrypt(password, salt, N, r, p, dkLen, callback) { + + N = ensureInteger(N, 'N'); + r = ensureInteger(r, 'r'); + p = ensureInteger(p, 'p'); + + dkLen = ensureInteger(dkLen, 'dkLen'); + + if (N === 0 || (N & (N - 1)) !== 0) { throw new Error('N must be power of 2'); } + + if (N > MAX_VALUE / 128 / r) { throw new Error('N too large'); } + if (r > MAX_VALUE / 128 / p) { throw new Error('r too large'); } + + if (!checkBufferish(password)) { + throw new Error('password must be an array or buffer'); + } + password = Array.prototype.slice.call(password); + + if (!checkBufferish(salt)) { + throw new Error('salt must be an array or buffer'); + } + salt = Array.prototype.slice.call(salt); + + let b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r); + const B = new Uint32Array(p * 32 * r) + for (let i = 0; i < B.length; i++) { + const j = i * 4; + B[i] = ((b[j + 3] & 0xff) << 24) | + ((b[j + 2] & 0xff) << 16) | + ((b[j + 1] & 0xff) << 8) | + ((b[j + 0] & 0xff) << 0); + } + + const XY = new Uint32Array(64 * r); + const V = new Uint32Array(32 * r * N); + + const Yi = 32 * r; + + // scratch space + const x = new Uint32Array(16); // salsa20_8 + const _X = new Uint32Array(16); // blockmix_salsa8 + + const totalOps = p * N * 2; + let currentOp = 0; + let lastPercent10 = null; + + // Set this to true to abandon the scrypt on the next step + let stop = false; + + // State information + let state = 0; + let i0 = 0, i1; + let Bi; + + // How many blockmix_salsa8 can we do per step? + const limit = callback ? parseInt(1000 / r): 0xffffffff; + + // Trick from scrypt-async; if there is a setImmediate shim in place, use it + const nextTick = (typeof(setImmediate) !== 'undefined') ? setImmediate : setTimeout; + + // This is really all I changed; making scryptsy a state machine so we occasionally + // stop and give other evnts on the evnt loop a chance to run. ~RicMoo + const incrementalSMix = function() { + if (stop) { + return callback(new Error('cancelled'), currentOp / totalOps); + } + + let steps; + + switch (state) { + case 0: + // for (var i = 0; i < p; i++)... + Bi = i0 * 32 * r; + + arraycopy(B, Bi, XY, 0, Yi); // ROMix - 1 + + state = 1; // Move to ROMix 2 + i1 = 0; + + // Fall through + + case 1: + + // Run up to 1000 steps of the first inner smix loop + steps = N - i1; + if (steps > limit) { steps = limit; } + for (let i = 0; i < steps; i++) { // ROMix - 2 + arraycopy(XY, 0, V, (i1 + i) * Yi, Yi) // ROMix - 3 + blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 4 + } + + // for (var i = 0; i < N; i++) + i1 += steps; + currentOp += steps; + + if (callback) { + // Call the callback with the progress (optionally stopping us) + const percent10 = parseInt(1000 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { break; } + lastPercent10 = percent10; + } + } + + if (i1 < N) { break; } + + i1 = 0; // Move to ROMix 6 + state = 2; + + // Fall through + + case 2: + + // Run up to 1000 steps of the second inner smix loop + steps = N - i1; + if (steps > limit) { steps = limit; } + for (let i = 0; i < steps; i++) { // ROMix - 6 + const offset = (2 * r - 1) * 16; // ROMix - 7 + const j = XY[offset] & (N - 1); + blockxor(V, j * Yi, XY, Yi); // ROMix - 8 (inner) + blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 9 (outer) + } + + // for (var i = 0; i < N; i++)... + i1 += steps; + currentOp += steps; + + // Call the callback with the progress (optionally stopping us) + if (callback) { + const percent10 = parseInt(1000 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { break; } + lastPercent10 = percent10; + } + } + + if (i1 < N) { break; } + + arraycopy(XY, 0, B, Bi, Yi); // ROMix - 10 + + // for (var i = 0; i < p; i++)... + i0++; + if (i0 < p) { + state = 0; + break; + } + + b = []; + for (let i = 0; i < B.length; i++) { + b.push((B[i] >> 0) & 0xff); + b.push((B[i] >> 8) & 0xff); + b.push((B[i] >> 16) & 0xff); + b.push((B[i] >> 24) & 0xff); + } + + const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen); + + // Send the result to the callback + if (callback) { callback(null, 1.0, derivedKey); } + + // Done; don't break (which would reschedule) + return derivedKey; + } + + // Schedule the next steps + if (callback) { nextTick(incrementalSMix); } + } + + // Run the smix state machine until completion + if (!callback) { + while (true) { + const derivedKey = incrementalSMix(); + if (derivedKey != undefined) { return derivedKey; } + } + } + + // Bootstrap the async incremental smix + incrementalSMix(); + } + + const lib = { + scrypt: function(password, salt, N, r, p, dkLen, progressCallback) { + return new Promise(function(resolve, reject) { + let lastProgress = 0; + if (progressCallback) { progressCallback(0); } + _scrypt(password, salt, N, r, p, dkLen, function(error, progress, key) { + if (error) { + reject(error); + } else if (key) { + if (progressCallback && lastProgress !== 1) { + progressCallback(1); + } + resolve(new Uint8Array(key)); + } else if (progressCallback && progress !== lastProgress) { + lastProgress = progress; + return progressCallback(progress); + } + }); + }); + }, + syncScrypt: function(password, salt, N, r, p, dkLen) { + return new Uint8Array(_scrypt(password, salt, N, r, p, dkLen)); + } + }; + + // node.js + if (true) { + module.exports = lib; + + // RequireJS/AMD + // http://www.requirejs.org/docs/api.html + // https://github.com/amdjs/amdjs-api/wiki/AMD + } else {} + +})(this); + + +/***/ }), + +/***/ 4189: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var Buffer = (__webpack_require__(9509).Buffer) + +// prototype class for hash functions +function Hash (blockSize, finalSize) { + this._block = Buffer.alloc(blockSize) + this._finalSize = finalSize + this._blockSize = blockSize + this._len = 0 +} + +Hash.prototype.update = function (data, enc) { + if (typeof data === 'string') { + enc = enc || 'utf8' + data = Buffer.from(data, enc) + } + + var block = this._block + var blockSize = this._blockSize + var length = data.length + var accum = this._len + + for (var offset = 0; offset < length;) { + var assigned = accum % blockSize + var remainder = Math.min(length - offset, blockSize - assigned) + + for (var i = 0; i < remainder; i++) { + block[assigned + i] = data[offset + i] + } + + accum += remainder + offset += remainder + + if ((accum % blockSize) === 0) { + this._update(block) + } + } + + this._len += length + return this +} + +Hash.prototype.digest = function (enc) { + var rem = this._len % this._blockSize + + this._block[rem] = 0x80 + + // zero (rem + 1) trailing bits, where (rem + 1) is the smallest + // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize + this._block.fill(0, rem + 1) + + if (rem >= this._finalSize) { + this._update(this._block) + this._block.fill(0) + } + + var bits = this._len * 8 + + // uint32 + if (bits <= 0xffffffff) { + this._block.writeUInt32BE(bits, this._blockSize - 4) + + // uint64 + } else { + var lowBits = (bits & 0xffffffff) >>> 0 + var highBits = (bits - lowBits) / 0x100000000 + + this._block.writeUInt32BE(highBits, this._blockSize - 8) + this._block.writeUInt32BE(lowBits, this._blockSize - 4) + } + + this._update(this._block) + var hash = this._hash() + + return enc ? hash.toString(enc) : hash +} + +Hash.prototype._update = function () { + throw new Error('_update must be implemented by subclass') +} + +module.exports = Hash + + +/***/ }), + +/***/ 9072: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var exports = module.exports = function SHA (algorithm) { + algorithm = algorithm.toLowerCase() + + var Algorithm = exports[algorithm] + if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)') + + return new Algorithm() +} + +exports.sha = __webpack_require__(4448) +exports.sha1 = __webpack_require__(8336) +exports.sha224 = __webpack_require__(8432) +exports.sha256 = __webpack_require__(7499) +exports.sha384 = __webpack_require__(1686) +exports.sha512 = __webpack_require__(7816) + + +/***/ }), + +/***/ 4448: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined + * in FIPS PUB 180-1 + * This source code is derived from sha1.js of the same repository. + * The difference between SHA-0 and SHA-1 is just a bitwise rotate left + * operation was added. + */ + +var inherits = __webpack_require__(5717) +var Hash = __webpack_require__(4189) +var Buffer = (__webpack_require__(9509).Buffer) + +var K = [ + 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 +] + +var W = new Array(80) + +function Sha () { + this.init() + this._w = W + + Hash.call(this, 64, 56) +} + +inherits(Sha, Hash) + +Sha.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 + + return this +} + +function rotl5 (num) { + return (num << 5) | (num >>> 27) +} + +function rotl30 (num) { + return (num << 30) | (num >>> 2) +} + +function ft (s, b, c, d) { + if (s === 0) return (b & c) | ((~b) & d) + if (s === 2) return (b & c) | (b & d) | (c & d) + return b ^ c ^ d +} + +Sha.prototype._update = function (M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16] + + for (var j = 0; j < 80; ++j) { + var s = ~~(j / 20) + var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 + + e = d + d = c + c = rotl30(b) + b = a + a = t + } + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} + +Sha.prototype._hash = function () { + var H = Buffer.allocUnsafe(20) + + H.writeInt32BE(this._a | 0, 0) + H.writeInt32BE(this._b | 0, 4) + H.writeInt32BE(this._c | 0, 8) + H.writeInt32BE(this._d | 0, 12) + H.writeInt32BE(this._e | 0, 16) + + return H +} + +module.exports = Sha + + +/***/ }), + +/***/ 8336: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +var inherits = __webpack_require__(5717) +var Hash = __webpack_require__(4189) +var Buffer = (__webpack_require__(9509).Buffer) + +var K = [ + 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 +] + +var W = new Array(80) + +function Sha1 () { + this.init() + this._w = W + + Hash.call(this, 64, 56) +} + +inherits(Sha1, Hash) + +Sha1.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 + + return this +} + +function rotl1 (num) { + return (num << 1) | (num >>> 31) +} + +function rotl5 (num) { + return (num << 5) | (num >>> 27) +} + +function rotl30 (num) { + return (num << 30) | (num >>> 2) +} + +function ft (s, b, c, d) { + if (s === 0) return (b & c) | ((~b) & d) + if (s === 2) return (b & c) | (b & d) | (c & d) + return b ^ c ^ d +} + +Sha1.prototype._update = function (M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]) + + for (var j = 0; j < 80; ++j) { + var s = ~~(j / 20) + var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 + + e = d + d = c + c = rotl30(b) + b = a + a = t + } + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} + +Sha1.prototype._hash = function () { + var H = Buffer.allocUnsafe(20) + + H.writeInt32BE(this._a | 0, 0) + H.writeInt32BE(this._b | 0, 4) + H.writeInt32BE(this._c | 0, 8) + H.writeInt32BE(this._d | 0, 12) + H.writeInt32BE(this._e | 0, 16) + + return H +} + +module.exports = Sha1 + + +/***/ }), + +/***/ 8432: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ + +var inherits = __webpack_require__(5717) +var Sha256 = __webpack_require__(7499) +var Hash = __webpack_require__(4189) +var Buffer = (__webpack_require__(9509).Buffer) + +var W = new Array(64) + +function Sha224 () { + this.init() + + this._w = W // new Array(64) + + Hash.call(this, 64, 56) +} + +inherits(Sha224, Sha256) + +Sha224.prototype.init = function () { + this._a = 0xc1059ed8 + this._b = 0x367cd507 + this._c = 0x3070dd17 + this._d = 0xf70e5939 + this._e = 0xffc00b31 + this._f = 0x68581511 + this._g = 0x64f98fa7 + this._h = 0xbefa4fa4 + + return this +} + +Sha224.prototype._hash = function () { + var H = Buffer.allocUnsafe(28) + + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) + + return H +} + +module.exports = Sha224 + + +/***/ }), + +/***/ 7499: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ + +var inherits = __webpack_require__(5717) +var Hash = __webpack_require__(4189) +var Buffer = (__webpack_require__(9509).Buffer) + +var K = [ + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +] + +var W = new Array(64) + +function Sha256 () { + this.init() + + this._w = W // new Array(64) + + Hash.call(this, 64, 56) +} + +inherits(Sha256, Hash) + +Sha256.prototype.init = function () { + this._a = 0x6a09e667 + this._b = 0xbb67ae85 + this._c = 0x3c6ef372 + this._d = 0xa54ff53a + this._e = 0x510e527f + this._f = 0x9b05688c + this._g = 0x1f83d9ab + this._h = 0x5be0cd19 + + return this +} + +function ch (x, y, z) { + return z ^ (x & (y ^ z)) +} + +function maj (x, y, z) { + return (x & y) | (z & (x | y)) +} + +function sigma0 (x) { + return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10) +} + +function sigma1 (x) { + return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7) +} + +function gamma0 (x) { + return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3) +} + +function gamma1 (x) { + return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10) +} + +Sha256.prototype._update = function (M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + var f = this._f | 0 + var g = this._g | 0 + var h = this._h | 0 + + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0 + + for (var j = 0; j < 64; ++j) { + var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0 + var T2 = (sigma0(a) + maj(a, b, c)) | 0 + + h = g + g = f + f = e + e = (d + T1) | 0 + d = c + c = b + b = a + a = (T1 + T2) | 0 + } + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 + this._f = (f + this._f) | 0 + this._g = (g + this._g) | 0 + this._h = (h + this._h) | 0 +} + +Sha256.prototype._hash = function () { + var H = Buffer.allocUnsafe(32) + + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) + H.writeInt32BE(this._h, 28) + + return H +} + +module.exports = Sha256 + + +/***/ }), + +/***/ 1686: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var inherits = __webpack_require__(5717) +var SHA512 = __webpack_require__(7816) +var Hash = __webpack_require__(4189) +var Buffer = (__webpack_require__(9509).Buffer) + +var W = new Array(160) + +function Sha384 () { + this.init() + this._w = W + + Hash.call(this, 128, 112) +} + +inherits(Sha384, SHA512) + +Sha384.prototype.init = function () { + this._ah = 0xcbbb9d5d + this._bh = 0x629a292a + this._ch = 0x9159015a + this._dh = 0x152fecd8 + this._eh = 0x67332667 + this._fh = 0x8eb44a87 + this._gh = 0xdb0c2e0d + this._hh = 0x47b5481d + + this._al = 0xc1059ed8 + this._bl = 0x367cd507 + this._cl = 0x3070dd17 + this._dl = 0xf70e5939 + this._el = 0xffc00b31 + this._fl = 0x68581511 + this._gl = 0x64f98fa7 + this._hl = 0xbefa4fa4 + + return this +} + +Sha384.prototype._hash = function () { + var H = Buffer.allocUnsafe(48) + + function writeInt64BE (h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) + } + + writeInt64BE(this._ah, this._al, 0) + writeInt64BE(this._bh, this._bl, 8) + writeInt64BE(this._ch, this._cl, 16) + writeInt64BE(this._dh, this._dl, 24) + writeInt64BE(this._eh, this._el, 32) + writeInt64BE(this._fh, this._fl, 40) + + return H +} + +module.exports = Sha384 + + +/***/ }), + +/***/ 7816: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var inherits = __webpack_require__(5717) +var Hash = __webpack_require__(4189) +var Buffer = (__webpack_require__(9509).Buffer) + +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +] + +var W = new Array(160) + +function Sha512 () { + this.init() + this._w = W + + Hash.call(this, 128, 112) +} + +inherits(Sha512, Hash) + +Sha512.prototype.init = function () { + this._ah = 0x6a09e667 + this._bh = 0xbb67ae85 + this._ch = 0x3c6ef372 + this._dh = 0xa54ff53a + this._eh = 0x510e527f + this._fh = 0x9b05688c + this._gh = 0x1f83d9ab + this._hh = 0x5be0cd19 + + this._al = 0xf3bcc908 + this._bl = 0x84caa73b + this._cl = 0xfe94f82b + this._dl = 0x5f1d36f1 + this._el = 0xade682d1 + this._fl = 0x2b3e6c1f + this._gl = 0xfb41bd6b + this._hl = 0x137e2179 + + return this +} + +function Ch (x, y, z) { + return z ^ (x & (y ^ z)) +} + +function maj (x, y, z) { + return (x & y) | (z & (x | y)) +} + +function sigma0 (x, xl) { + return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25) +} + +function sigma1 (x, xl) { + return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23) +} + +function Gamma0 (x, xl) { + return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7) +} + +function Gamma0l (x, xl) { + return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25) +} + +function Gamma1 (x, xl) { + return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6) +} + +function Gamma1l (x, xl) { + return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26) +} + +function getCarry (a, b) { + return (a >>> 0) < (b >>> 0) ? 1 : 0 +} + +Sha512.prototype._update = function (M) { + var W = this._w + + var ah = this._ah | 0 + var bh = this._bh | 0 + var ch = this._ch | 0 + var dh = this._dh | 0 + var eh = this._eh | 0 + var fh = this._fh | 0 + var gh = this._gh | 0 + var hh = this._hh | 0 + + var al = this._al | 0 + var bl = this._bl | 0 + var cl = this._cl | 0 + var dl = this._dl | 0 + var el = this._el | 0 + var fl = this._fl | 0 + var gl = this._gl | 0 + var hl = this._hl | 0 + + for (var i = 0; i < 32; i += 2) { + W[i] = M.readInt32BE(i * 4) + W[i + 1] = M.readInt32BE(i * 4 + 4) + } + for (; i < 160; i += 2) { + var xh = W[i - 15 * 2] + var xl = W[i - 15 * 2 + 1] + var gamma0 = Gamma0(xh, xl) + var gamma0l = Gamma0l(xl, xh) + + xh = W[i - 2 * 2] + xl = W[i - 2 * 2 + 1] + var gamma1 = Gamma1(xh, xl) + var gamma1l = Gamma1l(xl, xh) + + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7h = W[i - 7 * 2] + var Wi7l = W[i - 7 * 2 + 1] + + var Wi16h = W[i - 16 * 2] + var Wi16l = W[i - 16 * 2 + 1] + + var Wil = (gamma0l + Wi7l) | 0 + var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0 + Wil = (Wil + gamma1l) | 0 + Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0 + Wil = (Wil + Wi16l) | 0 + Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0 + + W[i] = Wih + W[i + 1] = Wil + } + + for (var j = 0; j < 160; j += 2) { + Wih = W[j] + Wil = W[j + 1] + + var majh = maj(ah, bh, ch) + var majl = maj(al, bl, cl) + + var sigma0h = sigma0(ah, al) + var sigma0l = sigma0(al, ah) + var sigma1h = sigma1(eh, el) + var sigma1l = sigma1(el, eh) + + // t1 = h + sigma1 + ch + K[j] + W[j] + var Kih = K[j] + var Kil = K[j + 1] + + var chh = Ch(eh, fh, gh) + var chl = Ch(el, fl, gl) + + var t1l = (hl + sigma1l) | 0 + var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0 + t1l = (t1l + chl) | 0 + t1h = (t1h + chh + getCarry(t1l, chl)) | 0 + t1l = (t1l + Kil) | 0 + t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0 + t1l = (t1l + Wil) | 0 + t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0 + + // t2 = sigma0 + maj + var t2l = (sigma0l + majl) | 0 + var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0 + + hh = gh + hl = gl + gh = fh + gl = fl + fh = eh + fl = el + el = (dl + t1l) | 0 + eh = (dh + t1h + getCarry(el, dl)) | 0 + dh = ch + dl = cl + ch = bh + cl = bl + bh = ah + bl = al + al = (t1l + t2l) | 0 + ah = (t1h + t2h + getCarry(al, t1l)) | 0 + } + + this._al = (this._al + al) | 0 + this._bl = (this._bl + bl) | 0 + this._cl = (this._cl + cl) | 0 + this._dl = (this._dl + dl) | 0 + this._el = (this._el + el) | 0 + this._fl = (this._fl + fl) | 0 + this._gl = (this._gl + gl) | 0 + this._hl = (this._hl + hl) | 0 + + this._ah = (this._ah + ah + getCarry(this._al, al)) | 0 + this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0 + this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0 + this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0 + this._eh = (this._eh + eh + getCarry(this._el, el)) | 0 + this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0 + this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0 + this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0 +} + +Sha512.prototype._hash = function () { + var H = Buffer.allocUnsafe(64) + + function writeInt64BE (h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) + } + + writeInt64BE(this._ah, this._al, 0) + writeInt64BE(this._bh, this._bl, 8) + writeInt64BE(this._ch, this._cl, 16) + writeInt64BE(this._dh, this._dl, 24) + writeInt64BE(this._eh, this._el, 32) + writeInt64BE(this._fh, this._fl, 40) + writeInt64BE(this._gh, this._gl, 48) + writeInt64BE(this._hh, this._hl, 56) + + return H +} + +module.exports = Sha512 + + +/***/ }), + +/***/ 8322: +/***/ (function(module) { + +(function (factory) { + if (true) { + // Node/CommonJS + module.exports = factory(); + } else { var glob; } +}(function (undefined) { + + 'use strict'; + + /* + * Fastest md5 implementation around (JKM md5). + * Credits: Joseph Myers + * + * @see http://www.myersdaily.org/joseph/javascript/md5-text.html + * @see http://jsperf.com/md5-shootout/7 + */ + + /* this function is much faster, + so if possible we use it. Some IEs + are the only ones I know of that + need the idiotic second function, + generated by an if clause. */ + var add32 = function (a, b) { + return (a + b) & 0xFFFFFFFF; + }, + hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; + + + function cmn(q, a, b, x, s, t) { + a = add32(add32(a, q), add32(x, t)); + return add32((a << s) | (a >>> (32 - s)), b); + } + + function md5cycle(x, k) { + var a = x[0], + b = x[1], + c = x[2], + d = x[3]; + + a += (b & c | ~b & d) + k[0] - 680876936 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[1] - 389564586 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[2] + 606105819 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[3] - 1044525330 | 0; + b = (b << 22 | b >>> 10) + c | 0; + a += (b & c | ~b & d) + k[4] - 176418897 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[5] + 1200080426 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[6] - 1473231341 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[7] - 45705983 | 0; + b = (b << 22 | b >>> 10) + c | 0; + a += (b & c | ~b & d) + k[8] + 1770035416 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[9] - 1958414417 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[10] - 42063 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[11] - 1990404162 | 0; + b = (b << 22 | b >>> 10) + c | 0; + a += (b & c | ~b & d) + k[12] + 1804603682 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[13] - 40341101 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[14] - 1502002290 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[15] + 1236535329 | 0; + b = (b << 22 | b >>> 10) + c | 0; + + a += (b & d | c & ~d) + k[1] - 165796510 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[6] - 1069501632 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[11] + 643717713 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[0] - 373897302 | 0; + b = (b << 20 | b >>> 12) + c | 0; + a += (b & d | c & ~d) + k[5] - 701558691 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[10] + 38016083 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[15] - 660478335 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[4] - 405537848 | 0; + b = (b << 20 | b >>> 12) + c | 0; + a += (b & d | c & ~d) + k[9] + 568446438 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[14] - 1019803690 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[3] - 187363961 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[8] + 1163531501 | 0; + b = (b << 20 | b >>> 12) + c | 0; + a += (b & d | c & ~d) + k[13] - 1444681467 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[2] - 51403784 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[7] + 1735328473 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[12] - 1926607734 | 0; + b = (b << 20 | b >>> 12) + c | 0; + + a += (b ^ c ^ d) + k[5] - 378558 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[8] - 2022574463 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[11] + 1839030562 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[14] - 35309556 | 0; + b = (b << 23 | b >>> 9) + c | 0; + a += (b ^ c ^ d) + k[1] - 1530992060 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[4] + 1272893353 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[7] - 155497632 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[10] - 1094730640 | 0; + b = (b << 23 | b >>> 9) + c | 0; + a += (b ^ c ^ d) + k[13] + 681279174 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[0] - 358537222 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[3] - 722521979 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[6] + 76029189 | 0; + b = (b << 23 | b >>> 9) + c | 0; + a += (b ^ c ^ d) + k[9] - 640364487 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[12] - 421815835 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[15] + 530742520 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[2] - 995338651 | 0; + b = (b << 23 | b >>> 9) + c | 0; + + a += (c ^ (b | ~d)) + k[0] - 198630844 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[5] - 57434055 | 0; + b = (b << 21 |b >>> 11) + c | 0; + a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[10] - 1051523 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0; + b = (b << 21 |b >>> 11) + c | 0; + a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[15] - 30611744 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0; + b = (b << 21 |b >>> 11) + c | 0; + a += (c ^ (b | ~d)) + k[4] - 145523070 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[2] + 718787259 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[9] - 343485551 | 0; + b = (b << 21 | b >>> 11) + c | 0; + + x[0] = a + x[0] | 0; + x[1] = b + x[1] | 0; + x[2] = c + x[2] | 0; + x[3] = d + x[3] | 0; + } + + function md5blk(s) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + } + + function md5blk_array(a) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + } + + function md51(s) { + var n = s.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); + } + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + return state; + } + + function md51_array(a) { + var n = a.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + + // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 + // containing the last element of the parent array if the sub array specified starts + // beyond the length of the parent array - weird. + // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue + a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); + + length = a.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << ((i % 4) << 3); + } + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + + return state; + } + + function rhex(n) { + var s = '', + j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; + } + return s; + } + + function hex(x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(''); + } + + // In some cases the fast add32 function cannot be used.. + if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') { + add32 = function (x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF), + msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + }; + } + + // --------------------------------------------------- + + /** + * ArrayBuffer slice polyfill. + * + * @see https://github.com/ttaubert/node-arraybuffer-slice + */ + + if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) { + (function () { + function clamp(val, length) { + val = (val | 0) || 0; + + if (val < 0) { + return Math.max(val + length, 0); + } + + return Math.min(val, length); + } + + ArrayBuffer.prototype.slice = function (from, to) { + var length = this.byteLength, + begin = clamp(from, length), + end = length, + num, + target, + targetArray, + sourceArray; + + if (to !== undefined) { + end = clamp(to, length); + } + + if (begin > end) { + return new ArrayBuffer(0); + } + + num = end - begin; + target = new ArrayBuffer(num); + targetArray = new Uint8Array(target); + + sourceArray = new Uint8Array(this, begin, num); + targetArray.set(sourceArray); + + return target; + }; + })(); + } + + // --------------------------------------------------- + + /** + * Helpers. + */ + + function toUtf8(str) { + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + return str; + } + + function utf8Str2ArrayBuffer(str, returnUInt8Array) { + var length = str.length, + buff = new ArrayBuffer(length), + arr = new Uint8Array(buff), + i; + + for (i = 0; i < length; i += 1) { + arr[i] = str.charCodeAt(i); + } + + return returnUInt8Array ? arr : buff; + } + + function arrayBuffer2Utf8Str(buff) { + return String.fromCharCode.apply(null, new Uint8Array(buff)); + } + + function concatenateArrayBuffers(first, second, returnUInt8Array) { + var result = new Uint8Array(first.byteLength + second.byteLength); + + result.set(new Uint8Array(first)); + result.set(new Uint8Array(second), first.byteLength); + + return returnUInt8Array ? result : result.buffer; + } + + function hexToBinaryString(hex) { + var bytes = [], + length = hex.length, + x; + + for (x = 0; x < length - 1; x += 2) { + bytes.push(parseInt(hex.substr(x, 2), 16)); + } + + return String.fromCharCode.apply(String, bytes); + } + + // --------------------------------------------------- + + /** + * SparkMD5 OOP implementation. + * + * Use this class to perform an incremental md5, otherwise use the + * static methods instead. + */ + + function SparkMD5() { + // call reset to init the instance + this.reset(); + } + + /** + * Appends a string. + * A conversion will be applied if an utf8 string is detected. + * + * @param {String} str The string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.append = function (str) { + // Converts the string to utf8 bytes if necessary + // Then append as binary + this.appendBinary(toUtf8(str)); + + return this; + }; + + /** + * Appends a binary string. + * + * @param {String} contents The binary string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.appendBinary = function (contents) { + this._buff += contents; + this._length += contents.length; + + var length = this._buff.length, + i; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i))); + } + + this._buff = this._buff.substring(i - 64); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * + * @param {Boolean} raw True to get the raw string, false to get the hex string + * + * @return {String} The result + */ + SparkMD5.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + i, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = hex(this._hash); + + if (raw) { + ret = hexToBinaryString(ret); + } + + this.reset(); + + return ret; + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.reset = function () { + this._buff = ''; + this._length = 0; + this._hash = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Gets the internal state of the computation. + * + * @return {Object} The state + */ + SparkMD5.prototype.getState = function () { + return { + buff: this._buff, + length: this._length, + hash: this._hash.slice() + }; + }; + + /** + * Gets the internal state of the computation. + * + * @param {Object} state The state + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.setState = function (state) { + this._buff = state.buff; + this._length = state.length; + this._hash = state.hash; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other additional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.prototype.destroy = function () { + delete this._hash; + delete this._buff; + delete this._length; + }; + + /** + * Finish the final calculation based on the tail. + * + * @param {Array} tail The tail (will be modified) + * @param {Number} length The length of the remaining buffer + */ + SparkMD5.prototype._finish = function (tail, length) { + var i = length, + tmp, + lo, + hi; + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(this._hash, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + md5cycle(this._hash, tail); + }; + + /** + * Performs the md5 hash on a string. + * A conversion will be applied if utf8 string is detected. + * + * @param {String} str The string + * @param {Boolean} [raw] True to get the raw string, false to get the hex string + * + * @return {String} The result + */ + SparkMD5.hash = function (str, raw) { + // Converts the string to utf8 bytes if necessary + // Then compute it using the binary function + return SparkMD5.hashBinary(toUtf8(str), raw); + }; + + /** + * Performs the md5 hash on a binary string. + * + * @param {String} content The binary string + * @param {Boolean} [raw] True to get the raw string, false to get the hex string + * + * @return {String} The result + */ + SparkMD5.hashBinary = function (content, raw) { + var hash = md51(content), + ret = hex(hash); + + return raw ? hexToBinaryString(ret) : ret; + }; + + // --------------------------------------------------- + + /** + * SparkMD5 OOP implementation for array buffers. + * + * Use this class to perform an incremental md5 ONLY for array buffers. + */ + SparkMD5.ArrayBuffer = function () { + // call reset to init the instance + this.reset(); + }; + + /** + * Appends an array buffer. + * + * @param {ArrayBuffer} arr The array to be appended + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.append = function (arr) { + var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), + length = buff.length, + i; + + this._length += arr.byteLength; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i))); + } + + this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * + * @param {Boolean} raw True to get the raw string, false to get the hex string + * + * @return {String} The result + */ + SparkMD5.ArrayBuffer.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + i, + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = hex(this._hash); + + if (raw) { + ret = hexToBinaryString(ret); + } + + this.reset(); + + return ret; + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.reset = function () { + this._buff = new Uint8Array(0); + this._length = 0; + this._hash = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Gets the internal state of the computation. + * + * @return {Object} The state + */ + SparkMD5.ArrayBuffer.prototype.getState = function () { + var state = SparkMD5.prototype.getState.call(this); + + // Convert buffer to a string + state.buff = arrayBuffer2Utf8Str(state.buff); + + return state; + }; + + /** + * Gets the internal state of the computation. + * + * @param {Object} state The state + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.setState = function (state) { + // Convert string to buffer + state.buff = utf8Str2ArrayBuffer(state.buff, true); + + return SparkMD5.prototype.setState.call(this, state); + }; + + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + + /** + * Performs the md5 hash on an array buffer. + * + * @param {ArrayBuffer} arr The array buffer + * @param {Boolean} [raw] True to get the raw string, false to get the hex one + * + * @return {String} The result + */ + SparkMD5.ArrayBuffer.hash = function (arr, raw) { + var hash = md51_array(new Uint8Array(arr)), + ret = hex(hash); + + return raw ? hexToBinaryString(ret) : ret; + }; + + return SparkMD5; +})); + + +/***/ }), + +/***/ 2830: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Stream; + +var EE = (__webpack_require__(7187).EventEmitter); +var inherits = __webpack_require__(5717); + +inherits(Stream, EE); +Stream.Readable = __webpack_require__(6577); +Stream.Writable = __webpack_require__(323); +Stream.Duplex = __webpack_require__(8656); +Stream.Transform = __webpack_require__(4473); +Stream.PassThrough = __webpack_require__(2366); +Stream.finished = __webpack_require__(1086) +Stream.pipeline = __webpack_require__(6472) + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + + +/***/ }), + +/***/ 8106: +/***/ (function(module) { + +"use strict"; + + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.q = codes; + + +/***/ }), + +/***/ 8656: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = __webpack_require__(6577); +var Writable = __webpack_require__(323); +__webpack_require__(5717)(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +/***/ }), + +/***/ 2366: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; +var Transform = __webpack_require__(4473); +__webpack_require__(5717)(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ 6577: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +module.exports = Readable; + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = (__webpack_require__(7187).EventEmitter); +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(3194); +/**/ + +var Buffer = (__webpack_require__(8764).Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ +var debugUtil = __webpack_require__(964); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = __webpack_require__(9686); +var destroyImpl = __webpack_require__(1029); +var _require = __webpack_require__(94), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(8106)/* .codes */ .q), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +__webpack_require__(5717)(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(8656); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = (__webpack_require__(2553)/* .StringDecoder */ .s); + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || __webpack_require__(8656); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = (__webpack_require__(2553)/* .StringDecoder */ .s); + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = __webpack_require__(828); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = __webpack_require__(1265); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +/***/ }), + +/***/ 4473: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; +var _require$codes = (__webpack_require__(8106)/* .codes */ .q), + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = __webpack_require__(8656); +__webpack_require__(5717)(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} + +/***/ }), + +/***/ 323: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: __webpack_require__(4927) +}; +/**/ + +/**/ +var Stream = __webpack_require__(3194); +/**/ + +var Buffer = (__webpack_require__(8764).Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = __webpack_require__(1029); +var _require = __webpack_require__(94), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(8106)/* .codes */ .q), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +__webpack_require__(5717)(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(8656); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || __webpack_require__(8656); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; + +/***/ }), + +/***/ 828: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); + + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = __webpack_require__(1086); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; + +/***/ }), + +/***/ 9686: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = __webpack_require__(8764), + Buffer = _require.Buffer; +var _require2 = __webpack_require__(9862), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}(); + +/***/ }), + +/***/ 1029: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* provided dependency */ var process = __webpack_require__(4155); + + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; + +/***/ }), + +/***/ 1086: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + + + +var ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(8106)/* .codes.ERR_STREAM_PREMATURE_CLOSE */ .q.ERR_STREAM_PREMATURE_CLOSE); +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; + +/***/ }), + +/***/ 1265: +/***/ (function(module) { + +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; + + +/***/ }), + +/***/ 6472: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + + + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = (__webpack_require__(8106)/* .codes */ .q), + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = __webpack_require__(1086); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; + +/***/ }), + +/***/ 94: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var ERR_INVALID_OPT_VALUE = (__webpack_require__(8106)/* .codes.ERR_INVALID_OPT_VALUE */ .q.ERR_INVALID_OPT_VALUE); +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; + +/***/ }), + +/***/ 3194: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = __webpack_require__(7187).EventEmitter; + + +/***/ }), + +/***/ 2553: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var Buffer = (__webpack_require__(396).Buffer); +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.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 true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + 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 enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.s = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), + +/***/ 396: +/***/ (function(module, exports, __webpack_require__) { + +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(8764) +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ 8731: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// This is free and unencumbered software released into the public domain. +// See LICENSE.md for more information. + +var encoding = __webpack_require__(4498); + +module.exports = { + TextEncoder: encoding.TextEncoder, + TextDecoder: encoding.TextDecoder, +}; + + +/***/ }), + +/***/ 2162: +/***/ (function(module) { + +(function(global) { + 'use strict'; + + if ( true && module.exports) { + module.exports = global; + } + + global["encoding-indexes"] = +{ + "big5":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,17392,19506,17923,17830,17784,160359,19831,17843,162993,19682,163013,15253,18230,18244,19527,19520,148159,144919,160594,159371,159954,19543,172881,18255,17882,19589,162924,19719,19108,18081,158499,29221,154196,137827,146950,147297,26189,22267,null,32149,22813,166841,15860,38708,162799,23515,138590,23204,13861,171696,23249,23479,23804,26478,34195,170309,29793,29853,14453,138579,145054,155681,16108,153822,15093,31484,40855,147809,166157,143850,133770,143966,17162,33924,40854,37935,18736,34323,22678,38730,37400,31184,31282,26208,27177,34973,29772,31685,26498,31276,21071,36934,13542,29636,155065,29894,40903,22451,18735,21580,16689,145038,22552,31346,162661,35727,18094,159368,16769,155033,31662,140476,40904,140481,140489,140492,40905,34052,144827,16564,40906,17633,175615,25281,28782,40907,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,12736,12737,12738,12739,12740,131340,12741,131281,131277,12742,12743,131275,139240,12744,131274,12745,12746,12747,12748,131342,12749,12750,256,193,461,192,274,201,282,200,332,211,465,210,null,7870,null,7872,202,257,225,462,224,593,275,233,283,232,299,237,464,236,333,243,466,242,363,250,468,249,470,472,474,476,252,null,7871,null,7873,234,609,9178,9179,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,172969,135493,null,25866,null,null,20029,28381,40270,37343,null,null,161589,25745,20250,20264,20392,20822,20852,20892,20964,21153,21160,21307,21326,21457,21464,22242,22768,22788,22791,22834,22836,23398,23454,23455,23706,24198,24635,25993,26622,26628,26725,27982,28860,30005,32420,32428,32442,32455,32463,32479,32518,32567,33402,33487,33647,35270,35774,35810,36710,36711,36718,29713,31996,32205,26950,31433,21031,null,null,null,null,37260,30904,37214,32956,null,36107,33014,133607,null,null,32927,40647,19661,40393,40460,19518,171510,159758,40458,172339,13761,null,28314,33342,29977,null,18705,39532,39567,40857,31111,164972,138698,132560,142054,20004,20097,20096,20103,20159,20203,20279,13388,20413,15944,20483,20616,13437,13459,13477,20870,22789,20955,20988,20997,20105,21113,21136,21287,13767,21417,13649,21424,13651,21442,21539,13677,13682,13953,21651,21667,21684,21689,21712,21743,21784,21795,21800,13720,21823,13733,13759,21975,13765,163204,21797,null,134210,134421,151851,21904,142534,14828,131905,36422,150968,169189,16467,164030,30586,142392,14900,18389,164189,158194,151018,25821,134524,135092,134357,135412,25741,36478,134806,134155,135012,142505,164438,148691,null,134470,170573,164073,18420,151207,142530,39602,14951,169460,16365,13574,152263,169940,161992,142660,40302,38933,null,17369,155813,25780,21731,142668,142282,135287,14843,135279,157402,157462,162208,25834,151634,134211,36456,139681,166732,132913,null,18443,131497,16378,22643,142733,null,148936,132348,155799,134988,134550,21881,16571,17338,null,19124,141926,135325,33194,39157,134556,25465,14846,141173,36288,22177,25724,15939,null,173569,134665,142031,142537,null,135368,145858,14738,14854,164507,13688,155209,139463,22098,134961,142514,169760,13500,27709,151099,null,null,161140,142987,139784,173659,167117,134778,134196,157724,32659,135375,141315,141625,13819,152035,134796,135053,134826,16275,134960,134471,135503,134732,null,134827,134057,134472,135360,135485,16377,140950,25650,135085,144372,161337,142286,134526,134527,142417,142421,14872,134808,135367,134958,173618,158544,167122,167321,167114,38314,21708,33476,21945,null,171715,39974,39606,161630,142830,28992,33133,33004,23580,157042,33076,14231,21343,164029,37302,134906,134671,134775,134907,13789,151019,13833,134358,22191,141237,135369,134672,134776,135288,135496,164359,136277,134777,151120,142756,23124,135197,135198,135413,135414,22428,134673,161428,164557,135093,134779,151934,14083,135094,135552,152280,172733,149978,137274,147831,164476,22681,21096,13850,153405,31666,23400,18432,19244,40743,18919,39967,39821,154484,143677,22011,13810,22153,20008,22786,138177,194680,38737,131206,20059,20155,13630,23587,24401,24516,14586,25164,25909,27514,27701,27706,28780,29227,20012,29357,149737,32594,31035,31993,32595,156266,13505,null,156491,32770,32896,157202,158033,21341,34916,35265,161970,35744,36125,38021,38264,38271,38376,167439,38886,39029,39118,39134,39267,170000,40060,40479,40644,27503,63751,20023,131207,38429,25143,38050,null,20539,28158,171123,40870,15817,34959,147790,28791,23797,19232,152013,13657,154928,24866,166450,36775,37366,29073,26393,29626,144001,172295,15499,137600,19216,30948,29698,20910,165647,16393,27235,172730,16931,34319,133743,31274,170311,166634,38741,28749,21284,139390,37876,30425,166371,40871,30685,20131,20464,20668,20015,20247,40872,21556,32139,22674,22736,138678,24210,24217,24514,141074,25995,144377,26905,27203,146531,27903,null,29184,148741,29580,16091,150035,23317,29881,35715,154788,153237,31379,31724,31939,32364,33528,34199,40873,34960,40874,36537,40875,36815,34143,39392,37409,40876,167353,136255,16497,17058,23066,null,null,null,39016,26475,17014,22333,null,34262,149883,33471,160013,19585,159092,23931,158485,159678,40877,40878,23446,40879,26343,32347,28247,31178,15752,17603,143958,141206,17306,17718,null,23765,146202,35577,23672,15634,144721,23928,40882,29015,17752,147692,138787,19575,14712,13386,131492,158785,35532,20404,131641,22975,33132,38998,170234,24379,134047,null,139713,166253,16642,18107,168057,16135,40883,172469,16632,14294,18167,158790,16764,165554,160767,17773,14548,152730,17761,17691,19849,19579,19830,17898,16328,150287,13921,17630,17597,16877,23870,23880,23894,15868,14351,23972,23993,14368,14392,24130,24253,24357,24451,14600,14612,14655,14669,24791,24893,23781,14729,25015,25017,25039,14776,25132,25232,25317,25368,14840,22193,14851,25570,25595,25607,25690,14923,25792,23829,22049,40863,14999,25990,15037,26111,26195,15090,26258,15138,26390,15170,26532,26624,15192,26698,26756,15218,15217,15227,26889,26947,29276,26980,27039,27013,15292,27094,15325,27237,27252,27249,27266,15340,27289,15346,27307,27317,27348,27382,27521,27585,27626,27765,27818,15563,27906,27910,27942,28033,15599,28068,28081,28181,28184,28201,28294,166336,28347,28386,28378,40831,28392,28393,28452,28468,15686,147265,28545,28606,15722,15733,29111,23705,15754,28716,15761,28752,28756,28783,28799,28809,131877,17345,13809,134872,147159,22462,159443,28990,153568,13902,27042,166889,23412,31305,153825,169177,31333,31357,154028,31419,31408,31426,31427,29137,156813,16842,31450,31453,31466,16879,21682,154625,31499,31573,31529,152334,154878,31650,31599,33692,154548,158847,31696,33825,31634,31672,154912,15789,154725,33938,31738,31750,31797,154817,31812,31875,149634,31910,26237,148856,31945,31943,31974,31860,31987,31989,31950,32359,17693,159300,32093,159446,29837,32137,32171,28981,32179,32210,147543,155689,32228,15635,32245,137209,32229,164717,32285,155937,155994,32366,32402,17195,37996,32295,32576,32577,32583,31030,156368,39393,32663,156497,32675,136801,131176,17756,145254,17667,164666,32762,156809,32773,32776,32797,32808,32815,172167,158915,32827,32828,32865,141076,18825,157222,146915,157416,26405,32935,166472,33031,33050,22704,141046,27775,156824,151480,25831,136330,33304,137310,27219,150117,150165,17530,33321,133901,158290,146814,20473,136445,34018,33634,158474,149927,144688,137075,146936,33450,26907,194964,16859,34123,33488,33562,134678,137140,14017,143741,144730,33403,33506,33560,147083,159139,158469,158615,144846,15807,33565,21996,33669,17675,159141,33708,33729,33747,13438,159444,27223,34138,13462,159298,143087,33880,154596,33905,15827,17636,27303,33866,146613,31064,33960,158614,159351,159299,34014,33807,33681,17568,33939,34020,154769,16960,154816,17731,34100,23282,159385,17703,34163,17686,26559,34326,165413,165435,34241,159880,34306,136578,159949,194994,17770,34344,13896,137378,21495,160666,34430,34673,172280,34798,142375,34737,34778,34831,22113,34412,26710,17935,34885,34886,161248,146873,161252,34910,34972,18011,34996,34997,25537,35013,30583,161551,35207,35210,35238,35241,35239,35260,166437,35303,162084,162493,35484,30611,37374,35472,162393,31465,162618,147343,18195,162616,29052,35596,35615,152624,152933,35647,35660,35661,35497,150138,35728,35739,35503,136927,17941,34895,35995,163156,163215,195028,14117,163155,36054,163224,163261,36114,36099,137488,36059,28764,36113,150729,16080,36215,36265,163842,135188,149898,15228,164284,160012,31463,36525,36534,36547,37588,36633,36653,164709,164882,36773,37635,172703,133712,36787,18730,166366,165181,146875,24312,143970,36857,172052,165564,165121,140069,14720,159447,36919,165180,162494,36961,165228,165387,37032,165651,37060,165606,37038,37117,37223,15088,37289,37316,31916,166195,138889,37390,27807,37441,37474,153017,37561,166598,146587,166668,153051,134449,37676,37739,166625,166891,28815,23235,166626,166629,18789,37444,166892,166969,166911,37747,37979,36540,38277,38310,37926,38304,28662,17081,140922,165592,135804,146990,18911,27676,38523,38550,16748,38563,159445,25050,38582,30965,166624,38589,21452,18849,158904,131700,156688,168111,168165,150225,137493,144138,38705,34370,38710,18959,17725,17797,150249,28789,23361,38683,38748,168405,38743,23370,168427,38751,37925,20688,143543,143548,38793,38815,38833,38846,38848,38866,38880,152684,38894,29724,169011,38911,38901,168989,162170,19153,38964,38963,38987,39014,15118,160117,15697,132656,147804,153350,39114,39095,39112,39111,19199,159015,136915,21936,39137,39142,39148,37752,39225,150057,19314,170071,170245,39413,39436,39483,39440,39512,153381,14020,168113,170965,39648,39650,170757,39668,19470,39700,39725,165376,20532,39732,158120,14531,143485,39760,39744,171326,23109,137315,39822,148043,39938,39935,39948,171624,40404,171959,172434,172459,172257,172323,172511,40318,40323,172340,40462,26760,40388,139611,172435,172576,137531,172595,40249,172217,172724,40592,40597,40606,40610,19764,40618,40623,148324,40641,15200,14821,15645,20274,14270,166955,40706,40712,19350,37924,159138,40727,40726,40761,22175,22154,40773,39352,168075,38898,33919,40802,40809,31452,40846,29206,19390,149877,149947,29047,150008,148296,150097,29598,166874,137466,31135,166270,167478,37737,37875,166468,37612,37761,37835,166252,148665,29207,16107,30578,31299,28880,148595,148472,29054,137199,28835,137406,144793,16071,137349,152623,137208,14114,136955,137273,14049,137076,137425,155467,14115,136896,22363,150053,136190,135848,136134,136374,34051,145062,34051,33877,149908,160101,146993,152924,147195,159826,17652,145134,170397,159526,26617,14131,15381,15847,22636,137506,26640,16471,145215,147681,147595,147727,158753,21707,22174,157361,22162,135135,134056,134669,37830,166675,37788,20216,20779,14361,148534,20156,132197,131967,20299,20362,153169,23144,131499,132043,14745,131850,132116,13365,20265,131776,167603,131701,35546,131596,20120,20685,20749,20386,20227,150030,147082,20290,20526,20588,20609,20428,20453,20568,20732,20825,20827,20829,20830,28278,144789,147001,147135,28018,137348,147081,20904,20931,132576,17629,132259,132242,132241,36218,166556,132878,21081,21156,133235,21217,37742,18042,29068,148364,134176,149932,135396,27089,134685,29817,16094,29849,29716,29782,29592,19342,150204,147597,21456,13700,29199,147657,21940,131909,21709,134086,22301,37469,38644,37734,22493,22413,22399,13886,22731,23193,166470,136954,137071,136976,23084,22968,37519,23166,23247,23058,153926,137715,137313,148117,14069,27909,29763,23073,155267,23169,166871,132115,37856,29836,135939,28933,18802,37896,166395,37821,14240,23582,23710,24158,24136,137622,137596,146158,24269,23375,137475,137476,14081,137376,14045,136958,14035,33066,166471,138682,144498,166312,24332,24334,137511,137131,23147,137019,23364,34324,161277,34912,24702,141408,140843,24539,16056,140719,140734,168072,159603,25024,131134,131142,140827,24985,24984,24693,142491,142599,149204,168269,25713,149093,142186,14889,142114,144464,170218,142968,25399,173147,25782,25393,25553,149987,142695,25252,142497,25659,25963,26994,15348,143502,144045,149897,144043,21773,144096,137433,169023,26318,144009,143795,15072,16784,152964,166690,152975,136956,152923,152613,30958,143619,137258,143924,13412,143887,143746,148169,26254,159012,26219,19347,26160,161904,138731,26211,144082,144097,26142,153714,14545,145466,145340,15257,145314,144382,29904,15254,26511,149034,26806,26654,15300,27326,14435,145365,148615,27187,27218,27337,27397,137490,25873,26776,27212,15319,27258,27479,147392,146586,37792,37618,166890,166603,37513,163870,166364,37991,28069,28427,149996,28007,147327,15759,28164,147516,23101,28170,22599,27940,30786,28987,148250,148086,28913,29264,29319,29332,149391,149285,20857,150180,132587,29818,147192,144991,150090,149783,155617,16134,16049,150239,166947,147253,24743,16115,29900,29756,37767,29751,17567,159210,17745,30083,16227,150745,150790,16216,30037,30323,173510,15129,29800,166604,149931,149902,15099,15821,150094,16127,149957,149747,37370,22322,37698,166627,137316,20703,152097,152039,30584,143922,30478,30479,30587,149143,145281,14942,149744,29752,29851,16063,150202,150215,16584,150166,156078,37639,152961,30750,30861,30856,30930,29648,31065,161601,153315,16654,31131,33942,31141,27181,147194,31290,31220,16750,136934,16690,37429,31217,134476,149900,131737,146874,137070,13719,21867,13680,13994,131540,134157,31458,23129,141045,154287,154268,23053,131675,30960,23082,154566,31486,16889,31837,31853,16913,154547,155324,155302,31949,150009,137136,31886,31868,31918,27314,32220,32263,32211,32590,156257,155996,162632,32151,155266,17002,158581,133398,26582,131150,144847,22468,156690,156664,149858,32733,31527,133164,154345,154947,31500,155150,39398,34373,39523,27164,144447,14818,150007,157101,39455,157088,33920,160039,158929,17642,33079,17410,32966,33033,33090,157620,39107,158274,33378,33381,158289,33875,159143,34320,160283,23174,16767,137280,23339,137377,23268,137432,34464,195004,146831,34861,160802,23042,34926,20293,34951,35007,35046,35173,35149,153219,35156,161669,161668,166901,166873,166812,166393,16045,33955,18165,18127,14322,35389,35356,169032,24397,37419,148100,26068,28969,28868,137285,40301,35999,36073,163292,22938,30659,23024,17262,14036,36394,36519,150537,36656,36682,17140,27736,28603,140065,18587,28537,28299,137178,39913,14005,149807,37051,37015,21873,18694,37307,37892,166475,16482,166652,37927,166941,166971,34021,35371,38297,38311,38295,38294,167220,29765,16066,149759,150082,148458,16103,143909,38543,167655,167526,167525,16076,149997,150136,147438,29714,29803,16124,38721,168112,26695,18973,168083,153567,38749,37736,166281,166950,166703,156606,37562,23313,35689,18748,29689,147995,38811,38769,39224,134950,24001,166853,150194,38943,169178,37622,169431,37349,17600,166736,150119,166756,39132,166469,16128,37418,18725,33812,39227,39245,162566,15869,39323,19311,39338,39516,166757,153800,27279,39457,23294,39471,170225,19344,170312,39356,19389,19351,37757,22642,135938,22562,149944,136424,30788,141087,146872,26821,15741,37976,14631,24912,141185,141675,24839,40015,40019,40059,39989,39952,39807,39887,171565,39839,172533,172286,40225,19630,147716,40472,19632,40204,172468,172269,172275,170287,40357,33981,159250,159711,158594,34300,17715,159140,159364,159216,33824,34286,159232,145367,155748,31202,144796,144960,18733,149982,15714,37851,37566,37704,131775,30905,37495,37965,20452,13376,36964,152925,30781,30804,30902,30795,137047,143817,149825,13978,20338,28634,28633,28702,28702,21524,147893,22459,22771,22410,40214,22487,28980,13487,147884,29163,158784,151447,23336,137141,166473,24844,23246,23051,17084,148616,14124,19323,166396,37819,37816,137430,134941,33906,158912,136211,148218,142374,148417,22932,146871,157505,32168,155995,155812,149945,149899,166394,37605,29666,16105,29876,166755,137375,16097,150195,27352,29683,29691,16086,150078,150164,137177,150118,132007,136228,149989,29768,149782,28837,149878,37508,29670,37727,132350,37681,166606,166422,37766,166887,153045,18741,166530,29035,149827,134399,22180,132634,134123,134328,21762,31172,137210,32254,136898,150096,137298,17710,37889,14090,166592,149933,22960,137407,137347,160900,23201,14050,146779,14000,37471,23161,166529,137314,37748,15565,133812,19094,14730,20724,15721,15692,136092,29045,17147,164376,28175,168164,17643,27991,163407,28775,27823,15574,147437,146989,28162,28428,15727,132085,30033,14012,13512,18048,16090,18545,22980,37486,18750,36673,166940,158656,22546,22472,14038,136274,28926,148322,150129,143331,135856,140221,26809,26983,136088,144613,162804,145119,166531,145366,144378,150687,27162,145069,158903,33854,17631,17614,159014,159057,158850,159710,28439,160009,33597,137018,33773,158848,159827,137179,22921,23170,137139,23137,23153,137477,147964,14125,23023,137020,14023,29070,37776,26266,148133,23150,23083,148115,27179,147193,161590,148571,148170,28957,148057,166369,20400,159016,23746,148686,163405,148413,27148,148054,135940,28838,28979,148457,15781,27871,194597,150095,32357,23019,23855,15859,24412,150109,137183,32164,33830,21637,146170,144128,131604,22398,133333,132633,16357,139166,172726,28675,168283,23920,29583,31955,166489,168992,20424,32743,29389,29456,162548,29496,29497,153334,29505,29512,16041,162584,36972,29173,149746,29665,33270,16074,30476,16081,27810,22269,29721,29726,29727,16098,16112,16116,16122,29907,16142,16211,30018,30061,30066,30093,16252,30152,30172,16320,30285,16343,30324,16348,30330,151388,29064,22051,35200,22633,16413,30531,16441,26465,16453,13787,30616,16490,16495,23646,30654,30667,22770,30744,28857,30748,16552,30777,30791,30801,30822,33864,152885,31027,26627,31026,16643,16649,31121,31129,36795,31238,36796,16743,31377,16818,31420,33401,16836,31439,31451,16847,20001,31586,31596,31611,31762,31771,16992,17018,31867,31900,17036,31928,17044,31981,36755,28864,134351,32207,32212,32208,32253,32686,32692,29343,17303,32800,32805,31545,32814,32817,32852,15820,22452,28832,32951,33001,17389,33036,29482,33038,33042,30048,33044,17409,15161,33110,33113,33114,17427,22586,33148,33156,17445,33171,17453,33189,22511,33217,33252,33364,17551,33446,33398,33482,33496,33535,17584,33623,38505,27018,33797,28917,33892,24803,33928,17668,33982,34017,34040,34064,34104,34130,17723,34159,34160,34272,17783,34418,34450,34482,34543,38469,34699,17926,17943,34990,35071,35108,35143,35217,162151,35369,35384,35476,35508,35921,36052,36082,36124,18328,22623,36291,18413,20206,36410,21976,22356,36465,22005,36528,18487,36558,36578,36580,36589,36594,36791,36801,36810,36812,36915,39364,18605,39136,37395,18718,37416,37464,37483,37553,37550,37567,37603,37611,37619,37620,37629,37699,37764,37805,18757,18769,40639,37911,21249,37917,37933,37950,18794,37972,38009,38189,38306,18855,38388,38451,18917,26528,18980,38720,18997,38834,38850,22100,19172,24808,39097,19225,39153,22596,39182,39193,20916,39196,39223,39234,39261,39266,19312,39365,19357,39484,39695,31363,39785,39809,39901,39921,39924,19565,39968,14191,138178,40265,39994,40702,22096,40339,40381,40384,40444,38134,36790,40571,40620,40625,40637,40646,38108,40674,40689,40696,31432,40772,131220,131767,132000,26906,38083,22956,132311,22592,38081,14265,132565,132629,132726,136890,22359,29043,133826,133837,134079,21610,194619,134091,21662,134139,134203,134227,134245,134268,24807,134285,22138,134325,134365,134381,134511,134578,134600,26965,39983,34725,134660,134670,134871,135056,134957,134771,23584,135100,24075,135260,135247,135286,26398,135291,135304,135318,13895,135359,135379,135471,135483,21348,33965,135907,136053,135990,35713,136567,136729,137155,137159,20088,28859,137261,137578,137773,137797,138282,138352,138412,138952,25283,138965,139029,29080,26709,139333,27113,14024,139900,140247,140282,141098,141425,141647,33533,141671,141715,142037,35237,142056,36768,142094,38840,142143,38983,39613,142412,null,142472,142519,154600,142600,142610,142775,142741,142914,143220,143308,143411,143462,144159,144350,24497,26184,26303,162425,144743,144883,29185,149946,30679,144922,145174,32391,131910,22709,26382,26904,146087,161367,155618,146961,147129,161278,139418,18640,19128,147737,166554,148206,148237,147515,148276,148374,150085,132554,20946,132625,22943,138920,15294,146687,148484,148694,22408,149108,14747,149295,165352,170441,14178,139715,35678,166734,39382,149522,149755,150037,29193,150208,134264,22885,151205,151430,132985,36570,151596,21135,22335,29041,152217,152601,147274,150183,21948,152646,152686,158546,37332,13427,152895,161330,152926,18200,152930,152934,153543,149823,153693,20582,13563,144332,24798,153859,18300,166216,154286,154505,154630,138640,22433,29009,28598,155906,162834,36950,156082,151450,35682,156674,156746,23899,158711,36662,156804,137500,35562,150006,156808,147439,156946,19392,157119,157365,141083,37989,153569,24981,23079,194765,20411,22201,148769,157436,20074,149812,38486,28047,158909,13848,35191,157593,157806,156689,157790,29151,157895,31554,168128,133649,157990,37124,158009,31301,40432,158202,39462,158253,13919,156777,131105,31107,158260,158555,23852,144665,33743,158621,18128,158884,30011,34917,159150,22710,14108,140685,159819,160205,15444,160384,160389,37505,139642,160395,37680,160486,149968,27705,38047,160848,134904,34855,35061,141606,164979,137137,28344,150058,137248,14756,14009,23568,31203,17727,26294,171181,170148,35139,161740,161880,22230,16607,136714,14753,145199,164072,136133,29101,33638,162269,168360,23143,19639,159919,166315,162301,162314,162571,163174,147834,31555,31102,163849,28597,172767,27139,164632,21410,159239,37823,26678,38749,164207,163875,158133,136173,143919,163912,23941,166960,163971,22293,38947,166217,23979,149896,26046,27093,21458,150181,147329,15377,26422,163984,164084,164142,139169,164175,164233,164271,164378,164614,164655,164746,13770,164968,165546,18682,25574,166230,30728,37461,166328,17394,166375,17375,166376,166726,166868,23032,166921,36619,167877,168172,31569,168208,168252,15863,168286,150218,36816,29327,22155,169191,169449,169392,169400,169778,170193,170313,170346,170435,170536,170766,171354,171419,32415,171768,171811,19620,38215,172691,29090,172799,19857,36882,173515,19868,134300,36798,21953,36794,140464,36793,150163,17673,32383,28502,27313,20202,13540,166700,161949,14138,36480,137205,163876,166764,166809,162366,157359,15851,161365,146615,153141,153942,20122,155265,156248,22207,134765,36366,23405,147080,150686,25566,25296,137206,137339,25904,22061,154698,21530,152337,15814,171416,19581,22050,22046,32585,155352,22901,146752,34672,19996,135146,134473,145082,33047,40286,36120,30267,40005,30286,30649,37701,21554,33096,33527,22053,33074,33816,32957,21994,31074,22083,21526,134813,13774,22021,22001,26353,164578,13869,30004,22000,21946,21655,21874,134209,134294,24272,151880,134774,142434,134818,40619,32090,21982,135285,25245,38765,21652,36045,29174,37238,25596,25529,25598,21865,142147,40050,143027,20890,13535,134567,20903,21581,21790,21779,30310,36397,157834,30129,32950,34820,34694,35015,33206,33820,135361,17644,29444,149254,23440,33547,157843,22139,141044,163119,147875,163187,159440,160438,37232,135641,37384,146684,173737,134828,134905,29286,138402,18254,151490,163833,135147,16634,40029,25887,142752,18675,149472,171388,135148,134666,24674,161187,135149,null,155720,135559,29091,32398,40272,19994,19972,13687,23309,27826,21351,13996,14812,21373,13989,149016,22682,150382,33325,21579,22442,154261,133497,null,14930,140389,29556,171692,19721,39917,146686,171824,19547,151465,169374,171998,33884,146870,160434,157619,145184,25390,32037,147191,146988,14890,36872,21196,15988,13946,17897,132238,30272,23280,134838,30842,163630,22695,16575,22140,39819,23924,30292,173108,40581,19681,30201,14331,24857,143578,148466,null,22109,135849,22439,149859,171526,21044,159918,13741,27722,40316,31830,39737,22494,137068,23635,25811,169168,156469,160100,34477,134440,159010,150242,134513,null,20990,139023,23950,38659,138705,40577,36940,31519,39682,23761,31651,25192,25397,39679,31695,39722,31870,39726,31810,31878,39957,31740,39689,40727,39963,149822,40794,21875,23491,20477,40600,20466,21088,15878,21201,22375,20566,22967,24082,38856,40363,36700,21609,38836,39232,38842,21292,24880,26924,21466,39946,40194,19515,38465,27008,20646,30022,137069,39386,21107,null,37209,38529,37212,null,37201,167575,25471,159011,27338,22033,37262,30074,25221,132092,29519,31856,154657,146685,null,149785,30422,39837,20010,134356,33726,34882,null,23626,27072,20717,22394,21023,24053,20174,27697,131570,20281,21660,21722,21146,36226,13822,24332,13811,null,27474,37244,40869,39831,38958,39092,39610,40616,40580,29050,31508,null,27642,34840,32632,null,22048,173642,36471,40787,null,36308,36431,40476,36353,25218,164733,36392,36469,31443,150135,31294,30936,27882,35431,30215,166490,40742,27854,34774,30147,172722,30803,194624,36108,29410,29553,35629,29442,29937,36075,150203,34351,24506,34976,17591,null,137275,159237,null,35454,140571,null,24829,30311,39639,40260,37742,39823,34805,null,34831,36087,29484,38689,39856,13782,29362,19463,31825,39242,155993,24921,19460,40598,24957,null,22367,24943,25254,25145,25294,14940,25058,21418,144373,25444,26626,13778,23895,166850,36826,167481,null,20697,138566,30982,21298,38456,134971,16485,null,30718,null,31938,155418,31962,31277,32870,32867,32077,29957,29938,35220,33306,26380,32866,160902,32859,29936,33027,30500,35209,157644,30035,159441,34729,34766,33224,34700,35401,36013,35651,30507,29944,34010,13877,27058,36262,null,35241,29800,28089,34753,147473,29927,15835,29046,24740,24988,15569,29026,24695,null,32625,166701,29264,24809,19326,21024,15384,146631,155351,161366,152881,137540,135934,170243,159196,159917,23745,156077,166415,145015,131310,157766,151310,17762,23327,156492,40784,40614,156267,12288,65292,12289,12290,65294,8231,65307,65306,65311,65281,65072,8230,8229,65104,65105,65106,183,65108,65109,65110,65111,65372,8211,65073,8212,65075,9588,65076,65103,65288,65289,65077,65078,65371,65373,65079,65080,12308,12309,65081,65082,12304,12305,65083,65084,12298,12299,65085,65086,12296,12297,65087,65088,12300,12301,65089,65090,12302,12303,65091,65092,65113,65114,65115,65116,65117,65118,8216,8217,8220,8221,12317,12318,8245,8242,65283,65286,65290,8251,167,12291,9675,9679,9651,9650,9678,9734,9733,9671,9670,9633,9632,9661,9660,12963,8453,175,65507,65343,717,65097,65098,65101,65102,65099,65100,65119,65120,65121,65291,65293,215,247,177,8730,65308,65310,65309,8806,8807,8800,8734,8786,8801,65122,65123,65124,65125,65126,65374,8745,8746,8869,8736,8735,8895,13266,13265,8747,8750,8757,8756,9792,9794,8853,8857,8593,8595,8592,8594,8598,8599,8601,8600,8741,8739,65295,65340,8725,65128,65284,65509,12306,65504,65505,65285,65312,8451,8457,65129,65130,65131,13269,13212,13213,13214,13262,13217,13198,13199,13252,176,20825,20827,20830,20829,20833,20835,21991,29929,31950,9601,9602,9603,9604,9605,9606,9607,9608,9615,9614,9613,9612,9611,9610,9609,9532,9524,9516,9508,9500,9620,9472,9474,9621,9484,9488,9492,9496,9581,9582,9584,9583,9552,9566,9578,9569,9698,9699,9701,9700,9585,9586,9587,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,12321,12322,12323,12324,12325,12326,12327,12328,12329,21313,21316,21317,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,12549,12550,12551,12552,12553,12554,12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570,12571,12572,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582,12583,12584,12585,729,713,714,711,715,9216,9217,9218,9219,9220,9221,9222,9223,9224,9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240,9241,9242,9243,9244,9245,9246,9247,9249,8364,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,19968,20057,19969,19971,20035,20061,20102,20108,20154,20799,20837,20843,20960,20992,20993,21147,21269,21313,21340,21448,19977,19979,19976,19978,20011,20024,20961,20037,20040,20063,20062,20110,20129,20800,20995,21242,21315,21449,21475,22303,22763,22805,22823,22899,23376,23377,23379,23544,23567,23586,23608,23665,24029,24037,24049,24050,24051,24062,24178,24318,24331,24339,25165,19985,19984,19981,20013,20016,20025,20043,23609,20104,20113,20117,20114,20116,20130,20161,20160,20163,20166,20167,20173,20170,20171,20164,20803,20801,20839,20845,20846,20844,20887,20982,20998,20999,21000,21243,21246,21247,21270,21305,21320,21319,21317,21342,21380,21451,21450,21453,22764,22825,22827,22826,22829,23380,23569,23588,23610,23663,24052,24187,24319,24340,24341,24515,25096,25142,25163,25166,25903,25991,26007,26020,26041,26085,26352,26376,26408,27424,27490,27513,27595,27604,27611,27663,27700,28779,29226,29238,29243,29255,29273,29275,29356,29579,19993,19990,19989,19988,19992,20027,20045,20047,20046,20197,20184,20180,20181,20182,20183,20195,20196,20185,20190,20805,20804,20873,20874,20908,20985,20986,20984,21002,21152,21151,21253,21254,21271,21277,20191,21322,21321,21345,21344,21359,21358,21435,21487,21476,21491,21484,21486,21481,21480,21500,21496,21493,21483,21478,21482,21490,21489,21488,21477,21485,21499,22235,22234,22806,22830,22833,22900,22902,23381,23427,23612,24040,24039,24038,24066,24067,24179,24188,24321,24344,24343,24517,25098,25171,25172,25170,25169,26021,26086,26414,26412,26410,26411,26413,27491,27597,27665,27664,27704,27713,27712,27710,29359,29572,29577,29916,29926,29976,29983,29992,29993,30000,30001,30002,30003,30091,30333,30382,30399,30446,30683,30690,30707,31034,31166,31348,31435,19998,19999,20050,20051,20073,20121,20132,20134,20133,20223,20233,20249,20234,20245,20237,20240,20241,20239,20210,20214,20219,20208,20211,20221,20225,20235,20809,20807,20806,20808,20840,20849,20877,20912,21015,21009,21010,21006,21014,21155,21256,21281,21280,21360,21361,21513,21519,21516,21514,21520,21505,21515,21508,21521,21517,21512,21507,21518,21510,21522,22240,22238,22237,22323,22320,22312,22317,22316,22319,22313,22809,22810,22839,22840,22916,22904,22915,22909,22905,22914,22913,23383,23384,23431,23432,23429,23433,23546,23574,23673,24030,24070,24182,24180,24335,24347,24537,24534,25102,25100,25101,25104,25187,25179,25176,25910,26089,26088,26092,26093,26354,26355,26377,26429,26420,26417,26421,27425,27492,27515,27670,27741,27735,27737,27743,27744,27728,27733,27745,27739,27725,27726,28784,29279,29277,30334,31481,31859,31992,32566,32650,32701,32769,32771,32780,32786,32819,32895,32905,32907,32908,33251,33258,33267,33276,33292,33307,33311,33390,33394,33406,34411,34880,34892,34915,35199,38433,20018,20136,20301,20303,20295,20311,20318,20276,20315,20309,20272,20304,20305,20285,20282,20280,20291,20308,20284,20294,20323,20316,20320,20271,20302,20278,20313,20317,20296,20314,20812,20811,20813,20853,20918,20919,21029,21028,21033,21034,21032,21163,21161,21162,21164,21283,21363,21365,21533,21549,21534,21566,21542,21582,21543,21574,21571,21555,21576,21570,21531,21545,21578,21561,21563,21560,21550,21557,21558,21536,21564,21568,21553,21547,21535,21548,22250,22256,22244,22251,22346,22353,22336,22349,22343,22350,22334,22352,22351,22331,22767,22846,22941,22930,22952,22942,22947,22937,22934,22925,22948,22931,22922,22949,23389,23388,23386,23387,23436,23435,23439,23596,23616,23617,23615,23614,23696,23697,23700,23692,24043,24076,24207,24199,24202,24311,24324,24351,24420,24418,24439,24441,24536,24524,24535,24525,24561,24555,24568,24554,25106,25105,25220,25239,25238,25216,25206,25225,25197,25226,25212,25214,25209,25203,25234,25199,25240,25198,25237,25235,25233,25222,25913,25915,25912,26097,26356,26463,26446,26447,26448,26449,26460,26454,26462,26441,26438,26464,26451,26455,27493,27599,27714,27742,27801,27777,27784,27785,27781,27803,27754,27770,27792,27760,27788,27752,27798,27794,27773,27779,27762,27774,27764,27782,27766,27789,27796,27800,27778,28790,28796,28797,28792,29282,29281,29280,29380,29378,29590,29996,29995,30007,30008,30338,30447,30691,31169,31168,31167,31350,31995,32597,32918,32915,32925,32920,32923,32922,32946,33391,33426,33419,33421,35211,35282,35328,35895,35910,35925,35997,36196,36208,36275,36523,36554,36763,36784,36802,36806,36805,36804,24033,37009,37026,37034,37030,37027,37193,37318,37324,38450,38446,38449,38442,38444,20006,20054,20083,20107,20123,20126,20139,20140,20335,20381,20365,20339,20351,20332,20379,20363,20358,20355,20336,20341,20360,20329,20347,20374,20350,20367,20369,20346,20820,20818,20821,20841,20855,20854,20856,20925,20989,21051,21048,21047,21050,21040,21038,21046,21057,21182,21179,21330,21332,21331,21329,21350,21367,21368,21369,21462,21460,21463,21619,21621,21654,21624,21653,21632,21627,21623,21636,21650,21638,21628,21648,21617,21622,21644,21658,21602,21608,21643,21629,21646,22266,22403,22391,22378,22377,22369,22374,22372,22396,22812,22857,22855,22856,22852,22868,22974,22971,22996,22969,22958,22993,22982,22992,22989,22987,22995,22986,22959,22963,22994,22981,23391,23396,23395,23447,23450,23448,23452,23449,23451,23578,23624,23621,23622,23735,23713,23736,23721,23723,23729,23731,24088,24090,24086,24085,24091,24081,24184,24218,24215,24220,24213,24214,24310,24358,24359,24361,24448,24449,24447,24444,24541,24544,24573,24565,24575,24591,24596,24623,24629,24598,24618,24597,24609,24615,24617,24619,24603,25110,25109,25151,25150,25152,25215,25289,25292,25284,25279,25282,25273,25298,25307,25259,25299,25300,25291,25288,25256,25277,25276,25296,25305,25287,25293,25269,25306,25265,25304,25302,25303,25286,25260,25294,25918,26023,26044,26106,26132,26131,26124,26118,26114,26126,26112,26127,26133,26122,26119,26381,26379,26477,26507,26517,26481,26524,26483,26487,26503,26525,26519,26479,26480,26495,26505,26494,26512,26485,26522,26515,26492,26474,26482,27427,27494,27495,27519,27667,27675,27875,27880,27891,27825,27852,27877,27827,27837,27838,27836,27874,27819,27861,27859,27832,27844,27833,27841,27822,27863,27845,27889,27839,27835,27873,27867,27850,27820,27887,27868,27862,27872,28821,28814,28818,28810,28825,29228,29229,29240,29256,29287,29289,29376,29390,29401,29399,29392,29609,29608,29599,29611,29605,30013,30109,30105,30106,30340,30402,30450,30452,30693,30717,31038,31040,31041,31177,31176,31354,31353,31482,31998,32596,32652,32651,32773,32954,32933,32930,32945,32929,32939,32937,32948,32938,32943,33253,33278,33293,33459,33437,33433,33453,33469,33439,33465,33457,33452,33445,33455,33464,33443,33456,33470,33463,34382,34417,21021,34920,36555,36814,36820,36817,37045,37048,37041,37046,37319,37329,38263,38272,38428,38464,38463,38459,38468,38466,38585,38632,38738,38750,20127,20141,20142,20449,20405,20399,20415,20448,20433,20431,20445,20419,20406,20440,20447,20426,20439,20398,20432,20420,20418,20442,20430,20446,20407,20823,20882,20881,20896,21070,21059,21066,21069,21068,21067,21063,21191,21193,21187,21185,21261,21335,21371,21402,21467,21676,21696,21672,21710,21705,21688,21670,21683,21703,21698,21693,21674,21697,21700,21704,21679,21675,21681,21691,21673,21671,21695,22271,22402,22411,22432,22435,22434,22478,22446,22419,22869,22865,22863,22862,22864,23004,23000,23039,23011,23016,23043,23013,23018,23002,23014,23041,23035,23401,23459,23462,23460,23458,23461,23553,23630,23631,23629,23627,23769,23762,24055,24093,24101,24095,24189,24224,24230,24314,24328,24365,24421,24456,24453,24458,24459,24455,24460,24457,24594,24605,24608,24613,24590,24616,24653,24688,24680,24674,24646,24643,24684,24683,24682,24676,25153,25308,25366,25353,25340,25325,25345,25326,25341,25351,25329,25335,25327,25324,25342,25332,25361,25346,25919,25925,26027,26045,26082,26149,26157,26144,26151,26159,26143,26152,26161,26148,26359,26623,26579,26609,26580,26576,26604,26550,26543,26613,26601,26607,26564,26577,26548,26586,26597,26552,26575,26590,26611,26544,26585,26594,26589,26578,27498,27523,27526,27573,27602,27607,27679,27849,27915,27954,27946,27969,27941,27916,27953,27934,27927,27963,27965,27966,27958,27931,27893,27961,27943,27960,27945,27950,27957,27918,27947,28843,28858,28851,28844,28847,28845,28856,28846,28836,29232,29298,29295,29300,29417,29408,29409,29623,29642,29627,29618,29645,29632,29619,29978,29997,30031,30028,30030,30027,30123,30116,30117,30114,30115,30328,30342,30343,30344,30408,30406,30403,30405,30465,30457,30456,30473,30475,30462,30460,30471,30684,30722,30740,30732,30733,31046,31049,31048,31047,31161,31162,31185,31186,31179,31359,31361,31487,31485,31869,32002,32005,32000,32009,32007,32004,32006,32568,32654,32703,32772,32784,32781,32785,32822,32982,32997,32986,32963,32964,32972,32993,32987,32974,32990,32996,32989,33268,33314,33511,33539,33541,33507,33499,33510,33540,33509,33538,33545,33490,33495,33521,33537,33500,33492,33489,33502,33491,33503,33519,33542,34384,34425,34427,34426,34893,34923,35201,35284,35336,35330,35331,35998,36000,36212,36211,36276,36557,36556,36848,36838,36834,36842,36837,36845,36843,36836,36840,37066,37070,37057,37059,37195,37194,37325,38274,38480,38475,38476,38477,38754,38761,38859,38893,38899,38913,39080,39131,39135,39318,39321,20056,20147,20492,20493,20515,20463,20518,20517,20472,20521,20502,20486,20540,20511,20506,20498,20497,20474,20480,20500,20520,20465,20513,20491,20505,20504,20467,20462,20525,20522,20478,20523,20489,20860,20900,20901,20898,20941,20940,20934,20939,21078,21084,21076,21083,21085,21290,21375,21407,21405,21471,21736,21776,21761,21815,21756,21733,21746,21766,21754,21780,21737,21741,21729,21769,21742,21738,21734,21799,21767,21757,21775,22275,22276,22466,22484,22475,22467,22537,22799,22871,22872,22874,23057,23064,23068,23071,23067,23059,23020,23072,23075,23081,23077,23052,23049,23403,23640,23472,23475,23478,23476,23470,23477,23481,23480,23556,23633,23637,23632,23789,23805,23803,23786,23784,23792,23798,23809,23796,24046,24109,24107,24235,24237,24231,24369,24466,24465,24464,24665,24675,24677,24656,24661,24685,24681,24687,24708,24735,24730,24717,24724,24716,24709,24726,25159,25331,25352,25343,25422,25406,25391,25429,25410,25414,25423,25417,25402,25424,25405,25386,25387,25384,25421,25420,25928,25929,26009,26049,26053,26178,26185,26191,26179,26194,26188,26181,26177,26360,26388,26389,26391,26657,26680,26696,26694,26707,26681,26690,26708,26665,26803,26647,26700,26705,26685,26612,26704,26688,26684,26691,26666,26693,26643,26648,26689,27530,27529,27575,27683,27687,27688,27686,27684,27888,28010,28053,28040,28039,28006,28024,28023,27993,28051,28012,28041,28014,27994,28020,28009,28044,28042,28025,28037,28005,28052,28874,28888,28900,28889,28872,28879,29241,29305,29436,29433,29437,29432,29431,29574,29677,29705,29678,29664,29674,29662,30036,30045,30044,30042,30041,30142,30149,30151,30130,30131,30141,30140,30137,30146,30136,30347,30384,30410,30413,30414,30505,30495,30496,30504,30697,30768,30759,30776,30749,30772,30775,30757,30765,30752,30751,30770,31061,31056,31072,31071,31062,31070,31069,31063,31066,31204,31203,31207,31199,31206,31209,31192,31364,31368,31449,31494,31505,31881,32033,32023,32011,32010,32032,32034,32020,32016,32021,32026,32028,32013,32025,32027,32570,32607,32660,32709,32705,32774,32792,32789,32793,32791,32829,32831,33009,33026,33008,33029,33005,33012,33030,33016,33011,33032,33021,33034,33020,33007,33261,33260,33280,33296,33322,33323,33320,33324,33467,33579,33618,33620,33610,33592,33616,33609,33589,33588,33615,33586,33593,33590,33559,33600,33585,33576,33603,34388,34442,34474,34451,34468,34473,34444,34467,34460,34928,34935,34945,34946,34941,34937,35352,35344,35342,35340,35349,35338,35351,35347,35350,35343,35345,35912,35962,35961,36001,36002,36215,36524,36562,36564,36559,36785,36865,36870,36855,36864,36858,36852,36867,36861,36869,36856,37013,37089,37085,37090,37202,37197,37196,37336,37341,37335,37340,37337,38275,38498,38499,38497,38491,38493,38500,38488,38494,38587,39138,39340,39592,39640,39717,39730,39740,20094,20602,20605,20572,20551,20547,20556,20570,20553,20581,20598,20558,20565,20597,20596,20599,20559,20495,20591,20589,20828,20885,20976,21098,21103,21202,21209,21208,21205,21264,21263,21273,21311,21312,21310,21443,26364,21830,21866,21862,21828,21854,21857,21827,21834,21809,21846,21839,21845,21807,21860,21816,21806,21852,21804,21859,21811,21825,21847,22280,22283,22281,22495,22533,22538,22534,22496,22500,22522,22530,22581,22519,22521,22816,22882,23094,23105,23113,23142,23146,23104,23100,23138,23130,23110,23114,23408,23495,23493,23492,23490,23487,23494,23561,23560,23559,23648,23644,23645,23815,23814,23822,23835,23830,23842,23825,23849,23828,23833,23844,23847,23831,24034,24120,24118,24115,24119,24247,24248,24246,24245,24254,24373,24375,24407,24428,24425,24427,24471,24473,24478,24472,24481,24480,24476,24703,24739,24713,24736,24744,24779,24756,24806,24765,24773,24763,24757,24796,24764,24792,24789,24774,24799,24760,24794,24775,25114,25115,25160,25504,25511,25458,25494,25506,25509,25463,25447,25496,25514,25457,25513,25481,25475,25499,25451,25512,25476,25480,25497,25505,25516,25490,25487,25472,25467,25449,25448,25466,25949,25942,25937,25945,25943,21855,25935,25944,25941,25940,26012,26011,26028,26063,26059,26060,26062,26205,26202,26212,26216,26214,26206,26361,21207,26395,26753,26799,26786,26771,26805,26751,26742,26801,26791,26775,26800,26755,26820,26797,26758,26757,26772,26781,26792,26783,26785,26754,27442,27578,27627,27628,27691,28046,28092,28147,28121,28082,28129,28108,28132,28155,28154,28165,28103,28107,28079,28113,28078,28126,28153,28088,28151,28149,28101,28114,28186,28085,28122,28139,28120,28138,28145,28142,28136,28102,28100,28074,28140,28095,28134,28921,28937,28938,28925,28911,29245,29309,29313,29468,29467,29462,29459,29465,29575,29701,29706,29699,29702,29694,29709,29920,29942,29943,29980,29986,30053,30054,30050,30064,30095,30164,30165,30133,30154,30157,30350,30420,30418,30427,30519,30526,30524,30518,30520,30522,30827,30787,30798,31077,31080,31085,31227,31378,31381,31520,31528,31515,31532,31526,31513,31518,31534,31890,31895,31893,32070,32067,32113,32046,32057,32060,32064,32048,32051,32068,32047,32066,32050,32049,32573,32670,32666,32716,32718,32722,32796,32842,32838,33071,33046,33059,33067,33065,33072,33060,33282,33333,33335,33334,33337,33678,33694,33688,33656,33698,33686,33725,33707,33682,33674,33683,33673,33696,33655,33659,33660,33670,33703,34389,24426,34503,34496,34486,34500,34485,34502,34507,34481,34479,34505,34899,34974,34952,34987,34962,34966,34957,34955,35219,35215,35370,35357,35363,35365,35377,35373,35359,35355,35362,35913,35930,36009,36012,36011,36008,36010,36007,36199,36198,36286,36282,36571,36575,36889,36877,36890,36887,36899,36895,36893,36880,36885,36894,36896,36879,36898,36886,36891,36884,37096,37101,37117,37207,37326,37365,37350,37347,37351,37357,37353,38281,38506,38517,38515,38520,38512,38516,38518,38519,38508,38592,38634,38633,31456,31455,38914,38915,39770,40165,40565,40575,40613,40635,20642,20621,20613,20633,20625,20608,20630,20632,20634,26368,20977,21106,21108,21109,21097,21214,21213,21211,21338,21413,21883,21888,21927,21884,21898,21917,21912,21890,21916,21930,21908,21895,21899,21891,21939,21934,21919,21822,21938,21914,21947,21932,21937,21886,21897,21931,21913,22285,22575,22570,22580,22564,22576,22577,22561,22557,22560,22777,22778,22880,23159,23194,23167,23186,23195,23207,23411,23409,23506,23500,23507,23504,23562,23563,23601,23884,23888,23860,23879,24061,24133,24125,24128,24131,24190,24266,24257,24258,24260,24380,24429,24489,24490,24488,24785,24801,24754,24758,24800,24860,24867,24826,24853,24816,24827,24820,24936,24817,24846,24822,24841,24832,24850,25119,25161,25507,25484,25551,25536,25577,25545,25542,25549,25554,25571,25552,25569,25558,25581,25582,25462,25588,25578,25563,25682,25562,25593,25950,25958,25954,25955,26001,26000,26031,26222,26224,26228,26230,26223,26257,26234,26238,26231,26366,26367,26399,26397,26874,26837,26848,26840,26839,26885,26847,26869,26862,26855,26873,26834,26866,26851,26827,26829,26893,26898,26894,26825,26842,26990,26875,27454,27450,27453,27544,27542,27580,27631,27694,27695,27692,28207,28216,28244,28193,28210,28263,28234,28192,28197,28195,28187,28251,28248,28196,28246,28270,28205,28198,28271,28212,28237,28218,28204,28227,28189,28222,28363,28297,28185,28238,28259,28228,28274,28265,28255,28953,28954,28966,28976,28961,28982,29038,28956,29260,29316,29312,29494,29477,29492,29481,29754,29738,29747,29730,29733,29749,29750,29748,29743,29723,29734,29736,29989,29990,30059,30058,30178,30171,30179,30169,30168,30174,30176,30331,30332,30358,30355,30388,30428,30543,30701,30813,30828,30831,31245,31240,31243,31237,31232,31384,31383,31382,31461,31459,31561,31574,31558,31568,31570,31572,31565,31563,31567,31569,31903,31909,32094,32080,32104,32085,32043,32110,32114,32097,32102,32098,32112,32115,21892,32724,32725,32779,32850,32901,33109,33108,33099,33105,33102,33081,33094,33086,33100,33107,33140,33298,33308,33769,33795,33784,33805,33760,33733,33803,33729,33775,33777,33780,33879,33802,33776,33804,33740,33789,33778,33738,33848,33806,33796,33756,33799,33748,33759,34395,34527,34521,34541,34516,34523,34532,34512,34526,34903,35009,35010,34993,35203,35222,35387,35424,35413,35422,35388,35393,35412,35419,35408,35398,35380,35386,35382,35414,35937,35970,36015,36028,36019,36029,36033,36027,36032,36020,36023,36022,36031,36024,36234,36229,36225,36302,36317,36299,36314,36305,36300,36315,36294,36603,36600,36604,36764,36910,36917,36913,36920,36914,36918,37122,37109,37129,37118,37219,37221,37327,37396,37397,37411,37385,37406,37389,37392,37383,37393,38292,38287,38283,38289,38291,38290,38286,38538,38542,38539,38525,38533,38534,38541,38514,38532,38593,38597,38596,38598,38599,38639,38642,38860,38917,38918,38920,39143,39146,39151,39145,39154,39149,39342,39341,40643,40653,40657,20098,20653,20661,20658,20659,20677,20670,20652,20663,20667,20655,20679,21119,21111,21117,21215,21222,21220,21218,21219,21295,21983,21992,21971,21990,21966,21980,21959,21969,21987,21988,21999,21978,21985,21957,21958,21989,21961,22290,22291,22622,22609,22616,22615,22618,22612,22635,22604,22637,22602,22626,22610,22603,22887,23233,23241,23244,23230,23229,23228,23219,23234,23218,23913,23919,24140,24185,24265,24264,24338,24409,24492,24494,24858,24847,24904,24863,24819,24859,24825,24833,24840,24910,24908,24900,24909,24894,24884,24871,24845,24838,24887,25121,25122,25619,25662,25630,25642,25645,25661,25644,25615,25628,25620,25613,25654,25622,25623,25606,25964,26015,26032,26263,26249,26247,26248,26262,26244,26264,26253,26371,27028,26989,26970,26999,26976,26964,26997,26928,27010,26954,26984,26987,26974,26963,27001,27014,26973,26979,26971,27463,27506,27584,27583,27603,27645,28322,28335,28371,28342,28354,28304,28317,28359,28357,28325,28312,28348,28346,28331,28369,28310,28316,28356,28372,28330,28327,28340,29006,29017,29033,29028,29001,29031,29020,29036,29030,29004,29029,29022,28998,29032,29014,29242,29266,29495,29509,29503,29502,29807,29786,29781,29791,29790,29761,29759,29785,29787,29788,30070,30072,30208,30192,30209,30194,30193,30202,30207,30196,30195,30430,30431,30555,30571,30566,30558,30563,30585,30570,30572,30556,30565,30568,30562,30702,30862,30896,30871,30872,30860,30857,30844,30865,30867,30847,31098,31103,31105,33836,31165,31260,31258,31264,31252,31263,31262,31391,31392,31607,31680,31584,31598,31591,31921,31923,31925,32147,32121,32145,32129,32143,32091,32622,32617,32618,32626,32681,32680,32676,32854,32856,32902,32900,33137,33136,33144,33125,33134,33139,33131,33145,33146,33126,33285,33351,33922,33911,33853,33841,33909,33894,33899,33865,33900,33883,33852,33845,33889,33891,33897,33901,33862,34398,34396,34399,34553,34579,34568,34567,34560,34558,34555,34562,34563,34566,34570,34905,35039,35028,35033,35036,35032,35037,35041,35018,35029,35026,35228,35299,35435,35442,35443,35430,35433,35440,35463,35452,35427,35488,35441,35461,35437,35426,35438,35436,35449,35451,35390,35432,35938,35978,35977,36042,36039,36040,36036,36018,36035,36034,36037,36321,36319,36328,36335,36339,36346,36330,36324,36326,36530,36611,36617,36606,36618,36767,36786,36939,36938,36947,36930,36948,36924,36949,36944,36935,36943,36942,36941,36945,36926,36929,37138,37143,37228,37226,37225,37321,37431,37463,37432,37437,37440,37438,37467,37451,37476,37457,37428,37449,37453,37445,37433,37439,37466,38296,38552,38548,38549,38605,38603,38601,38602,38647,38651,38649,38646,38742,38772,38774,38928,38929,38931,38922,38930,38924,39164,39156,39165,39166,39347,39345,39348,39649,40169,40578,40718,40723,40736,20711,20718,20709,20694,20717,20698,20693,20687,20689,20721,20686,20713,20834,20979,21123,21122,21297,21421,22014,22016,22043,22039,22013,22036,22022,22025,22029,22030,22007,22038,22047,22024,22032,22006,22296,22294,22645,22654,22659,22675,22666,22649,22661,22653,22781,22821,22818,22820,22890,22889,23265,23270,23273,23255,23254,23256,23267,23413,23518,23527,23521,23525,23526,23528,23522,23524,23519,23565,23650,23940,23943,24155,24163,24149,24151,24148,24275,24278,24330,24390,24432,24505,24903,24895,24907,24951,24930,24931,24927,24922,24920,24949,25130,25735,25688,25684,25764,25720,25695,25722,25681,25703,25652,25709,25723,25970,26017,26071,26070,26274,26280,26269,27036,27048,27029,27073,27054,27091,27083,27035,27063,27067,27051,27060,27088,27085,27053,27084,27046,27075,27043,27465,27468,27699,28467,28436,28414,28435,28404,28457,28478,28448,28460,28431,28418,28450,28415,28399,28422,28465,28472,28466,28451,28437,28459,28463,28552,28458,28396,28417,28402,28364,28407,29076,29081,29053,29066,29060,29074,29246,29330,29334,29508,29520,29796,29795,29802,29808,29805,29956,30097,30247,30221,30219,30217,30227,30433,30435,30596,30589,30591,30561,30913,30879,30887,30899,30889,30883,31118,31119,31117,31278,31281,31402,31401,31469,31471,31649,31637,31627,31605,31639,31645,31636,31631,31672,31623,31620,31929,31933,31934,32187,32176,32156,32189,32190,32160,32202,32180,32178,32177,32186,32162,32191,32181,32184,32173,32210,32199,32172,32624,32736,32737,32735,32862,32858,32903,33104,33152,33167,33160,33162,33151,33154,33255,33274,33287,33300,33310,33355,33993,33983,33990,33988,33945,33950,33970,33948,33995,33976,33984,34003,33936,33980,34001,33994,34623,34588,34619,34594,34597,34612,34584,34645,34615,34601,35059,35074,35060,35065,35064,35069,35048,35098,35055,35494,35468,35486,35491,35469,35489,35475,35492,35498,35493,35496,35480,35473,35482,35495,35946,35981,35980,36051,36049,36050,36203,36249,36245,36348,36628,36626,36629,36627,36771,36960,36952,36956,36963,36953,36958,36962,36957,36955,37145,37144,37150,37237,37240,37239,37236,37496,37504,37509,37528,37526,37499,37523,37532,37544,37500,37521,38305,38312,38313,38307,38309,38308,38553,38556,38555,38604,38610,38656,38780,38789,38902,38935,38936,39087,39089,39171,39173,39180,39177,39361,39599,39600,39654,39745,39746,40180,40182,40179,40636,40763,40778,20740,20736,20731,20725,20729,20738,20744,20745,20741,20956,21127,21128,21129,21133,21130,21232,21426,22062,22075,22073,22066,22079,22068,22057,22099,22094,22103,22132,22070,22063,22064,22656,22687,22686,22707,22684,22702,22697,22694,22893,23305,23291,23307,23285,23308,23304,23534,23532,23529,23531,23652,23653,23965,23956,24162,24159,24161,24290,24282,24287,24285,24291,24288,24392,24433,24503,24501,24950,24935,24942,24925,24917,24962,24956,24944,24939,24958,24999,24976,25003,24974,25004,24986,24996,24980,25006,25134,25705,25711,25721,25758,25778,25736,25744,25776,25765,25747,25749,25769,25746,25774,25773,25771,25754,25772,25753,25762,25779,25973,25975,25976,26286,26283,26292,26289,27171,27167,27112,27137,27166,27161,27133,27169,27155,27146,27123,27138,27141,27117,27153,27472,27470,27556,27589,27590,28479,28540,28548,28497,28518,28500,28550,28525,28507,28536,28526,28558,28538,28528,28516,28567,28504,28373,28527,28512,28511,29087,29100,29105,29096,29270,29339,29518,29527,29801,29835,29827,29822,29824,30079,30240,30249,30239,30244,30246,30241,30242,30362,30394,30436,30606,30599,30604,30609,30603,30923,30917,30906,30922,30910,30933,30908,30928,31295,31292,31296,31293,31287,31291,31407,31406,31661,31665,31684,31668,31686,31687,31681,31648,31692,31946,32224,32244,32239,32251,32216,32236,32221,32232,32227,32218,32222,32233,32158,32217,32242,32249,32629,32631,32687,32745,32806,33179,33180,33181,33184,33178,33176,34071,34109,34074,34030,34092,34093,34067,34065,34083,34081,34068,34028,34085,34047,34054,34690,34676,34678,34656,34662,34680,34664,34649,34647,34636,34643,34907,34909,35088,35079,35090,35091,35093,35082,35516,35538,35527,35524,35477,35531,35576,35506,35529,35522,35519,35504,35542,35533,35510,35513,35547,35916,35918,35948,36064,36062,36070,36068,36076,36077,36066,36067,36060,36074,36065,36205,36255,36259,36395,36368,36381,36386,36367,36393,36383,36385,36382,36538,36637,36635,36639,36649,36646,36650,36636,36638,36645,36969,36974,36968,36973,36983,37168,37165,37159,37169,37255,37257,37259,37251,37573,37563,37559,37610,37548,37604,37569,37555,37564,37586,37575,37616,37554,38317,38321,38660,38662,38663,38665,38752,38797,38795,38799,38945,38955,38940,39091,39178,39187,39186,39192,39389,39376,39391,39387,39377,39381,39378,39385,39607,39662,39663,39719,39749,39748,39799,39791,40198,40201,40195,40617,40638,40654,22696,40786,20754,20760,20756,20752,20757,20864,20906,20957,21137,21139,21235,22105,22123,22137,22121,22116,22136,22122,22120,22117,22129,22127,22124,22114,22134,22721,22718,22727,22725,22894,23325,23348,23416,23536,23566,24394,25010,24977,25001,24970,25037,25014,25022,25034,25032,25136,25797,25793,25803,25787,25788,25818,25796,25799,25794,25805,25791,25810,25812,25790,25972,26310,26313,26297,26308,26311,26296,27197,27192,27194,27225,27243,27224,27193,27204,27234,27233,27211,27207,27189,27231,27208,27481,27511,27653,28610,28593,28577,28611,28580,28609,28583,28595,28608,28601,28598,28582,28576,28596,29118,29129,29136,29138,29128,29141,29113,29134,29145,29148,29123,29124,29544,29852,29859,29848,29855,29854,29922,29964,29965,30260,30264,30266,30439,30437,30624,30622,30623,30629,30952,30938,30956,30951,31142,31309,31310,31302,31308,31307,31418,31705,31761,31689,31716,31707,31713,31721,31718,31957,31958,32266,32273,32264,32283,32291,32286,32285,32265,32272,32633,32690,32752,32753,32750,32808,33203,33193,33192,33275,33288,33368,33369,34122,34137,34120,34152,34153,34115,34121,34157,34154,34142,34691,34719,34718,34722,34701,34913,35114,35122,35109,35115,35105,35242,35238,35558,35578,35563,35569,35584,35548,35559,35566,35582,35585,35586,35575,35565,35571,35574,35580,35947,35949,35987,36084,36420,36401,36404,36418,36409,36405,36667,36655,36664,36659,36776,36774,36981,36980,36984,36978,36988,36986,37172,37266,37664,37686,37624,37683,37679,37666,37628,37675,37636,37658,37648,37670,37665,37653,37678,37657,38331,38567,38568,38570,38613,38670,38673,38678,38669,38675,38671,38747,38748,38758,38808,38960,38968,38971,38967,38957,38969,38948,39184,39208,39198,39195,39201,39194,39405,39394,39409,39608,39612,39675,39661,39720,39825,40213,40227,40230,40232,40210,40219,40664,40660,40845,40860,20778,20767,20769,20786,21237,22158,22144,22160,22149,22151,22159,22741,22739,22737,22734,23344,23338,23332,23418,23607,23656,23996,23994,23997,23992,24171,24396,24509,25033,25026,25031,25062,25035,25138,25140,25806,25802,25816,25824,25840,25830,25836,25841,25826,25837,25986,25987,26329,26326,27264,27284,27268,27298,27292,27355,27299,27262,27287,27280,27296,27484,27566,27610,27656,28632,28657,28639,28640,28635,28644,28651,28655,28544,28652,28641,28649,28629,28654,28656,29159,29151,29166,29158,29157,29165,29164,29172,29152,29237,29254,29552,29554,29865,29872,29862,29864,30278,30274,30284,30442,30643,30634,30640,30636,30631,30637,30703,30967,30970,30964,30959,30977,31143,31146,31319,31423,31751,31757,31742,31735,31756,31712,31968,31964,31966,31970,31967,31961,31965,32302,32318,32326,32311,32306,32323,32299,32317,32305,32325,32321,32308,32313,32328,32309,32319,32303,32580,32755,32764,32881,32882,32880,32879,32883,33222,33219,33210,33218,33216,33215,33213,33225,33214,33256,33289,33393,34218,34180,34174,34204,34193,34196,34223,34203,34183,34216,34186,34407,34752,34769,34739,34770,34758,34731,34747,34746,34760,34763,35131,35126,35140,35128,35133,35244,35598,35607,35609,35611,35594,35616,35613,35588,35600,35905,35903,35955,36090,36093,36092,36088,36091,36264,36425,36427,36424,36426,36676,36670,36674,36677,36671,36991,36989,36996,36993,36994,36992,37177,37283,37278,37276,37709,37762,37672,37749,37706,37733,37707,37656,37758,37740,37723,37744,37722,37716,38346,38347,38348,38344,38342,38577,38584,38614,38684,38686,38816,38867,38982,39094,39221,39425,39423,39854,39851,39850,39853,40251,40255,40587,40655,40670,40668,40669,40667,40766,40779,21474,22165,22190,22745,22744,23352,24413,25059,25139,25844,25842,25854,25862,25850,25851,25847,26039,26332,26406,27315,27308,27331,27323,27320,27330,27310,27311,27487,27512,27567,28681,28683,28670,28678,28666,28689,28687,29179,29180,29182,29176,29559,29557,29863,29887,29973,30294,30296,30290,30653,30655,30651,30652,30990,31150,31329,31330,31328,31428,31429,31787,31783,31786,31774,31779,31777,31975,32340,32341,32350,32346,32353,32338,32345,32584,32761,32763,32887,32886,33229,33231,33290,34255,34217,34253,34256,34249,34224,34234,34233,34214,34799,34796,34802,34784,35206,35250,35316,35624,35641,35628,35627,35920,36101,36441,36451,36454,36452,36447,36437,36544,36681,36685,36999,36995,37000,37291,37292,37328,37780,37770,37782,37794,37811,37806,37804,37808,37784,37786,37783,38356,38358,38352,38357,38626,38620,38617,38619,38622,38692,38819,38822,38829,38905,38989,38991,38988,38990,38995,39098,39230,39231,39229,39214,39333,39438,39617,39683,39686,39759,39758,39757,39882,39881,39933,39880,39872,40273,40285,40288,40672,40725,40748,20787,22181,22750,22751,22754,23541,40848,24300,25074,25079,25078,25077,25856,25871,26336,26333,27365,27357,27354,27347,28699,28703,28712,28698,28701,28693,28696,29190,29197,29272,29346,29560,29562,29885,29898,29923,30087,30086,30303,30305,30663,31001,31153,31339,31337,31806,31807,31800,31805,31799,31808,32363,32365,32377,32361,32362,32645,32371,32694,32697,32696,33240,34281,34269,34282,34261,34276,34277,34295,34811,34821,34829,34809,34814,35168,35167,35158,35166,35649,35676,35672,35657,35674,35662,35663,35654,35673,36104,36106,36476,36466,36487,36470,36460,36474,36468,36692,36686,36781,37002,37003,37297,37294,37857,37841,37855,37827,37832,37852,37853,37846,37858,37837,37848,37860,37847,37864,38364,38580,38627,38698,38695,38753,38876,38907,39006,39000,39003,39100,39237,39241,39446,39449,39693,39912,39911,39894,39899,40329,40289,40306,40298,40300,40594,40599,40595,40628,21240,22184,22199,22198,22196,22204,22756,23360,23363,23421,23542,24009,25080,25082,25880,25876,25881,26342,26407,27372,28734,28720,28722,29200,29563,29903,30306,30309,31014,31018,31020,31019,31431,31478,31820,31811,31821,31983,31984,36782,32381,32380,32386,32588,32768,33242,33382,34299,34297,34321,34298,34310,34315,34311,34314,34836,34837,35172,35258,35320,35696,35692,35686,35695,35679,35691,36111,36109,36489,36481,36485,36482,37300,37323,37912,37891,37885,38369,38704,39108,39250,39249,39336,39467,39472,39479,39477,39955,39949,40569,40629,40680,40751,40799,40803,40801,20791,20792,22209,22208,22210,22804,23660,24013,25084,25086,25885,25884,26005,26345,27387,27396,27386,27570,28748,29211,29351,29910,29908,30313,30675,31824,32399,32396,32700,34327,34349,34330,34851,34850,34849,34847,35178,35180,35261,35700,35703,35709,36115,36490,36493,36491,36703,36783,37306,37934,37939,37941,37946,37944,37938,37931,38370,38712,38713,38706,38911,39015,39013,39255,39493,39491,39488,39486,39631,39764,39761,39981,39973,40367,40372,40386,40376,40605,40687,40729,40796,40806,40807,20796,20795,22216,22218,22217,23423,24020,24018,24398,25087,25892,27402,27489,28753,28760,29568,29924,30090,30318,30316,31155,31840,31839,32894,32893,33247,35186,35183,35324,35712,36118,36119,36497,36499,36705,37192,37956,37969,37970,38717,38718,38851,38849,39019,39253,39509,39501,39634,39706,40009,39985,39998,39995,40403,40407,40756,40812,40810,40852,22220,24022,25088,25891,25899,25898,26348,27408,29914,31434,31844,31843,31845,32403,32406,32404,33250,34360,34367,34865,35722,37008,37007,37987,37984,37988,38760,39023,39260,39514,39515,39511,39635,39636,39633,40020,40023,40022,40421,40607,40692,22225,22761,25900,28766,30321,30322,30679,32592,32648,34870,34873,34914,35731,35730,35734,33399,36123,37312,37994,38722,38728,38724,38854,39024,39519,39714,39768,40031,40441,40442,40572,40573,40711,40823,40818,24307,27414,28771,31852,31854,34875,35264,36513,37313,38002,38000,39025,39262,39638,39715,40652,28772,30682,35738,38007,38857,39522,39525,32412,35740,36522,37317,38013,38014,38012,40055,40056,40695,35924,38015,40474,29224,39530,39729,40475,40478,31858,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,20022,20031,20101,20128,20866,20886,20907,21241,21304,21353,21430,22794,23424,24027,12083,24191,24308,24400,24417,25908,26080,30098,30326,36789,38582,168,710,12541,12542,12445,12446,12291,20189,12293,12294,12295,12540,65339,65341,10045,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8679,8632,8633,12751,131276,20058,131210,20994,17553,40880,20872,40881,161287,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,65506,65508,65287,65282,12849,8470,8481,12443,12444,11904,11908,11910,11911,11912,11914,11916,11917,11925,11932,11933,11941,11943,11946,11948,11950,11958,11964,11966,11974,11978,11980,11981,11983,11990,11991,11998,12003,null,null,null,643,592,603,596,629,339,248,331,650,618,20034,20060,20981,21274,21378,19975,19980,20039,20109,22231,64012,23662,24435,19983,20871,19982,20014,20115,20162,20169,20168,20888,21244,21356,21433,22304,22787,22828,23568,24063,26081,27571,27596,27668,29247,20017,20028,20200,20188,20201,20193,20189,20186,21004,21276,21324,22306,22307,22807,22831,23425,23428,23570,23611,23668,23667,24068,24192,24194,24521,25097,25168,27669,27702,27715,27711,27707,29358,29360,29578,31160,32906,38430,20238,20248,20268,20213,20244,20209,20224,20215,20232,20253,20226,20229,20258,20243,20228,20212,20242,20913,21011,21001,21008,21158,21282,21279,21325,21386,21511,22241,22239,22318,22314,22324,22844,22912,22908,22917,22907,22910,22903,22911,23382,23573,23589,23676,23674,23675,23678,24031,24181,24196,24322,24346,24436,24533,24532,24527,25180,25182,25188,25185,25190,25186,25177,25184,25178,25189,26095,26094,26430,26425,26424,26427,26426,26431,26428,26419,27672,27718,27730,27740,27727,27722,27732,27723,27724,28785,29278,29364,29365,29582,29994,30335,31349,32593,33400,33404,33408,33405,33407,34381,35198,37017,37015,37016,37019,37012,38434,38436,38432,38435,20310,20283,20322,20297,20307,20324,20286,20327,20306,20319,20289,20312,20269,20275,20287,20321,20879,20921,21020,21022,21025,21165,21166,21257,21347,21362,21390,21391,21552,21559,21546,21588,21573,21529,21532,21541,21528,21565,21583,21569,21544,21540,21575,22254,22247,22245,22337,22341,22348,22345,22347,22354,22790,22848,22950,22936,22944,22935,22926,22946,22928,22927,22951,22945,23438,23442,23592,23594,23693,23695,23688,23691,23689,23698,23690,23686,23699,23701,24032,24074,24078,24203,24201,24204,24200,24205,24325,24349,24440,24438,24530,24529,24528,24557,24552,24558,24563,24545,24548,24547,24570,24559,24567,24571,24576,24564,25146,25219,25228,25230,25231,25236,25223,25201,25211,25210,25200,25217,25224,25207,25213,25202,25204,25911,26096,26100,26099,26098,26101,26437,26439,26457,26453,26444,26440,26461,26445,26458,26443,27600,27673,27674,27768,27751,27755,27780,27787,27791,27761,27759,27753,27802,27757,27783,27797,27804,27750,27763,27749,27771,27790,28788,28794,29283,29375,29373,29379,29382,29377,29370,29381,29589,29591,29587,29588,29586,30010,30009,30100,30101,30337,31037,32820,32917,32921,32912,32914,32924,33424,33423,33413,33422,33425,33427,33418,33411,33412,35960,36809,36799,37023,37025,37029,37022,37031,37024,38448,38440,38447,38445,20019,20376,20348,20357,20349,20352,20359,20342,20340,20361,20356,20343,20300,20375,20330,20378,20345,20353,20344,20368,20380,20372,20382,20370,20354,20373,20331,20334,20894,20924,20926,21045,21042,21043,21062,21041,21180,21258,21259,21308,21394,21396,21639,21631,21633,21649,21634,21640,21611,21626,21630,21605,21612,21620,21606,21645,21615,21601,21600,21656,21603,21607,21604,22263,22265,22383,22386,22381,22379,22385,22384,22390,22400,22389,22395,22387,22388,22370,22376,22397,22796,22853,22965,22970,22991,22990,22962,22988,22977,22966,22972,22979,22998,22961,22973,22976,22984,22964,22983,23394,23397,23443,23445,23620,23623,23726,23716,23712,23733,23727,23720,23724,23711,23715,23725,23714,23722,23719,23709,23717,23734,23728,23718,24087,24084,24089,24360,24354,24355,24356,24404,24450,24446,24445,24542,24549,24621,24614,24601,24626,24587,24628,24586,24599,24627,24602,24606,24620,24610,24589,24592,24622,24595,24593,24588,24585,24604,25108,25149,25261,25268,25297,25278,25258,25270,25290,25262,25267,25263,25275,25257,25264,25272,25917,26024,26043,26121,26108,26116,26130,26120,26107,26115,26123,26125,26117,26109,26129,26128,26358,26378,26501,26476,26510,26514,26486,26491,26520,26502,26500,26484,26509,26508,26490,26527,26513,26521,26499,26493,26497,26488,26489,26516,27429,27520,27518,27614,27677,27795,27884,27883,27886,27865,27830,27860,27821,27879,27831,27856,27842,27834,27843,27846,27885,27890,27858,27869,27828,27786,27805,27776,27870,27840,27952,27853,27847,27824,27897,27855,27881,27857,28820,28824,28805,28819,28806,28804,28817,28822,28802,28826,28803,29290,29398,29387,29400,29385,29404,29394,29396,29402,29388,29393,29604,29601,29613,29606,29602,29600,29612,29597,29917,29928,30015,30016,30014,30092,30104,30383,30451,30449,30448,30453,30712,30716,30713,30715,30714,30711,31042,31039,31173,31352,31355,31483,31861,31997,32821,32911,32942,32931,32952,32949,32941,33312,33440,33472,33451,33434,33432,33435,33461,33447,33454,33468,33438,33466,33460,33448,33441,33449,33474,33444,33475,33462,33442,34416,34415,34413,34414,35926,36818,36811,36819,36813,36822,36821,36823,37042,37044,37039,37043,37040,38457,38461,38460,38458,38467,20429,20421,20435,20402,20425,20427,20417,20436,20444,20441,20411,20403,20443,20423,20438,20410,20416,20409,20460,21060,21065,21184,21186,21309,21372,21399,21398,21401,21400,21690,21665,21677,21669,21711,21699,33549,21687,21678,21718,21686,21701,21702,21664,21616,21692,21666,21694,21618,21726,21680,22453,22430,22431,22436,22412,22423,22429,22427,22420,22424,22415,22425,22437,22426,22421,22772,22797,22867,23009,23006,23022,23040,23025,23005,23034,23037,23036,23030,23012,23026,23031,23003,23017,23027,23029,23008,23038,23028,23021,23464,23628,23760,23768,23756,23767,23755,23771,23774,23770,23753,23751,23754,23766,23763,23764,23759,23752,23750,23758,23775,23800,24057,24097,24098,24099,24096,24100,24240,24228,24226,24219,24227,24229,24327,24366,24406,24454,24631,24633,24660,24690,24670,24645,24659,24647,24649,24667,24652,24640,24642,24671,24612,24644,24664,24678,24686,25154,25155,25295,25357,25355,25333,25358,25347,25323,25337,25359,25356,25336,25334,25344,25363,25364,25338,25365,25339,25328,25921,25923,26026,26047,26166,26145,26162,26165,26140,26150,26146,26163,26155,26170,26141,26164,26169,26158,26383,26384,26561,26610,26568,26554,26588,26555,26616,26584,26560,26551,26565,26603,26596,26591,26549,26573,26547,26615,26614,26606,26595,26562,26553,26574,26599,26608,26546,26620,26566,26605,26572,26542,26598,26587,26618,26569,26570,26563,26602,26571,27432,27522,27524,27574,27606,27608,27616,27680,27681,27944,27956,27949,27935,27964,27967,27922,27914,27866,27955,27908,27929,27962,27930,27921,27904,27933,27970,27905,27928,27959,27907,27919,27968,27911,27936,27948,27912,27938,27913,27920,28855,28831,28862,28849,28848,28833,28852,28853,28841,29249,29257,29258,29292,29296,29299,29294,29386,29412,29416,29419,29407,29418,29414,29411,29573,29644,29634,29640,29637,29625,29622,29621,29620,29675,29631,29639,29630,29635,29638,29624,29643,29932,29934,29998,30023,30024,30119,30122,30329,30404,30472,30467,30468,30469,30474,30455,30459,30458,30695,30696,30726,30737,30738,30725,30736,30735,30734,30729,30723,30739,31050,31052,31051,31045,31044,31189,31181,31183,31190,31182,31360,31358,31441,31488,31489,31866,31864,31865,31871,31872,31873,32003,32008,32001,32600,32657,32653,32702,32775,32782,32783,32788,32823,32984,32967,32992,32977,32968,32962,32976,32965,32995,32985,32988,32970,32981,32969,32975,32983,32998,32973,33279,33313,33428,33497,33534,33529,33543,33512,33536,33493,33594,33515,33494,33524,33516,33505,33522,33525,33548,33531,33526,33520,33514,33508,33504,33530,33523,33517,34423,34420,34428,34419,34881,34894,34919,34922,34921,35283,35332,35335,36210,36835,36833,36846,36832,37105,37053,37055,37077,37061,37054,37063,37067,37064,37332,37331,38484,38479,38481,38483,38474,38478,20510,20485,20487,20499,20514,20528,20507,20469,20468,20531,20535,20524,20470,20471,20503,20508,20512,20519,20533,20527,20529,20494,20826,20884,20883,20938,20932,20933,20936,20942,21089,21082,21074,21086,21087,21077,21090,21197,21262,21406,21798,21730,21783,21778,21735,21747,21732,21786,21759,21764,21768,21739,21777,21765,21745,21770,21755,21751,21752,21728,21774,21763,21771,22273,22274,22476,22578,22485,22482,22458,22470,22461,22460,22456,22454,22463,22471,22480,22457,22465,22798,22858,23065,23062,23085,23086,23061,23055,23063,23050,23070,23091,23404,23463,23469,23468,23555,23638,23636,23788,23807,23790,23793,23799,23808,23801,24105,24104,24232,24238,24234,24236,24371,24368,24423,24669,24666,24679,24641,24738,24712,24704,24722,24705,24733,24707,24725,24731,24727,24711,24732,24718,25113,25158,25330,25360,25430,25388,25412,25413,25398,25411,25572,25401,25419,25418,25404,25385,25409,25396,25432,25428,25433,25389,25415,25395,25434,25425,25400,25431,25408,25416,25930,25926,26054,26051,26052,26050,26186,26207,26183,26193,26386,26387,26655,26650,26697,26674,26675,26683,26699,26703,26646,26673,26652,26677,26667,26669,26671,26702,26692,26676,26653,26642,26644,26662,26664,26670,26701,26682,26661,26656,27436,27439,27437,27441,27444,27501,32898,27528,27622,27620,27624,27619,27618,27623,27685,28026,28003,28004,28022,27917,28001,28050,27992,28002,28013,28015,28049,28045,28143,28031,28038,27998,28007,28000,28055,28016,28028,27999,28034,28056,27951,28008,28043,28030,28032,28036,27926,28035,28027,28029,28021,28048,28892,28883,28881,28893,28875,32569,28898,28887,28882,28894,28896,28884,28877,28869,28870,28871,28890,28878,28897,29250,29304,29303,29302,29440,29434,29428,29438,29430,29427,29435,29441,29651,29657,29669,29654,29628,29671,29667,29673,29660,29650,29659,29652,29661,29658,29655,29656,29672,29918,29919,29940,29941,29985,30043,30047,30128,30145,30139,30148,30144,30143,30134,30138,30346,30409,30493,30491,30480,30483,30482,30499,30481,30485,30489,30490,30498,30503,30755,30764,30754,30773,30767,30760,30766,30763,30753,30761,30771,30762,30769,31060,31067,31055,31068,31059,31058,31057,31211,31212,31200,31214,31213,31210,31196,31198,31197,31366,31369,31365,31371,31372,31370,31367,31448,31504,31492,31507,31493,31503,31496,31498,31502,31497,31506,31876,31889,31882,31884,31880,31885,31877,32030,32029,32017,32014,32024,32022,32019,32031,32018,32015,32012,32604,32609,32606,32608,32605,32603,32662,32658,32707,32706,32704,32790,32830,32825,33018,33010,33017,33013,33025,33019,33024,33281,33327,33317,33587,33581,33604,33561,33617,33573,33622,33599,33601,33574,33564,33570,33602,33614,33563,33578,33544,33596,33613,33558,33572,33568,33591,33583,33577,33607,33605,33612,33619,33566,33580,33611,33575,33608,34387,34386,34466,34472,34454,34445,34449,34462,34439,34455,34438,34443,34458,34437,34469,34457,34465,34471,34453,34456,34446,34461,34448,34452,34883,34884,34925,34933,34934,34930,34944,34929,34943,34927,34947,34942,34932,34940,35346,35911,35927,35963,36004,36003,36214,36216,36277,36279,36278,36561,36563,36862,36853,36866,36863,36859,36868,36860,36854,37078,37088,37081,37082,37091,37087,37093,37080,37083,37079,37084,37092,37200,37198,37199,37333,37346,37338,38492,38495,38588,39139,39647,39727,20095,20592,20586,20577,20574,20576,20563,20555,20573,20594,20552,20557,20545,20571,20554,20578,20501,20549,20575,20585,20587,20579,20580,20550,20544,20590,20595,20567,20561,20944,21099,21101,21100,21102,21206,21203,21293,21404,21877,21878,21820,21837,21840,21812,21802,21841,21858,21814,21813,21808,21842,21829,21772,21810,21861,21838,21817,21832,21805,21819,21824,21835,22282,22279,22523,22548,22498,22518,22492,22516,22528,22509,22525,22536,22520,22539,22515,22479,22535,22510,22499,22514,22501,22508,22497,22542,22524,22544,22503,22529,22540,22513,22505,22512,22541,22532,22876,23136,23128,23125,23143,23134,23096,23093,23149,23120,23135,23141,23148,23123,23140,23127,23107,23133,23122,23108,23131,23112,23182,23102,23117,23097,23116,23152,23145,23111,23121,23126,23106,23132,23410,23406,23489,23488,23641,23838,23819,23837,23834,23840,23820,23848,23821,23846,23845,23823,23856,23826,23843,23839,23854,24126,24116,24241,24244,24249,24242,24243,24374,24376,24475,24470,24479,24714,24720,24710,24766,24752,24762,24787,24788,24783,24804,24793,24797,24776,24753,24795,24759,24778,24767,24771,24781,24768,25394,25445,25482,25474,25469,25533,25502,25517,25501,25495,25515,25486,25455,25479,25488,25454,25519,25461,25500,25453,25518,25468,25508,25403,25503,25464,25477,25473,25489,25485,25456,25939,26061,26213,26209,26203,26201,26204,26210,26392,26745,26759,26768,26780,26733,26734,26798,26795,26966,26735,26787,26796,26793,26741,26740,26802,26767,26743,26770,26748,26731,26738,26794,26752,26737,26750,26779,26774,26763,26784,26761,26788,26744,26747,26769,26764,26762,26749,27446,27443,27447,27448,27537,27535,27533,27534,27532,27690,28096,28075,28084,28083,28276,28076,28137,28130,28087,28150,28116,28160,28104,28128,28127,28118,28094,28133,28124,28125,28123,28148,28106,28093,28141,28144,28090,28117,28098,28111,28105,28112,28146,28115,28157,28119,28109,28131,28091,28922,28941,28919,28951,28916,28940,28912,28932,28915,28944,28924,28927,28934,28947,28928,28920,28918,28939,28930,28942,29310,29307,29308,29311,29469,29463,29447,29457,29464,29450,29448,29439,29455,29470,29576,29686,29688,29685,29700,29697,29693,29703,29696,29690,29692,29695,29708,29707,29684,29704,30052,30051,30158,30162,30159,30155,30156,30161,30160,30351,30345,30419,30521,30511,30509,30513,30514,30516,30515,30525,30501,30523,30517,30792,30802,30793,30797,30794,30796,30758,30789,30800,31076,31079,31081,31082,31075,31083,31073,31163,31226,31224,31222,31223,31375,31380,31376,31541,31559,31540,31525,31536,31522,31524,31539,31512,31530,31517,31537,31531,31533,31535,31538,31544,31514,31523,31892,31896,31894,31907,32053,32061,32056,32054,32058,32069,32044,32041,32065,32071,32062,32063,32074,32059,32040,32611,32661,32668,32669,32667,32714,32715,32717,32720,32721,32711,32719,32713,32799,32798,32795,32839,32835,32840,33048,33061,33049,33051,33069,33055,33068,33054,33057,33045,33063,33053,33058,33297,33336,33331,33338,33332,33330,33396,33680,33699,33704,33677,33658,33651,33700,33652,33679,33665,33685,33689,33653,33684,33705,33661,33667,33676,33693,33691,33706,33675,33662,33701,33711,33672,33687,33712,33663,33702,33671,33710,33654,33690,34393,34390,34495,34487,34498,34497,34501,34490,34480,34504,34489,34483,34488,34508,34484,34491,34492,34499,34493,34494,34898,34953,34965,34984,34978,34986,34970,34961,34977,34975,34968,34983,34969,34971,34967,34980,34988,34956,34963,34958,35202,35286,35289,35285,35376,35367,35372,35358,35897,35899,35932,35933,35965,36005,36221,36219,36217,36284,36290,36281,36287,36289,36568,36574,36573,36572,36567,36576,36577,36900,36875,36881,36892,36876,36897,37103,37098,37104,37108,37106,37107,37076,37099,37100,37097,37206,37208,37210,37203,37205,37356,37364,37361,37363,37368,37348,37369,37354,37355,37367,37352,37358,38266,38278,38280,38524,38509,38507,38513,38511,38591,38762,38916,39141,39319,20635,20629,20628,20638,20619,20643,20611,20620,20622,20637,20584,20636,20626,20610,20615,20831,20948,21266,21265,21412,21415,21905,21928,21925,21933,21879,22085,21922,21907,21896,21903,21941,21889,21923,21906,21924,21885,21900,21926,21887,21909,21921,21902,22284,22569,22583,22553,22558,22567,22563,22568,22517,22600,22565,22556,22555,22579,22591,22582,22574,22585,22584,22573,22572,22587,22881,23215,23188,23199,23162,23202,23198,23160,23206,23164,23205,23212,23189,23214,23095,23172,23178,23191,23171,23179,23209,23163,23165,23180,23196,23183,23187,23197,23530,23501,23499,23508,23505,23498,23502,23564,23600,23863,23875,23915,23873,23883,23871,23861,23889,23886,23893,23859,23866,23890,23869,23857,23897,23874,23865,23881,23864,23868,23858,23862,23872,23877,24132,24129,24408,24486,24485,24491,24777,24761,24780,24802,24782,24772,24852,24818,24842,24854,24837,24821,24851,24824,24828,24830,24769,24835,24856,24861,24848,24831,24836,24843,25162,25492,25521,25520,25550,25573,25576,25583,25539,25757,25587,25546,25568,25590,25557,25586,25589,25697,25567,25534,25565,25564,25540,25560,25555,25538,25543,25548,25547,25544,25584,25559,25561,25906,25959,25962,25956,25948,25960,25957,25996,26013,26014,26030,26064,26066,26236,26220,26235,26240,26225,26233,26218,26226,26369,26892,26835,26884,26844,26922,26860,26858,26865,26895,26838,26871,26859,26852,26870,26899,26896,26867,26849,26887,26828,26888,26992,26804,26897,26863,26822,26900,26872,26832,26877,26876,26856,26891,26890,26903,26830,26824,26845,26846,26854,26868,26833,26886,26836,26857,26901,26917,26823,27449,27451,27455,27452,27540,27543,27545,27541,27581,27632,27634,27635,27696,28156,28230,28231,28191,28233,28296,28220,28221,28229,28258,28203,28223,28225,28253,28275,28188,28211,28235,28224,28241,28219,28163,28206,28254,28264,28252,28257,28209,28200,28256,28273,28267,28217,28194,28208,28243,28261,28199,28280,28260,28279,28245,28281,28242,28262,28213,28214,28250,28960,28958,28975,28923,28974,28977,28963,28965,28962,28978,28959,28968,28986,28955,29259,29274,29320,29321,29318,29317,29323,29458,29451,29488,29474,29489,29491,29479,29490,29485,29478,29475,29493,29452,29742,29740,29744,29739,29718,29722,29729,29741,29745,29732,29731,29725,29737,29728,29746,29947,29999,30063,30060,30183,30170,30177,30182,30173,30175,30180,30167,30357,30354,30426,30534,30535,30532,30541,30533,30538,30542,30539,30540,30686,30700,30816,30820,30821,30812,30829,30833,30826,30830,30832,30825,30824,30814,30818,31092,31091,31090,31088,31234,31242,31235,31244,31236,31385,31462,31460,31562,31547,31556,31560,31564,31566,31552,31576,31557,31906,31902,31912,31905,32088,32111,32099,32083,32086,32103,32106,32079,32109,32092,32107,32082,32084,32105,32081,32095,32078,32574,32575,32613,32614,32674,32672,32673,32727,32849,32847,32848,33022,32980,33091,33098,33106,33103,33095,33085,33101,33082,33254,33262,33271,33272,33273,33284,33340,33341,33343,33397,33595,33743,33785,33827,33728,33768,33810,33767,33764,33788,33782,33808,33734,33736,33771,33763,33727,33793,33757,33765,33752,33791,33761,33739,33742,33750,33781,33737,33801,33807,33758,33809,33798,33730,33779,33749,33786,33735,33745,33770,33811,33731,33772,33774,33732,33787,33751,33762,33819,33755,33790,34520,34530,34534,34515,34531,34522,34538,34525,34539,34524,34540,34537,34519,34536,34513,34888,34902,34901,35002,35031,35001,35000,35008,35006,34998,35004,34999,35005,34994,35073,35017,35221,35224,35223,35293,35290,35291,35406,35405,35385,35417,35392,35415,35416,35396,35397,35410,35400,35409,35402,35404,35407,35935,35969,35968,36026,36030,36016,36025,36021,36228,36224,36233,36312,36307,36301,36295,36310,36316,36303,36309,36313,36296,36311,36293,36591,36599,36602,36601,36582,36590,36581,36597,36583,36584,36598,36587,36593,36588,36596,36585,36909,36916,36911,37126,37164,37124,37119,37116,37128,37113,37115,37121,37120,37127,37125,37123,37217,37220,37215,37218,37216,37377,37386,37413,37379,37402,37414,37391,37388,37376,37394,37375,37373,37382,37380,37415,37378,37404,37412,37401,37399,37381,37398,38267,38285,38284,38288,38535,38526,38536,38537,38531,38528,38594,38600,38595,38641,38640,38764,38768,38766,38919,39081,39147,40166,40697,20099,20100,20150,20669,20671,20678,20654,20676,20682,20660,20680,20674,20656,20673,20666,20657,20683,20681,20662,20664,20951,21114,21112,21115,21116,21955,21979,21964,21968,21963,21962,21981,21952,21972,21956,21993,21951,21970,21901,21967,21973,21986,21974,21960,22002,21965,21977,21954,22292,22611,22632,22628,22607,22605,22601,22639,22613,22606,22621,22617,22629,22619,22589,22627,22641,22780,23239,23236,23243,23226,23224,23217,23221,23216,23231,23240,23227,23238,23223,23232,23242,23220,23222,23245,23225,23184,23510,23512,23513,23583,23603,23921,23907,23882,23909,23922,23916,23902,23912,23911,23906,24048,24143,24142,24138,24141,24139,24261,24268,24262,24267,24263,24384,24495,24493,24823,24905,24906,24875,24901,24886,24882,24878,24902,24879,24911,24873,24896,25120,37224,25123,25125,25124,25541,25585,25579,25616,25618,25609,25632,25636,25651,25667,25631,25621,25624,25657,25655,25634,25635,25612,25638,25648,25640,25665,25653,25647,25610,25626,25664,25637,25639,25611,25575,25627,25646,25633,25614,25967,26002,26067,26246,26252,26261,26256,26251,26250,26265,26260,26232,26400,26982,26975,26936,26958,26978,26993,26943,26949,26986,26937,26946,26967,26969,27002,26952,26953,26933,26988,26931,26941,26981,26864,27000,26932,26985,26944,26991,26948,26998,26968,26945,26996,26956,26939,26955,26935,26972,26959,26961,26930,26962,26927,27003,26940,27462,27461,27459,27458,27464,27457,27547,64013,27643,27644,27641,27639,27640,28315,28374,28360,28303,28352,28319,28307,28308,28320,28337,28345,28358,28370,28349,28353,28318,28361,28343,28336,28365,28326,28367,28338,28350,28355,28380,28376,28313,28306,28302,28301,28324,28321,28351,28339,28368,28362,28311,28334,28323,28999,29012,29010,29027,29024,28993,29021,29026,29042,29048,29034,29025,28994,29016,28995,29003,29040,29023,29008,29011,28996,29005,29018,29263,29325,29324,29329,29328,29326,29500,29506,29499,29498,29504,29514,29513,29764,29770,29771,29778,29777,29783,29760,29775,29776,29774,29762,29766,29773,29780,29921,29951,29950,29949,29981,30073,30071,27011,30191,30223,30211,30199,30206,30204,30201,30200,30224,30203,30198,30189,30197,30205,30361,30389,30429,30549,30559,30560,30546,30550,30554,30569,30567,30548,30553,30573,30688,30855,30874,30868,30863,30852,30869,30853,30854,30881,30851,30841,30873,30848,30870,30843,31100,31106,31101,31097,31249,31256,31257,31250,31255,31253,31266,31251,31259,31248,31395,31394,31390,31467,31590,31588,31597,31604,31593,31602,31589,31603,31601,31600,31585,31608,31606,31587,31922,31924,31919,32136,32134,32128,32141,32127,32133,32122,32142,32123,32131,32124,32140,32148,32132,32125,32146,32621,32619,32615,32616,32620,32678,32677,32679,32731,32732,32801,33124,33120,33143,33116,33129,33115,33122,33138,26401,33118,33142,33127,33135,33092,33121,33309,33353,33348,33344,33346,33349,34033,33855,33878,33910,33913,33935,33933,33893,33873,33856,33926,33895,33840,33869,33917,33882,33881,33908,33907,33885,34055,33886,33847,33850,33844,33914,33859,33912,33842,33861,33833,33753,33867,33839,33858,33837,33887,33904,33849,33870,33868,33874,33903,33989,33934,33851,33863,33846,33843,33896,33918,33860,33835,33888,33876,33902,33872,34571,34564,34551,34572,34554,34518,34549,34637,34552,34574,34569,34561,34550,34573,34565,35030,35019,35021,35022,35038,35035,35034,35020,35024,35205,35227,35295,35301,35300,35297,35296,35298,35292,35302,35446,35462,35455,35425,35391,35447,35458,35460,35445,35459,35457,35444,35450,35900,35915,35914,35941,35940,35942,35974,35972,35973,36044,36200,36201,36241,36236,36238,36239,36237,36243,36244,36240,36242,36336,36320,36332,36337,36334,36304,36329,36323,36322,36327,36338,36331,36340,36614,36607,36609,36608,36613,36615,36616,36610,36619,36946,36927,36932,36937,36925,37136,37133,37135,37137,37142,37140,37131,37134,37230,37231,37448,37458,37424,37434,37478,37427,37477,37470,37507,37422,37450,37446,37485,37484,37455,37472,37479,37487,37430,37473,37488,37425,37460,37475,37456,37490,37454,37459,37452,37462,37426,38303,38300,38302,38299,38546,38547,38545,38551,38606,38650,38653,38648,38645,38771,38775,38776,38770,38927,38925,38926,39084,39158,39161,39343,39346,39344,39349,39597,39595,39771,40170,40173,40167,40576,40701,20710,20692,20695,20712,20723,20699,20714,20701,20708,20691,20716,20720,20719,20707,20704,20952,21120,21121,21225,21227,21296,21420,22055,22037,22028,22034,22012,22031,22044,22017,22035,22018,22010,22045,22020,22015,22009,22665,22652,22672,22680,22662,22657,22655,22644,22667,22650,22663,22673,22670,22646,22658,22664,22651,22676,22671,22782,22891,23260,23278,23269,23253,23274,23258,23277,23275,23283,23266,23264,23259,23276,23262,23261,23257,23272,23263,23415,23520,23523,23651,23938,23936,23933,23942,23930,23937,23927,23946,23945,23944,23934,23932,23949,23929,23935,24152,24153,24147,24280,24273,24279,24270,24284,24277,24281,24274,24276,24388,24387,24431,24502,24876,24872,24897,24926,24945,24947,24914,24915,24946,24940,24960,24948,24916,24954,24923,24933,24891,24938,24929,24918,25129,25127,25131,25643,25677,25691,25693,25716,25718,25714,25715,25725,25717,25702,25766,25678,25730,25694,25692,25675,25683,25696,25680,25727,25663,25708,25707,25689,25701,25719,25971,26016,26273,26272,26271,26373,26372,26402,27057,27062,27081,27040,27086,27030,27056,27052,27068,27025,27033,27022,27047,27021,27049,27070,27055,27071,27076,27069,27044,27092,27065,27082,27034,27087,27059,27027,27050,27041,27038,27097,27031,27024,27074,27061,27045,27078,27466,27469,27467,27550,27551,27552,27587,27588,27646,28366,28405,28401,28419,28453,28408,28471,28411,28462,28425,28494,28441,28442,28455,28440,28475,28434,28397,28426,28470,28531,28409,28398,28461,28480,28464,28476,28469,28395,28423,28430,28483,28421,28413,28406,28473,28444,28412,28474,28447,28429,28446,28424,28449,29063,29072,29065,29056,29061,29058,29071,29051,29062,29057,29079,29252,29267,29335,29333,29331,29507,29517,29521,29516,29794,29811,29809,29813,29810,29799,29806,29952,29954,29955,30077,30096,30230,30216,30220,30229,30225,30218,30228,30392,30593,30588,30597,30594,30574,30592,30575,30590,30595,30898,30890,30900,30893,30888,30846,30891,30878,30885,30880,30892,30882,30884,31128,31114,31115,31126,31125,31124,31123,31127,31112,31122,31120,31275,31306,31280,31279,31272,31270,31400,31403,31404,31470,31624,31644,31626,31633,31632,31638,31629,31628,31643,31630,31621,31640,21124,31641,31652,31618,31931,31935,31932,31930,32167,32183,32194,32163,32170,32193,32192,32197,32157,32206,32196,32198,32203,32204,32175,32185,32150,32188,32159,32166,32174,32169,32161,32201,32627,32738,32739,32741,32734,32804,32861,32860,33161,33158,33155,33159,33165,33164,33163,33301,33943,33956,33953,33951,33978,33998,33986,33964,33966,33963,33977,33972,33985,33997,33962,33946,33969,34000,33949,33959,33979,33954,33940,33991,33996,33947,33961,33967,33960,34006,33944,33974,33999,33952,34007,34004,34002,34011,33968,33937,34401,34611,34595,34600,34667,34624,34606,34590,34593,34585,34587,34627,34604,34625,34622,34630,34592,34610,34602,34605,34620,34578,34618,34609,34613,34626,34598,34599,34616,34596,34586,34608,34577,35063,35047,35057,35058,35066,35070,35054,35068,35062,35067,35056,35052,35051,35229,35233,35231,35230,35305,35307,35304,35499,35481,35467,35474,35471,35478,35901,35944,35945,36053,36047,36055,36246,36361,36354,36351,36365,36349,36362,36355,36359,36358,36357,36350,36352,36356,36624,36625,36622,36621,37155,37148,37152,37154,37151,37149,37146,37156,37153,37147,37242,37234,37241,37235,37541,37540,37494,37531,37498,37536,37524,37546,37517,37542,37530,37547,37497,37527,37503,37539,37614,37518,37506,37525,37538,37501,37512,37537,37514,37510,37516,37529,37543,37502,37511,37545,37533,37515,37421,38558,38561,38655,38744,38781,38778,38782,38787,38784,38786,38779,38788,38785,38783,38862,38861,38934,39085,39086,39170,39168,39175,39325,39324,39363,39353,39355,39354,39362,39357,39367,39601,39651,39655,39742,39743,39776,39777,39775,40177,40178,40181,40615,20735,20739,20784,20728,20742,20743,20726,20734,20747,20748,20733,20746,21131,21132,21233,21231,22088,22082,22092,22069,22081,22090,22089,22086,22104,22106,22080,22067,22077,22060,22078,22072,22058,22074,22298,22699,22685,22705,22688,22691,22703,22700,22693,22689,22783,23295,23284,23293,23287,23286,23299,23288,23298,23289,23297,23303,23301,23311,23655,23961,23959,23967,23954,23970,23955,23957,23968,23964,23969,23962,23966,24169,24157,24160,24156,32243,24283,24286,24289,24393,24498,24971,24963,24953,25009,25008,24994,24969,24987,24979,25007,25005,24991,24978,25002,24993,24973,24934,25011,25133,25710,25712,25750,25760,25733,25751,25756,25743,25739,25738,25740,25763,25759,25704,25777,25752,25974,25978,25977,25979,26034,26035,26293,26288,26281,26290,26295,26282,26287,27136,27142,27159,27109,27128,27157,27121,27108,27168,27135,27116,27106,27163,27165,27134,27175,27122,27118,27156,27127,27111,27200,27144,27110,27131,27149,27132,27115,27145,27140,27160,27173,27151,27126,27174,27143,27124,27158,27473,27557,27555,27554,27558,27649,27648,27647,27650,28481,28454,28542,28551,28614,28562,28557,28553,28556,28514,28495,28549,28506,28566,28534,28524,28546,28501,28530,28498,28496,28503,28564,28563,28509,28416,28513,28523,28541,28519,28560,28499,28555,28521,28543,28565,28515,28535,28522,28539,29106,29103,29083,29104,29088,29082,29097,29109,29085,29093,29086,29092,29089,29098,29084,29095,29107,29336,29338,29528,29522,29534,29535,29536,29533,29531,29537,29530,29529,29538,29831,29833,29834,29830,29825,29821,29829,29832,29820,29817,29960,29959,30078,30245,30238,30233,30237,30236,30243,30234,30248,30235,30364,30365,30366,30363,30605,30607,30601,30600,30925,30907,30927,30924,30929,30926,30932,30920,30915,30916,30921,31130,31137,31136,31132,31138,31131,27510,31289,31410,31412,31411,31671,31691,31678,31660,31694,31663,31673,31690,31669,31941,31944,31948,31947,32247,32219,32234,32231,32215,32225,32259,32250,32230,32246,32241,32240,32238,32223,32630,32684,32688,32685,32749,32747,32746,32748,32742,32744,32868,32871,33187,33183,33182,33173,33186,33177,33175,33302,33359,33363,33362,33360,33358,33361,34084,34107,34063,34048,34089,34062,34057,34061,34079,34058,34087,34076,34043,34091,34042,34056,34060,34036,34090,34034,34069,34039,34027,34035,34044,34066,34026,34025,34070,34046,34088,34077,34094,34050,34045,34078,34038,34097,34086,34023,34024,34032,34031,34041,34072,34080,34096,34059,34073,34095,34402,34646,34659,34660,34679,34785,34675,34648,34644,34651,34642,34657,34650,34641,34654,34669,34666,34640,34638,34655,34653,34671,34668,34682,34670,34652,34661,34639,34683,34677,34658,34663,34665,34906,35077,35084,35092,35083,35095,35096,35097,35078,35094,35089,35086,35081,35234,35236,35235,35309,35312,35308,35535,35526,35512,35539,35537,35540,35541,35515,35543,35518,35520,35525,35544,35523,35514,35517,35545,35902,35917,35983,36069,36063,36057,36072,36058,36061,36071,36256,36252,36257,36251,36384,36387,36389,36388,36398,36373,36379,36374,36369,36377,36390,36391,36372,36370,36376,36371,36380,36375,36378,36652,36644,36632,36634,36640,36643,36630,36631,36979,36976,36975,36967,36971,37167,37163,37161,37162,37170,37158,37166,37253,37254,37258,37249,37250,37252,37248,37584,37571,37572,37568,37593,37558,37583,37617,37599,37592,37609,37591,37597,37580,37615,37570,37608,37578,37576,37582,37606,37581,37589,37577,37600,37598,37607,37585,37587,37557,37601,37574,37556,38268,38316,38315,38318,38320,38564,38562,38611,38661,38664,38658,38746,38794,38798,38792,38864,38863,38942,38941,38950,38953,38952,38944,38939,38951,39090,39176,39162,39185,39188,39190,39191,39189,39388,39373,39375,39379,39380,39374,39369,39382,39384,39371,39383,39372,39603,39660,39659,39667,39666,39665,39750,39747,39783,39796,39793,39782,39798,39797,39792,39784,39780,39788,40188,40186,40189,40191,40183,40199,40192,40185,40187,40200,40197,40196,40579,40659,40719,40720,20764,20755,20759,20762,20753,20958,21300,21473,22128,22112,22126,22131,22118,22115,22125,22130,22110,22135,22300,22299,22728,22717,22729,22719,22714,22722,22716,22726,23319,23321,23323,23329,23316,23315,23312,23318,23336,23322,23328,23326,23535,23980,23985,23977,23975,23989,23984,23982,23978,23976,23986,23981,23983,23988,24167,24168,24166,24175,24297,24295,24294,24296,24293,24395,24508,24989,25000,24982,25029,25012,25030,25025,25036,25018,25023,25016,24972,25815,25814,25808,25807,25801,25789,25737,25795,25819,25843,25817,25907,25983,25980,26018,26312,26302,26304,26314,26315,26319,26301,26299,26298,26316,26403,27188,27238,27209,27239,27186,27240,27198,27229,27245,27254,27227,27217,27176,27226,27195,27199,27201,27242,27236,27216,27215,27220,27247,27241,27232,27196,27230,27222,27221,27213,27214,27206,27477,27476,27478,27559,27562,27563,27592,27591,27652,27651,27654,28589,28619,28579,28615,28604,28622,28616,28510,28612,28605,28574,28618,28584,28676,28581,28590,28602,28588,28586,28623,28607,28600,28578,28617,28587,28621,28591,28594,28592,29125,29122,29119,29112,29142,29120,29121,29131,29140,29130,29127,29135,29117,29144,29116,29126,29146,29147,29341,29342,29545,29542,29543,29548,29541,29547,29546,29823,29850,29856,29844,29842,29845,29857,29963,30080,30255,30253,30257,30269,30259,30268,30261,30258,30256,30395,30438,30618,30621,30625,30620,30619,30626,30627,30613,30617,30615,30941,30953,30949,30954,30942,30947,30939,30945,30946,30957,30943,30944,31140,31300,31304,31303,31414,31416,31413,31409,31415,31710,31715,31719,31709,31701,31717,31706,31720,31737,31700,31722,31714,31708,31723,31704,31711,31954,31956,31959,31952,31953,32274,32289,32279,32268,32287,32288,32275,32270,32284,32277,32282,32290,32267,32271,32278,32269,32276,32293,32292,32579,32635,32636,32634,32689,32751,32810,32809,32876,33201,33190,33198,33209,33205,33195,33200,33196,33204,33202,33207,33191,33266,33365,33366,33367,34134,34117,34155,34125,34131,34145,34136,34112,34118,34148,34113,34146,34116,34129,34119,34147,34110,34139,34161,34126,34158,34165,34133,34151,34144,34188,34150,34141,34132,34149,34156,34403,34405,34404,34715,34703,34711,34707,34706,34696,34689,34710,34712,34681,34695,34723,34693,34704,34705,34717,34692,34708,34716,34714,34697,35102,35110,35120,35117,35118,35111,35121,35106,35113,35107,35119,35116,35103,35313,35552,35554,35570,35572,35573,35549,35604,35556,35551,35568,35528,35550,35553,35560,35583,35567,35579,35985,35986,35984,36085,36078,36081,36080,36083,36204,36206,36261,36263,36403,36414,36408,36416,36421,36406,36412,36413,36417,36400,36415,36541,36662,36654,36661,36658,36665,36663,36660,36982,36985,36987,36998,37114,37171,37173,37174,37267,37264,37265,37261,37263,37671,37662,37640,37663,37638,37647,37754,37688,37692,37659,37667,37650,37633,37702,37677,37646,37645,37579,37661,37626,37669,37651,37625,37623,37684,37634,37668,37631,37673,37689,37685,37674,37652,37644,37643,37630,37641,37632,37627,37654,38332,38349,38334,38329,38330,38326,38335,38325,38333,38569,38612,38667,38674,38672,38809,38807,38804,38896,38904,38965,38959,38962,39204,39199,39207,39209,39326,39406,39404,39397,39396,39408,39395,39402,39401,39399,39609,39615,39604,39611,39670,39674,39673,39671,39731,39808,39813,39815,39804,39806,39803,39810,39827,39826,39824,39802,39829,39805,39816,40229,40215,40224,40222,40212,40233,40221,40216,40226,40208,40217,40223,40584,40582,40583,40622,40621,40661,40662,40698,40722,40765,20774,20773,20770,20772,20768,20777,21236,22163,22156,22157,22150,22148,22147,22142,22146,22143,22145,22742,22740,22735,22738,23341,23333,23346,23331,23340,23335,23334,23343,23342,23419,23537,23538,23991,24172,24170,24510,24507,25027,25013,25020,25063,25056,25061,25060,25064,25054,25839,25833,25827,25835,25828,25832,25985,25984,26038,26074,26322,27277,27286,27265,27301,27273,27295,27291,27297,27294,27271,27283,27278,27285,27267,27304,27300,27281,27263,27302,27290,27269,27276,27282,27483,27565,27657,28620,28585,28660,28628,28643,28636,28653,28647,28646,28638,28658,28637,28642,28648,29153,29169,29160,29170,29156,29168,29154,29555,29550,29551,29847,29874,29867,29840,29866,29869,29873,29861,29871,29968,29969,29970,29967,30084,30275,30280,30281,30279,30372,30441,30645,30635,30642,30647,30646,30644,30641,30632,30704,30963,30973,30978,30971,30972,30962,30981,30969,30974,30980,31147,31144,31324,31323,31318,31320,31316,31322,31422,31424,31425,31749,31759,31730,31744,31743,31739,31758,31732,31755,31731,31746,31753,31747,31745,31736,31741,31750,31728,31729,31760,31754,31976,32301,32316,32322,32307,38984,32312,32298,32329,32320,32327,32297,32332,32304,32315,32310,32324,32314,32581,32639,32638,32637,32756,32754,32812,33211,33220,33228,33226,33221,33223,33212,33257,33371,33370,33372,34179,34176,34191,34215,34197,34208,34187,34211,34171,34212,34202,34206,34167,34172,34185,34209,34170,34168,34135,34190,34198,34182,34189,34201,34205,34177,34210,34178,34184,34181,34169,34166,34200,34192,34207,34408,34750,34730,34733,34757,34736,34732,34745,34741,34748,34734,34761,34755,34754,34764,34743,34735,34756,34762,34740,34742,34751,34744,34749,34782,34738,35125,35123,35132,35134,35137,35154,35127,35138,35245,35247,35246,35314,35315,35614,35608,35606,35601,35589,35595,35618,35599,35602,35605,35591,35597,35592,35590,35612,35603,35610,35919,35952,35954,35953,35951,35989,35988,36089,36207,36430,36429,36435,36432,36428,36423,36675,36672,36997,36990,37176,37274,37282,37275,37273,37279,37281,37277,37280,37793,37763,37807,37732,37718,37703,37756,37720,37724,37750,37705,37712,37713,37728,37741,37775,37708,37738,37753,37719,37717,37714,37711,37745,37751,37755,37729,37726,37731,37735,37760,37710,37721,38343,38336,38345,38339,38341,38327,38574,38576,38572,38688,38687,38680,38685,38681,38810,38817,38812,38814,38813,38869,38868,38897,38977,38980,38986,38985,38981,38979,39205,39211,39212,39210,39219,39218,39215,39213,39217,39216,39320,39331,39329,39426,39418,39412,39415,39417,39416,39414,39419,39421,39422,39420,39427,39614,39678,39677,39681,39676,39752,39834,39848,39838,39835,39846,39841,39845,39844,39814,39842,39840,39855,40243,40257,40295,40246,40238,40239,40241,40248,40240,40261,40258,40259,40254,40247,40256,40253,32757,40237,40586,40585,40589,40624,40648,40666,40699,40703,40740,40739,40738,40788,40864,20785,20781,20782,22168,22172,22167,22170,22173,22169,22896,23356,23657,23658,24000,24173,24174,25048,25055,25069,25070,25073,25066,25072,25067,25046,25065,25855,25860,25853,25848,25857,25859,25852,26004,26075,26330,26331,26328,27333,27321,27325,27361,27334,27322,27318,27319,27335,27316,27309,27486,27593,27659,28679,28684,28685,28673,28677,28692,28686,28671,28672,28667,28710,28668,28663,28682,29185,29183,29177,29187,29181,29558,29880,29888,29877,29889,29886,29878,29883,29890,29972,29971,30300,30308,30297,30288,30291,30295,30298,30374,30397,30444,30658,30650,30975,30988,30995,30996,30985,30992,30994,30993,31149,31148,31327,31772,31785,31769,31776,31775,31789,31773,31782,31784,31778,31781,31792,32348,32336,32342,32355,32344,32354,32351,32337,32352,32343,32339,32693,32691,32759,32760,32885,33233,33234,33232,33375,33374,34228,34246,34240,34243,34242,34227,34229,34237,34247,34244,34239,34251,34254,34248,34245,34225,34230,34258,34340,34232,34231,34238,34409,34791,34790,34786,34779,34795,34794,34789,34783,34803,34788,34772,34780,34771,34797,34776,34787,34724,34775,34777,34817,34804,34792,34781,35155,35147,35151,35148,35142,35152,35153,35145,35626,35623,35619,35635,35632,35637,35655,35631,35644,35646,35633,35621,35639,35622,35638,35630,35620,35643,35645,35642,35906,35957,35993,35992,35991,36094,36100,36098,36096,36444,36450,36448,36439,36438,36446,36453,36455,36443,36442,36449,36445,36457,36436,36678,36679,36680,36683,37160,37178,37179,37182,37288,37285,37287,37295,37290,37813,37772,37778,37815,37787,37789,37769,37799,37774,37802,37790,37798,37781,37768,37785,37791,37773,37809,37777,37810,37796,37800,37812,37795,37797,38354,38355,38353,38579,38615,38618,24002,38623,38616,38621,38691,38690,38693,38828,38830,38824,38827,38820,38826,38818,38821,38871,38873,38870,38872,38906,38992,38993,38994,39096,39233,39228,39226,39439,39435,39433,39437,39428,39441,39434,39429,39431,39430,39616,39644,39688,39684,39685,39721,39733,39754,39756,39755,39879,39878,39875,39871,39873,39861,39864,39891,39862,39876,39865,39869,40284,40275,40271,40266,40283,40267,40281,40278,40268,40279,40274,40276,40287,40280,40282,40590,40588,40671,40705,40704,40726,40741,40747,40746,40745,40744,40780,40789,20788,20789,21142,21239,21428,22187,22189,22182,22183,22186,22188,22746,22749,22747,22802,23357,23358,23359,24003,24176,24511,25083,25863,25872,25869,25865,25868,25870,25988,26078,26077,26334,27367,27360,27340,27345,27353,27339,27359,27356,27344,27371,27343,27341,27358,27488,27568,27660,28697,28711,28704,28694,28715,28705,28706,28707,28713,28695,28708,28700,28714,29196,29194,29191,29186,29189,29349,29350,29348,29347,29345,29899,29893,29879,29891,29974,30304,30665,30666,30660,30705,31005,31003,31009,31004,30999,31006,31152,31335,31336,31795,31804,31801,31788,31803,31980,31978,32374,32373,32376,32368,32375,32367,32378,32370,32372,32360,32587,32586,32643,32646,32695,32765,32766,32888,33239,33237,33380,33377,33379,34283,34289,34285,34265,34273,34280,34266,34263,34284,34290,34296,34264,34271,34275,34268,34257,34288,34278,34287,34270,34274,34816,34810,34819,34806,34807,34825,34828,34827,34822,34812,34824,34815,34826,34818,35170,35162,35163,35159,35169,35164,35160,35165,35161,35208,35255,35254,35318,35664,35656,35658,35648,35667,35670,35668,35659,35669,35665,35650,35666,35671,35907,35959,35958,35994,36102,36103,36105,36268,36266,36269,36267,36461,36472,36467,36458,36463,36475,36546,36690,36689,36687,36688,36691,36788,37184,37183,37296,37293,37854,37831,37839,37826,37850,37840,37881,37868,37836,37849,37801,37862,37834,37844,37870,37859,37845,37828,37838,37824,37842,37863,38269,38362,38363,38625,38697,38699,38700,38696,38694,38835,38839,38838,38877,38878,38879,39004,39001,39005,38999,39103,39101,39099,39102,39240,39239,39235,39334,39335,39450,39445,39461,39453,39460,39451,39458,39456,39463,39459,39454,39452,39444,39618,39691,39690,39694,39692,39735,39914,39915,39904,39902,39908,39910,39906,39920,39892,39895,39916,39900,39897,39909,39893,39905,39898,40311,40321,40330,40324,40328,40305,40320,40312,40326,40331,40332,40317,40299,40308,40309,40304,40297,40325,40307,40315,40322,40303,40313,40319,40327,40296,40596,40593,40640,40700,40749,40768,40769,40781,40790,40791,40792,21303,22194,22197,22195,22755,23365,24006,24007,24302,24303,24512,24513,25081,25879,25878,25877,25875,26079,26344,26339,26340,27379,27376,27370,27368,27385,27377,27374,27375,28732,28725,28719,28727,28724,28721,28738,28728,28735,28730,28729,28736,28731,28723,28737,29203,29204,29352,29565,29564,29882,30379,30378,30398,30445,30668,30670,30671,30669,30706,31013,31011,31015,31016,31012,31017,31154,31342,31340,31341,31479,31817,31816,31818,31815,31813,31982,32379,32382,32385,32384,32698,32767,32889,33243,33241,33291,33384,33385,34338,34303,34305,34302,34331,34304,34294,34308,34313,34309,34316,34301,34841,34832,34833,34839,34835,34838,35171,35174,35257,35319,35680,35690,35677,35688,35683,35685,35687,35693,36270,36486,36488,36484,36697,36694,36695,36693,36696,36698,37005,37187,37185,37303,37301,37298,37299,37899,37907,37883,37920,37903,37908,37886,37909,37904,37928,37913,37901,37877,37888,37879,37895,37902,37910,37906,37882,37897,37880,37898,37887,37884,37900,37878,37905,37894,38366,38368,38367,38702,38703,38841,38843,38909,38910,39008,39010,39011,39007,39105,39106,39248,39246,39257,39244,39243,39251,39474,39476,39473,39468,39466,39478,39465,39470,39480,39469,39623,39626,39622,39696,39698,39697,39947,39944,39927,39941,39954,39928,40000,39943,39950,39942,39959,39956,39945,40351,40345,40356,40349,40338,40344,40336,40347,40352,40340,40348,40362,40343,40353,40346,40354,40360,40350,40355,40383,40361,40342,40358,40359,40601,40603,40602,40677,40676,40679,40678,40752,40750,40795,40800,40798,40797,40793,40849,20794,20793,21144,21143,22211,22205,22206,23368,23367,24011,24015,24305,25085,25883,27394,27388,27395,27384,27392,28739,28740,28746,28744,28745,28741,28742,29213,29210,29209,29566,29975,30314,30672,31021,31025,31023,31828,31827,31986,32394,32391,32392,32395,32390,32397,32589,32699,32816,33245,34328,34346,34342,34335,34339,34332,34329,34343,34350,34337,34336,34345,34334,34341,34857,34845,34843,34848,34852,34844,34859,34890,35181,35177,35182,35179,35322,35705,35704,35653,35706,35707,36112,36116,36271,36494,36492,36702,36699,36701,37190,37188,37189,37305,37951,37947,37942,37929,37949,37948,37936,37945,37930,37943,37932,37952,37937,38373,38372,38371,38709,38714,38847,38881,39012,39113,39110,39104,39256,39254,39481,39485,39494,39492,39490,39489,39482,39487,39629,39701,39703,39704,39702,39738,39762,39979,39965,39964,39980,39971,39976,39977,39972,39969,40375,40374,40380,40385,40391,40394,40399,40382,40389,40387,40379,40373,40398,40377,40378,40364,40392,40369,40365,40396,40371,40397,40370,40570,40604,40683,40686,40685,40731,40728,40730,40753,40782,40805,40804,40850,20153,22214,22213,22219,22897,23371,23372,24021,24017,24306,25889,25888,25894,25890,27403,27400,27401,27661,28757,28758,28759,28754,29214,29215,29353,29567,29912,29909,29913,29911,30317,30381,31029,31156,31344,31345,31831,31836,31833,31835,31834,31988,31985,32401,32591,32647,33246,33387,34356,34357,34355,34348,34354,34358,34860,34856,34854,34858,34853,35185,35263,35262,35323,35710,35716,35714,35718,35717,35711,36117,36501,36500,36506,36498,36496,36502,36503,36704,36706,37191,37964,37968,37962,37963,37967,37959,37957,37960,37961,37958,38719,38883,39018,39017,39115,39252,39259,39502,39507,39508,39500,39503,39496,39498,39497,39506,39504,39632,39705,39723,39739,39766,39765,40006,40008,39999,40004,39993,39987,40001,39996,39991,39988,39986,39997,39990,40411,40402,40414,40410,40395,40400,40412,40401,40415,40425,40409,40408,40406,40437,40405,40413,40630,40688,40757,40755,40754,40770,40811,40853,40866,20797,21145,22760,22759,22898,23373,24024,34863,24399,25089,25091,25092,25897,25893,26006,26347,27409,27410,27407,27594,28763,28762,29218,29570,29569,29571,30320,30676,31847,31846,32405,33388,34362,34368,34361,34364,34353,34363,34366,34864,34866,34862,34867,35190,35188,35187,35326,35724,35726,35723,35720,35909,36121,36504,36708,36707,37308,37986,37973,37981,37975,37982,38852,38853,38912,39510,39513,39710,39711,39712,40018,40024,40016,40010,40013,40011,40021,40025,40012,40014,40443,40439,40431,40419,40427,40440,40420,40438,40417,40430,40422,40434,40432,40418,40428,40436,40435,40424,40429,40642,40656,40690,40691,40710,40732,40760,40759,40758,40771,40783,40817,40816,40814,40815,22227,22221,23374,23661,25901,26349,26350,27411,28767,28769,28765,28768,29219,29915,29925,30677,31032,31159,31158,31850,32407,32649,33389,34371,34872,34871,34869,34891,35732,35733,36510,36511,36512,36509,37310,37309,37314,37995,37992,37993,38629,38726,38723,38727,38855,38885,39518,39637,39769,40035,40039,40038,40034,40030,40032,40450,40446,40455,40451,40454,40453,40448,40449,40457,40447,40445,40452,40608,40734,40774,40820,40821,40822,22228,25902,26040,27416,27417,27415,27418,28770,29222,29354,30680,30681,31033,31849,31851,31990,32410,32408,32411,32409,33248,33249,34374,34375,34376,35193,35194,35196,35195,35327,35736,35737,36517,36516,36515,37998,37997,37999,38001,38003,38729,39026,39263,40040,40046,40045,40459,40461,40464,40463,40466,40465,40609,40693,40713,40775,40824,40827,40826,40825,22302,28774,31855,34876,36274,36518,37315,38004,38008,38006,38005,39520,40052,40051,40049,40053,40468,40467,40694,40714,40868,28776,28773,31991,34410,34878,34877,34879,35742,35996,36521,36553,38731,39027,39028,39116,39265,39339,39524,39526,39527,39716,40469,40471,40776,25095,27422,29223,34380,36520,38018,38016,38017,39529,39528,39726,40473,29225,34379,35743,38019,40057,40631,30325,39531,40058,40477,28777,28778,40612,40830,40777,40856,30849,37561,35023,22715,24658,31911,23290,9556,9574,9559,9568,9580,9571,9562,9577,9565,9554,9572,9557,9566,9578,9569,9560,9575,9563,9555,9573,9558,9567,9579,9570,9561,9576,9564,9553,9552,9581,9582,9584,9583,65517,132423,37595,132575,147397,34124,17077,29679,20917,13897,149826,166372,37700,137691,33518,146632,30780,26436,25311,149811,166314,131744,158643,135941,20395,140525,20488,159017,162436,144896,150193,140563,20521,131966,24484,131968,131911,28379,132127,20605,20737,13434,20750,39020,14147,33814,149924,132231,20832,144308,20842,134143,139516,131813,140592,132494,143923,137603,23426,34685,132531,146585,20914,20920,40244,20937,20943,20945,15580,20947,150182,20915,20962,21314,20973,33741,26942,145197,24443,21003,21030,21052,21173,21079,21140,21177,21189,31765,34114,21216,34317,158483,21253,166622,21833,28377,147328,133460,147436,21299,21316,134114,27851,136998,26651,29653,24650,16042,14540,136936,29149,17570,21357,21364,165547,21374,21375,136598,136723,30694,21395,166555,21408,21419,21422,29607,153458,16217,29596,21441,21445,27721,20041,22526,21465,15019,134031,21472,147435,142755,21494,134263,21523,28793,21803,26199,27995,21613,158547,134516,21853,21647,21668,18342,136973,134877,15796,134477,166332,140952,21831,19693,21551,29719,21894,21929,22021,137431,147514,17746,148533,26291,135348,22071,26317,144010,26276,26285,22093,22095,30961,22257,38791,21502,22272,22255,22253,166758,13859,135759,22342,147877,27758,28811,22338,14001,158846,22502,136214,22531,136276,148323,22566,150517,22620,22698,13665,22752,22748,135740,22779,23551,22339,172368,148088,37843,13729,22815,26790,14019,28249,136766,23076,21843,136850,34053,22985,134478,158849,159018,137180,23001,137211,137138,159142,28017,137256,136917,23033,159301,23211,23139,14054,149929,23159,14088,23190,29797,23251,159649,140628,15749,137489,14130,136888,24195,21200,23414,25992,23420,162318,16388,18525,131588,23509,24928,137780,154060,132517,23539,23453,19728,23557,138052,23571,29646,23572,138405,158504,23625,18653,23685,23785,23791,23947,138745,138807,23824,23832,23878,138916,23738,24023,33532,14381,149761,139337,139635,33415,14390,15298,24110,27274,24181,24186,148668,134355,21414,20151,24272,21416,137073,24073,24308,164994,24313,24315,14496,24316,26686,37915,24333,131521,194708,15070,18606,135994,24378,157832,140240,24408,140401,24419,38845,159342,24434,37696,166454,24487,23990,15711,152144,139114,159992,140904,37334,131742,166441,24625,26245,137335,14691,15815,13881,22416,141236,31089,15936,24734,24740,24755,149890,149903,162387,29860,20705,23200,24932,33828,24898,194726,159442,24961,20980,132694,24967,23466,147383,141407,25043,166813,170333,25040,14642,141696,141505,24611,24924,25886,25483,131352,25285,137072,25301,142861,25452,149983,14871,25656,25592,136078,137212,25744,28554,142902,38932,147596,153373,25825,25829,38011,14950,25658,14935,25933,28438,150056,150051,25989,25965,25951,143486,26037,149824,19255,26065,16600,137257,26080,26083,24543,144384,26136,143863,143864,26180,143780,143781,26187,134773,26215,152038,26227,26228,138813,143921,165364,143816,152339,30661,141559,39332,26370,148380,150049,15147,27130,145346,26462,26471,26466,147917,168173,26583,17641,26658,28240,37436,26625,144358,159136,26717,144495,27105,27147,166623,26995,26819,144845,26881,26880,15666,14849,144956,15232,26540,26977,166474,17148,26934,27032,15265,132041,33635,20624,27129,144985,139562,27205,145155,27293,15347,26545,27336,168348,15373,27421,133411,24798,27445,27508,141261,28341,146139,132021,137560,14144,21537,146266,27617,147196,27612,27703,140427,149745,158545,27738,33318,27769,146876,17605,146877,147876,149772,149760,146633,14053,15595,134450,39811,143865,140433,32655,26679,159013,159137,159211,28054,27996,28284,28420,149887,147589,159346,34099,159604,20935,27804,28189,33838,166689,28207,146991,29779,147330,31180,28239,23185,143435,28664,14093,28573,146992,28410,136343,147517,17749,37872,28484,28508,15694,28532,168304,15675,28575,147780,28627,147601,147797,147513,147440,147380,147775,20959,147798,147799,147776,156125,28747,28798,28839,28801,28876,28885,28886,28895,16644,15848,29108,29078,148087,28971,28997,23176,29002,29038,23708,148325,29007,37730,148161,28972,148570,150055,150050,29114,166888,28861,29198,37954,29205,22801,37955,29220,37697,153093,29230,29248,149876,26813,29269,29271,15957,143428,26637,28477,29314,29482,29483,149539,165931,18669,165892,29480,29486,29647,29610,134202,158254,29641,29769,147938,136935,150052,26147,14021,149943,149901,150011,29687,29717,26883,150054,29753,132547,16087,29788,141485,29792,167602,29767,29668,29814,33721,29804,14128,29812,37873,27180,29826,18771,150156,147807,150137,166799,23366,166915,137374,29896,137608,29966,29929,29982,167641,137803,23511,167596,37765,30029,30026,30055,30062,151426,16132,150803,30094,29789,30110,30132,30210,30252,30289,30287,30319,30326,156661,30352,33263,14328,157969,157966,30369,30373,30391,30412,159647,33890,151709,151933,138780,30494,30502,30528,25775,152096,30552,144044,30639,166244,166248,136897,30708,30729,136054,150034,26826,30895,30919,30931,38565,31022,153056,30935,31028,30897,161292,36792,34948,166699,155779,140828,31110,35072,26882,31104,153687,31133,162617,31036,31145,28202,160038,16040,31174,168205,31188], + "euc-kr":[44034,44035,44037,44038,44043,44044,44045,44046,44047,44056,44062,44063,44065,44066,44067,44069,44070,44071,44072,44073,44074,44075,44078,44082,44083,44084,null,null,null,null,null,null,44085,44086,44087,44090,44091,44093,44094,44095,44097,44098,44099,44100,44101,44102,44103,44104,44105,44106,44108,44110,44111,44112,44113,44114,44115,44117,null,null,null,null,null,null,44118,44119,44121,44122,44123,44125,44126,44127,44128,44129,44130,44131,44132,44133,44134,44135,44136,44137,44138,44139,44140,44141,44142,44143,44146,44147,44149,44150,44153,44155,44156,44157,44158,44159,44162,44167,44168,44173,44174,44175,44177,44178,44179,44181,44182,44183,44184,44185,44186,44187,44190,44194,44195,44196,44197,44198,44199,44203,44205,44206,44209,44210,44211,44212,44213,44214,44215,44218,44222,44223,44224,44226,44227,44229,44230,44231,44233,44234,44235,44237,44238,44239,44240,44241,44242,44243,44244,44246,44248,44249,44250,44251,44252,44253,44254,44255,44258,44259,44261,44262,44265,44267,44269,44270,44274,44276,44279,44280,44281,44282,44283,44286,44287,44289,44290,44291,44293,44295,44296,44297,44298,44299,44302,44304,44306,44307,44308,44309,44310,44311,44313,44314,44315,44317,44318,44319,44321,44322,44323,44324,44325,44326,44327,44328,44330,44331,44334,44335,44336,44337,44338,44339,null,null,null,null,null,null,44342,44343,44345,44346,44347,44349,44350,44351,44352,44353,44354,44355,44358,44360,44362,44363,44364,44365,44366,44367,44369,44370,44371,44373,44374,44375,null,null,null,null,null,null,44377,44378,44379,44380,44381,44382,44383,44384,44386,44388,44389,44390,44391,44392,44393,44394,44395,44398,44399,44401,44402,44407,44408,44409,44410,44414,44416,44419,44420,44421,44422,44423,44426,44427,44429,44430,44431,44433,44434,44435,44436,44437,44438,44439,44440,44441,44442,44443,44446,44447,44448,44449,44450,44451,44453,44454,44455,44456,44457,44458,44459,44460,44461,44462,44463,44464,44465,44466,44467,44468,44469,44470,44472,44473,44474,44475,44476,44477,44478,44479,44482,44483,44485,44486,44487,44489,44490,44491,44492,44493,44494,44495,44498,44500,44501,44502,44503,44504,44505,44506,44507,44509,44510,44511,44513,44514,44515,44517,44518,44519,44520,44521,44522,44523,44524,44525,44526,44527,44528,44529,44530,44531,44532,44533,44534,44535,44538,44539,44541,44542,44546,44547,44548,44549,44550,44551,44554,44556,44558,44559,44560,44561,44562,44563,44565,44566,44567,44568,44569,44570,44571,44572,null,null,null,null,null,null,44573,44574,44575,44576,44577,44578,44579,44580,44581,44582,44583,44584,44585,44586,44587,44588,44589,44590,44591,44594,44595,44597,44598,44601,44603,44604,null,null,null,null,null,null,44605,44606,44607,44610,44612,44615,44616,44617,44619,44623,44625,44626,44627,44629,44631,44632,44633,44634,44635,44638,44642,44643,44644,44646,44647,44650,44651,44653,44654,44655,44657,44658,44659,44660,44661,44662,44663,44666,44670,44671,44672,44673,44674,44675,44678,44679,44680,44681,44682,44683,44685,44686,44687,44688,44689,44690,44691,44692,44693,44694,44695,44696,44697,44698,44699,44700,44701,44702,44703,44704,44705,44706,44707,44708,44709,44710,44711,44712,44713,44714,44715,44716,44717,44718,44719,44720,44721,44722,44723,44724,44725,44726,44727,44728,44729,44730,44731,44735,44737,44738,44739,44741,44742,44743,44744,44745,44746,44747,44750,44754,44755,44756,44757,44758,44759,44762,44763,44765,44766,44767,44768,44769,44770,44771,44772,44773,44774,44775,44777,44778,44780,44782,44783,44784,44785,44786,44787,44789,44790,44791,44793,44794,44795,44797,44798,44799,44800,44801,44802,44803,44804,44805,null,null,null,null,null,null,44806,44809,44810,44811,44812,44814,44815,44817,44818,44819,44820,44821,44822,44823,44824,44825,44826,44827,44828,44829,44830,44831,44832,44833,44834,44835,null,null,null,null,null,null,44836,44837,44838,44839,44840,44841,44842,44843,44846,44847,44849,44851,44853,44854,44855,44856,44857,44858,44859,44862,44864,44868,44869,44870,44871,44874,44875,44876,44877,44878,44879,44881,44882,44883,44884,44885,44886,44887,44888,44889,44890,44891,44894,44895,44896,44897,44898,44899,44902,44903,44904,44905,44906,44907,44908,44909,44910,44911,44912,44913,44914,44915,44916,44917,44918,44919,44920,44922,44923,44924,44925,44926,44927,44929,44930,44931,44933,44934,44935,44937,44938,44939,44940,44941,44942,44943,44946,44947,44948,44950,44951,44952,44953,44954,44955,44957,44958,44959,44960,44961,44962,44963,44964,44965,44966,44967,44968,44969,44970,44971,44972,44973,44974,44975,44976,44977,44978,44979,44980,44981,44982,44983,44986,44987,44989,44990,44991,44993,44994,44995,44996,44997,44998,45002,45004,45007,45008,45009,45010,45011,45013,45014,45015,45016,45017,45018,45019,45021,45022,45023,45024,45025,null,null,null,null,null,null,45026,45027,45028,45029,45030,45031,45034,45035,45036,45037,45038,45039,45042,45043,45045,45046,45047,45049,45050,45051,45052,45053,45054,45055,45058,45059,null,null,null,null,null,null,45061,45062,45063,45064,45065,45066,45067,45069,45070,45071,45073,45074,45075,45077,45078,45079,45080,45081,45082,45083,45086,45087,45088,45089,45090,45091,45092,45093,45094,45095,45097,45098,45099,45100,45101,45102,45103,45104,45105,45106,45107,45108,45109,45110,45111,45112,45113,45114,45115,45116,45117,45118,45119,45120,45121,45122,45123,45126,45127,45129,45131,45133,45135,45136,45137,45138,45142,45144,45146,45147,45148,45150,45151,45152,45153,45154,45155,45156,45157,45158,45159,45160,45161,45162,45163,45164,45165,45166,45167,45168,45169,45170,45171,45172,45173,45174,45175,45176,45177,45178,45179,45182,45183,45185,45186,45187,45189,45190,45191,45192,45193,45194,45195,45198,45200,45202,45203,45204,45205,45206,45207,45211,45213,45214,45219,45220,45221,45222,45223,45226,45232,45234,45238,45239,45241,45242,45243,45245,45246,45247,45248,45249,45250,45251,45254,45258,45259,45260,45261,45262,45263,45266,null,null,null,null,null,null,45267,45269,45270,45271,45273,45274,45275,45276,45277,45278,45279,45281,45282,45283,45284,45286,45287,45288,45289,45290,45291,45292,45293,45294,45295,45296,null,null,null,null,null,null,45297,45298,45299,45300,45301,45302,45303,45304,45305,45306,45307,45308,45309,45310,45311,45312,45313,45314,45315,45316,45317,45318,45319,45322,45325,45326,45327,45329,45332,45333,45334,45335,45338,45342,45343,45344,45345,45346,45350,45351,45353,45354,45355,45357,45358,45359,45360,45361,45362,45363,45366,45370,45371,45372,45373,45374,45375,45378,45379,45381,45382,45383,45385,45386,45387,45388,45389,45390,45391,45394,45395,45398,45399,45401,45402,45403,45405,45406,45407,45409,45410,45411,45412,45413,45414,45415,45416,45417,45418,45419,45420,45421,45422,45423,45424,45425,45426,45427,45428,45429,45430,45431,45434,45435,45437,45438,45439,45441,45443,45444,45445,45446,45447,45450,45452,45454,45455,45456,45457,45461,45462,45463,45465,45466,45467,45469,45470,45471,45472,45473,45474,45475,45476,45477,45478,45479,45481,45482,45483,45484,45485,45486,45487,45488,45489,45490,45491,45492,45493,45494,45495,45496,null,null,null,null,null,null,45497,45498,45499,45500,45501,45502,45503,45504,45505,45506,45507,45508,45509,45510,45511,45512,45513,45514,45515,45517,45518,45519,45521,45522,45523,45525,null,null,null,null,null,null,45526,45527,45528,45529,45530,45531,45534,45536,45537,45538,45539,45540,45541,45542,45543,45546,45547,45549,45550,45551,45553,45554,45555,45556,45557,45558,45559,45560,45562,45564,45566,45567,45568,45569,45570,45571,45574,45575,45577,45578,45581,45582,45583,45584,45585,45586,45587,45590,45592,45594,45595,45596,45597,45598,45599,45601,45602,45603,45604,45605,45606,45607,45608,45609,45610,45611,45612,45613,45614,45615,45616,45617,45618,45619,45621,45622,45623,45624,45625,45626,45627,45629,45630,45631,45632,45633,45634,45635,45636,45637,45638,45639,45640,45641,45642,45643,45644,45645,45646,45647,45648,45649,45650,45651,45652,45653,45654,45655,45657,45658,45659,45661,45662,45663,45665,45666,45667,45668,45669,45670,45671,45674,45675,45676,45677,45678,45679,45680,45681,45682,45683,45686,45687,45688,45689,45690,45691,45693,45694,45695,45696,45697,45698,45699,45702,45703,45704,45706,45707,45708,45709,45710,null,null,null,null,null,null,45711,45714,45715,45717,45718,45719,45723,45724,45725,45726,45727,45730,45732,45735,45736,45737,45739,45741,45742,45743,45745,45746,45747,45749,45750,45751,null,null,null,null,null,null,45752,45753,45754,45755,45756,45757,45758,45759,45760,45761,45762,45763,45764,45765,45766,45767,45770,45771,45773,45774,45775,45777,45779,45780,45781,45782,45783,45786,45788,45790,45791,45792,45793,45795,45799,45801,45802,45808,45809,45810,45814,45820,45821,45822,45826,45827,45829,45830,45831,45833,45834,45835,45836,45837,45838,45839,45842,45846,45847,45848,45849,45850,45851,45853,45854,45855,45856,45857,45858,45859,45860,45861,45862,45863,45864,45865,45866,45867,45868,45869,45870,45871,45872,45873,45874,45875,45876,45877,45878,45879,45880,45881,45882,45883,45884,45885,45886,45887,45888,45889,45890,45891,45892,45893,45894,45895,45896,45897,45898,45899,45900,45901,45902,45903,45904,45905,45906,45907,45911,45913,45914,45917,45920,45921,45922,45923,45926,45928,45930,45932,45933,45935,45938,45939,45941,45942,45943,45945,45946,45947,45948,45949,45950,45951,45954,45958,45959,45960,45961,45962,45963,45965,null,null,null,null,null,null,45966,45967,45969,45970,45971,45973,45974,45975,45976,45977,45978,45979,45980,45981,45982,45983,45986,45987,45988,45989,45990,45991,45993,45994,45995,45997,null,null,null,null,null,null,45998,45999,46000,46001,46002,46003,46004,46005,46006,46007,46008,46009,46010,46011,46012,46013,46014,46015,46016,46017,46018,46019,46022,46023,46025,46026,46029,46031,46033,46034,46035,46038,46040,46042,46044,46046,46047,46049,46050,46051,46053,46054,46055,46057,46058,46059,46060,46061,46062,46063,46064,46065,46066,46067,46068,46069,46070,46071,46072,46073,46074,46075,46077,46078,46079,46080,46081,46082,46083,46084,46085,46086,46087,46088,46089,46090,46091,46092,46093,46094,46095,46097,46098,46099,46100,46101,46102,46103,46105,46106,46107,46109,46110,46111,46113,46114,46115,46116,46117,46118,46119,46122,46124,46125,46126,46127,46128,46129,46130,46131,46133,46134,46135,46136,46137,46138,46139,46140,46141,46142,46143,46144,46145,46146,46147,46148,46149,46150,46151,46152,46153,46154,46155,46156,46157,46158,46159,46162,46163,46165,46166,46167,46169,46170,46171,46172,46173,46174,46175,46178,46180,46182,null,null,null,null,null,null,46183,46184,46185,46186,46187,46189,46190,46191,46192,46193,46194,46195,46196,46197,46198,46199,46200,46201,46202,46203,46204,46205,46206,46207,46209,46210,null,null,null,null,null,null,46211,46212,46213,46214,46215,46217,46218,46219,46220,46221,46222,46223,46224,46225,46226,46227,46228,46229,46230,46231,46232,46233,46234,46235,46236,46238,46239,46240,46241,46242,46243,46245,46246,46247,46249,46250,46251,46253,46254,46255,46256,46257,46258,46259,46260,46262,46264,46266,46267,46268,46269,46270,46271,46273,46274,46275,46277,46278,46279,46281,46282,46283,46284,46285,46286,46287,46289,46290,46291,46292,46294,46295,46296,46297,46298,46299,46302,46303,46305,46306,46309,46311,46312,46313,46314,46315,46318,46320,46322,46323,46324,46325,46326,46327,46329,46330,46331,46332,46333,46334,46335,46336,46337,46338,46339,46340,46341,46342,46343,46344,46345,46346,46347,46348,46349,46350,46351,46352,46353,46354,46355,46358,46359,46361,46362,46365,46366,46367,46368,46369,46370,46371,46374,46379,46380,46381,46382,46383,46386,46387,46389,46390,46391,46393,46394,46395,46396,46397,46398,46399,46402,46406,null,null,null,null,null,null,46407,46408,46409,46410,46414,46415,46417,46418,46419,46421,46422,46423,46424,46425,46426,46427,46430,46434,46435,46436,46437,46438,46439,46440,46441,46442,null,null,null,null,null,null,46443,46444,46445,46446,46447,46448,46449,46450,46451,46452,46453,46454,46455,46456,46457,46458,46459,46460,46461,46462,46463,46464,46465,46466,46467,46468,46469,46470,46471,46472,46473,46474,46475,46476,46477,46478,46479,46480,46481,46482,46483,46484,46485,46486,46487,46488,46489,46490,46491,46492,46493,46494,46495,46498,46499,46501,46502,46503,46505,46508,46509,46510,46511,46514,46518,46519,46520,46521,46522,46526,46527,46529,46530,46531,46533,46534,46535,46536,46537,46538,46539,46542,46546,46547,46548,46549,46550,46551,46553,46554,46555,46556,46557,46558,46559,46560,46561,46562,46563,46564,46565,46566,46567,46568,46569,46570,46571,46573,46574,46575,46576,46577,46578,46579,46580,46581,46582,46583,46584,46585,46586,46587,46588,46589,46590,46591,46592,46593,46594,46595,46596,46597,46598,46599,46600,46601,46602,46603,46604,46605,46606,46607,46610,46611,46613,46614,46615,46617,46618,46619,46620,46621,null,null,null,null,null,null,46622,46623,46624,46625,46626,46627,46628,46630,46631,46632,46633,46634,46635,46637,46638,46639,46640,46641,46642,46643,46645,46646,46647,46648,46649,46650,null,null,null,null,null,null,46651,46652,46653,46654,46655,46656,46657,46658,46659,46660,46661,46662,46663,46665,46666,46667,46668,46669,46670,46671,46672,46673,46674,46675,46676,46677,46678,46679,46680,46681,46682,46683,46684,46685,46686,46687,46688,46689,46690,46691,46693,46694,46695,46697,46698,46699,46700,46701,46702,46703,46704,46705,46706,46707,46708,46709,46710,46711,46712,46713,46714,46715,46716,46717,46718,46719,46720,46721,46722,46723,46724,46725,46726,46727,46728,46729,46730,46731,46732,46733,46734,46735,46736,46737,46738,46739,46740,46741,46742,46743,46744,46745,46746,46747,46750,46751,46753,46754,46755,46757,46758,46759,46760,46761,46762,46765,46766,46767,46768,46770,46771,46772,46773,46774,46775,46776,46777,46778,46779,46780,46781,46782,46783,46784,46785,46786,46787,46788,46789,46790,46791,46792,46793,46794,46795,46796,46797,46798,46799,46800,46801,46802,46803,46805,46806,46807,46808,46809,46810,46811,46812,46813,null,null,null,null,null,null,46814,46815,46816,46817,46818,46819,46820,46821,46822,46823,46824,46825,46826,46827,46828,46829,46830,46831,46833,46834,46835,46837,46838,46839,46841,46842,null,null,null,null,null,null,46843,46844,46845,46846,46847,46850,46851,46852,46854,46855,46856,46857,46858,46859,46860,46861,46862,46863,46864,46865,46866,46867,46868,46869,46870,46871,46872,46873,46874,46875,46876,46877,46878,46879,46880,46881,46882,46883,46884,46885,46886,46887,46890,46891,46893,46894,46897,46898,46899,46900,46901,46902,46903,46906,46908,46909,46910,46911,46912,46913,46914,46915,46917,46918,46919,46921,46922,46923,46925,46926,46927,46928,46929,46930,46931,46934,46935,46936,46937,46938,46939,46940,46941,46942,46943,46945,46946,46947,46949,46950,46951,46953,46954,46955,46956,46957,46958,46959,46962,46964,46966,46967,46968,46969,46970,46971,46974,46975,46977,46978,46979,46981,46982,46983,46984,46985,46986,46987,46990,46995,46996,46997,47002,47003,47005,47006,47007,47009,47010,47011,47012,47013,47014,47015,47018,47022,47023,47024,47025,47026,47027,47030,47031,47033,47034,47035,47036,47037,47038,47039,47040,47041,null,null,null,null,null,null,47042,47043,47044,47045,47046,47048,47050,47051,47052,47053,47054,47055,47056,47057,47058,47059,47060,47061,47062,47063,47064,47065,47066,47067,47068,47069,null,null,null,null,null,null,47070,47071,47072,47073,47074,47075,47076,47077,47078,47079,47080,47081,47082,47083,47086,47087,47089,47090,47091,47093,47094,47095,47096,47097,47098,47099,47102,47106,47107,47108,47109,47110,47114,47115,47117,47118,47119,47121,47122,47123,47124,47125,47126,47127,47130,47132,47134,47135,47136,47137,47138,47139,47142,47143,47145,47146,47147,47149,47150,47151,47152,47153,47154,47155,47158,47162,47163,47164,47165,47166,47167,47169,47170,47171,47173,47174,47175,47176,47177,47178,47179,47180,47181,47182,47183,47184,47186,47188,47189,47190,47191,47192,47193,47194,47195,47198,47199,47201,47202,47203,47205,47206,47207,47208,47209,47210,47211,47214,47216,47218,47219,47220,47221,47222,47223,47225,47226,47227,47229,47230,47231,47232,47233,47234,47235,47236,47237,47238,47239,47240,47241,47242,47243,47244,47246,47247,47248,47249,47250,47251,47252,47253,47254,47255,47256,47257,47258,47259,47260,47261,47262,47263,null,null,null,null,null,null,47264,47265,47266,47267,47268,47269,47270,47271,47273,47274,47275,47276,47277,47278,47279,47281,47282,47283,47285,47286,47287,47289,47290,47291,47292,47293,null,null,null,null,null,null,47294,47295,47298,47300,47302,47303,47304,47305,47306,47307,47309,47310,47311,47313,47314,47315,47317,47318,47319,47320,47321,47322,47323,47324,47326,47328,47330,47331,47332,47333,47334,47335,47338,47339,47341,47342,47343,47345,47346,47347,47348,47349,47350,47351,47354,47356,47358,47359,47360,47361,47362,47363,47365,47366,47367,47368,47369,47370,47371,47372,47373,47374,47375,47376,47377,47378,47379,47380,47381,47382,47383,47385,47386,47387,47388,47389,47390,47391,47393,47394,47395,47396,47397,47398,47399,47400,47401,47402,47403,47404,47405,47406,47407,47408,47409,47410,47411,47412,47413,47414,47415,47416,47417,47418,47419,47422,47423,47425,47426,47427,47429,47430,47431,47432,47433,47434,47435,47437,47438,47440,47442,47443,47444,47445,47446,47447,47450,47451,47453,47454,47455,47457,47458,47459,47460,47461,47462,47463,47466,47468,47470,47471,47472,47473,47474,47475,47478,47479,47481,47482,47483,47485,null,null,null,null,null,null,47486,47487,47488,47489,47490,47491,47494,47496,47499,47500,47503,47504,47505,47506,47507,47508,47509,47510,47511,47512,47513,47514,47515,47516,47517,47518,null,null,null,null,null,null,47519,47520,47521,47522,47523,47524,47525,47526,47527,47528,47529,47530,47531,47534,47535,47537,47538,47539,47541,47542,47543,47544,47545,47546,47547,47550,47552,47554,47555,47556,47557,47558,47559,47562,47563,47565,47571,47572,47573,47574,47575,47578,47580,47583,47584,47586,47590,47591,47593,47594,47595,47597,47598,47599,47600,47601,47602,47603,47606,47611,47612,47613,47614,47615,47618,47619,47620,47621,47622,47623,47625,47626,47627,47628,47629,47630,47631,47632,47633,47634,47635,47636,47638,47639,47640,47641,47642,47643,47644,47645,47646,47647,47648,47649,47650,47651,47652,47653,47654,47655,47656,47657,47658,47659,47660,47661,47662,47663,47664,47665,47666,47667,47668,47669,47670,47671,47674,47675,47677,47678,47679,47681,47683,47684,47685,47686,47687,47690,47692,47695,47696,47697,47698,47702,47703,47705,47706,47707,47709,47710,47711,47712,47713,47714,47715,47718,47722,47723,47724,47725,47726,47727,null,null,null,null,null,null,47730,47731,47733,47734,47735,47737,47738,47739,47740,47741,47742,47743,47744,47745,47746,47750,47752,47753,47754,47755,47757,47758,47759,47760,47761,47762,null,null,null,null,null,null,47763,47764,47765,47766,47767,47768,47769,47770,47771,47772,47773,47774,47775,47776,47777,47778,47779,47780,47781,47782,47783,47786,47789,47790,47791,47793,47795,47796,47797,47798,47799,47802,47804,47806,47807,47808,47809,47810,47811,47813,47814,47815,47817,47818,47819,47820,47821,47822,47823,47824,47825,47826,47827,47828,47829,47830,47831,47834,47835,47836,47837,47838,47839,47840,47841,47842,47843,47844,47845,47846,47847,47848,47849,47850,47851,47852,47853,47854,47855,47856,47857,47858,47859,47860,47861,47862,47863,47864,47865,47866,47867,47869,47870,47871,47873,47874,47875,47877,47878,47879,47880,47881,47882,47883,47884,47886,47888,47890,47891,47892,47893,47894,47895,47897,47898,47899,47901,47902,47903,47905,47906,47907,47908,47909,47910,47911,47912,47914,47916,47917,47918,47919,47920,47921,47922,47923,47927,47929,47930,47935,47936,47937,47938,47939,47942,47944,47946,47947,47948,47950,47953,47954,null,null,null,null,null,null,47955,47957,47958,47959,47961,47962,47963,47964,47965,47966,47967,47968,47970,47972,47973,47974,47975,47976,47977,47978,47979,47981,47982,47983,47984,47985,null,null,null,null,null,null,47986,47987,47988,47989,47990,47991,47992,47993,47994,47995,47996,47997,47998,47999,48000,48001,48002,48003,48004,48005,48006,48007,48009,48010,48011,48013,48014,48015,48017,48018,48019,48020,48021,48022,48023,48024,48025,48026,48027,48028,48029,48030,48031,48032,48033,48034,48035,48037,48038,48039,48041,48042,48043,48045,48046,48047,48048,48049,48050,48051,48053,48054,48056,48057,48058,48059,48060,48061,48062,48063,48065,48066,48067,48069,48070,48071,48073,48074,48075,48076,48077,48078,48079,48081,48082,48084,48085,48086,48087,48088,48089,48090,48091,48092,48093,48094,48095,48096,48097,48098,48099,48100,48101,48102,48103,48104,48105,48106,48107,48108,48109,48110,48111,48112,48113,48114,48115,48116,48117,48118,48119,48122,48123,48125,48126,48129,48131,48132,48133,48134,48135,48138,48142,48144,48146,48147,48153,48154,48160,48161,48162,48163,48166,48168,48170,48171,48172,48174,48175,48178,48179,48181,null,null,null,null,null,null,48182,48183,48185,48186,48187,48188,48189,48190,48191,48194,48198,48199,48200,48202,48203,48206,48207,48209,48210,48211,48212,48213,48214,48215,48216,48217,null,null,null,null,null,null,48218,48219,48220,48222,48223,48224,48225,48226,48227,48228,48229,48230,48231,48232,48233,48234,48235,48236,48237,48238,48239,48240,48241,48242,48243,48244,48245,48246,48247,48248,48249,48250,48251,48252,48253,48254,48255,48256,48257,48258,48259,48262,48263,48265,48266,48269,48271,48272,48273,48274,48275,48278,48280,48283,48284,48285,48286,48287,48290,48291,48293,48294,48297,48298,48299,48300,48301,48302,48303,48306,48310,48311,48312,48313,48314,48315,48318,48319,48321,48322,48323,48325,48326,48327,48328,48329,48330,48331,48332,48334,48338,48339,48340,48342,48343,48345,48346,48347,48349,48350,48351,48352,48353,48354,48355,48356,48357,48358,48359,48360,48361,48362,48363,48364,48365,48366,48367,48368,48369,48370,48371,48375,48377,48378,48379,48381,48382,48383,48384,48385,48386,48387,48390,48392,48394,48395,48396,48397,48398,48399,48401,48402,48403,48405,48406,48407,48408,48409,48410,48411,48412,48413,null,null,null,null,null,null,48414,48415,48416,48417,48418,48419,48421,48422,48423,48424,48425,48426,48427,48429,48430,48431,48432,48433,48434,48435,48436,48437,48438,48439,48440,48441,null,null,null,null,null,null,48442,48443,48444,48445,48446,48447,48449,48450,48451,48452,48453,48454,48455,48458,48459,48461,48462,48463,48465,48466,48467,48468,48469,48470,48471,48474,48475,48476,48477,48478,48479,48480,48481,48482,48483,48485,48486,48487,48489,48490,48491,48492,48493,48494,48495,48496,48497,48498,48499,48500,48501,48502,48503,48504,48505,48506,48507,48508,48509,48510,48511,48514,48515,48517,48518,48523,48524,48525,48526,48527,48530,48532,48534,48535,48536,48539,48541,48542,48543,48544,48545,48546,48547,48549,48550,48551,48552,48553,48554,48555,48556,48557,48558,48559,48561,48562,48563,48564,48565,48566,48567,48569,48570,48571,48572,48573,48574,48575,48576,48577,48578,48579,48580,48581,48582,48583,48584,48585,48586,48587,48588,48589,48590,48591,48592,48593,48594,48595,48598,48599,48601,48602,48603,48605,48606,48607,48608,48609,48610,48611,48612,48613,48614,48615,48616,48618,48619,48620,48621,48622,48623,48625,null,null,null,null,null,null,48626,48627,48629,48630,48631,48633,48634,48635,48636,48637,48638,48639,48641,48642,48644,48646,48647,48648,48649,48650,48651,48654,48655,48657,48658,48659,null,null,null,null,null,null,48661,48662,48663,48664,48665,48666,48667,48670,48672,48673,48674,48675,48676,48677,48678,48679,48680,48681,48682,48683,48684,48685,48686,48687,48688,48689,48690,48691,48692,48693,48694,48695,48696,48697,48698,48699,48700,48701,48702,48703,48704,48705,48706,48707,48710,48711,48713,48714,48715,48717,48719,48720,48721,48722,48723,48726,48728,48732,48733,48734,48735,48738,48739,48741,48742,48743,48745,48747,48748,48749,48750,48751,48754,48758,48759,48760,48761,48762,48766,48767,48769,48770,48771,48773,48774,48775,48776,48777,48778,48779,48782,48786,48787,48788,48789,48790,48791,48794,48795,48796,48797,48798,48799,48800,48801,48802,48803,48804,48805,48806,48807,48809,48810,48811,48812,48813,48814,48815,48816,48817,48818,48819,48820,48821,48822,48823,48824,48825,48826,48827,48828,48829,48830,48831,48832,48833,48834,48835,48836,48837,48838,48839,48840,48841,48842,48843,48844,48845,48846,48847,48850,48851,null,null,null,null,null,null,48853,48854,48857,48858,48859,48860,48861,48862,48863,48865,48866,48870,48871,48872,48873,48874,48875,48877,48878,48879,48880,48881,48882,48883,48884,48885,null,null,null,null,null,null,48886,48887,48888,48889,48890,48891,48892,48893,48894,48895,48896,48898,48899,48900,48901,48902,48903,48906,48907,48908,48909,48910,48911,48912,48913,48914,48915,48916,48917,48918,48919,48922,48926,48927,48928,48929,48930,48931,48932,48933,48934,48935,48936,48937,48938,48939,48940,48941,48942,48943,48944,48945,48946,48947,48948,48949,48950,48951,48952,48953,48954,48955,48956,48957,48958,48959,48962,48963,48965,48966,48967,48969,48970,48971,48972,48973,48974,48975,48978,48979,48980,48982,48983,48984,48985,48986,48987,48988,48989,48990,48991,48992,48993,48994,48995,48996,48997,48998,48999,49000,49001,49002,49003,49004,49005,49006,49007,49008,49009,49010,49011,49012,49013,49014,49015,49016,49017,49018,49019,49020,49021,49022,49023,49024,49025,49026,49027,49028,49029,49030,49031,49032,49033,49034,49035,49036,49037,49038,49039,49040,49041,49042,49043,49045,49046,49047,49048,49049,49050,49051,49052,49053,null,null,null,null,null,null,49054,49055,49056,49057,49058,49059,49060,49061,49062,49063,49064,49065,49066,49067,49068,49069,49070,49071,49073,49074,49075,49076,49077,49078,49079,49080,null,null,null,null,null,null,49081,49082,49083,49084,49085,49086,49087,49088,49089,49090,49091,49092,49094,49095,49096,49097,49098,49099,49102,49103,49105,49106,49107,49109,49110,49111,49112,49113,49114,49115,49117,49118,49120,49122,49123,49124,49125,49126,49127,49128,49129,49130,49131,49132,49133,49134,49135,49136,49137,49138,49139,49140,49141,49142,49143,49144,49145,49146,49147,49148,49149,49150,49151,49152,49153,49154,49155,49156,49157,49158,49159,49160,49161,49162,49163,49164,49165,49166,49167,49168,49169,49170,49171,49172,49173,49174,49175,49176,49177,49178,49179,49180,49181,49182,49183,49184,49185,49186,49187,49188,49189,49190,49191,49192,49193,49194,49195,49196,49197,49198,49199,49200,49201,49202,49203,49204,49205,49206,49207,49208,49209,49210,49211,49213,49214,49215,49216,49217,49218,49219,49220,49221,49222,49223,49224,49225,49226,49227,49228,49229,49230,49231,49232,49234,49235,49236,49237,49238,49239,49241,49242,49243,null,null,null,null,null,null,49245,49246,49247,49249,49250,49251,49252,49253,49254,49255,49258,49259,49260,49261,49262,49263,49264,49265,49266,49267,49268,49269,49270,49271,49272,49273,null,null,null,null,null,null,49274,49275,49276,49277,49278,49279,49280,49281,49282,49283,49284,49285,49286,49287,49288,49289,49290,49291,49292,49293,49294,49295,49298,49299,49301,49302,49303,49305,49306,49307,49308,49309,49310,49311,49314,49316,49318,49319,49320,49321,49322,49323,49326,49329,49330,49335,49336,49337,49338,49339,49342,49346,49347,49348,49350,49351,49354,49355,49357,49358,49359,49361,49362,49363,49364,49365,49366,49367,49370,49374,49375,49376,49377,49378,49379,49382,49383,49385,49386,49387,49389,49390,49391,49392,49393,49394,49395,49398,49400,49402,49403,49404,49405,49406,49407,49409,49410,49411,49413,49414,49415,49417,49418,49419,49420,49421,49422,49423,49425,49426,49427,49428,49430,49431,49432,49433,49434,49435,49441,49442,49445,49448,49449,49450,49451,49454,49458,49459,49460,49461,49463,49466,49467,49469,49470,49471,49473,49474,49475,49476,49477,49478,49479,49482,49486,49487,49488,49489,49490,49491,49494,49495,null,null,null,null,null,null,49497,49498,49499,49501,49502,49503,49504,49505,49506,49507,49510,49514,49515,49516,49517,49518,49519,49521,49522,49523,49525,49526,49527,49529,49530,49531,null,null,null,null,null,null,49532,49533,49534,49535,49536,49537,49538,49539,49540,49542,49543,49544,49545,49546,49547,49551,49553,49554,49555,49557,49559,49560,49561,49562,49563,49566,49568,49570,49571,49572,49574,49575,49578,49579,49581,49582,49583,49585,49586,49587,49588,49589,49590,49591,49592,49593,49594,49595,49596,49598,49599,49600,49601,49602,49603,49605,49606,49607,49609,49610,49611,49613,49614,49615,49616,49617,49618,49619,49621,49622,49625,49626,49627,49628,49629,49630,49631,49633,49634,49635,49637,49638,49639,49641,49642,49643,49644,49645,49646,49647,49650,49652,49653,49654,49655,49656,49657,49658,49659,49662,49663,49665,49666,49667,49669,49670,49671,49672,49673,49674,49675,49678,49680,49682,49683,49684,49685,49686,49687,49690,49691,49693,49694,49697,49698,49699,49700,49701,49702,49703,49706,49708,49710,49712,49715,49717,49718,49719,49720,49721,49722,49723,49724,49725,49726,49727,49728,49729,49730,49731,49732,49733,null,null,null,null,null,null,49734,49735,49737,49738,49739,49740,49741,49742,49743,49746,49747,49749,49750,49751,49753,49754,49755,49756,49757,49758,49759,49761,49762,49763,49764,49766,null,null,null,null,null,null,49767,49768,49769,49770,49771,49774,49775,49777,49778,49779,49781,49782,49783,49784,49785,49786,49787,49790,49792,49794,49795,49796,49797,49798,49799,49802,49803,49804,49805,49806,49807,49809,49810,49811,49812,49813,49814,49815,49817,49818,49820,49822,49823,49824,49825,49826,49827,49830,49831,49833,49834,49835,49838,49839,49840,49841,49842,49843,49846,49848,49850,49851,49852,49853,49854,49855,49856,49857,49858,49859,49860,49861,49862,49863,49864,49865,49866,49867,49868,49869,49870,49871,49872,49873,49874,49875,49876,49877,49878,49879,49880,49881,49882,49883,49886,49887,49889,49890,49893,49894,49895,49896,49897,49898,49902,49904,49906,49907,49908,49909,49911,49914,49917,49918,49919,49921,49922,49923,49924,49925,49926,49927,49930,49931,49934,49935,49936,49937,49938,49942,49943,49945,49946,49947,49949,49950,49951,49952,49953,49954,49955,49958,49959,49962,49963,49964,49965,49966,49967,49968,49969,49970,null,null,null,null,null,null,49971,49972,49973,49974,49975,49976,49977,49978,49979,49980,49981,49982,49983,49984,49985,49986,49987,49988,49990,49991,49992,49993,49994,49995,49996,49997,null,null,null,null,null,null,49998,49999,50000,50001,50002,50003,50004,50005,50006,50007,50008,50009,50010,50011,50012,50013,50014,50015,50016,50017,50018,50019,50020,50021,50022,50023,50026,50027,50029,50030,50031,50033,50035,50036,50037,50038,50039,50042,50043,50046,50047,50048,50049,50050,50051,50053,50054,50055,50057,50058,50059,50061,50062,50063,50064,50065,50066,50067,50068,50069,50070,50071,50072,50073,50074,50075,50076,50077,50078,50079,50080,50081,50082,50083,50084,50085,50086,50087,50088,50089,50090,50091,50092,50093,50094,50095,50096,50097,50098,50099,50100,50101,50102,50103,50104,50105,50106,50107,50108,50109,50110,50111,50113,50114,50115,50116,50117,50118,50119,50120,50121,50122,50123,50124,50125,50126,50127,50128,50129,50130,50131,50132,50133,50134,50135,50138,50139,50141,50142,50145,50147,50148,50149,50150,50151,50154,50155,50156,50158,50159,50160,50161,50162,50163,50166,50167,50169,50170,50171,50172,50173,50174,null,null,null,null,null,null,50175,50176,50177,50178,50179,50180,50181,50182,50183,50185,50186,50187,50188,50189,50190,50191,50193,50194,50195,50196,50197,50198,50199,50200,50201,50202,null,null,null,null,null,null,50203,50204,50205,50206,50207,50208,50209,50210,50211,50213,50214,50215,50216,50217,50218,50219,50221,50222,50223,50225,50226,50227,50229,50230,50231,50232,50233,50234,50235,50238,50239,50240,50241,50242,50243,50244,50245,50246,50247,50249,50250,50251,50252,50253,50254,50255,50256,50257,50258,50259,50260,50261,50262,50263,50264,50265,50266,50267,50268,50269,50270,50271,50272,50273,50274,50275,50278,50279,50281,50282,50283,50285,50286,50287,50288,50289,50290,50291,50294,50295,50296,50298,50299,50300,50301,50302,50303,50305,50306,50307,50308,50309,50310,50311,50312,50313,50314,50315,50316,50317,50318,50319,50320,50321,50322,50323,50325,50326,50327,50328,50329,50330,50331,50333,50334,50335,50336,50337,50338,50339,50340,50341,50342,50343,50344,50345,50346,50347,50348,50349,50350,50351,50352,50353,50354,50355,50356,50357,50358,50359,50361,50362,50363,50365,50366,50367,50368,50369,50370,50371,50372,50373,null,null,null,null,null,null,50374,50375,50376,50377,50378,50379,50380,50381,50382,50383,50384,50385,50386,50387,50388,50389,50390,50391,50392,50393,50394,50395,50396,50397,50398,50399,null,null,null,null,null,null,50400,50401,50402,50403,50404,50405,50406,50407,50408,50410,50411,50412,50413,50414,50415,50418,50419,50421,50422,50423,50425,50427,50428,50429,50430,50434,50435,50436,50437,50438,50439,50440,50441,50442,50443,50445,50446,50447,50449,50450,50451,50453,50454,50455,50456,50457,50458,50459,50461,50462,50463,50464,50465,50466,50467,50468,50469,50470,50471,50474,50475,50477,50478,50479,50481,50482,50483,50484,50485,50486,50487,50490,50492,50494,50495,50496,50497,50498,50499,50502,50503,50507,50511,50512,50513,50514,50518,50522,50523,50524,50527,50530,50531,50533,50534,50535,50537,50538,50539,50540,50541,50542,50543,50546,50550,50551,50552,50553,50554,50555,50558,50559,50561,50562,50563,50565,50566,50568,50569,50570,50571,50574,50576,50578,50579,50580,50582,50585,50586,50587,50589,50590,50591,50593,50594,50595,50596,50597,50598,50599,50600,50602,50603,50604,50605,50606,50607,50608,50609,50610,50611,50614,null,null,null,null,null,null,50615,50618,50623,50624,50625,50626,50627,50635,50637,50639,50642,50643,50645,50646,50647,50649,50650,50651,50652,50653,50654,50655,50658,50660,50662,50663,null,null,null,null,null,null,50664,50665,50666,50667,50671,50673,50674,50675,50677,50680,50681,50682,50683,50690,50691,50692,50697,50698,50699,50701,50702,50703,50705,50706,50707,50708,50709,50710,50711,50714,50717,50718,50719,50720,50721,50722,50723,50726,50727,50729,50730,50731,50735,50737,50738,50742,50744,50746,50748,50749,50750,50751,50754,50755,50757,50758,50759,50761,50762,50763,50764,50765,50766,50767,50770,50774,50775,50776,50777,50778,50779,50782,50783,50785,50786,50787,50788,50789,50790,50791,50792,50793,50794,50795,50797,50798,50800,50802,50803,50804,50805,50806,50807,50810,50811,50813,50814,50815,50817,50818,50819,50820,50821,50822,50823,50826,50828,50830,50831,50832,50833,50834,50835,50838,50839,50841,50842,50843,50845,50846,50847,50848,50849,50850,50851,50854,50856,50858,50859,50860,50861,50862,50863,50866,50867,50869,50870,50871,50875,50876,50877,50878,50879,50882,50884,50886,50887,50888,50889,50890,50891,50894,null,null,null,null,null,null,50895,50897,50898,50899,50901,50902,50903,50904,50905,50906,50907,50910,50911,50914,50915,50916,50917,50918,50919,50922,50923,50925,50926,50927,50929,50930,null,null,null,null,null,null,50931,50932,50933,50934,50935,50938,50939,50940,50942,50943,50944,50945,50946,50947,50950,50951,50953,50954,50955,50957,50958,50959,50960,50961,50962,50963,50966,50968,50970,50971,50972,50973,50974,50975,50978,50979,50981,50982,50983,50985,50986,50987,50988,50989,50990,50991,50994,50996,50998,51000,51001,51002,51003,51006,51007,51009,51010,51011,51013,51014,51015,51016,51017,51019,51022,51024,51033,51034,51035,51037,51038,51039,51041,51042,51043,51044,51045,51046,51047,51049,51050,51052,51053,51054,51055,51056,51057,51058,51059,51062,51063,51065,51066,51067,51071,51072,51073,51074,51078,51083,51084,51085,51087,51090,51091,51093,51097,51099,51100,51101,51102,51103,51106,51111,51112,51113,51114,51115,51118,51119,51121,51122,51123,51125,51126,51127,51128,51129,51130,51131,51134,51138,51139,51140,51141,51142,51143,51146,51147,51149,51151,51153,51154,51155,51156,51157,51158,51159,51161,51162,51163,51164,null,null,null,null,null,null,51166,51167,51168,51169,51170,51171,51173,51174,51175,51177,51178,51179,51181,51182,51183,51184,51185,51186,51187,51188,51189,51190,51191,51192,51193,51194,null,null,null,null,null,null,51195,51196,51197,51198,51199,51202,51203,51205,51206,51207,51209,51211,51212,51213,51214,51215,51218,51220,51223,51224,51225,51226,51227,51230,51231,51233,51234,51235,51237,51238,51239,51240,51241,51242,51243,51246,51248,51250,51251,51252,51253,51254,51255,51257,51258,51259,51261,51262,51263,51265,51266,51267,51268,51269,51270,51271,51274,51275,51278,51279,51280,51281,51282,51283,51285,51286,51287,51288,51289,51290,51291,51292,51293,51294,51295,51296,51297,51298,51299,51300,51301,51302,51303,51304,51305,51306,51307,51308,51309,51310,51311,51314,51315,51317,51318,51319,51321,51323,51324,51325,51326,51327,51330,51332,51336,51337,51338,51342,51343,51344,51345,51346,51347,51349,51350,51351,51352,51353,51354,51355,51356,51358,51360,51362,51363,51364,51365,51366,51367,51369,51370,51371,51372,51373,51374,51375,51376,51377,51378,51379,51380,51381,51382,51383,51384,51385,51386,51387,51390,51391,51392,51393,null,null,null,null,null,null,51394,51395,51397,51398,51399,51401,51402,51403,51405,51406,51407,51408,51409,51410,51411,51414,51416,51418,51419,51420,51421,51422,51423,51426,51427,51429,null,null,null,null,null,null,51430,51431,51432,51433,51434,51435,51436,51437,51438,51439,51440,51441,51442,51443,51444,51446,51447,51448,51449,51450,51451,51454,51455,51457,51458,51459,51463,51464,51465,51466,51467,51470,12288,12289,12290,183,8229,8230,168,12291,173,8213,8741,65340,8764,8216,8217,8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,12304,12305,177,215,247,8800,8804,8805,8734,8756,176,8242,8243,8451,8491,65504,65505,65509,9794,9792,8736,8869,8978,8706,8711,8801,8786,167,8251,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660,8594,8592,8593,8595,8596,12307,8810,8811,8730,8765,8733,8757,8747,8748,8712,8715,8838,8839,8834,8835,8746,8745,8743,8744,65506,51472,51474,51475,51476,51477,51478,51479,51481,51482,51483,51484,51485,51486,51487,51488,51489,51490,51491,51492,51493,51494,51495,51496,51497,51498,51499,null,null,null,null,null,null,51501,51502,51503,51504,51505,51506,51507,51509,51510,51511,51512,51513,51514,51515,51516,51517,51518,51519,51520,51521,51522,51523,51524,51525,51526,51527,null,null,null,null,null,null,51528,51529,51530,51531,51532,51533,51534,51535,51538,51539,51541,51542,51543,51545,51546,51547,51548,51549,51550,51551,51554,51556,51557,51558,51559,51560,51561,51562,51563,51565,51566,51567,8658,8660,8704,8707,180,65374,711,728,733,730,729,184,731,161,191,720,8750,8721,8719,164,8457,8240,9665,9664,9655,9654,9828,9824,9825,9829,9831,9827,8857,9672,9635,9680,9681,9618,9636,9637,9640,9639,9638,9641,9832,9743,9742,9756,9758,182,8224,8225,8597,8599,8601,8598,8600,9837,9833,9834,9836,12927,12828,8470,13255,8482,13250,13272,8481,8364,174,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,51569,51570,51571,51573,51574,51575,51576,51577,51578,51579,51581,51582,51583,51584,51585,51586,51587,51588,51589,51590,51591,51594,51595,51597,51598,51599,null,null,null,null,null,null,51601,51602,51603,51604,51605,51606,51607,51610,51612,51614,51615,51616,51617,51618,51619,51620,51621,51622,51623,51624,51625,51626,51627,51628,51629,51630,null,null,null,null,null,null,51631,51632,51633,51634,51635,51636,51637,51638,51639,51640,51641,51642,51643,51644,51645,51646,51647,51650,51651,51653,51654,51657,51659,51660,51661,51662,51663,51666,51668,51671,51672,51675,65281,65282,65283,65284,65285,65286,65287,65288,65289,65290,65291,65292,65293,65294,65295,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,65306,65307,65308,65309,65310,65311,65312,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65339,65510,65341,65342,65343,65344,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,65371,65372,65373,65507,51678,51679,51681,51683,51685,51686,51688,51689,51690,51691,51694,51698,51699,51700,51701,51702,51703,51706,51707,51709,51710,51711,51713,51714,51715,51716,null,null,null,null,null,null,51717,51718,51719,51722,51726,51727,51728,51729,51730,51731,51733,51734,51735,51737,51738,51739,51740,51741,51742,51743,51744,51745,51746,51747,51748,51749,null,null,null,null,null,null,51750,51751,51752,51754,51755,51756,51757,51758,51759,51760,51761,51762,51763,51764,51765,51766,51767,51768,51769,51770,51771,51772,51773,51774,51775,51776,51777,51778,51779,51780,51781,51782,12593,12594,12595,12596,12597,12598,12599,12600,12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616,12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,12647,12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663,12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679,12680,12681,12682,12683,12684,12685,12686,51783,51784,51785,51786,51787,51790,51791,51793,51794,51795,51797,51798,51799,51800,51801,51802,51803,51806,51810,51811,51812,51813,51814,51815,51817,51818,null,null,null,null,null,null,51819,51820,51821,51822,51823,51824,51825,51826,51827,51828,51829,51830,51831,51832,51833,51834,51835,51836,51838,51839,51840,51841,51842,51843,51845,51846,null,null,null,null,null,null,51847,51848,51849,51850,51851,51852,51853,51854,51855,51856,51857,51858,51859,51860,51861,51862,51863,51865,51866,51867,51868,51869,51870,51871,51872,51873,51874,51875,51876,51877,51878,51879,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,null,null,null,null,null,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,null,null,null,null,null,null,null,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,null,null,null,null,null,null,null,null,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,null,null,null,null,null,null,51880,51881,51882,51883,51884,51885,51886,51887,51888,51889,51890,51891,51892,51893,51894,51895,51896,51897,51898,51899,51902,51903,51905,51906,51907,51909,null,null,null,null,null,null,51910,51911,51912,51913,51914,51915,51918,51920,51922,51924,51925,51926,51927,51930,51931,51932,51933,51934,51935,51937,51938,51939,51940,51941,51942,51943,null,null,null,null,null,null,51944,51945,51946,51947,51949,51950,51951,51952,51953,51954,51955,51957,51958,51959,51960,51961,51962,51963,51964,51965,51966,51967,51968,51969,51970,51971,51972,51973,51974,51975,51977,51978,9472,9474,9484,9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487,9491,9499,9495,9507,9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520,9509,9528,9538,9490,9489,9498,9497,9494,9493,9486,9485,9502,9503,9505,9506,9510,9511,9513,9514,9517,9518,9521,9522,9525,9526,9529,9530,9533,9534,9536,9537,9539,9540,9541,9542,9543,9544,9545,9546,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,51979,51980,51981,51982,51983,51985,51986,51987,51989,51990,51991,51993,51994,51995,51996,51997,51998,51999,52002,52003,52004,52005,52006,52007,52008,52009,null,null,null,null,null,null,52010,52011,52012,52013,52014,52015,52016,52017,52018,52019,52020,52021,52022,52023,52024,52025,52026,52027,52028,52029,52030,52031,52032,52034,52035,52036,null,null,null,null,null,null,52037,52038,52039,52042,52043,52045,52046,52047,52049,52050,52051,52052,52053,52054,52055,52058,52059,52060,52062,52063,52064,52065,52066,52067,52069,52070,52071,52072,52073,52074,52075,52076,13205,13206,13207,8467,13208,13252,13219,13220,13221,13222,13209,13210,13211,13212,13213,13214,13215,13216,13217,13218,13258,13197,13198,13199,13263,13192,13193,13256,13223,13224,13232,13233,13234,13235,13236,13237,13238,13239,13240,13241,13184,13185,13186,13187,13188,13242,13243,13244,13245,13246,13247,13200,13201,13202,13203,13204,8486,13248,13249,13194,13195,13196,13270,13253,13229,13230,13231,13275,13225,13226,13227,13228,13277,13264,13267,13251,13257,13276,13254,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52077,52078,52079,52080,52081,52082,52083,52084,52085,52086,52087,52090,52091,52092,52093,52094,52095,52096,52097,52098,52099,52100,52101,52102,52103,52104,null,null,null,null,null,null,52105,52106,52107,52108,52109,52110,52111,52112,52113,52114,52115,52116,52117,52118,52119,52120,52121,52122,52123,52125,52126,52127,52128,52129,52130,52131,null,null,null,null,null,null,52132,52133,52134,52135,52136,52137,52138,52139,52140,52141,52142,52143,52144,52145,52146,52147,52148,52149,52150,52151,52153,52154,52155,52156,52157,52158,52159,52160,52161,52162,52163,52164,198,208,170,294,null,306,null,319,321,216,338,186,222,358,330,null,12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911,12912,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,9424,9425,9426,9427,9428,9429,9430,9431,9432,9433,9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446,9447,9448,9449,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,189,8531,8532,188,190,8539,8540,8541,8542,52165,52166,52167,52168,52169,52170,52171,52172,52173,52174,52175,52176,52177,52178,52179,52181,52182,52183,52184,52185,52186,52187,52188,52189,52190,52191,null,null,null,null,null,null,52192,52193,52194,52195,52197,52198,52200,52202,52203,52204,52205,52206,52207,52208,52209,52210,52211,52212,52213,52214,52215,52216,52217,52218,52219,52220,null,null,null,null,null,null,52221,52222,52223,52224,52225,52226,52227,52228,52229,52230,52231,52232,52233,52234,52235,52238,52239,52241,52242,52243,52245,52246,52247,52248,52249,52250,52251,52254,52255,52256,52259,52260,230,273,240,295,305,307,312,320,322,248,339,223,254,359,331,329,12800,12801,12802,12803,12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819,12820,12821,12822,12823,12824,12825,12826,12827,9372,9373,9374,9375,9376,9377,9378,9379,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,185,178,179,8308,8319,8321,8322,8323,8324,52261,52262,52266,52267,52269,52271,52273,52274,52275,52276,52277,52278,52279,52282,52287,52288,52289,52290,52291,52294,52295,52297,52298,52299,52301,52302,null,null,null,null,null,null,52303,52304,52305,52306,52307,52310,52314,52315,52316,52317,52318,52319,52321,52322,52323,52325,52327,52329,52330,52331,52332,52333,52334,52335,52337,52338,null,null,null,null,null,null,52339,52340,52342,52343,52344,52345,52346,52347,52348,52349,52350,52351,52352,52353,52354,52355,52356,52357,52358,52359,52360,52361,52362,52363,52364,52365,52366,52367,52368,52369,52370,52371,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,null,null,null,null,null,null,null,null,null,null,null,52372,52373,52374,52375,52378,52379,52381,52382,52383,52385,52386,52387,52388,52389,52390,52391,52394,52398,52399,52400,52401,52402,52403,52406,52407,52409,null,null,null,null,null,null,52410,52411,52413,52414,52415,52416,52417,52418,52419,52422,52424,52426,52427,52428,52429,52430,52431,52433,52434,52435,52437,52438,52439,52440,52441,52442,null,null,null,null,null,null,52443,52444,52445,52446,52447,52448,52449,52450,52451,52453,52454,52455,52456,52457,52458,52459,52461,52462,52463,52465,52466,52467,52468,52469,52470,52471,52472,52473,52474,52475,52476,52477,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,null,null,null,null,null,null,null,null,52478,52479,52480,52482,52483,52484,52485,52486,52487,52490,52491,52493,52494,52495,52497,52498,52499,52500,52501,52502,52503,52506,52508,52510,52511,52512,null,null,null,null,null,null,52513,52514,52515,52517,52518,52519,52521,52522,52523,52525,52526,52527,52528,52529,52530,52531,52532,52533,52534,52535,52536,52538,52539,52540,52541,52542,null,null,null,null,null,null,52543,52544,52545,52546,52547,52548,52549,52550,52551,52552,52553,52554,52555,52556,52557,52558,52559,52560,52561,52562,52563,52564,52565,52566,52567,52568,52569,52570,52571,52573,52574,52575,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,null,null,null,null,null,null,null,null,null,null,null,null,null,52577,52578,52579,52581,52582,52583,52584,52585,52586,52587,52590,52592,52594,52595,52596,52597,52598,52599,52601,52602,52603,52604,52605,52606,52607,52608,null,null,null,null,null,null,52609,52610,52611,52612,52613,52614,52615,52617,52618,52619,52620,52621,52622,52623,52624,52625,52626,52627,52630,52631,52633,52634,52635,52637,52638,52639,null,null,null,null,null,null,52640,52641,52642,52643,52646,52648,52650,52651,52652,52653,52654,52655,52657,52658,52659,52660,52661,52662,52663,52664,52665,52666,52667,52668,52669,52670,52671,52672,52673,52674,52675,52677,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52678,52679,52680,52681,52682,52683,52685,52686,52687,52689,52690,52691,52692,52693,52694,52695,52696,52697,52698,52699,52700,52701,52702,52703,52704,52705,null,null,null,null,null,null,52706,52707,52708,52709,52710,52711,52713,52714,52715,52717,52718,52719,52721,52722,52723,52724,52725,52726,52727,52730,52732,52734,52735,52736,52737,52738,null,null,null,null,null,null,52739,52741,52742,52743,52745,52746,52747,52749,52750,52751,52752,52753,52754,52755,52757,52758,52759,52760,52762,52763,52764,52765,52766,52767,52770,52771,52773,52774,52775,52777,52778,52779,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52780,52781,52782,52783,52786,52788,52790,52791,52792,52793,52794,52795,52796,52797,52798,52799,52800,52801,52802,52803,52804,52805,52806,52807,52808,52809,null,null,null,null,null,null,52810,52811,52812,52813,52814,52815,52816,52817,52818,52819,52820,52821,52822,52823,52826,52827,52829,52830,52834,52835,52836,52837,52838,52839,52842,52844,null,null,null,null,null,null,52846,52847,52848,52849,52850,52851,52854,52855,52857,52858,52859,52861,52862,52863,52864,52865,52866,52867,52870,52872,52874,52875,52876,52877,52878,52879,52882,52883,52885,52886,52887,52889,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52890,52891,52892,52893,52894,52895,52898,52902,52903,52904,52905,52906,52907,52910,52911,52912,52913,52914,52915,52916,52917,52918,52919,52920,52921,52922,null,null,null,null,null,null,52923,52924,52925,52926,52927,52928,52930,52931,52932,52933,52934,52935,52936,52937,52938,52939,52940,52941,52942,52943,52944,52945,52946,52947,52948,52949,null,null,null,null,null,null,52950,52951,52952,52953,52954,52955,52956,52957,52958,52959,52960,52961,52962,52963,52966,52967,52969,52970,52973,52974,52975,52976,52977,52978,52979,52982,52986,52987,52988,52989,52990,52991,44032,44033,44036,44039,44040,44041,44042,44048,44049,44050,44051,44052,44053,44054,44055,44057,44058,44059,44060,44061,44064,44068,44076,44077,44079,44080,44081,44088,44089,44092,44096,44107,44109,44116,44120,44124,44144,44145,44148,44151,44152,44154,44160,44161,44163,44164,44165,44166,44169,44170,44171,44172,44176,44180,44188,44189,44191,44192,44193,44200,44201,44202,44204,44207,44208,44216,44217,44219,44220,44221,44225,44228,44232,44236,44245,44247,44256,44257,44260,44263,44264,44266,44268,44271,44272,44273,44275,44277,44278,44284,44285,44288,44292,44294,52994,52995,52997,52998,52999,53001,53002,53003,53004,53005,53006,53007,53010,53012,53014,53015,53016,53017,53018,53019,53021,53022,53023,53025,53026,53027,null,null,null,null,null,null,53029,53030,53031,53032,53033,53034,53035,53038,53042,53043,53044,53045,53046,53047,53049,53050,53051,53052,53053,53054,53055,53056,53057,53058,53059,53060,null,null,null,null,null,null,53061,53062,53063,53064,53065,53066,53067,53068,53069,53070,53071,53072,53073,53074,53075,53078,53079,53081,53082,53083,53085,53086,53087,53088,53089,53090,53091,53094,53096,53098,53099,53100,44300,44301,44303,44305,44312,44316,44320,44329,44332,44333,44340,44341,44344,44348,44356,44357,44359,44361,44368,44372,44376,44385,44387,44396,44397,44400,44403,44404,44405,44406,44411,44412,44413,44415,44417,44418,44424,44425,44428,44432,44444,44445,44452,44471,44480,44481,44484,44488,44496,44497,44499,44508,44512,44516,44536,44537,44540,44543,44544,44545,44552,44553,44555,44557,44564,44592,44593,44596,44599,44600,44602,44608,44609,44611,44613,44614,44618,44620,44621,44622,44624,44628,44630,44636,44637,44639,44640,44641,44645,44648,44649,44652,44656,44664,53101,53102,53103,53106,53107,53109,53110,53111,53113,53114,53115,53116,53117,53118,53119,53121,53122,53123,53124,53126,53127,53128,53129,53130,53131,53133,null,null,null,null,null,null,53134,53135,53136,53137,53138,53139,53140,53141,53142,53143,53144,53145,53146,53147,53148,53149,53150,53151,53152,53154,53155,53156,53157,53158,53159,53161,null,null,null,null,null,null,53162,53163,53164,53165,53166,53167,53169,53170,53171,53172,53173,53174,53175,53176,53177,53178,53179,53180,53181,53182,53183,53184,53185,53186,53187,53189,53190,53191,53192,53193,53194,53195,44665,44667,44668,44669,44676,44677,44684,44732,44733,44734,44736,44740,44748,44749,44751,44752,44753,44760,44761,44764,44776,44779,44781,44788,44792,44796,44807,44808,44813,44816,44844,44845,44848,44850,44852,44860,44861,44863,44865,44866,44867,44872,44873,44880,44892,44893,44900,44901,44921,44928,44932,44936,44944,44945,44949,44956,44984,44985,44988,44992,44999,45000,45001,45003,45005,45006,45012,45020,45032,45033,45040,45041,45044,45048,45056,45057,45060,45068,45072,45076,45084,45085,45096,45124,45125,45128,45130,45132,45134,45139,45140,45141,45143,45145,53196,53197,53198,53199,53200,53201,53202,53203,53204,53205,53206,53207,53208,53209,53210,53211,53212,53213,53214,53215,53218,53219,53221,53222,53223,53225,null,null,null,null,null,null,53226,53227,53228,53229,53230,53231,53234,53236,53238,53239,53240,53241,53242,53243,53245,53246,53247,53249,53250,53251,53253,53254,53255,53256,53257,53258,null,null,null,null,null,null,53259,53260,53261,53262,53263,53264,53266,53267,53268,53269,53270,53271,53273,53274,53275,53276,53277,53278,53279,53280,53281,53282,53283,53284,53285,53286,53287,53288,53289,53290,53291,53292,45149,45180,45181,45184,45188,45196,45197,45199,45201,45208,45209,45210,45212,45215,45216,45217,45218,45224,45225,45227,45228,45229,45230,45231,45233,45235,45236,45237,45240,45244,45252,45253,45255,45256,45257,45264,45265,45268,45272,45280,45285,45320,45321,45323,45324,45328,45330,45331,45336,45337,45339,45340,45341,45347,45348,45349,45352,45356,45364,45365,45367,45368,45369,45376,45377,45380,45384,45392,45393,45396,45397,45400,45404,45408,45432,45433,45436,45440,45442,45448,45449,45451,45453,45458,45459,45460,45464,45468,45480,45516,45520,45524,45532,45533,53294,53295,53296,53297,53298,53299,53302,53303,53305,53306,53307,53309,53310,53311,53312,53313,53314,53315,53318,53320,53322,53323,53324,53325,53326,53327,null,null,null,null,null,null,53329,53330,53331,53333,53334,53335,53337,53338,53339,53340,53341,53342,53343,53345,53346,53347,53348,53349,53350,53351,53352,53353,53354,53355,53358,53359,null,null,null,null,null,null,53361,53362,53363,53365,53366,53367,53368,53369,53370,53371,53374,53375,53376,53378,53379,53380,53381,53382,53383,53384,53385,53386,53387,53388,53389,53390,53391,53392,53393,53394,53395,53396,45535,45544,45545,45548,45552,45561,45563,45565,45572,45573,45576,45579,45580,45588,45589,45591,45593,45600,45620,45628,45656,45660,45664,45672,45673,45684,45685,45692,45700,45701,45705,45712,45713,45716,45720,45721,45722,45728,45729,45731,45733,45734,45738,45740,45744,45748,45768,45769,45772,45776,45778,45784,45785,45787,45789,45794,45796,45797,45798,45800,45803,45804,45805,45806,45807,45811,45812,45813,45815,45816,45817,45818,45819,45823,45824,45825,45828,45832,45840,45841,45843,45844,45845,45852,45908,45909,45910,45912,45915,45916,45918,45919,45924,45925,53397,53398,53399,53400,53401,53402,53403,53404,53405,53406,53407,53408,53409,53410,53411,53414,53415,53417,53418,53419,53421,53422,53423,53424,53425,53426,null,null,null,null,null,null,53427,53430,53432,53434,53435,53436,53437,53438,53439,53442,53443,53445,53446,53447,53450,53451,53452,53453,53454,53455,53458,53462,53463,53464,53465,53466,null,null,null,null,null,null,53467,53470,53471,53473,53474,53475,53477,53478,53479,53480,53481,53482,53483,53486,53490,53491,53492,53493,53494,53495,53497,53498,53499,53500,53501,53502,53503,53504,53505,53506,53507,53508,45927,45929,45931,45934,45936,45937,45940,45944,45952,45953,45955,45956,45957,45964,45968,45972,45984,45985,45992,45996,46020,46021,46024,46027,46028,46030,46032,46036,46037,46039,46041,46043,46045,46048,46052,46056,46076,46096,46104,46108,46112,46120,46121,46123,46132,46160,46161,46164,46168,46176,46177,46179,46181,46188,46208,46216,46237,46244,46248,46252,46261,46263,46265,46272,46276,46280,46288,46293,46300,46301,46304,46307,46308,46310,46316,46317,46319,46321,46328,46356,46357,46360,46363,46364,46372,46373,46375,46376,46377,46378,46384,46385,46388,46392,53509,53510,53511,53512,53513,53514,53515,53516,53518,53519,53520,53521,53522,53523,53524,53525,53526,53527,53528,53529,53530,53531,53532,53533,53534,53535,null,null,null,null,null,null,53536,53537,53538,53539,53540,53541,53542,53543,53544,53545,53546,53547,53548,53549,53550,53551,53554,53555,53557,53558,53559,53561,53563,53564,53565,53566,null,null,null,null,null,null,53567,53570,53574,53575,53576,53577,53578,53579,53582,53583,53585,53586,53587,53589,53590,53591,53592,53593,53594,53595,53598,53600,53602,53603,53604,53605,53606,53607,53609,53610,53611,53613,46400,46401,46403,46404,46405,46411,46412,46413,46416,46420,46428,46429,46431,46432,46433,46496,46497,46500,46504,46506,46507,46512,46513,46515,46516,46517,46523,46524,46525,46528,46532,46540,46541,46543,46544,46545,46552,46572,46608,46609,46612,46616,46629,46636,46644,46664,46692,46696,46748,46749,46752,46756,46763,46764,46769,46804,46832,46836,46840,46848,46849,46853,46888,46889,46892,46895,46896,46904,46905,46907,46916,46920,46924,46932,46933,46944,46948,46952,46960,46961,46963,46965,46972,46973,46976,46980,46988,46989,46991,46992,46993,46994,46998,46999,53614,53615,53616,53617,53618,53619,53620,53621,53622,53623,53624,53625,53626,53627,53629,53630,53631,53632,53633,53634,53635,53637,53638,53639,53641,53642,null,null,null,null,null,null,53643,53644,53645,53646,53647,53648,53649,53650,53651,53652,53653,53654,53655,53656,53657,53658,53659,53660,53661,53662,53663,53666,53667,53669,53670,53671,null,null,null,null,null,null,53673,53674,53675,53676,53677,53678,53679,53682,53684,53686,53687,53688,53689,53691,53693,53694,53695,53697,53698,53699,53700,53701,53702,53703,53704,53705,53706,53707,53708,53709,53710,53711,47000,47001,47004,47008,47016,47017,47019,47020,47021,47028,47029,47032,47047,47049,47084,47085,47088,47092,47100,47101,47103,47104,47105,47111,47112,47113,47116,47120,47128,47129,47131,47133,47140,47141,47144,47148,47156,47157,47159,47160,47161,47168,47172,47185,47187,47196,47197,47200,47204,47212,47213,47215,47217,47224,47228,47245,47272,47280,47284,47288,47296,47297,47299,47301,47308,47312,47316,47325,47327,47329,47336,47337,47340,47344,47352,47353,47355,47357,47364,47384,47392,47420,47421,47424,47428,47436,47439,47441,47448,47449,47452,47456,47464,47465,53712,53713,53714,53715,53716,53717,53718,53719,53721,53722,53723,53724,53725,53726,53727,53728,53729,53730,53731,53732,53733,53734,53735,53736,53737,53738,null,null,null,null,null,null,53739,53740,53741,53742,53743,53744,53745,53746,53747,53749,53750,53751,53753,53754,53755,53756,53757,53758,53759,53760,53761,53762,53763,53764,53765,53766,null,null,null,null,null,null,53768,53770,53771,53772,53773,53774,53775,53777,53778,53779,53780,53781,53782,53783,53784,53785,53786,53787,53788,53789,53790,53791,53792,53793,53794,53795,53796,53797,53798,53799,53800,53801,47467,47469,47476,47477,47480,47484,47492,47493,47495,47497,47498,47501,47502,47532,47533,47536,47540,47548,47549,47551,47553,47560,47561,47564,47566,47567,47568,47569,47570,47576,47577,47579,47581,47582,47585,47587,47588,47589,47592,47596,47604,47605,47607,47608,47609,47610,47616,47617,47624,47637,47672,47673,47676,47680,47682,47688,47689,47691,47693,47694,47699,47700,47701,47704,47708,47716,47717,47719,47720,47721,47728,47729,47732,47736,47747,47748,47749,47751,47756,47784,47785,47787,47788,47792,47794,47800,47801,47803,47805,47812,47816,47832,47833,47868,53802,53803,53806,53807,53809,53810,53811,53813,53814,53815,53816,53817,53818,53819,53822,53824,53826,53827,53828,53829,53830,53831,53833,53834,53835,53836,null,null,null,null,null,null,53837,53838,53839,53840,53841,53842,53843,53844,53845,53846,53847,53848,53849,53850,53851,53853,53854,53855,53856,53857,53858,53859,53861,53862,53863,53864,null,null,null,null,null,null,53865,53866,53867,53868,53869,53870,53871,53872,53873,53874,53875,53876,53877,53878,53879,53880,53881,53882,53883,53884,53885,53886,53887,53890,53891,53893,53894,53895,53897,53898,53899,53900,47872,47876,47885,47887,47889,47896,47900,47904,47913,47915,47924,47925,47926,47928,47931,47932,47933,47934,47940,47941,47943,47945,47949,47951,47952,47956,47960,47969,47971,47980,48008,48012,48016,48036,48040,48044,48052,48055,48064,48068,48072,48080,48083,48120,48121,48124,48127,48128,48130,48136,48137,48139,48140,48141,48143,48145,48148,48149,48150,48151,48152,48155,48156,48157,48158,48159,48164,48165,48167,48169,48173,48176,48177,48180,48184,48192,48193,48195,48196,48197,48201,48204,48205,48208,48221,48260,48261,48264,48267,48268,48270,48276,48277,48279,53901,53902,53903,53906,53907,53908,53910,53911,53912,53913,53914,53915,53917,53918,53919,53921,53922,53923,53925,53926,53927,53928,53929,53930,53931,53933,null,null,null,null,null,null,53934,53935,53936,53938,53939,53940,53941,53942,53943,53946,53947,53949,53950,53953,53955,53956,53957,53958,53959,53962,53964,53965,53966,53967,53968,53969,null,null,null,null,null,null,53970,53971,53973,53974,53975,53977,53978,53979,53981,53982,53983,53984,53985,53986,53987,53990,53991,53992,53993,53994,53995,53996,53997,53998,53999,54002,54003,54005,54006,54007,54009,54010,48281,48282,48288,48289,48292,48295,48296,48304,48305,48307,48308,48309,48316,48317,48320,48324,48333,48335,48336,48337,48341,48344,48348,48372,48373,48374,48376,48380,48388,48389,48391,48393,48400,48404,48420,48428,48448,48456,48457,48460,48464,48472,48473,48484,48488,48512,48513,48516,48519,48520,48521,48522,48528,48529,48531,48533,48537,48538,48540,48548,48560,48568,48596,48597,48600,48604,48617,48624,48628,48632,48640,48643,48645,48652,48653,48656,48660,48668,48669,48671,48708,48709,48712,48716,48718,48724,48725,48727,48729,48730,48731,48736,48737,48740,54011,54012,54013,54014,54015,54018,54020,54022,54023,54024,54025,54026,54027,54031,54033,54034,54035,54037,54039,54040,54041,54042,54043,54046,54050,54051,null,null,null,null,null,null,54052,54054,54055,54058,54059,54061,54062,54063,54065,54066,54067,54068,54069,54070,54071,54074,54078,54079,54080,54081,54082,54083,54086,54087,54088,54089,null,null,null,null,null,null,54090,54091,54092,54093,54094,54095,54096,54097,54098,54099,54100,54101,54102,54103,54104,54105,54106,54107,54108,54109,54110,54111,54112,54113,54114,54115,54116,54117,54118,54119,54120,54121,48744,48746,48752,48753,48755,48756,48757,48763,48764,48765,48768,48772,48780,48781,48783,48784,48785,48792,48793,48808,48848,48849,48852,48855,48856,48864,48867,48868,48869,48876,48897,48904,48905,48920,48921,48923,48924,48925,48960,48961,48964,48968,48976,48977,48981,49044,49072,49093,49100,49101,49104,49108,49116,49119,49121,49212,49233,49240,49244,49248,49256,49257,49296,49297,49300,49304,49312,49313,49315,49317,49324,49325,49327,49328,49331,49332,49333,49334,49340,49341,49343,49344,49345,49349,49352,49353,49356,49360,49368,49369,49371,49372,49373,49380,54122,54123,54124,54125,54126,54127,54128,54129,54130,54131,54132,54133,54134,54135,54136,54137,54138,54139,54142,54143,54145,54146,54147,54149,54150,54151,null,null,null,null,null,null,54152,54153,54154,54155,54158,54162,54163,54164,54165,54166,54167,54170,54171,54173,54174,54175,54177,54178,54179,54180,54181,54182,54183,54186,54188,54190,null,null,null,null,null,null,54191,54192,54193,54194,54195,54197,54198,54199,54201,54202,54203,54205,54206,54207,54208,54209,54210,54211,54214,54215,54218,54219,54220,54221,54222,54223,54225,54226,54227,54228,54229,54230,49381,49384,49388,49396,49397,49399,49401,49408,49412,49416,49424,49429,49436,49437,49438,49439,49440,49443,49444,49446,49447,49452,49453,49455,49456,49457,49462,49464,49465,49468,49472,49480,49481,49483,49484,49485,49492,49493,49496,49500,49508,49509,49511,49512,49513,49520,49524,49528,49541,49548,49549,49550,49552,49556,49558,49564,49565,49567,49569,49573,49576,49577,49580,49584,49597,49604,49608,49612,49620,49623,49624,49632,49636,49640,49648,49649,49651,49660,49661,49664,49668,49676,49677,49679,49681,49688,49689,49692,49695,49696,49704,49705,49707,49709,54231,54233,54234,54235,54236,54237,54238,54239,54240,54242,54244,54245,54246,54247,54248,54249,54250,54251,54254,54255,54257,54258,54259,54261,54262,54263,null,null,null,null,null,null,54264,54265,54266,54267,54270,54272,54274,54275,54276,54277,54278,54279,54281,54282,54283,54284,54285,54286,54287,54288,54289,54290,54291,54292,54293,54294,null,null,null,null,null,null,54295,54296,54297,54298,54299,54300,54302,54303,54304,54305,54306,54307,54308,54309,54310,54311,54312,54313,54314,54315,54316,54317,54318,54319,54320,54321,54322,54323,54324,54325,54326,54327,49711,49713,49714,49716,49736,49744,49745,49748,49752,49760,49765,49772,49773,49776,49780,49788,49789,49791,49793,49800,49801,49808,49816,49819,49821,49828,49829,49832,49836,49837,49844,49845,49847,49849,49884,49885,49888,49891,49892,49899,49900,49901,49903,49905,49910,49912,49913,49915,49916,49920,49928,49929,49932,49933,49939,49940,49941,49944,49948,49956,49957,49960,49961,49989,50024,50025,50028,50032,50034,50040,50041,50044,50045,50052,50056,50060,50112,50136,50137,50140,50143,50144,50146,50152,50153,50157,50164,50165,50168,50184,50192,50212,50220,50224,54328,54329,54330,54331,54332,54333,54334,54335,54337,54338,54339,54341,54342,54343,54344,54345,54346,54347,54348,54349,54350,54351,54352,54353,54354,54355,null,null,null,null,null,null,54356,54357,54358,54359,54360,54361,54362,54363,54365,54366,54367,54369,54370,54371,54373,54374,54375,54376,54377,54378,54379,54380,54382,54384,54385,54386,null,null,null,null,null,null,54387,54388,54389,54390,54391,54394,54395,54397,54398,54401,54403,54404,54405,54406,54407,54410,54412,54414,54415,54416,54417,54418,54419,54421,54422,54423,54424,54425,54426,54427,54428,54429,50228,50236,50237,50248,50276,50277,50280,50284,50292,50293,50297,50304,50324,50332,50360,50364,50409,50416,50417,50420,50424,50426,50431,50432,50433,50444,50448,50452,50460,50472,50473,50476,50480,50488,50489,50491,50493,50500,50501,50504,50505,50506,50508,50509,50510,50515,50516,50517,50519,50520,50521,50525,50526,50528,50529,50532,50536,50544,50545,50547,50548,50549,50556,50557,50560,50564,50567,50572,50573,50575,50577,50581,50583,50584,50588,50592,50601,50612,50613,50616,50617,50619,50620,50621,50622,50628,50629,50630,50631,50632,50633,50634,50636,50638,54430,54431,54432,54433,54434,54435,54436,54437,54438,54439,54440,54442,54443,54444,54445,54446,54447,54448,54449,54450,54451,54452,54453,54454,54455,54456,null,null,null,null,null,null,54457,54458,54459,54460,54461,54462,54463,54464,54465,54466,54467,54468,54469,54470,54471,54472,54473,54474,54475,54477,54478,54479,54481,54482,54483,54485,null,null,null,null,null,null,54486,54487,54488,54489,54490,54491,54493,54494,54496,54497,54498,54499,54500,54501,54502,54503,54505,54506,54507,54509,54510,54511,54513,54514,54515,54516,54517,54518,54519,54521,54522,54524,50640,50641,50644,50648,50656,50657,50659,50661,50668,50669,50670,50672,50676,50678,50679,50684,50685,50686,50687,50688,50689,50693,50694,50695,50696,50700,50704,50712,50713,50715,50716,50724,50725,50728,50732,50733,50734,50736,50739,50740,50741,50743,50745,50747,50752,50753,50756,50760,50768,50769,50771,50772,50773,50780,50781,50784,50796,50799,50801,50808,50809,50812,50816,50824,50825,50827,50829,50836,50837,50840,50844,50852,50853,50855,50857,50864,50865,50868,50872,50873,50874,50880,50881,50883,50885,50892,50893,50896,50900,50908,50909,50912,50913,50920,54526,54527,54528,54529,54530,54531,54533,54534,54535,54537,54538,54539,54541,54542,54543,54544,54545,54546,54547,54550,54552,54553,54554,54555,54556,54557,null,null,null,null,null,null,54558,54559,54560,54561,54562,54563,54564,54565,54566,54567,54568,54569,54570,54571,54572,54573,54574,54575,54576,54577,54578,54579,54580,54581,54582,54583,null,null,null,null,null,null,54584,54585,54586,54587,54590,54591,54593,54594,54595,54597,54598,54599,54600,54601,54602,54603,54606,54608,54610,54611,54612,54613,54614,54615,54618,54619,54621,54622,54623,54625,54626,54627,50921,50924,50928,50936,50937,50941,50948,50949,50952,50956,50964,50965,50967,50969,50976,50977,50980,50984,50992,50993,50995,50997,50999,51004,51005,51008,51012,51018,51020,51021,51023,51025,51026,51027,51028,51029,51030,51031,51032,51036,51040,51048,51051,51060,51061,51064,51068,51069,51070,51075,51076,51077,51079,51080,51081,51082,51086,51088,51089,51092,51094,51095,51096,51098,51104,51105,51107,51108,51109,51110,51116,51117,51120,51124,51132,51133,51135,51136,51137,51144,51145,51148,51150,51152,51160,51165,51172,51176,51180,51200,51201,51204,51208,51210,54628,54630,54631,54634,54636,54638,54639,54640,54641,54642,54643,54646,54647,54649,54650,54651,54653,54654,54655,54656,54657,54658,54659,54662,54666,54667,null,null,null,null,null,null,54668,54669,54670,54671,54673,54674,54675,54676,54677,54678,54679,54680,54681,54682,54683,54684,54685,54686,54687,54688,54689,54690,54691,54692,54694,54695,null,null,null,null,null,null,54696,54697,54698,54699,54700,54701,54702,54703,54704,54705,54706,54707,54708,54709,54710,54711,54712,54713,54714,54715,54716,54717,54718,54719,54720,54721,54722,54723,54724,54725,54726,54727,51216,51217,51219,51221,51222,51228,51229,51232,51236,51244,51245,51247,51249,51256,51260,51264,51272,51273,51276,51277,51284,51312,51313,51316,51320,51322,51328,51329,51331,51333,51334,51335,51339,51340,51341,51348,51357,51359,51361,51368,51388,51389,51396,51400,51404,51412,51413,51415,51417,51424,51425,51428,51445,51452,51453,51456,51460,51461,51462,51468,51469,51471,51473,51480,51500,51508,51536,51537,51540,51544,51552,51553,51555,51564,51568,51572,51580,51592,51593,51596,51600,51608,51609,51611,51613,51648,51649,51652,51655,51656,51658,51664,51665,51667,54730,54731,54733,54734,54735,54737,54739,54740,54741,54742,54743,54746,54748,54750,54751,54752,54753,54754,54755,54758,54759,54761,54762,54763,54765,54766,null,null,null,null,null,null,54767,54768,54769,54770,54771,54774,54776,54778,54779,54780,54781,54782,54783,54786,54787,54789,54790,54791,54793,54794,54795,54796,54797,54798,54799,54802,null,null,null,null,null,null,54806,54807,54808,54809,54810,54811,54813,54814,54815,54817,54818,54819,54821,54822,54823,54824,54825,54826,54827,54828,54830,54831,54832,54833,54834,54835,54836,54837,54838,54839,54842,54843,51669,51670,51673,51674,51676,51677,51680,51682,51684,51687,51692,51693,51695,51696,51697,51704,51705,51708,51712,51720,51721,51723,51724,51725,51732,51736,51753,51788,51789,51792,51796,51804,51805,51807,51808,51809,51816,51837,51844,51864,51900,51901,51904,51908,51916,51917,51919,51921,51923,51928,51929,51936,51948,51956,51976,51984,51988,51992,52000,52001,52033,52040,52041,52044,52048,52056,52057,52061,52068,52088,52089,52124,52152,52180,52196,52199,52201,52236,52237,52240,52244,52252,52253,52257,52258,52263,52264,52265,52268,52270,52272,52280,52281,52283,54845,54846,54847,54849,54850,54851,54852,54854,54855,54858,54860,54862,54863,54864,54866,54867,54870,54871,54873,54874,54875,54877,54878,54879,54880,54881,null,null,null,null,null,null,54882,54883,54884,54885,54886,54888,54890,54891,54892,54893,54894,54895,54898,54899,54901,54902,54903,54904,54905,54906,54907,54908,54909,54910,54911,54912,null,null,null,null,null,null,54913,54914,54916,54918,54919,54920,54921,54922,54923,54926,54927,54929,54930,54931,54933,54934,54935,54936,54937,54938,54939,54940,54942,54944,54946,54947,54948,54949,54950,54951,54953,54954,52284,52285,52286,52292,52293,52296,52300,52308,52309,52311,52312,52313,52320,52324,52326,52328,52336,52341,52376,52377,52380,52384,52392,52393,52395,52396,52397,52404,52405,52408,52412,52420,52421,52423,52425,52432,52436,52452,52460,52464,52481,52488,52489,52492,52496,52504,52505,52507,52509,52516,52520,52524,52537,52572,52576,52580,52588,52589,52591,52593,52600,52616,52628,52629,52632,52636,52644,52645,52647,52649,52656,52676,52684,52688,52712,52716,52720,52728,52729,52731,52733,52740,52744,52748,52756,52761,52768,52769,52772,52776,52784,52785,52787,52789,54955,54957,54958,54959,54961,54962,54963,54964,54965,54966,54967,54968,54970,54972,54973,54974,54975,54976,54977,54978,54979,54982,54983,54985,54986,54987,null,null,null,null,null,null,54989,54990,54991,54992,54994,54995,54997,54998,55000,55002,55003,55004,55005,55006,55007,55009,55010,55011,55013,55014,55015,55017,55018,55019,55020,55021,null,null,null,null,null,null,55022,55023,55025,55026,55027,55028,55030,55031,55032,55033,55034,55035,55038,55039,55041,55042,55043,55045,55046,55047,55048,55049,55050,55051,55052,55053,55054,55055,55056,55058,55059,55060,52824,52825,52828,52831,52832,52833,52840,52841,52843,52845,52852,52853,52856,52860,52868,52869,52871,52873,52880,52881,52884,52888,52896,52897,52899,52900,52901,52908,52909,52929,52964,52965,52968,52971,52972,52980,52981,52983,52984,52985,52992,52993,52996,53000,53008,53009,53011,53013,53020,53024,53028,53036,53037,53039,53040,53041,53048,53076,53077,53080,53084,53092,53093,53095,53097,53104,53105,53108,53112,53120,53125,53132,53153,53160,53168,53188,53216,53217,53220,53224,53232,53233,53235,53237,53244,53248,53252,53265,53272,53293,53300,53301,53304,53308,55061,55062,55063,55066,55067,55069,55070,55071,55073,55074,55075,55076,55077,55078,55079,55082,55084,55086,55087,55088,55089,55090,55091,55094,55095,55097,null,null,null,null,null,null,55098,55099,55101,55102,55103,55104,55105,55106,55107,55109,55110,55112,55114,55115,55116,55117,55118,55119,55122,55123,55125,55130,55131,55132,55133,55134,null,null,null,null,null,null,55135,55138,55140,55142,55143,55144,55146,55147,55149,55150,55151,55153,55154,55155,55157,55158,55159,55160,55161,55162,55163,55166,55167,55168,55170,55171,55172,55173,55174,55175,55178,55179,53316,53317,53319,53321,53328,53332,53336,53344,53356,53357,53360,53364,53372,53373,53377,53412,53413,53416,53420,53428,53429,53431,53433,53440,53441,53444,53448,53449,53456,53457,53459,53460,53461,53468,53469,53472,53476,53484,53485,53487,53488,53489,53496,53517,53552,53553,53556,53560,53562,53568,53569,53571,53572,53573,53580,53581,53584,53588,53596,53597,53599,53601,53608,53612,53628,53636,53640,53664,53665,53668,53672,53680,53681,53683,53685,53690,53692,53696,53720,53748,53752,53767,53769,53776,53804,53805,53808,53812,53820,53821,53823,53825,53832,53852,55181,55182,55183,55185,55186,55187,55188,55189,55190,55191,55194,55196,55198,55199,55200,55201,55202,55203,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,53860,53888,53889,53892,53896,53904,53905,53909,53916,53920,53924,53932,53937,53944,53945,53948,53951,53952,53954,53960,53961,53963,53972,53976,53980,53988,53989,54000,54001,54004,54008,54016,54017,54019,54021,54028,54029,54030,54032,54036,54038,54044,54045,54047,54048,54049,54053,54056,54057,54060,54064,54072,54073,54075,54076,54077,54084,54085,54140,54141,54144,54148,54156,54157,54159,54160,54161,54168,54169,54172,54176,54184,54185,54187,54189,54196,54200,54204,54212,54213,54216,54217,54224,54232,54241,54243,54252,54253,54256,54260,54268,54269,54271,54273,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,54280,54301,54336,54340,54364,54368,54372,54381,54383,54392,54393,54396,54399,54400,54402,54408,54409,54411,54413,54420,54441,54476,54480,54484,54492,54495,54504,54508,54512,54520,54523,54525,54532,54536,54540,54548,54549,54551,54588,54589,54592,54596,54604,54605,54607,54609,54616,54617,54620,54624,54629,54632,54633,54635,54637,54644,54645,54648,54652,54660,54661,54663,54664,54665,54672,54693,54728,54729,54732,54736,54738,54744,54745,54747,54749,54756,54757,54760,54764,54772,54773,54775,54777,54784,54785,54788,54792,54800,54801,54803,54804,54805,54812,54816,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,54820,54829,54840,54841,54844,54848,54853,54856,54857,54859,54861,54865,54868,54869,54872,54876,54887,54889,54896,54897,54900,54915,54917,54924,54925,54928,54932,54941,54943,54945,54952,54956,54960,54969,54971,54980,54981,54984,54988,54993,54996,54999,55001,55008,55012,55016,55024,55029,55036,55037,55040,55044,55057,55064,55065,55068,55072,55080,55081,55083,55085,55092,55093,55096,55100,55108,55111,55113,55120,55121,55124,55126,55127,55128,55129,55136,55137,55139,55141,55145,55148,55152,55156,55164,55165,55169,55176,55177,55180,55184,55192,55193,55195,55197,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20285,20339,20551,20729,21152,21487,21621,21733,22025,23233,23478,26247,26550,26551,26607,27468,29634,30146,31292,33499,33540,34903,34952,35382,36040,36303,36603,36838,39381,21051,21364,21508,24682,24932,27580,29647,33050,35258,35282,38307,20355,21002,22718,22904,23014,24178,24185,25031,25536,26438,26604,26751,28567,30286,30475,30965,31240,31487,31777,32925,33390,33393,35563,38291,20075,21917,26359,28212,30883,31469,33883,35088,34638,38824,21208,22350,22570,23884,24863,25022,25121,25954,26577,27204,28187,29976,30131,30435,30640,32058,37039,37969,37970,40853,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21283,23724,30002,32987,37440,38296,21083,22536,23004,23713,23831,24247,24378,24394,24951,27743,30074,30086,31968,32115,32177,32652,33108,33313,34193,35137,35611,37628,38477,40007,20171,20215,20491,20977,22607,24887,24894,24936,25913,27114,28433,30117,30342,30422,31623,33445,33995,63744,37799,38283,21888,23458,22353,63745,31923,32697,37301,20520,21435,23621,24040,25298,25454,25818,25831,28192,28844,31067,36317,36382,63746,36989,37445,37624,20094,20214,20581,24062,24314,24838,26967,33137,34388,36423,37749,39467,20062,20625,26480,26688,20745,21133,21138,27298,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,30652,37392,40660,21163,24623,36850,20552,25001,25581,25802,26684,27268,28608,33160,35233,38548,22533,29309,29356,29956,32121,32365,32937,35211,35700,36963,40273,25225,27770,28500,32080,32570,35363,20860,24906,31645,35609,37463,37772,20140,20435,20510,20670,20742,21185,21197,21375,22384,22659,24218,24465,24950,25004,25806,25964,26223,26299,26356,26775,28039,28805,28913,29855,29861,29898,30169,30828,30956,31455,31478,32069,32147,32789,32831,33051,33686,35686,36629,36885,37857,38915,38968,39514,39912,20418,21843,22586,22865,23395,23622,24760,25106,26690,26800,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26856,28330,30028,30328,30926,31293,31995,32363,32380,35336,35489,35903,38542,40388,21476,21481,21578,21617,22266,22993,23396,23611,24235,25335,25911,25925,25970,26272,26543,27073,27837,30204,30352,30590,31295,32660,32771,32929,33167,33510,33533,33776,34241,34865,34996,35493,63747,36764,37678,38599,39015,39640,40723,21741,26011,26354,26767,31296,35895,40288,22256,22372,23825,26118,26801,26829,28414,29736,34974,39908,27752,63748,39592,20379,20844,20849,21151,23380,24037,24656,24685,25329,25511,25915,29657,31354,34467,36002,38799,20018,23521,25096,26524,29916,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31185,33747,35463,35506,36328,36942,37707,38982,24275,27112,34303,37101,63749,20896,23448,23532,24931,26874,27454,28748,29743,29912,31649,32592,33733,35264,36011,38364,39208,21038,24669,25324,36866,20362,20809,21281,22745,24291,26336,27960,28826,29378,29654,31568,33009,37979,21350,25499,32619,20054,20608,22602,22750,24618,24871,25296,27088,39745,23439,32024,32945,36703,20132,20689,21676,21932,23308,23968,24039,25898,25934,26657,27211,29409,30350,30703,32094,32761,33184,34126,34527,36611,36686,37066,39171,39509,39851,19992,20037,20061,20167,20465,20855,21246,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21312,21475,21477,21646,22036,22389,22434,23495,23943,24272,25084,25304,25937,26552,26601,27083,27472,27590,27628,27714,28317,28792,29399,29590,29699,30655,30697,31350,32127,32777,33276,33285,33290,33503,34914,35635,36092,36544,36881,37041,37476,37558,39378,39493,40169,40407,40860,22283,23616,33738,38816,38827,40628,21531,31384,32676,35033,36557,37089,22528,23624,25496,31391,23470,24339,31353,31406,33422,36524,20518,21048,21240,21367,22280,25331,25458,27402,28099,30519,21413,29527,34152,36470,38357,26426,27331,28528,35437,36556,39243,63750,26231,27512,36020,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,39740,63751,21483,22317,22862,25542,27131,29674,30789,31418,31429,31998,33909,35215,36211,36917,38312,21243,22343,30023,31584,33740,37406,63752,27224,20811,21067,21127,25119,26840,26997,38553,20677,21156,21220,25027,26020,26681,27135,29822,31563,33465,33771,35250,35641,36817,39241,63753,20170,22935,25810,26129,27278,29748,31105,31165,33449,34942,34943,35167,63754,37670,20235,21450,24613,25201,27762,32026,32102,20120,20834,30684,32943,20225,20238,20854,20864,21980,22120,22331,22522,22524,22804,22855,22931,23492,23696,23822,24049,24190,24524,25216,26071,26083,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26398,26399,26462,26827,26820,27231,27450,27683,27773,27778,28103,29592,29734,29738,29826,29859,30072,30079,30849,30959,31041,31047,31048,31098,31637,32000,32186,32648,32774,32813,32908,35352,35663,35912,36215,37665,37668,39138,39249,39438,39439,39525,40594,32202,20342,21513,25326,26708,37329,21931,20794,63755,63756,23068,25062,63757,25295,25343,63758,63759,63760,63761,63762,63763,37027,63764,63765,63766,63767,63768,35582,63769,63770,63771,63772,26262,63773,29014,63774,63775,38627,63776,25423,25466,21335,63777,26511,26976,28275,63778,30007,63779,63780,63781,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32013,63782,63783,34930,22218,23064,63784,63785,63786,63787,63788,20035,63789,20839,22856,26608,32784,63790,22899,24180,25754,31178,24565,24684,25288,25467,23527,23511,21162,63791,22900,24361,24594,63792,63793,63794,29785,63795,63796,63797,63798,63799,63800,39377,63801,63802,63803,63804,63805,63806,63807,63808,63809,63810,63811,28611,63812,63813,33215,36786,24817,63814,63815,33126,63816,63817,23615,63818,63819,63820,63821,63822,63823,63824,63825,23273,35365,26491,32016,63826,63827,63828,63829,63830,63831,33021,63832,63833,23612,27877,21311,28346,22810,33590,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20025,20150,20294,21934,22296,22727,24406,26039,26086,27264,27573,28237,30701,31471,31774,32222,34507,34962,37170,37723,25787,28606,29562,30136,36948,21846,22349,25018,25812,26311,28129,28251,28525,28601,30192,32835,33213,34113,35203,35527,35674,37663,27795,30035,31572,36367,36957,21776,22530,22616,24162,25095,25758,26848,30070,31958,34739,40680,20195,22408,22382,22823,23565,23729,24118,24453,25140,25825,29619,33274,34955,36024,38538,40667,23429,24503,24755,20498,20992,21040,22294,22581,22615,23566,23648,23798,23947,24230,24466,24764,25361,25481,25623,26691,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26873,27330,28120,28193,28372,28644,29182,30428,30585,31153,31291,33796,35241,36077,36339,36424,36867,36884,36947,37117,37709,38518,38876,27602,28678,29272,29346,29544,30563,31167,31716,32411,35712,22697,24775,25958,26109,26302,27788,28958,29129,35930,38931,20077,31361,20189,20908,20941,21205,21516,24999,26481,26704,26847,27934,28540,30140,30643,31461,33012,33891,37509,20828,26007,26460,26515,30168,31431,33651,63834,35910,36887,38957,23663,33216,33434,36929,36975,37389,24471,23965,27225,29128,30331,31561,34276,35588,37159,39472,21895,25078,63835,30313,32645,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,34367,34746,35064,37007,63836,27931,28889,29662,32097,33853,63837,37226,39409,63838,20098,21365,27396,27410,28734,29211,34349,40478,21068,36771,23888,25829,25900,27414,28651,31811,32412,34253,35172,35261,25289,33240,34847,24266,26391,28010,29436,29701,29807,34690,37086,20358,23821,24480,33802,20919,25504,30053,20142,20486,20841,20937,26753,27153,31918,31921,31975,33391,35538,36635,37327,20406,20791,21237,21570,24300,24942,25150,26053,27354,28670,31018,34268,34851,38317,39522,39530,40599,40654,21147,26310,27511,28701,31019,36706,38722,24976,25088,25891,28451,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,29001,29833,32244,32879,34030,36646,36899,37706,20925,21015,21155,27916,28872,35010,24265,25986,27566,28610,31806,29557,20196,20278,22265,63839,23738,23994,24604,29618,31533,32666,32718,32838,36894,37428,38646,38728,38936,40801,20363,28583,31150,37300,38583,21214,63840,25736,25796,27347,28510,28696,29200,30439,32769,34310,34396,36335,36613,38706,39791,40442,40565,30860,31103,32160,33737,37636,40575,40595,35542,22751,24324,26407,28711,29903,31840,32894,20769,28712,29282,30922,36034,36058,36084,38647,20102,20698,23534,24278,26009,29134,30274,30637,32842,34044,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36988,39719,40845,22744,23105,23650,27155,28122,28431,30267,32047,32311,34078,35128,37860,38475,21129,26066,26611,27060,27969,28316,28687,29705,29792,30041,30244,30827,35628,39006,20845,25134,38520,20374,20523,23833,28138,32184,36650,24459,24900,26647,63841,38534,21202,32907,20956,20940,26974,31260,32190,33777,38517,20442,21033,21400,21519,21774,23653,24743,26446,26792,28012,29313,29432,29702,29827,63842,30178,31852,32633,32696,33673,35023,35041,37324,37328,38626,39881,21533,28542,29136,29848,34298,36522,38563,40023,40607,26519,28107,29747,33256,38678,30764,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31435,31520,31890,25705,29802,30194,30908,30952,39340,39764,40635,23518,24149,28448,33180,33707,37000,19975,21325,23081,24018,24398,24930,25405,26217,26364,28415,28459,28771,30622,33836,34067,34875,36627,39237,39995,21788,25273,26411,27819,33545,35178,38778,20129,22916,24536,24537,26395,32178,32596,33426,33579,33725,36638,37017,22475,22969,23186,23504,26151,26522,26757,27599,29028,32629,36023,36067,36993,39749,33032,35978,38476,39488,40613,23391,27667,29467,30450,30431,33804,20906,35219,20813,20885,21193,26825,27796,30468,30496,32191,32236,38754,40629,28357,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,34065,20901,21517,21629,26126,26269,26919,28319,30399,30609,33559,33986,34719,37225,37528,40180,34946,20398,20882,21215,22982,24125,24917,25720,25721,26286,26576,27169,27597,27611,29279,29281,29761,30520,30683,32791,33468,33541,35584,35624,35980,26408,27792,29287,30446,30566,31302,40361,27519,27794,22818,26406,33945,21359,22675,22937,24287,25551,26164,26483,28218,29483,31447,33495,37672,21209,24043,25006,25035,25098,25287,25771,26080,26969,27494,27595,28961,29687,30045,32326,33310,33538,34154,35491,36031,38695,40289,22696,40664,20497,21006,21563,21839,25991,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,27766,32010,32011,32862,34442,38272,38639,21247,27797,29289,21619,23194,23614,23883,24396,24494,26410,26806,26979,28220,28228,30473,31859,32654,34183,35598,36855,38753,40692,23735,24758,24845,25003,25935,26107,26108,27665,27887,29599,29641,32225,38292,23494,34588,35600,21085,21338,25293,25615,25778,26420,27192,27850,29632,29854,31636,31893,32283,33162,33334,34180,36843,38649,39361,20276,21322,21453,21467,25292,25644,25856,26001,27075,27886,28504,29677,30036,30242,30436,30460,30928,30971,31020,32070,33324,34784,36820,38930,39151,21187,25300,25765,28196,28497,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,30332,36299,37297,37474,39662,39747,20515,20621,22346,22952,23592,24135,24439,25151,25918,26041,26049,26121,26507,27036,28354,30917,32033,32938,33152,33323,33459,33953,34444,35370,35607,37030,38450,40848,20493,20467,63843,22521,24472,25308,25490,26479,28227,28953,30403,32972,32986,35060,35061,35097,36064,36649,37197,38506,20271,20336,24091,26575,26658,30333,30334,39748,24161,27146,29033,29140,30058,63844,32321,34115,34281,39132,20240,31567,32624,38309,20961,24070,26805,27710,27726,27867,29359,31684,33539,27861,29754,20731,21128,22721,25816,27287,29863,30294,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,30887,34327,38370,38713,63845,21342,24321,35722,36776,36783,37002,21029,30629,40009,40712,19993,20482,20853,23643,24183,26142,26170,26564,26821,28851,29953,30149,31177,31453,36647,39200,39432,20445,22561,22577,23542,26222,27493,27921,28282,28541,29668,29995,33769,35036,35091,35676,36628,20239,20693,21264,21340,23443,24489,26381,31119,33145,33583,34068,35079,35206,36665,36667,39333,39954,26412,20086,20472,22857,23553,23791,23792,25447,26834,28925,29090,29739,32299,34028,34562,36898,37586,40179,19981,20184,20463,20613,21078,21103,21542,21648,22496,22827,23142,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,23386,23413,23500,24220,63846,25206,25975,26023,28014,28325,29238,31526,31807,32566,33104,33105,33178,33344,33433,33705,35331,36000,36070,36091,36212,36282,37096,37340,38428,38468,39385,40167,21271,20998,21545,22132,22707,22868,22894,24575,24996,25198,26128,27774,28954,30406,31881,31966,32027,33452,36033,38640,63847,20315,24343,24447,25282,23849,26379,26842,30844,32323,40300,19989,20633,21269,21290,21329,22915,23138,24199,24754,24970,25161,25209,26000,26503,27047,27604,27606,27607,27608,27832,63848,29749,30202,30738,30865,31189,31192,31875,32203,32737,32933,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,33086,33218,33778,34586,35048,35513,35692,36027,37145,38750,39131,40763,22188,23338,24428,25996,27315,27567,27996,28657,28693,29277,29613,36007,36051,38971,24977,27703,32856,39425,20045,20107,20123,20181,20282,20284,20351,20447,20735,21490,21496,21766,21987,22235,22763,22882,23057,23531,23546,23556,24051,24107,24473,24605,25448,26012,26031,26614,26619,26797,27515,27801,27863,28195,28681,29509,30722,31038,31040,31072,31169,31721,32023,32114,32902,33293,33678,34001,34503,35039,35408,35422,35613,36060,36198,36781,37034,39164,39391,40605,21066,63849,26388,63850,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20632,21034,23665,25955,27733,29642,29987,30109,31639,33948,37240,38704,20087,25746,27578,29022,34217,19977,63851,26441,26862,28183,33439,34072,34923,25591,28545,37394,39087,19978,20663,20687,20767,21830,21930,22039,23360,23577,23776,24120,24202,24224,24258,24819,26705,27233,28248,29245,29248,29376,30456,31077,31665,32724,35059,35316,35443,35937,36062,38684,22622,29885,36093,21959,63852,31329,32034,33394,29298,29983,29989,63853,31513,22661,22779,23996,24207,24246,24464,24661,25234,25471,25933,26257,26329,26360,26646,26866,29312,29790,31598,32110,32214,32626,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32997,33298,34223,35199,35475,36893,37604,40653,40736,22805,22893,24109,24796,26132,26227,26512,27728,28101,28511,30707,30889,33990,37323,37675,20185,20682,20808,21892,23307,23459,25159,25982,26059,28210,29053,29697,29764,29831,29887,30316,31146,32218,32341,32680,33146,33203,33337,34330,34796,35445,36323,36984,37521,37925,39245,39854,21352,23633,26964,27844,27945,28203,33292,34203,35131,35373,35498,38634,40807,21089,26297,27570,32406,34814,36109,38275,38493,25885,28041,29166,63854,22478,22995,23468,24615,24826,25104,26143,26207,29481,29689,30427,30465,31596,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32854,32882,33125,35488,37266,19990,21218,27506,27927,31237,31545,32048,63855,36016,21484,22063,22609,23477,23567,23569,24034,25152,25475,25620,26157,26803,27836,28040,28335,28703,28836,29138,29990,30095,30094,30233,31505,31712,31787,32032,32057,34092,34157,34311,35380,36877,36961,37045,37559,38902,39479,20439,23660,26463,28049,31903,32396,35606,36118,36895,23403,24061,25613,33984,36956,39137,29575,23435,24730,26494,28126,35359,35494,36865,38924,21047,63856,28753,30862,37782,34928,37335,20462,21463,22013,22234,22402,22781,23234,23432,23723,23744,24101,24833,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,25101,25163,25480,25628,25910,25976,27193,27530,27700,27929,28465,29159,29417,29560,29703,29874,30246,30561,31168,31319,31466,31929,32143,32172,32353,32670,33065,33585,33936,34010,34282,34966,35504,35728,36664,36930,36995,37228,37526,37561,38539,38567,38568,38614,38656,38920,39318,39635,39706,21460,22654,22809,23408,23487,28113,28506,29087,29729,29881,32901,33789,24033,24455,24490,24642,26092,26642,26991,27219,27529,27957,28147,29667,30462,30636,31565,32020,33059,33308,33600,34036,34147,35426,35524,37255,37662,38918,39348,25100,34899,36848,37477,23815,23847,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,23913,29791,33181,34664,28629,25342,32722,35126,35186,19998,20056,20711,21213,21319,25215,26119,32361,34821,38494,20365,21273,22070,22987,23204,23608,23630,23629,24066,24337,24643,26045,26159,26178,26558,26612,29468,30690,31034,32709,33940,33997,35222,35430,35433,35553,35925,35962,22516,23508,24335,24687,25325,26893,27542,28252,29060,31698,34645,35672,36606,39135,39166,20280,20353,20449,21627,23072,23480,24892,26032,26216,29180,30003,31070,32051,33102,33251,33688,34218,34254,34563,35338,36523,36763,63857,36805,22833,23460,23526,24713,23529,23563,24515,27777,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63858,28145,28683,29978,33455,35574,20160,21313,63859,38617,27663,20126,20420,20818,21854,23077,23784,25105,29273,33469,33706,34558,34905,35357,38463,38597,39187,40201,40285,22538,23731,23997,24132,24801,24853,25569,27138,28197,37122,37716,38990,39952,40823,23433,23736,25353,26191,26696,30524,38593,38797,38996,39839,26017,35585,36555,38332,21813,23721,24022,24245,26263,30284,33780,38343,22739,25276,29390,40232,20208,22830,24591,26171,27523,31207,40230,21395,21696,22467,23830,24859,26326,28079,30861,33406,38552,38724,21380,25212,25494,28082,32266,33099,38989,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,27387,32588,40367,40474,20063,20539,20918,22812,24825,25590,26928,29242,32822,63860,37326,24369,63861,63862,32004,33509,33903,33979,34277,36493,63863,20335,63864,63865,22756,23363,24665,25562,25880,25965,26264,63866,26954,27171,27915,28673,29036,30162,30221,31155,31344,63867,32650,63868,35140,63869,35731,37312,38525,63870,39178,22276,24481,26044,28417,30208,31142,35486,39341,39770,40812,20740,25014,25233,27277,33222,20547,22576,24422,28937,35328,35578,23420,34326,20474,20796,22196,22852,25513,28153,23978,26989,20870,20104,20313,63871,63872,63873,22914,63874,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63875,27487,27741,63876,29877,30998,63877,33287,33349,33593,36671,36701,63878,39192,63879,63880,63881,20134,63882,22495,24441,26131,63883,63884,30123,32377,35695,63885,36870,39515,22181,22567,23032,23071,23476,63886,24310,63887,63888,25424,25403,63889,26941,27783,27839,28046,28051,28149,28436,63890,28895,28982,29017,63891,29123,29141,63892,30799,30831,63893,31605,32227,63894,32303,63895,34893,36575,63896,63897,63898,37467,63899,40182,63900,63901,63902,24709,28037,63903,29105,63904,63905,38321,21421,63906,63907,63908,26579,63909,28814,28976,29744,33398,33490,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63910,38331,39653,40573,26308,63911,29121,33865,63912,63913,22603,63914,63915,23992,24433,63916,26144,26254,27001,27054,27704,27891,28214,28481,28634,28699,28719,29008,29151,29552,63917,29787,63918,29908,30408,31310,32403,63919,63920,33521,35424,36814,63921,37704,63922,38681,63923,63924,20034,20522,63925,21000,21473,26355,27757,28618,29450,30591,31330,33454,34269,34306,63926,35028,35427,35709,35947,63927,37555,63928,38675,38928,20116,20237,20425,20658,21320,21566,21555,21978,22626,22714,22887,23067,23524,24735,63929,25034,25942,26111,26212,26791,27738,28595,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,28879,29100,29522,31613,34568,35492,39986,40711,23627,27779,29508,29577,37434,28331,29797,30239,31337,32277,34314,20800,22725,25793,29934,29973,30320,32705,37013,38605,39252,28198,29926,31401,31402,33253,34521,34680,35355,23113,23436,23451,26785,26880,28003,29609,29715,29740,30871,32233,32747,33048,33109,33694,35916,38446,38929,26352,24448,26106,26505,27754,29579,20525,23043,27498,30702,22806,23916,24013,29477,30031,63930,63931,20709,20985,22575,22829,22934,23002,23525,63932,63933,23970,25303,25622,25747,25854,63934,26332,63935,27208,63936,29183,29796,63937,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31368,31407,32327,32350,32768,33136,63938,34799,35201,35616,36953,63939,36992,39250,24958,27442,28020,32287,35109,36785,20433,20653,20887,21191,22471,22665,23481,24248,24898,27029,28044,28263,28342,29076,29794,29992,29996,32883,33592,33993,36362,37780,37854,63940,20110,20305,20598,20778,21448,21451,21491,23431,23507,23588,24858,24962,26100,29275,29591,29760,30402,31056,31121,31161,32006,32701,33419,34261,34398,36802,36935,37109,37354,38533,38632,38633,21206,24423,26093,26161,26671,29020,31286,37057,38922,20113,63941,27218,27550,28560,29065,32792,33464,34131,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36939,38549,38642,38907,34074,39729,20112,29066,38596,20803,21407,21729,22291,22290,22435,23195,23236,23491,24616,24895,25588,27781,27961,28274,28304,29232,29503,29783,33489,34945,36677,36960,63942,38498,39000,40219,26376,36234,37470,20301,20553,20702,21361,22285,22996,23041,23561,24944,26256,28205,29234,29771,32239,32963,33806,33894,34111,34655,34907,35096,35586,36949,38859,39759,20083,20369,20754,20842,63943,21807,21929,23418,23461,24188,24189,24254,24736,24799,24840,24841,25540,25912,26377,63944,26580,26586,63945,26977,26978,27833,27943,63946,28216,63947,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,28641,29494,29495,63948,29788,30001,63949,30290,63950,63951,32173,33278,33848,35029,35480,35547,35565,36400,36418,36938,36926,36986,37193,37321,37742,63952,63953,22537,63954,27603,32905,32946,63955,63956,20801,22891,23609,63957,63958,28516,29607,32996,36103,63959,37399,38287,63960,63961,63962,63963,32895,25102,28700,32104,34701,63964,22432,24681,24903,27575,35518,37504,38577,20057,21535,28139,34093,38512,38899,39150,25558,27875,37009,20957,25033,33210,40441,20381,20506,20736,23452,24847,25087,25836,26885,27589,30097,30691,32681,33380,34191,34811,34915,35516,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,35696,37291,20108,20197,20234,63965,63966,22839,23016,63967,24050,24347,24411,24609,63968,63969,63970,63971,29246,29669,63972,30064,30157,63973,31227,63974,32780,32819,32900,33505,33617,63975,63976,36029,36019,36999,63977,63978,39156,39180,63979,63980,28727,30410,32714,32716,32764,35610,20154,20161,20995,21360,63981,21693,22240,23035,23493,24341,24525,28270,63982,63983,32106,33589,63984,34451,35469,63985,38765,38775,63986,63987,19968,20314,20350,22777,26085,28322,36920,37808,39353,20219,22764,22922,23001,24641,63988,63989,31252,63990,33615,36035,20837,21316,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63991,63992,63993,20173,21097,23381,33471,20180,21050,21672,22985,23039,23376,23383,23388,24675,24904,28363,28825,29038,29574,29943,30133,30913,32043,32773,33258,33576,34071,34249,35566,36039,38604,20316,21242,22204,26027,26152,28796,28856,29237,32189,33421,37196,38592,40306,23409,26855,27544,28538,30430,23697,26283,28507,31668,31786,34870,38620,19976,20183,21280,22580,22715,22767,22892,23559,24115,24196,24373,25484,26290,26454,27167,27299,27404,28479,29254,63994,29520,29835,31456,31911,33144,33247,33255,33674,33900,34083,34196,34255,35037,36115,37292,38263,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,38556,20877,21705,22312,23472,25165,26448,26685,26771,28221,28371,28797,32289,35009,36001,36617,40779,40782,29229,31631,35533,37658,20295,20302,20786,21632,22992,24213,25269,26485,26990,27159,27822,28186,29401,29482,30141,31672,32053,33511,33785,33879,34295,35419,36015,36487,36889,37048,38606,40799,21219,21514,23265,23490,25688,25973,28404,29380,63995,30340,31309,31515,31821,32318,32735,33659,35627,36042,36196,36321,36447,36842,36857,36969,37841,20291,20346,20659,20840,20856,21069,21098,22625,22652,22880,23560,23637,24283,24731,25136,26643,27583,27656,28593,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,29006,29728,30000,30008,30033,30322,31564,31627,31661,31686,32399,35438,36670,36681,37439,37523,37666,37931,38651,39002,39019,39198,20999,25130,25240,27993,30308,31434,31680,32118,21344,23742,24215,28472,28857,31896,38673,39822,40670,25509,25722,34678,19969,20117,20141,20572,20597,21576,22979,23450,24128,24237,24311,24449,24773,25402,25919,25972,26060,26230,26232,26622,26984,27273,27491,27712,28096,28136,28191,28254,28702,28833,29582,29693,30010,30555,30855,31118,31243,31357,31934,32142,33351,35330,35562,35998,37165,37194,37336,37478,37580,37664,38662,38742,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,38748,38914,40718,21046,21137,21884,22564,24093,24351,24716,25552,26799,28639,31085,31532,33229,34234,35069,35576,36420,37261,38500,38555,38717,38988,40778,20430,20806,20939,21161,22066,24340,24427,25514,25805,26089,26177,26362,26361,26397,26781,26839,27133,28437,28526,29031,29157,29226,29866,30522,31062,31066,31199,31264,31381,31895,31967,32068,32368,32903,34299,34468,35412,35519,36249,36481,36896,36973,37347,38459,38613,40165,26063,31751,36275,37827,23384,23562,21330,25305,29469,20519,23447,24478,24752,24939,26837,28121,29742,31278,32066,32156,32305,33131,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36394,36405,37758,37912,20304,22352,24038,24231,25387,32618,20027,20303,20367,20570,23005,32964,21610,21608,22014,22863,23449,24030,24282,26205,26417,26609,26666,27880,27954,28234,28557,28855,29664,30087,31820,32002,32044,32162,33311,34523,35387,35461,36208,36490,36659,36913,37198,37202,37956,39376,31481,31909,20426,20737,20934,22472,23535,23803,26201,27197,27994,28310,28652,28940,30063,31459,34850,36897,36981,38603,39423,33537,20013,20210,34886,37325,21373,27355,26987,27713,33914,22686,24974,26366,25327,28893,29969,30151,32338,33976,35657,36104,20043,21482,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21675,22320,22336,24535,25345,25351,25711,25903,26088,26234,26525,26547,27490,27744,27802,28460,30693,30757,31049,31063,32025,32930,33026,33267,33437,33463,34584,35468,63996,36100,36286,36978,30452,31257,31287,32340,32887,21767,21972,22645,25391,25634,26185,26187,26733,27035,27524,27941,28337,29645,29800,29857,30043,30137,30433,30494,30603,31206,32265,32285,33275,34095,34967,35386,36049,36587,36784,36914,37805,38499,38515,38663,20356,21489,23018,23241,24089,26702,29894,30142,31209,31378,33187,34541,36074,36300,36845,26015,26389,63997,22519,28503,32221,36655,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,37878,38598,24501,25074,28548,19988,20376,20511,21449,21983,23919,24046,27425,27492,30923,31642,63998,36425,36554,36974,25417,25662,30528,31364,37679,38015,40810,25776,28591,29158,29864,29914,31428,31762,32386,31922,32408,35738,36106,38013,39184,39244,21049,23519,25830,26413,32046,20717,21443,22649,24920,24921,25082,26028,31449,35730,35734,20489,20513,21109,21809,23100,24288,24432,24884,25950,26124,26166,26274,27085,28356,28466,29462,30241,31379,33081,33369,33750,33980,20661,22512,23488,23528,24425,25505,30758,32181,33756,34081,37319,37365,20874,26613,31574,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36012,20932,22971,24765,34389,20508,63999,21076,23610,24957,25114,25299,25842,26021,28364,30240,33034,36448,38495,38587,20191,21315,21912,22825,24029,25797,27849,28154,29588,31359,33307,34214,36068,36368,36983,37351,38369,38433,38854,20984,21746,21894,24505,25764,28552,32180,36639,36685,37941,20681,23574,27838,28155,29979,30651,31805,31844,35449,35522,22558,22974,24086,25463,29266,30090,30571,35548,36028,36626,24307,26228,28152,32893,33729,35531,38737,39894,64000,21059,26367,28053,28399,32224,35558,36910,36958,39636,21021,21119,21736,24980,25220,25307,26786,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26898,26970,27189,28818,28966,30813,30977,30990,31186,31245,32918,33400,33493,33609,34121,35970,36229,37218,37259,37294,20419,22225,29165,30679,34560,35320,23544,24534,26449,37032,21474,22618,23541,24740,24961,25696,32317,32880,34085,37507,25774,20652,23828,26368,22684,25277,25512,26894,27000,27166,28267,30394,31179,33467,33833,35535,36264,36861,37138,37195,37276,37648,37656,37786,38619,39478,39949,19985,30044,31069,31482,31569,31689,32302,33988,36441,36468,36600,36880,26149,26943,29763,20986,26414,40668,20805,24544,27798,34802,34909,34935,24756,33205,33795,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36101,21462,21561,22068,23094,23601,28810,32736,32858,33030,33261,36259,37257,39519,40434,20596,20164,21408,24827,28204,23652,20360,20516,21988,23769,24159,24677,26772,27835,28100,29118,30164,30196,30305,31258,31305,32199,32251,32622,33268,34473,36636,38601,39347,40786,21063,21189,39149,35242,19971,26578,28422,20405,23522,26517,27784,28024,29723,30759,37341,37756,34756,31204,31281,24555,20182,21668,21822,22702,22949,24816,25171,25302,26422,26965,33333,38464,39345,39389,20524,21331,21828,22396,64001,25176,64002,25826,26219,26589,28609,28655,29730,29752,35351,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,37944,21585,22022,22374,24392,24986,27470,28760,28845,32187,35477,22890,33067,25506,30472,32829,36010,22612,25645,27067,23445,24081,28271,64003,34153,20812,21488,22826,24608,24907,27526,27760,27888,31518,32974,33492,36294,37040,39089,64004,25799,28580,25745,25860,20814,21520,22303,35342,24927,26742,64005,30171,31570,32113,36890,22534,27084,33151,35114,36864,38969,20600,22871,22956,25237,36879,39722,24925,29305,38358,22369,23110,24052,25226,25773,25850,26487,27874,27966,29228,29750,30772,32631,33453,36315,38935,21028,22338,26495,29256,29923,36009,36774,37393,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,38442,20843,21485,25420,20329,21764,24726,25943,27803,28031,29260,29437,31255,35207,35997,24429,28558,28921,33192,24846,20415,20559,25153,29255,31687,32232,32745,36941,38829,39449,36022,22378,24179,26544,33805,35413,21536,23318,24163,24290,24330,25987,32954,34109,38281,38491,20296,21253,21261,21263,21638,21754,22275,24067,24598,25243,25265,25429,64006,27873,28006,30129,30770,32990,33071,33502,33889,33970,34957,35090,36875,37610,39165,39825,24133,26292,26333,28689,29190,64007,20469,21117,24426,24915,26451,27161,28418,29922,31080,34920,35961,39111,39108,39491,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21697,31263,26963,35575,35914,39080,39342,24444,25259,30130,30382,34987,36991,38466,21305,24380,24517,27852,29644,30050,30091,31558,33534,39325,20047,36924,19979,20309,21414,22799,24264,26160,27827,29781,33655,34662,36032,36944,38686,39957,22737,23416,34384,35604,40372,23506,24680,24717,26097,27735,28450,28579,28698,32597,32752,38289,38290,38480,38867,21106,36676,20989,21547,21688,21859,21898,27323,28085,32216,33382,37532,38519,40569,21512,21704,30418,34532,38308,38356,38492,20130,20233,23022,23270,24055,24658,25239,26477,26689,27782,28207,32568,32923,33322,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,64008,64009,38917,20133,20565,21683,22419,22874,23401,23475,25032,26999,28023,28707,34809,35299,35442,35559,36994,39405,39608,21182,26680,20502,24184,26447,33607,34892,20139,21521,22190,29670,37141,38911,39177,39255,39321,22099,22687,34395,35377,25010,27382,29563,36562,27463,38570,39511,22869,29184,36203,38761,20436,23796,24358,25080,26203,27883,28843,29572,29625,29694,30505,30541,32067,32098,32291,33335,34898,64010,36066,37449,39023,23377,31348,34880,38913,23244,20448,21332,22846,23805,25406,28025,29433,33029,33031,33698,37583,38960,20136,20804,21009,22411,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,24418,27842,28366,28677,28752,28847,29074,29673,29801,33610,34722,34913,36872,37026,37795,39336,20846,24407,24800,24935,26291,34137,36426,37295,38795,20046,20114,21628,22741,22778,22909,23733,24359,25142,25160,26122,26215,27627,28009,28111,28246,28408,28564,28640,28649,28765,29392,29733,29786,29920,30355,31068,31946,32286,32993,33446,33899,33983,34382,34399,34676,35703,35946,37804,38912,39013,24785,25110,37239,23130,26127,28151,28222,29759,39746,24573,24794,31503,21700,24344,27742,27859,27946,28888,32005,34425,35340,40251,21270,21644,23301,27194,28779,30069,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31117,31166,33457,33775,35441,35649,36008,38772,64011,25844,25899,30906,30907,31339,20024,21914,22864,23462,24187,24739,25563,27489,26213,26707,28185,29029,29872,32008,36996,39529,39973,27963,28369,29502,35905,38346,20976,24140,24488,24653,24822,24880,24908,26179,26180,27045,27841,28255,28361,28514,29004,29852,30343,31681,31783,33618,34647,36945,38541,40643,21295,22238,24315,24458,24674,24724,25079,26214,26371,27292,28142,28590,28784,29546,32362,33214,33588,34516,35496,36036,21123,29554,23446,27243,37892,21742,22150,23389,25928,25989,26313,26783,28045,28102,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,29243,32948,37237,39501,20399,20505,21402,21518,21564,21897,21957,24127,24460,26429,29030,29661,36869,21211,21235,22628,22734,28932,29071,29179,34224,35347,26248,34216,21927,26244,29002,33841,21321,21913,27585,24409,24509,25582,26249,28999,35569,36637,40638,20241,25658,28875,30054,34407,24676,35662,40440,20807,20982,21256,27958,33016,40657,26133,27427,28824,30165,21507,23673,32007,35350,27424,27453,27462,21560,24688,27965,32725,33288,20694,20958,21916,22123,22221,23020,23305,24076,24985,24984,25137,26206,26342,29081,29113,29114,29351,31143,31232,32690,35440,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null], + "gb18030":[19970,19972,19973,19974,19983,19986,19991,19999,20000,20001,20003,20006,20009,20014,20015,20017,20019,20021,20023,20028,20032,20033,20034,20036,20038,20042,20049,20053,20055,20058,20059,20066,20067,20068,20069,20071,20072,20074,20075,20076,20077,20078,20079,20082,20084,20085,20086,20087,20088,20089,20090,20091,20092,20093,20095,20096,20097,20098,20099,20100,20101,20103,20106,20112,20118,20119,20121,20124,20125,20126,20131,20138,20143,20144,20145,20148,20150,20151,20152,20153,20156,20157,20158,20168,20172,20175,20176,20178,20186,20187,20188,20192,20194,20198,20199,20201,20205,20206,20207,20209,20212,20216,20217,20218,20220,20222,20224,20226,20227,20228,20229,20230,20231,20232,20235,20236,20242,20243,20244,20245,20246,20252,20253,20257,20259,20264,20265,20268,20269,20270,20273,20275,20277,20279,20281,20283,20286,20287,20288,20289,20290,20292,20293,20295,20296,20297,20298,20299,20300,20306,20308,20310,20321,20322,20326,20328,20330,20331,20333,20334,20337,20338,20341,20343,20344,20345,20346,20349,20352,20353,20354,20357,20358,20359,20362,20364,20366,20368,20370,20371,20373,20374,20376,20377,20378,20380,20382,20383,20385,20386,20388,20395,20397,20400,20401,20402,20403,20404,20406,20407,20408,20409,20410,20411,20412,20413,20414,20416,20417,20418,20422,20423,20424,20425,20427,20428,20429,20434,20435,20436,20437,20438,20441,20443,20448,20450,20452,20453,20455,20459,20460,20464,20466,20468,20469,20470,20471,20473,20475,20476,20477,20479,20480,20481,20482,20483,20484,20485,20486,20487,20488,20489,20490,20491,20494,20496,20497,20499,20501,20502,20503,20507,20509,20510,20512,20514,20515,20516,20519,20523,20527,20528,20529,20530,20531,20532,20533,20534,20535,20536,20537,20539,20541,20543,20544,20545,20546,20548,20549,20550,20553,20554,20555,20557,20560,20561,20562,20563,20564,20566,20567,20568,20569,20571,20573,20574,20575,20576,20577,20578,20579,20580,20582,20583,20584,20585,20586,20587,20589,20590,20591,20592,20593,20594,20595,20596,20597,20600,20601,20602,20604,20605,20609,20610,20611,20612,20614,20615,20617,20618,20619,20620,20622,20623,20624,20625,20626,20627,20628,20629,20630,20631,20632,20633,20634,20635,20636,20637,20638,20639,20640,20641,20642,20644,20646,20650,20651,20653,20654,20655,20656,20657,20659,20660,20661,20662,20663,20664,20665,20668,20669,20670,20671,20672,20673,20674,20675,20676,20677,20678,20679,20680,20681,20682,20683,20684,20685,20686,20688,20689,20690,20691,20692,20693,20695,20696,20697,20699,20700,20701,20702,20703,20704,20705,20706,20707,20708,20709,20712,20713,20714,20715,20719,20720,20721,20722,20724,20726,20727,20728,20729,20730,20732,20733,20734,20735,20736,20737,20738,20739,20740,20741,20744,20745,20746,20748,20749,20750,20751,20752,20753,20755,20756,20757,20758,20759,20760,20761,20762,20763,20764,20765,20766,20767,20768,20770,20771,20772,20773,20774,20775,20776,20777,20778,20779,20780,20781,20782,20783,20784,20785,20786,20787,20788,20789,20790,20791,20792,20793,20794,20795,20796,20797,20798,20802,20807,20810,20812,20814,20815,20816,20818,20819,20823,20824,20825,20827,20829,20830,20831,20832,20833,20835,20836,20838,20839,20841,20842,20847,20850,20858,20862,20863,20867,20868,20870,20871,20874,20875,20878,20879,20880,20881,20883,20884,20888,20890,20893,20894,20895,20897,20899,20902,20903,20904,20905,20906,20909,20910,20916,20920,20921,20922,20926,20927,20929,20930,20931,20933,20936,20938,20941,20942,20944,20946,20947,20948,20949,20950,20951,20952,20953,20954,20956,20958,20959,20962,20963,20965,20966,20967,20968,20969,20970,20972,20974,20977,20978,20980,20983,20990,20996,20997,21001,21003,21004,21007,21008,21011,21012,21013,21020,21022,21023,21025,21026,21027,21029,21030,21031,21034,21036,21039,21041,21042,21044,21045,21052,21054,21060,21061,21062,21063,21064,21065,21067,21070,21071,21074,21075,21077,21079,21080,21081,21082,21083,21085,21087,21088,21090,21091,21092,21094,21096,21099,21100,21101,21102,21104,21105,21107,21108,21109,21110,21111,21112,21113,21114,21115,21116,21118,21120,21123,21124,21125,21126,21127,21129,21130,21131,21132,21133,21134,21135,21137,21138,21140,21141,21142,21143,21144,21145,21146,21148,21156,21157,21158,21159,21166,21167,21168,21172,21173,21174,21175,21176,21177,21178,21179,21180,21181,21184,21185,21186,21188,21189,21190,21192,21194,21196,21197,21198,21199,21201,21203,21204,21205,21207,21209,21210,21211,21212,21213,21214,21216,21217,21218,21219,21221,21222,21223,21224,21225,21226,21227,21228,21229,21230,21231,21233,21234,21235,21236,21237,21238,21239,21240,21243,21244,21245,21249,21250,21251,21252,21255,21257,21258,21259,21260,21262,21265,21266,21267,21268,21272,21275,21276,21278,21279,21282,21284,21285,21287,21288,21289,21291,21292,21293,21295,21296,21297,21298,21299,21300,21301,21302,21303,21304,21308,21309,21312,21314,21316,21318,21323,21324,21325,21328,21332,21336,21337,21339,21341,21349,21352,21354,21356,21357,21362,21366,21369,21371,21372,21373,21374,21376,21377,21379,21383,21384,21386,21390,21391,21392,21393,21394,21395,21396,21398,21399,21401,21403,21404,21406,21408,21409,21412,21415,21418,21419,21420,21421,21423,21424,21425,21426,21427,21428,21429,21431,21432,21433,21434,21436,21437,21438,21440,21443,21444,21445,21446,21447,21454,21455,21456,21458,21459,21461,21466,21468,21469,21470,21473,21474,21479,21492,21498,21502,21503,21504,21506,21509,21511,21515,21524,21528,21529,21530,21532,21538,21540,21541,21546,21552,21555,21558,21559,21562,21565,21567,21569,21570,21572,21573,21575,21577,21580,21581,21582,21583,21585,21594,21597,21598,21599,21600,21601,21603,21605,21607,21609,21610,21611,21612,21613,21614,21615,21616,21620,21625,21626,21630,21631,21633,21635,21637,21639,21640,21641,21642,21645,21649,21651,21655,21656,21660,21662,21663,21664,21665,21666,21669,21678,21680,21682,21685,21686,21687,21689,21690,21692,21694,21699,21701,21706,21707,21718,21720,21723,21728,21729,21730,21731,21732,21739,21740,21743,21744,21745,21748,21749,21750,21751,21752,21753,21755,21758,21760,21762,21763,21764,21765,21768,21770,21771,21772,21773,21774,21778,21779,21781,21782,21783,21784,21785,21786,21788,21789,21790,21791,21793,21797,21798,21800,21801,21803,21805,21810,21812,21813,21814,21816,21817,21818,21819,21821,21824,21826,21829,21831,21832,21835,21836,21837,21838,21839,21841,21842,21843,21844,21847,21848,21849,21850,21851,21853,21854,21855,21856,21858,21859,21864,21865,21867,21871,21872,21873,21874,21875,21876,21881,21882,21885,21887,21893,21894,21900,21901,21902,21904,21906,21907,21909,21910,21911,21914,21915,21918,21920,21921,21922,21923,21924,21925,21926,21928,21929,21930,21931,21932,21933,21934,21935,21936,21938,21940,21942,21944,21946,21948,21951,21952,21953,21954,21955,21958,21959,21960,21962,21963,21966,21967,21968,21973,21975,21976,21977,21978,21979,21982,21984,21986,21991,21993,21997,21998,22000,22001,22004,22006,22008,22009,22010,22011,22012,22015,22018,22019,22020,22021,22022,22023,22026,22027,22029,22032,22033,22034,22035,22036,22037,22038,22039,22041,22042,22044,22045,22048,22049,22050,22053,22054,22056,22057,22058,22059,22062,22063,22064,22067,22069,22071,22072,22074,22076,22077,22078,22080,22081,22082,22083,22084,22085,22086,22087,22088,22089,22090,22091,22095,22096,22097,22098,22099,22101,22102,22106,22107,22109,22110,22111,22112,22113,22115,22117,22118,22119,22125,22126,22127,22128,22130,22131,22132,22133,22135,22136,22137,22138,22141,22142,22143,22144,22145,22146,22147,22148,22151,22152,22153,22154,22155,22156,22157,22160,22161,22162,22164,22165,22166,22167,22168,22169,22170,22171,22172,22173,22174,22175,22176,22177,22178,22180,22181,22182,22183,22184,22185,22186,22187,22188,22189,22190,22192,22193,22194,22195,22196,22197,22198,22200,22201,22202,22203,22205,22206,22207,22208,22209,22210,22211,22212,22213,22214,22215,22216,22217,22219,22220,22221,22222,22223,22224,22225,22226,22227,22229,22230,22232,22233,22236,22243,22245,22246,22247,22248,22249,22250,22252,22254,22255,22258,22259,22262,22263,22264,22267,22268,22272,22273,22274,22277,22279,22283,22284,22285,22286,22287,22288,22289,22290,22291,22292,22293,22294,22295,22296,22297,22298,22299,22301,22302,22304,22305,22306,22308,22309,22310,22311,22315,22321,22322,22324,22325,22326,22327,22328,22332,22333,22335,22337,22339,22340,22341,22342,22344,22345,22347,22354,22355,22356,22357,22358,22360,22361,22370,22371,22373,22375,22380,22382,22384,22385,22386,22388,22389,22392,22393,22394,22397,22398,22399,22400,22401,22407,22408,22409,22410,22413,22414,22415,22416,22417,22420,22421,22422,22423,22424,22425,22426,22428,22429,22430,22431,22437,22440,22442,22444,22447,22448,22449,22451,22453,22454,22455,22457,22458,22459,22460,22461,22462,22463,22464,22465,22468,22469,22470,22471,22472,22473,22474,22476,22477,22480,22481,22483,22486,22487,22491,22492,22494,22497,22498,22499,22501,22502,22503,22504,22505,22506,22507,22508,22510,22512,22513,22514,22515,22517,22518,22519,22523,22524,22526,22527,22529,22531,22532,22533,22536,22537,22538,22540,22542,22543,22544,22546,22547,22548,22550,22551,22552,22554,22555,22556,22557,22559,22562,22563,22565,22566,22567,22568,22569,22571,22572,22573,22574,22575,22577,22578,22579,22580,22582,22583,22584,22585,22586,22587,22588,22589,22590,22591,22592,22593,22594,22595,22597,22598,22599,22600,22601,22602,22603,22606,22607,22608,22610,22611,22613,22614,22615,22617,22618,22619,22620,22621,22623,22624,22625,22626,22627,22628,22630,22631,22632,22633,22634,22637,22638,22639,22640,22641,22642,22643,22644,22645,22646,22647,22648,22649,22650,22651,22652,22653,22655,22658,22660,22662,22663,22664,22666,22667,22668,22669,22670,22671,22672,22673,22676,22677,22678,22679,22680,22683,22684,22685,22688,22689,22690,22691,22692,22693,22694,22695,22698,22699,22700,22701,22702,22703,22704,22705,22706,22707,22708,22709,22710,22711,22712,22713,22714,22715,22717,22718,22719,22720,22722,22723,22724,22726,22727,22728,22729,22730,22731,22732,22733,22734,22735,22736,22738,22739,22740,22742,22743,22744,22745,22746,22747,22748,22749,22750,22751,22752,22753,22754,22755,22757,22758,22759,22760,22761,22762,22765,22767,22769,22770,22772,22773,22775,22776,22778,22779,22780,22781,22782,22783,22784,22785,22787,22789,22790,22792,22793,22794,22795,22796,22798,22800,22801,22802,22803,22807,22808,22811,22813,22814,22816,22817,22818,22819,22822,22824,22828,22832,22834,22835,22837,22838,22843,22845,22846,22847,22848,22851,22853,22854,22858,22860,22861,22864,22866,22867,22873,22875,22876,22877,22878,22879,22881,22883,22884,22886,22887,22888,22889,22890,22891,22892,22893,22894,22895,22896,22897,22898,22901,22903,22906,22907,22908,22910,22911,22912,22917,22921,22923,22924,22926,22927,22928,22929,22932,22933,22936,22938,22939,22940,22941,22943,22944,22945,22946,22950,22951,22956,22957,22960,22961,22963,22964,22965,22966,22967,22968,22970,22972,22973,22975,22976,22977,22978,22979,22980,22981,22983,22984,22985,22988,22989,22990,22991,22997,22998,23001,23003,23006,23007,23008,23009,23010,23012,23014,23015,23017,23018,23019,23021,23022,23023,23024,23025,23026,23027,23028,23029,23030,23031,23032,23034,23036,23037,23038,23040,23042,23050,23051,23053,23054,23055,23056,23058,23060,23061,23062,23063,23065,23066,23067,23069,23070,23073,23074,23076,23078,23079,23080,23082,23083,23084,23085,23086,23087,23088,23091,23093,23095,23096,23097,23098,23099,23101,23102,23103,23105,23106,23107,23108,23109,23111,23112,23115,23116,23117,23118,23119,23120,23121,23122,23123,23124,23126,23127,23128,23129,23131,23132,23133,23134,23135,23136,23137,23139,23140,23141,23142,23144,23145,23147,23148,23149,23150,23151,23152,23153,23154,23155,23160,23161,23163,23164,23165,23166,23168,23169,23170,23171,23172,23173,23174,23175,23176,23177,23178,23179,23180,23181,23182,23183,23184,23185,23187,23188,23189,23190,23191,23192,23193,23196,23197,23198,23199,23200,23201,23202,23203,23204,23205,23206,23207,23208,23209,23211,23212,23213,23214,23215,23216,23217,23220,23222,23223,23225,23226,23227,23228,23229,23231,23232,23235,23236,23237,23238,23239,23240,23242,23243,23245,23246,23247,23248,23249,23251,23253,23255,23257,23258,23259,23261,23262,23263,23266,23268,23269,23271,23272,23274,23276,23277,23278,23279,23280,23282,23283,23284,23285,23286,23287,23288,23289,23290,23291,23292,23293,23294,23295,23296,23297,23298,23299,23300,23301,23302,23303,23304,23306,23307,23308,23309,23310,23311,23312,23313,23314,23315,23316,23317,23320,23321,23322,23323,23324,23325,23326,23327,23328,23329,23330,23331,23332,23333,23334,23335,23336,23337,23338,23339,23340,23341,23342,23343,23344,23345,23347,23349,23350,23352,23353,23354,23355,23356,23357,23358,23359,23361,23362,23363,23364,23365,23366,23367,23368,23369,23370,23371,23372,23373,23374,23375,23378,23382,23390,23392,23393,23399,23400,23403,23405,23406,23407,23410,23412,23414,23415,23416,23417,23419,23420,23422,23423,23426,23430,23434,23437,23438,23440,23441,23442,23444,23446,23455,23463,23464,23465,23468,23469,23470,23471,23473,23474,23479,23482,23483,23484,23488,23489,23491,23496,23497,23498,23499,23501,23502,23503,23505,23508,23509,23510,23511,23512,23513,23514,23515,23516,23520,23522,23523,23526,23527,23529,23530,23531,23532,23533,23535,23537,23538,23539,23540,23541,23542,23543,23549,23550,23552,23554,23555,23557,23559,23560,23563,23564,23565,23566,23568,23570,23571,23575,23577,23579,23582,23583,23584,23585,23587,23590,23592,23593,23594,23595,23597,23598,23599,23600,23602,23603,23605,23606,23607,23619,23620,23622,23623,23628,23629,23634,23635,23636,23638,23639,23640,23642,23643,23644,23645,23647,23650,23652,23655,23656,23657,23658,23659,23660,23661,23664,23666,23667,23668,23669,23670,23671,23672,23675,23676,23677,23678,23680,23683,23684,23685,23686,23687,23689,23690,23691,23694,23695,23698,23699,23701,23709,23710,23711,23712,23713,23716,23717,23718,23719,23720,23722,23726,23727,23728,23730,23732,23734,23737,23738,23739,23740,23742,23744,23746,23747,23749,23750,23751,23752,23753,23754,23756,23757,23758,23759,23760,23761,23763,23764,23765,23766,23767,23768,23770,23771,23772,23773,23774,23775,23776,23778,23779,23783,23785,23787,23788,23790,23791,23793,23794,23795,23796,23797,23798,23799,23800,23801,23802,23804,23805,23806,23807,23808,23809,23812,23813,23816,23817,23818,23819,23820,23821,23823,23824,23825,23826,23827,23829,23831,23832,23833,23834,23836,23837,23839,23840,23841,23842,23843,23845,23848,23850,23851,23852,23855,23856,23857,23858,23859,23861,23862,23863,23864,23865,23866,23867,23868,23871,23872,23873,23874,23875,23876,23877,23878,23880,23881,23885,23886,23887,23888,23889,23890,23891,23892,23893,23894,23895,23897,23898,23900,23902,23903,23904,23905,23906,23907,23908,23909,23910,23911,23912,23914,23917,23918,23920,23921,23922,23923,23925,23926,23927,23928,23929,23930,23931,23932,23933,23934,23935,23936,23937,23939,23940,23941,23942,23943,23944,23945,23946,23947,23948,23949,23950,23951,23952,23953,23954,23955,23956,23957,23958,23959,23960,23962,23963,23964,23966,23967,23968,23969,23970,23971,23972,23973,23974,23975,23976,23977,23978,23979,23980,23981,23982,23983,23984,23985,23986,23987,23988,23989,23990,23992,23993,23994,23995,23996,23997,23998,23999,24000,24001,24002,24003,24004,24006,24007,24008,24009,24010,24011,24012,24014,24015,24016,24017,24018,24019,24020,24021,24022,24023,24024,24025,24026,24028,24031,24032,24035,24036,24042,24044,24045,24048,24053,24054,24056,24057,24058,24059,24060,24063,24064,24068,24071,24073,24074,24075,24077,24078,24082,24083,24087,24094,24095,24096,24097,24098,24099,24100,24101,24104,24105,24106,24107,24108,24111,24112,24114,24115,24116,24117,24118,24121,24122,24126,24127,24128,24129,24131,24134,24135,24136,24137,24138,24139,24141,24142,24143,24144,24145,24146,24147,24150,24151,24152,24153,24154,24156,24157,24159,24160,24163,24164,24165,24166,24167,24168,24169,24170,24171,24172,24173,24174,24175,24176,24177,24181,24183,24185,24190,24193,24194,24195,24197,24200,24201,24204,24205,24206,24210,24216,24219,24221,24225,24226,24227,24228,24232,24233,24234,24235,24236,24238,24239,24240,24241,24242,24244,24250,24251,24252,24253,24255,24256,24257,24258,24259,24260,24261,24262,24263,24264,24267,24268,24269,24270,24271,24272,24276,24277,24279,24280,24281,24282,24284,24285,24286,24287,24288,24289,24290,24291,24292,24293,24294,24295,24297,24299,24300,24301,24302,24303,24304,24305,24306,24307,24309,24312,24313,24315,24316,24317,24325,24326,24327,24329,24332,24333,24334,24336,24338,24340,24342,24345,24346,24348,24349,24350,24353,24354,24355,24356,24360,24363,24364,24366,24368,24370,24371,24372,24373,24374,24375,24376,24379,24381,24382,24383,24385,24386,24387,24388,24389,24390,24391,24392,24393,24394,24395,24396,24397,24398,24399,24401,24404,24409,24410,24411,24412,24414,24415,24416,24419,24421,24423,24424,24427,24430,24431,24434,24436,24437,24438,24440,24442,24445,24446,24447,24451,24454,24461,24462,24463,24465,24467,24468,24470,24474,24475,24477,24478,24479,24480,24482,24483,24484,24485,24486,24487,24489,24491,24492,24495,24496,24497,24498,24499,24500,24502,24504,24505,24506,24507,24510,24511,24512,24513,24514,24519,24520,24522,24523,24526,24531,24532,24533,24538,24539,24540,24542,24543,24546,24547,24549,24550,24552,24553,24556,24559,24560,24562,24563,24564,24566,24567,24569,24570,24572,24583,24584,24585,24587,24588,24592,24593,24595,24599,24600,24602,24606,24607,24610,24611,24612,24620,24621,24622,24624,24625,24626,24627,24628,24630,24631,24632,24633,24634,24637,24638,24640,24644,24645,24646,24647,24648,24649,24650,24652,24654,24655,24657,24659,24660,24662,24663,24664,24667,24668,24670,24671,24672,24673,24677,24678,24686,24689,24690,24692,24693,24695,24702,24704,24705,24706,24709,24710,24711,24712,24714,24715,24718,24719,24720,24721,24723,24725,24727,24728,24729,24732,24734,24737,24738,24740,24741,24743,24745,24746,24750,24752,24755,24757,24758,24759,24761,24762,24765,24766,24767,24768,24769,24770,24771,24772,24775,24776,24777,24780,24781,24782,24783,24784,24786,24787,24788,24790,24791,24793,24795,24798,24801,24802,24803,24804,24805,24810,24817,24818,24821,24823,24824,24827,24828,24829,24830,24831,24834,24835,24836,24837,24839,24842,24843,24844,24848,24849,24850,24851,24852,24854,24855,24856,24857,24859,24860,24861,24862,24865,24866,24869,24872,24873,24874,24876,24877,24878,24879,24880,24881,24882,24883,24884,24885,24886,24887,24888,24889,24890,24891,24892,24893,24894,24896,24897,24898,24899,24900,24901,24902,24903,24905,24907,24909,24911,24912,24914,24915,24916,24918,24919,24920,24921,24922,24923,24924,24926,24927,24928,24929,24931,24932,24933,24934,24937,24938,24939,24940,24941,24942,24943,24945,24946,24947,24948,24950,24952,24953,24954,24955,24956,24957,24958,24959,24960,24961,24962,24963,24964,24965,24966,24967,24968,24969,24970,24972,24973,24975,24976,24977,24978,24979,24981,24982,24983,24984,24985,24986,24987,24988,24990,24991,24992,24993,24994,24995,24996,24997,24998,25002,25003,25005,25006,25007,25008,25009,25010,25011,25012,25013,25014,25016,25017,25018,25019,25020,25021,25023,25024,25025,25027,25028,25029,25030,25031,25033,25036,25037,25038,25039,25040,25043,25045,25046,25047,25048,25049,25050,25051,25052,25053,25054,25055,25056,25057,25058,25059,25060,25061,25063,25064,25065,25066,25067,25068,25069,25070,25071,25072,25073,25074,25075,25076,25078,25079,25080,25081,25082,25083,25084,25085,25086,25088,25089,25090,25091,25092,25093,25095,25097,25107,25108,25113,25116,25117,25118,25120,25123,25126,25127,25128,25129,25131,25133,25135,25136,25137,25138,25141,25142,25144,25145,25146,25147,25148,25154,25156,25157,25158,25162,25167,25168,25173,25174,25175,25177,25178,25180,25181,25182,25183,25184,25185,25186,25188,25189,25192,25201,25202,25204,25205,25207,25208,25210,25211,25213,25217,25218,25219,25221,25222,25223,25224,25227,25228,25229,25230,25231,25232,25236,25241,25244,25245,25246,25251,25254,25255,25257,25258,25261,25262,25263,25264,25266,25267,25268,25270,25271,25272,25274,25278,25280,25281,25283,25291,25295,25297,25301,25309,25310,25312,25313,25316,25322,25323,25328,25330,25333,25336,25337,25338,25339,25344,25347,25348,25349,25350,25354,25355,25356,25357,25359,25360,25362,25363,25364,25365,25367,25368,25369,25372,25382,25383,25385,25388,25389,25390,25392,25393,25395,25396,25397,25398,25399,25400,25403,25404,25406,25407,25408,25409,25412,25415,25416,25418,25425,25426,25427,25428,25430,25431,25432,25433,25434,25435,25436,25437,25440,25444,25445,25446,25448,25450,25451,25452,25455,25456,25458,25459,25460,25461,25464,25465,25468,25469,25470,25471,25473,25475,25476,25477,25478,25483,25485,25489,25491,25492,25493,25495,25497,25498,25499,25500,25501,25502,25503,25505,25508,25510,25515,25519,25521,25522,25525,25526,25529,25531,25533,25535,25536,25537,25538,25539,25541,25543,25544,25546,25547,25548,25553,25555,25556,25557,25559,25560,25561,25562,25563,25564,25565,25567,25570,25572,25573,25574,25575,25576,25579,25580,25582,25583,25584,25585,25587,25589,25591,25593,25594,25595,25596,25598,25603,25604,25606,25607,25608,25609,25610,25613,25614,25617,25618,25621,25622,25623,25624,25625,25626,25629,25631,25634,25635,25636,25637,25639,25640,25641,25643,25646,25647,25648,25649,25650,25651,25653,25654,25655,25656,25657,25659,25660,25662,25664,25666,25667,25673,25675,25676,25677,25678,25679,25680,25681,25683,25685,25686,25687,25689,25690,25691,25692,25693,25695,25696,25697,25698,25699,25700,25701,25702,25704,25706,25707,25708,25710,25711,25712,25713,25714,25715,25716,25717,25718,25719,25723,25724,25725,25726,25727,25728,25729,25731,25734,25736,25737,25738,25739,25740,25741,25742,25743,25744,25747,25748,25751,25752,25754,25755,25756,25757,25759,25760,25761,25762,25763,25765,25766,25767,25768,25770,25771,25775,25777,25778,25779,25780,25782,25785,25787,25789,25790,25791,25793,25795,25796,25798,25799,25800,25801,25802,25803,25804,25807,25809,25811,25812,25813,25814,25817,25818,25819,25820,25821,25823,25824,25825,25827,25829,25831,25832,25833,25834,25835,25836,25837,25838,25839,25840,25841,25842,25843,25844,25845,25846,25847,25848,25849,25850,25851,25852,25853,25854,25855,25857,25858,25859,25860,25861,25862,25863,25864,25866,25867,25868,25869,25870,25871,25872,25873,25875,25876,25877,25878,25879,25881,25882,25883,25884,25885,25886,25887,25888,25889,25890,25891,25892,25894,25895,25896,25897,25898,25900,25901,25904,25905,25906,25907,25911,25914,25916,25917,25920,25921,25922,25923,25924,25926,25927,25930,25931,25933,25934,25936,25938,25939,25940,25943,25944,25946,25948,25951,25952,25953,25956,25957,25959,25960,25961,25962,25965,25966,25967,25969,25971,25973,25974,25976,25977,25978,25979,25980,25981,25982,25983,25984,25985,25986,25987,25988,25989,25990,25992,25993,25994,25997,25998,25999,26002,26004,26005,26006,26008,26010,26013,26014,26016,26018,26019,26022,26024,26026,26028,26030,26033,26034,26035,26036,26037,26038,26039,26040,26042,26043,26046,26047,26048,26050,26055,26056,26057,26058,26061,26064,26065,26067,26068,26069,26072,26073,26074,26075,26076,26077,26078,26079,26081,26083,26084,26090,26091,26098,26099,26100,26101,26104,26105,26107,26108,26109,26110,26111,26113,26116,26117,26119,26120,26121,26123,26125,26128,26129,26130,26134,26135,26136,26138,26139,26140,26142,26145,26146,26147,26148,26150,26153,26154,26155,26156,26158,26160,26162,26163,26167,26168,26169,26170,26171,26173,26175,26176,26178,26180,26181,26182,26183,26184,26185,26186,26189,26190,26192,26193,26200,26201,26203,26204,26205,26206,26208,26210,26211,26213,26215,26217,26218,26219,26220,26221,26225,26226,26227,26229,26232,26233,26235,26236,26237,26239,26240,26241,26243,26245,26246,26248,26249,26250,26251,26253,26254,26255,26256,26258,26259,26260,26261,26264,26265,26266,26267,26268,26270,26271,26272,26273,26274,26275,26276,26277,26278,26281,26282,26283,26284,26285,26287,26288,26289,26290,26291,26293,26294,26295,26296,26298,26299,26300,26301,26303,26304,26305,26306,26307,26308,26309,26310,26311,26312,26313,26314,26315,26316,26317,26318,26319,26320,26321,26322,26323,26324,26325,26326,26327,26328,26330,26334,26335,26336,26337,26338,26339,26340,26341,26343,26344,26346,26347,26348,26349,26350,26351,26353,26357,26358,26360,26362,26363,26365,26369,26370,26371,26372,26373,26374,26375,26380,26382,26383,26385,26386,26387,26390,26392,26393,26394,26396,26398,26400,26401,26402,26403,26404,26405,26407,26409,26414,26416,26418,26419,26422,26423,26424,26425,26427,26428,26430,26431,26433,26436,26437,26439,26442,26443,26445,26450,26452,26453,26455,26456,26457,26458,26459,26461,26466,26467,26468,26470,26471,26475,26476,26478,26481,26484,26486,26488,26489,26490,26491,26493,26496,26498,26499,26501,26502,26504,26506,26508,26509,26510,26511,26513,26514,26515,26516,26518,26521,26523,26527,26528,26529,26532,26534,26537,26540,26542,26545,26546,26548,26553,26554,26555,26556,26557,26558,26559,26560,26562,26565,26566,26567,26568,26569,26570,26571,26572,26573,26574,26581,26582,26583,26587,26591,26593,26595,26596,26598,26599,26600,26602,26603,26605,26606,26610,26613,26614,26615,26616,26617,26618,26619,26620,26622,26625,26626,26627,26628,26630,26637,26640,26642,26644,26645,26648,26649,26650,26651,26652,26654,26655,26656,26658,26659,26660,26661,26662,26663,26664,26667,26668,26669,26670,26671,26672,26673,26676,26677,26678,26682,26683,26687,26695,26699,26701,26703,26706,26710,26711,26712,26713,26714,26715,26716,26717,26718,26719,26730,26732,26733,26734,26735,26736,26737,26738,26739,26741,26744,26745,26746,26747,26748,26749,26750,26751,26752,26754,26756,26759,26760,26761,26762,26763,26764,26765,26766,26768,26769,26770,26772,26773,26774,26776,26777,26778,26779,26780,26781,26782,26783,26784,26785,26787,26788,26789,26793,26794,26795,26796,26798,26801,26802,26804,26806,26807,26808,26809,26810,26811,26812,26813,26814,26815,26817,26819,26820,26821,26822,26823,26824,26826,26828,26830,26831,26832,26833,26835,26836,26838,26839,26841,26843,26844,26845,26846,26847,26849,26850,26852,26853,26854,26855,26856,26857,26858,26859,26860,26861,26863,26866,26867,26868,26870,26871,26872,26875,26877,26878,26879,26880,26882,26883,26884,26886,26887,26888,26889,26890,26892,26895,26897,26899,26900,26901,26902,26903,26904,26905,26906,26907,26908,26909,26910,26913,26914,26915,26917,26918,26919,26920,26921,26922,26923,26924,26926,26927,26929,26930,26931,26933,26934,26935,26936,26938,26939,26940,26942,26944,26945,26947,26948,26949,26950,26951,26952,26953,26954,26955,26956,26957,26958,26959,26960,26961,26962,26963,26965,26966,26968,26969,26971,26972,26975,26977,26978,26980,26981,26983,26984,26985,26986,26988,26989,26991,26992,26994,26995,26996,26997,26998,27002,27003,27005,27006,27007,27009,27011,27013,27018,27019,27020,27022,27023,27024,27025,27026,27027,27030,27031,27033,27034,27037,27038,27039,27040,27041,27042,27043,27044,27045,27046,27049,27050,27052,27054,27055,27056,27058,27059,27061,27062,27064,27065,27066,27068,27069,27070,27071,27072,27074,27075,27076,27077,27078,27079,27080,27081,27083,27085,27087,27089,27090,27091,27093,27094,27095,27096,27097,27098,27100,27101,27102,27105,27106,27107,27108,27109,27110,27111,27112,27113,27114,27115,27116,27118,27119,27120,27121,27123,27124,27125,27126,27127,27128,27129,27130,27131,27132,27134,27136,27137,27138,27139,27140,27141,27142,27143,27144,27145,27147,27148,27149,27150,27151,27152,27153,27154,27155,27156,27157,27158,27161,27162,27163,27164,27165,27166,27168,27170,27171,27172,27173,27174,27175,27177,27179,27180,27181,27182,27184,27186,27187,27188,27190,27191,27192,27193,27194,27195,27196,27199,27200,27201,27202,27203,27205,27206,27208,27209,27210,27211,27212,27213,27214,27215,27217,27218,27219,27220,27221,27222,27223,27226,27228,27229,27230,27231,27232,27234,27235,27236,27238,27239,27240,27241,27242,27243,27244,27245,27246,27247,27248,27250,27251,27252,27253,27254,27255,27256,27258,27259,27261,27262,27263,27265,27266,27267,27269,27270,27271,27272,27273,27274,27275,27276,27277,27279,27282,27283,27284,27285,27286,27288,27289,27290,27291,27292,27293,27294,27295,27297,27298,27299,27300,27301,27302,27303,27304,27306,27309,27310,27311,27312,27313,27314,27315,27316,27317,27318,27319,27320,27321,27322,27323,27324,27325,27326,27327,27328,27329,27330,27331,27332,27333,27334,27335,27336,27337,27338,27339,27340,27341,27342,27343,27344,27345,27346,27347,27348,27349,27350,27351,27352,27353,27354,27355,27356,27357,27358,27359,27360,27361,27362,27363,27364,27365,27366,27367,27368,27369,27370,27371,27372,27373,27374,27375,27376,27377,27378,27379,27380,27381,27382,27383,27384,27385,27386,27387,27388,27389,27390,27391,27392,27393,27394,27395,27396,27397,27398,27399,27400,27401,27402,27403,27404,27405,27406,27407,27408,27409,27410,27411,27412,27413,27414,27415,27416,27417,27418,27419,27420,27421,27422,27423,27429,27430,27432,27433,27434,27435,27436,27437,27438,27439,27440,27441,27443,27444,27445,27446,27448,27451,27452,27453,27455,27456,27457,27458,27460,27461,27464,27466,27467,27469,27470,27471,27472,27473,27474,27475,27476,27477,27478,27479,27480,27482,27483,27484,27485,27486,27487,27488,27489,27496,27497,27499,27500,27501,27502,27503,27504,27505,27506,27507,27508,27509,27510,27511,27512,27514,27517,27518,27519,27520,27525,27528,27532,27534,27535,27536,27537,27540,27541,27543,27544,27545,27548,27549,27550,27551,27552,27554,27555,27556,27557,27558,27559,27560,27561,27563,27564,27565,27566,27567,27568,27569,27570,27574,27576,27577,27578,27579,27580,27581,27582,27584,27587,27588,27590,27591,27592,27593,27594,27596,27598,27600,27601,27608,27610,27612,27613,27614,27615,27616,27618,27619,27620,27621,27622,27623,27624,27625,27628,27629,27630,27632,27633,27634,27636,27638,27639,27640,27642,27643,27644,27646,27647,27648,27649,27650,27651,27652,27656,27657,27658,27659,27660,27662,27666,27671,27676,27677,27678,27680,27683,27685,27691,27692,27693,27697,27699,27702,27703,27705,27706,27707,27708,27710,27711,27715,27716,27717,27720,27723,27724,27725,27726,27727,27729,27730,27731,27734,27736,27737,27738,27746,27747,27749,27750,27751,27755,27756,27757,27758,27759,27761,27763,27765,27767,27768,27770,27771,27772,27775,27776,27780,27783,27786,27787,27789,27790,27793,27794,27797,27798,27799,27800,27802,27804,27805,27806,27808,27810,27816,27820,27823,27824,27828,27829,27830,27831,27834,27840,27841,27842,27843,27846,27847,27848,27851,27853,27854,27855,27857,27858,27864,27865,27866,27868,27869,27871,27876,27878,27879,27881,27884,27885,27890,27892,27897,27903,27904,27906,27907,27909,27910,27912,27913,27914,27917,27919,27920,27921,27923,27924,27925,27926,27928,27932,27933,27935,27936,27937,27938,27939,27940,27942,27944,27945,27948,27949,27951,27952,27956,27958,27959,27960,27962,27967,27968,27970,27972,27977,27980,27984,27989,27990,27991,27992,27995,27997,27999,28001,28002,28004,28005,28007,28008,28011,28012,28013,28016,28017,28018,28019,28021,28022,28025,28026,28027,28029,28030,28031,28032,28033,28035,28036,28038,28039,28042,28043,28045,28047,28048,28050,28054,28055,28056,28057,28058,28060,28066,28069,28076,28077,28080,28081,28083,28084,28086,28087,28089,28090,28091,28092,28093,28094,28097,28098,28099,28104,28105,28106,28109,28110,28111,28112,28114,28115,28116,28117,28119,28122,28123,28124,28127,28130,28131,28133,28135,28136,28137,28138,28141,28143,28144,28146,28148,28149,28150,28152,28154,28157,28158,28159,28160,28161,28162,28163,28164,28166,28167,28168,28169,28171,28175,28178,28179,28181,28184,28185,28187,28188,28190,28191,28194,28198,28199,28200,28202,28204,28206,28208,28209,28211,28213,28214,28215,28217,28219,28220,28221,28222,28223,28224,28225,28226,28229,28230,28231,28232,28233,28234,28235,28236,28239,28240,28241,28242,28245,28247,28249,28250,28252,28253,28254,28256,28257,28258,28259,28260,28261,28262,28263,28264,28265,28266,28268,28269,28271,28272,28273,28274,28275,28276,28277,28278,28279,28280,28281,28282,28283,28284,28285,28288,28289,28290,28292,28295,28296,28298,28299,28300,28301,28302,28305,28306,28307,28308,28309,28310,28311,28313,28314,28315,28317,28318,28320,28321,28323,28324,28326,28328,28329,28331,28332,28333,28334,28336,28339,28341,28344,28345,28348,28350,28351,28352,28355,28356,28357,28358,28360,28361,28362,28364,28365,28366,28368,28370,28374,28376,28377,28379,28380,28381,28387,28391,28394,28395,28396,28397,28398,28399,28400,28401,28402,28403,28405,28406,28407,28408,28410,28411,28412,28413,28414,28415,28416,28417,28419,28420,28421,28423,28424,28426,28427,28428,28429,28430,28432,28433,28434,28438,28439,28440,28441,28442,28443,28444,28445,28446,28447,28449,28450,28451,28453,28454,28455,28456,28460,28462,28464,28466,28468,28469,28471,28472,28473,28474,28475,28476,28477,28479,28480,28481,28482,28483,28484,28485,28488,28489,28490,28492,28494,28495,28496,28497,28498,28499,28500,28501,28502,28503,28505,28506,28507,28509,28511,28512,28513,28515,28516,28517,28519,28520,28521,28522,28523,28524,28527,28528,28529,28531,28533,28534,28535,28537,28539,28541,28542,28543,28544,28545,28546,28547,28549,28550,28551,28554,28555,28559,28560,28561,28562,28563,28564,28565,28566,28567,28568,28569,28570,28571,28573,28574,28575,28576,28578,28579,28580,28581,28582,28584,28585,28586,28587,28588,28589,28590,28591,28592,28593,28594,28596,28597,28599,28600,28602,28603,28604,28605,28606,28607,28609,28611,28612,28613,28614,28615,28616,28618,28619,28620,28621,28622,28623,28624,28627,28628,28629,28630,28631,28632,28633,28634,28635,28636,28637,28639,28642,28643,28644,28645,28646,28647,28648,28649,28650,28651,28652,28653,28656,28657,28658,28659,28660,28661,28662,28663,28664,28665,28666,28667,28668,28669,28670,28671,28672,28673,28674,28675,28676,28677,28678,28679,28680,28681,28682,28683,28684,28685,28686,28687,28688,28690,28691,28692,28693,28694,28695,28696,28697,28700,28701,28702,28703,28704,28705,28706,28708,28709,28710,28711,28712,28713,28714,28715,28716,28717,28718,28719,28720,28721,28722,28723,28724,28726,28727,28728,28730,28731,28732,28733,28734,28735,28736,28737,28738,28739,28740,28741,28742,28743,28744,28745,28746,28747,28749,28750,28752,28753,28754,28755,28756,28757,28758,28759,28760,28761,28762,28763,28764,28765,28767,28768,28769,28770,28771,28772,28773,28774,28775,28776,28777,28778,28782,28785,28786,28787,28788,28791,28793,28794,28795,28797,28801,28802,28803,28804,28806,28807,28808,28811,28812,28813,28815,28816,28817,28819,28823,28824,28826,28827,28830,28831,28832,28833,28834,28835,28836,28837,28838,28839,28840,28841,28842,28848,28850,28852,28853,28854,28858,28862,28863,28868,28869,28870,28871,28873,28875,28876,28877,28878,28879,28880,28881,28882,28883,28884,28885,28886,28887,28890,28892,28893,28894,28896,28897,28898,28899,28901,28906,28910,28912,28913,28914,28915,28916,28917,28918,28920,28922,28923,28924,28926,28927,28928,28929,28930,28931,28932,28933,28934,28935,28936,28939,28940,28941,28942,28943,28945,28946,28948,28951,28955,28956,28957,28958,28959,28960,28961,28962,28963,28964,28965,28967,28968,28969,28970,28971,28972,28973,28974,28978,28979,28980,28981,28983,28984,28985,28986,28987,28988,28989,28990,28991,28992,28993,28994,28995,28996,28998,28999,29000,29001,29003,29005,29007,29008,29009,29010,29011,29012,29013,29014,29015,29016,29017,29018,29019,29021,29023,29024,29025,29026,29027,29029,29033,29034,29035,29036,29037,29039,29040,29041,29044,29045,29046,29047,29049,29051,29052,29054,29055,29056,29057,29058,29059,29061,29062,29063,29064,29065,29067,29068,29069,29070,29072,29073,29074,29075,29077,29078,29079,29082,29083,29084,29085,29086,29089,29090,29091,29092,29093,29094,29095,29097,29098,29099,29101,29102,29103,29104,29105,29106,29108,29110,29111,29112,29114,29115,29116,29117,29118,29119,29120,29121,29122,29124,29125,29126,29127,29128,29129,29130,29131,29132,29133,29135,29136,29137,29138,29139,29142,29143,29144,29145,29146,29147,29148,29149,29150,29151,29153,29154,29155,29156,29158,29160,29161,29162,29163,29164,29165,29167,29168,29169,29170,29171,29172,29173,29174,29175,29176,29178,29179,29180,29181,29182,29183,29184,29185,29186,29187,29188,29189,29191,29192,29193,29194,29195,29196,29197,29198,29199,29200,29201,29202,29203,29204,29205,29206,29207,29208,29209,29210,29211,29212,29214,29215,29216,29217,29218,29219,29220,29221,29222,29223,29225,29227,29229,29230,29231,29234,29235,29236,29242,29244,29246,29248,29249,29250,29251,29252,29253,29254,29257,29258,29259,29262,29263,29264,29265,29267,29268,29269,29271,29272,29274,29276,29278,29280,29283,29284,29285,29288,29290,29291,29292,29293,29296,29297,29299,29300,29302,29303,29304,29307,29308,29309,29314,29315,29317,29318,29319,29320,29321,29324,29326,29328,29329,29331,29332,29333,29334,29335,29336,29337,29338,29339,29340,29341,29342,29344,29345,29346,29347,29348,29349,29350,29351,29352,29353,29354,29355,29358,29361,29362,29363,29365,29370,29371,29372,29373,29374,29375,29376,29381,29382,29383,29385,29386,29387,29388,29391,29393,29395,29396,29397,29398,29400,29402,29403,58566,58567,58568,58569,58570,58571,58572,58573,58574,58575,58576,58577,58578,58579,58580,58581,58582,58583,58584,58585,58586,58587,58588,58589,58590,58591,58592,58593,58594,58595,58596,58597,58598,58599,58600,58601,58602,58603,58604,58605,58606,58607,58608,58609,58610,58611,58612,58613,58614,58615,58616,58617,58618,58619,58620,58621,58622,58623,58624,58625,58626,58627,58628,58629,58630,58631,58632,58633,58634,58635,58636,58637,58638,58639,58640,58641,58642,58643,58644,58645,58646,58647,58648,58649,58650,58651,58652,58653,58654,58655,58656,58657,58658,58659,58660,58661,12288,12289,12290,183,713,711,168,12291,12293,8212,65374,8214,8230,8216,8217,8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,12310,12311,12304,12305,177,215,247,8758,8743,8744,8721,8719,8746,8745,8712,8759,8730,8869,8741,8736,8978,8857,8747,8750,8801,8780,8776,8765,8733,8800,8814,8815,8804,8805,8734,8757,8756,9794,9792,176,8242,8243,8451,65284,164,65504,65505,8240,167,8470,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,8251,8594,8592,8593,8595,12307,58662,58663,58664,58665,58666,58667,58668,58669,58670,58671,58672,58673,58674,58675,58676,58677,58678,58679,58680,58681,58682,58683,58684,58685,58686,58687,58688,58689,58690,58691,58692,58693,58694,58695,58696,58697,58698,58699,58700,58701,58702,58703,58704,58705,58706,58707,58708,58709,58710,58711,58712,58713,58714,58715,58716,58717,58718,58719,58720,58721,58722,58723,58724,58725,58726,58727,58728,58729,58730,58731,58732,58733,58734,58735,58736,58737,58738,58739,58740,58741,58742,58743,58744,58745,58746,58747,58748,58749,58750,58751,58752,58753,58754,58755,58756,58757,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,59238,59239,59240,59241,59242,59243,9352,9353,9354,9355,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,9347,9348,9349,9350,9351,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,8364,59245,12832,12833,12834,12835,12836,12837,12838,12839,12840,12841,59246,59247,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,59248,59249,58758,58759,58760,58761,58762,58763,58764,58765,58766,58767,58768,58769,58770,58771,58772,58773,58774,58775,58776,58777,58778,58779,58780,58781,58782,58783,58784,58785,58786,58787,58788,58789,58790,58791,58792,58793,58794,58795,58796,58797,58798,58799,58800,58801,58802,58803,58804,58805,58806,58807,58808,58809,58810,58811,58812,58813,58814,58815,58816,58817,58818,58819,58820,58821,58822,58823,58824,58825,58826,58827,58828,58829,58830,58831,58832,58833,58834,58835,58836,58837,58838,58839,58840,58841,58842,58843,58844,58845,58846,58847,58848,58849,58850,58851,58852,12288,65281,65282,65283,65509,65285,65286,65287,65288,65289,65290,65291,65292,65293,65294,65295,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,65306,65307,65308,65309,65310,65311,65312,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65339,65340,65341,65342,65343,65344,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,65371,65372,65373,65507,58854,58855,58856,58857,58858,58859,58860,58861,58862,58863,58864,58865,58866,58867,58868,58869,58870,58871,58872,58873,58874,58875,58876,58877,58878,58879,58880,58881,58882,58883,58884,58885,58886,58887,58888,58889,58890,58891,58892,58893,58894,58895,58896,58897,58898,58899,58900,58901,58902,58903,58904,58905,58906,58907,58908,58909,58910,58911,58912,58913,58914,58915,58916,58917,58918,58919,58920,58921,58922,58923,58924,58925,58926,58927,58928,58929,58930,58931,58932,58933,58934,58935,58936,58937,58938,58939,58940,58941,58942,58943,58944,58945,58946,58947,58948,58949,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,59250,59251,59252,59253,59254,59255,59256,59257,59258,59259,59260,58950,58951,58952,58953,58954,58955,58956,58957,58958,58959,58960,58961,58962,58963,58964,58965,58966,58967,58968,58969,58970,58971,58972,58973,58974,58975,58976,58977,58978,58979,58980,58981,58982,58983,58984,58985,58986,58987,58988,58989,58990,58991,58992,58993,58994,58995,58996,58997,58998,58999,59000,59001,59002,59003,59004,59005,59006,59007,59008,59009,59010,59011,59012,59013,59014,59015,59016,59017,59018,59019,59020,59021,59022,59023,59024,59025,59026,59027,59028,59029,59030,59031,59032,59033,59034,59035,59036,59037,59038,59039,59040,59041,59042,59043,59044,59045,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,59261,59262,59263,59264,59265,59266,59267,59268,59046,59047,59048,59049,59050,59051,59052,59053,59054,59055,59056,59057,59058,59059,59060,59061,59062,59063,59064,59065,59066,59067,59068,59069,59070,59071,59072,59073,59074,59075,59076,59077,59078,59079,59080,59081,59082,59083,59084,59085,59086,59087,59088,59089,59090,59091,59092,59093,59094,59095,59096,59097,59098,59099,59100,59101,59102,59103,59104,59105,59106,59107,59108,59109,59110,59111,59112,59113,59114,59115,59116,59117,59118,59119,59120,59121,59122,59123,59124,59125,59126,59127,59128,59129,59130,59131,59132,59133,59134,59135,59136,59137,59138,59139,59140,59141,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,59269,59270,59271,59272,59273,59274,59275,59276,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,59277,59278,59279,59280,59281,59282,59283,65077,65078,65081,65082,65087,65088,65085,65086,65089,65090,65091,65092,59284,59285,65083,65084,65079,65080,65073,59286,65075,65076,59287,59288,59289,59290,59291,59292,59293,59294,59295,59142,59143,59144,59145,59146,59147,59148,59149,59150,59151,59152,59153,59154,59155,59156,59157,59158,59159,59160,59161,59162,59163,59164,59165,59166,59167,59168,59169,59170,59171,59172,59173,59174,59175,59176,59177,59178,59179,59180,59181,59182,59183,59184,59185,59186,59187,59188,59189,59190,59191,59192,59193,59194,59195,59196,59197,59198,59199,59200,59201,59202,59203,59204,59205,59206,59207,59208,59209,59210,59211,59212,59213,59214,59215,59216,59217,59218,59219,59220,59221,59222,59223,59224,59225,59226,59227,59228,59229,59230,59231,59232,59233,59234,59235,59236,59237,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,59296,59297,59298,59299,59300,59301,59302,59303,59304,59305,59306,59307,59308,59309,59310,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,59311,59312,59313,59314,59315,59316,59317,59318,59319,59320,59321,59322,59323,714,715,729,8211,8213,8229,8245,8453,8457,8598,8599,8600,8601,8725,8735,8739,8786,8806,8807,8895,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9601,9602,9603,9604,9605,9606,9607,9608,9609,9610,9611,9612,9613,9614,9615,9619,9620,9621,9660,9661,9698,9699,9700,9701,9737,8853,12306,12317,12318,59324,59325,59326,59327,59328,59329,59330,59331,59332,59333,59334,257,225,462,224,275,233,283,232,299,237,464,236,333,243,466,242,363,250,468,249,470,472,474,476,252,234,593,7743,324,328,505,609,59337,59338,59339,59340,12549,12550,12551,12552,12553,12554,12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570,12571,12572,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582,12583,12584,12585,59341,59342,59343,59344,59345,59346,59347,59348,59349,59350,59351,59352,59353,59354,59355,59356,59357,59358,59359,59360,59361,12321,12322,12323,12324,12325,12326,12327,12328,12329,12963,13198,13199,13212,13213,13214,13217,13252,13262,13265,13266,13269,65072,65506,65508,59362,8481,12849,59363,8208,59364,59365,59366,12540,12443,12444,12541,12542,12294,12445,12446,65097,65098,65099,65100,65101,65102,65103,65104,65105,65106,65108,65109,65110,65111,65113,65114,65115,65116,65117,65118,65119,65120,65121,65122,65123,65124,65125,65126,65128,65129,65130,65131,12350,12272,12273,12274,12275,12276,12277,12278,12279,12280,12281,12282,12283,12295,59380,59381,59382,59383,59384,59385,59386,59387,59388,59389,59390,59391,59392,9472,9473,9474,9475,9476,9477,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,9489,9490,9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506,9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,9521,9522,9523,9524,9525,9526,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536,9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,59393,59394,59395,59396,59397,59398,59399,59400,59401,59402,59403,59404,59405,59406,59407,29404,29405,29407,29410,29411,29412,29413,29414,29415,29418,29419,29429,29430,29433,29437,29438,29439,29440,29442,29444,29445,29446,29447,29448,29449,29451,29452,29453,29455,29456,29457,29458,29460,29464,29465,29466,29471,29472,29475,29476,29478,29479,29480,29485,29487,29488,29490,29491,29493,29494,29498,29499,29500,29501,29504,29505,29506,29507,29508,29509,29510,29511,29512,29513,29514,29515,29516,29518,29519,29521,29523,29524,29525,29526,29528,29529,29530,29531,29532,29533,29534,29535,29537,29538,29539,29540,29541,29542,29543,29544,29545,29546,29547,29550,29552,29553,57344,57345,57346,57347,57348,57349,57350,57351,57352,57353,57354,57355,57356,57357,57358,57359,57360,57361,57362,57363,57364,57365,57366,57367,57368,57369,57370,57371,57372,57373,57374,57375,57376,57377,57378,57379,57380,57381,57382,57383,57384,57385,57386,57387,57388,57389,57390,57391,57392,57393,57394,57395,57396,57397,57398,57399,57400,57401,57402,57403,57404,57405,57406,57407,57408,57409,57410,57411,57412,57413,57414,57415,57416,57417,57418,57419,57420,57421,57422,57423,57424,57425,57426,57427,57428,57429,57430,57431,57432,57433,57434,57435,57436,57437,29554,29555,29556,29557,29558,29559,29560,29561,29562,29563,29564,29565,29567,29568,29569,29570,29571,29573,29574,29576,29578,29580,29581,29583,29584,29586,29587,29588,29589,29591,29592,29593,29594,29596,29597,29598,29600,29601,29603,29604,29605,29606,29607,29608,29610,29612,29613,29617,29620,29621,29622,29624,29625,29628,29629,29630,29631,29633,29635,29636,29637,29638,29639,29643,29644,29646,29650,29651,29652,29653,29654,29655,29656,29658,29659,29660,29661,29663,29665,29666,29667,29668,29670,29672,29674,29675,29676,29678,29679,29680,29681,29683,29684,29685,29686,29687,57438,57439,57440,57441,57442,57443,57444,57445,57446,57447,57448,57449,57450,57451,57452,57453,57454,57455,57456,57457,57458,57459,57460,57461,57462,57463,57464,57465,57466,57467,57468,57469,57470,57471,57472,57473,57474,57475,57476,57477,57478,57479,57480,57481,57482,57483,57484,57485,57486,57487,57488,57489,57490,57491,57492,57493,57494,57495,57496,57497,57498,57499,57500,57501,57502,57503,57504,57505,57506,57507,57508,57509,57510,57511,57512,57513,57514,57515,57516,57517,57518,57519,57520,57521,57522,57523,57524,57525,57526,57527,57528,57529,57530,57531,29688,29689,29690,29691,29692,29693,29694,29695,29696,29697,29698,29700,29703,29704,29707,29708,29709,29710,29713,29714,29715,29716,29717,29718,29719,29720,29721,29724,29725,29726,29727,29728,29729,29731,29732,29735,29737,29739,29741,29743,29745,29746,29751,29752,29753,29754,29755,29757,29758,29759,29760,29762,29763,29764,29765,29766,29767,29768,29769,29770,29771,29772,29773,29774,29775,29776,29777,29778,29779,29780,29782,29784,29789,29792,29793,29794,29795,29796,29797,29798,29799,29800,29801,29802,29803,29804,29806,29807,29809,29810,29811,29812,29813,29816,29817,29818,57532,57533,57534,57535,57536,57537,57538,57539,57540,57541,57542,57543,57544,57545,57546,57547,57548,57549,57550,57551,57552,57553,57554,57555,57556,57557,57558,57559,57560,57561,57562,57563,57564,57565,57566,57567,57568,57569,57570,57571,57572,57573,57574,57575,57576,57577,57578,57579,57580,57581,57582,57583,57584,57585,57586,57587,57588,57589,57590,57591,57592,57593,57594,57595,57596,57597,57598,57599,57600,57601,57602,57603,57604,57605,57606,57607,57608,57609,57610,57611,57612,57613,57614,57615,57616,57617,57618,57619,57620,57621,57622,57623,57624,57625,29819,29820,29821,29823,29826,29828,29829,29830,29832,29833,29834,29836,29837,29839,29841,29842,29843,29844,29845,29846,29847,29848,29849,29850,29851,29853,29855,29856,29857,29858,29859,29860,29861,29862,29866,29867,29868,29869,29870,29871,29872,29873,29874,29875,29876,29877,29878,29879,29880,29881,29883,29884,29885,29886,29887,29888,29889,29890,29891,29892,29893,29894,29895,29896,29897,29898,29899,29900,29901,29902,29903,29904,29905,29907,29908,29909,29910,29911,29912,29913,29914,29915,29917,29919,29921,29925,29927,29928,29929,29930,29931,29932,29933,29936,29937,29938,57626,57627,57628,57629,57630,57631,57632,57633,57634,57635,57636,57637,57638,57639,57640,57641,57642,57643,57644,57645,57646,57647,57648,57649,57650,57651,57652,57653,57654,57655,57656,57657,57658,57659,57660,57661,57662,57663,57664,57665,57666,57667,57668,57669,57670,57671,57672,57673,57674,57675,57676,57677,57678,57679,57680,57681,57682,57683,57684,57685,57686,57687,57688,57689,57690,57691,57692,57693,57694,57695,57696,57697,57698,57699,57700,57701,57702,57703,57704,57705,57706,57707,57708,57709,57710,57711,57712,57713,57714,57715,57716,57717,57718,57719,29939,29941,29944,29945,29946,29947,29948,29949,29950,29952,29953,29954,29955,29957,29958,29959,29960,29961,29962,29963,29964,29966,29968,29970,29972,29973,29974,29975,29979,29981,29982,29984,29985,29986,29987,29988,29990,29991,29994,29998,30004,30006,30009,30012,30013,30015,30017,30018,30019,30020,30022,30023,30025,30026,30029,30032,30033,30034,30035,30037,30038,30039,30040,30045,30046,30047,30048,30049,30050,30051,30052,30055,30056,30057,30059,30060,30061,30062,30063,30064,30065,30067,30069,30070,30071,30074,30075,30076,30077,30078,30080,30081,30082,30084,30085,30087,57720,57721,57722,57723,57724,57725,57726,57727,57728,57729,57730,57731,57732,57733,57734,57735,57736,57737,57738,57739,57740,57741,57742,57743,57744,57745,57746,57747,57748,57749,57750,57751,57752,57753,57754,57755,57756,57757,57758,57759,57760,57761,57762,57763,57764,57765,57766,57767,57768,57769,57770,57771,57772,57773,57774,57775,57776,57777,57778,57779,57780,57781,57782,57783,57784,57785,57786,57787,57788,57789,57790,57791,57792,57793,57794,57795,57796,57797,57798,57799,57800,57801,57802,57803,57804,57805,57806,57807,57808,57809,57810,57811,57812,57813,30088,30089,30090,30092,30093,30094,30096,30099,30101,30104,30107,30108,30110,30114,30118,30119,30120,30121,30122,30125,30134,30135,30138,30139,30143,30144,30145,30150,30155,30156,30158,30159,30160,30161,30163,30167,30169,30170,30172,30173,30175,30176,30177,30181,30185,30188,30189,30190,30191,30194,30195,30197,30198,30199,30200,30202,30203,30205,30206,30210,30212,30214,30215,30216,30217,30219,30221,30222,30223,30225,30226,30227,30228,30230,30234,30236,30237,30238,30241,30243,30247,30248,30252,30254,30255,30257,30258,30262,30263,30265,30266,30267,30269,30273,30274,30276,57814,57815,57816,57817,57818,57819,57820,57821,57822,57823,57824,57825,57826,57827,57828,57829,57830,57831,57832,57833,57834,57835,57836,57837,57838,57839,57840,57841,57842,57843,57844,57845,57846,57847,57848,57849,57850,57851,57852,57853,57854,57855,57856,57857,57858,57859,57860,57861,57862,57863,57864,57865,57866,57867,57868,57869,57870,57871,57872,57873,57874,57875,57876,57877,57878,57879,57880,57881,57882,57883,57884,57885,57886,57887,57888,57889,57890,57891,57892,57893,57894,57895,57896,57897,57898,57899,57900,57901,57902,57903,57904,57905,57906,57907,30277,30278,30279,30280,30281,30282,30283,30286,30287,30288,30289,30290,30291,30293,30295,30296,30297,30298,30299,30301,30303,30304,30305,30306,30308,30309,30310,30311,30312,30313,30314,30316,30317,30318,30320,30321,30322,30323,30324,30325,30326,30327,30329,30330,30332,30335,30336,30337,30339,30341,30345,30346,30348,30349,30351,30352,30354,30356,30357,30359,30360,30362,30363,30364,30365,30366,30367,30368,30369,30370,30371,30373,30374,30375,30376,30377,30378,30379,30380,30381,30383,30384,30387,30389,30390,30391,30392,30393,30394,30395,30396,30397,30398,30400,30401,30403,21834,38463,22467,25384,21710,21769,21696,30353,30284,34108,30702,33406,30861,29233,38552,38797,27688,23433,20474,25353,26263,23736,33018,26696,32942,26114,30414,20985,25942,29100,32753,34948,20658,22885,25034,28595,33453,25420,25170,21485,21543,31494,20843,30116,24052,25300,36299,38774,25226,32793,22365,38712,32610,29240,30333,26575,30334,25670,20336,36133,25308,31255,26001,29677,25644,25203,33324,39041,26495,29256,25198,25292,20276,29923,21322,21150,32458,37030,24110,26758,27036,33152,32465,26834,30917,34444,38225,20621,35876,33502,32990,21253,35090,21093,30404,30407,30409,30411,30412,30419,30421,30425,30426,30428,30429,30430,30432,30433,30434,30435,30436,30438,30439,30440,30441,30442,30443,30444,30445,30448,30451,30453,30454,30455,30458,30459,30461,30463,30464,30466,30467,30469,30470,30474,30476,30478,30479,30480,30481,30482,30483,30484,30485,30486,30487,30488,30491,30492,30493,30494,30497,30499,30500,30501,30503,30506,30507,30508,30510,30512,30513,30514,30515,30516,30521,30523,30525,30526,30527,30530,30532,30533,30534,30536,30537,30538,30539,30540,30541,30542,30543,30546,30547,30548,30549,30550,30551,30552,30553,30556,34180,38649,20445,22561,39281,23453,25265,25253,26292,35961,40077,29190,26479,30865,24754,21329,21271,36744,32972,36125,38049,20493,29384,22791,24811,28953,34987,22868,33519,26412,31528,23849,32503,29997,27893,36454,36856,36924,40763,27604,37145,31508,24444,30887,34006,34109,27605,27609,27606,24065,24199,30201,38381,25949,24330,24517,36767,22721,33218,36991,38491,38829,36793,32534,36140,25153,20415,21464,21342,36776,36777,36779,36941,26631,24426,33176,34920,40150,24971,21035,30250,24428,25996,28626,28392,23486,25672,20853,20912,26564,19993,31177,39292,28851,30557,30558,30559,30560,30564,30567,30569,30570,30573,30574,30575,30576,30577,30578,30579,30580,30581,30582,30583,30584,30586,30587,30588,30593,30594,30595,30598,30599,30600,30601,30602,30603,30607,30608,30611,30612,30613,30614,30615,30616,30617,30618,30619,30620,30621,30622,30625,30627,30628,30630,30632,30635,30637,30638,30639,30641,30642,30644,30646,30647,30648,30649,30650,30652,30654,30656,30657,30658,30659,30660,30661,30662,30663,30664,30665,30666,30667,30668,30670,30671,30672,30673,30674,30675,30676,30677,30678,30680,30681,30682,30685,30686,30687,30688,30689,30692,30149,24182,29627,33760,25773,25320,38069,27874,21338,21187,25615,38082,31636,20271,24091,33334,33046,33162,28196,27850,39539,25429,21340,21754,34917,22496,19981,24067,27493,31807,37096,24598,25830,29468,35009,26448,25165,36130,30572,36393,37319,24425,33756,34081,39184,21442,34453,27531,24813,24808,28799,33485,33329,20179,27815,34255,25805,31961,27133,26361,33609,21397,31574,20391,20876,27979,23618,36461,25554,21449,33580,33590,26597,30900,25661,23519,23700,24046,35815,25286,26612,35962,25600,25530,34633,39307,35863,32544,38130,20135,38416,39076,26124,29462,30694,30696,30698,30703,30704,30705,30706,30708,30709,30711,30713,30714,30715,30716,30723,30724,30725,30726,30727,30728,30730,30731,30734,30735,30736,30739,30741,30745,30747,30750,30752,30753,30754,30756,30760,30762,30763,30766,30767,30769,30770,30771,30773,30774,30781,30783,30785,30786,30787,30788,30790,30792,30793,30794,30795,30797,30799,30801,30803,30804,30808,30809,30810,30811,30812,30814,30815,30816,30817,30818,30819,30820,30821,30822,30823,30824,30825,30831,30832,30833,30834,30835,30836,30837,30838,30840,30841,30842,30843,30845,30846,30847,30848,30849,30850,30851,22330,23581,24120,38271,20607,32928,21378,25950,30021,21809,20513,36229,25220,38046,26397,22066,28526,24034,21557,28818,36710,25199,25764,25507,24443,28552,37108,33251,36784,23576,26216,24561,27785,38472,36225,34924,25745,31216,22478,27225,25104,21576,20056,31243,24809,28548,35802,25215,36894,39563,31204,21507,30196,25345,21273,27744,36831,24347,39536,32827,40831,20360,23610,36196,32709,26021,28861,20805,20914,34411,23815,23456,25277,37228,30068,36364,31264,24833,31609,20167,32504,30597,19985,33261,21021,20986,27249,21416,36487,38148,38607,28353,38500,26970,30852,30853,30854,30856,30858,30859,30863,30864,30866,30868,30869,30870,30873,30877,30878,30880,30882,30884,30886,30888,30889,30890,30891,30892,30893,30894,30895,30901,30902,30903,30904,30906,30907,30908,30909,30911,30912,30914,30915,30916,30918,30919,30920,30924,30925,30926,30927,30929,30930,30931,30934,30935,30936,30938,30939,30940,30941,30942,30943,30944,30945,30946,30947,30948,30949,30950,30951,30953,30954,30955,30957,30958,30959,30960,30961,30963,30965,30966,30968,30969,30971,30972,30973,30974,30975,30976,30978,30979,30980,30982,30983,30984,30985,30986,30987,30988,30784,20648,30679,25616,35302,22788,25571,24029,31359,26941,20256,33337,21912,20018,30126,31383,24162,24202,38383,21019,21561,28810,25462,38180,22402,26149,26943,37255,21767,28147,32431,34850,25139,32496,30133,33576,30913,38604,36766,24904,29943,35789,27492,21050,36176,27425,32874,33905,22257,21254,20174,19995,20945,31895,37259,31751,20419,36479,31713,31388,25703,23828,20652,33030,30209,31929,28140,32736,26449,23384,23544,30923,25774,25619,25514,25387,38169,25645,36798,31572,30249,25171,22823,21574,27513,20643,25140,24102,27526,20195,36151,34955,24453,36910,30989,30990,30991,30992,30993,30994,30996,30997,30998,30999,31000,31001,31002,31003,31004,31005,31007,31008,31009,31010,31011,31013,31014,31015,31016,31017,31018,31019,31020,31021,31022,31023,31024,31025,31026,31027,31029,31030,31031,31032,31033,31037,31039,31042,31043,31044,31045,31047,31050,31051,31052,31053,31054,31055,31056,31057,31058,31060,31061,31064,31065,31073,31075,31076,31078,31081,31082,31083,31084,31086,31088,31089,31090,31091,31092,31093,31094,31097,31099,31100,31101,31102,31103,31106,31107,31110,31111,31112,31113,31115,31116,31117,31118,31120,31121,31122,24608,32829,25285,20025,21333,37112,25528,32966,26086,27694,20294,24814,28129,35806,24377,34507,24403,25377,20826,33633,26723,20992,25443,36424,20498,23707,31095,23548,21040,31291,24764,36947,30423,24503,24471,30340,36460,28783,30331,31561,30634,20979,37011,22564,20302,28404,36842,25932,31515,29380,28068,32735,23265,25269,24213,22320,33922,31532,24093,24351,36882,32532,39072,25474,28359,30872,28857,20856,38747,22443,30005,20291,30008,24215,24806,22880,28096,27583,30857,21500,38613,20939,20993,25481,21514,38035,35843,36300,29241,30879,34678,36845,35853,21472,31123,31124,31125,31126,31127,31128,31129,31131,31132,31133,31134,31135,31136,31137,31138,31139,31140,31141,31142,31144,31145,31146,31147,31148,31149,31150,31151,31152,31153,31154,31156,31157,31158,31159,31160,31164,31167,31170,31172,31173,31175,31176,31178,31180,31182,31183,31184,31187,31188,31190,31191,31193,31194,31195,31196,31197,31198,31200,31201,31202,31205,31208,31210,31212,31214,31217,31218,31219,31220,31221,31222,31223,31225,31226,31228,31230,31231,31233,31236,31237,31239,31240,31241,31242,31244,31247,31248,31249,31250,31251,31253,31254,31256,31257,31259,31260,19969,30447,21486,38025,39030,40718,38189,23450,35746,20002,19996,20908,33891,25026,21160,26635,20375,24683,20923,27934,20828,25238,26007,38497,35910,36887,30168,37117,30563,27602,29322,29420,35835,22581,30585,36172,26460,38208,32922,24230,28193,22930,31471,30701,38203,27573,26029,32526,22534,20817,38431,23545,22697,21544,36466,25958,39039,22244,38045,30462,36929,25479,21702,22810,22842,22427,36530,26421,36346,33333,21057,24816,22549,34558,23784,40517,20420,39069,35769,23077,24694,21380,25212,36943,37122,39295,24681,32780,20799,32819,23572,39285,27953,20108,31261,31263,31265,31266,31268,31269,31270,31271,31272,31273,31274,31275,31276,31277,31278,31279,31280,31281,31282,31284,31285,31286,31288,31290,31294,31296,31297,31298,31299,31300,31301,31303,31304,31305,31306,31307,31308,31309,31310,31311,31312,31314,31315,31316,31317,31318,31320,31321,31322,31323,31324,31325,31326,31327,31328,31329,31330,31331,31332,31333,31334,31335,31336,31337,31338,31339,31340,31341,31342,31343,31345,31346,31347,31349,31355,31356,31357,31358,31362,31365,31367,31369,31370,31371,31372,31374,31375,31376,31379,31380,31385,31386,31387,31390,31393,31394,36144,21457,32602,31567,20240,20047,38400,27861,29648,34281,24070,30058,32763,27146,30718,38034,32321,20961,28902,21453,36820,33539,36137,29359,39277,27867,22346,33459,26041,32938,25151,38450,22952,20223,35775,32442,25918,33778,38750,21857,39134,32933,21290,35837,21536,32954,24223,27832,36153,33452,37210,21545,27675,20998,32439,22367,28954,27774,31881,22859,20221,24575,24868,31914,20016,23553,26539,34562,23792,38155,39118,30127,28925,36898,20911,32541,35773,22857,20964,20315,21542,22827,25975,32932,23413,25206,25282,36752,24133,27679,31526,20239,20440,26381,31395,31396,31399,31401,31402,31403,31406,31407,31408,31409,31410,31412,31413,31414,31415,31416,31417,31418,31419,31420,31421,31422,31424,31425,31426,31427,31428,31429,31430,31431,31432,31433,31434,31436,31437,31438,31439,31440,31441,31442,31443,31444,31445,31447,31448,31450,31451,31452,31453,31457,31458,31460,31463,31464,31465,31466,31467,31468,31470,31472,31473,31474,31475,31476,31477,31478,31479,31480,31483,31484,31486,31488,31489,31490,31493,31495,31497,31500,31501,31502,31504,31506,31507,31510,31511,31512,31514,31516,31517,31519,31521,31522,31523,31527,31529,31533,28014,28074,31119,34993,24343,29995,25242,36741,20463,37340,26023,33071,33105,24220,33104,36212,21103,35206,36171,22797,20613,20184,38428,29238,33145,36127,23500,35747,38468,22919,32538,21648,22134,22030,35813,25913,27010,38041,30422,28297,24178,29976,26438,26577,31487,32925,36214,24863,31174,25954,36195,20872,21018,38050,32568,32923,32434,23703,28207,26464,31705,30347,39640,33167,32660,31957,25630,38224,31295,21578,21733,27468,25601,25096,40509,33011,30105,21106,38761,33883,26684,34532,38401,38548,38124,20010,21508,32473,26681,36319,32789,26356,24218,32697,31535,31536,31538,31540,31541,31542,31543,31545,31547,31549,31551,31552,31553,31554,31555,31556,31558,31560,31562,31565,31566,31571,31573,31575,31577,31580,31582,31583,31585,31587,31588,31589,31590,31591,31592,31593,31594,31595,31596,31597,31599,31600,31603,31604,31606,31608,31610,31612,31613,31615,31617,31618,31619,31620,31622,31623,31624,31625,31626,31627,31628,31630,31631,31633,31634,31635,31638,31640,31641,31642,31643,31646,31647,31648,31651,31652,31653,31662,31663,31664,31666,31667,31669,31670,31671,31673,31674,31675,31676,31677,31678,31679,31680,31682,31683,31684,22466,32831,26775,24037,25915,21151,24685,40858,20379,36524,20844,23467,24339,24041,27742,25329,36129,20849,38057,21246,27807,33503,29399,22434,26500,36141,22815,36764,33735,21653,31629,20272,27837,23396,22993,40723,21476,34506,39592,35895,32929,25925,39038,22266,38599,21038,29916,21072,23521,25346,35074,20054,25296,24618,26874,20851,23448,20896,35266,31649,39302,32592,24815,28748,36143,20809,24191,36891,29808,35268,22317,30789,24402,40863,38394,36712,39740,35809,30328,26690,26588,36330,36149,21053,36746,28378,26829,38149,37101,22269,26524,35065,36807,21704,31685,31688,31689,31690,31691,31693,31694,31695,31696,31698,31700,31701,31702,31703,31704,31707,31708,31710,31711,31712,31714,31715,31716,31719,31720,31721,31723,31724,31725,31727,31728,31730,31731,31732,31733,31734,31736,31737,31738,31739,31741,31743,31744,31745,31746,31747,31748,31749,31750,31752,31753,31754,31757,31758,31760,31761,31762,31763,31764,31765,31767,31768,31769,31770,31771,31772,31773,31774,31776,31777,31778,31779,31780,31781,31784,31785,31787,31788,31789,31790,31791,31792,31793,31794,31795,31796,31797,31798,31799,31801,31802,31803,31804,31805,31806,31810,39608,23401,28023,27686,20133,23475,39559,37219,25000,37039,38889,21547,28085,23506,20989,21898,32597,32752,25788,25421,26097,25022,24717,28938,27735,27721,22831,26477,33322,22741,22158,35946,27627,37085,22909,32791,21495,28009,21621,21917,33655,33743,26680,31166,21644,20309,21512,30418,35977,38402,27827,28088,36203,35088,40548,36154,22079,40657,30165,24456,29408,24680,21756,20136,27178,34913,24658,36720,21700,28888,34425,40511,27946,23439,24344,32418,21897,20399,29492,21564,21402,20505,21518,21628,20046,24573,29786,22774,33899,32993,34676,29392,31946,28246,31811,31812,31813,31814,31815,31816,31817,31818,31819,31820,31822,31823,31824,31825,31826,31827,31828,31829,31830,31831,31832,31833,31834,31835,31836,31837,31838,31839,31840,31841,31842,31843,31844,31845,31846,31847,31848,31849,31850,31851,31852,31853,31854,31855,31856,31857,31858,31861,31862,31863,31864,31865,31866,31870,31871,31872,31873,31874,31875,31876,31877,31878,31879,31880,31882,31883,31884,31885,31886,31887,31888,31891,31892,31894,31897,31898,31899,31904,31905,31907,31910,31911,31912,31913,31915,31916,31917,31919,31920,31924,31925,31926,31927,31928,31930,31931,24359,34382,21804,25252,20114,27818,25143,33457,21719,21326,29502,28369,30011,21010,21270,35805,27088,24458,24576,28142,22351,27426,29615,26707,36824,32531,25442,24739,21796,30186,35938,28949,28067,23462,24187,33618,24908,40644,30970,34647,31783,30343,20976,24822,29004,26179,24140,24653,35854,28784,25381,36745,24509,24674,34516,22238,27585,24724,24935,21321,24800,26214,36159,31229,20250,28905,27719,35763,35826,32472,33636,26127,23130,39746,27985,28151,35905,27963,20249,28779,33719,25110,24785,38669,36135,31096,20987,22334,22522,26426,30072,31293,31215,31637,31935,31936,31938,31939,31940,31942,31945,31947,31950,31951,31952,31953,31954,31955,31956,31960,31962,31963,31965,31966,31969,31970,31971,31972,31973,31974,31975,31977,31978,31979,31980,31981,31982,31984,31985,31986,31987,31988,31989,31990,31991,31993,31994,31996,31997,31998,31999,32000,32001,32002,32003,32004,32005,32006,32007,32008,32009,32011,32012,32013,32014,32015,32016,32017,32018,32019,32020,32021,32022,32023,32024,32025,32026,32027,32028,32029,32030,32031,32033,32035,32036,32037,32038,32040,32041,32042,32044,32045,32046,32048,32049,32050,32051,32052,32053,32054,32908,39269,36857,28608,35749,40481,23020,32489,32521,21513,26497,26840,36753,31821,38598,21450,24613,30142,27762,21363,23241,32423,25380,20960,33034,24049,34015,25216,20864,23395,20238,31085,21058,24760,27982,23492,23490,35745,35760,26082,24524,38469,22931,32487,32426,22025,26551,22841,20339,23478,21152,33626,39050,36158,30002,38078,20551,31292,20215,26550,39550,23233,27516,30417,22362,23574,31546,38388,29006,20860,32937,33392,22904,32516,33575,26816,26604,30897,30839,25315,25441,31616,20461,21098,20943,33616,27099,37492,36341,36145,35265,38190,31661,20214,32055,32056,32057,32058,32059,32060,32061,32062,32063,32064,32065,32066,32067,32068,32069,32070,32071,32072,32073,32074,32075,32076,32077,32078,32079,32080,32081,32082,32083,32084,32085,32086,32087,32088,32089,32090,32091,32092,32093,32094,32095,32096,32097,32098,32099,32100,32101,32102,32103,32104,32105,32106,32107,32108,32109,32111,32112,32113,32114,32115,32116,32117,32118,32120,32121,32122,32123,32124,32125,32126,32127,32128,32129,32130,32131,32132,32133,32134,32135,32136,32137,32138,32139,32140,32141,32142,32143,32144,32145,32146,32147,32148,32149,32150,32151,32152,20581,33328,21073,39279,28176,28293,28071,24314,20725,23004,23558,27974,27743,30086,33931,26728,22870,35762,21280,37233,38477,34121,26898,30977,28966,33014,20132,37066,27975,39556,23047,22204,25605,38128,30699,20389,33050,29409,35282,39290,32564,32478,21119,25945,37237,36735,36739,21483,31382,25581,25509,30342,31224,34903,38454,25130,21163,33410,26708,26480,25463,30571,31469,27905,32467,35299,22992,25106,34249,33445,30028,20511,20171,30117,35819,23626,24062,31563,26020,37329,20170,27941,35167,32039,38182,20165,35880,36827,38771,26187,31105,36817,28908,28024,32153,32154,32155,32156,32157,32158,32159,32160,32161,32162,32163,32164,32165,32167,32168,32169,32170,32171,32172,32173,32175,32176,32177,32178,32179,32180,32181,32182,32183,32184,32185,32186,32187,32188,32189,32190,32191,32192,32193,32194,32195,32196,32197,32198,32199,32200,32201,32202,32203,32204,32205,32206,32207,32208,32209,32210,32211,32212,32213,32214,32215,32216,32217,32218,32219,32220,32221,32222,32223,32224,32225,32226,32227,32228,32229,32230,32231,32232,32233,32234,32235,32236,32237,32238,32239,32240,32241,32242,32243,32244,32245,32246,32247,32248,32249,32250,23613,21170,33606,20834,33550,30555,26230,40120,20140,24778,31934,31923,32463,20117,35686,26223,39048,38745,22659,25964,38236,24452,30153,38742,31455,31454,20928,28847,31384,25578,31350,32416,29590,38893,20037,28792,20061,37202,21417,25937,26087,33276,33285,21646,23601,30106,38816,25304,29401,30141,23621,39545,33738,23616,21632,30697,20030,27822,32858,25298,25454,24040,20855,36317,36382,38191,20465,21477,24807,28844,21095,25424,40515,23071,20518,30519,21367,32482,25733,25899,25225,25496,20500,29237,35273,20915,35776,32477,22343,33740,38055,20891,21531,23803,32251,32252,32253,32254,32255,32256,32257,32258,32259,32260,32261,32262,32263,32264,32265,32266,32267,32268,32269,32270,32271,32272,32273,32274,32275,32276,32277,32278,32279,32280,32281,32282,32283,32284,32285,32286,32287,32288,32289,32290,32291,32292,32293,32294,32295,32296,32297,32298,32299,32300,32301,32302,32303,32304,32305,32306,32307,32308,32309,32310,32311,32312,32313,32314,32316,32317,32318,32319,32320,32322,32323,32324,32325,32326,32328,32329,32330,32331,32332,32333,32334,32335,32336,32337,32338,32339,32340,32341,32342,32343,32344,32345,32346,32347,32348,32349,20426,31459,27994,37089,39567,21888,21654,21345,21679,24320,25577,26999,20975,24936,21002,22570,21208,22350,30733,30475,24247,24951,31968,25179,25239,20130,28821,32771,25335,28900,38752,22391,33499,26607,26869,30933,39063,31185,22771,21683,21487,28212,20811,21051,23458,35838,32943,21827,22438,24691,22353,21549,31354,24656,23380,25511,25248,21475,25187,23495,26543,21741,31391,33510,37239,24211,35044,22840,22446,25358,36328,33007,22359,31607,20393,24555,23485,27454,21281,31568,29378,26694,30719,30518,26103,20917,20111,30420,23743,31397,33909,22862,39745,20608,32350,32351,32352,32353,32354,32355,32356,32357,32358,32359,32360,32361,32362,32363,32364,32365,32366,32367,32368,32369,32370,32371,32372,32373,32374,32375,32376,32377,32378,32379,32380,32381,32382,32383,32384,32385,32387,32388,32389,32390,32391,32392,32393,32394,32395,32396,32397,32398,32399,32400,32401,32402,32403,32404,32405,32406,32407,32408,32409,32410,32412,32413,32414,32430,32436,32443,32444,32470,32484,32492,32505,32522,32528,32542,32567,32569,32571,32572,32573,32574,32575,32576,32577,32579,32582,32583,32584,32585,32586,32587,32588,32589,32590,32591,32594,32595,39304,24871,28291,22372,26118,25414,22256,25324,25193,24275,38420,22403,25289,21895,34593,33098,36771,21862,33713,26469,36182,34013,23146,26639,25318,31726,38417,20848,28572,35888,25597,35272,25042,32518,28866,28389,29701,27028,29436,24266,37070,26391,28010,25438,21171,29282,32769,20332,23013,37226,28889,28061,21202,20048,38647,38253,34174,30922,32047,20769,22418,25794,32907,31867,27882,26865,26974,20919,21400,26792,29313,40654,31729,29432,31163,28435,29702,26446,37324,40100,31036,33673,33620,21519,26647,20029,21385,21169,30782,21382,21033,20616,20363,20432,32598,32601,32603,32604,32605,32606,32608,32611,32612,32613,32614,32615,32619,32620,32621,32623,32624,32627,32629,32630,32631,32632,32634,32635,32636,32637,32639,32640,32642,32643,32644,32645,32646,32647,32648,32649,32651,32653,32655,32656,32657,32658,32659,32661,32662,32663,32664,32665,32667,32668,32672,32674,32675,32677,32678,32680,32681,32682,32683,32684,32685,32686,32689,32691,32692,32693,32694,32695,32698,32699,32702,32704,32706,32707,32708,32710,32711,32712,32713,32715,32717,32719,32720,32721,32722,32723,32726,32727,32729,32730,32731,32732,32733,32734,32738,32739,30178,31435,31890,27813,38582,21147,29827,21737,20457,32852,33714,36830,38256,24265,24604,28063,24088,25947,33080,38142,24651,28860,32451,31918,20937,26753,31921,33391,20004,36742,37327,26238,20142,35845,25769,32842,20698,30103,29134,23525,36797,28518,20102,25730,38243,24278,26009,21015,35010,28872,21155,29454,29747,26519,30967,38678,20020,37051,40158,28107,20955,36161,21533,25294,29618,33777,38646,40836,38083,20278,32666,20940,28789,38517,23725,39046,21478,20196,28316,29705,27060,30827,39311,30041,21016,30244,27969,26611,20845,40857,32843,21657,31548,31423,32740,32743,32744,32746,32747,32748,32749,32751,32754,32756,32757,32758,32759,32760,32761,32762,32765,32766,32767,32770,32775,32776,32777,32778,32782,32783,32785,32787,32794,32795,32797,32798,32799,32801,32803,32804,32811,32812,32813,32814,32815,32816,32818,32820,32825,32826,32828,32830,32832,32833,32836,32837,32839,32840,32841,32846,32847,32848,32849,32851,32853,32854,32855,32857,32859,32860,32861,32862,32863,32864,32865,32866,32867,32868,32869,32870,32871,32872,32875,32876,32877,32878,32879,32880,32882,32883,32884,32885,32886,32887,32888,32889,32890,32891,32892,32893,38534,22404,25314,38471,27004,23044,25602,31699,28431,38475,33446,21346,39045,24208,28809,25523,21348,34383,40065,40595,30860,38706,36335,36162,40575,28510,31108,24405,38470,25134,39540,21525,38109,20387,26053,23653,23649,32533,34385,27695,24459,29575,28388,32511,23782,25371,23402,28390,21365,20081,25504,30053,25249,36718,20262,20177,27814,32438,35770,33821,34746,32599,36923,38179,31657,39585,35064,33853,27931,39558,32476,22920,40635,29595,30721,34434,39532,39554,22043,21527,22475,20080,40614,21334,36808,33033,30610,39314,34542,28385,34067,26364,24930,28459,32894,32897,32898,32901,32904,32906,32909,32910,32911,32912,32913,32914,32916,32917,32919,32921,32926,32931,32934,32935,32936,32940,32944,32947,32949,32950,32952,32953,32955,32965,32967,32968,32969,32970,32971,32975,32976,32977,32978,32979,32980,32981,32984,32991,32992,32994,32995,32998,33006,33013,33015,33017,33019,33022,33023,33024,33025,33027,33028,33029,33031,33032,33035,33036,33045,33047,33049,33051,33052,33053,33055,33056,33057,33058,33059,33060,33061,33062,33063,33064,33065,33066,33067,33069,33070,33072,33075,33076,33077,33079,33081,33082,33083,33084,33085,33087,35881,33426,33579,30450,27667,24537,33725,29483,33541,38170,27611,30683,38086,21359,33538,20882,24125,35980,36152,20040,29611,26522,26757,37238,38665,29028,27809,30473,23186,38209,27599,32654,26151,23504,22969,23194,38376,38391,20204,33804,33945,27308,30431,38192,29467,26790,23391,30511,37274,38753,31964,36855,35868,24357,31859,31192,35269,27852,34588,23494,24130,26825,30496,32501,20885,20813,21193,23081,32517,38754,33495,25551,30596,34256,31186,28218,24217,22937,34065,28781,27665,25279,30399,25935,24751,38397,26126,34719,40483,38125,21517,21629,35884,25720,33088,33089,33090,33091,33092,33093,33095,33097,33101,33102,33103,33106,33110,33111,33112,33115,33116,33117,33118,33119,33121,33122,33123,33124,33126,33128,33130,33131,33132,33135,33138,33139,33141,33142,33143,33144,33153,33155,33156,33157,33158,33159,33161,33163,33164,33165,33166,33168,33170,33171,33172,33173,33174,33175,33177,33178,33182,33183,33184,33185,33186,33188,33189,33191,33193,33195,33196,33197,33198,33199,33200,33201,33202,33204,33205,33206,33207,33208,33209,33212,33213,33214,33215,33220,33221,33223,33224,33225,33227,33229,33230,33231,33232,33233,33234,33235,25721,34321,27169,33180,30952,25705,39764,25273,26411,33707,22696,40664,27819,28448,23518,38476,35851,29279,26576,25287,29281,20137,22982,27597,22675,26286,24149,21215,24917,26408,30446,30566,29287,31302,25343,21738,21584,38048,37027,23068,32435,27670,20035,22902,32784,22856,21335,30007,38590,22218,25376,33041,24700,38393,28118,21602,39297,20869,23273,33021,22958,38675,20522,27877,23612,25311,20320,21311,33147,36870,28346,34091,25288,24180,30910,25781,25467,24565,23064,37247,40479,23615,25423,32834,23421,21870,38218,38221,28037,24744,26592,29406,20957,23425,33236,33237,33238,33239,33240,33241,33242,33243,33244,33245,33246,33247,33248,33249,33250,33252,33253,33254,33256,33257,33259,33262,33263,33264,33265,33266,33269,33270,33271,33272,33273,33274,33277,33279,33283,33287,33288,33289,33290,33291,33294,33295,33297,33299,33301,33302,33303,33304,33305,33306,33309,33312,33316,33317,33318,33319,33321,33326,33330,33338,33340,33341,33343,33344,33345,33346,33347,33349,33350,33352,33354,33356,33357,33358,33360,33361,33362,33363,33364,33365,33366,33367,33369,33371,33372,33373,33374,33376,33377,33378,33379,33380,33381,33382,33383,33385,25319,27870,29275,25197,38062,32445,33043,27987,20892,24324,22900,21162,24594,22899,26262,34384,30111,25386,25062,31983,35834,21734,27431,40485,27572,34261,21589,20598,27812,21866,36276,29228,24085,24597,29750,25293,25490,29260,24472,28227,27966,25856,28504,30424,30928,30460,30036,21028,21467,20051,24222,26049,32810,32982,25243,21638,21032,28846,34957,36305,27873,21624,32986,22521,35060,36180,38506,37197,20329,27803,21943,30406,30768,25256,28921,28558,24429,34028,26842,30844,31735,33192,26379,40527,25447,30896,22383,30738,38713,25209,25259,21128,29749,27607,33386,33387,33388,33389,33393,33397,33398,33399,33400,33403,33404,33408,33409,33411,33413,33414,33415,33417,33420,33424,33427,33428,33429,33430,33434,33435,33438,33440,33442,33443,33447,33458,33461,33462,33466,33467,33468,33471,33472,33474,33475,33477,33478,33481,33488,33494,33497,33498,33501,33506,33511,33512,33513,33514,33516,33517,33518,33520,33522,33523,33525,33526,33528,33530,33532,33533,33534,33535,33536,33546,33547,33549,33552,33554,33555,33558,33560,33561,33565,33566,33567,33568,33569,33570,33571,33572,33573,33574,33577,33578,33582,33584,33586,33591,33595,33597,21860,33086,30130,30382,21305,30174,20731,23617,35692,31687,20559,29255,39575,39128,28418,29922,31080,25735,30629,25340,39057,36139,21697,32856,20050,22378,33529,33805,24179,20973,29942,35780,23631,22369,27900,39047,23110,30772,39748,36843,31893,21078,25169,38138,20166,33670,33889,33769,33970,22484,26420,22275,26222,28006,35889,26333,28689,26399,27450,26646,25114,22971,19971,20932,28422,26578,27791,20854,26827,22855,27495,30054,23822,33040,40784,26071,31048,31041,39569,36215,23682,20062,20225,21551,22865,30732,22120,27668,36804,24323,27773,27875,35755,25488,33598,33599,33601,33602,33604,33605,33608,33610,33611,33612,33613,33614,33619,33621,33622,33623,33624,33625,33629,33634,33648,33649,33650,33651,33652,33653,33654,33657,33658,33662,33663,33664,33665,33666,33667,33668,33671,33672,33674,33675,33676,33677,33679,33680,33681,33684,33685,33686,33687,33689,33690,33693,33695,33697,33698,33699,33700,33701,33702,33703,33708,33709,33710,33711,33717,33723,33726,33727,33730,33731,33732,33734,33736,33737,33739,33741,33742,33744,33745,33746,33747,33749,33751,33753,33754,33755,33758,33762,33763,33764,33766,33767,33768,33771,33772,33773,24688,27965,29301,25190,38030,38085,21315,36801,31614,20191,35878,20094,40660,38065,38067,21069,28508,36963,27973,35892,22545,23884,27424,27465,26538,21595,33108,32652,22681,34103,24378,25250,27207,38201,25970,24708,26725,30631,20052,20392,24039,38808,25772,32728,23789,20431,31373,20999,33540,19988,24623,31363,38054,20405,20146,31206,29748,21220,33465,25810,31165,23517,27777,38738,36731,27682,20542,21375,28165,25806,26228,27696,24773,39031,35831,24198,29756,31351,31179,19992,37041,29699,27714,22234,37195,27845,36235,21306,34502,26354,36527,23624,39537,28192,33774,33775,33779,33780,33781,33782,33783,33786,33787,33788,33790,33791,33792,33794,33797,33799,33800,33801,33802,33808,33810,33811,33812,33813,33814,33815,33817,33818,33819,33822,33823,33824,33825,33826,33827,33833,33834,33835,33836,33837,33838,33839,33840,33842,33843,33844,33845,33846,33847,33849,33850,33851,33854,33855,33856,33857,33858,33859,33860,33861,33863,33864,33865,33866,33867,33868,33869,33870,33871,33872,33874,33875,33876,33877,33878,33880,33885,33886,33887,33888,33890,33892,33893,33894,33895,33896,33898,33902,33903,33904,33906,33908,33911,33913,33915,33916,21462,23094,40843,36259,21435,22280,39079,26435,37275,27849,20840,30154,25331,29356,21048,21149,32570,28820,30264,21364,40522,27063,30830,38592,35033,32676,28982,29123,20873,26579,29924,22756,25880,22199,35753,39286,25200,32469,24825,28909,22764,20161,20154,24525,38887,20219,35748,20995,22922,32427,25172,20173,26085,25102,33592,33993,33635,34701,29076,28342,23481,32466,20887,25545,26580,32905,33593,34837,20754,23418,22914,36785,20083,27741,20837,35109,36719,38446,34122,29790,38160,38384,28070,33509,24369,25746,27922,33832,33134,40131,22622,36187,19977,21441,33917,33918,33919,33920,33921,33923,33924,33925,33926,33930,33933,33935,33936,33937,33938,33939,33940,33941,33942,33944,33946,33947,33949,33950,33951,33952,33954,33955,33956,33957,33958,33959,33960,33961,33962,33963,33964,33965,33966,33968,33969,33971,33973,33974,33975,33979,33980,33982,33984,33986,33987,33989,33990,33991,33992,33995,33996,33998,33999,34002,34004,34005,34007,34008,34009,34010,34011,34012,34014,34017,34018,34020,34023,34024,34025,34026,34027,34029,34030,34031,34033,34034,34035,34036,34037,34038,34039,34040,34041,34042,34043,34045,34046,34048,34049,34050,20254,25955,26705,21971,20007,25620,39578,25195,23234,29791,33394,28073,26862,20711,33678,30722,26432,21049,27801,32433,20667,21861,29022,31579,26194,29642,33515,26441,23665,21024,29053,34923,38378,38485,25797,36193,33203,21892,27733,25159,32558,22674,20260,21830,36175,26188,19978,23578,35059,26786,25422,31245,28903,33421,21242,38902,23569,21736,37045,32461,22882,36170,34503,33292,33293,36198,25668,23556,24913,28041,31038,35774,30775,30003,21627,20280,36523,28145,23072,32453,31070,27784,23457,23158,29978,32958,24910,28183,22768,29983,29989,29298,21319,32499,34051,34052,34053,34054,34055,34056,34057,34058,34059,34061,34062,34063,34064,34066,34068,34069,34070,34072,34073,34075,34076,34077,34078,34080,34082,34083,34084,34085,34086,34087,34088,34089,34090,34093,34094,34095,34096,34097,34098,34099,34100,34101,34102,34110,34111,34112,34113,34114,34116,34117,34118,34119,34123,34124,34125,34126,34127,34128,34129,34130,34131,34132,34133,34135,34136,34138,34139,34140,34141,34143,34144,34145,34146,34147,34149,34150,34151,34153,34154,34155,34156,34157,34158,34159,34160,34161,34163,34165,34166,34167,34168,34172,34173,34175,34176,34177,30465,30427,21097,32988,22307,24072,22833,29422,26045,28287,35799,23608,34417,21313,30707,25342,26102,20160,39135,34432,23454,35782,21490,30690,20351,23630,39542,22987,24335,31034,22763,19990,26623,20107,25325,35475,36893,21183,26159,21980,22124,36866,20181,20365,37322,39280,27663,24066,24643,23460,35270,35797,25910,25163,39318,23432,23551,25480,21806,21463,30246,20861,34092,26530,26803,27530,25234,36755,21460,33298,28113,30095,20070,36174,23408,29087,34223,26257,26329,32626,34560,40653,40736,23646,26415,36848,26641,26463,25101,31446,22661,24246,25968,28465,34178,34179,34182,34184,34185,34186,34187,34188,34189,34190,34192,34193,34194,34195,34196,34197,34198,34199,34200,34201,34202,34205,34206,34207,34208,34209,34210,34211,34213,34214,34215,34217,34219,34220,34221,34225,34226,34227,34228,34229,34230,34232,34234,34235,34236,34237,34238,34239,34240,34242,34243,34244,34245,34246,34247,34248,34250,34251,34252,34253,34254,34257,34258,34260,34262,34263,34264,34265,34266,34267,34269,34270,34271,34272,34273,34274,34275,34277,34278,34279,34280,34282,34283,34284,34285,34286,34287,34288,34289,34290,34291,34292,34293,34294,34295,34296,24661,21047,32781,25684,34928,29993,24069,26643,25332,38684,21452,29245,35841,27700,30561,31246,21550,30636,39034,33308,35828,30805,26388,28865,26031,25749,22070,24605,31169,21496,19997,27515,32902,23546,21987,22235,20282,20284,39282,24051,26494,32824,24578,39042,36865,23435,35772,35829,25628,33368,25822,22013,33487,37221,20439,32032,36895,31903,20723,22609,28335,23487,35785,32899,37240,33948,31639,34429,38539,38543,32485,39635,30862,23681,31319,36930,38567,31071,23385,25439,31499,34001,26797,21766,32553,29712,32034,38145,25152,22604,20182,23427,22905,22612,34297,34298,34300,34301,34302,34304,34305,34306,34307,34308,34310,34311,34312,34313,34314,34315,34316,34317,34318,34319,34320,34322,34323,34324,34325,34327,34328,34329,34330,34331,34332,34333,34334,34335,34336,34337,34338,34339,34340,34341,34342,34344,34346,34347,34348,34349,34350,34351,34352,34353,34354,34355,34356,34357,34358,34359,34361,34362,34363,34365,34366,34367,34368,34369,34370,34371,34372,34373,34374,34375,34376,34377,34378,34379,34380,34386,34387,34389,34390,34391,34392,34393,34395,34396,34397,34399,34400,34401,34403,34404,34405,34406,34407,34408,34409,34410,29549,25374,36427,36367,32974,33492,25260,21488,27888,37214,22826,24577,27760,22349,25674,36138,30251,28393,22363,27264,30192,28525,35885,35848,22374,27631,34962,30899,25506,21497,28845,27748,22616,25642,22530,26848,33179,21776,31958,20504,36538,28108,36255,28907,25487,28059,28372,32486,33796,26691,36867,28120,38518,35752,22871,29305,34276,33150,30140,35466,26799,21076,36386,38161,25552,39064,36420,21884,20307,26367,22159,24789,28053,21059,23625,22825,28155,22635,30000,29980,24684,33300,33094,25361,26465,36834,30522,36339,36148,38081,24086,21381,21548,28867,34413,34415,34416,34418,34419,34420,34421,34422,34423,34424,34435,34436,34437,34438,34439,34440,34441,34446,34447,34448,34449,34450,34452,34454,34455,34456,34457,34458,34459,34462,34463,34464,34465,34466,34469,34470,34475,34477,34478,34482,34483,34487,34488,34489,34491,34492,34493,34494,34495,34497,34498,34499,34501,34504,34508,34509,34514,34515,34517,34518,34519,34522,34524,34525,34528,34529,34530,34531,34533,34534,34535,34536,34538,34539,34540,34543,34549,34550,34551,34554,34555,34556,34557,34559,34561,34564,34565,34566,34571,34572,34574,34575,34576,34577,34580,34582,27712,24311,20572,20141,24237,25402,33351,36890,26704,37230,30643,21516,38108,24420,31461,26742,25413,31570,32479,30171,20599,25237,22836,36879,20984,31171,31361,22270,24466,36884,28034,23648,22303,21520,20820,28237,22242,25512,39059,33151,34581,35114,36864,21534,23663,33216,25302,25176,33073,40501,38464,39534,39548,26925,22949,25299,21822,25366,21703,34521,27964,23043,29926,34972,27498,22806,35916,24367,28286,29609,39037,20024,28919,23436,30871,25405,26202,30358,24779,23451,23113,19975,33109,27754,29579,20129,26505,32593,24448,26106,26395,24536,22916,23041,34585,34587,34589,34591,34592,34596,34598,34599,34600,34602,34603,34604,34605,34607,34608,34610,34611,34613,34614,34616,34617,34618,34620,34621,34624,34625,34626,34627,34628,34629,34630,34634,34635,34637,34639,34640,34641,34642,34644,34645,34646,34648,34650,34651,34652,34653,34654,34655,34657,34658,34662,34663,34664,34665,34666,34667,34668,34669,34671,34673,34674,34675,34677,34679,34680,34681,34682,34687,34688,34689,34692,34694,34695,34697,34698,34700,34702,34703,34704,34705,34706,34708,34709,34710,34712,34713,34714,34715,34716,34717,34718,34720,34721,34722,34723,34724,24013,24494,21361,38886,36829,26693,22260,21807,24799,20026,28493,32500,33479,33806,22996,20255,20266,23614,32428,26410,34074,21619,30031,32963,21890,39759,20301,28205,35859,23561,24944,21355,30239,28201,34442,25991,38395,32441,21563,31283,32010,38382,21985,32705,29934,25373,34583,28065,31389,25105,26017,21351,25569,27779,24043,21596,38056,20044,27745,35820,23627,26080,33436,26791,21566,21556,27595,27494,20116,25410,21320,33310,20237,20398,22366,25098,38654,26212,29289,21247,21153,24735,35823,26132,29081,26512,35199,30802,30717,26224,22075,21560,38177,29306,34725,34726,34727,34729,34730,34734,34736,34737,34738,34740,34742,34743,34744,34745,34747,34748,34750,34751,34753,34754,34755,34756,34757,34759,34760,34761,34764,34765,34766,34767,34768,34772,34773,34774,34775,34776,34777,34778,34780,34781,34782,34783,34785,34786,34787,34788,34790,34791,34792,34793,34795,34796,34797,34799,34800,34801,34802,34803,34804,34805,34806,34807,34808,34810,34811,34812,34813,34815,34816,34817,34818,34820,34821,34822,34823,34824,34825,34827,34828,34829,34830,34831,34832,34833,34834,34836,34839,34840,34841,34842,34844,34845,34846,34847,34848,34851,31232,24687,24076,24713,33181,22805,24796,29060,28911,28330,27728,29312,27268,34989,24109,20064,23219,21916,38115,27927,31995,38553,25103,32454,30606,34430,21283,38686,36758,26247,23777,20384,29421,19979,21414,22799,21523,25472,38184,20808,20185,40092,32420,21688,36132,34900,33335,38386,28046,24358,23244,26174,38505,29616,29486,21439,33146,39301,32673,23466,38519,38480,32447,30456,21410,38262,39321,31665,35140,28248,20065,32724,31077,35814,24819,21709,20139,39033,24055,27233,20687,21521,35937,33831,30813,38660,21066,21742,22179,38144,28040,23477,28102,26195,34852,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34867,34868,34869,34870,34871,34872,34874,34875,34877,34878,34879,34881,34882,34883,34886,34887,34888,34889,34890,34891,34894,34895,34896,34897,34898,34899,34901,34902,34904,34906,34907,34908,34909,34910,34911,34912,34918,34919,34922,34925,34927,34929,34931,34932,34933,34934,34936,34937,34938,34939,34940,34944,34947,34950,34951,34953,34954,34956,34958,34959,34960,34961,34963,34964,34965,34967,34968,34969,34970,34971,34973,34974,34975,34976,34977,34979,34981,34982,34983,34984,34985,34986,23567,23389,26657,32918,21880,31505,25928,26964,20123,27463,34638,38795,21327,25375,25658,37034,26012,32961,35856,20889,26800,21368,34809,25032,27844,27899,35874,23633,34218,33455,38156,27427,36763,26032,24571,24515,20449,34885,26143,33125,29481,24826,20852,21009,22411,24418,37026,34892,37266,24184,26447,24615,22995,20804,20982,33016,21256,27769,38596,29066,20241,20462,32670,26429,21957,38152,31168,34966,32483,22687,25100,38656,34394,22040,39035,24464,35768,33988,37207,21465,26093,24207,30044,24676,32110,23167,32490,32493,36713,21927,23459,24748,26059,29572,34988,34990,34991,34992,34994,34995,34996,34997,34998,35000,35001,35002,35003,35005,35006,35007,35008,35011,35012,35015,35016,35018,35019,35020,35021,35023,35024,35025,35027,35030,35031,35034,35035,35036,35037,35038,35040,35041,35046,35047,35049,35050,35051,35052,35053,35054,35055,35058,35061,35062,35063,35066,35067,35069,35071,35072,35073,35075,35076,35077,35078,35079,35080,35081,35083,35084,35085,35086,35087,35089,35092,35093,35094,35095,35096,35100,35101,35102,35103,35104,35106,35107,35108,35110,35111,35112,35113,35116,35117,35118,35119,35121,35122,35123,35125,35127,36873,30307,30505,32474,38772,34203,23398,31348,38634,34880,21195,29071,24490,26092,35810,23547,39535,24033,27529,27739,35757,35759,36874,36805,21387,25276,40486,40493,21568,20011,33469,29273,34460,23830,34905,28079,38597,21713,20122,35766,28937,21693,38409,28895,28153,30416,20005,30740,34578,23721,24310,35328,39068,38414,28814,27839,22852,25513,30524,34893,28436,33395,22576,29141,21388,30746,38593,21761,24422,28976,23476,35866,39564,27523,22830,40495,31207,26472,25196,20335,30113,32650,27915,38451,27687,20208,30162,20859,26679,28478,36992,33136,22934,29814,35128,35129,35130,35131,35132,35133,35134,35135,35136,35138,35139,35141,35142,35143,35144,35145,35146,35147,35148,35149,35150,35151,35152,35153,35154,35155,35156,35157,35158,35159,35160,35161,35162,35163,35164,35165,35168,35169,35170,35171,35172,35173,35175,35176,35177,35178,35179,35180,35181,35182,35183,35184,35185,35186,35187,35188,35189,35190,35191,35192,35193,35194,35196,35197,35198,35200,35202,35204,35205,35207,35208,35209,35210,35211,35212,35213,35214,35215,35216,35217,35218,35219,35220,35221,35222,35223,35224,35225,35226,35227,35228,35229,35230,35231,35232,35233,25671,23591,36965,31377,35875,23002,21676,33280,33647,35201,32768,26928,22094,32822,29239,37326,20918,20063,39029,25494,19994,21494,26355,33099,22812,28082,19968,22777,21307,25558,38129,20381,20234,34915,39056,22839,36951,31227,20202,33008,30097,27778,23452,23016,24413,26885,34433,20506,24050,20057,30691,20197,33402,25233,26131,37009,23673,20159,24441,33222,36920,32900,30123,20134,35028,24847,27589,24518,20041,30410,28322,35811,35758,35850,35793,24322,32764,32716,32462,33589,33643,22240,27575,38899,38452,23035,21535,38134,28139,23493,39278,23609,24341,38544,35234,35235,35236,35237,35238,35239,35240,35241,35242,35243,35244,35245,35246,35247,35248,35249,35250,35251,35252,35253,35254,35255,35256,35257,35258,35259,35260,35261,35262,35263,35264,35267,35277,35283,35284,35285,35287,35288,35289,35291,35293,35295,35296,35297,35298,35300,35303,35304,35305,35306,35308,35309,35310,35312,35313,35314,35316,35317,35318,35319,35320,35321,35322,35323,35324,35325,35326,35327,35329,35330,35331,35332,35333,35334,35336,35337,35338,35339,35340,35341,35342,35343,35344,35345,35346,35347,35348,35349,35350,35351,35352,35353,35354,35355,35356,35357,21360,33521,27185,23156,40560,24212,32552,33721,33828,33829,33639,34631,36814,36194,30408,24433,39062,30828,26144,21727,25317,20323,33219,30152,24248,38605,36362,34553,21647,27891,28044,27704,24703,21191,29992,24189,20248,24736,24551,23588,30001,37038,38080,29369,27833,28216,37193,26377,21451,21491,20305,37321,35825,21448,24188,36802,28132,20110,30402,27014,34398,24858,33286,20313,20446,36926,40060,24841,28189,28180,38533,20104,23089,38632,19982,23679,31161,23431,35821,32701,29577,22495,33419,37057,21505,36935,21947,23786,24481,24840,27442,29425,32946,35465,35358,35359,35360,35361,35362,35363,35364,35365,35366,35367,35368,35369,35370,35371,35372,35373,35374,35375,35376,35377,35378,35379,35380,35381,35382,35383,35384,35385,35386,35387,35388,35389,35391,35392,35393,35394,35395,35396,35397,35398,35399,35401,35402,35403,35404,35405,35406,35407,35408,35409,35410,35411,35412,35413,35414,35415,35416,35417,35418,35419,35420,35421,35422,35423,35424,35425,35426,35427,35428,35429,35430,35431,35432,35433,35434,35435,35436,35437,35438,35439,35440,35441,35442,35443,35444,35445,35446,35447,35448,35450,35451,35452,35453,35454,35455,35456,28020,23507,35029,39044,35947,39533,40499,28170,20900,20803,22435,34945,21407,25588,36757,22253,21592,22278,29503,28304,32536,36828,33489,24895,24616,38498,26352,32422,36234,36291,38053,23731,31908,26376,24742,38405,32792,20113,37095,21248,38504,20801,36816,34164,37213,26197,38901,23381,21277,30776,26434,26685,21705,28798,23472,36733,20877,22312,21681,25874,26242,36190,36163,33039,33900,36973,31967,20991,34299,26531,26089,28577,34468,36481,22122,36896,30338,28790,29157,36131,25321,21017,27901,36156,24590,22686,24974,26366,36192,25166,21939,28195,26413,36711,35457,35458,35459,35460,35461,35462,35463,35464,35467,35468,35469,35470,35471,35472,35473,35474,35476,35477,35478,35479,35480,35481,35482,35483,35484,35485,35486,35487,35488,35489,35490,35491,35492,35493,35494,35495,35496,35497,35498,35499,35500,35501,35502,35503,35504,35505,35506,35507,35508,35509,35510,35511,35512,35513,35514,35515,35516,35517,35518,35519,35520,35521,35522,35523,35524,35525,35526,35527,35528,35529,35530,35531,35532,35533,35534,35535,35536,35537,35538,35539,35540,35541,35542,35543,35544,35545,35546,35547,35548,35549,35550,35551,35552,35553,35554,35555,38113,38392,30504,26629,27048,21643,20045,28856,35784,25688,25995,23429,31364,20538,23528,30651,27617,35449,31896,27838,30415,26025,36759,23853,23637,34360,26632,21344,25112,31449,28251,32509,27167,31456,24432,28467,24352,25484,28072,26454,19976,24080,36134,20183,32960,30260,38556,25307,26157,25214,27836,36213,29031,32617,20806,32903,21484,36974,25240,21746,34544,36761,32773,38167,34071,36825,27993,29645,26015,30495,29956,30759,33275,36126,38024,20390,26517,30137,35786,38663,25391,38215,38453,33976,25379,30529,24449,29424,20105,24596,25972,25327,27491,25919,35556,35557,35558,35559,35560,35561,35562,35563,35564,35565,35566,35567,35568,35569,35570,35571,35572,35573,35574,35575,35576,35577,35578,35579,35580,35581,35582,35583,35584,35585,35586,35587,35588,35589,35590,35592,35593,35594,35595,35596,35597,35598,35599,35600,35601,35602,35603,35604,35605,35606,35607,35608,35609,35610,35611,35612,35613,35614,35615,35616,35617,35618,35619,35620,35621,35623,35624,35625,35626,35627,35628,35629,35630,35631,35632,35633,35634,35635,35636,35637,35638,35639,35640,35641,35642,35643,35644,35645,35646,35647,35648,35649,35650,35651,35652,35653,24103,30151,37073,35777,33437,26525,25903,21553,34584,30693,32930,33026,27713,20043,32455,32844,30452,26893,27542,25191,20540,20356,22336,25351,27490,36286,21482,26088,32440,24535,25370,25527,33267,33268,32622,24092,23769,21046,26234,31209,31258,36136,28825,30164,28382,27835,31378,20013,30405,24544,38047,34935,32456,31181,32959,37325,20210,20247,33311,21608,24030,27954,35788,31909,36724,32920,24090,21650,30385,23449,26172,39588,29664,26666,34523,26417,29482,35832,35803,36880,31481,28891,29038,25284,30633,22065,20027,33879,26609,21161,34496,36142,38136,31569,35654,35655,35656,35657,35658,35659,35660,35661,35662,35663,35664,35665,35666,35667,35668,35669,35670,35671,35672,35673,35674,35675,35676,35677,35678,35679,35680,35681,35682,35683,35684,35685,35687,35688,35689,35690,35691,35693,35694,35695,35696,35697,35698,35699,35700,35701,35702,35703,35704,35705,35706,35707,35708,35709,35710,35711,35712,35713,35714,35715,35716,35717,35718,35719,35720,35721,35722,35723,35724,35725,35726,35727,35728,35729,35730,35731,35732,35733,35734,35735,35736,35737,35738,35739,35740,35741,35742,35743,35756,35761,35771,35783,35792,35818,35849,35870,20303,27880,31069,39547,25235,29226,25341,19987,30742,36716,25776,36186,31686,26729,24196,35013,22918,25758,22766,29366,26894,38181,36861,36184,22368,32512,35846,20934,25417,25305,21331,26700,29730,33537,37196,21828,30528,28796,27978,20857,21672,36164,23039,28363,28100,23388,32043,20180,31869,28371,23376,33258,28173,23383,39683,26837,36394,23447,32508,24635,32437,37049,36208,22863,25549,31199,36275,21330,26063,31062,35781,38459,32452,38075,32386,22068,37257,26368,32618,23562,36981,26152,24038,20304,26590,20570,20316,22352,24231,59408,59409,59410,59411,59412,35896,35897,35898,35899,35900,35901,35902,35903,35904,35906,35907,35908,35909,35912,35914,35915,35917,35918,35919,35920,35921,35922,35923,35924,35926,35927,35928,35929,35931,35932,35933,35934,35935,35936,35939,35940,35941,35942,35943,35944,35945,35948,35949,35950,35951,35952,35953,35954,35956,35957,35958,35959,35963,35964,35965,35966,35967,35968,35969,35971,35972,35974,35975,35976,35979,35981,35982,35983,35984,35985,35986,35987,35989,35990,35991,35993,35994,35995,35996,35997,35998,35999,36000,36001,36002,36003,36004,36005,36006,36007,36008,36009,36010,36011,36012,36013,20109,19980,20800,19984,24319,21317,19989,20120,19998,39730,23404,22121,20008,31162,20031,21269,20039,22829,29243,21358,27664,22239,32996,39319,27603,30590,40727,20022,20127,40720,20060,20073,20115,33416,23387,21868,22031,20164,21389,21405,21411,21413,21422,38757,36189,21274,21493,21286,21294,21310,36188,21350,21347,20994,21000,21006,21037,21043,21055,21056,21068,21086,21089,21084,33967,21117,21122,21121,21136,21139,20866,32596,20155,20163,20169,20162,20200,20193,20203,20190,20251,20211,20258,20324,20213,20261,20263,20233,20267,20318,20327,25912,20314,20317,36014,36015,36016,36017,36018,36019,36020,36021,36022,36023,36024,36025,36026,36027,36028,36029,36030,36031,36032,36033,36034,36035,36036,36037,36038,36039,36040,36041,36042,36043,36044,36045,36046,36047,36048,36049,36050,36051,36052,36053,36054,36055,36056,36057,36058,36059,36060,36061,36062,36063,36064,36065,36066,36067,36068,36069,36070,36071,36072,36073,36074,36075,36076,36077,36078,36079,36080,36081,36082,36083,36084,36085,36086,36087,36088,36089,36090,36091,36092,36093,36094,36095,36096,36097,36098,36099,36100,36101,36102,36103,36104,36105,36106,36107,36108,36109,20319,20311,20274,20285,20342,20340,20369,20361,20355,20367,20350,20347,20394,20348,20396,20372,20454,20456,20458,20421,20442,20451,20444,20433,20447,20472,20521,20556,20467,20524,20495,20526,20525,20478,20508,20492,20517,20520,20606,20547,20565,20552,20558,20588,20603,20645,20647,20649,20666,20694,20742,20717,20716,20710,20718,20743,20747,20189,27709,20312,20325,20430,40864,27718,31860,20846,24061,40649,39320,20865,22804,21241,21261,35335,21264,20971,22809,20821,20128,20822,20147,34926,34980,20149,33044,35026,31104,23348,34819,32696,20907,20913,20925,20924,36110,36111,36112,36113,36114,36115,36116,36117,36118,36119,36120,36121,36122,36123,36124,36128,36177,36178,36183,36191,36197,36200,36201,36202,36204,36206,36207,36209,36210,36216,36217,36218,36219,36220,36221,36222,36223,36224,36226,36227,36230,36231,36232,36233,36236,36237,36238,36239,36240,36242,36243,36245,36246,36247,36248,36249,36250,36251,36252,36253,36254,36256,36257,36258,36260,36261,36262,36263,36264,36265,36266,36267,36268,36269,36270,36271,36272,36274,36278,36279,36281,36283,36285,36288,36289,36290,36293,36295,36296,36297,36298,36301,36304,36306,36307,36308,20935,20886,20898,20901,35744,35750,35751,35754,35764,35765,35767,35778,35779,35787,35791,35790,35794,35795,35796,35798,35800,35801,35804,35807,35808,35812,35816,35817,35822,35824,35827,35830,35833,35836,35839,35840,35842,35844,35847,35852,35855,35857,35858,35860,35861,35862,35865,35867,35864,35869,35871,35872,35873,35877,35879,35882,35883,35886,35887,35890,35891,35893,35894,21353,21370,38429,38434,38433,38449,38442,38461,38460,38466,38473,38484,38495,38503,38508,38514,38516,38536,38541,38551,38576,37015,37019,37021,37017,37036,37025,37044,37043,37046,37050,36309,36312,36313,36316,36320,36321,36322,36325,36326,36327,36329,36333,36334,36336,36337,36338,36340,36342,36348,36350,36351,36352,36353,36354,36355,36356,36358,36359,36360,36363,36365,36366,36368,36369,36370,36371,36373,36374,36375,36376,36377,36378,36379,36380,36384,36385,36388,36389,36390,36391,36392,36395,36397,36400,36402,36403,36404,36406,36407,36408,36411,36412,36414,36415,36419,36421,36422,36428,36429,36430,36431,36432,36435,36436,36437,36438,36439,36440,36442,36443,36444,36445,36446,36447,36448,36449,36450,36451,36452,36453,36455,36456,36458,36459,36462,36465,37048,37040,37071,37061,37054,37072,37060,37063,37075,37094,37090,37084,37079,37083,37099,37103,37118,37124,37154,37150,37155,37169,37167,37177,37187,37190,21005,22850,21154,21164,21165,21182,21759,21200,21206,21232,21471,29166,30669,24308,20981,20988,39727,21430,24321,30042,24047,22348,22441,22433,22654,22716,22725,22737,22313,22316,22314,22323,22329,22318,22319,22364,22331,22338,22377,22405,22379,22406,22396,22395,22376,22381,22390,22387,22445,22436,22412,22450,22479,22439,22452,22419,22432,22485,22488,22490,22489,22482,22456,22516,22511,22520,22500,22493,36467,36469,36471,36472,36473,36474,36475,36477,36478,36480,36482,36483,36484,36486,36488,36489,36490,36491,36492,36493,36494,36497,36498,36499,36501,36502,36503,36504,36505,36506,36507,36509,36511,36512,36513,36514,36515,36516,36517,36518,36519,36520,36521,36522,36525,36526,36528,36529,36531,36532,36533,36534,36535,36536,36537,36539,36540,36541,36542,36543,36544,36545,36546,36547,36548,36549,36550,36551,36552,36553,36554,36555,36556,36557,36559,36560,36561,36562,36563,36564,36565,36566,36567,36568,36569,36570,36571,36572,36573,36574,36575,36576,36577,36578,36579,36580,22539,22541,22525,22509,22528,22558,22553,22596,22560,22629,22636,22657,22665,22682,22656,39336,40729,25087,33401,33405,33407,33423,33418,33448,33412,33422,33425,33431,33433,33451,33464,33470,33456,33480,33482,33507,33432,33463,33454,33483,33484,33473,33449,33460,33441,33450,33439,33476,33486,33444,33505,33545,33527,33508,33551,33543,33500,33524,33490,33496,33548,33531,33491,33553,33562,33542,33556,33557,33504,33493,33564,33617,33627,33628,33544,33682,33596,33588,33585,33691,33630,33583,33615,33607,33603,33631,33600,33559,33632,33581,33594,33587,33638,33637,36581,36582,36583,36584,36585,36586,36587,36588,36589,36590,36591,36592,36593,36594,36595,36596,36597,36598,36599,36600,36601,36602,36603,36604,36605,36606,36607,36608,36609,36610,36611,36612,36613,36614,36615,36616,36617,36618,36619,36620,36621,36622,36623,36624,36625,36626,36627,36628,36629,36630,36631,36632,36633,36634,36635,36636,36637,36638,36639,36640,36641,36642,36643,36644,36645,36646,36647,36648,36649,36650,36651,36652,36653,36654,36655,36656,36657,36658,36659,36660,36661,36662,36663,36664,36665,36666,36667,36668,36669,36670,36671,36672,36673,36674,36675,36676,33640,33563,33641,33644,33642,33645,33646,33712,33656,33715,33716,33696,33706,33683,33692,33669,33660,33718,33705,33661,33720,33659,33688,33694,33704,33722,33724,33729,33793,33765,33752,22535,33816,33803,33757,33789,33750,33820,33848,33809,33798,33748,33759,33807,33795,33784,33785,33770,33733,33728,33830,33776,33761,33884,33873,33882,33881,33907,33927,33928,33914,33929,33912,33852,33862,33897,33910,33932,33934,33841,33901,33985,33997,34000,34022,33981,34003,33994,33983,33978,34016,33953,33977,33972,33943,34021,34019,34060,29965,34104,34032,34105,34079,34106,36677,36678,36679,36680,36681,36682,36683,36684,36685,36686,36687,36688,36689,36690,36691,36692,36693,36694,36695,36696,36697,36698,36699,36700,36701,36702,36703,36704,36705,36706,36707,36708,36709,36714,36736,36748,36754,36765,36768,36769,36770,36772,36773,36774,36775,36778,36780,36781,36782,36783,36786,36787,36788,36789,36791,36792,36794,36795,36796,36799,36800,36803,36806,36809,36810,36811,36812,36813,36815,36818,36822,36823,36826,36832,36833,36835,36839,36844,36847,36849,36850,36852,36853,36854,36858,36859,36860,36862,36863,36871,36872,36876,36878,36883,36885,36888,34134,34107,34047,34044,34137,34120,34152,34148,34142,34170,30626,34115,34162,34171,34212,34216,34183,34191,34169,34222,34204,34181,34233,34231,34224,34259,34241,34268,34303,34343,34309,34345,34326,34364,24318,24328,22844,22849,32823,22869,22874,22872,21263,23586,23589,23596,23604,25164,25194,25247,25275,25290,25306,25303,25326,25378,25334,25401,25419,25411,25517,25590,25457,25466,25486,25524,25453,25516,25482,25449,25518,25532,25586,25592,25568,25599,25540,25566,25550,25682,25542,25534,25669,25665,25611,25627,25632,25612,25638,25633,25694,25732,25709,25750,36889,36892,36899,36900,36901,36903,36904,36905,36906,36907,36908,36912,36913,36914,36915,36916,36919,36921,36922,36925,36927,36928,36931,36933,36934,36936,36937,36938,36939,36940,36942,36948,36949,36950,36953,36954,36956,36957,36958,36959,36960,36961,36964,36966,36967,36969,36970,36971,36972,36975,36976,36977,36978,36979,36982,36983,36984,36985,36986,36987,36988,36990,36993,36996,36997,36998,36999,37001,37002,37004,37005,37006,37007,37008,37010,37012,37014,37016,37018,37020,37022,37023,37024,37028,37029,37031,37032,37033,37035,37037,37042,37047,37052,37053,37055,37056,25722,25783,25784,25753,25786,25792,25808,25815,25828,25826,25865,25893,25902,24331,24530,29977,24337,21343,21489,21501,21481,21480,21499,21522,21526,21510,21579,21586,21587,21588,21590,21571,21537,21591,21593,21539,21554,21634,21652,21623,21617,21604,21658,21659,21636,21622,21606,21661,21712,21677,21698,21684,21714,21671,21670,21715,21716,21618,21667,21717,21691,21695,21708,21721,21722,21724,21673,21674,21668,21725,21711,21726,21787,21735,21792,21757,21780,21747,21794,21795,21775,21777,21799,21802,21863,21903,21941,21833,21869,21825,21845,21823,21840,21820,37058,37059,37062,37064,37065,37067,37068,37069,37074,37076,37077,37078,37080,37081,37082,37086,37087,37088,37091,37092,37093,37097,37098,37100,37102,37104,37105,37106,37107,37109,37110,37111,37113,37114,37115,37116,37119,37120,37121,37123,37125,37126,37127,37128,37129,37130,37131,37132,37133,37134,37135,37136,37137,37138,37139,37140,37141,37142,37143,37144,37146,37147,37148,37149,37151,37152,37153,37156,37157,37158,37159,37160,37161,37162,37163,37164,37165,37166,37168,37170,37171,37172,37173,37174,37175,37176,37178,37179,37180,37181,37182,37183,37184,37185,37186,37188,21815,21846,21877,21878,21879,21811,21808,21852,21899,21970,21891,21937,21945,21896,21889,21919,21886,21974,21905,21883,21983,21949,21950,21908,21913,21994,22007,21961,22047,21969,21995,21996,21972,21990,21981,21956,21999,21989,22002,22003,21964,21965,21992,22005,21988,36756,22046,22024,22028,22017,22052,22051,22014,22016,22055,22061,22104,22073,22103,22060,22093,22114,22105,22108,22092,22100,22150,22116,22129,22123,22139,22140,22149,22163,22191,22228,22231,22237,22241,22261,22251,22265,22271,22276,22282,22281,22300,24079,24089,24084,24081,24113,24123,24124,37189,37191,37192,37201,37203,37204,37205,37206,37208,37209,37211,37212,37215,37216,37222,37223,37224,37227,37229,37235,37242,37243,37244,37248,37249,37250,37251,37252,37254,37256,37258,37262,37263,37267,37268,37269,37270,37271,37272,37273,37276,37277,37278,37279,37280,37281,37284,37285,37286,37287,37288,37289,37291,37292,37296,37297,37298,37299,37302,37303,37304,37305,37307,37308,37309,37310,37311,37312,37313,37314,37315,37316,37317,37318,37320,37323,37328,37330,37331,37332,37333,37334,37335,37336,37337,37338,37339,37341,37342,37343,37344,37345,37346,37347,37348,37349,24119,24132,24148,24155,24158,24161,23692,23674,23693,23696,23702,23688,23704,23705,23697,23706,23708,23733,23714,23741,23724,23723,23729,23715,23745,23735,23748,23762,23780,23755,23781,23810,23811,23847,23846,23854,23844,23838,23814,23835,23896,23870,23860,23869,23916,23899,23919,23901,23915,23883,23882,23913,23924,23938,23961,23965,35955,23991,24005,24435,24439,24450,24455,24457,24460,24469,24473,24476,24488,24493,24501,24508,34914,24417,29357,29360,29364,29367,29368,29379,29377,29390,29389,29394,29416,29423,29417,29426,29428,29431,29441,29427,29443,29434,37350,37351,37352,37353,37354,37355,37356,37357,37358,37359,37360,37361,37362,37363,37364,37365,37366,37367,37368,37369,37370,37371,37372,37373,37374,37375,37376,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37387,37388,37389,37390,37391,37392,37393,37394,37395,37396,37397,37398,37399,37400,37401,37402,37403,37404,37405,37406,37407,37408,37409,37410,37411,37412,37413,37414,37415,37416,37417,37418,37419,37420,37421,37422,37423,37424,37425,37426,37427,37428,37429,37430,37431,37432,37433,37434,37435,37436,37437,37438,37439,37440,37441,37442,37443,37444,37445,29435,29463,29459,29473,29450,29470,29469,29461,29474,29497,29477,29484,29496,29489,29520,29517,29527,29536,29548,29551,29566,33307,22821,39143,22820,22786,39267,39271,39272,39273,39274,39275,39276,39284,39287,39293,39296,39300,39303,39306,39309,39312,39313,39315,39316,39317,24192,24209,24203,24214,24229,24224,24249,24245,24254,24243,36179,24274,24273,24283,24296,24298,33210,24516,24521,24534,24527,24579,24558,24580,24545,24548,24574,24581,24582,24554,24557,24568,24601,24629,24614,24603,24591,24589,24617,24619,24586,24639,24609,24696,24697,24699,24698,24642,37446,37447,37448,37449,37450,37451,37452,37453,37454,37455,37456,37457,37458,37459,37460,37461,37462,37463,37464,37465,37466,37467,37468,37469,37470,37471,37472,37473,37474,37475,37476,37477,37478,37479,37480,37481,37482,37483,37484,37485,37486,37487,37488,37489,37490,37491,37493,37494,37495,37496,37497,37498,37499,37500,37501,37502,37503,37504,37505,37506,37507,37508,37509,37510,37511,37512,37513,37514,37515,37516,37517,37519,37520,37521,37522,37523,37524,37525,37526,37527,37528,37529,37530,37531,37532,37533,37534,37535,37536,37537,37538,37539,37540,37541,37542,37543,24682,24701,24726,24730,24749,24733,24707,24722,24716,24731,24812,24763,24753,24797,24792,24774,24794,24756,24864,24870,24853,24867,24820,24832,24846,24875,24906,24949,25004,24980,24999,25015,25044,25077,24541,38579,38377,38379,38385,38387,38389,38390,38396,38398,38403,38404,38406,38408,38410,38411,38412,38413,38415,38418,38421,38422,38423,38425,38426,20012,29247,25109,27701,27732,27740,27722,27811,27781,27792,27796,27788,27752,27753,27764,27766,27782,27817,27856,27860,27821,27895,27896,27889,27863,27826,27872,27862,27898,27883,27886,27825,27859,27887,27902,37544,37545,37546,37547,37548,37549,37551,37552,37553,37554,37555,37556,37557,37558,37559,37560,37561,37562,37563,37564,37565,37566,37567,37568,37569,37570,37571,37572,37573,37574,37575,37577,37578,37579,37580,37581,37582,37583,37584,37585,37586,37587,37588,37589,37590,37591,37592,37593,37594,37595,37596,37597,37598,37599,37600,37601,37602,37603,37604,37605,37606,37607,37608,37609,37610,37611,37612,37613,37614,37615,37616,37617,37618,37619,37620,37621,37622,37623,37624,37625,37626,37627,37628,37629,37630,37631,37632,37633,37634,37635,37636,37637,37638,37639,37640,37641,27961,27943,27916,27971,27976,27911,27908,27929,27918,27947,27981,27950,27957,27930,27983,27986,27988,27955,28049,28015,28062,28064,27998,28051,28052,27996,28000,28028,28003,28186,28103,28101,28126,28174,28095,28128,28177,28134,28125,28121,28182,28075,28172,28078,28203,28270,28238,28267,28338,28255,28294,28243,28244,28210,28197,28228,28383,28337,28312,28384,28461,28386,28325,28327,28349,28347,28343,28375,28340,28367,28303,28354,28319,28514,28486,28487,28452,28437,28409,28463,28470,28491,28532,28458,28425,28457,28553,28557,28556,28536,28530,28540,28538,28625,37642,37643,37644,37645,37646,37647,37648,37649,37650,37651,37652,37653,37654,37655,37656,37657,37658,37659,37660,37661,37662,37663,37664,37665,37666,37667,37668,37669,37670,37671,37672,37673,37674,37675,37676,37677,37678,37679,37680,37681,37682,37683,37684,37685,37686,37687,37688,37689,37690,37691,37692,37693,37695,37696,37697,37698,37699,37700,37701,37702,37703,37704,37705,37706,37707,37708,37709,37710,37711,37712,37713,37714,37715,37716,37717,37718,37719,37720,37721,37722,37723,37724,37725,37726,37727,37728,37729,37730,37731,37732,37733,37734,37735,37736,37737,37739,28617,28583,28601,28598,28610,28641,28654,28638,28640,28655,28698,28707,28699,28729,28725,28751,28766,23424,23428,23445,23443,23461,23480,29999,39582,25652,23524,23534,35120,23536,36423,35591,36790,36819,36821,36837,36846,36836,36841,36838,36851,36840,36869,36868,36875,36902,36881,36877,36886,36897,36917,36918,36909,36911,36932,36945,36946,36944,36968,36952,36962,36955,26297,36980,36989,36994,37000,36995,37003,24400,24407,24406,24408,23611,21675,23632,23641,23409,23651,23654,32700,24362,24361,24365,33396,24380,39739,23662,22913,22915,22925,22953,22954,22947,37740,37741,37742,37743,37744,37745,37746,37747,37748,37749,37750,37751,37752,37753,37754,37755,37756,37757,37758,37759,37760,37761,37762,37763,37764,37765,37766,37767,37768,37769,37770,37771,37772,37773,37774,37776,37777,37778,37779,37780,37781,37782,37783,37784,37785,37786,37787,37788,37789,37790,37791,37792,37793,37794,37795,37796,37797,37798,37799,37800,37801,37802,37803,37804,37805,37806,37807,37808,37809,37810,37811,37812,37813,37814,37815,37816,37817,37818,37819,37820,37821,37822,37823,37824,37825,37826,37827,37828,37829,37830,37831,37832,37833,37835,37836,37837,22935,22986,22955,22942,22948,22994,22962,22959,22999,22974,23045,23046,23005,23048,23011,23000,23033,23052,23049,23090,23092,23057,23075,23059,23104,23143,23114,23125,23100,23138,23157,33004,23210,23195,23159,23162,23230,23275,23218,23250,23252,23224,23264,23267,23281,23254,23270,23256,23260,23305,23319,23318,23346,23351,23360,23573,23580,23386,23397,23411,23377,23379,23394,39541,39543,39544,39546,39551,39549,39552,39553,39557,39560,39562,39568,39570,39571,39574,39576,39579,39580,39581,39583,39584,39586,39587,39589,39591,32415,32417,32419,32421,32424,32425,37838,37839,37840,37841,37842,37843,37844,37845,37847,37848,37849,37850,37851,37852,37853,37854,37855,37856,37857,37858,37859,37860,37861,37862,37863,37864,37865,37866,37867,37868,37869,37870,37871,37872,37873,37874,37875,37876,37877,37878,37879,37880,37881,37882,37883,37884,37885,37886,37887,37888,37889,37890,37891,37892,37893,37894,37895,37896,37897,37898,37899,37900,37901,37902,37903,37904,37905,37906,37907,37908,37909,37910,37911,37912,37913,37914,37915,37916,37917,37918,37919,37920,37921,37922,37923,37924,37925,37926,37927,37928,37929,37930,37931,37932,37933,37934,32429,32432,32446,32448,32449,32450,32457,32459,32460,32464,32468,32471,32475,32480,32481,32488,32491,32494,32495,32497,32498,32525,32502,32506,32507,32510,32513,32514,32515,32519,32520,32523,32524,32527,32529,32530,32535,32537,32540,32539,32543,32545,32546,32547,32548,32549,32550,32551,32554,32555,32556,32557,32559,32560,32561,32562,32563,32565,24186,30079,24027,30014,37013,29582,29585,29614,29602,29599,29647,29634,29649,29623,29619,29632,29641,29640,29669,29657,39036,29706,29673,29671,29662,29626,29682,29711,29738,29787,29734,29733,29736,29744,29742,29740,37935,37936,37937,37938,37939,37940,37941,37942,37943,37944,37945,37946,37947,37948,37949,37951,37952,37953,37954,37955,37956,37957,37958,37959,37960,37961,37962,37963,37964,37965,37966,37967,37968,37969,37970,37971,37972,37973,37974,37975,37976,37977,37978,37979,37980,37981,37982,37983,37984,37985,37986,37987,37988,37989,37990,37991,37992,37993,37994,37996,37997,37998,37999,38000,38001,38002,38003,38004,38005,38006,38007,38008,38009,38010,38011,38012,38013,38014,38015,38016,38017,38018,38019,38020,38033,38038,38040,38087,38095,38099,38100,38106,38118,38139,38172,38176,29723,29722,29761,29788,29783,29781,29785,29815,29805,29822,29852,29838,29824,29825,29831,29835,29854,29864,29865,29840,29863,29906,29882,38890,38891,38892,26444,26451,26462,26440,26473,26533,26503,26474,26483,26520,26535,26485,26536,26526,26541,26507,26487,26492,26608,26633,26584,26634,26601,26544,26636,26585,26549,26586,26547,26589,26624,26563,26552,26594,26638,26561,26621,26674,26675,26720,26721,26702,26722,26692,26724,26755,26653,26709,26726,26689,26727,26688,26686,26698,26697,26665,26805,26767,26740,26743,26771,26731,26818,26990,26876,26911,26912,26873,38183,38195,38205,38211,38216,38219,38229,38234,38240,38254,38260,38261,38263,38264,38265,38266,38267,38268,38269,38270,38272,38273,38274,38275,38276,38277,38278,38279,38280,38281,38282,38283,38284,38285,38286,38287,38288,38289,38290,38291,38292,38293,38294,38295,38296,38297,38298,38299,38300,38301,38302,38303,38304,38305,38306,38307,38308,38309,38310,38311,38312,38313,38314,38315,38316,38317,38318,38319,38320,38321,38322,38323,38324,38325,38326,38327,38328,38329,38330,38331,38332,38333,38334,38335,38336,38337,38338,38339,38340,38341,38342,38343,38344,38345,38346,38347,26916,26864,26891,26881,26967,26851,26896,26993,26937,26976,26946,26973,27012,26987,27008,27032,27000,26932,27084,27015,27016,27086,27017,26982,26979,27001,27035,27047,27067,27051,27053,27092,27057,27073,27082,27103,27029,27104,27021,27135,27183,27117,27159,27160,27237,27122,27204,27198,27296,27216,27227,27189,27278,27257,27197,27176,27224,27260,27281,27280,27305,27287,27307,29495,29522,27521,27522,27527,27524,27538,27539,27533,27546,27547,27553,27562,36715,36717,36721,36722,36723,36725,36726,36728,36727,36729,36730,36732,36734,36737,36738,36740,36743,36747,38348,38349,38350,38351,38352,38353,38354,38355,38356,38357,38358,38359,38360,38361,38362,38363,38364,38365,38366,38367,38368,38369,38370,38371,38372,38373,38374,38375,38380,38399,38407,38419,38424,38427,38430,38432,38435,38436,38437,38438,38439,38440,38441,38443,38444,38445,38447,38448,38455,38456,38457,38458,38462,38465,38467,38474,38478,38479,38481,38482,38483,38486,38487,38488,38489,38490,38492,38493,38494,38496,38499,38501,38502,38507,38509,38510,38511,38512,38513,38515,38520,38521,38522,38523,38524,38525,38526,38527,38528,38529,38530,38531,38532,38535,38537,38538,36749,36750,36751,36760,36762,36558,25099,25111,25115,25119,25122,25121,25125,25124,25132,33255,29935,29940,29951,29967,29969,29971,25908,26094,26095,26096,26122,26137,26482,26115,26133,26112,28805,26359,26141,26164,26161,26166,26165,32774,26207,26196,26177,26191,26198,26209,26199,26231,26244,26252,26279,26269,26302,26331,26332,26342,26345,36146,36147,36150,36155,36157,36160,36165,36166,36168,36169,36167,36173,36181,36185,35271,35274,35275,35276,35278,35279,35280,35281,29294,29343,29277,29286,29295,29310,29311,29316,29323,29325,29327,29330,25352,25394,25520,38540,38542,38545,38546,38547,38549,38550,38554,38555,38557,38558,38559,38560,38561,38562,38563,38564,38565,38566,38568,38569,38570,38571,38572,38573,38574,38575,38577,38578,38580,38581,38583,38584,38586,38587,38591,38594,38595,38600,38602,38603,38608,38609,38611,38612,38614,38615,38616,38617,38618,38619,38620,38621,38622,38623,38625,38626,38627,38628,38629,38630,38631,38635,38636,38637,38638,38640,38641,38642,38644,38645,38648,38650,38651,38652,38653,38655,38658,38659,38661,38666,38667,38668,38672,38673,38674,38676,38677,38679,38680,38681,38682,38683,38685,38687,38688,25663,25816,32772,27626,27635,27645,27637,27641,27653,27655,27654,27661,27669,27672,27673,27674,27681,27689,27684,27690,27698,25909,25941,25963,29261,29266,29270,29232,34402,21014,32927,32924,32915,32956,26378,32957,32945,32939,32941,32948,32951,32999,33000,33001,33002,32987,32962,32964,32985,32973,32983,26384,32989,33003,33009,33012,33005,33037,33038,33010,33020,26389,33042,35930,33078,33054,33068,33048,33074,33096,33100,33107,33140,33113,33114,33137,33120,33129,33148,33149,33133,33127,22605,23221,33160,33154,33169,28373,33187,33194,33228,26406,33226,33211,38689,38690,38691,38692,38693,38694,38695,38696,38697,38699,38700,38702,38703,38705,38707,38708,38709,38710,38711,38714,38715,38716,38717,38719,38720,38721,38722,38723,38724,38725,38726,38727,38728,38729,38730,38731,38732,38733,38734,38735,38736,38737,38740,38741,38743,38744,38746,38748,38749,38751,38755,38756,38758,38759,38760,38762,38763,38764,38765,38766,38767,38768,38769,38770,38773,38775,38776,38777,38778,38779,38781,38782,38783,38784,38785,38786,38787,38788,38790,38791,38792,38793,38794,38796,38798,38799,38800,38803,38805,38806,38807,38809,38810,38811,38812,38813,33217,33190,27428,27447,27449,27459,27462,27481,39121,39122,39123,39125,39129,39130,27571,24384,27586,35315,26000,40785,26003,26044,26054,26052,26051,26060,26062,26066,26070,28800,28828,28822,28829,28859,28864,28855,28843,28849,28904,28874,28944,28947,28950,28975,28977,29043,29020,29032,28997,29042,29002,29048,29050,29080,29107,29109,29096,29088,29152,29140,29159,29177,29213,29224,28780,28952,29030,29113,25150,25149,25155,25160,25161,31035,31040,31046,31049,31067,31068,31059,31066,31074,31063,31072,31087,31079,31098,31109,31114,31130,31143,31155,24529,24528,38814,38815,38817,38818,38820,38821,38822,38823,38824,38825,38826,38828,38830,38832,38833,38835,38837,38838,38839,38840,38841,38842,38843,38844,38845,38846,38847,38848,38849,38850,38851,38852,38853,38854,38855,38856,38857,38858,38859,38860,38861,38862,38863,38864,38865,38866,38867,38868,38869,38870,38871,38872,38873,38874,38875,38876,38877,38878,38879,38880,38881,38882,38883,38884,38885,38888,38894,38895,38896,38897,38898,38900,38903,38904,38905,38906,38907,38908,38909,38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920,38921,38922,38923,38924,38925,38926,24636,24669,24666,24679,24641,24665,24675,24747,24838,24845,24925,25001,24989,25035,25041,25094,32896,32895,27795,27894,28156,30710,30712,30720,30729,30743,30744,30737,26027,30765,30748,30749,30777,30778,30779,30751,30780,30757,30764,30755,30761,30798,30829,30806,30807,30758,30800,30791,30796,30826,30875,30867,30874,30855,30876,30881,30883,30898,30905,30885,30932,30937,30921,30956,30962,30981,30964,30995,31012,31006,31028,40859,40697,40699,40700,30449,30468,30477,30457,30471,30472,30490,30498,30489,30509,30502,30517,30520,30544,30545,30535,30531,30554,30568,38927,38928,38929,38930,38931,38932,38933,38934,38935,38936,38937,38938,38939,38940,38941,38942,38943,38944,38945,38946,38947,38948,38949,38950,38951,38952,38953,38954,38955,38956,38957,38958,38959,38960,38961,38962,38963,38964,38965,38966,38967,38968,38969,38970,38971,38972,38973,38974,38975,38976,38977,38978,38979,38980,38981,38982,38983,38984,38985,38986,38987,38988,38989,38990,38991,38992,38993,38994,38995,38996,38997,38998,38999,39000,39001,39002,39003,39004,39005,39006,39007,39008,39009,39010,39011,39012,39013,39014,39015,39016,39017,39018,39019,39020,39021,39022,30562,30565,30591,30605,30589,30592,30604,30609,30623,30624,30640,30645,30653,30010,30016,30030,30027,30024,30043,30066,30073,30083,32600,32609,32607,35400,32616,32628,32625,32633,32641,32638,30413,30437,34866,38021,38022,38023,38027,38026,38028,38029,38031,38032,38036,38039,38037,38042,38043,38044,38051,38052,38059,38058,38061,38060,38063,38064,38066,38068,38070,38071,38072,38073,38074,38076,38077,38079,38084,38088,38089,38090,38091,38092,38093,38094,38096,38097,38098,38101,38102,38103,38105,38104,38107,38110,38111,38112,38114,38116,38117,38119,38120,38122,39023,39024,39025,39026,39027,39028,39051,39054,39058,39061,39065,39075,39080,39081,39082,39083,39084,39085,39086,39087,39088,39089,39090,39091,39092,39093,39094,39095,39096,39097,39098,39099,39100,39101,39102,39103,39104,39105,39106,39107,39108,39109,39110,39111,39112,39113,39114,39115,39116,39117,39119,39120,39124,39126,39127,39131,39132,39133,39136,39137,39138,39139,39140,39141,39142,39145,39146,39147,39148,39149,39150,39151,39152,39153,39154,39155,39156,39157,39158,39159,39160,39161,39162,39163,39164,39165,39166,39167,39168,39169,39170,39171,39172,39173,39174,39175,38121,38123,38126,38127,38131,38132,38133,38135,38137,38140,38141,38143,38147,38146,38150,38151,38153,38154,38157,38158,38159,38162,38163,38164,38165,38166,38168,38171,38173,38174,38175,38178,38186,38187,38185,38188,38193,38194,38196,38198,38199,38200,38204,38206,38207,38210,38197,38212,38213,38214,38217,38220,38222,38223,38226,38227,38228,38230,38231,38232,38233,38235,38238,38239,38237,38241,38242,38244,38245,38246,38247,38248,38249,38250,38251,38252,38255,38257,38258,38259,38202,30695,30700,38601,31189,31213,31203,31211,31238,23879,31235,31234,31262,31252,39176,39177,39178,39179,39180,39182,39183,39185,39186,39187,39188,39189,39190,39191,39192,39193,39194,39195,39196,39197,39198,39199,39200,39201,39202,39203,39204,39205,39206,39207,39208,39209,39210,39211,39212,39213,39215,39216,39217,39218,39219,39220,39221,39222,39223,39224,39225,39226,39227,39228,39229,39230,39231,39232,39233,39234,39235,39236,39237,39238,39239,39240,39241,39242,39243,39244,39245,39246,39247,39248,39249,39250,39251,39254,39255,39256,39257,39258,39259,39260,39261,39262,39263,39264,39265,39266,39268,39270,39283,39288,39289,39291,39294,39298,39299,39305,31289,31287,31313,40655,39333,31344,30344,30350,30355,30361,30372,29918,29920,29996,40480,40482,40488,40489,40490,40491,40492,40498,40497,40502,40504,40503,40505,40506,40510,40513,40514,40516,40518,40519,40520,40521,40523,40524,40526,40529,40533,40535,40538,40539,40540,40542,40547,40550,40551,40552,40553,40554,40555,40556,40561,40557,40563,30098,30100,30102,30112,30109,30124,30115,30131,30132,30136,30148,30129,30128,30147,30146,30166,30157,30179,30184,30182,30180,30187,30183,30211,30193,30204,30207,30224,30208,30213,30220,30231,30218,30245,30232,30229,30233,39308,39310,39322,39323,39324,39325,39326,39327,39328,39329,39330,39331,39332,39334,39335,39337,39338,39339,39340,39341,39342,39343,39344,39345,39346,39347,39348,39349,39350,39351,39352,39353,39354,39355,39356,39357,39358,39359,39360,39361,39362,39363,39364,39365,39366,39367,39368,39369,39370,39371,39372,39373,39374,39375,39376,39377,39378,39379,39380,39381,39382,39383,39384,39385,39386,39387,39388,39389,39390,39391,39392,39393,39394,39395,39396,39397,39398,39399,39400,39401,39402,39403,39404,39405,39406,39407,39408,39409,39410,39411,39412,39413,39414,39415,39416,39417,30235,30268,30242,30240,30272,30253,30256,30271,30261,30275,30270,30259,30285,30302,30292,30300,30294,30315,30319,32714,31462,31352,31353,31360,31366,31368,31381,31398,31392,31404,31400,31405,31411,34916,34921,34930,34941,34943,34946,34978,35014,34999,35004,35017,35042,35022,35043,35045,35057,35098,35068,35048,35070,35056,35105,35097,35091,35099,35082,35124,35115,35126,35137,35174,35195,30091,32997,30386,30388,30684,32786,32788,32790,32796,32800,32802,32805,32806,32807,32809,32808,32817,32779,32821,32835,32838,32845,32850,32873,32881,35203,39032,39040,39043,39418,39419,39420,39421,39422,39423,39424,39425,39426,39427,39428,39429,39430,39431,39432,39433,39434,39435,39436,39437,39438,39439,39440,39441,39442,39443,39444,39445,39446,39447,39448,39449,39450,39451,39452,39453,39454,39455,39456,39457,39458,39459,39460,39461,39462,39463,39464,39465,39466,39467,39468,39469,39470,39471,39472,39473,39474,39475,39476,39477,39478,39479,39480,39481,39482,39483,39484,39485,39486,39487,39488,39489,39490,39491,39492,39493,39494,39495,39496,39497,39498,39499,39500,39501,39502,39503,39504,39505,39506,39507,39508,39509,39510,39511,39512,39513,39049,39052,39053,39055,39060,39066,39067,39070,39071,39073,39074,39077,39078,34381,34388,34412,34414,34431,34426,34428,34427,34472,34445,34443,34476,34461,34471,34467,34474,34451,34473,34486,34500,34485,34510,34480,34490,34481,34479,34505,34511,34484,34537,34545,34546,34541,34547,34512,34579,34526,34548,34527,34520,34513,34563,34567,34552,34568,34570,34573,34569,34595,34619,34590,34597,34606,34586,34622,34632,34612,34609,34601,34615,34623,34690,34594,34685,34686,34683,34656,34672,34636,34670,34699,34643,34659,34684,34660,34649,34661,34707,34735,34728,34770,39514,39515,39516,39517,39518,39519,39520,39521,39522,39523,39524,39525,39526,39527,39528,39529,39530,39531,39538,39555,39561,39565,39566,39572,39573,39577,39590,39593,39594,39595,39596,39597,39598,39599,39602,39603,39604,39605,39609,39611,39613,39614,39615,39619,39620,39622,39623,39624,39625,39626,39629,39630,39631,39632,39634,39636,39637,39638,39639,39641,39642,39643,39644,39645,39646,39648,39650,39651,39652,39653,39655,39656,39657,39658,39660,39662,39664,39665,39666,39667,39668,39669,39670,39671,39672,39674,39676,39677,39678,39679,39680,39681,39682,39684,39685,39686,34758,34696,34693,34733,34711,34691,34731,34789,34732,34741,34739,34763,34771,34749,34769,34752,34762,34779,34794,34784,34798,34838,34835,34814,34826,34843,34849,34873,34876,32566,32578,32580,32581,33296,31482,31485,31496,31491,31492,31509,31498,31531,31503,31559,31544,31530,31513,31534,31537,31520,31525,31524,31539,31550,31518,31576,31578,31557,31605,31564,31581,31584,31598,31611,31586,31602,31601,31632,31654,31655,31672,31660,31645,31656,31621,31658,31644,31650,31659,31668,31697,31681,31692,31709,31706,31717,31718,31722,31756,31742,31740,31759,31766,31755,39687,39689,39690,39691,39692,39693,39694,39696,39697,39698,39700,39701,39702,39703,39704,39705,39706,39707,39708,39709,39710,39712,39713,39714,39716,39717,39718,39719,39720,39721,39722,39723,39724,39725,39726,39728,39729,39731,39732,39733,39734,39735,39736,39737,39738,39741,39742,39743,39744,39750,39754,39755,39756,39758,39760,39762,39763,39765,39766,39767,39768,39769,39770,39771,39772,39773,39774,39775,39776,39777,39778,39779,39780,39781,39782,39783,39784,39785,39786,39787,39788,39789,39790,39791,39792,39793,39794,39795,39796,39797,39798,39799,39800,39801,39802,39803,31775,31786,31782,31800,31809,31808,33278,33281,33282,33284,33260,34884,33313,33314,33315,33325,33327,33320,33323,33336,33339,33331,33332,33342,33348,33353,33355,33359,33370,33375,33384,34942,34949,34952,35032,35039,35166,32669,32671,32679,32687,32688,32690,31868,25929,31889,31901,31900,31902,31906,31922,31932,31933,31937,31943,31948,31949,31944,31941,31959,31976,33390,26280,32703,32718,32725,32741,32737,32742,32745,32750,32755,31992,32119,32166,32174,32327,32411,40632,40628,36211,36228,36244,36241,36273,36199,36205,35911,35913,37194,37200,37198,37199,37220,39804,39805,39806,39807,39808,39809,39810,39811,39812,39813,39814,39815,39816,39817,39818,39819,39820,39821,39822,39823,39824,39825,39826,39827,39828,39829,39830,39831,39832,39833,39834,39835,39836,39837,39838,39839,39840,39841,39842,39843,39844,39845,39846,39847,39848,39849,39850,39851,39852,39853,39854,39855,39856,39857,39858,39859,39860,39861,39862,39863,39864,39865,39866,39867,39868,39869,39870,39871,39872,39873,39874,39875,39876,39877,39878,39879,39880,39881,39882,39883,39884,39885,39886,39887,39888,39889,39890,39891,39892,39893,39894,39895,39896,39897,39898,39899,37218,37217,37232,37225,37231,37245,37246,37234,37236,37241,37260,37253,37264,37261,37265,37282,37283,37290,37293,37294,37295,37301,37300,37306,35925,40574,36280,36331,36357,36441,36457,36277,36287,36284,36282,36292,36310,36311,36314,36318,36302,36303,36315,36294,36332,36343,36344,36323,36345,36347,36324,36361,36349,36372,36381,36383,36396,36398,36387,36399,36410,36416,36409,36405,36413,36401,36425,36417,36418,36433,36434,36426,36464,36470,36476,36463,36468,36485,36495,36500,36496,36508,36510,35960,35970,35978,35973,35992,35988,26011,35286,35294,35290,35292,39900,39901,39902,39903,39904,39905,39906,39907,39908,39909,39910,39911,39912,39913,39914,39915,39916,39917,39918,39919,39920,39921,39922,39923,39924,39925,39926,39927,39928,39929,39930,39931,39932,39933,39934,39935,39936,39937,39938,39939,39940,39941,39942,39943,39944,39945,39946,39947,39948,39949,39950,39951,39952,39953,39954,39955,39956,39957,39958,39959,39960,39961,39962,39963,39964,39965,39966,39967,39968,39969,39970,39971,39972,39973,39974,39975,39976,39977,39978,39979,39980,39981,39982,39983,39984,39985,39986,39987,39988,39989,39990,39991,39992,39993,39994,39995,35301,35307,35311,35390,35622,38739,38633,38643,38639,38662,38657,38664,38671,38670,38698,38701,38704,38718,40832,40835,40837,40838,40839,40840,40841,40842,40844,40702,40715,40717,38585,38588,38589,38606,38610,30655,38624,37518,37550,37576,37694,37738,37834,37775,37950,37995,40063,40066,40069,40070,40071,40072,31267,40075,40078,40080,40081,40082,40084,40085,40090,40091,40094,40095,40096,40097,40098,40099,40101,40102,40103,40104,40105,40107,40109,40110,40112,40113,40114,40115,40116,40117,40118,40119,40122,40123,40124,40125,40132,40133,40134,40135,40138,40139,39996,39997,39998,39999,40000,40001,40002,40003,40004,40005,40006,40007,40008,40009,40010,40011,40012,40013,40014,40015,40016,40017,40018,40019,40020,40021,40022,40023,40024,40025,40026,40027,40028,40029,40030,40031,40032,40033,40034,40035,40036,40037,40038,40039,40040,40041,40042,40043,40044,40045,40046,40047,40048,40049,40050,40051,40052,40053,40054,40055,40056,40057,40058,40059,40061,40062,40064,40067,40068,40073,40074,40076,40079,40083,40086,40087,40088,40089,40093,40106,40108,40111,40121,40126,40127,40128,40129,40130,40136,40137,40145,40146,40154,40155,40160,40161,40140,40141,40142,40143,40144,40147,40148,40149,40151,40152,40153,40156,40157,40159,40162,38780,38789,38801,38802,38804,38831,38827,38819,38834,38836,39601,39600,39607,40536,39606,39610,39612,39617,39616,39621,39618,39627,39628,39633,39749,39747,39751,39753,39752,39757,39761,39144,39181,39214,39253,39252,39647,39649,39654,39663,39659,39675,39661,39673,39688,39695,39699,39711,39715,40637,40638,32315,40578,40583,40584,40587,40594,37846,40605,40607,40667,40668,40669,40672,40671,40674,40681,40679,40677,40682,40687,40738,40748,40751,40761,40759,40765,40766,40772,40163,40164,40165,40166,40167,40168,40169,40170,40171,40172,40173,40174,40175,40176,40177,40178,40179,40180,40181,40182,40183,40184,40185,40186,40187,40188,40189,40190,40191,40192,40193,40194,40195,40196,40197,40198,40199,40200,40201,40202,40203,40204,40205,40206,40207,40208,40209,40210,40211,40212,40213,40214,40215,40216,40217,40218,40219,40220,40221,40222,40223,40224,40225,40226,40227,40228,40229,40230,40231,40232,40233,40234,40235,40236,40237,40238,40239,40240,40241,40242,40243,40244,40245,40246,40247,40248,40249,40250,40251,40252,40253,40254,40255,40256,40257,40258,57908,57909,57910,57911,57912,57913,57914,57915,57916,57917,57918,57919,57920,57921,57922,57923,57924,57925,57926,57927,57928,57929,57930,57931,57932,57933,57934,57935,57936,57937,57938,57939,57940,57941,57942,57943,57944,57945,57946,57947,57948,57949,57950,57951,57952,57953,57954,57955,57956,57957,57958,57959,57960,57961,57962,57963,57964,57965,57966,57967,57968,57969,57970,57971,57972,57973,57974,57975,57976,57977,57978,57979,57980,57981,57982,57983,57984,57985,57986,57987,57988,57989,57990,57991,57992,57993,57994,57995,57996,57997,57998,57999,58000,58001,40259,40260,40261,40262,40263,40264,40265,40266,40267,40268,40269,40270,40271,40272,40273,40274,40275,40276,40277,40278,40279,40280,40281,40282,40283,40284,40285,40286,40287,40288,40289,40290,40291,40292,40293,40294,40295,40296,40297,40298,40299,40300,40301,40302,40303,40304,40305,40306,40307,40308,40309,40310,40311,40312,40313,40314,40315,40316,40317,40318,40319,40320,40321,40322,40323,40324,40325,40326,40327,40328,40329,40330,40331,40332,40333,40334,40335,40336,40337,40338,40339,40340,40341,40342,40343,40344,40345,40346,40347,40348,40349,40350,40351,40352,40353,40354,58002,58003,58004,58005,58006,58007,58008,58009,58010,58011,58012,58013,58014,58015,58016,58017,58018,58019,58020,58021,58022,58023,58024,58025,58026,58027,58028,58029,58030,58031,58032,58033,58034,58035,58036,58037,58038,58039,58040,58041,58042,58043,58044,58045,58046,58047,58048,58049,58050,58051,58052,58053,58054,58055,58056,58057,58058,58059,58060,58061,58062,58063,58064,58065,58066,58067,58068,58069,58070,58071,58072,58073,58074,58075,58076,58077,58078,58079,58080,58081,58082,58083,58084,58085,58086,58087,58088,58089,58090,58091,58092,58093,58094,58095,40355,40356,40357,40358,40359,40360,40361,40362,40363,40364,40365,40366,40367,40368,40369,40370,40371,40372,40373,40374,40375,40376,40377,40378,40379,40380,40381,40382,40383,40384,40385,40386,40387,40388,40389,40390,40391,40392,40393,40394,40395,40396,40397,40398,40399,40400,40401,40402,40403,40404,40405,40406,40407,40408,40409,40410,40411,40412,40413,40414,40415,40416,40417,40418,40419,40420,40421,40422,40423,40424,40425,40426,40427,40428,40429,40430,40431,40432,40433,40434,40435,40436,40437,40438,40439,40440,40441,40442,40443,40444,40445,40446,40447,40448,40449,40450,58096,58097,58098,58099,58100,58101,58102,58103,58104,58105,58106,58107,58108,58109,58110,58111,58112,58113,58114,58115,58116,58117,58118,58119,58120,58121,58122,58123,58124,58125,58126,58127,58128,58129,58130,58131,58132,58133,58134,58135,58136,58137,58138,58139,58140,58141,58142,58143,58144,58145,58146,58147,58148,58149,58150,58151,58152,58153,58154,58155,58156,58157,58158,58159,58160,58161,58162,58163,58164,58165,58166,58167,58168,58169,58170,58171,58172,58173,58174,58175,58176,58177,58178,58179,58180,58181,58182,58183,58184,58185,58186,58187,58188,58189,40451,40452,40453,40454,40455,40456,40457,40458,40459,40460,40461,40462,40463,40464,40465,40466,40467,40468,40469,40470,40471,40472,40473,40474,40475,40476,40477,40478,40484,40487,40494,40496,40500,40507,40508,40512,40525,40528,40530,40531,40532,40534,40537,40541,40543,40544,40545,40546,40549,40558,40559,40562,40564,40565,40566,40567,40568,40569,40570,40571,40572,40573,40576,40577,40579,40580,40581,40582,40585,40586,40588,40589,40590,40591,40592,40593,40596,40597,40598,40599,40600,40601,40602,40603,40604,40606,40608,40609,40610,40611,40612,40613,40615,40616,40617,40618,58190,58191,58192,58193,58194,58195,58196,58197,58198,58199,58200,58201,58202,58203,58204,58205,58206,58207,58208,58209,58210,58211,58212,58213,58214,58215,58216,58217,58218,58219,58220,58221,58222,58223,58224,58225,58226,58227,58228,58229,58230,58231,58232,58233,58234,58235,58236,58237,58238,58239,58240,58241,58242,58243,58244,58245,58246,58247,58248,58249,58250,58251,58252,58253,58254,58255,58256,58257,58258,58259,58260,58261,58262,58263,58264,58265,58266,58267,58268,58269,58270,58271,58272,58273,58274,58275,58276,58277,58278,58279,58280,58281,58282,58283,40619,40620,40621,40622,40623,40624,40625,40626,40627,40629,40630,40631,40633,40634,40636,40639,40640,40641,40642,40643,40645,40646,40647,40648,40650,40651,40652,40656,40658,40659,40661,40662,40663,40665,40666,40670,40673,40675,40676,40678,40680,40683,40684,40685,40686,40688,40689,40690,40691,40692,40693,40694,40695,40696,40698,40701,40703,40704,40705,40706,40707,40708,40709,40710,40711,40712,40713,40714,40716,40719,40721,40722,40724,40725,40726,40728,40730,40731,40732,40733,40734,40735,40737,40739,40740,40741,40742,40743,40744,40745,40746,40747,40749,40750,40752,40753,58284,58285,58286,58287,58288,58289,58290,58291,58292,58293,58294,58295,58296,58297,58298,58299,58300,58301,58302,58303,58304,58305,58306,58307,58308,58309,58310,58311,58312,58313,58314,58315,58316,58317,58318,58319,58320,58321,58322,58323,58324,58325,58326,58327,58328,58329,58330,58331,58332,58333,58334,58335,58336,58337,58338,58339,58340,58341,58342,58343,58344,58345,58346,58347,58348,58349,58350,58351,58352,58353,58354,58355,58356,58357,58358,58359,58360,58361,58362,58363,58364,58365,58366,58367,58368,58369,58370,58371,58372,58373,58374,58375,58376,58377,40754,40755,40756,40757,40758,40760,40762,40764,40767,40768,40769,40770,40771,40773,40774,40775,40776,40777,40778,40779,40780,40781,40782,40783,40786,40787,40788,40789,40790,40791,40792,40793,40794,40795,40796,40797,40798,40799,40800,40801,40802,40803,40804,40805,40806,40807,40808,40809,40810,40811,40812,40813,40814,40815,40816,40817,40818,40819,40820,40821,40822,40823,40824,40825,40826,40827,40828,40829,40830,40833,40834,40845,40846,40847,40848,40849,40850,40851,40852,40853,40854,40855,40856,40860,40861,40862,40865,40866,40867,40868,40869,63788,63865,63893,63975,63985,58378,58379,58380,58381,58382,58383,58384,58385,58386,58387,58388,58389,58390,58391,58392,58393,58394,58395,58396,58397,58398,58399,58400,58401,58402,58403,58404,58405,58406,58407,58408,58409,58410,58411,58412,58413,58414,58415,58416,58417,58418,58419,58420,58421,58422,58423,58424,58425,58426,58427,58428,58429,58430,58431,58432,58433,58434,58435,58436,58437,58438,58439,58440,58441,58442,58443,58444,58445,58446,58447,58448,58449,58450,58451,58452,58453,58454,58455,58456,58457,58458,58459,58460,58461,58462,58463,58464,58465,58466,58467,58468,58469,58470,58471,64012,64013,64014,64015,64017,64019,64020,64024,64031,64032,64033,64035,64036,64039,64040,64041,11905,59414,59415,59416,11908,13427,13383,11912,11915,59422,13726,13850,13838,11916,11927,14702,14616,59430,14799,14815,14963,14800,59435,59436,15182,15470,15584,11943,59441,59442,11946,16470,16735,11950,17207,11955,11958,11959,59451,17329,17324,11963,17373,17622,18017,17996,59459,18211,18217,18300,18317,11978,18759,18810,18813,18818,18819,18821,18822,18847,18843,18871,18870,59476,59477,19619,19615,19616,19617,19575,19618,19731,19732,19733,19734,19735,19736,19737,19886,59492,58472,58473,58474,58475,58476,58477,58478,58479,58480,58481,58482,58483,58484,58485,58486,58487,58488,58489,58490,58491,58492,58493,58494,58495,58496,58497,58498,58499,58500,58501,58502,58503,58504,58505,58506,58507,58508,58509,58510,58511,58512,58513,58514,58515,58516,58517,58518,58519,58520,58521,58522,58523,58524,58525,58526,58527,58528,58529,58530,58531,58532,58533,58534,58535,58536,58537,58538,58539,58540,58541,58542,58543,58544,58545,58546,58547,58548,58549,58550,58551,58552,58553,58554,58555,58556,58557,58558,58559,58560,58561,58562,58563,58564,58565], + "gb18030-ranges":[[0,128],[36,165],[38,169],[45,178],[50,184],[81,216],[89,226],[95,235],[96,238],[100,244],[103,248],[104,251],[105,253],[109,258],[126,276],[133,284],[148,300],[172,325],[175,329],[179,334],[208,364],[306,463],[307,465],[308,467],[309,469],[310,471],[311,473],[312,475],[313,477],[341,506],[428,594],[443,610],[544,712],[545,716],[558,730],[741,930],[742,938],[749,962],[750,970],[805,1026],[819,1104],[820,1106],[7922,8209],[7924,8215],[7925,8218],[7927,8222],[7934,8231],[7943,8241],[7944,8244],[7945,8246],[7950,8252],[8062,8365],[8148,8452],[8149,8454],[8152,8458],[8164,8471],[8174,8482],[8236,8556],[8240,8570],[8262,8596],[8264,8602],[8374,8713],[8380,8720],[8381,8722],[8384,8726],[8388,8731],[8390,8737],[8392,8740],[8393,8742],[8394,8748],[8396,8751],[8401,8760],[8406,8766],[8416,8777],[8419,8781],[8424,8787],[8437,8802],[8439,8808],[8445,8816],[8482,8854],[8485,8858],[8496,8870],[8521,8896],[8603,8979],[8936,9322],[8946,9372],[9046,9548],[9050,9588],[9063,9616],[9066,9622],[9076,9634],[9092,9652],[9100,9662],[9108,9672],[9111,9676],[9113,9680],[9131,9702],[9162,9735],[9164,9738],[9218,9793],[9219,9795],[11329,11906],[11331,11909],[11334,11913],[11336,11917],[11346,11928],[11361,11944],[11363,11947],[11366,11951],[11370,11956],[11372,11960],[11375,11964],[11389,11979],[11682,12284],[11686,12292],[11687,12312],[11692,12319],[11694,12330],[11714,12351],[11716,12436],[11723,12447],[11725,12535],[11730,12543],[11736,12586],[11982,12842],[11989,12850],[12102,12964],[12336,13200],[12348,13215],[12350,13218],[12384,13253],[12393,13263],[12395,13267],[12397,13270],[12510,13384],[12553,13428],[12851,13727],[12962,13839],[12973,13851],[13738,14617],[13823,14703],[13919,14801],[13933,14816],[14080,14964],[14298,15183],[14585,15471],[14698,15585],[15583,16471],[15847,16736],[16318,17208],[16434,17325],[16438,17330],[16481,17374],[16729,17623],[17102,17997],[17122,18018],[17315,18212],[17320,18218],[17402,18301],[17418,18318],[17859,18760],[17909,18811],[17911,18814],[17915,18820],[17916,18823],[17936,18844],[17939,18848],[17961,18872],[18664,19576],[18703,19620],[18814,19738],[18962,19887],[19043,40870],[33469,59244],[33470,59336],[33471,59367],[33484,59413],[33485,59417],[33490,59423],[33497,59431],[33501,59437],[33505,59443],[33513,59452],[33520,59460],[33536,59478],[33550,59493],[37845,63789],[37921,63866],[37948,63894],[38029,63976],[38038,63986],[38064,64016],[38065,64018],[38066,64021],[38069,64025],[38075,64034],[38076,64037],[38078,64042],[39108,65074],[39109,65093],[39113,65107],[39114,65112],[39115,65127],[39116,65132],[39265,65375],[39394,65510],[189000,65536]], + "jis0208":[12288,12289,12290,65292,65294,12539,65306,65307,65311,65281,12443,12444,180,65344,168,65342,65507,65343,12541,12542,12445,12446,12291,20189,12293,12294,12295,12540,8213,8208,65295,65340,65374,8741,65372,8230,8229,8216,8217,8220,8221,65288,65289,12308,12309,65339,65341,65371,65373,12296,12297,12298,12299,12300,12301,12302,12303,12304,12305,65291,65293,177,215,247,65309,8800,65308,65310,8806,8807,8734,8756,9794,9792,176,8242,8243,8451,65509,65284,65504,65505,65285,65283,65286,65290,65312,167,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660,8251,12306,8594,8592,8593,8595,12307,null,null,null,null,null,null,null,null,null,null,null,8712,8715,8838,8839,8834,8835,8746,8745,null,null,null,null,null,null,null,null,8743,8744,65506,8658,8660,8704,8707,null,null,null,null,null,null,null,null,null,null,null,8736,8869,8978,8706,8711,8801,8786,8810,8811,8730,8765,8733,8757,8747,8748,null,null,null,null,null,null,null,8491,8240,9839,9837,9834,8224,8225,182,null,null,null,null,9711,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,null,null,null,null,null,null,null,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,null,null,null,null,null,null,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,null,null,null,null,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,null,null,null,null,null,null,null,null,null,null,null,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,null,null,null,null,null,null,null,null,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,null,null,null,null,null,null,null,null,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,null,null,null,null,null,null,null,null,null,null,null,null,null,9472,9474,9484,9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487,9491,9499,9495,9507,9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520,9509,9528,9538,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,null,13129,13076,13090,13133,13080,13095,13059,13110,13137,13143,13069,13094,13091,13099,13130,13115,13212,13213,13214,13198,13199,13252,13217,null,null,null,null,null,null,null,null,13179,12317,12319,8470,13261,8481,12964,12965,12966,12967,12968,12849,12850,12857,13182,13181,13180,8786,8801,8747,8750,8721,8730,8869,8736,8735,8895,8757,8745,8746,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20124,21782,23043,38463,21696,24859,25384,23030,36898,33909,33564,31312,24746,25569,28197,26093,33894,33446,39925,26771,22311,26017,25201,23451,22992,34427,39156,32098,32190,39822,25110,31903,34999,23433,24245,25353,26263,26696,38343,38797,26447,20197,20234,20301,20381,20553,22258,22839,22996,23041,23561,24799,24847,24944,26131,26885,28858,30031,30064,31227,32173,32239,32963,33806,34915,35586,36949,36986,21307,20117,20133,22495,32946,37057,30959,19968,22769,28322,36920,31282,33576,33419,39983,20801,21360,21693,21729,22240,23035,24341,39154,28139,32996,34093,38498,38512,38560,38907,21515,21491,23431,28879,32701,36802,38632,21359,40284,31418,19985,30867,33276,28198,22040,21764,27421,34074,39995,23013,21417,28006,29916,38287,22082,20113,36939,38642,33615,39180,21473,21942,23344,24433,26144,26355,26628,27704,27891,27945,29787,30408,31310,38964,33521,34907,35424,37613,28082,30123,30410,39365,24742,35585,36234,38322,27022,21421,20870,22290,22576,22852,23476,24310,24616,25513,25588,27839,28436,28814,28948,29017,29141,29503,32257,33398,33489,34199,36960,37467,40219,22633,26044,27738,29989,20985,22830,22885,24448,24540,25276,26106,27178,27431,27572,29579,32705,35158,40236,40206,40644,23713,27798,33659,20740,23627,25014,33222,26742,29281,20057,20474,21368,24681,28201,31311,38899,19979,21270,20206,20309,20285,20385,20339,21152,21487,22025,22799,23233,23478,23521,31185,26247,26524,26550,27468,27827,28779,29634,31117,31166,31292,31623,33457,33499,33540,33655,33775,33747,34662,35506,22057,36008,36838,36942,38686,34442,20420,23784,25105,29273,30011,33253,33469,34558,36032,38597,39187,39381,20171,20250,35299,22238,22602,22730,24315,24555,24618,24724,24674,25040,25106,25296,25913,39745,26214,26800,28023,28784,30028,30342,32117,33445,34809,38283,38542,35997,20977,21182,22806,21683,23475,23830,24936,27010,28079,30861,33995,34903,35442,37799,39608,28012,39336,34521,22435,26623,34510,37390,21123,22151,21508,24275,25313,25785,26684,26680,27579,29554,30906,31339,35226,35282,36203,36611,37101,38307,38548,38761,23398,23731,27005,38989,38990,25499,31520,27179,27263,26806,39949,28511,21106,21917,24688,25324,27963,28167,28369,33883,35088,36676,19988,39993,21494,26907,27194,38788,26666,20828,31427,33970,37340,37772,22107,40232,26658,33541,33841,31909,21000,33477,29926,20094,20355,20896,23506,21002,21208,21223,24059,21914,22570,23014,23436,23448,23515,24178,24185,24739,24863,24931,25022,25563,25954,26577,26707,26874,27454,27475,27735,28450,28567,28485,29872,29976,30435,30475,31487,31649,31777,32233,32566,32752,32925,33382,33694,35251,35532,36011,36996,37969,38291,38289,38306,38501,38867,39208,33304,20024,21547,23736,24012,29609,30284,30524,23721,32747,36107,38593,38929,38996,39000,20225,20238,21361,21916,22120,22522,22855,23305,23492,23696,24076,24190,24524,25582,26426,26071,26082,26399,26827,26820,27231,24112,27589,27671,27773,30079,31048,23395,31232,32000,24509,35215,35352,36020,36215,36556,36637,39138,39438,39740,20096,20605,20736,22931,23452,25135,25216,25836,27450,29344,30097,31047,32681,34811,35516,35696,25516,33738,38816,21513,21507,21931,26708,27224,35440,30759,26485,40653,21364,23458,33050,34384,36870,19992,20037,20167,20241,21450,21560,23470,24339,24613,25937,26429,27714,27762,27875,28792,29699,31350,31406,31496,32026,31998,32102,26087,29275,21435,23621,24040,25298,25312,25369,28192,34394,35377,36317,37624,28417,31142,39770,20136,20139,20140,20379,20384,20689,20807,31478,20849,20982,21332,21281,21375,21483,21932,22659,23777,24375,24394,24623,24656,24685,25375,25945,27211,27841,29378,29421,30703,33016,33029,33288,34126,37111,37857,38911,39255,39514,20208,20957,23597,26241,26989,23616,26354,26997,29577,26704,31873,20677,21220,22343,24062,37670,26020,27427,27453,29748,31105,31165,31563,32202,33465,33740,34943,35167,35641,36817,37329,21535,37504,20061,20534,21477,21306,29399,29590,30697,33510,36527,39366,39368,39378,20855,24858,34398,21936,31354,20598,23507,36935,38533,20018,27355,37351,23633,23624,25496,31391,27795,38772,36705,31402,29066,38536,31874,26647,32368,26705,37740,21234,21531,34219,35347,32676,36557,37089,21350,34952,31041,20418,20670,21009,20804,21843,22317,29674,22411,22865,24418,24452,24693,24950,24935,25001,25522,25658,25964,26223,26690,28179,30054,31293,31995,32076,32153,32331,32619,33550,33610,34509,35336,35427,35686,36605,38938,40335,33464,36814,39912,21127,25119,25731,28608,38553,26689,20625,27424,27770,28500,31348,32080,34880,35363,26376,20214,20537,20518,20581,20860,21048,21091,21927,22287,22533,23244,24314,25010,25080,25331,25458,26908,27177,29309,29356,29486,30740,30831,32121,30476,32937,35211,35609,36066,36562,36963,37749,38522,38997,39443,40568,20803,21407,21427,24187,24358,28187,28304,29572,29694,32067,33335,35328,35578,38480,20046,20491,21476,21628,22266,22993,23396,24049,24235,24359,25144,25925,26543,28246,29392,31946,34996,32929,32993,33776,34382,35463,36328,37431,38599,39015,40723,20116,20114,20237,21320,21577,21566,23087,24460,24481,24735,26791,27278,29786,30849,35486,35492,35703,37264,20062,39881,20132,20348,20399,20505,20502,20809,20844,21151,21177,21246,21402,21475,21521,21518,21897,22353,22434,22909,23380,23389,23439,24037,24039,24055,24184,24195,24218,24247,24344,24658,24908,25239,25304,25511,25915,26114,26179,26356,26477,26657,26775,27083,27743,27946,28009,28207,28317,30002,30343,30828,31295,31968,32005,32024,32094,32177,32789,32771,32943,32945,33108,33167,33322,33618,34892,34913,35611,36002,36092,37066,37237,37489,30783,37628,38308,38477,38917,39321,39640,40251,21083,21163,21495,21512,22741,25335,28640,35946,36703,40633,20811,21051,21578,22269,31296,37239,40288,40658,29508,28425,33136,29969,24573,24794,39592,29403,36796,27492,38915,20170,22256,22372,22718,23130,24680,25031,26127,26118,26681,26801,28151,30165,32058,33390,39746,20123,20304,21449,21766,23919,24038,24046,26619,27801,29811,30722,35408,37782,35039,22352,24231,25387,20661,20652,20877,26368,21705,22622,22971,23472,24425,25165,25505,26685,27507,28168,28797,37319,29312,30741,30758,31085,25998,32048,33756,35009,36617,38555,21092,22312,26448,32618,36001,20916,22338,38442,22586,27018,32948,21682,23822,22524,30869,40442,20316,21066,21643,25662,26152,26388,26613,31364,31574,32034,37679,26716,39853,31545,21273,20874,21047,23519,25334,25774,25830,26413,27578,34217,38609,30352,39894,25420,37638,39851,30399,26194,19977,20632,21442,23665,24808,25746,25955,26719,29158,29642,29987,31639,32386,34453,35715,36059,37240,39184,26028,26283,27531,20181,20180,20282,20351,21050,21496,21490,21987,22235,22763,22987,22985,23039,23376,23629,24066,24107,24535,24605,25351,25903,23388,26031,26045,26088,26525,27490,27515,27663,29509,31049,31169,31992,32025,32043,32930,33026,33267,35222,35422,35433,35430,35468,35566,36039,36060,38604,39164,27503,20107,20284,20365,20816,23383,23546,24904,25345,26178,27425,28363,27835,29246,29885,30164,30913,31034,32780,32819,33258,33940,36766,27728,40575,24335,35672,40235,31482,36600,23437,38635,19971,21489,22519,22833,23241,23460,24713,28287,28422,30142,36074,23455,34048,31712,20594,26612,33437,23649,34122,32286,33294,20889,23556,25448,36198,26012,29038,31038,32023,32773,35613,36554,36974,34503,37034,20511,21242,23610,26451,28796,29237,37196,37320,37675,33509,23490,24369,24825,20027,21462,23432,25163,26417,27530,29417,29664,31278,33131,36259,37202,39318,20754,21463,21610,23551,25480,27193,32172,38656,22234,21454,21608,23447,23601,24030,20462,24833,25342,27954,31168,31179,32066,32333,32722,33261,33311,33936,34886,35186,35728,36468,36655,36913,37195,37228,38598,37276,20160,20303,20805,21313,24467,25102,26580,27713,28171,29539,32294,37325,37507,21460,22809,23487,28113,31069,32302,31899,22654,29087,20986,34899,36848,20426,23803,26149,30636,31459,33308,39423,20934,24490,26092,26991,27529,28147,28310,28516,30462,32020,24033,36981,37255,38918,20966,21021,25152,26257,26329,28186,24246,32210,32626,26360,34223,34295,35576,21161,21465,22899,24207,24464,24661,37604,38500,20663,20767,21213,21280,21319,21484,21736,21830,21809,22039,22888,22974,23100,23477,23558,23567,23569,23578,24196,24202,24288,24432,25215,25220,25307,25484,25463,26119,26124,26157,26230,26494,26786,27167,27189,27836,28040,28169,28248,28988,28966,29031,30151,30465,30813,30977,31077,31216,31456,31505,31911,32057,32918,33750,33931,34121,34909,35059,35359,35388,35412,35443,35937,36062,37284,37478,37758,37912,38556,38808,19978,19976,19998,20055,20887,21104,22478,22580,22732,23330,24120,24773,25854,26465,26454,27972,29366,30067,31331,33976,35698,37304,37664,22065,22516,39166,25325,26893,27542,29165,32340,32887,33394,35302,39135,34645,36785,23611,20280,20449,20405,21767,23072,23517,23529,24515,24910,25391,26032,26187,26862,27035,28024,28145,30003,30137,30495,31070,31206,32051,33251,33455,34218,35242,35386,36523,36763,36914,37341,38663,20154,20161,20995,22645,22764,23563,29978,23613,33102,35338,36805,38499,38765,31525,35535,38920,37218,22259,21416,36887,21561,22402,24101,25512,27700,28810,30561,31883,32736,34928,36930,37204,37648,37656,38543,29790,39620,23815,23913,25968,26530,36264,38619,25454,26441,26905,33733,38935,38592,35070,28548,25722,23544,19990,28716,30045,26159,20932,21046,21218,22995,24449,24615,25104,25919,25972,26143,26228,26866,26646,27491,28165,29298,29983,30427,31934,32854,22768,35069,35199,35488,35475,35531,36893,37266,38738,38745,25993,31246,33030,38587,24109,24796,25114,26021,26132,26512,30707,31309,31821,32318,33034,36012,36196,36321,36447,30889,20999,25305,25509,25666,25240,35373,31363,31680,35500,38634,32118,33292,34633,20185,20808,21315,21344,23459,23554,23574,24029,25126,25159,25776,26643,26676,27849,27973,27927,26579,28508,29006,29053,26059,31359,31661,32218,32330,32680,33146,33307,33337,34214,35438,36046,36341,36984,36983,37549,37521,38275,39854,21069,21892,28472,28982,20840,31109,32341,33203,31950,22092,22609,23720,25514,26366,26365,26970,29401,30095,30094,30990,31062,31199,31895,32032,32068,34311,35380,38459,36961,40736,20711,21109,21452,21474,20489,21930,22766,22863,29245,23435,23652,21277,24803,24819,25436,25475,25407,25531,25805,26089,26361,24035,27085,27133,28437,29157,20105,30185,30456,31379,31967,32207,32156,32865,33609,33624,33900,33980,34299,35013,36208,36865,36973,37783,38684,39442,20687,22679,24974,33235,34101,36104,36896,20419,20596,21063,21363,24687,25417,26463,28204,36275,36895,20439,23646,36042,26063,32154,21330,34966,20854,25539,23384,23403,23562,25613,26449,36956,20182,22810,22826,27760,35409,21822,22549,22949,24816,25171,26561,33333,26965,38464,39364,39464,20307,22534,23550,32784,23729,24111,24453,24608,24907,25140,26367,27888,28382,32974,33151,33492,34955,36024,36864,36910,38538,40667,39899,20195,21488,22823,31532,37261,38988,40441,28381,28711,21331,21828,23429,25176,25246,25299,27810,28655,29730,35351,37944,28609,35582,33592,20967,34552,21482,21481,20294,36948,36784,22890,33073,24061,31466,36799,26842,35895,29432,40008,27197,35504,20025,21336,22022,22374,25285,25506,26086,27470,28129,28251,28845,30701,31471,31658,32187,32829,32966,34507,35477,37723,22243,22727,24382,26029,26262,27264,27573,30007,35527,20516,30693,22320,24347,24677,26234,27744,30196,31258,32622,33268,34584,36933,39347,31689,30044,31481,31569,33988,36880,31209,31378,33590,23265,30528,20013,20210,23449,24544,25277,26172,26609,27880,34411,34935,35387,37198,37619,39376,27159,28710,29482,33511,33879,36015,19969,20806,20939,21899,23541,24086,24115,24193,24340,24373,24427,24500,25074,25361,26274,26397,28526,29266,30010,30522,32884,33081,33144,34678,35519,35548,36229,36339,37530,38263,38914,40165,21189,25431,30452,26389,27784,29645,36035,37806,38515,27941,22684,26894,27084,36861,37786,30171,36890,22618,26626,25524,27131,20291,28460,26584,36795,34086,32180,37716,26943,28528,22378,22775,23340,32044,29226,21514,37347,40372,20141,20302,20572,20597,21059,35998,21576,22564,23450,24093,24213,24237,24311,24351,24716,25269,25402,25552,26799,27712,30855,31118,31243,32224,33351,35330,35558,36420,36883,37048,37165,37336,40718,27877,25688,25826,25973,28404,30340,31515,36969,37841,28346,21746,24505,25764,36685,36845,37444,20856,22635,22825,23637,24215,28155,32399,29980,36028,36578,39003,28857,20253,27583,28593,30000,38651,20814,21520,22581,22615,22956,23648,24466,26007,26460,28193,30331,33759,36077,36884,37117,37709,30757,30778,21162,24230,22303,22900,24594,20498,20826,20908,20941,20992,21776,22612,22616,22871,23445,23798,23947,24764,25237,25645,26481,26691,26812,26847,30423,28120,28271,28059,28783,29128,24403,30168,31095,31561,31572,31570,31958,32113,21040,33891,34153,34276,35342,35588,35910,36367,36867,36879,37913,38518,38957,39472,38360,20685,21205,21516,22530,23566,24999,25758,27934,30643,31461,33012,33796,36947,37509,23776,40199,21311,24471,24499,28060,29305,30563,31167,31716,27602,29420,35501,26627,27233,20984,31361,26932,23626,40182,33515,23493,37193,28702,22136,23663,24775,25958,27788,35930,36929,38931,21585,26311,37389,22856,37027,20869,20045,20970,34201,35598,28760,25466,37707,26978,39348,32260,30071,21335,26976,36575,38627,27741,20108,23612,24336,36841,21250,36049,32905,34425,24319,26085,20083,20837,22914,23615,38894,20219,22922,24525,35469,28641,31152,31074,23527,33905,29483,29105,24180,24565,25467,25754,29123,31896,20035,24316,20043,22492,22178,24745,28611,32013,33021,33075,33215,36786,35223,34468,24052,25226,25773,35207,26487,27874,27966,29750,30772,23110,32629,33453,39340,20467,24259,25309,25490,25943,26479,30403,29260,32972,32954,36649,37197,20493,22521,23186,26757,26995,29028,29437,36023,22770,36064,38506,36889,34687,31204,30695,33833,20271,21093,21338,25293,26575,27850,30333,31636,31893,33334,34180,36843,26333,28448,29190,32283,33707,39361,40614,20989,31665,30834,31672,32903,31560,27368,24161,32908,30033,30048,20843,37474,28300,30330,37271,39658,20240,32624,25244,31567,38309,40169,22138,22617,34532,38588,20276,21028,21322,21453,21467,24070,25644,26001,26495,27710,27726,29256,29359,29677,30036,32321,33324,34281,36009,31684,37318,29033,38930,39151,25405,26217,30058,30436,30928,34115,34542,21290,21329,21542,22915,24199,24444,24754,25161,25209,25259,26000,27604,27852,30130,30382,30865,31192,32203,32631,32933,34987,35513,36027,36991,38750,39131,27147,31800,20633,23614,24494,26503,27608,29749,30473,32654,40763,26570,31255,21305,30091,39661,24422,33181,33777,32920,24380,24517,30050,31558,36924,26727,23019,23195,32016,30334,35628,20469,24426,27161,27703,28418,29922,31080,34920,35413,35961,24287,25551,30149,31186,33495,37672,37618,33948,34541,39981,21697,24428,25996,27996,28693,36007,36051,38971,25935,29942,19981,20184,22496,22827,23142,23500,20904,24067,24220,24598,25206,25975,26023,26222,28014,29238,31526,33104,33178,33433,35676,36000,36070,36212,38428,38468,20398,25771,27494,33310,33889,34154,37096,23553,26963,39080,33914,34135,20239,21103,24489,24133,26381,31119,33145,35079,35206,28149,24343,25173,27832,20175,29289,39826,20998,21563,22132,22707,24996,25198,28954,22894,31881,31966,32027,38640,25991,32862,19993,20341,20853,22592,24163,24179,24330,26564,20006,34109,38281,38491,31859,38913,20731,22721,30294,30887,21029,30629,34065,31622,20559,22793,29255,31687,32232,36794,36820,36941,20415,21193,23081,24321,38829,20445,33303,37610,22275,25429,27497,29995,35036,36628,31298,21215,22675,24917,25098,26286,27597,31807,33769,20515,20472,21253,21574,22577,22857,23453,23792,23791,23849,24214,25265,25447,25918,26041,26379,27861,27873,28921,30770,32299,32990,33459,33804,34028,34562,35090,35370,35914,37030,37586,39165,40179,40300,20047,20129,20621,21078,22346,22952,24125,24536,24537,25151,26292,26395,26576,26834,20882,32033,32938,33192,35584,35980,36031,37502,38450,21536,38956,21271,20693,21340,22696,25778,26420,29287,30566,31302,37350,21187,27809,27526,22528,24140,22868,26412,32763,20961,30406,25705,30952,39764,40635,22475,22969,26151,26522,27598,21737,27097,24149,33180,26517,39850,26622,40018,26717,20134,20451,21448,25273,26411,27819,36804,20397,32365,40639,19975,24930,28288,28459,34067,21619,26410,39749,24051,31637,23724,23494,34588,28234,34001,31252,33032,22937,31885,27665,30496,21209,22818,28961,29279,30683,38695,40289,26891,23167,23064,20901,21517,21629,26126,30431,36855,37528,40180,23018,29277,28357,20813,26825,32191,32236,38754,40634,25720,27169,33538,22916,23391,27611,29467,30450,32178,32791,33945,20786,26408,40665,30446,26466,21247,39173,23588,25147,31870,36016,21839,24758,32011,38272,21249,20063,20918,22812,29242,32822,37326,24357,30690,21380,24441,32004,34220,35379,36493,38742,26611,34222,37971,24841,24840,27833,30290,35565,36664,21807,20305,20778,21191,21451,23461,24189,24736,24962,25558,26377,26586,28263,28044,29494,29495,30001,31056,35029,35480,36938,37009,37109,38596,34701,22805,20104,20313,19982,35465,36671,38928,20653,24188,22934,23481,24248,25562,25594,25793,26332,26954,27096,27915,28342,29076,29992,31407,32650,32768,33865,33993,35201,35617,36362,36965,38525,39178,24958,25233,27442,27779,28020,32716,32764,28096,32645,34746,35064,26469,33713,38972,38647,27931,32097,33853,37226,20081,21365,23888,27396,28651,34253,34349,35239,21033,21519,23653,26446,26792,29702,29827,30178,35023,35041,37324,38626,38520,24459,29575,31435,33870,25504,30053,21129,27969,28316,29705,30041,30827,31890,38534,31452,40845,20406,24942,26053,34396,20102,20142,20698,20001,20940,23534,26009,26753,28092,29471,30274,30637,31260,31975,33391,35538,36988,37327,38517,38936,21147,32209,20523,21400,26519,28107,29136,29747,33256,36650,38563,40023,40607,29792,22593,28057,32047,39006,20196,20278,20363,20919,21169,23994,24604,29618,31036,33491,37428,38583,38646,38666,40599,40802,26278,27508,21015,21155,28872,35010,24265,24651,24976,28451,29001,31806,32244,32879,34030,36899,37676,21570,39791,27347,28809,36034,36335,38706,21172,23105,24266,24324,26391,27004,27028,28010,28431,29282,29436,31725,32769,32894,34635,37070,20845,40595,31108,32907,37682,35542,20525,21644,35441,27498,36036,33031,24785,26528,40434,20121,20120,39952,35435,34241,34152,26880,28286,30871,33109,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,24332,19984,19989,20010,20017,20022,20028,20031,20034,20054,20056,20098,20101,35947,20106,33298,24333,20110,20126,20127,20128,20130,20144,20147,20150,20174,20173,20164,20166,20162,20183,20190,20205,20191,20215,20233,20314,20272,20315,20317,20311,20295,20342,20360,20367,20376,20347,20329,20336,20369,20335,20358,20374,20760,20436,20447,20430,20440,20443,20433,20442,20432,20452,20453,20506,20520,20500,20522,20517,20485,20252,20470,20513,20521,20524,20478,20463,20497,20486,20547,20551,26371,20565,20560,20552,20570,20566,20588,20600,20608,20634,20613,20660,20658,20681,20682,20659,20674,20694,20702,20709,20717,20707,20718,20729,20725,20745,20737,20738,20758,20757,20756,20762,20769,20794,20791,20796,20795,20799,20800,20818,20812,20820,20834,31480,20841,20842,20846,20864,20866,22232,20876,20873,20879,20881,20883,20885,20886,20900,20902,20898,20905,20906,20907,20915,20913,20914,20912,20917,20925,20933,20937,20955,20960,34389,20969,20973,20976,20981,20990,20996,21003,21012,21006,21031,21034,21038,21043,21049,21071,21060,21067,21068,21086,21076,21098,21108,21097,21107,21119,21117,21133,21140,21138,21105,21128,21137,36776,36775,21164,21165,21180,21173,21185,21197,21207,21214,21219,21222,39149,21216,21235,21237,21240,21241,21254,21256,30008,21261,21264,21263,21269,21274,21283,21295,21297,21299,21304,21312,21318,21317,19991,21321,21325,20950,21342,21353,21358,22808,21371,21367,21378,21398,21408,21414,21413,21422,21424,21430,21443,31762,38617,21471,26364,29166,21486,21480,21485,21498,21505,21565,21568,21548,21549,21564,21550,21558,21545,21533,21582,21647,21621,21646,21599,21617,21623,21616,21650,21627,21632,21622,21636,21648,21638,21703,21666,21688,21669,21676,21700,21704,21672,21675,21698,21668,21694,21692,21720,21733,21734,21775,21780,21757,21742,21741,21754,21730,21817,21824,21859,21836,21806,21852,21829,21846,21847,21816,21811,21853,21913,21888,21679,21898,21919,21883,21886,21912,21918,21934,21884,21891,21929,21895,21928,21978,21957,21983,21956,21980,21988,21972,22036,22007,22038,22014,22013,22043,22009,22094,22096,29151,22068,22070,22066,22072,22123,22116,22063,22124,22122,22150,22144,22154,22176,22164,22159,22181,22190,22198,22196,22210,22204,22209,22211,22208,22216,22222,22225,22227,22231,22254,22265,22272,22271,22276,22281,22280,22283,22285,22291,22296,22294,21959,22300,22310,22327,22328,22350,22331,22336,22351,22377,22464,22408,22369,22399,22409,22419,22432,22451,22436,22442,22448,22467,22470,22484,22482,22483,22538,22486,22499,22539,22553,22557,22642,22561,22626,22603,22640,27584,22610,22589,22649,22661,22713,22687,22699,22714,22750,22715,22712,22702,22725,22739,22737,22743,22745,22744,22757,22748,22756,22751,22767,22778,22777,22779,22780,22781,22786,22794,22800,22811,26790,22821,22828,22829,22834,22840,22846,31442,22869,22864,22862,22874,22872,22882,22880,22887,22892,22889,22904,22913,22941,20318,20395,22947,22962,22982,23016,23004,22925,23001,23002,23077,23071,23057,23068,23049,23066,23104,23148,23113,23093,23094,23138,23146,23194,23228,23230,23243,23234,23229,23267,23255,23270,23273,23254,23290,23291,23308,23307,23318,23346,23248,23338,23350,23358,23363,23365,23360,23377,23381,23386,23387,23397,23401,23408,23411,23413,23416,25992,23418,23424,23427,23462,23480,23491,23495,23497,23508,23504,23524,23526,23522,23518,23525,23531,23536,23542,23539,23557,23559,23560,23565,23571,23584,23586,23592,23608,23609,23617,23622,23630,23635,23632,23631,23409,23660,23662,20066,23670,23673,23692,23697,23700,22939,23723,23739,23734,23740,23735,23749,23742,23751,23769,23785,23805,23802,23789,23948,23786,23819,23829,23831,23900,23839,23835,23825,23828,23842,23834,23833,23832,23884,23890,23886,23883,23916,23923,23926,23943,23940,23938,23970,23965,23980,23982,23997,23952,23991,23996,24009,24013,24019,24018,24022,24027,24043,24050,24053,24075,24090,24089,24081,24091,24118,24119,24132,24131,24128,24142,24151,24148,24159,24162,24164,24135,24181,24182,24186,40636,24191,24224,24257,24258,24264,24272,24271,24278,24291,24285,24282,24283,24290,24289,24296,24297,24300,24305,24307,24304,24308,24312,24318,24323,24329,24413,24412,24331,24337,24342,24361,24365,24376,24385,24392,24396,24398,24367,24401,24406,24407,24409,24417,24429,24435,24439,24451,24450,24447,24458,24456,24465,24455,24478,24473,24472,24480,24488,24493,24508,24534,24571,24548,24568,24561,24541,24755,24575,24609,24672,24601,24592,24617,24590,24625,24603,24597,24619,24614,24591,24634,24666,24641,24682,24695,24671,24650,24646,24653,24675,24643,24676,24642,24684,24683,24665,24705,24717,24807,24707,24730,24708,24731,24726,24727,24722,24743,24715,24801,24760,24800,24787,24756,24560,24765,24774,24757,24792,24909,24853,24838,24822,24823,24832,24820,24826,24835,24865,24827,24817,24845,24846,24903,24894,24872,24871,24906,24895,24892,24876,24884,24893,24898,24900,24947,24951,24920,24921,24922,24939,24948,24943,24933,24945,24927,24925,24915,24949,24985,24982,24967,25004,24980,24986,24970,24977,25003,25006,25036,25034,25033,25079,25032,25027,25030,25018,25035,32633,25037,25062,25059,25078,25082,25076,25087,25085,25084,25086,25088,25096,25097,25101,25100,25108,25115,25118,25121,25130,25134,25136,25138,25139,25153,25166,25182,25187,25179,25184,25192,25212,25218,25225,25214,25234,25235,25238,25300,25219,25236,25303,25297,25275,25295,25343,25286,25812,25288,25308,25292,25290,25282,25287,25243,25289,25356,25326,25329,25383,25346,25352,25327,25333,25424,25406,25421,25628,25423,25494,25486,25472,25515,25462,25507,25487,25481,25503,25525,25451,25449,25534,25577,25536,25542,25571,25545,25554,25590,25540,25622,25652,25606,25619,25638,25654,25885,25623,25640,25615,25703,25711,25718,25678,25898,25749,25747,25765,25769,25736,25788,25818,25810,25797,25799,25787,25816,25794,25841,25831,33289,25824,25825,25260,25827,25839,25900,25846,25844,25842,25850,25856,25853,25880,25884,25861,25892,25891,25899,25908,25909,25911,25910,25912,30027,25928,25942,25941,25933,25944,25950,25949,25970,25976,25986,25987,35722,26011,26015,26027,26039,26051,26054,26049,26052,26060,26066,26075,26073,26080,26081,26097,26482,26122,26115,26107,26483,26165,26166,26164,26140,26191,26180,26185,26177,26206,26205,26212,26215,26216,26207,26210,26224,26243,26248,26254,26249,26244,26264,26269,26305,26297,26313,26302,26300,26308,26296,26326,26330,26336,26175,26342,26345,26352,26357,26359,26383,26390,26398,26406,26407,38712,26414,26431,26422,26433,26424,26423,26438,26462,26464,26457,26467,26468,26505,26480,26537,26492,26474,26508,26507,26534,26529,26501,26551,26607,26548,26604,26547,26601,26552,26596,26590,26589,26594,26606,26553,26574,26566,26599,27292,26654,26694,26665,26688,26701,26674,26702,26803,26667,26713,26723,26743,26751,26783,26767,26797,26772,26781,26779,26755,27310,26809,26740,26805,26784,26810,26895,26765,26750,26881,26826,26888,26840,26914,26918,26849,26892,26829,26836,26855,26837,26934,26898,26884,26839,26851,26917,26873,26848,26863,26920,26922,26906,26915,26913,26822,27001,26999,26972,27000,26987,26964,27006,26990,26937,26996,26941,26969,26928,26977,26974,26973,27009,26986,27058,27054,27088,27071,27073,27091,27070,27086,23528,27082,27101,27067,27075,27047,27182,27025,27040,27036,27029,27060,27102,27112,27138,27163,27135,27402,27129,27122,27111,27141,27057,27166,27117,27156,27115,27146,27154,27329,27171,27155,27204,27148,27250,27190,27256,27207,27234,27225,27238,27208,27192,27170,27280,27277,27296,27268,27298,27299,27287,34327,27323,27331,27330,27320,27315,27308,27358,27345,27359,27306,27354,27370,27387,27397,34326,27386,27410,27414,39729,27423,27448,27447,30428,27449,39150,27463,27459,27465,27472,27481,27476,27483,27487,27489,27512,27513,27519,27520,27524,27523,27533,27544,27541,27550,27556,27562,27563,27567,27570,27569,27571,27575,27580,27590,27595,27603,27615,27628,27627,27635,27631,40638,27656,27667,27668,27675,27684,27683,27742,27733,27746,27754,27778,27789,27802,27777,27803,27774,27752,27763,27794,27792,27844,27889,27859,27837,27863,27845,27869,27822,27825,27838,27834,27867,27887,27865,27882,27935,34893,27958,27947,27965,27960,27929,27957,27955,27922,27916,28003,28051,28004,27994,28025,27993,28046,28053,28644,28037,28153,28181,28170,28085,28103,28134,28088,28102,28140,28126,28108,28136,28114,28101,28154,28121,28132,28117,28138,28142,28205,28270,28206,28185,28274,28255,28222,28195,28267,28203,28278,28237,28191,28227,28218,28238,28196,28415,28189,28216,28290,28330,28312,28361,28343,28371,28349,28335,28356,28338,28372,28373,28303,28325,28354,28319,28481,28433,28748,28396,28408,28414,28479,28402,28465,28399,28466,28364,28478,28435,28407,28550,28538,28536,28545,28544,28527,28507,28659,28525,28546,28540,28504,28558,28561,28610,28518,28595,28579,28577,28580,28601,28614,28586,28639,28629,28652,28628,28632,28657,28654,28635,28681,28683,28666,28689,28673,28687,28670,28699,28698,28532,28701,28696,28703,28720,28734,28722,28753,28771,28825,28818,28847,28913,28844,28856,28851,28846,28895,28875,28893,28889,28937,28925,28956,28953,29029,29013,29064,29030,29026,29004,29014,29036,29071,29179,29060,29077,29096,29100,29143,29113,29118,29138,29129,29140,29134,29152,29164,29159,29173,29180,29177,29183,29197,29200,29211,29224,29229,29228,29232,29234,29243,29244,29247,29248,29254,29259,29272,29300,29310,29314,29313,29319,29330,29334,29346,29351,29369,29362,29379,29382,29380,29390,29394,29410,29408,29409,29433,29431,20495,29463,29450,29468,29462,29469,29492,29487,29481,29477,29502,29518,29519,40664,29527,29546,29544,29552,29560,29557,29563,29562,29640,29619,29646,29627,29632,29669,29678,29662,29858,29701,29807,29733,29688,29746,29754,29781,29759,29791,29785,29761,29788,29801,29808,29795,29802,29814,29822,29835,29854,29863,29898,29903,29908,29681,29920,29923,29927,29929,29934,29938,29936,29937,29944,29943,29956,29955,29957,29964,29966,29965,29973,29971,29982,29990,29996,30012,30020,30029,30026,30025,30043,30022,30042,30057,30052,30055,30059,30061,30072,30070,30086,30087,30068,30090,30089,30082,30100,30106,30109,30117,30115,30146,30131,30147,30133,30141,30136,30140,30129,30157,30154,30162,30169,30179,30174,30206,30207,30204,30209,30192,30202,30194,30195,30219,30221,30217,30239,30247,30240,30241,30242,30244,30260,30256,30267,30279,30280,30278,30300,30296,30305,30306,30312,30313,30314,30311,30316,30320,30322,30326,30328,30332,30336,30339,30344,30347,30350,30358,30355,30361,30362,30384,30388,30392,30393,30394,30402,30413,30422,30418,30430,30433,30437,30439,30442,34351,30459,30472,30471,30468,30505,30500,30494,30501,30502,30491,30519,30520,30535,30554,30568,30571,30555,30565,30591,30590,30585,30606,30603,30609,30624,30622,30640,30646,30649,30655,30652,30653,30651,30663,30669,30679,30682,30684,30691,30702,30716,30732,30738,31014,30752,31018,30789,30862,30836,30854,30844,30874,30860,30883,30901,30890,30895,30929,30918,30923,30932,30910,30908,30917,30922,30956,30951,30938,30973,30964,30983,30994,30993,31001,31020,31019,31040,31072,31063,31071,31066,31061,31059,31098,31103,31114,31133,31143,40779,31146,31150,31155,31161,31162,31177,31189,31207,31212,31201,31203,31240,31245,31256,31257,31264,31263,31104,31281,31291,31294,31287,31299,31319,31305,31329,31330,31337,40861,31344,31353,31357,31368,31383,31381,31384,31382,31401,31432,31408,31414,31429,31428,31423,36995,31431,31434,31437,31439,31445,31443,31449,31450,31453,31457,31458,31462,31469,31472,31490,31503,31498,31494,31539,31512,31513,31518,31541,31528,31542,31568,31610,31492,31565,31499,31564,31557,31605,31589,31604,31591,31600,31601,31596,31598,31645,31640,31647,31629,31644,31642,31627,31634,31631,31581,31641,31691,31681,31692,31695,31668,31686,31709,31721,31761,31764,31718,31717,31840,31744,31751,31763,31731,31735,31767,31757,31734,31779,31783,31786,31775,31799,31787,31805,31820,31811,31828,31823,31808,31824,31832,31839,31844,31830,31845,31852,31861,31875,31888,31908,31917,31906,31915,31905,31912,31923,31922,31921,31918,31929,31933,31936,31941,31938,31960,31954,31964,31970,39739,31983,31986,31988,31990,31994,32006,32002,32028,32021,32010,32069,32075,32046,32050,32063,32053,32070,32115,32086,32078,32114,32104,32110,32079,32099,32147,32137,32091,32143,32125,32155,32186,32174,32163,32181,32199,32189,32171,32317,32162,32175,32220,32184,32159,32176,32216,32221,32228,32222,32251,32242,32225,32261,32266,32291,32289,32274,32305,32287,32265,32267,32290,32326,32358,32315,32309,32313,32323,32311,32306,32314,32359,32349,32342,32350,32345,32346,32377,32362,32361,32380,32379,32387,32213,32381,36782,32383,32392,32393,32396,32402,32400,32403,32404,32406,32398,32411,32412,32568,32570,32581,32588,32589,32590,32592,32593,32597,32596,32600,32607,32608,32616,32617,32615,32632,32642,32646,32643,32648,32647,32652,32660,32670,32669,32666,32675,32687,32690,32697,32686,32694,32696,35697,32709,32710,32714,32725,32724,32737,32742,32745,32755,32761,39132,32774,32772,32779,32786,32792,32793,32796,32801,32808,32831,32827,32842,32838,32850,32856,32858,32863,32866,32872,32883,32882,32880,32886,32889,32893,32895,32900,32902,32901,32923,32915,32922,32941,20880,32940,32987,32997,32985,32989,32964,32986,32982,33033,33007,33009,33051,33065,33059,33071,33099,38539,33094,33086,33107,33105,33020,33137,33134,33125,33126,33140,33155,33160,33162,33152,33154,33184,33173,33188,33187,33119,33171,33193,33200,33205,33214,33208,33213,33216,33218,33210,33225,33229,33233,33241,33240,33224,33242,33247,33248,33255,33274,33275,33278,33281,33282,33285,33287,33290,33293,33296,33302,33321,33323,33336,33331,33344,33369,33368,33373,33370,33375,33380,33378,33384,33386,33387,33326,33393,33399,33400,33406,33421,33426,33451,33439,33467,33452,33505,33507,33503,33490,33524,33523,33530,33683,33539,33531,33529,33502,33542,33500,33545,33497,33589,33588,33558,33586,33585,33600,33593,33616,33605,33583,33579,33559,33560,33669,33690,33706,33695,33698,33686,33571,33678,33671,33674,33660,33717,33651,33653,33696,33673,33704,33780,33811,33771,33742,33789,33795,33752,33803,33729,33783,33799,33760,33778,33805,33826,33824,33725,33848,34054,33787,33901,33834,33852,34138,33924,33911,33899,33965,33902,33922,33897,33862,33836,33903,33913,33845,33994,33890,33977,33983,33951,34009,33997,33979,34010,34000,33985,33990,34006,33953,34081,34047,34036,34071,34072,34092,34079,34069,34068,34044,34112,34147,34136,34120,34113,34306,34123,34133,34176,34212,34184,34193,34186,34216,34157,34196,34203,34282,34183,34204,34167,34174,34192,34249,34234,34255,34233,34256,34261,34269,34277,34268,34297,34314,34323,34315,34302,34298,34310,34338,34330,34352,34367,34381,20053,34388,34399,34407,34417,34451,34467,34473,34474,34443,34444,34486,34479,34500,34502,34480,34505,34851,34475,34516,34526,34537,34540,34527,34523,34543,34578,34566,34568,34560,34563,34555,34577,34569,34573,34553,34570,34612,34623,34615,34619,34597,34601,34586,34656,34655,34680,34636,34638,34676,34647,34664,34670,34649,34643,34659,34666,34821,34722,34719,34690,34735,34763,34749,34752,34768,38614,34731,34756,34739,34759,34758,34747,34799,34802,34784,34831,34829,34814,34806,34807,34830,34770,34833,34838,34837,34850,34849,34865,34870,34873,34855,34875,34884,34882,34898,34905,34910,34914,34923,34945,34942,34974,34933,34941,34997,34930,34946,34967,34962,34990,34969,34978,34957,34980,34992,35007,34993,35011,35012,35028,35032,35033,35037,35065,35074,35068,35060,35048,35058,35076,35084,35082,35091,35139,35102,35109,35114,35115,35137,35140,35131,35126,35128,35148,35101,35168,35166,35174,35172,35181,35178,35183,35188,35191,35198,35203,35208,35210,35219,35224,35233,35241,35238,35244,35247,35250,35258,35261,35263,35264,35290,35292,35293,35303,35316,35320,35331,35350,35344,35340,35355,35357,35365,35382,35393,35419,35410,35398,35400,35452,35437,35436,35426,35461,35458,35460,35496,35489,35473,35493,35494,35482,35491,35524,35533,35522,35546,35563,35571,35559,35556,35569,35604,35552,35554,35575,35550,35547,35596,35591,35610,35553,35606,35600,35607,35616,35635,38827,35622,35627,35646,35624,35649,35660,35663,35662,35657,35670,35675,35674,35691,35679,35692,35695,35700,35709,35712,35724,35726,35730,35731,35734,35737,35738,35898,35905,35903,35912,35916,35918,35920,35925,35938,35948,35960,35962,35970,35977,35973,35978,35981,35982,35988,35964,35992,25117,36013,36010,36029,36018,36019,36014,36022,36040,36033,36068,36067,36058,36093,36090,36091,36100,36101,36106,36103,36111,36109,36112,40782,36115,36045,36116,36118,36199,36205,36209,36211,36225,36249,36290,36286,36282,36303,36314,36310,36300,36315,36299,36330,36331,36319,36323,36348,36360,36361,36351,36381,36382,36368,36383,36418,36405,36400,36404,36426,36423,36425,36428,36432,36424,36441,36452,36448,36394,36451,36437,36470,36466,36476,36481,36487,36485,36484,36491,36490,36499,36497,36500,36505,36522,36513,36524,36528,36550,36529,36542,36549,36552,36555,36571,36579,36604,36603,36587,36606,36618,36613,36629,36626,36633,36627,36636,36639,36635,36620,36646,36659,36667,36665,36677,36674,36670,36684,36681,36678,36686,36695,36700,36706,36707,36708,36764,36767,36771,36781,36783,36791,36826,36837,36834,36842,36847,36999,36852,36869,36857,36858,36881,36885,36897,36877,36894,36886,36875,36903,36918,36917,36921,36856,36943,36944,36945,36946,36878,36937,36926,36950,36952,36958,36968,36975,36982,38568,36978,36994,36989,36993,36992,37002,37001,37007,37032,37039,37041,37045,37090,37092,25160,37083,37122,37138,37145,37170,37168,37194,37206,37208,37219,37221,37225,37235,37234,37259,37257,37250,37282,37291,37295,37290,37301,37300,37306,37312,37313,37321,37323,37328,37334,37343,37345,37339,37372,37365,37366,37406,37375,37396,37420,37397,37393,37470,37463,37445,37449,37476,37448,37525,37439,37451,37456,37532,37526,37523,37531,37466,37583,37561,37559,37609,37647,37626,37700,37678,37657,37666,37658,37667,37690,37685,37691,37724,37728,37756,37742,37718,37808,37804,37805,37780,37817,37846,37847,37864,37861,37848,37827,37853,37840,37832,37860,37914,37908,37907,37891,37895,37904,37942,37931,37941,37921,37946,37953,37970,37956,37979,37984,37986,37982,37994,37417,38000,38005,38007,38013,37978,38012,38014,38017,38015,38274,38279,38282,38292,38294,38296,38297,38304,38312,38311,38317,38332,38331,38329,38334,38346,28662,38339,38349,38348,38357,38356,38358,38364,38369,38373,38370,38433,38440,38446,38447,38466,38476,38479,38475,38519,38492,38494,38493,38495,38502,38514,38508,38541,38552,38549,38551,38570,38567,38577,38578,38576,38580,38582,38584,38585,38606,38603,38601,38605,35149,38620,38669,38613,38649,38660,38662,38664,38675,38670,38673,38671,38678,38681,38692,38698,38704,38713,38717,38718,38724,38726,38728,38722,38729,38748,38752,38756,38758,38760,21202,38763,38769,38777,38789,38780,38785,38778,38790,38795,38799,38800,38812,38824,38822,38819,38835,38836,38851,38854,38856,38859,38876,38893,40783,38898,31455,38902,38901,38927,38924,38968,38948,38945,38967,38973,38982,38991,38987,39019,39023,39024,39025,39028,39027,39082,39087,39089,39094,39108,39107,39110,39145,39147,39171,39177,39186,39188,39192,39201,39197,39198,39204,39200,39212,39214,39229,39230,39234,39241,39237,39248,39243,39249,39250,39244,39253,39319,39320,39333,39341,39342,39356,39391,39387,39389,39384,39377,39405,39406,39409,39410,39419,39416,39425,39439,39429,39394,39449,39467,39479,39493,39490,39488,39491,39486,39509,39501,39515,39511,39519,39522,39525,39524,39529,39531,39530,39597,39600,39612,39616,39631,39633,39635,39636,39646,39647,39650,39651,39654,39663,39659,39662,39668,39665,39671,39675,39686,39704,39706,39711,39714,39715,39717,39719,39720,39721,39722,39726,39727,39730,39748,39747,39759,39757,39758,39761,39768,39796,39827,39811,39825,39830,39831,39839,39840,39848,39860,39872,39882,39865,39878,39887,39889,39890,39907,39906,39908,39892,39905,39994,39922,39921,39920,39957,39956,39945,39955,39948,39942,39944,39954,39946,39940,39982,39963,39973,39972,39969,39984,40007,39986,40006,39998,40026,40032,40039,40054,40056,40167,40172,40176,40201,40200,40171,40195,40198,40234,40230,40367,40227,40223,40260,40213,40210,40257,40255,40254,40262,40264,40285,40286,40292,40273,40272,40281,40306,40329,40327,40363,40303,40314,40346,40356,40361,40370,40388,40385,40379,40376,40378,40390,40399,40386,40409,40403,40440,40422,40429,40431,40445,40474,40475,40478,40565,40569,40573,40577,40584,40587,40588,40594,40597,40593,40605,40613,40617,40632,40618,40621,38753,40652,40654,40655,40656,40660,40668,40670,40669,40672,40677,40680,40687,40692,40694,40695,40697,40699,40700,40701,40711,40712,30391,40725,40737,40748,40766,40778,40786,40788,40803,40799,40800,40801,40806,40807,40812,40810,40823,40818,40822,40853,40860,40864,22575,27079,36953,29796,20956,29081,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32394,35100,37704,37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193,20220,20224,20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479,20510,20550,20592,20546,20628,20724,20696,20810,20836,20893,20926,20972,21013,21148,21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660,21642,21673,21759,21894,22361,22373,22444,22472,22471,64015,64016,22686,22706,22795,22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532,23582,23718,23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353,24372,24423,24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887,24880,24984,25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121,26158,26142,26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362,26382,63785,26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032,27106,27184,27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759,27866,27908,28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199,28220,28351,28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020,28998,28999,64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654,29667,29650,29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063,30338,30364,30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024,64024,64025,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072,32092,32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782,33864,33972,34131,34137,34155,64031,34224,64032,64033,34823,35061,35346,35383,35449,35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214,64035,36559,64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357,37358,37348,37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433,37479,37543,37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669,37665,37627,64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880,37937,37957,37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735,38737,38741,38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797,39794,39823,39857,39867,39936,40304,40299,64045,40473,40657,null,null,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,65506,65508,65287,65282,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,65506,65508,65287,65282,12849,8470,8481,8757,32394,35100,37704,37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193,20220,20224,20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479,20510,20550,20592,20546,20628,20724,20696,20810,20836,20893,20926,20972,21013,21148,21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660,21642,21673,21759,21894,22361,22373,22444,22472,22471,64015,64016,22686,22706,22795,22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532,23582,23718,23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353,24372,24423,24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887,24880,24984,25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121,26158,26142,26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362,26382,63785,26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032,27106,27184,27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759,27866,27908,28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199,28220,28351,28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020,28998,28999,64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654,29667,29650,29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063,30338,30364,30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024,64024,64025,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072,32092,32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782,33864,33972,34131,34137,34155,64031,34224,64032,64033,34823,35061,35346,35383,35449,35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214,64035,36559,64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357,37358,37348,37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433,37479,37543,37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669,37665,37627,64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880,37937,37957,37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735,38737,38741,38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797,39794,39823,39857,39867,39936,40304,40299,64045,40473,40657,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null], + "jis0212":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,728,711,184,729,733,175,731,730,65374,900,901,null,null,null,null,null,null,null,null,161,166,191,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,186,170,169,174,8482,164,8470,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,902,904,905,906,938,null,908,null,910,939,null,911,null,null,null,null,940,941,942,943,970,912,972,962,973,971,944,974,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1038,1039,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1118,1119,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,198,272,null,294,null,306,null,321,319,null,330,216,338,null,358,222,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,230,273,240,295,305,307,312,322,320,329,331,248,339,223,359,254,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,193,192,196,194,258,461,256,260,197,195,262,264,268,199,266,270,201,200,203,202,282,278,274,280,null,284,286,290,288,292,205,204,207,206,463,304,298,302,296,308,310,313,317,315,323,327,325,209,211,210,214,212,465,336,332,213,340,344,342,346,348,352,350,356,354,218,217,220,219,364,467,368,362,370,366,360,471,475,473,469,372,221,376,374,377,381,379,null,null,null,null,null,null,null,225,224,228,226,259,462,257,261,229,227,263,265,269,231,267,271,233,232,235,234,283,279,275,281,501,285,287,null,289,293,237,236,239,238,464,null,299,303,297,309,311,314,318,316,324,328,326,241,243,242,246,244,466,337,333,245,341,345,343,347,349,353,351,357,355,250,249,252,251,365,468,369,363,371,367,361,472,476,474,470,373,253,255,375,378,382,380,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,19970,19972,19973,19980,19986,19999,20003,20004,20008,20011,20014,20015,20016,20021,20032,20033,20036,20039,20049,20058,20060,20067,20072,20073,20084,20085,20089,20095,20109,20118,20119,20125,20143,20153,20163,20176,20186,20187,20192,20193,20194,20200,20207,20209,20211,20213,20221,20222,20223,20224,20226,20227,20232,20235,20236,20242,20245,20246,20247,20249,20270,20273,20320,20275,20277,20279,20281,20283,20286,20288,20290,20296,20297,20299,20300,20306,20308,20310,20312,20319,20323,20330,20332,20334,20337,20343,20344,20345,20346,20349,20350,20353,20354,20356,20357,20361,20362,20364,20366,20368,20370,20371,20372,20375,20377,20378,20382,20383,20402,20407,20409,20411,20412,20413,20414,20416,20417,20421,20422,20424,20425,20427,20428,20429,20431,20434,20444,20448,20450,20464,20466,20476,20477,20479,20480,20481,20484,20487,20490,20492,20494,20496,20499,20503,20504,20507,20508,20509,20510,20514,20519,20526,20528,20530,20531,20533,20544,20545,20546,20549,20550,20554,20556,20558,20561,20562,20563,20567,20569,20575,20576,20578,20579,20582,20583,20586,20589,20592,20593,20539,20609,20611,20612,20614,20618,20622,20623,20624,20626,20627,20628,20630,20635,20636,20638,20639,20640,20641,20642,20650,20655,20656,20665,20666,20669,20672,20675,20676,20679,20684,20686,20688,20691,20692,20696,20700,20701,20703,20706,20708,20710,20712,20713,20719,20721,20726,20730,20734,20739,20742,20743,20744,20747,20748,20749,20750,20722,20752,20759,20761,20763,20764,20765,20766,20771,20775,20776,20780,20781,20783,20785,20787,20788,20789,20792,20793,20802,20810,20815,20819,20821,20823,20824,20831,20836,20838,20862,20867,20868,20875,20878,20888,20893,20897,20899,20909,20920,20922,20924,20926,20927,20930,20936,20943,20945,20946,20947,20949,20952,20958,20962,20965,20974,20978,20979,20980,20983,20993,20994,20997,21010,21011,21013,21014,21016,21026,21032,21041,21042,21045,21052,21061,21065,21077,21079,21080,21082,21084,21087,21088,21089,21094,21102,21111,21112,21113,21120,21122,21125,21130,21132,21139,21141,21142,21143,21144,21146,21148,21156,21157,21158,21159,21167,21168,21174,21175,21176,21178,21179,21181,21184,21188,21190,21192,21196,21199,21201,21204,21206,21211,21212,21217,21221,21224,21225,21226,21228,21232,21233,21236,21238,21239,21248,21251,21258,21259,21260,21265,21267,21272,21275,21276,21278,21279,21285,21287,21288,21289,21291,21292,21293,21296,21298,21301,21308,21309,21310,21314,21324,21323,21337,21339,21345,21347,21349,21356,21357,21362,21369,21374,21379,21383,21384,21390,21395,21396,21401,21405,21409,21412,21418,21419,21423,21426,21428,21429,21431,21432,21434,21437,21440,21445,21455,21458,21459,21461,21466,21469,21470,21472,21478,21479,21493,21506,21523,21530,21537,21543,21544,21546,21551,21553,21556,21557,21571,21572,21575,21581,21583,21598,21602,21604,21606,21607,21609,21611,21613,21614,21620,21631,21633,21635,21637,21640,21641,21645,21649,21653,21654,21660,21663,21665,21670,21671,21673,21674,21677,21678,21681,21687,21689,21690,21691,21695,21702,21706,21709,21710,21728,21738,21740,21743,21750,21756,21758,21759,21760,21761,21765,21768,21769,21772,21773,21774,21781,21802,21803,21810,21813,21814,21819,21820,21821,21825,21831,21833,21834,21837,21840,21841,21848,21850,21851,21854,21856,21857,21860,21862,21887,21889,21890,21894,21896,21902,21903,21905,21906,21907,21908,21911,21923,21924,21933,21938,21951,21953,21955,21958,21961,21963,21964,21966,21969,21970,21971,21975,21976,21979,21982,21986,21993,22006,22015,22021,22024,22026,22029,22030,22031,22032,22033,22034,22041,22060,22064,22067,22069,22071,22073,22075,22076,22077,22079,22080,22081,22083,22084,22086,22089,22091,22093,22095,22100,22110,22112,22113,22114,22115,22118,22121,22125,22127,22129,22130,22133,22148,22149,22152,22155,22156,22165,22169,22170,22173,22174,22175,22182,22183,22184,22185,22187,22188,22189,22193,22195,22199,22206,22213,22217,22218,22219,22223,22224,22220,22221,22233,22236,22237,22239,22241,22244,22245,22246,22247,22248,22257,22251,22253,22262,22263,22273,22274,22279,22282,22284,22289,22293,22298,22299,22301,22304,22306,22307,22308,22309,22313,22314,22316,22318,22319,22323,22324,22333,22334,22335,22341,22342,22348,22349,22354,22370,22373,22375,22376,22379,22381,22382,22383,22384,22385,22387,22388,22389,22391,22393,22394,22395,22396,22398,22401,22403,22412,22420,22423,22425,22426,22428,22429,22430,22431,22433,22421,22439,22440,22441,22444,22456,22461,22471,22472,22476,22479,22485,22493,22494,22500,22502,22503,22505,22509,22512,22517,22518,22520,22525,22526,22527,22531,22532,22536,22537,22497,22540,22541,22555,22558,22559,22560,22566,22567,22573,22578,22585,22591,22601,22604,22605,22607,22608,22613,22623,22625,22628,22631,22632,22648,22652,22655,22656,22657,22663,22664,22665,22666,22668,22669,22671,22672,22676,22678,22685,22688,22689,22690,22694,22697,22705,22706,22724,22716,22722,22728,22733,22734,22736,22738,22740,22742,22746,22749,22753,22754,22761,22771,22789,22790,22795,22796,22802,22803,22804,34369,22813,22817,22819,22820,22824,22831,22832,22835,22837,22838,22847,22851,22854,22866,22867,22873,22875,22877,22878,22879,22881,22883,22891,22893,22895,22898,22901,22902,22905,22907,22908,22923,22924,22926,22930,22933,22935,22943,22948,22951,22957,22958,22959,22960,22963,22967,22970,22972,22977,22979,22980,22984,22986,22989,22994,23005,23006,23007,23011,23012,23015,23022,23023,23025,23026,23028,23031,23040,23044,23052,23053,23054,23058,23059,23070,23075,23076,23079,23080,23082,23085,23088,23108,23109,23111,23112,23116,23120,23125,23134,23139,23141,23143,23149,23159,23162,23163,23166,23179,23184,23187,23190,23193,23196,23198,23199,23200,23202,23207,23212,23217,23218,23219,23221,23224,23226,23227,23231,23236,23238,23240,23247,23258,23260,23264,23269,23274,23278,23285,23286,23293,23296,23297,23304,23319,23348,23321,23323,23325,23329,23333,23341,23352,23361,23371,23372,23378,23382,23390,23400,23406,23407,23420,23421,23422,23423,23425,23428,23430,23434,23438,23440,23441,23443,23444,23446,23464,23465,23468,23469,23471,23473,23474,23479,23482,23484,23488,23489,23501,23503,23510,23511,23512,23513,23514,23520,23535,23537,23540,23549,23564,23575,23582,23583,23587,23590,23593,23595,23596,23598,23600,23602,23605,23606,23641,23642,23644,23650,23651,23655,23656,23657,23661,23664,23668,23669,23674,23675,23676,23677,23687,23688,23690,23695,23698,23709,23711,23712,23714,23715,23718,23722,23730,23732,23733,23738,23753,23755,23762,23773,23767,23790,23793,23794,23796,23809,23814,23821,23826,23851,23843,23844,23846,23847,23857,23860,23865,23869,23871,23874,23875,23878,23880,23893,23889,23897,23882,23903,23904,23905,23906,23908,23914,23917,23920,23929,23930,23934,23935,23937,23939,23944,23946,23954,23955,23956,23957,23961,23963,23967,23968,23975,23979,23984,23988,23992,23993,24003,24007,24011,24016,24014,24024,24025,24032,24036,24041,24056,24057,24064,24071,24077,24082,24084,24085,24088,24095,24096,24110,24104,24114,24117,24126,24139,24144,24137,24145,24150,24152,24155,24156,24158,24168,24170,24171,24172,24173,24174,24176,24192,24203,24206,24226,24228,24229,24232,24234,24236,24241,24243,24253,24254,24255,24262,24268,24267,24270,24273,24274,24276,24277,24284,24286,24293,24299,24322,24326,24327,24328,24334,24345,24348,24349,24353,24354,24355,24356,24360,24363,24364,24366,24368,24372,24374,24379,24381,24383,24384,24388,24389,24391,24397,24400,24404,24408,24411,24416,24419,24420,24423,24431,24434,24436,24437,24440,24442,24445,24446,24457,24461,24463,24470,24476,24477,24482,24487,24491,24484,24492,24495,24496,24497,24504,24516,24519,24520,24521,24523,24528,24529,24530,24531,24532,24542,24545,24546,24552,24553,24554,24556,24557,24558,24559,24562,24563,24566,24570,24572,24583,24586,24589,24595,24596,24599,24600,24602,24607,24612,24621,24627,24629,24640,24647,24648,24649,24652,24657,24660,24662,24663,24669,24673,24679,24689,24702,24703,24706,24710,24712,24714,24718,24721,24723,24725,24728,24733,24734,24738,24740,24741,24744,24752,24753,24759,24763,24766,24770,24772,24776,24777,24778,24779,24782,24783,24788,24789,24793,24795,24797,24798,24802,24805,24818,24821,24824,24828,24829,24834,24839,24842,24844,24848,24849,24850,24851,24852,24854,24855,24857,24860,24862,24866,24874,24875,24880,24881,24885,24886,24887,24889,24897,24901,24902,24905,24926,24928,24940,24946,24952,24955,24956,24959,24960,24961,24963,24964,24971,24973,24978,24979,24983,24984,24988,24989,24991,24992,24997,25000,25002,25005,25016,25017,25020,25024,25025,25026,25038,25039,25045,25052,25053,25054,25055,25057,25058,25063,25065,25061,25068,25069,25071,25089,25091,25092,25095,25107,25109,25116,25120,25122,25123,25127,25129,25131,25145,25149,25154,25155,25156,25158,25164,25168,25169,25170,25172,25174,25178,25180,25188,25197,25199,25203,25210,25213,25229,25230,25231,25232,25254,25256,25267,25270,25271,25274,25278,25279,25284,25294,25301,25302,25306,25322,25330,25332,25340,25341,25347,25348,25354,25355,25357,25360,25363,25366,25368,25385,25386,25389,25397,25398,25401,25404,25409,25410,25411,25412,25414,25418,25419,25422,25426,25427,25428,25432,25435,25445,25446,25452,25453,25457,25460,25461,25464,25468,25469,25471,25474,25476,25479,25482,25488,25492,25493,25497,25498,25502,25508,25510,25517,25518,25519,25533,25537,25541,25544,25550,25553,25555,25556,25557,25564,25568,25573,25578,25580,25586,25587,25589,25592,25593,25609,25610,25616,25618,25620,25624,25630,25632,25634,25636,25637,25641,25642,25647,25648,25653,25661,25663,25675,25679,25681,25682,25683,25684,25690,25691,25692,25693,25695,25696,25697,25699,25709,25715,25716,25723,25725,25733,25735,25743,25744,25745,25752,25753,25755,25757,25759,25761,25763,25766,25768,25772,25779,25789,25790,25791,25796,25801,25802,25803,25804,25806,25808,25809,25813,25815,25828,25829,25833,25834,25837,25840,25845,25847,25851,25855,25857,25860,25864,25865,25866,25871,25875,25876,25878,25881,25883,25886,25887,25890,25894,25897,25902,25905,25914,25916,25917,25923,25927,25929,25936,25938,25940,25951,25952,25959,25963,25978,25981,25985,25989,25994,26002,26005,26008,26013,26016,26019,26022,26030,26034,26035,26036,26047,26050,26056,26057,26062,26064,26068,26070,26072,26079,26096,26098,26100,26101,26105,26110,26111,26112,26116,26120,26121,26125,26129,26130,26133,26134,26141,26142,26145,26146,26147,26148,26150,26153,26154,26155,26156,26158,26160,26161,26163,26169,26167,26176,26181,26182,26186,26188,26193,26190,26199,26200,26201,26203,26204,26208,26209,26363,26218,26219,26220,26238,26227,26229,26239,26231,26232,26233,26235,26240,26236,26251,26252,26253,26256,26258,26265,26266,26267,26268,26271,26272,26276,26285,26289,26290,26293,26299,26303,26304,26306,26307,26312,26316,26318,26319,26324,26331,26335,26344,26347,26348,26350,26362,26373,26375,26382,26387,26393,26396,26400,26402,26419,26430,26437,26439,26440,26444,26452,26453,26461,26470,26476,26478,26484,26486,26491,26497,26500,26510,26511,26513,26515,26518,26520,26521,26523,26544,26545,26546,26549,26555,26556,26557,26617,26560,26562,26563,26565,26568,26569,26578,26583,26585,26588,26593,26598,26608,26610,26614,26615,26706,26644,26649,26653,26655,26664,26663,26668,26669,26671,26672,26673,26675,26683,26687,26692,26693,26698,26700,26709,26711,26712,26715,26731,26734,26735,26736,26737,26738,26741,26745,26746,26747,26748,26754,26756,26758,26760,26774,26776,26778,26780,26785,26787,26789,26793,26794,26798,26802,26811,26821,26824,26828,26831,26832,26833,26835,26838,26841,26844,26845,26853,26856,26858,26859,26860,26861,26864,26865,26869,26870,26875,26876,26877,26886,26889,26890,26896,26897,26899,26902,26903,26929,26931,26933,26936,26939,26946,26949,26953,26958,26967,26971,26979,26980,26981,26982,26984,26985,26988,26992,26993,26994,27002,27003,27007,27008,27021,27026,27030,27032,27041,27045,27046,27048,27051,27053,27055,27063,27064,27066,27068,27077,27080,27089,27094,27095,27106,27109,27118,27119,27121,27123,27125,27134,27136,27137,27139,27151,27153,27157,27162,27165,27168,27172,27176,27184,27186,27188,27191,27195,27198,27199,27205,27206,27209,27210,27214,27216,27217,27218,27221,27222,27227,27236,27239,27242,27249,27251,27262,27265,27267,27270,27271,27273,27275,27281,27291,27293,27294,27295,27301,27307,27311,27312,27313,27316,27325,27326,27327,27334,27337,27336,27340,27344,27348,27349,27350,27356,27357,27364,27367,27372,27376,27377,27378,27388,27389,27394,27395,27398,27399,27401,27407,27408,27409,27415,27419,27422,27428,27432,27435,27436,27439,27445,27446,27451,27455,27462,27466,27469,27474,27478,27480,27485,27488,27495,27499,27502,27504,27509,27517,27518,27522,27525,27543,27547,27551,27552,27554,27555,27560,27561,27564,27565,27566,27568,27576,27577,27581,27582,27587,27588,27593,27596,27606,27610,27617,27619,27622,27623,27630,27633,27639,27641,27647,27650,27652,27653,27657,27661,27662,27664,27666,27673,27679,27686,27687,27688,27692,27694,27699,27701,27702,27706,27707,27711,27722,27723,27725,27727,27730,27732,27737,27739,27740,27755,27757,27759,27764,27766,27768,27769,27771,27781,27782,27783,27785,27796,27797,27799,27800,27804,27807,27824,27826,27828,27842,27846,27853,27855,27856,27857,27858,27860,27862,27866,27868,27872,27879,27881,27883,27884,27886,27890,27892,27908,27911,27914,27918,27919,27921,27923,27930,27942,27943,27944,27751,27950,27951,27953,27961,27964,27967,27991,27998,27999,28001,28005,28007,28015,28016,28028,28034,28039,28049,28050,28052,28054,28055,28056,28074,28076,28084,28087,28089,28093,28095,28100,28104,28106,28110,28111,28118,28123,28125,28127,28128,28130,28133,28137,28143,28144,28148,28150,28156,28160,28164,28190,28194,28199,28210,28214,28217,28219,28220,28228,28229,28232,28233,28235,28239,28241,28242,28243,28244,28247,28252,28253,28254,28258,28259,28264,28275,28283,28285,28301,28307,28313,28320,28327,28333,28334,28337,28339,28347,28351,28352,28353,28355,28359,28360,28362,28365,28366,28367,28395,28397,28398,28409,28411,28413,28420,28424,28426,28428,28429,28438,28440,28442,28443,28454,28457,28458,28463,28464,28467,28470,28475,28476,28461,28495,28497,28498,28499,28503,28505,28506,28509,28510,28513,28514,28520,28524,28541,28542,28547,28551,28552,28555,28556,28557,28560,28562,28563,28564,28566,28570,28575,28576,28581,28582,28583,28584,28590,28591,28592,28597,28598,28604,28613,28615,28616,28618,28634,28638,28648,28649,28656,28661,28665,28668,28669,28672,28677,28678,28679,28685,28695,28704,28707,28719,28724,28727,28729,28732,28739,28740,28744,28745,28746,28747,28756,28757,28765,28766,28750,28772,28773,28780,28782,28789,28790,28798,28801,28805,28806,28820,28821,28822,28823,28824,28827,28836,28843,28848,28849,28852,28855,28874,28881,28883,28884,28885,28886,28888,28892,28900,28922,28931,28932,28933,28934,28935,28939,28940,28943,28958,28960,28971,28973,28975,28976,28977,28984,28993,28997,28998,28999,29002,29003,29008,29010,29015,29018,29020,29022,29024,29032,29049,29056,29061,29063,29068,29074,29082,29083,29088,29090,29103,29104,29106,29107,29114,29119,29120,29121,29124,29131,29132,29139,29142,29145,29146,29148,29176,29182,29184,29191,29192,29193,29203,29207,29210,29213,29215,29220,29227,29231,29236,29240,29241,29249,29250,29251,29253,29262,29263,29264,29267,29269,29270,29274,29276,29278,29280,29283,29288,29291,29294,29295,29297,29303,29304,29307,29308,29311,29316,29321,29325,29326,29331,29339,29352,29357,29358,29361,29364,29374,29377,29383,29385,29388,29397,29398,29400,29407,29413,29427,29428,29434,29435,29438,29442,29444,29445,29447,29451,29453,29458,29459,29464,29465,29470,29474,29476,29479,29480,29484,29489,29490,29493,29498,29499,29501,29507,29517,29520,29522,29526,29528,29533,29534,29535,29536,29542,29543,29545,29547,29548,29550,29551,29553,29559,29561,29564,29568,29569,29571,29573,29574,29582,29584,29587,29589,29591,29592,29596,29598,29599,29600,29602,29605,29606,29610,29611,29613,29621,29623,29625,29628,29629,29631,29637,29638,29641,29643,29644,29647,29650,29651,29654,29657,29661,29665,29667,29670,29671,29673,29684,29685,29687,29689,29690,29691,29693,29695,29696,29697,29700,29703,29706,29713,29722,29723,29732,29734,29736,29737,29738,29739,29740,29741,29742,29743,29744,29745,29753,29760,29763,29764,29766,29767,29771,29773,29777,29778,29783,29789,29794,29798,29799,29800,29803,29805,29806,29809,29810,29824,29825,29829,29830,29831,29833,29839,29840,29841,29842,29848,29849,29850,29852,29855,29856,29857,29859,29862,29864,29865,29866,29867,29870,29871,29873,29874,29877,29881,29883,29887,29896,29897,29900,29904,29907,29912,29914,29915,29918,29919,29924,29928,29930,29931,29935,29940,29946,29947,29948,29951,29958,29970,29974,29975,29984,29985,29988,29991,29993,29994,29999,30006,30009,30013,30014,30015,30016,30019,30023,30024,30030,30032,30034,30039,30046,30047,30049,30063,30065,30073,30074,30075,30076,30077,30078,30081,30085,30096,30098,30099,30101,30105,30108,30114,30116,30132,30138,30143,30144,30145,30148,30150,30156,30158,30159,30167,30172,30175,30176,30177,30180,30183,30188,30190,30191,30193,30201,30208,30210,30211,30212,30215,30216,30218,30220,30223,30226,30227,30229,30230,30233,30235,30236,30237,30238,30243,30245,30246,30249,30253,30258,30259,30261,30264,30265,30266,30268,30282,30272,30273,30275,30276,30277,30281,30283,30293,30297,30303,30308,30309,30317,30318,30319,30321,30324,30337,30341,30348,30349,30357,30363,30364,30365,30367,30368,30370,30371,30372,30373,30374,30375,30376,30378,30381,30397,30401,30405,30409,30411,30412,30414,30420,30425,30432,30438,30440,30444,30448,30449,30454,30457,30460,30464,30470,30474,30478,30482,30484,30485,30487,30489,30490,30492,30498,30504,30509,30510,30511,30516,30517,30518,30521,30525,30526,30530,30533,30534,30538,30541,30542,30543,30546,30550,30551,30556,30558,30559,30560,30562,30564,30567,30570,30572,30576,30578,30579,30580,30586,30589,30592,30596,30604,30605,30612,30613,30614,30618,30623,30626,30631,30634,30638,30639,30641,30645,30654,30659,30665,30673,30674,30677,30681,30686,30687,30688,30692,30694,30698,30700,30704,30705,30708,30712,30715,30725,30726,30729,30733,30734,30737,30749,30753,30754,30755,30765,30766,30768,30773,30775,30787,30788,30791,30792,30796,30798,30802,30812,30814,30816,30817,30819,30820,30824,30826,30830,30842,30846,30858,30863,30868,30872,30881,30877,30878,30879,30884,30888,30892,30893,30896,30897,30898,30899,30907,30909,30911,30919,30920,30921,30924,30926,30930,30931,30933,30934,30948,30939,30943,30944,30945,30950,30954,30962,30963,30976,30966,30967,30970,30971,30975,30982,30988,30992,31002,31004,31006,31007,31008,31013,31015,31017,31021,31025,31028,31029,31035,31037,31039,31044,31045,31046,31050,31051,31055,31057,31060,31064,31067,31068,31079,31081,31083,31090,31097,31099,31100,31102,31115,31116,31121,31123,31124,31125,31126,31128,31131,31132,31137,31144,31145,31147,31151,31153,31156,31160,31163,31170,31172,31175,31176,31178,31183,31188,31190,31194,31197,31198,31200,31202,31205,31210,31211,31213,31217,31224,31228,31234,31235,31239,31241,31242,31244,31249,31253,31259,31262,31265,31271,31275,31277,31279,31280,31284,31285,31288,31289,31290,31300,31301,31303,31304,31308,31317,31318,31321,31324,31325,31327,31328,31333,31335,31338,31341,31349,31352,31358,31360,31362,31365,31366,31370,31371,31376,31377,31380,31390,31392,31395,31404,31411,31413,31417,31419,31420,31430,31433,31436,31438,31441,31451,31464,31465,31467,31468,31473,31476,31483,31485,31486,31495,31508,31519,31523,31527,31529,31530,31531,31533,31534,31535,31536,31537,31540,31549,31551,31552,31553,31559,31566,31573,31584,31588,31590,31593,31594,31597,31599,31602,31603,31607,31620,31625,31630,31632,31633,31638,31643,31646,31648,31653,31660,31663,31664,31666,31669,31670,31674,31675,31676,31677,31682,31685,31688,31690,31700,31702,31703,31705,31706,31707,31720,31722,31730,31732,31733,31736,31737,31738,31740,31742,31745,31746,31747,31748,31750,31753,31755,31756,31758,31759,31769,31771,31776,31781,31782,31784,31788,31793,31795,31796,31798,31801,31802,31814,31818,31829,31825,31826,31827,31833,31834,31835,31836,31837,31838,31841,31843,31847,31849,31853,31854,31856,31858,31865,31868,31869,31878,31879,31887,31892,31902,31904,31910,31920,31926,31927,31930,31931,31932,31935,31940,31943,31944,31945,31949,31951,31955,31956,31957,31959,31961,31962,31965,31974,31977,31979,31989,32003,32007,32008,32009,32015,32017,32018,32019,32022,32029,32030,32035,32038,32042,32045,32049,32060,32061,32062,32064,32065,32071,32072,32077,32081,32083,32087,32089,32090,32092,32093,32101,32103,32106,32112,32120,32122,32123,32127,32129,32130,32131,32133,32134,32136,32139,32140,32141,32145,32150,32151,32157,32158,32166,32167,32170,32179,32182,32183,32185,32194,32195,32196,32197,32198,32204,32205,32206,32215,32217,32256,32226,32229,32230,32234,32235,32237,32241,32245,32246,32249,32250,32264,32272,32273,32277,32279,32284,32285,32288,32295,32296,32300,32301,32303,32307,32310,32319,32324,32325,32327,32334,32336,32338,32344,32351,32353,32354,32357,32363,32366,32367,32371,32376,32382,32385,32390,32391,32394,32397,32401,32405,32408,32410,32413,32414,32572,32571,32573,32574,32575,32579,32580,32583,32591,32594,32595,32603,32604,32605,32609,32611,32612,32613,32614,32621,32625,32637,32638,32639,32640,32651,32653,32655,32656,32657,32662,32663,32668,32673,32674,32678,32682,32685,32692,32700,32703,32704,32707,32712,32718,32719,32731,32735,32739,32741,32744,32748,32750,32751,32754,32762,32765,32766,32767,32775,32776,32778,32781,32782,32783,32785,32787,32788,32790,32797,32798,32799,32800,32804,32806,32812,32814,32816,32820,32821,32823,32825,32826,32828,32830,32832,32836,32864,32868,32870,32877,32881,32885,32897,32904,32910,32924,32926,32934,32935,32939,32952,32953,32968,32973,32975,32978,32980,32981,32983,32984,32992,33005,33006,33008,33010,33011,33014,33017,33018,33022,33027,33035,33046,33047,33048,33052,33054,33056,33060,33063,33068,33072,33077,33082,33084,33093,33095,33098,33100,33106,33111,33120,33121,33127,33128,33129,33133,33135,33143,33153,33168,33156,33157,33158,33163,33166,33174,33176,33179,33182,33186,33198,33202,33204,33211,33227,33219,33221,33226,33230,33231,33237,33239,33243,33245,33246,33249,33252,33259,33260,33264,33265,33266,33269,33270,33272,33273,33277,33279,33280,33283,33295,33299,33300,33305,33306,33309,33313,33314,33320,33330,33332,33338,33347,33348,33349,33350,33355,33358,33359,33361,33366,33372,33376,33379,33383,33389,33396,33403,33405,33407,33408,33409,33411,33412,33415,33417,33418,33422,33425,33428,33430,33432,33434,33435,33440,33441,33443,33444,33447,33448,33449,33450,33454,33456,33458,33460,33463,33466,33468,33470,33471,33478,33488,33493,33498,33504,33506,33508,33512,33514,33517,33519,33526,33527,33533,33534,33536,33537,33543,33544,33546,33547,33620,33563,33565,33566,33567,33569,33570,33580,33581,33582,33584,33587,33591,33594,33596,33597,33602,33603,33604,33607,33613,33614,33617,33621,33622,33623,33648,33656,33661,33663,33664,33666,33668,33670,33677,33682,33684,33685,33688,33689,33691,33692,33693,33702,33703,33705,33708,33726,33727,33728,33735,33737,33743,33744,33745,33748,33757,33619,33768,33770,33782,33784,33785,33788,33793,33798,33802,33807,33809,33813,33817,33709,33839,33849,33861,33863,33864,33866,33869,33871,33873,33874,33878,33880,33881,33882,33884,33888,33892,33893,33895,33898,33904,33907,33908,33910,33912,33916,33917,33921,33925,33938,33939,33941,33950,33958,33960,33961,33962,33967,33969,33972,33978,33981,33982,33984,33986,33991,33992,33996,33999,34003,34012,34023,34026,34031,34032,34033,34034,34039,34098,34042,34043,34045,34050,34051,34055,34060,34062,34064,34076,34078,34082,34083,34084,34085,34087,34090,34091,34095,34099,34100,34102,34111,34118,34127,34128,34129,34130,34131,34134,34137,34140,34141,34142,34143,34144,34145,34146,34148,34155,34159,34169,34170,34171,34173,34175,34177,34181,34182,34185,34187,34188,34191,34195,34200,34205,34207,34208,34210,34213,34215,34228,34230,34231,34232,34236,34237,34238,34239,34242,34247,34250,34251,34254,34221,34264,34266,34271,34272,34278,34280,34285,34291,34294,34300,34303,34304,34308,34309,34317,34318,34320,34321,34322,34328,34329,34331,34334,34337,34343,34345,34358,34360,34362,34364,34365,34368,34370,34374,34386,34387,34390,34391,34392,34393,34397,34400,34401,34402,34403,34404,34409,34412,34415,34421,34422,34423,34426,34445,34449,34454,34456,34458,34460,34465,34470,34471,34472,34477,34481,34483,34484,34485,34487,34488,34489,34495,34496,34497,34499,34501,34513,34514,34517,34519,34522,34524,34528,34531,34533,34535,34440,34554,34556,34557,34564,34565,34567,34571,34574,34575,34576,34579,34580,34585,34590,34591,34593,34595,34600,34606,34607,34609,34610,34617,34618,34620,34621,34622,34624,34627,34629,34637,34648,34653,34657,34660,34661,34671,34673,34674,34683,34691,34692,34693,34694,34695,34696,34697,34699,34700,34704,34707,34709,34711,34712,34713,34718,34720,34723,34727,34732,34733,34734,34737,34741,34750,34751,34753,34760,34761,34762,34766,34773,34774,34777,34778,34780,34783,34786,34787,34788,34794,34795,34797,34801,34803,34808,34810,34815,34817,34819,34822,34825,34826,34827,34832,34841,34834,34835,34836,34840,34842,34843,34844,34846,34847,34856,34861,34862,34864,34866,34869,34874,34876,34881,34883,34885,34888,34889,34890,34891,34894,34897,34901,34902,34904,34906,34908,34911,34912,34916,34921,34929,34937,34939,34944,34968,34970,34971,34972,34975,34976,34984,34986,35002,35005,35006,35008,35018,35019,35020,35021,35022,35025,35026,35027,35035,35038,35047,35055,35056,35057,35061,35063,35073,35078,35085,35086,35087,35093,35094,35096,35097,35098,35100,35104,35110,35111,35112,35120,35121,35122,35125,35129,35130,35134,35136,35138,35141,35142,35145,35151,35154,35159,35162,35163,35164,35169,35170,35171,35179,35182,35184,35187,35189,35194,35195,35196,35197,35209,35213,35216,35220,35221,35227,35228,35231,35232,35237,35248,35252,35253,35254,35255,35260,35284,35285,35286,35287,35288,35301,35305,35307,35309,35313,35315,35318,35321,35325,35327,35332,35333,35335,35343,35345,35346,35348,35349,35358,35360,35362,35364,35366,35371,35372,35375,35381,35383,35389,35390,35392,35395,35397,35399,35401,35405,35406,35411,35414,35415,35416,35420,35421,35425,35429,35431,35445,35446,35447,35449,35450,35451,35454,35455,35456,35459,35462,35467,35471,35472,35474,35478,35479,35481,35487,35495,35497,35502,35503,35507,35510,35511,35515,35518,35523,35526,35528,35529,35530,35537,35539,35540,35541,35543,35549,35551,35564,35568,35572,35573,35574,35580,35583,35589,35590,35595,35601,35612,35614,35615,35594,35629,35632,35639,35644,35650,35651,35652,35653,35654,35656,35666,35667,35668,35673,35661,35678,35683,35693,35702,35704,35705,35708,35710,35713,35716,35717,35723,35725,35727,35732,35733,35740,35742,35743,35896,35897,35901,35902,35909,35911,35913,35915,35919,35921,35923,35924,35927,35928,35931,35933,35929,35939,35940,35942,35944,35945,35949,35955,35957,35958,35963,35966,35974,35975,35979,35984,35986,35987,35993,35995,35996,36004,36025,36026,36037,36038,36041,36043,36047,36054,36053,36057,36061,36065,36072,36076,36079,36080,36082,36085,36087,36088,36094,36095,36097,36099,36105,36114,36119,36123,36197,36201,36204,36206,36223,36226,36228,36232,36237,36240,36241,36245,36254,36255,36256,36262,36267,36268,36271,36274,36277,36279,36281,36283,36288,36293,36294,36295,36296,36298,36302,36305,36308,36309,36311,36313,36324,36325,36327,36332,36336,36284,36337,36338,36340,36349,36353,36356,36357,36358,36363,36369,36372,36374,36384,36385,36386,36387,36390,36391,36401,36403,36406,36407,36408,36409,36413,36416,36417,36427,36429,36430,36431,36436,36443,36444,36445,36446,36449,36450,36457,36460,36461,36463,36464,36465,36473,36474,36475,36482,36483,36489,36496,36498,36501,36506,36507,36509,36510,36514,36519,36521,36525,36526,36531,36533,36538,36539,36544,36545,36547,36548,36551,36559,36561,36564,36572,36584,36590,36592,36593,36599,36601,36602,36589,36608,36610,36615,36616,36623,36624,36630,36631,36632,36638,36640,36641,36643,36645,36647,36648,36652,36653,36654,36660,36661,36662,36663,36666,36672,36673,36675,36679,36687,36689,36690,36691,36692,36693,36696,36701,36702,36709,36765,36768,36769,36772,36773,36774,36789,36790,36792,36798,36800,36801,36806,36810,36811,36813,36816,36818,36819,36821,36832,36835,36836,36840,36846,36849,36853,36854,36859,36862,36866,36868,36872,36876,36888,36891,36904,36905,36911,36906,36908,36909,36915,36916,36919,36927,36931,36932,36940,36955,36957,36962,36966,36967,36972,36976,36980,36985,36997,37000,37003,37004,37006,37008,37013,37015,37016,37017,37019,37024,37025,37026,37029,37040,37042,37043,37044,37046,37053,37068,37054,37059,37060,37061,37063,37064,37077,37079,37080,37081,37084,37085,37087,37093,37074,37110,37099,37103,37104,37108,37118,37119,37120,37124,37125,37126,37128,37133,37136,37140,37142,37143,37144,37146,37148,37150,37152,37157,37154,37155,37159,37161,37166,37167,37169,37172,37174,37175,37177,37178,37180,37181,37187,37191,37192,37199,37203,37207,37209,37210,37211,37217,37220,37223,37229,37236,37241,37242,37243,37249,37251,37253,37254,37258,37262,37265,37267,37268,37269,37272,37278,37281,37286,37288,37292,37293,37294,37296,37297,37298,37299,37302,37307,37308,37309,37311,37314,37315,37317,37331,37332,37335,37337,37338,37342,37348,37349,37353,37354,37356,37357,37358,37359,37360,37361,37367,37369,37371,37373,37376,37377,37380,37381,37382,37383,37385,37386,37388,37392,37394,37395,37398,37400,37404,37405,37411,37412,37413,37414,37416,37422,37423,37424,37427,37429,37430,37432,37433,37434,37436,37438,37440,37442,37443,37446,37447,37450,37453,37454,37455,37457,37464,37465,37468,37469,37472,37473,37477,37479,37480,37481,37486,37487,37488,37493,37494,37495,37496,37497,37499,37500,37501,37503,37512,37513,37514,37517,37518,37522,37527,37529,37535,37536,37540,37541,37543,37544,37547,37551,37554,37558,37560,37562,37563,37564,37565,37567,37568,37569,37570,37571,37573,37574,37575,37576,37579,37580,37581,37582,37584,37587,37589,37591,37592,37593,37596,37597,37599,37600,37601,37603,37605,37607,37608,37612,37614,37616,37625,37627,37631,37632,37634,37640,37645,37649,37652,37653,37660,37661,37662,37663,37665,37668,37669,37671,37673,37674,37683,37684,37686,37687,37703,37704,37705,37712,37713,37714,37717,37719,37720,37722,37726,37732,37733,37735,37737,37738,37741,37743,37744,37745,37747,37748,37750,37754,37757,37759,37760,37761,37762,37768,37770,37771,37773,37775,37778,37781,37784,37787,37790,37793,37795,37796,37798,37800,37803,37812,37813,37814,37818,37801,37825,37828,37829,37830,37831,37833,37834,37835,37836,37837,37843,37849,37852,37854,37855,37858,37862,37863,37881,37879,37880,37882,37883,37885,37889,37890,37892,37896,37897,37901,37902,37903,37909,37910,37911,37919,37934,37935,37937,37938,37939,37940,37947,37951,37949,37955,37957,37960,37962,37964,37973,37977,37980,37983,37985,37987,37992,37995,37997,37998,37999,38001,38002,38020,38019,38264,38265,38270,38276,38280,38284,38285,38286,38301,38302,38303,38305,38310,38313,38315,38316,38324,38326,38330,38333,38335,38342,38344,38345,38347,38352,38353,38354,38355,38361,38362,38365,38366,38367,38368,38372,38374,38429,38430,38434,38436,38437,38438,38444,38449,38451,38455,38456,38457,38458,38460,38461,38465,38482,38484,38486,38487,38488,38497,38510,38516,38523,38524,38526,38527,38529,38530,38531,38532,38537,38545,38550,38554,38557,38559,38564,38565,38566,38569,38574,38575,38579,38586,38602,38610,23986,38616,38618,38621,38622,38623,38633,38639,38641,38650,38658,38659,38661,38665,38682,38683,38685,38689,38690,38691,38696,38705,38707,38721,38723,38730,38734,38735,38741,38743,38744,38746,38747,38755,38759,38762,38766,38771,38774,38775,38776,38779,38781,38783,38784,38793,38805,38806,38807,38809,38810,38814,38815,38818,38828,38830,38833,38834,38837,38838,38840,38841,38842,38844,38846,38847,38849,38852,38853,38855,38857,38858,38860,38861,38862,38864,38865,38868,38871,38872,38873,38877,38878,38880,38875,38881,38884,38895,38897,38900,38903,38904,38906,38919,38922,38937,38925,38926,38932,38934,38940,38942,38944,38947,38950,38955,38958,38959,38960,38962,38963,38965,38949,38974,38980,38983,38986,38993,38994,38995,38998,38999,39001,39002,39010,39011,39013,39014,39018,39020,39083,39085,39086,39088,39092,39095,39096,39098,39099,39103,39106,39109,39112,39116,39137,39139,39141,39142,39143,39146,39155,39158,39170,39175,39176,39185,39189,39190,39191,39194,39195,39196,39199,39202,39206,39207,39211,39217,39218,39219,39220,39221,39225,39226,39227,39228,39232,39233,39238,39239,39240,39245,39246,39252,39256,39257,39259,39260,39262,39263,39264,39323,39325,39327,39334,39344,39345,39346,39349,39353,39354,39357,39359,39363,39369,39379,39380,39385,39386,39388,39390,39399,39402,39403,39404,39408,39412,39413,39417,39421,39422,39426,39427,39428,39435,39436,39440,39441,39446,39454,39456,39458,39459,39460,39463,39469,39470,39475,39477,39478,39480,39495,39489,39492,39498,39499,39500,39502,39505,39508,39510,39517,39594,39596,39598,39599,39602,39604,39605,39606,39609,39611,39614,39615,39617,39619,39622,39624,39630,39632,39634,39637,39638,39639,39643,39644,39648,39652,39653,39655,39657,39660,39666,39667,39669,39673,39674,39677,39679,39680,39681,39682,39683,39684,39685,39688,39689,39691,39692,39693,39694,39696,39698,39702,39705,39707,39708,39712,39718,39723,39725,39731,39732,39733,39735,39737,39738,39741,39752,39755,39756,39765,39766,39767,39771,39774,39777,39779,39781,39782,39784,39786,39787,39788,39789,39790,39795,39797,39799,39800,39801,39807,39808,39812,39813,39814,39815,39817,39818,39819,39821,39823,39824,39828,39834,39837,39838,39846,39847,39849,39852,39856,39857,39858,39863,39864,39867,39868,39870,39871,39873,39879,39880,39886,39888,39895,39896,39901,39903,39909,39911,39914,39915,39919,39923,39927,39928,39929,39930,39933,39935,39936,39938,39947,39951,39953,39958,39960,39961,39962,39964,39966,39970,39971,39974,39975,39976,39977,39978,39985,39989,39990,39991,39997,40001,40003,40004,40005,40009,40010,40014,40015,40016,40019,40020,40022,40024,40027,40029,40030,40031,40035,40041,40042,40028,40043,40040,40046,40048,40050,40053,40055,40059,40166,40178,40183,40185,40203,40194,40209,40215,40216,40220,40221,40222,40239,40240,40242,40243,40244,40250,40252,40261,40253,40258,40259,40263,40266,40275,40276,40287,40291,40290,40293,40297,40298,40299,40304,40310,40311,40315,40316,40318,40323,40324,40326,40330,40333,40334,40338,40339,40341,40342,40343,40344,40353,40362,40364,40366,40369,40373,40377,40380,40383,40387,40391,40393,40394,40404,40405,40406,40407,40410,40414,40415,40416,40421,40423,40425,40427,40430,40432,40435,40436,40446,40458,40450,40455,40462,40464,40465,40466,40469,40470,40473,40476,40477,40570,40571,40572,40576,40578,40579,40580,40581,40583,40590,40591,40598,40600,40603,40606,40612,40616,40620,40622,40623,40624,40627,40628,40629,40646,40648,40651,40661,40671,40676,40679,40684,40685,40686,40688,40689,40690,40693,40696,40703,40706,40707,40713,40719,40720,40721,40722,40724,40726,40727,40729,40730,40731,40735,40738,40742,40746,40747,40751,40753,40754,40756,40759,40761,40762,40764,40765,40767,40769,40771,40772,40773,40774,40775,40787,40789,40790,40791,40792,40794,40797,40798,40808,40809,40813,40814,40815,40816,40817,40819,40821,40826,40829,40847,40848,40849,40850,40852,40854,40855,40862,40865,40866,40867,40869,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null], + "ibm866":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160], + "iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729], + "iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729], + "iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729], + "iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119], + "iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null], + "iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null], + "iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null], + "iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312], + "iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217], + "iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255], + "iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255], + "iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255], + "koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066], + "koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066], + "macintosh":[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711], + "windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null], + "windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729], + "windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103], + "windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255], + "windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null], + "windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255], + "windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null], + "windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746], + "windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729], + "windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255], + "x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364] +}; + +// For strict environments where `this` inside the global scope +// is `undefined`, take a pure object instead +}(this || {})); + +/***/ }), + +/***/ 4498: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +// This is free and unencumbered software released into the public domain. +// See LICENSE.md for more information. + +/** + * @fileoverview Global |this| required for resolving indexes in node. + * @suppress {globalThis} + */ +(function(global) { + 'use strict'; + + // If we're in node require encoding-indexes and attach it to the global. + if ( true && module.exports && + !global["encoding-indexes"]) { + global["encoding-indexes"] = + (__webpack_require__(2162)["encoding-indexes"]); + } + + // + // Utilities + // + + /** + * @param {number} a The number to test. + * @param {number} min The minimum value in the range, inclusive. + * @param {number} max The maximum value in the range, inclusive. + * @return {boolean} True if a >= min and a <= max. + */ + function inRange(a, min, max) { + return min <= a && a <= max; + } + + /** + * @param {!Array.<*>} array The array to check. + * @param {*} item The item to look for in the array. + * @return {boolean} True if the item appears in the array. + */ + function includes(array, item) { + return array.indexOf(item) !== -1; + } + + var floor = Math.floor; + + /** + * @param {*} o + * @return {Object} + */ + function ToDictionary(o) { + if (o === undefined) return {}; + if (o === Object(o)) return o; + throw TypeError('Could not convert argument to dictionary'); + } + + /** + * @param {string} string Input string of UTF-16 code units. + * @return {!Array.} Code points. + */ + function stringToCodePoints(string) { + // https://heycam.github.io/webidl/#dfn-obtain-unicode + + // 1. Let S be the DOMString value. + var s = String(string); + + // 2. Let n be the length of S. + var n = s.length; + + // 3. Initialize i to 0. + var i = 0; + + // 4. Initialize U to be an empty sequence of Unicode characters. + var u = []; + + // 5. While i < n: + while (i < n) { + + // 1. Let c be the code unit in S at index i. + var c = s.charCodeAt(i); + + // 2. Depending on the value of c: + + // c < 0xD800 or c > 0xDFFF + if (c < 0xD800 || c > 0xDFFF) { + // Append to U the Unicode character with code point c. + u.push(c); + } + + // 0xDC00 ≤ c ≤ 0xDFFF + else if (0xDC00 <= c && c <= 0xDFFF) { + // Append to U a U+FFFD REPLACEMENT CHARACTER. + u.push(0xFFFD); + } + + // 0xD800 ≤ c ≤ 0xDBFF + else if (0xD800 <= c && c <= 0xDBFF) { + // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT + // CHARACTER. + if (i === n - 1) { + u.push(0xFFFD); + } + // 2. Otherwise, i < n−1: + else { + // 1. Let d be the code unit in S at index i+1. + var d = s.charCodeAt(i + 1); + + // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then: + if (0xDC00 <= d && d <= 0xDFFF) { + // 1. Let a be c & 0x3FF. + var a = c & 0x3FF; + + // 2. Let b be d & 0x3FF. + var b = d & 0x3FF; + + // 3. Append to U the Unicode character with code point + // 2^16+2^10*a+b. + u.push(0x10000 + (a << 10) + b); + + // 4. Set i to i+1. + i += 1; + } + + // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a + // U+FFFD REPLACEMENT CHARACTER. + else { + u.push(0xFFFD); + } + } + } + + // 3. Set i to i+1. + i += 1; + } + + // 6. Return U. + return u; + } + + /** + * @param {!Array.} code_points Array of code points. + * @return {string} string String of UTF-16 code units. + */ + function codePointsToString(code_points) { + var s = ''; + for (var i = 0; i < code_points.length; ++i) { + var cp = code_points[i]; + if (cp <= 0xFFFF) { + s += String.fromCharCode(cp); + } else { + cp -= 0x10000; + s += String.fromCharCode((cp >> 10) + 0xD800, + (cp & 0x3FF) + 0xDC00); + } + } + return s; + } + + + // + // Implementation of Encoding specification + // https://encoding.spec.whatwg.org/ + // + + // + // 4. Terminology + // + + /** + * An ASCII byte is a byte in the range 0x00 to 0x7F, inclusive. + * @param {number} a The number to test. + * @return {boolean} True if a is in the range 0x00 to 0x7F, inclusive. + */ + function isASCIIByte(a) { + return 0x00 <= a && a <= 0x7F; + } + + /** + * An ASCII code point is a code point in the range U+0000 to + * U+007F, inclusive. + */ + var isASCIICodePoint = isASCIIByte; + + + /** + * End-of-stream is a special token that signifies no more tokens + * are in the stream. + * @const + */ var end_of_stream = -1; + + /** + * A stream represents an ordered sequence of tokens. + * + * @constructor + * @param {!(Array.|Uint8Array)} tokens Array of tokens that provide + * the stream. + */ + function Stream(tokens) { + /** @type {!Array.} */ + this.tokens = [].slice.call(tokens); + // Reversed as push/pop is more efficient than shift/unshift. + this.tokens.reverse(); + } + + Stream.prototype = { + /** + * @return {boolean} True if end-of-stream has been hit. + */ + endOfStream: function() { + return !this.tokens.length; + }, + + /** + * When a token is read from a stream, the first token in the + * stream must be returned and subsequently removed, and + * end-of-stream must be returned otherwise. + * + * @return {number} Get the next token from the stream, or + * end_of_stream. + */ + read: function() { + if (!this.tokens.length) + return end_of_stream; + return this.tokens.pop(); + }, + + /** + * When one or more tokens are prepended to a stream, those tokens + * must be inserted, in given order, before the first token in the + * stream. + * + * @param {(number|!Array.)} token The token(s) to prepend to the + * stream. + */ + prepend: function(token) { + if (Array.isArray(token)) { + var tokens = /**@type {!Array.}*/(token); + while (tokens.length) + this.tokens.push(tokens.pop()); + } else { + this.tokens.push(token); + } + }, + + /** + * When one or more tokens are pushed to a stream, those tokens + * must be inserted, in given order, after the last token in the + * stream. + * + * @param {(number|!Array.)} token The tokens(s) to push to the + * stream. + */ + push: function(token) { + if (Array.isArray(token)) { + var tokens = /**@type {!Array.}*/(token); + while (tokens.length) + this.tokens.unshift(tokens.shift()); + } else { + this.tokens.unshift(token); + } + } + }; + + // + // 5. Encodings + // + + // 5.1 Encoders and decoders + + /** @const */ + var finished = -1; + + /** + * @param {boolean} fatal If true, decoding errors raise an exception. + * @param {number=} opt_code_point Override the standard fallback code point. + * @return {number} The code point to insert on a decoding error. + */ + function decoderError(fatal, opt_code_point) { + if (fatal) + throw TypeError('Decoder error'); + return opt_code_point || 0xFFFD; + } + + /** + * @param {number} code_point The code point that could not be encoded. + * @return {number} Always throws, no value is actually returned. + */ + function encoderError(code_point) { + throw TypeError('The code point ' + code_point + ' could not be encoded.'); + } + + /** @interface */ + function Decoder() {} + Decoder.prototype = { + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point, or |finished|. + */ + handler: function(stream, bite) {} + }; + + /** @interface */ + function Encoder() {} + Encoder.prototype = { + /** + * @param {Stream} stream The stream of code points being encoded. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit, or |finished|. + */ + handler: function(stream, code_point) {} + }; + + // 5.2 Names and labels + + // TODO: Define @typedef for Encoding: {name:string,labels:Array.} + // https://github.com/google/closure-compiler/issues/247 + + /** + * @param {string} label The encoding label. + * @return {?{name:string,labels:Array.}} + */ + function getEncoding(label) { + // 1. Remove any leading and trailing ASCII whitespace from label. + label = String(label).trim().toLowerCase(); + + // 2. If label is an ASCII case-insensitive match for any of the + // labels listed in the table below, return the corresponding + // encoding, and failure otherwise. + if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) { + return label_to_encoding[label]; + } + return null; + } + + /** + * Encodings table: https://encoding.spec.whatwg.org/encodings.json + * @const + * @type {!Array.<{ + * heading: string, + * encodings: Array.<{name:string,labels:Array.}> + * }>} + */ + var encodings = [ + { + "encodings": [ + { + "labels": [ + "unicode-1-1-utf-8", + "utf-8", + "utf8" + ], + "name": "UTF-8" + } + ], + "heading": "The Encoding" + }, + { + "encodings": [ + { + "labels": [ + "866", + "cp866", + "csibm866", + "ibm866" + ], + "name": "IBM866" + }, + { + "labels": [ + "csisolatin2", + "iso-8859-2", + "iso-ir-101", + "iso8859-2", + "iso88592", + "iso_8859-2", + "iso_8859-2:1987", + "l2", + "latin2" + ], + "name": "ISO-8859-2" + }, + { + "labels": [ + "csisolatin3", + "iso-8859-3", + "iso-ir-109", + "iso8859-3", + "iso88593", + "iso_8859-3", + "iso_8859-3:1988", + "l3", + "latin3" + ], + "name": "ISO-8859-3" + }, + { + "labels": [ + "csisolatin4", + "iso-8859-4", + "iso-ir-110", + "iso8859-4", + "iso88594", + "iso_8859-4", + "iso_8859-4:1988", + "l4", + "latin4" + ], + "name": "ISO-8859-4" + }, + { + "labels": [ + "csisolatincyrillic", + "cyrillic", + "iso-8859-5", + "iso-ir-144", + "iso8859-5", + "iso88595", + "iso_8859-5", + "iso_8859-5:1988" + ], + "name": "ISO-8859-5" + }, + { + "labels": [ + "arabic", + "asmo-708", + "csiso88596e", + "csiso88596i", + "csisolatinarabic", + "ecma-114", + "iso-8859-6", + "iso-8859-6-e", + "iso-8859-6-i", + "iso-ir-127", + "iso8859-6", + "iso88596", + "iso_8859-6", + "iso_8859-6:1987" + ], + "name": "ISO-8859-6" + }, + { + "labels": [ + "csisolatingreek", + "ecma-118", + "elot_928", + "greek", + "greek8", + "iso-8859-7", + "iso-ir-126", + "iso8859-7", + "iso88597", + "iso_8859-7", + "iso_8859-7:1987", + "sun_eu_greek" + ], + "name": "ISO-8859-7" + }, + { + "labels": [ + "csiso88598e", + "csisolatinhebrew", + "hebrew", + "iso-8859-8", + "iso-8859-8-e", + "iso-ir-138", + "iso8859-8", + "iso88598", + "iso_8859-8", + "iso_8859-8:1988", + "visual" + ], + "name": "ISO-8859-8" + }, + { + "labels": [ + "csiso88598i", + "iso-8859-8-i", + "logical" + ], + "name": "ISO-8859-8-I" + }, + { + "labels": [ + "csisolatin6", + "iso-8859-10", + "iso-ir-157", + "iso8859-10", + "iso885910", + "l6", + "latin6" + ], + "name": "ISO-8859-10" + }, + { + "labels": [ + "iso-8859-13", + "iso8859-13", + "iso885913" + ], + "name": "ISO-8859-13" + }, + { + "labels": [ + "iso-8859-14", + "iso8859-14", + "iso885914" + ], + "name": "ISO-8859-14" + }, + { + "labels": [ + "csisolatin9", + "iso-8859-15", + "iso8859-15", + "iso885915", + "iso_8859-15", + "l9" + ], + "name": "ISO-8859-15" + }, + { + "labels": [ + "iso-8859-16" + ], + "name": "ISO-8859-16" + }, + { + "labels": [ + "cskoi8r", + "koi", + "koi8", + "koi8-r", + "koi8_r" + ], + "name": "KOI8-R" + }, + { + "labels": [ + "koi8-ru", + "koi8-u" + ], + "name": "KOI8-U" + }, + { + "labels": [ + "csmacintosh", + "mac", + "macintosh", + "x-mac-roman" + ], + "name": "macintosh" + }, + { + "labels": [ + "dos-874", + "iso-8859-11", + "iso8859-11", + "iso885911", + "tis-620", + "windows-874" + ], + "name": "windows-874" + }, + { + "labels": [ + "cp1250", + "windows-1250", + "x-cp1250" + ], + "name": "windows-1250" + }, + { + "labels": [ + "cp1251", + "windows-1251", + "x-cp1251" + ], + "name": "windows-1251" + }, + { + "labels": [ + "ansi_x3.4-1968", + "ascii", + "cp1252", + "cp819", + "csisolatin1", + "ibm819", + "iso-8859-1", + "iso-ir-100", + "iso8859-1", + "iso88591", + "iso_8859-1", + "iso_8859-1:1987", + "l1", + "latin1", + "us-ascii", + "windows-1252", + "x-cp1252" + ], + "name": "windows-1252" + }, + { + "labels": [ + "cp1253", + "windows-1253", + "x-cp1253" + ], + "name": "windows-1253" + }, + { + "labels": [ + "cp1254", + "csisolatin5", + "iso-8859-9", + "iso-ir-148", + "iso8859-9", + "iso88599", + "iso_8859-9", + "iso_8859-9:1989", + "l5", + "latin5", + "windows-1254", + "x-cp1254" + ], + "name": "windows-1254" + }, + { + "labels": [ + "cp1255", + "windows-1255", + "x-cp1255" + ], + "name": "windows-1255" + }, + { + "labels": [ + "cp1256", + "windows-1256", + "x-cp1256" + ], + "name": "windows-1256" + }, + { + "labels": [ + "cp1257", + "windows-1257", + "x-cp1257" + ], + "name": "windows-1257" + }, + { + "labels": [ + "cp1258", + "windows-1258", + "x-cp1258" + ], + "name": "windows-1258" + }, + { + "labels": [ + "x-mac-cyrillic", + "x-mac-ukrainian" + ], + "name": "x-mac-cyrillic" + } + ], + "heading": "Legacy single-byte encodings" + }, + { + "encodings": [ + { + "labels": [ + "chinese", + "csgb2312", + "csiso58gb231280", + "gb2312", + "gb_2312", + "gb_2312-80", + "gbk", + "iso-ir-58", + "x-gbk" + ], + "name": "GBK" + }, + { + "labels": [ + "gb18030" + ], + "name": "gb18030" + } + ], + "heading": "Legacy multi-byte Chinese (simplified) encodings" + }, + { + "encodings": [ + { + "labels": [ + "big5", + "big5-hkscs", + "cn-big5", + "csbig5", + "x-x-big5" + ], + "name": "Big5" + } + ], + "heading": "Legacy multi-byte Chinese (traditional) encodings" + }, + { + "encodings": [ + { + "labels": [ + "cseucpkdfmtjapanese", + "euc-jp", + "x-euc-jp" + ], + "name": "EUC-JP" + }, + { + "labels": [ + "csiso2022jp", + "iso-2022-jp" + ], + "name": "ISO-2022-JP" + }, + { + "labels": [ + "csshiftjis", + "ms932", + "ms_kanji", + "shift-jis", + "shift_jis", + "sjis", + "windows-31j", + "x-sjis" + ], + "name": "Shift_JIS" + } + ], + "heading": "Legacy multi-byte Japanese encodings" + }, + { + "encodings": [ + { + "labels": [ + "cseuckr", + "csksc56011987", + "euc-kr", + "iso-ir-149", + "korean", + "ks_c_5601-1987", + "ks_c_5601-1989", + "ksc5601", + "ksc_5601", + "windows-949" + ], + "name": "EUC-KR" + } + ], + "heading": "Legacy multi-byte Korean encodings" + }, + { + "encodings": [ + { + "labels": [ + "csiso2022kr", + "hz-gb-2312", + "iso-2022-cn", + "iso-2022-cn-ext", + "iso-2022-kr" + ], + "name": "replacement" + }, + { + "labels": [ + "utf-16be" + ], + "name": "UTF-16BE" + }, + { + "labels": [ + "utf-16", + "utf-16le" + ], + "name": "UTF-16LE" + }, + { + "labels": [ + "x-user-defined" + ], + "name": "x-user-defined" + } + ], + "heading": "Legacy miscellaneous encodings" + } + ]; + + // Label to encoding registry. + /** @type {Object.}>} */ + var label_to_encoding = {}; + encodings.forEach(function(category) { + category.encodings.forEach(function(encoding) { + encoding.labels.forEach(function(label) { + label_to_encoding[label] = encoding; + }); + }); + }); + + // Registry of of encoder/decoder factories, by encoding name. + /** @type {Object.} */ + var encoders = {}; + /** @type {Object.} */ + var decoders = {}; + + // + // 6. Indexes + // + + /** + * @param {number} pointer The |pointer| to search for. + * @param {(!Array.|undefined)} index The |index| to search within. + * @return {?number} The code point corresponding to |pointer| in |index|, + * or null if |code point| is not in |index|. + */ + function indexCodePointFor(pointer, index) { + if (!index) return null; + return index[pointer] || null; + } + + /** + * @param {number} code_point The |code point| to search for. + * @param {!Array.} index The |index| to search within. + * @return {?number} The first pointer corresponding to |code point| in + * |index|, or null if |code point| is not in |index|. + */ + function indexPointerFor(code_point, index) { + var pointer = index.indexOf(code_point); + return pointer === -1 ? null : pointer; + } + + /** + * @param {string} name Name of the index. + * @return {(!Array.|!Array.>)} + * */ + function index(name) { + if (!('encoding-indexes' in global)) { + throw Error("Indexes missing." + + " Did you forget to include encoding-indexes.js first?"); + } + return global['encoding-indexes'][name]; + } + + /** + * @param {number} pointer The |pointer| to search for in the gb18030 index. + * @return {?number} The code point corresponding to |pointer| in |index|, + * or null if |code point| is not in the gb18030 index. + */ + function indexGB18030RangesCodePointFor(pointer) { + // 1. If pointer is greater than 39419 and less than 189000, or + // pointer is greater than 1237575, return null. + if ((pointer > 39419 && pointer < 189000) || (pointer > 1237575)) + return null; + + // 2. If pointer is 7457, return code point U+E7C7. + if (pointer === 7457) return 0xE7C7; + + // 3. Let offset be the last pointer in index gb18030 ranges that + // is equal to or less than pointer and let code point offset be + // its corresponding code point. + var offset = 0; + var code_point_offset = 0; + var idx = index('gb18030-ranges'); + var i; + for (i = 0; i < idx.length; ++i) { + /** @type {!Array.} */ + var entry = idx[i]; + if (entry[0] <= pointer) { + offset = entry[0]; + code_point_offset = entry[1]; + } else { + break; + } + } + + // 4. Return a code point whose value is code point offset + + // pointer − offset. + return code_point_offset + pointer - offset; + } + + /** + * @param {number} code_point The |code point| to locate in the gb18030 index. + * @return {number} The first pointer corresponding to |code point| in the + * gb18030 index. + */ + function indexGB18030RangesPointerFor(code_point) { + // 1. If code point is U+E7C7, return pointer 7457. + if (code_point === 0xE7C7) return 7457; + + // 2. Let offset be the last code point in index gb18030 ranges + // that is equal to or less than code point and let pointer offset + // be its corresponding pointer. + var offset = 0; + var pointer_offset = 0; + var idx = index('gb18030-ranges'); + var i; + for (i = 0; i < idx.length; ++i) { + /** @type {!Array.} */ + var entry = idx[i]; + if (entry[1] <= code_point) { + offset = entry[1]; + pointer_offset = entry[0]; + } else { + break; + } + } + + // 3. Return a pointer whose value is pointer offset + code point + // − offset. + return pointer_offset + code_point - offset; + } + + /** + * @param {number} code_point The |code_point| to search for in the Shift_JIS + * index. + * @return {?number} The code point corresponding to |pointer| in |index|, + * or null if |code point| is not in the Shift_JIS index. + */ + function indexShiftJISPointerFor(code_point) { + // 1. Let index be index jis0208 excluding all entries whose + // pointer is in the range 8272 to 8835, inclusive. + shift_jis_index = shift_jis_index || + index('jis0208').map(function(code_point, pointer) { + return inRange(pointer, 8272, 8835) ? null : code_point; + }); + var index_ = shift_jis_index; + + // 2. Return the index pointer for code point in index. + return index_.indexOf(code_point); + } + var shift_jis_index; + + /** + * @param {number} code_point The |code_point| to search for in the big5 + * index. + * @return {?number} The code point corresponding to |pointer| in |index|, + * or null if |code point| is not in the big5 index. + */ + function indexBig5PointerFor(code_point) { + // 1. Let index be index Big5 excluding all entries whose pointer + big5_index_no_hkscs = big5_index_no_hkscs || + index('big5').map(function(code_point, pointer) { + return (pointer < (0xA1 - 0x81) * 157) ? null : code_point; + }); + var index_ = big5_index_no_hkscs; + + // 2. If code point is U+2550, U+255E, U+2561, U+256A, U+5341, or + // U+5345, return the last pointer corresponding to code point in + // index. + if (code_point === 0x2550 || code_point === 0x255E || + code_point === 0x2561 || code_point === 0x256A || + code_point === 0x5341 || code_point === 0x5345) { + return index_.lastIndexOf(code_point); + } + + // 3. Return the index pointer for code point in index. + return indexPointerFor(code_point, index_); + } + var big5_index_no_hkscs; + + // + // 8. API + // + + /** @const */ var DEFAULT_ENCODING = 'utf-8'; + + // 8.1 Interface TextDecoder + + /** + * @constructor + * @param {string=} label The label of the encoding; + * defaults to 'utf-8'. + * @param {Object=} options + */ + function TextDecoder(label, options) { + // Web IDL conventions + if (!(this instanceof TextDecoder)) + throw TypeError('Called as a function. Did you forget \'new\'?'); + label = label !== undefined ? String(label) : DEFAULT_ENCODING; + options = ToDictionary(options); + + // A TextDecoder object has an associated encoding, decoder, + // stream, ignore BOM flag (initially unset), BOM seen flag + // (initially unset), error mode (initially replacement), and do + // not flush flag (initially unset). + + /** @private */ + this._encoding = null; + /** @private @type {?Decoder} */ + this._decoder = null; + /** @private @type {boolean} */ + this._ignoreBOM = false; + /** @private @type {boolean} */ + this._BOMseen = false; + /** @private @type {string} */ + this._error_mode = 'replacement'; + /** @private @type {boolean} */ + this._do_not_flush = false; + + + // 1. Let encoding be the result of getting an encoding from + // label. + var encoding = getEncoding(label); + + // 2. If encoding is failure or replacement, throw a RangeError. + if (encoding === null || encoding.name === 'replacement') + throw RangeError('Unknown encoding: ' + label); + if (!decoders[encoding.name]) { + throw Error('Decoder not present.' + + ' Did you forget to include encoding-indexes.js first?'); + } + + // 3. Let dec be a new TextDecoder object. + var dec = this; + + // 4. Set dec's encoding to encoding. + dec._encoding = encoding; + + // 5. If options's fatal member is true, set dec's error mode to + // fatal. + if (Boolean(options['fatal'])) + dec._error_mode = 'fatal'; + + // 6. If options's ignoreBOM member is true, set dec's ignore BOM + // flag. + if (Boolean(options['ignoreBOM'])) + dec._ignoreBOM = true; + + // For pre-ES5 runtimes: + if (!Object.defineProperty) { + this.encoding = dec._encoding.name.toLowerCase(); + this.fatal = dec._error_mode === 'fatal'; + this.ignoreBOM = dec._ignoreBOM; + } + + // 7. Return dec. + return dec; + } + + if (Object.defineProperty) { + // The encoding attribute's getter must return encoding's name. + Object.defineProperty(TextDecoder.prototype, 'encoding', { + /** @this {TextDecoder} */ + get: function() { return this._encoding.name.toLowerCase(); } + }); + + // The fatal attribute's getter must return true if error mode + // is fatal, and false otherwise. + Object.defineProperty(TextDecoder.prototype, 'fatal', { + /** @this {TextDecoder} */ + get: function() { return this._error_mode === 'fatal'; } + }); + + // The ignoreBOM attribute's getter must return true if ignore + // BOM flag is set, and false otherwise. + Object.defineProperty(TextDecoder.prototype, 'ignoreBOM', { + /** @this {TextDecoder} */ + get: function() { return this._ignoreBOM; } + }); + } + + /** + * @param {BufferSource=} input The buffer of bytes to decode. + * @param {Object=} options + * @return {string} The decoded string. + */ + TextDecoder.prototype.decode = function decode(input, options) { + var bytes; + if (typeof input === 'object' && input instanceof ArrayBuffer) { + bytes = new Uint8Array(input); + } else if (typeof input === 'object' && 'buffer' in input && + input.buffer instanceof ArrayBuffer) { + bytes = new Uint8Array(input.buffer, + input.byteOffset, + input.byteLength); + } else { + bytes = new Uint8Array(0); + } + + options = ToDictionary(options); + + // 1. If the do not flush flag is unset, set decoder to a new + // encoding's decoder, set stream to a new stream, and unset the + // BOM seen flag. + if (!this._do_not_flush) { + this._decoder = decoders[this._encoding.name]({ + fatal: this._error_mode === 'fatal'}); + this._BOMseen = false; + } + + // 2. If options's stream is true, set the do not flush flag, and + // unset the do not flush flag otherwise. + this._do_not_flush = Boolean(options['stream']); + + // 3. If input is given, push a copy of input to stream. + // TODO: Align with spec algorithm - maintain stream on instance. + var input_stream = new Stream(bytes); + + // 4. Let output be a new stream. + var output = []; + + /** @type {?(number|!Array.)} */ + var result; + + // 5. While true: + while (true) { + // 1. Let token be the result of reading from stream. + var token = input_stream.read(); + + // 2. If token is end-of-stream and the do not flush flag is + // set, return output, serialized. + // TODO: Align with spec algorithm. + if (token === end_of_stream) + break; + + // 3. Otherwise, run these subsubsteps: + + // 1. Let result be the result of processing token for decoder, + // stream, output, and error mode. + result = this._decoder.handler(input_stream, token); + + // 2. If result is finished, return output, serialized. + if (result === finished) + break; + + if (result !== null) { + if (Array.isArray(result)) + output.push.apply(output, /**@type {!Array.}*/(result)); + else + output.push(result); + } + + // 3. Otherwise, if result is error, throw a TypeError. + // (Thrown in handler) + + // 4. Otherwise, do nothing. + } + // TODO: Align with spec algorithm. + if (!this._do_not_flush) { + do { + result = this._decoder.handler(input_stream, input_stream.read()); + if (result === finished) + break; + if (result === null) + continue; + if (Array.isArray(result)) + output.push.apply(output, /**@type {!Array.}*/(result)); + else + output.push(result); + } while (!input_stream.endOfStream()); + this._decoder = null; + } + + // A TextDecoder object also has an associated serialize stream + // algorithm... + /** + * @param {!Array.} stream + * @return {string} + * @this {TextDecoder} + */ + function serializeStream(stream) { + // 1. Let token be the result of reading from stream. + // (Done in-place on array, rather than as a stream) + + // 2. If encoding is UTF-8, UTF-16BE, or UTF-16LE, and ignore + // BOM flag and BOM seen flag are unset, run these subsubsteps: + if (includes(['UTF-8', 'UTF-16LE', 'UTF-16BE'], this._encoding.name) && + !this._ignoreBOM && !this._BOMseen) { + if (stream.length > 0 && stream[0] === 0xFEFF) { + // 1. If token is U+FEFF, set BOM seen flag. + this._BOMseen = true; + stream.shift(); + } else if (stream.length > 0) { + // 2. Otherwise, if token is not end-of-stream, set BOM seen + // flag and append token to stream. + this._BOMseen = true; + } else { + // 3. Otherwise, if token is not end-of-stream, append token + // to output. + // (no-op) + } + } + // 4. Otherwise, return output. + return codePointsToString(stream); + } + + return serializeStream.call(this, output); + }; + + // 8.2 Interface TextEncoder + + /** + * @constructor + * @param {string=} label The label of the encoding. NONSTANDARD. + * @param {Object=} options NONSTANDARD. + */ + function TextEncoder(label, options) { + // Web IDL conventions + if (!(this instanceof TextEncoder)) + throw TypeError('Called as a function. Did you forget \'new\'?'); + options = ToDictionary(options); + + // A TextEncoder object has an associated encoding and encoder. + + /** @private */ + this._encoding = null; + /** @private @type {?Encoder} */ + this._encoder = null; + + // Non-standard + /** @private @type {boolean} */ + this._do_not_flush = false; + /** @private @type {string} */ + this._fatal = Boolean(options['fatal']) ? 'fatal' : 'replacement'; + + // 1. Let enc be a new TextEncoder object. + var enc = this; + + // 2. Set enc's encoding to UTF-8's encoder. + if (Boolean(options['NONSTANDARD_allowLegacyEncoding'])) { + // NONSTANDARD behavior. + label = label !== undefined ? String(label) : DEFAULT_ENCODING; + var encoding = getEncoding(label); + if (encoding === null || encoding.name === 'replacement') + throw RangeError('Unknown encoding: ' + label); + if (!encoders[encoding.name]) { + throw Error('Encoder not present.' + + ' Did you forget to include encoding-indexes.js first?'); + } + enc._encoding = encoding; + } else { + // Standard behavior. + enc._encoding = getEncoding('utf-8'); + + if (label !== undefined && 'console' in global) { + console.warn('TextEncoder constructor called with encoding label, ' + + 'which is ignored.'); + } + } + + // For pre-ES5 runtimes: + if (!Object.defineProperty) + this.encoding = enc._encoding.name.toLowerCase(); + + // 3. Return enc. + return enc; + } + + if (Object.defineProperty) { + // The encoding attribute's getter must return encoding's name. + Object.defineProperty(TextEncoder.prototype, 'encoding', { + /** @this {TextEncoder} */ + get: function() { return this._encoding.name.toLowerCase(); } + }); + } + + /** + * @param {string=} opt_string The string to encode. + * @param {Object=} options + * @return {!Uint8Array} Encoded bytes, as a Uint8Array. + */ + TextEncoder.prototype.encode = function encode(opt_string, options) { + opt_string = opt_string === undefined ? '' : String(opt_string); + options = ToDictionary(options); + + // NOTE: This option is nonstandard. None of the encodings + // permitted for encoding (i.e. UTF-8, UTF-16) are stateful when + // the input is a USVString so streaming is not necessary. + if (!this._do_not_flush) + this._encoder = encoders[this._encoding.name]({ + fatal: this._fatal === 'fatal'}); + this._do_not_flush = Boolean(options['stream']); + + // 1. Convert input to a stream. + var input = new Stream(stringToCodePoints(opt_string)); + + // 2. Let output be a new stream + var output = []; + + /** @type {?(number|!Array.)} */ + var result; + // 3. While true, run these substeps: + while (true) { + // 1. Let token be the result of reading from input. + var token = input.read(); + if (token === end_of_stream) + break; + // 2. Let result be the result of processing token for encoder, + // input, output. + result = this._encoder.handler(input, token); + if (result === finished) + break; + if (Array.isArray(result)) + output.push.apply(output, /**@type {!Array.}*/(result)); + else + output.push(result); + } + // TODO: Align with spec algorithm. + if (!this._do_not_flush) { + while (true) { + result = this._encoder.handler(input, input.read()); + if (result === finished) + break; + if (Array.isArray(result)) + output.push.apply(output, /**@type {!Array.}*/(result)); + else + output.push(result); + } + this._encoder = null; + } + // 3. If result is finished, convert output into a byte sequence, + // and then return a Uint8Array object wrapping an ArrayBuffer + // containing output. + return new Uint8Array(output); + }; + + + // + // 9. The encoding + // + + // 9.1 utf-8 + + // 9.1.1 utf-8 decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function UTF8Decoder(options) { + var fatal = options.fatal; + + // utf-8's decoder's has an associated utf-8 code point, utf-8 + // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8 + // lower boundary (initially 0x80), and a utf-8 upper boundary + // (initially 0xBF). + var /** @type {number} */ utf8_code_point = 0, + /** @type {number} */ utf8_bytes_seen = 0, + /** @type {number} */ utf8_bytes_needed = 0, + /** @type {number} */ utf8_lower_boundary = 0x80, + /** @type {number} */ utf8_upper_boundary = 0xBF; + + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and utf-8 bytes needed is not 0, + // set utf-8 bytes needed to 0 and return error. + if (bite === end_of_stream && utf8_bytes_needed !== 0) { + utf8_bytes_needed = 0; + return decoderError(fatal); + } + + // 2. If byte is end-of-stream, return finished. + if (bite === end_of_stream) + return finished; + + // 3. If utf-8 bytes needed is 0, based on byte: + if (utf8_bytes_needed === 0) { + + // 0x00 to 0x7F + if (inRange(bite, 0x00, 0x7F)) { + // Return a code point whose value is byte. + return bite; + } + + // 0xC2 to 0xDF + else if (inRange(bite, 0xC2, 0xDF)) { + // 1. Set utf-8 bytes needed to 1. + utf8_bytes_needed = 1; + + // 2. Set UTF-8 code point to byte & 0x1F. + utf8_code_point = bite & 0x1F; + } + + // 0xE0 to 0xEF + else if (inRange(bite, 0xE0, 0xEF)) { + // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0. + if (bite === 0xE0) + utf8_lower_boundary = 0xA0; + // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F. + if (bite === 0xED) + utf8_upper_boundary = 0x9F; + // 3. Set utf-8 bytes needed to 2. + utf8_bytes_needed = 2; + // 4. Set UTF-8 code point to byte & 0xF. + utf8_code_point = bite & 0xF; + } + + // 0xF0 to 0xF4 + else if (inRange(bite, 0xF0, 0xF4)) { + // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90. + if (bite === 0xF0) + utf8_lower_boundary = 0x90; + // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F. + if (bite === 0xF4) + utf8_upper_boundary = 0x8F; + // 3. Set utf-8 bytes needed to 3. + utf8_bytes_needed = 3; + // 4. Set UTF-8 code point to byte & 0x7. + utf8_code_point = bite & 0x7; + } + + // Otherwise + else { + // Return error. + return decoderError(fatal); + } + + // Return continue. + return null; + } + + // 4. If byte is not in the range utf-8 lower boundary to utf-8 + // upper boundary, inclusive, run these substeps: + if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) { + + // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8 + // bytes seen to 0, set utf-8 lower boundary to 0x80, and set + // utf-8 upper boundary to 0xBF. + utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0; + utf8_lower_boundary = 0x80; + utf8_upper_boundary = 0xBF; + + // 2. Prepend byte to stream. + stream.prepend(bite); + + // 3. Return error. + return decoderError(fatal); + } + + // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary + // to 0xBF. + utf8_lower_boundary = 0x80; + utf8_upper_boundary = 0xBF; + + // 6. Set UTF-8 code point to (UTF-8 code point << 6) | (byte & + // 0x3F) + utf8_code_point = (utf8_code_point << 6) | (bite & 0x3F); + + // 7. Increase utf-8 bytes seen by one. + utf8_bytes_seen += 1; + + // 8. If utf-8 bytes seen is not equal to utf-8 bytes needed, + // continue. + if (utf8_bytes_seen !== utf8_bytes_needed) + return null; + + // 9. Let code point be utf-8 code point. + var code_point = utf8_code_point; + + // 10. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes + // seen to 0. + utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0; + + // 11. Return a code point whose value is code point. + return code_point; + }; + } + + // 9.1.2 utf-8 encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ + function UTF8Encoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point, return a byte whose + // value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 3. Set count and offset based on the range code point is in: + var count, offset; + // U+0080 to U+07FF, inclusive: + if (inRange(code_point, 0x0080, 0x07FF)) { + // 1 and 0xC0 + count = 1; + offset = 0xC0; + } + // U+0800 to U+FFFF, inclusive: + else if (inRange(code_point, 0x0800, 0xFFFF)) { + // 2 and 0xE0 + count = 2; + offset = 0xE0; + } + // U+10000 to U+10FFFF, inclusive: + else if (inRange(code_point, 0x10000, 0x10FFFF)) { + // 3 and 0xF0 + count = 3; + offset = 0xF0; + } + + // 4. Let bytes be a byte sequence whose first byte is (code + // point >> (6 × count)) + offset. + var bytes = [(code_point >> (6 * count)) + offset]; + + // 5. Run these substeps while count is greater than 0: + while (count > 0) { + + // 1. Set temp to code point >> (6 × (count − 1)). + var temp = code_point >> (6 * (count - 1)); + + // 2. Append to bytes 0x80 | (temp & 0x3F). + bytes.push(0x80 | (temp & 0x3F)); + + // 3. Decrease count by one. + count -= 1; + } + + // 6. Return bytes bytes, in order. + return bytes; + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['UTF-8'] = function(options) { + return new UTF8Encoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['UTF-8'] = function(options) { + return new UTF8Decoder(options); + }; + + // + // 10. Legacy single-byte encodings + // + + // 10.1 single-byte decoder + /** + * @constructor + * @implements {Decoder} + * @param {!Array.} index The encoding index. + * @param {{fatal: boolean}} options + */ + function SingleByteDecoder(index, options) { + var fatal = options.fatal; + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream, return finished. + if (bite === end_of_stream) + return finished; + + // 2. If byte is an ASCII byte, return a code point whose value + // is byte. + if (isASCIIByte(bite)) + return bite; + + // 3. Let code point be the index code point for byte − 0x80 in + // index single-byte. + var code_point = index[bite - 0x80]; + + // 4. If code point is null, return error. + if (code_point === null) + return decoderError(fatal); + + // 5. Return a code point whose value is code point. + return code_point; + }; + } + + // 10.2 single-byte encoder + /** + * @constructor + * @implements {Encoder} + * @param {!Array.} index The encoding index. + * @param {{fatal: boolean}} options + */ + function SingleByteEncoder(index, options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point, return a byte whose + // value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 3. Let pointer be the index pointer for code point in index + // single-byte. + var pointer = indexPointerFor(code_point, index); + + // 4. If pointer is null, return error with code point. + if (pointer === null) + encoderError(code_point); + + // 5. Return a byte whose value is pointer + 0x80. + return pointer + 0x80; + }; + } + + (function() { + if (!('encoding-indexes' in global)) + return; + encodings.forEach(function(category) { + if (category.heading !== 'Legacy single-byte encodings') + return; + category.encodings.forEach(function(encoding) { + var name = encoding.name; + var idx = index(name.toLowerCase()); + /** @param {{fatal: boolean}} options */ + decoders[name] = function(options) { + return new SingleByteDecoder(idx, options); + }; + /** @param {{fatal: boolean}} options */ + encoders[name] = function(options) { + return new SingleByteEncoder(idx, options); + }; + }); + }); + }()); + + // + // 11. Legacy multi-byte Chinese (simplified) encodings + // + + // 11.1 gbk + + // 11.1.1 gbk decoder + // gbk's decoder is gb18030's decoder. + /** @param {{fatal: boolean}} options */ + decoders['GBK'] = function(options) { + return new GB18030Decoder(options); + }; + + // 11.1.2 gbk encoder + // gbk's encoder is gb18030's encoder with its gbk flag set. + /** @param {{fatal: boolean}} options */ + encoders['GBK'] = function(options) { + return new GB18030Encoder(options, true); + }; + + // 11.2 gb18030 + + // 11.2.1 gb18030 decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function GB18030Decoder(options) { + var fatal = options.fatal; + // gb18030's decoder has an associated gb18030 first, gb18030 + // second, and gb18030 third (all initially 0x00). + var /** @type {number} */ gb18030_first = 0x00, + /** @type {number} */ gb18030_second = 0x00, + /** @type {number} */ gb18030_third = 0x00; + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and gb18030 first, gb18030 + // second, and gb18030 third are 0x00, return finished. + if (bite === end_of_stream && gb18030_first === 0x00 && + gb18030_second === 0x00 && gb18030_third === 0x00) { + return finished; + } + // 2. If byte is end-of-stream, and gb18030 first, gb18030 + // second, or gb18030 third is not 0x00, set gb18030 first, + // gb18030 second, and gb18030 third to 0x00, and return error. + if (bite === end_of_stream && + (gb18030_first !== 0x00 || gb18030_second !== 0x00 || + gb18030_third !== 0x00)) { + gb18030_first = 0x00; + gb18030_second = 0x00; + gb18030_third = 0x00; + decoderError(fatal); + } + var code_point; + // 3. If gb18030 third is not 0x00, run these substeps: + if (gb18030_third !== 0x00) { + // 1. Let code point be null. + code_point = null; + // 2. If byte is in the range 0x30 to 0x39, inclusive, set + // code point to the index gb18030 ranges code point for + // (((gb18030 first − 0x81) × 10 + gb18030 second − 0x30) × + // 126 + gb18030 third − 0x81) × 10 + byte − 0x30. + if (inRange(bite, 0x30, 0x39)) { + code_point = indexGB18030RangesCodePointFor( + (((gb18030_first - 0x81) * 10 + gb18030_second - 0x30) * 126 + + gb18030_third - 0x81) * 10 + bite - 0x30); + } + + // 3. Let buffer be a byte sequence consisting of gb18030 + // second, gb18030 third, and byte, in order. + var buffer = [gb18030_second, gb18030_third, bite]; + + // 4. Set gb18030 first, gb18030 second, and gb18030 third to + // 0x00. + gb18030_first = 0x00; + gb18030_second = 0x00; + gb18030_third = 0x00; + + // 5. If code point is null, prepend buffer to stream and + // return error. + if (code_point === null) { + stream.prepend(buffer); + return decoderError(fatal); + } + + // 6. Return a code point whose value is code point. + return code_point; + } + + // 4. If gb18030 second is not 0x00, run these substeps: + if (gb18030_second !== 0x00) { + + // 1. If byte is in the range 0x81 to 0xFE, inclusive, set + // gb18030 third to byte and return continue. + if (inRange(bite, 0x81, 0xFE)) { + gb18030_third = bite; + return null; + } + + // 2. Prepend gb18030 second followed by byte to stream, set + // gb18030 first and gb18030 second to 0x00, and return error. + stream.prepend([gb18030_second, bite]); + gb18030_first = 0x00; + gb18030_second = 0x00; + return decoderError(fatal); + } + + // 5. If gb18030 first is not 0x00, run these substeps: + if (gb18030_first !== 0x00) { + + // 1. If byte is in the range 0x30 to 0x39, inclusive, set + // gb18030 second to byte and return continue. + if (inRange(bite, 0x30, 0x39)) { + gb18030_second = bite; + return null; + } + + // 2. Let lead be gb18030 first, let pointer be null, and set + // gb18030 first to 0x00. + var lead = gb18030_first; + var pointer = null; + gb18030_first = 0x00; + + // 3. Let offset be 0x40 if byte is less than 0x7F and 0x41 + // otherwise. + var offset = bite < 0x7F ? 0x40 : 0x41; + + // 4. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80 + // to 0xFE, inclusive, set pointer to (lead − 0x81) × 190 + + // (byte − offset). + if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE)) + pointer = (lead - 0x81) * 190 + (bite - offset); + + // 5. Let code point be null if pointer is null and the index + // code point for pointer in index gb18030 otherwise. + code_point = pointer === null ? null : + indexCodePointFor(pointer, index('gb18030')); + + // 6. If code point is null and byte is an ASCII byte, prepend + // byte to stream. + if (code_point === null && isASCIIByte(bite)) + stream.prepend(bite); + + // 7. If code point is null, return error. + if (code_point === null) + return decoderError(fatal); + + // 8. Return a code point whose value is code point. + return code_point; + } + + // 6. If byte is an ASCII byte, return a code point whose value + // is byte. + if (isASCIIByte(bite)) + return bite; + + // 7. If byte is 0x80, return code point U+20AC. + if (bite === 0x80) + return 0x20AC; + + // 8. If byte is in the range 0x81 to 0xFE, inclusive, set + // gb18030 first to byte and return continue. + if (inRange(bite, 0x81, 0xFE)) { + gb18030_first = bite; + return null; + } + + // 9. Return error. + return decoderError(fatal); + }; + } + + // 11.2.2 gb18030 encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + * @param {boolean=} gbk_flag + */ + function GB18030Encoder(options, gbk_flag) { + var fatal = options.fatal; + // gb18030's decoder has an associated gbk flag (initially unset). + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point, return a byte whose + // value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 3. If code point is U+E5E5, return error with code point. + if (code_point === 0xE5E5) + return encoderError(code_point); + + // 4. If the gbk flag is set and code point is U+20AC, return + // byte 0x80. + if (gbk_flag && code_point === 0x20AC) + return 0x80; + + // 5. Let pointer be the index pointer for code point in index + // gb18030. + var pointer = indexPointerFor(code_point, index('gb18030')); + + // 6. If pointer is not null, run these substeps: + if (pointer !== null) { + + // 1. Let lead be floor(pointer / 190) + 0x81. + var lead = floor(pointer / 190) + 0x81; + + // 2. Let trail be pointer % 190. + var trail = pointer % 190; + + // 3. Let offset be 0x40 if trail is less than 0x3F and 0x41 otherwise. + var offset = trail < 0x3F ? 0x40 : 0x41; + + // 4. Return two bytes whose values are lead and trail + offset. + return [lead, trail + offset]; + } + + // 7. If gbk flag is set, return error with code point. + if (gbk_flag) + return encoderError(code_point); + + // 8. Set pointer to the index gb18030 ranges pointer for code + // point. + pointer = indexGB18030RangesPointerFor(code_point); + + // 9. Let byte1 be floor(pointer / 10 / 126 / 10). + var byte1 = floor(pointer / 10 / 126 / 10); + + // 10. Set pointer to pointer − byte1 × 10 × 126 × 10. + pointer = pointer - byte1 * 10 * 126 * 10; + + // 11. Let byte2 be floor(pointer / 10 / 126). + var byte2 = floor(pointer / 10 / 126); + + // 12. Set pointer to pointer − byte2 × 10 × 126. + pointer = pointer - byte2 * 10 * 126; + + // 13. Let byte3 be floor(pointer / 10). + var byte3 = floor(pointer / 10); + + // 14. Let byte4 be pointer − byte3 × 10. + var byte4 = pointer - byte3 * 10; + + // 15. Return four bytes whose values are byte1 + 0x81, byte2 + + // 0x30, byte3 + 0x81, byte4 + 0x30. + return [byte1 + 0x81, + byte2 + 0x30, + byte3 + 0x81, + byte4 + 0x30]; + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['gb18030'] = function(options) { + return new GB18030Encoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['gb18030'] = function(options) { + return new GB18030Decoder(options); + }; + + + // + // 12. Legacy multi-byte Chinese (traditional) encodings + // + + // 12.1 Big5 + + // 12.1.1 Big5 decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function Big5Decoder(options) { + var fatal = options.fatal; + // Big5's decoder has an associated Big5 lead (initially 0x00). + var /** @type {number} */ Big5_lead = 0x00; + + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and Big5 lead is not 0x00, set + // Big5 lead to 0x00 and return error. + if (bite === end_of_stream && Big5_lead !== 0x00) { + Big5_lead = 0x00; + return decoderError(fatal); + } + + // 2. If byte is end-of-stream and Big5 lead is 0x00, return + // finished. + if (bite === end_of_stream && Big5_lead === 0x00) + return finished; + + // 3. If Big5 lead is not 0x00, let lead be Big5 lead, let + // pointer be null, set Big5 lead to 0x00, and then run these + // substeps: + if (Big5_lead !== 0x00) { + var lead = Big5_lead; + var pointer = null; + Big5_lead = 0x00; + + // 1. Let offset be 0x40 if byte is less than 0x7F and 0x62 + // otherwise. + var offset = bite < 0x7F ? 0x40 : 0x62; + + // 2. If byte is in the range 0x40 to 0x7E, inclusive, or 0xA1 + // to 0xFE, inclusive, set pointer to (lead − 0x81) × 157 + + // (byte − offset). + if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE)) + pointer = (lead - 0x81) * 157 + (bite - offset); + + // 3. If there is a row in the table below whose first column + // is pointer, return the two code points listed in its second + // column + // Pointer | Code points + // --------+-------------- + // 1133 | U+00CA U+0304 + // 1135 | U+00CA U+030C + // 1164 | U+00EA U+0304 + // 1166 | U+00EA U+030C + switch (pointer) { + case 1133: return [0x00CA, 0x0304]; + case 1135: return [0x00CA, 0x030C]; + case 1164: return [0x00EA, 0x0304]; + case 1166: return [0x00EA, 0x030C]; + } + + // 4. Let code point be null if pointer is null and the index + // code point for pointer in index Big5 otherwise. + var code_point = (pointer === null) ? null : + indexCodePointFor(pointer, index('big5')); + + // 5. If code point is null and byte is an ASCII byte, prepend + // byte to stream. + if (code_point === null && isASCIIByte(bite)) + stream.prepend(bite); + + // 6. If code point is null, return error. + if (code_point === null) + return decoderError(fatal); + + // 7. Return a code point whose value is code point. + return code_point; + } + + // 4. If byte is an ASCII byte, return a code point whose value + // is byte. + if (isASCIIByte(bite)) + return bite; + + // 5. If byte is in the range 0x81 to 0xFE, inclusive, set Big5 + // lead to byte and return continue. + if (inRange(bite, 0x81, 0xFE)) { + Big5_lead = bite; + return null; + } + + // 6. Return error. + return decoderError(fatal); + }; + } + + // 12.1.2 Big5 encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ + function Big5Encoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point, return a byte whose + // value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 3. Let pointer be the index Big5 pointer for code point. + var pointer = indexBig5PointerFor(code_point); + + // 4. If pointer is null, return error with code point. + if (pointer === null) + return encoderError(code_point); + + // 5. Let lead be floor(pointer / 157) + 0x81. + var lead = floor(pointer / 157) + 0x81; + + // 6. If lead is less than 0xA1, return error with code point. + if (lead < 0xA1) + return encoderError(code_point); + + // 7. Let trail be pointer % 157. + var trail = pointer % 157; + + // 8. Let offset be 0x40 if trail is less than 0x3F and 0x62 + // otherwise. + var offset = trail < 0x3F ? 0x40 : 0x62; + + // Return two bytes whose values are lead and trail + offset. + return [lead, trail + offset]; + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['Big5'] = function(options) { + return new Big5Encoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['Big5'] = function(options) { + return new Big5Decoder(options); + }; + + + // + // 13. Legacy multi-byte Japanese encodings + // + + // 13.1 euc-jp + + // 13.1.1 euc-jp decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function EUCJPDecoder(options) { + var fatal = options.fatal; + + // euc-jp's decoder has an associated euc-jp jis0212 flag + // (initially unset) and euc-jp lead (initially 0x00). + var /** @type {boolean} */ eucjp_jis0212_flag = false, + /** @type {number} */ eucjp_lead = 0x00; + + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and euc-jp lead is not 0x00, set + // euc-jp lead to 0x00, and return error. + if (bite === end_of_stream && eucjp_lead !== 0x00) { + eucjp_lead = 0x00; + return decoderError(fatal); + } + + // 2. If byte is end-of-stream and euc-jp lead is 0x00, return + // finished. + if (bite === end_of_stream && eucjp_lead === 0x00) + return finished; + + // 3. If euc-jp lead is 0x8E and byte is in the range 0xA1 to + // 0xDF, inclusive, set euc-jp lead to 0x00 and return a code + // point whose value is 0xFF61 − 0xA1 + byte. + if (eucjp_lead === 0x8E && inRange(bite, 0xA1, 0xDF)) { + eucjp_lead = 0x00; + return 0xFF61 - 0xA1 + bite; + } + + // 4. If euc-jp lead is 0x8F and byte is in the range 0xA1 to + // 0xFE, inclusive, set the euc-jp jis0212 flag, set euc-jp lead + // to byte, and return continue. + if (eucjp_lead === 0x8F && inRange(bite, 0xA1, 0xFE)) { + eucjp_jis0212_flag = true; + eucjp_lead = bite; + return null; + } + + // 5. If euc-jp lead is not 0x00, let lead be euc-jp lead, set + // euc-jp lead to 0x00, and run these substeps: + if (eucjp_lead !== 0x00) { + var lead = eucjp_lead; + eucjp_lead = 0x00; + + // 1. Let code point be null. + var code_point = null; + + // 2. If lead and byte are both in the range 0xA1 to 0xFE, + // inclusive, set code point to the index code point for (lead + // − 0xA1) × 94 + byte − 0xA1 in index jis0208 if the euc-jp + // jis0212 flag is unset and in index jis0212 otherwise. + if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) { + code_point = indexCodePointFor( + (lead - 0xA1) * 94 + (bite - 0xA1), + index(!eucjp_jis0212_flag ? 'jis0208' : 'jis0212')); + } + + // 3. Unset the euc-jp jis0212 flag. + eucjp_jis0212_flag = false; + + // 4. If byte is not in the range 0xA1 to 0xFE, inclusive, + // prepend byte to stream. + if (!inRange(bite, 0xA1, 0xFE)) + stream.prepend(bite); + + // 5. If code point is null, return error. + if (code_point === null) + return decoderError(fatal); + + // 6. Return a code point whose value is code point. + return code_point; + } + + // 6. If byte is an ASCII byte, return a code point whose value + // is byte. + if (isASCIIByte(bite)) + return bite; + + // 7. If byte is 0x8E, 0x8F, or in the range 0xA1 to 0xFE, + // inclusive, set euc-jp lead to byte and return continue. + if (bite === 0x8E || bite === 0x8F || inRange(bite, 0xA1, 0xFE)) { + eucjp_lead = bite; + return null; + } + + // 8. Return error. + return decoderError(fatal); + }; + } + + // 13.1.2 euc-jp encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ + function EUCJPEncoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point, return a byte whose + // value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 3. If code point is U+00A5, return byte 0x5C. + if (code_point === 0x00A5) + return 0x5C; + + // 4. If code point is U+203E, return byte 0x7E. + if (code_point === 0x203E) + return 0x7E; + + // 5. If code point is in the range U+FF61 to U+FF9F, inclusive, + // return two bytes whose values are 0x8E and code point − + // 0xFF61 + 0xA1. + if (inRange(code_point, 0xFF61, 0xFF9F)) + return [0x8E, code_point - 0xFF61 + 0xA1]; + + // 6. If code point is U+2212, set it to U+FF0D. + if (code_point === 0x2212) + code_point = 0xFF0D; + + // 7. Let pointer be the index pointer for code point in index + // jis0208. + var pointer = indexPointerFor(code_point, index('jis0208')); + + // 8. If pointer is null, return error with code point. + if (pointer === null) + return encoderError(code_point); + + // 9. Let lead be floor(pointer / 94) + 0xA1. + var lead = floor(pointer / 94) + 0xA1; + + // 10. Let trail be pointer % 94 + 0xA1. + var trail = pointer % 94 + 0xA1; + + // 11. Return two bytes whose values are lead and trail. + return [lead, trail]; + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['EUC-JP'] = function(options) { + return new EUCJPEncoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['EUC-JP'] = function(options) { + return new EUCJPDecoder(options); + }; + + // 13.2 iso-2022-jp + + // 13.2.1 iso-2022-jp decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function ISO2022JPDecoder(options) { + var fatal = options.fatal; + /** @enum */ + var states = { + ASCII: 0, + Roman: 1, + Katakana: 2, + LeadByte: 3, + TrailByte: 4, + EscapeStart: 5, + Escape: 6 + }; + // iso-2022-jp's decoder has an associated iso-2022-jp decoder + // state (initially ASCII), iso-2022-jp decoder output state + // (initially ASCII), iso-2022-jp lead (initially 0x00), and + // iso-2022-jp output flag (initially unset). + var /** @type {number} */ iso2022jp_decoder_state = states.ASCII, + /** @type {number} */ iso2022jp_decoder_output_state = states.ASCII, + /** @type {number} */ iso2022jp_lead = 0x00, + /** @type {boolean} */ iso2022jp_output_flag = false; + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // switching on iso-2022-jp decoder state: + switch (iso2022jp_decoder_state) { + default: + case states.ASCII: + // ASCII + // Based on byte: + + // 0x1B + if (bite === 0x1B) { + // Set iso-2022-jp decoder state to escape start and return + // continue. + iso2022jp_decoder_state = states.EscapeStart; + return null; + } + + // 0x00 to 0x7F, excluding 0x0E, 0x0F, and 0x1B + if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E + && bite !== 0x0F && bite !== 0x1B) { + // Unset the iso-2022-jp output flag and return a code point + // whose value is byte. + iso2022jp_output_flag = false; + return bite; + } + + // end-of-stream + if (bite === end_of_stream) { + // Return finished. + return finished; + } + + // Otherwise + // Unset the iso-2022-jp output flag and return error. + iso2022jp_output_flag = false; + return decoderError(fatal); + + case states.Roman: + // Roman + // Based on byte: + + // 0x1B + if (bite === 0x1B) { + // Set iso-2022-jp decoder state to escape start and return + // continue. + iso2022jp_decoder_state = states.EscapeStart; + return null; + } + + // 0x5C + if (bite === 0x5C) { + // Unset the iso-2022-jp output flag and return code point + // U+00A5. + iso2022jp_output_flag = false; + return 0x00A5; + } + + // 0x7E + if (bite === 0x7E) { + // Unset the iso-2022-jp output flag and return code point + // U+203E. + iso2022jp_output_flag = false; + return 0x203E; + } + + // 0x00 to 0x7F, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E + if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E && bite !== 0x0F + && bite !== 0x1B && bite !== 0x5C && bite !== 0x7E) { + // Unset the iso-2022-jp output flag and return a code point + // whose value is byte. + iso2022jp_output_flag = false; + return bite; + } + + // end-of-stream + if (bite === end_of_stream) { + // Return finished. + return finished; + } + + // Otherwise + // Unset the iso-2022-jp output flag and return error. + iso2022jp_output_flag = false; + return decoderError(fatal); + + case states.Katakana: + // Katakana + // Based on byte: + + // 0x1B + if (bite === 0x1B) { + // Set iso-2022-jp decoder state to escape start and return + // continue. + iso2022jp_decoder_state = states.EscapeStart; + return null; + } + + // 0x21 to 0x5F + if (inRange(bite, 0x21, 0x5F)) { + // Unset the iso-2022-jp output flag and return a code point + // whose value is 0xFF61 − 0x21 + byte. + iso2022jp_output_flag = false; + return 0xFF61 - 0x21 + bite; + } + + // end-of-stream + if (bite === end_of_stream) { + // Return finished. + return finished; + } + + // Otherwise + // Unset the iso-2022-jp output flag and return error. + iso2022jp_output_flag = false; + return decoderError(fatal); + + case states.LeadByte: + // Lead byte + // Based on byte: + + // 0x1B + if (bite === 0x1B) { + // Set iso-2022-jp decoder state to escape start and return + // continue. + iso2022jp_decoder_state = states.EscapeStart; + return null; + } + + // 0x21 to 0x7E + if (inRange(bite, 0x21, 0x7E)) { + // Unset the iso-2022-jp output flag, set iso-2022-jp lead + // to byte, iso-2022-jp decoder state to trail byte, and + // return continue. + iso2022jp_output_flag = false; + iso2022jp_lead = bite; + iso2022jp_decoder_state = states.TrailByte; + return null; + } + + // end-of-stream + if (bite === end_of_stream) { + // Return finished. + return finished; + } + + // Otherwise + // Unset the iso-2022-jp output flag and return error. + iso2022jp_output_flag = false; + return decoderError(fatal); + + case states.TrailByte: + // Trail byte + // Based on byte: + + // 0x1B + if (bite === 0x1B) { + // Set iso-2022-jp decoder state to escape start and return + // continue. + iso2022jp_decoder_state = states.EscapeStart; + return decoderError(fatal); + } + + // 0x21 to 0x7E + if (inRange(bite, 0x21, 0x7E)) { + // 1. Set the iso-2022-jp decoder state to lead byte. + iso2022jp_decoder_state = states.LeadByte; + + // 2. Let pointer be (iso-2022-jp lead − 0x21) × 94 + byte − 0x21. + var pointer = (iso2022jp_lead - 0x21) * 94 + bite - 0x21; + + // 3. Let code point be the index code point for pointer in + // index jis0208. + var code_point = indexCodePointFor(pointer, index('jis0208')); + + // 4. If code point is null, return error. + if (code_point === null) + return decoderError(fatal); + + // 5. Return a code point whose value is code point. + return code_point; + } + + // end-of-stream + if (bite === end_of_stream) { + // Set the iso-2022-jp decoder state to lead byte, prepend + // byte to stream, and return error. + iso2022jp_decoder_state = states.LeadByte; + stream.prepend(bite); + return decoderError(fatal); + } + + // Otherwise + // Set iso-2022-jp decoder state to lead byte and return + // error. + iso2022jp_decoder_state = states.LeadByte; + return decoderError(fatal); + + case states.EscapeStart: + // Escape start + + // 1. If byte is either 0x24 or 0x28, set iso-2022-jp lead to + // byte, iso-2022-jp decoder state to escape, and return + // continue. + if (bite === 0x24 || bite === 0x28) { + iso2022jp_lead = bite; + iso2022jp_decoder_state = states.Escape; + return null; + } + + // 2. Prepend byte to stream. + stream.prepend(bite); + + // 3. Unset the iso-2022-jp output flag, set iso-2022-jp + // decoder state to iso-2022-jp decoder output state, and + // return error. + iso2022jp_output_flag = false; + iso2022jp_decoder_state = iso2022jp_decoder_output_state; + return decoderError(fatal); + + case states.Escape: + // Escape + + // 1. Let lead be iso-2022-jp lead and set iso-2022-jp lead to + // 0x00. + var lead = iso2022jp_lead; + iso2022jp_lead = 0x00; + + // 2. Let state be null. + var state = null; + + // 3. If lead is 0x28 and byte is 0x42, set state to ASCII. + if (lead === 0x28 && bite === 0x42) + state = states.ASCII; + + // 4. If lead is 0x28 and byte is 0x4A, set state to Roman. + if (lead === 0x28 && bite === 0x4A) + state = states.Roman; + + // 5. If lead is 0x28 and byte is 0x49, set state to Katakana. + if (lead === 0x28 && bite === 0x49) + state = states.Katakana; + + // 6. If lead is 0x24 and byte is either 0x40 or 0x42, set + // state to lead byte. + if (lead === 0x24 && (bite === 0x40 || bite === 0x42)) + state = states.LeadByte; + + // 7. If state is non-null, run these substeps: + if (state !== null) { + // 1. Set iso-2022-jp decoder state and iso-2022-jp decoder + // output state to states. + iso2022jp_decoder_state = iso2022jp_decoder_state = state; + + // 2. Let output flag be the iso-2022-jp output flag. + var output_flag = iso2022jp_output_flag; + + // 3. Set the iso-2022-jp output flag. + iso2022jp_output_flag = true; + + // 4. Return continue, if output flag is unset, and error + // otherwise. + return !output_flag ? null : decoderError(fatal); + } + + // 8. Prepend lead and byte to stream. + stream.prepend([lead, bite]); + + // 9. Unset the iso-2022-jp output flag, set iso-2022-jp + // decoder state to iso-2022-jp decoder output state and + // return error. + iso2022jp_output_flag = false; + iso2022jp_decoder_state = iso2022jp_decoder_output_state; + return decoderError(fatal); + } + }; + } + + // 13.2.2 iso-2022-jp encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ + function ISO2022JPEncoder(options) { + var fatal = options.fatal; + // iso-2022-jp's encoder has an associated iso-2022-jp encoder + // state which is one of ASCII, Roman, and jis0208 (initially + // ASCII). + /** @enum */ + var states = { + ASCII: 0, + Roman: 1, + jis0208: 2 + }; + var /** @type {number} */ iso2022jp_state = states.ASCII; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream and iso-2022-jp encoder + // state is not ASCII, prepend code point to stream, set + // iso-2022-jp encoder state to ASCII, and return three bytes + // 0x1B 0x28 0x42. + if (code_point === end_of_stream && + iso2022jp_state !== states.ASCII) { + stream.prepend(code_point); + iso2022jp_state = states.ASCII; + return [0x1B, 0x28, 0x42]; + } + + // 2. If code point is end-of-stream and iso-2022-jp encoder + // state is ASCII, return finished. + if (code_point === end_of_stream && iso2022jp_state === states.ASCII) + return finished; + + // 3. If ISO-2022-JP encoder state is ASCII or Roman, and code + // point is U+000E, U+000F, or U+001B, return error with U+FFFD. + if ((iso2022jp_state === states.ASCII || + iso2022jp_state === states.Roman) && + (code_point === 0x000E || code_point === 0x000F || + code_point === 0x001B)) { + return encoderError(0xFFFD); + } + + // 4. If iso-2022-jp encoder state is ASCII and code point is an + // ASCII code point, return a byte whose value is code point. + if (iso2022jp_state === states.ASCII && + isASCIICodePoint(code_point)) + return code_point; + + // 5. If iso-2022-jp encoder state is Roman and code point is an + // ASCII code point, excluding U+005C and U+007E, or is U+00A5 + // or U+203E, run these substeps: + if (iso2022jp_state === states.Roman && + ((isASCIICodePoint(code_point) && + code_point !== 0x005C && code_point !== 0x007E) || + (code_point == 0x00A5 || code_point == 0x203E))) { + + // 1. If code point is an ASCII code point, return a byte + // whose value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 2. If code point is U+00A5, return byte 0x5C. + if (code_point === 0x00A5) + return 0x5C; + + // 3. If code point is U+203E, return byte 0x7E. + if (code_point === 0x203E) + return 0x7E; + } + + // 6. If code point is an ASCII code point, and iso-2022-jp + // encoder state is not ASCII, prepend code point to stream, set + // iso-2022-jp encoder state to ASCII, and return three bytes + // 0x1B 0x28 0x42. + if (isASCIICodePoint(code_point) && + iso2022jp_state !== states.ASCII) { + stream.prepend(code_point); + iso2022jp_state = states.ASCII; + return [0x1B, 0x28, 0x42]; + } + + // 7. If code point is either U+00A5 or U+203E, and iso-2022-jp + // encoder state is not Roman, prepend code point to stream, set + // iso-2022-jp encoder state to Roman, and return three bytes + // 0x1B 0x28 0x4A. + if ((code_point === 0x00A5 || code_point === 0x203E) && + iso2022jp_state !== states.Roman) { + stream.prepend(code_point); + iso2022jp_state = states.Roman; + return [0x1B, 0x28, 0x4A]; + } + + // 8. If code point is U+2212, set it to U+FF0D. + if (code_point === 0x2212) + code_point = 0xFF0D; + + // 9. Let pointer be the index pointer for code point in index + // jis0208. + var pointer = indexPointerFor(code_point, index('jis0208')); + + // 10. If pointer is null, return error with code point. + if (pointer === null) + return encoderError(code_point); + + // 11. If iso-2022-jp encoder state is not jis0208, prepend code + // point to stream, set iso-2022-jp encoder state to jis0208, + // and return three bytes 0x1B 0x24 0x42. + if (iso2022jp_state !== states.jis0208) { + stream.prepend(code_point); + iso2022jp_state = states.jis0208; + return [0x1B, 0x24, 0x42]; + } + + // 12. Let lead be floor(pointer / 94) + 0x21. + var lead = floor(pointer / 94) + 0x21; + + // 13. Let trail be pointer % 94 + 0x21. + var trail = pointer % 94 + 0x21; + + // 14. Return two bytes whose values are lead and trail. + return [lead, trail]; + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['ISO-2022-JP'] = function(options) { + return new ISO2022JPEncoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['ISO-2022-JP'] = function(options) { + return new ISO2022JPDecoder(options); + }; + + // 13.3 Shift_JIS + + // 13.3.1 Shift_JIS decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function ShiftJISDecoder(options) { + var fatal = options.fatal; + // Shift_JIS's decoder has an associated Shift_JIS lead (initially + // 0x00). + var /** @type {number} */ Shift_JIS_lead = 0x00; + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and Shift_JIS lead is not 0x00, + // set Shift_JIS lead to 0x00 and return error. + if (bite === end_of_stream && Shift_JIS_lead !== 0x00) { + Shift_JIS_lead = 0x00; + return decoderError(fatal); + } + + // 2. If byte is end-of-stream and Shift_JIS lead is 0x00, + // return finished. + if (bite === end_of_stream && Shift_JIS_lead === 0x00) + return finished; + + // 3. If Shift_JIS lead is not 0x00, let lead be Shift_JIS lead, + // let pointer be null, set Shift_JIS lead to 0x00, and then run + // these substeps: + if (Shift_JIS_lead !== 0x00) { + var lead = Shift_JIS_lead; + var pointer = null; + Shift_JIS_lead = 0x00; + + // 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41 + // otherwise. + var offset = (bite < 0x7F) ? 0x40 : 0x41; + + // 2. Let lead offset be 0x81, if lead is less than 0xA0, and + // 0xC1 otherwise. + var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1; + + // 3. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80 + // to 0xFC, inclusive, set pointer to (lead − lead offset) × + // 188 + byte − offset. + if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFC)) + pointer = (lead - lead_offset) * 188 + bite - offset; + + // 4. If pointer is in the range 8836 to 10715, inclusive, + // return a code point whose value is 0xE000 − 8836 + pointer. + if (inRange(pointer, 8836, 10715)) + return 0xE000 - 8836 + pointer; + + // 5. Let code point be null, if pointer is null, and the + // index code point for pointer in index jis0208 otherwise. + var code_point = (pointer === null) ? null : + indexCodePointFor(pointer, index('jis0208')); + + // 6. If code point is null and byte is an ASCII byte, prepend + // byte to stream. + if (code_point === null && isASCIIByte(bite)) + stream.prepend(bite); + + // 7. If code point is null, return error. + if (code_point === null) + return decoderError(fatal); + + // 8. Return a code point whose value is code point. + return code_point; + } + + // 4. If byte is an ASCII byte or 0x80, return a code point + // whose value is byte. + if (isASCIIByte(bite) || bite === 0x80) + return bite; + + // 5. If byte is in the range 0xA1 to 0xDF, inclusive, return a + // code point whose value is 0xFF61 − 0xA1 + byte. + if (inRange(bite, 0xA1, 0xDF)) + return 0xFF61 - 0xA1 + bite; + + // 6. If byte is in the range 0x81 to 0x9F, inclusive, or 0xE0 + // to 0xFC, inclusive, set Shift_JIS lead to byte and return + // continue. + if (inRange(bite, 0x81, 0x9F) || inRange(bite, 0xE0, 0xFC)) { + Shift_JIS_lead = bite; + return null; + } + + // 7. Return error. + return decoderError(fatal); + }; + } + + // 13.3.2 Shift_JIS encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ + function ShiftJISEncoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point or U+0080, return a + // byte whose value is code point. + if (isASCIICodePoint(code_point) || code_point === 0x0080) + return code_point; + + // 3. If code point is U+00A5, return byte 0x5C. + if (code_point === 0x00A5) + return 0x5C; + + // 4. If code point is U+203E, return byte 0x7E. + if (code_point === 0x203E) + return 0x7E; + + // 5. If code point is in the range U+FF61 to U+FF9F, inclusive, + // return a byte whose value is code point − 0xFF61 + 0xA1. + if (inRange(code_point, 0xFF61, 0xFF9F)) + return code_point - 0xFF61 + 0xA1; + + // 6. If code point is U+2212, set it to U+FF0D. + if (code_point === 0x2212) + code_point = 0xFF0D; + + // 7. Let pointer be the index Shift_JIS pointer for code point. + var pointer = indexShiftJISPointerFor(code_point); + + // 8. If pointer is null, return error with code point. + if (pointer === null) + return encoderError(code_point); + + // 9. Let lead be floor(pointer / 188). + var lead = floor(pointer / 188); + + // 10. Let lead offset be 0x81, if lead is less than 0x1F, and + // 0xC1 otherwise. + var lead_offset = (lead < 0x1F) ? 0x81 : 0xC1; + + // 11. Let trail be pointer % 188. + var trail = pointer % 188; + + // 12. Let offset be 0x40, if trail is less than 0x3F, and 0x41 + // otherwise. + var offset = (trail < 0x3F) ? 0x40 : 0x41; + + // 13. Return two bytes whose values are lead + lead offset and + // trail + offset. + return [lead + lead_offset, trail + offset]; + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['Shift_JIS'] = function(options) { + return new ShiftJISEncoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['Shift_JIS'] = function(options) { + return new ShiftJISDecoder(options); + }; + + // + // 14. Legacy multi-byte Korean encodings + // + + // 14.1 euc-kr + + // 14.1.1 euc-kr decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function EUCKRDecoder(options) { + var fatal = options.fatal; + + // euc-kr's decoder has an associated euc-kr lead (initially 0x00). + var /** @type {number} */ euckr_lead = 0x00; + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and euc-kr lead is not 0x00, set + // euc-kr lead to 0x00 and return error. + if (bite === end_of_stream && euckr_lead !== 0) { + euckr_lead = 0x00; + return decoderError(fatal); + } + + // 2. If byte is end-of-stream and euc-kr lead is 0x00, return + // finished. + if (bite === end_of_stream && euckr_lead === 0) + return finished; + + // 3. If euc-kr lead is not 0x00, let lead be euc-kr lead, let + // pointer be null, set euc-kr lead to 0x00, and then run these + // substeps: + if (euckr_lead !== 0x00) { + var lead = euckr_lead; + var pointer = null; + euckr_lead = 0x00; + + // 1. If byte is in the range 0x41 to 0xFE, inclusive, set + // pointer to (lead − 0x81) × 190 + (byte − 0x41). + if (inRange(bite, 0x41, 0xFE)) + pointer = (lead - 0x81) * 190 + (bite - 0x41); + + // 2. Let code point be null, if pointer is null, and the + // index code point for pointer in index euc-kr otherwise. + var code_point = (pointer === null) + ? null : indexCodePointFor(pointer, index('euc-kr')); + + // 3. If code point is null and byte is an ASCII byte, prepend + // byte to stream. + if (pointer === null && isASCIIByte(bite)) + stream.prepend(bite); + + // 4. If code point is null, return error. + if (code_point === null) + return decoderError(fatal); + + // 5. Return a code point whose value is code point. + return code_point; + } + + // 4. If byte is an ASCII byte, return a code point whose value + // is byte. + if (isASCIIByte(bite)) + return bite; + + // 5. If byte is in the range 0x81 to 0xFE, inclusive, set + // euc-kr lead to byte and return continue. + if (inRange(bite, 0x81, 0xFE)) { + euckr_lead = bite; + return null; + } + + // 6. Return error. + return decoderError(fatal); + }; + } + + // 14.1.2 euc-kr encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ + function EUCKREncoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point, return a byte whose + // value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 3. Let pointer be the index pointer for code point in index + // euc-kr. + var pointer = indexPointerFor(code_point, index('euc-kr')); + + // 4. If pointer is null, return error with code point. + if (pointer === null) + return encoderError(code_point); + + // 5. Let lead be floor(pointer / 190) + 0x81. + var lead = floor(pointer / 190) + 0x81; + + // 6. Let trail be pointer % 190 + 0x41. + var trail = (pointer % 190) + 0x41; + + // 7. Return two bytes whose values are lead and trail. + return [lead, trail]; + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['EUC-KR'] = function(options) { + return new EUCKREncoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['EUC-KR'] = function(options) { + return new EUCKRDecoder(options); + }; + + + // + // 15. Legacy miscellaneous encodings + // + + // 15.1 replacement + + // Not needed - API throws RangeError + + // 15.2 Common infrastructure for utf-16be and utf-16le + + /** + * @param {number} code_unit + * @param {boolean} utf16be + * @return {!Array.} bytes + */ + function convertCodeUnitToBytes(code_unit, utf16be) { + // 1. Let byte1 be code unit >> 8. + var byte1 = code_unit >> 8; + + // 2. Let byte2 be code unit & 0x00FF. + var byte2 = code_unit & 0x00FF; + + // 3. Then return the bytes in order: + // utf-16be flag is set: byte1, then byte2. + if (utf16be) + return [byte1, byte2]; + // utf-16be flag is unset: byte2, then byte1. + return [byte2, byte1]; + } + + // 15.2.1 shared utf-16 decoder + /** + * @constructor + * @implements {Decoder} + * @param {boolean} utf16_be True if big-endian, false if little-endian. + * @param {{fatal: boolean}} options + */ + function UTF16Decoder(utf16_be, options) { + var fatal = options.fatal; + var /** @type {?number} */ utf16_lead_byte = null, + /** @type {?number} */ utf16_lead_surrogate = null; + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and either utf-16 lead byte or + // utf-16 lead surrogate is not null, set utf-16 lead byte and + // utf-16 lead surrogate to null, and return error. + if (bite === end_of_stream && (utf16_lead_byte !== null || + utf16_lead_surrogate !== null)) { + return decoderError(fatal); + } + + // 2. If byte is end-of-stream and utf-16 lead byte and utf-16 + // lead surrogate are null, return finished. + if (bite === end_of_stream && utf16_lead_byte === null && + utf16_lead_surrogate === null) { + return finished; + } + + // 3. If utf-16 lead byte is null, set utf-16 lead byte to byte + // and return continue. + if (utf16_lead_byte === null) { + utf16_lead_byte = bite; + return null; + } + + // 4. Let code unit be the result of: + var code_unit; + if (utf16_be) { + // utf-16be decoder flag is set + // (utf-16 lead byte << 8) + byte. + code_unit = (utf16_lead_byte << 8) + bite; + } else { + // utf-16be decoder flag is unset + // (byte << 8) + utf-16 lead byte. + code_unit = (bite << 8) + utf16_lead_byte; + } + // Then set utf-16 lead byte to null. + utf16_lead_byte = null; + + // 5. If utf-16 lead surrogate is not null, let lead surrogate + // be utf-16 lead surrogate, set utf-16 lead surrogate to null, + // and then run these substeps: + if (utf16_lead_surrogate !== null) { + var lead_surrogate = utf16_lead_surrogate; + utf16_lead_surrogate = null; + + // 1. If code unit is in the range U+DC00 to U+DFFF, + // inclusive, return a code point whose value is 0x10000 + + // ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00). + if (inRange(code_unit, 0xDC00, 0xDFFF)) { + return 0x10000 + (lead_surrogate - 0xD800) * 0x400 + + (code_unit - 0xDC00); + } + + // 2. Prepend the sequence resulting of converting code unit + // to bytes using utf-16be decoder flag to stream and return + // error. + stream.prepend(convertCodeUnitToBytes(code_unit, utf16_be)); + return decoderError(fatal); + } + + // 6. If code unit is in the range U+D800 to U+DBFF, inclusive, + // set utf-16 lead surrogate to code unit and return continue. + if (inRange(code_unit, 0xD800, 0xDBFF)) { + utf16_lead_surrogate = code_unit; + return null; + } + + // 7. If code unit is in the range U+DC00 to U+DFFF, inclusive, + // return error. + if (inRange(code_unit, 0xDC00, 0xDFFF)) + return decoderError(fatal); + + // 8. Return code point code unit. + return code_unit; + }; + } + + // 15.2.2 shared utf-16 encoder + /** + * @constructor + * @implements {Encoder} + * @param {boolean} utf16_be True if big-endian, false if little-endian. + * @param {{fatal: boolean}} options + */ + function UTF16Encoder(utf16_be, options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is in the range U+0000 to U+FFFF, inclusive, + // return the sequence resulting of converting code point to + // bytes using utf-16be encoder flag. + if (inRange(code_point, 0x0000, 0xFFFF)) + return convertCodeUnitToBytes(code_point, utf16_be); + + // 3. Let lead be ((code point − 0x10000) >> 10) + 0xD800, + // converted to bytes using utf-16be encoder flag. + var lead = convertCodeUnitToBytes( + ((code_point - 0x10000) >> 10) + 0xD800, utf16_be); + + // 4. Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00, + // converted to bytes using utf-16be encoder flag. + var trail = convertCodeUnitToBytes( + ((code_point - 0x10000) & 0x3FF) + 0xDC00, utf16_be); + + // 5. Return a byte sequence of lead followed by trail. + return lead.concat(trail); + }; + } + + // 15.3 utf-16be + // 15.3.1 utf-16be decoder + /** @param {{fatal: boolean}} options */ + encoders['UTF-16BE'] = function(options) { + return new UTF16Encoder(true, options); + }; + // 15.3.2 utf-16be encoder + /** @param {{fatal: boolean}} options */ + decoders['UTF-16BE'] = function(options) { + return new UTF16Decoder(true, options); + }; + + // 15.4 utf-16le + // 15.4.1 utf-16le decoder + /** @param {{fatal: boolean}} options */ + encoders['UTF-16LE'] = function(options) { + return new UTF16Encoder(false, options); + }; + // 15.4.2 utf-16le encoder + /** @param {{fatal: boolean}} options */ + decoders['UTF-16LE'] = function(options) { + return new UTF16Decoder(false, options); + }; + + // 15.5 x-user-defined + + // 15.5.1 x-user-defined decoder + /** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ + function XUserDefinedDecoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream, return finished. + if (bite === end_of_stream) + return finished; + + // 2. If byte is an ASCII byte, return a code point whose value + // is byte. + if (isASCIIByte(bite)) + return bite; + + // 3. Return a code point whose value is 0xF780 + byte − 0x80. + return 0xF780 + bite - 0x80; + }; + } + + // 15.5.2 x-user-defined encoder + /** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ + function XUserDefinedEncoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1.If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is an ASCII code point, return a byte whose + // value is code point. + if (isASCIICodePoint(code_point)) + return code_point; + + // 3. If code point is in the range U+F780 to U+F7FF, inclusive, + // return a byte whose value is code point − 0xF780 + 0x80. + if (inRange(code_point, 0xF780, 0xF7FF)) + return code_point - 0xF780 + 0x80; + + // 4. Return error with code point. + return encoderError(code_point); + }; + } + + /** @param {{fatal: boolean}} options */ + encoders['x-user-defined'] = function(options) { + return new XUserDefinedEncoder(options); + }; + /** @param {{fatal: boolean}} options */ + decoders['x-user-defined'] = function(options) { + return new XUserDefinedDecoder(options); + }; + + if (!global['TextEncoder']) + global['TextEncoder'] = TextEncoder; + if (!global['TextDecoder']) + global['TextDecoder'] = TextDecoder; + + if ( true && module.exports) { + module.exports = { + TextEncoder: global['TextEncoder'], + TextDecoder: global['TextDecoder'], + EncodingIndexes: global["encoding-indexes"] + }; + } + +// For strict environments where `this` inside the global scope +// is `undefined`, take a pure object instead +}(this || {})); + +/***/ }), + +/***/ 5923: +/***/ (function(module) { + +var r; +module.exports = function rand(len) { + if (!r) + r = new Rand(null); + return r.generate(len); +}; +function Rand(rand) { + this.rand = rand; +} +module.exports.Rand = Rand; +Rand.prototype.generate = function generate(len) { + return this._rand(len); +}; +// Emulate crypto API using randy +Rand.prototype._rand = function _rand(n) { + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = (Math.random() * 256) & 0xff; + return res; +}; + + +/***/ }), + +/***/ 780: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +(function(nacl) { +'use strict'; + +// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. +// Public domain. +// +// Implementation derived from TweetNaCl version 20140427. +// See for details: http://tweetnacl.cr.yp.to/ + +var gf = function(init) { + var i, r = new Float64Array(16); + if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; + return r; +}; + +// Pluggable, initialized in high-level API below. +var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; + +var _0 = new Uint8Array(16); +var _9 = new Uint8Array(32); _9[0] = 9; + +var gf0 = gf(), + gf1 = gf([1]), + _121665 = gf([0xdb41, 1]), + D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), + D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), + X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), + Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), + I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); + +function ts64(x, i, h, l) { + x[i] = (h >> 24) & 0xff; + x[i+1] = (h >> 16) & 0xff; + x[i+2] = (h >> 8) & 0xff; + x[i+3] = h & 0xff; + x[i+4] = (l >> 24) & 0xff; + x[i+5] = (l >> 16) & 0xff; + x[i+6] = (l >> 8) & 0xff; + x[i+7] = l & 0xff; +} + +function vn(x, xi, y, yi, n) { + var i,d = 0; + for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; + return (1 & ((d - 1) >>> 8)) - 1; +} + +function crypto_verify_16(x, xi, y, yi) { + return vn(x,xi,y,yi,16); +} + +function crypto_verify_32(x, xi, y, yi) { + return vn(x,xi,y,yi,32); +} + +function core_salsa20(o, p, k, c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; + + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; + + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); + + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } + x0 = x0 + j0 | 0; + x1 = x1 + j1 | 0; + x2 = x2 + j2 | 0; + x3 = x3 + j3 | 0; + x4 = x4 + j4 | 0; + x5 = x5 + j5 | 0; + x6 = x6 + j6 | 0; + x7 = x7 + j7 | 0; + x8 = x8 + j8 | 0; + x9 = x9 + j9 | 0; + x10 = x10 + j10 | 0; + x11 = x11 + j11 | 0; + x12 = x12 + j12 | 0; + x13 = x13 + j13 | 0; + x14 = x14 + j14 | 0; + x15 = x15 + j15 | 0; + + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; + + o[ 4] = x1 >>> 0 & 0xff; + o[ 5] = x1 >>> 8 & 0xff; + o[ 6] = x1 >>> 16 & 0xff; + o[ 7] = x1 >>> 24 & 0xff; + + o[ 8] = x2 >>> 0 & 0xff; + o[ 9] = x2 >>> 8 & 0xff; + o[10] = x2 >>> 16 & 0xff; + o[11] = x2 >>> 24 & 0xff; + + o[12] = x3 >>> 0 & 0xff; + o[13] = x3 >>> 8 & 0xff; + o[14] = x3 >>> 16 & 0xff; + o[15] = x3 >>> 24 & 0xff; + + o[16] = x4 >>> 0 & 0xff; + o[17] = x4 >>> 8 & 0xff; + o[18] = x4 >>> 16 & 0xff; + o[19] = x4 >>> 24 & 0xff; + + o[20] = x5 >>> 0 & 0xff; + o[21] = x5 >>> 8 & 0xff; + o[22] = x5 >>> 16 & 0xff; + o[23] = x5 >>> 24 & 0xff; + + o[24] = x6 >>> 0 & 0xff; + o[25] = x6 >>> 8 & 0xff; + o[26] = x6 >>> 16 & 0xff; + o[27] = x6 >>> 24 & 0xff; + + o[28] = x7 >>> 0 & 0xff; + o[29] = x7 >>> 8 & 0xff; + o[30] = x7 >>> 16 & 0xff; + o[31] = x7 >>> 24 & 0xff; + + o[32] = x8 >>> 0 & 0xff; + o[33] = x8 >>> 8 & 0xff; + o[34] = x8 >>> 16 & 0xff; + o[35] = x8 >>> 24 & 0xff; + + o[36] = x9 >>> 0 & 0xff; + o[37] = x9 >>> 8 & 0xff; + o[38] = x9 >>> 16 & 0xff; + o[39] = x9 >>> 24 & 0xff; + + o[40] = x10 >>> 0 & 0xff; + o[41] = x10 >>> 8 & 0xff; + o[42] = x10 >>> 16 & 0xff; + o[43] = x10 >>> 24 & 0xff; + + o[44] = x11 >>> 0 & 0xff; + o[45] = x11 >>> 8 & 0xff; + o[46] = x11 >>> 16 & 0xff; + o[47] = x11 >>> 24 & 0xff; + + o[48] = x12 >>> 0 & 0xff; + o[49] = x12 >>> 8 & 0xff; + o[50] = x12 >>> 16 & 0xff; + o[51] = x12 >>> 24 & 0xff; + + o[52] = x13 >>> 0 & 0xff; + o[53] = x13 >>> 8 & 0xff; + o[54] = x13 >>> 16 & 0xff; + o[55] = x13 >>> 24 & 0xff; + + o[56] = x14 >>> 0 & 0xff; + o[57] = x14 >>> 8 & 0xff; + o[58] = x14 >>> 16 & 0xff; + o[59] = x14 >>> 24 & 0xff; + + o[60] = x15 >>> 0 & 0xff; + o[61] = x15 >>> 8 & 0xff; + o[62] = x15 >>> 16 & 0xff; + o[63] = x15 >>> 24 & 0xff; +} + +function core_hsalsa20(o,p,k,c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; + + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; + + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); + + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } + + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; + + o[ 4] = x5 >>> 0 & 0xff; + o[ 5] = x5 >>> 8 & 0xff; + o[ 6] = x5 >>> 16 & 0xff; + o[ 7] = x5 >>> 24 & 0xff; + + o[ 8] = x10 >>> 0 & 0xff; + o[ 9] = x10 >>> 8 & 0xff; + o[10] = x10 >>> 16 & 0xff; + o[11] = x10 >>> 24 & 0xff; + + o[12] = x15 >>> 0 & 0xff; + o[13] = x15 >>> 8 & 0xff; + o[14] = x15 >>> 16 & 0xff; + o[15] = x15 >>> 24 & 0xff; + + o[16] = x6 >>> 0 & 0xff; + o[17] = x6 >>> 8 & 0xff; + o[18] = x6 >>> 16 & 0xff; + o[19] = x6 >>> 24 & 0xff; + + o[20] = x7 >>> 0 & 0xff; + o[21] = x7 >>> 8 & 0xff; + o[22] = x7 >>> 16 & 0xff; + o[23] = x7 >>> 24 & 0xff; + + o[24] = x8 >>> 0 & 0xff; + o[25] = x8 >>> 8 & 0xff; + o[26] = x8 >>> 16 & 0xff; + o[27] = x8 >>> 24 & 0xff; + + o[28] = x9 >>> 0 & 0xff; + o[29] = x9 >>> 8 & 0xff; + o[30] = x9 >>> 16 & 0xff; + o[31] = x9 >>> 24 & 0xff; +} + +function crypto_core_salsa20(out,inp,k,c) { + core_salsa20(out,inp,k,c); +} + +function crypto_core_hsalsa20(out,inp,k,c) { + core_hsalsa20(out,inp,k,c); +} + +var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + // "expand 32-byte k" + +function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + mpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; + } + return 0; +} + +function crypto_stream_salsa20(c,cpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = x[i]; + } + return 0; +} + +function crypto_stream(c,cpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20(c,cpos,d,sn,s); +} + +function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); +} + +/* +* Port of Andrew Moon's Poly1305-donna-16. Public domain. +* https://github.com/floodyberry/poly1305-donna +*/ + +var poly1305 = function(key) { + this.buffer = new Uint8Array(16); + this.r = new Uint16Array(10); + this.h = new Uint16Array(10); + this.pad = new Uint16Array(8); + this.leftover = 0; + this.fin = 0; + + var t0, t1, t2, t3, t4, t5, t6, t7; + + t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; + t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; + t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; + this.r[5] = ((t4 >>> 1)) & 0x1ffe; + t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; + t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + this.r[9] = ((t7 >>> 5)) & 0x007f; + + this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; + this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; + this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; + this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; + this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; + this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; + this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; + this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; +}; + +poly1305.prototype.blocks = function(m, mpos, bytes) { + var hibit = this.fin ? 0 : (1 << 11); + var t0, t1, t2, t3, t4, t5, t6, t7, c; + var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; + + var h0 = this.h[0], + h1 = this.h[1], + h2 = this.h[2], + h3 = this.h[3], + h4 = this.h[4], + h5 = this.h[5], + h6 = this.h[6], + h7 = this.h[7], + h8 = this.h[8], + h9 = this.h[9]; + + var r0 = this.r[0], + r1 = this.r[1], + r2 = this.r[2], + r3 = this.r[3], + r4 = this.r[4], + r5 = this.r[5], + r6 = this.r[6], + r7 = this.r[7], + r8 = this.r[8], + r9 = this.r[9]; + + while (bytes >= 16) { + t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; + t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; + t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; + h5 += ((t4 >>> 1)) & 0x1fff; + t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; + t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + h9 += ((t7 >>> 5)) | hibit; + + c = 0; + + d0 = c; + d0 += h0 * r0; + d0 += h1 * (5 * r9); + d0 += h2 * (5 * r8); + d0 += h3 * (5 * r7); + d0 += h4 * (5 * r6); + c = (d0 >>> 13); d0 &= 0x1fff; + d0 += h5 * (5 * r5); + d0 += h6 * (5 * r4); + d0 += h7 * (5 * r3); + d0 += h8 * (5 * r2); + d0 += h9 * (5 * r1); + c += (d0 >>> 13); d0 &= 0x1fff; + + d1 = c; + d1 += h0 * r1; + d1 += h1 * r0; + d1 += h2 * (5 * r9); + d1 += h3 * (5 * r8); + d1 += h4 * (5 * r7); + c = (d1 >>> 13); d1 &= 0x1fff; + d1 += h5 * (5 * r6); + d1 += h6 * (5 * r5); + d1 += h7 * (5 * r4); + d1 += h8 * (5 * r3); + d1 += h9 * (5 * r2); + c += (d1 >>> 13); d1 &= 0x1fff; + + d2 = c; + d2 += h0 * r2; + d2 += h1 * r1; + d2 += h2 * r0; + d2 += h3 * (5 * r9); + d2 += h4 * (5 * r8); + c = (d2 >>> 13); d2 &= 0x1fff; + d2 += h5 * (5 * r7); + d2 += h6 * (5 * r6); + d2 += h7 * (5 * r5); + d2 += h8 * (5 * r4); + d2 += h9 * (5 * r3); + c += (d2 >>> 13); d2 &= 0x1fff; + + d3 = c; + d3 += h0 * r3; + d3 += h1 * r2; + d3 += h2 * r1; + d3 += h3 * r0; + d3 += h4 * (5 * r9); + c = (d3 >>> 13); d3 &= 0x1fff; + d3 += h5 * (5 * r8); + d3 += h6 * (5 * r7); + d3 += h7 * (5 * r6); + d3 += h8 * (5 * r5); + d3 += h9 * (5 * r4); + c += (d3 >>> 13); d3 &= 0x1fff; + + d4 = c; + d4 += h0 * r4; + d4 += h1 * r3; + d4 += h2 * r2; + d4 += h3 * r1; + d4 += h4 * r0; + c = (d4 >>> 13); d4 &= 0x1fff; + d4 += h5 * (5 * r9); + d4 += h6 * (5 * r8); + d4 += h7 * (5 * r7); + d4 += h8 * (5 * r6); + d4 += h9 * (5 * r5); + c += (d4 >>> 13); d4 &= 0x1fff; + + d5 = c; + d5 += h0 * r5; + d5 += h1 * r4; + d5 += h2 * r3; + d5 += h3 * r2; + d5 += h4 * r1; + c = (d5 >>> 13); d5 &= 0x1fff; + d5 += h5 * r0; + d5 += h6 * (5 * r9); + d5 += h7 * (5 * r8); + d5 += h8 * (5 * r7); + d5 += h9 * (5 * r6); + c += (d5 >>> 13); d5 &= 0x1fff; + + d6 = c; + d6 += h0 * r6; + d6 += h1 * r5; + d6 += h2 * r4; + d6 += h3 * r3; + d6 += h4 * r2; + c = (d6 >>> 13); d6 &= 0x1fff; + d6 += h5 * r1; + d6 += h6 * r0; + d6 += h7 * (5 * r9); + d6 += h8 * (5 * r8); + d6 += h9 * (5 * r7); + c += (d6 >>> 13); d6 &= 0x1fff; + + d7 = c; + d7 += h0 * r7; + d7 += h1 * r6; + d7 += h2 * r5; + d7 += h3 * r4; + d7 += h4 * r3; + c = (d7 >>> 13); d7 &= 0x1fff; + d7 += h5 * r2; + d7 += h6 * r1; + d7 += h7 * r0; + d7 += h8 * (5 * r9); + d7 += h9 * (5 * r8); + c += (d7 >>> 13); d7 &= 0x1fff; + + d8 = c; + d8 += h0 * r8; + d8 += h1 * r7; + d8 += h2 * r6; + d8 += h3 * r5; + d8 += h4 * r4; + c = (d8 >>> 13); d8 &= 0x1fff; + d8 += h5 * r3; + d8 += h6 * r2; + d8 += h7 * r1; + d8 += h8 * r0; + d8 += h9 * (5 * r9); + c += (d8 >>> 13); d8 &= 0x1fff; + + d9 = c; + d9 += h0 * r9; + d9 += h1 * r8; + d9 += h2 * r7; + d9 += h3 * r6; + d9 += h4 * r5; + c = (d9 >>> 13); d9 &= 0x1fff; + d9 += h5 * r4; + d9 += h6 * r3; + d9 += h7 * r2; + d9 += h8 * r1; + d9 += h9 * r0; + c += (d9 >>> 13); d9 &= 0x1fff; + + c = (((c << 2) + c)) | 0; + c = (c + d0) | 0; + d0 = c & 0x1fff; + c = (c >>> 13); + d1 += c; + + h0 = d0; + h1 = d1; + h2 = d2; + h3 = d3; + h4 = d4; + h5 = d5; + h6 = d6; + h7 = d7; + h8 = d8; + h9 = d9; + + mpos += 16; + bytes -= 16; + } + this.h[0] = h0; + this.h[1] = h1; + this.h[2] = h2; + this.h[3] = h3; + this.h[4] = h4; + this.h[5] = h5; + this.h[6] = h6; + this.h[7] = h7; + this.h[8] = h8; + this.h[9] = h9; +}; + +poly1305.prototype.finish = function(mac, macpos) { + var g = new Uint16Array(10); + var c, mask, f, i; + + if (this.leftover) { + i = this.leftover; + this.buffer[i++] = 1; + for (; i < 16; i++) this.buffer[i] = 0; + this.fin = 1; + this.blocks(this.buffer, 0, 16); + } + + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + for (i = 2; i < 10; i++) { + this.h[i] += c; + c = this.h[i] >>> 13; + this.h[i] &= 0x1fff; + } + this.h[0] += (c * 5); + c = this.h[0] >>> 13; + this.h[0] &= 0x1fff; + this.h[1] += c; + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + this.h[2] += c; + + g[0] = this.h[0] + 5; + c = g[0] >>> 13; + g[0] &= 0x1fff; + for (i = 1; i < 10; i++) { + g[i] = this.h[i] + c; + c = g[i] >>> 13; + g[i] &= 0x1fff; + } + g[9] -= (1 << 13); + + mask = (c ^ 1) - 1; + for (i = 0; i < 10; i++) g[i] &= mask; + mask = ~mask; + for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; + + this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; + this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; + this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; + this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; + this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; + this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; + this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; + this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; + + f = this.h[0] + this.pad[0]; + this.h[0] = f & 0xffff; + for (i = 1; i < 8; i++) { + f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; + this.h[i] = f & 0xffff; + } + + mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; + mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; + mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; + mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; + mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; + mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; + mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; + mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; + mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; + mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; + mac[macpos+10] = (this.h[5] >>> 0) & 0xff; + mac[macpos+11] = (this.h[5] >>> 8) & 0xff; + mac[macpos+12] = (this.h[6] >>> 0) & 0xff; + mac[macpos+13] = (this.h[6] >>> 8) & 0xff; + mac[macpos+14] = (this.h[7] >>> 0) & 0xff; + mac[macpos+15] = (this.h[7] >>> 8) & 0xff; +}; + +poly1305.prototype.update = function(m, mpos, bytes) { + var i, want; + + if (this.leftover) { + want = (16 - this.leftover); + if (want > bytes) + want = bytes; + for (i = 0; i < want; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + bytes -= want; + mpos += want; + this.leftover += want; + if (this.leftover < 16) + return; + this.blocks(this.buffer, 0, 16); + this.leftover = 0; + } + + if (bytes >= 16) { + want = bytes - (bytes % 16); + this.blocks(m, mpos, want); + mpos += want; + bytes -= want; + } + + if (bytes) { + for (i = 0; i < bytes; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + this.leftover += bytes; + } +}; + +function crypto_onetimeauth(out, outpos, m, mpos, n, k) { + var s = new poly1305(k); + s.update(m, mpos, n); + s.finish(out, outpos); + return 0; +} + +function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { + var x = new Uint8Array(16); + crypto_onetimeauth(x,0,m,mpos,n,k); + return crypto_verify_16(h,hpos,x,0); +} + +function crypto_secretbox(c,m,d,n,k) { + var i; + if (d < 32) return -1; + crypto_stream_xor(c,0,m,0,d,n,k); + crypto_onetimeauth(c, 16, c, 32, d - 32, c); + for (i = 0; i < 16; i++) c[i] = 0; + return 0; +} + +function crypto_secretbox_open(m,c,d,n,k) { + var i; + var x = new Uint8Array(32); + if (d < 32) return -1; + crypto_stream(x,0,32,n,k); + if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; + crypto_stream_xor(m,0,c,0,d,n,k); + for (i = 0; i < 32; i++) m[i] = 0; + return 0; +} + +function set25519(r, a) { + var i; + for (i = 0; i < 16; i++) r[i] = a[i]|0; +} + +function car25519(o) { + var i, v, c = 1; + for (i = 0; i < 16; i++) { + v = o[i] + c + 65535; + c = Math.floor(v / 65536); + o[i] = v - c * 65536; + } + o[0] += c-1 + 37 * (c-1); +} + +function sel25519(p, q, b) { + var t, c = ~(b-1); + for (var i = 0; i < 16; i++) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; + } +} + +function pack25519(o, n) { + var i, j, b; + var m = gf(), t = gf(); + for (i = 0; i < 16; i++) t[i] = n[i]; + car25519(t); + car25519(t); + car25519(t); + for (j = 0; j < 2; j++) { + m[0] = t[0] - 0xffed; + for (i = 1; i < 15; i++) { + m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); + m[i-1] &= 0xffff; + } + m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); + b = (m[15]>>16) & 1; + m[14] &= 0xffff; + sel25519(t, m, 1-b); + } + for (i = 0; i < 16; i++) { + o[2*i] = t[i] & 0xff; + o[2*i+1] = t[i]>>8; + } +} + +function neq25519(a, b) { + var c = new Uint8Array(32), d = new Uint8Array(32); + pack25519(c, a); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); +} + +function par25519(a) { + var d = new Uint8Array(32); + pack25519(d, a); + return d[0] & 1; +} + +function unpack25519(o, n) { + var i; + for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); + o[15] &= 0x7fff; +} + +function A(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; +} + +function Z(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; +} + +function M(o, a, b) { + var v, c, + t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, + t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, + t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, + t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, + b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3], + b4 = b[4], + b5 = b[5], + b6 = b[6], + b7 = b[7], + b8 = b[8], + b9 = b[9], + b10 = b[10], + b11 = b[11], + b12 = b[12], + b13 = b[13], + b14 = b[14], + b15 = b[15]; + + v = a[0]; + t0 += v * b0; + t1 += v * b1; + t2 += v * b2; + t3 += v * b3; + t4 += v * b4; + t5 += v * b5; + t6 += v * b6; + t7 += v * b7; + t8 += v * b8; + t9 += v * b9; + t10 += v * b10; + t11 += v * b11; + t12 += v * b12; + t13 += v * b13; + t14 += v * b14; + t15 += v * b15; + v = a[1]; + t1 += v * b0; + t2 += v * b1; + t3 += v * b2; + t4 += v * b3; + t5 += v * b4; + t6 += v * b5; + t7 += v * b6; + t8 += v * b7; + t9 += v * b8; + t10 += v * b9; + t11 += v * b10; + t12 += v * b11; + t13 += v * b12; + t14 += v * b13; + t15 += v * b14; + t16 += v * b15; + v = a[2]; + t2 += v * b0; + t3 += v * b1; + t4 += v * b2; + t5 += v * b3; + t6 += v * b4; + t7 += v * b5; + t8 += v * b6; + t9 += v * b7; + t10 += v * b8; + t11 += v * b9; + t12 += v * b10; + t13 += v * b11; + t14 += v * b12; + t15 += v * b13; + t16 += v * b14; + t17 += v * b15; + v = a[3]; + t3 += v * b0; + t4 += v * b1; + t5 += v * b2; + t6 += v * b3; + t7 += v * b4; + t8 += v * b5; + t9 += v * b6; + t10 += v * b7; + t11 += v * b8; + t12 += v * b9; + t13 += v * b10; + t14 += v * b11; + t15 += v * b12; + t16 += v * b13; + t17 += v * b14; + t18 += v * b15; + v = a[4]; + t4 += v * b0; + t5 += v * b1; + t6 += v * b2; + t7 += v * b3; + t8 += v * b4; + t9 += v * b5; + t10 += v * b6; + t11 += v * b7; + t12 += v * b8; + t13 += v * b9; + t14 += v * b10; + t15 += v * b11; + t16 += v * b12; + t17 += v * b13; + t18 += v * b14; + t19 += v * b15; + v = a[5]; + t5 += v * b0; + t6 += v * b1; + t7 += v * b2; + t8 += v * b3; + t9 += v * b4; + t10 += v * b5; + t11 += v * b6; + t12 += v * b7; + t13 += v * b8; + t14 += v * b9; + t15 += v * b10; + t16 += v * b11; + t17 += v * b12; + t18 += v * b13; + t19 += v * b14; + t20 += v * b15; + v = a[6]; + t6 += v * b0; + t7 += v * b1; + t8 += v * b2; + t9 += v * b3; + t10 += v * b4; + t11 += v * b5; + t12 += v * b6; + t13 += v * b7; + t14 += v * b8; + t15 += v * b9; + t16 += v * b10; + t17 += v * b11; + t18 += v * b12; + t19 += v * b13; + t20 += v * b14; + t21 += v * b15; + v = a[7]; + t7 += v * b0; + t8 += v * b1; + t9 += v * b2; + t10 += v * b3; + t11 += v * b4; + t12 += v * b5; + t13 += v * b6; + t14 += v * b7; + t15 += v * b8; + t16 += v * b9; + t17 += v * b10; + t18 += v * b11; + t19 += v * b12; + t20 += v * b13; + t21 += v * b14; + t22 += v * b15; + v = a[8]; + t8 += v * b0; + t9 += v * b1; + t10 += v * b2; + t11 += v * b3; + t12 += v * b4; + t13 += v * b5; + t14 += v * b6; + t15 += v * b7; + t16 += v * b8; + t17 += v * b9; + t18 += v * b10; + t19 += v * b11; + t20 += v * b12; + t21 += v * b13; + t22 += v * b14; + t23 += v * b15; + v = a[9]; + t9 += v * b0; + t10 += v * b1; + t11 += v * b2; + t12 += v * b3; + t13 += v * b4; + t14 += v * b5; + t15 += v * b6; + t16 += v * b7; + t17 += v * b8; + t18 += v * b9; + t19 += v * b10; + t20 += v * b11; + t21 += v * b12; + t22 += v * b13; + t23 += v * b14; + t24 += v * b15; + v = a[10]; + t10 += v * b0; + t11 += v * b1; + t12 += v * b2; + t13 += v * b3; + t14 += v * b4; + t15 += v * b5; + t16 += v * b6; + t17 += v * b7; + t18 += v * b8; + t19 += v * b9; + t20 += v * b10; + t21 += v * b11; + t22 += v * b12; + t23 += v * b13; + t24 += v * b14; + t25 += v * b15; + v = a[11]; + t11 += v * b0; + t12 += v * b1; + t13 += v * b2; + t14 += v * b3; + t15 += v * b4; + t16 += v * b5; + t17 += v * b6; + t18 += v * b7; + t19 += v * b8; + t20 += v * b9; + t21 += v * b10; + t22 += v * b11; + t23 += v * b12; + t24 += v * b13; + t25 += v * b14; + t26 += v * b15; + v = a[12]; + t12 += v * b0; + t13 += v * b1; + t14 += v * b2; + t15 += v * b3; + t16 += v * b4; + t17 += v * b5; + t18 += v * b6; + t19 += v * b7; + t20 += v * b8; + t21 += v * b9; + t22 += v * b10; + t23 += v * b11; + t24 += v * b12; + t25 += v * b13; + t26 += v * b14; + t27 += v * b15; + v = a[13]; + t13 += v * b0; + t14 += v * b1; + t15 += v * b2; + t16 += v * b3; + t17 += v * b4; + t18 += v * b5; + t19 += v * b6; + t20 += v * b7; + t21 += v * b8; + t22 += v * b9; + t23 += v * b10; + t24 += v * b11; + t25 += v * b12; + t26 += v * b13; + t27 += v * b14; + t28 += v * b15; + v = a[14]; + t14 += v * b0; + t15 += v * b1; + t16 += v * b2; + t17 += v * b3; + t18 += v * b4; + t19 += v * b5; + t20 += v * b6; + t21 += v * b7; + t22 += v * b8; + t23 += v * b9; + t24 += v * b10; + t25 += v * b11; + t26 += v * b12; + t27 += v * b13; + t28 += v * b14; + t29 += v * b15; + v = a[15]; + t15 += v * b0; + t16 += v * b1; + t17 += v * b2; + t18 += v * b3; + t19 += v * b4; + t20 += v * b5; + t21 += v * b6; + t22 += v * b7; + t23 += v * b8; + t24 += v * b9; + t25 += v * b10; + t26 += v * b11; + t27 += v * b12; + t28 += v * b13; + t29 += v * b14; + t30 += v * b15; + + t0 += 38 * t16; + t1 += 38 * t17; + t2 += 38 * t18; + t3 += 38 * t19; + t4 += 38 * t20; + t5 += 38 * t21; + t6 += 38 * t22; + t7 += 38 * t23; + t8 += 38 * t24; + t9 += 38 * t25; + t10 += 38 * t26; + t11 += 38 * t27; + t12 += 38 * t28; + t13 += 38 * t29; + t14 += 38 * t30; + // t15 left as is + + // first car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + // second car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + o[ 0] = t0; + o[ 1] = t1; + o[ 2] = t2; + o[ 3] = t3; + o[ 4] = t4; + o[ 5] = t5; + o[ 6] = t6; + o[ 7] = t7; + o[ 8] = t8; + o[ 9] = t9; + o[10] = t10; + o[11] = t11; + o[12] = t12; + o[13] = t13; + o[14] = t14; + o[15] = t15; +} + +function S(o, a) { + M(o, a, a); +} + +function inv25519(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 253; a >= 0; a--) { + S(c, c); + if(a !== 2 && a !== 4) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function pow2523(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 250; a >= 0; a--) { + S(c, c); + if(a !== 1) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function crypto_scalarmult(q, n, p) { + var z = new Uint8Array(32); + var x = new Float64Array(80), r, i; + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(); + for (i = 0; i < 31; i++) z[i] = n[i]; + z[31]=(n[31]&127)|64; + z[0]&=248; + unpack25519(x,p); + for (i = 0; i < 16; i++) { + b[i]=x[i]; + d[i]=a[i]=c[i]=0; + } + a[0]=d[0]=1; + for (i=254; i>=0; --i) { + r=(z[i>>>3]>>>(i&7))&1; + sel25519(a,b,r); + sel25519(c,d,r); + A(e,a,c); + Z(a,a,c); + A(c,b,d); + Z(b,b,d); + S(d,e); + S(f,a); + M(a,c,a); + M(c,b,e); + A(e,a,c); + Z(a,a,c); + S(b,a); + Z(c,d,f); + M(a,c,_121665); + A(a,a,d); + M(c,c,a); + M(a,d,f); + M(d,b,x); + S(b,e); + sel25519(a,b,r); + sel25519(c,d,r); + } + for (i = 0; i < 16; i++) { + x[i+16]=a[i]; + x[i+32]=c[i]; + x[i+48]=b[i]; + x[i+64]=d[i]; + } + var x32 = x.subarray(32); + var x16 = x.subarray(16); + inv25519(x32,x32); + M(x16,x16,x32); + pack25519(q,x16); + return 0; +} + +function crypto_scalarmult_base(q, n) { + return crypto_scalarmult(q, n, _9); +} + +function crypto_box_keypair(y, x) { + randombytes(x, 32); + return crypto_scalarmult_base(y, x); +} + +function crypto_box_beforenm(k, y, x) { + var s = new Uint8Array(32); + crypto_scalarmult(s, x, y); + return crypto_core_hsalsa20(k, _0, s, sigma); +} + +var crypto_box_afternm = crypto_secretbox; +var crypto_box_open_afternm = crypto_secretbox_open; + +function crypto_box(c, m, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_afternm(c, m, d, n, k); +} + +function crypto_box_open(m, c, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_open_afternm(m, c, d, n, k); +} + +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +function crypto_hashblocks_hl(hh, hl, m, n) { + var wh = new Int32Array(16), wl = new Int32Array(16), + bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, + bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, + th, tl, i, j, h, l, a, b, c, d; + + var ah0 = hh[0], + ah1 = hh[1], + ah2 = hh[2], + ah3 = hh[3], + ah4 = hh[4], + ah5 = hh[5], + ah6 = hh[6], + ah7 = hh[7], + + al0 = hl[0], + al1 = hl[1], + al2 = hl[2], + al3 = hl[3], + al4 = hl[4], + al5 = hl[5], + al6 = hl[6], + al7 = hl[7]; + + var pos = 0; + while (n >= 128) { + for (i = 0; i < 16; i++) { + j = 8 * i + pos; + wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; + wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; + } + for (i = 0; i < 80; i++) { + bh0 = ah0; + bh1 = ah1; + bh2 = ah2; + bh3 = ah3; + bh4 = ah4; + bh5 = ah5; + bh6 = ah6; + bh7 = ah7; + + bl0 = al0; + bl1 = al1; + bl2 = al2; + bl3 = al3; + bl4 = al4; + bl5 = al5; + bl6 = al6; + bl7 = al7; + + // add + h = ah7; + l = al7; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + // Sigma1 + h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); + l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // Ch + h = (ah4 & ah5) ^ (~ah4 & ah6); + l = (al4 & al5) ^ (~al4 & al6); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // K + h = K[i*2]; + l = K[i*2+1]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // w + h = wh[i%16]; + l = wl[i%16]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + th = c & 0xffff | d << 16; + tl = a & 0xffff | b << 16; + + // add + h = th; + l = tl; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + // Sigma0 + h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); + l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // Maj + h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); + l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + bh7 = (c & 0xffff) | (d << 16); + bl7 = (a & 0xffff) | (b << 16); + + // add + h = bh3; + l = bl3; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = th; + l = tl; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + bh3 = (c & 0xffff) | (d << 16); + bl3 = (a & 0xffff) | (b << 16); + + ah1 = bh0; + ah2 = bh1; + ah3 = bh2; + ah4 = bh3; + ah5 = bh4; + ah6 = bh5; + ah7 = bh6; + ah0 = bh7; + + al1 = bl0; + al2 = bl1; + al3 = bl2; + al4 = bl3; + al5 = bl4; + al6 = bl5; + al7 = bl6; + al0 = bl7; + + if (i%16 === 15) { + for (j = 0; j < 16; j++) { + // add + h = wh[j]; + l = wl[j]; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = wh[(j+9)%16]; + l = wl[(j+9)%16]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // sigma0 + th = wh[(j+1)%16]; + tl = wl[(j+1)%16]; + h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); + l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // sigma1 + th = wh[(j+14)%16]; + tl = wl[(j+14)%16]; + h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); + l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + wh[j] = (c & 0xffff) | (d << 16); + wl[j] = (a & 0xffff) | (b << 16); + } + } + } + + // add + h = ah0; + l = al0; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[0]; + l = hl[0]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[0] = ah0 = (c & 0xffff) | (d << 16); + hl[0] = al0 = (a & 0xffff) | (b << 16); + + h = ah1; + l = al1; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[1]; + l = hl[1]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[1] = ah1 = (c & 0xffff) | (d << 16); + hl[1] = al1 = (a & 0xffff) | (b << 16); + + h = ah2; + l = al2; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[2]; + l = hl[2]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[2] = ah2 = (c & 0xffff) | (d << 16); + hl[2] = al2 = (a & 0xffff) | (b << 16); + + h = ah3; + l = al3; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[3]; + l = hl[3]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[3] = ah3 = (c & 0xffff) | (d << 16); + hl[3] = al3 = (a & 0xffff) | (b << 16); + + h = ah4; + l = al4; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[4]; + l = hl[4]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[4] = ah4 = (c & 0xffff) | (d << 16); + hl[4] = al4 = (a & 0xffff) | (b << 16); + + h = ah5; + l = al5; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[5]; + l = hl[5]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[5] = ah5 = (c & 0xffff) | (d << 16); + hl[5] = al5 = (a & 0xffff) | (b << 16); + + h = ah6; + l = al6; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[6]; + l = hl[6]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[6] = ah6 = (c & 0xffff) | (d << 16); + hl[6] = al6 = (a & 0xffff) | (b << 16); + + h = ah7; + l = al7; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[7]; + l = hl[7]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[7] = ah7 = (c & 0xffff) | (d << 16); + hl[7] = al7 = (a & 0xffff) | (b << 16); + + pos += 128; + n -= 128; + } + + return n; +} + +function crypto_hash(out, m, n) { + var hh = new Int32Array(8), + hl = new Int32Array(8), + x = new Uint8Array(256), + i, b = n; + + hh[0] = 0x6a09e667; + hh[1] = 0xbb67ae85; + hh[2] = 0x3c6ef372; + hh[3] = 0xa54ff53a; + hh[4] = 0x510e527f; + hh[5] = 0x9b05688c; + hh[6] = 0x1f83d9ab; + hh[7] = 0x5be0cd19; + + hl[0] = 0xf3bcc908; + hl[1] = 0x84caa73b; + hl[2] = 0xfe94f82b; + hl[3] = 0x5f1d36f1; + hl[4] = 0xade682d1; + hl[5] = 0x2b3e6c1f; + hl[6] = 0xfb41bd6b; + hl[7] = 0x137e2179; + + crypto_hashblocks_hl(hh, hl, m, n); + n %= 128; + + for (i = 0; i < n; i++) x[i] = m[b-n+i]; + x[n] = 128; + + n = 256-128*(n<112?1:0); + x[n-9] = 0; + ts64(x, n-8, (b / 0x20000000) | 0, b << 3); + crypto_hashblocks_hl(hh, hl, x, n); + + for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); + + return 0; +} + +function add(p, q) { + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(), + g = gf(), h = gf(), t = gf(); + + Z(a, p[1], p[0]); + Z(t, q[1], q[0]); + M(a, a, t); + A(b, p[0], p[1]); + A(t, q[0], q[1]); + M(b, b, t); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e, b, a); + Z(f, d, c); + A(g, d, c); + A(h, b, a); + + M(p[0], e, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e, h); +} + +function cswap(p, q, b) { + var i; + for (i = 0; i < 4; i++) { + sel25519(p[i], q[i], b); + } +} + +function pack(r, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r, ty); + r[31] ^= par25519(tx) << 7; +} + +function scalarmult(p, q, s) { + var b, i; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for (i = 255; i >= 0; --i) { + b = (s[(i/8)|0] >> (i&7)) & 1; + cswap(p, q, b); + add(q, p); + add(p, p); + cswap(p, q, b); + } +} + +function scalarbase(p, s) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s); +} + +function crypto_sign_keypair(pk, sk, seeded) { + var d = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()]; + var i; + + if (!seeded) randombytes(sk, 32); + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + scalarbase(p, d); + pack(pk, p); + + for (i = 0; i < 32; i++) sk[i+32] = pk[i]; + return 0; +} + +var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); + +function modL(r, x) { + var carry, i, j, k; + for (i = 63; i >= 32; --i) { + carry = 0; + for (j = i - 32, k = i - 12; j < k; ++j) { + x[j] += carry - 16 * x[i] * L[j - (i - 32)]; + carry = Math.floor((x[j] + 128) / 256); + x[j] -= carry * 256; + } + x[j] += carry; + x[i] = 0; + } + carry = 0; + for (j = 0; j < 32; j++) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for (j = 0; j < 32; j++) x[j] -= carry * L[j]; + for (i = 0; i < 32; i++) { + x[i+1] += x[i] >> 8; + r[i] = x[i] & 255; + } +} + +function reduce(r) { + var x = new Float64Array(64), i; + for (i = 0; i < 64; i++) x[i] = r[i]; + for (i = 0; i < 64; i++) r[i] = 0; + modL(r, x); +} + +// Note: difference from C - smlen returned, not passed as argument. +function crypto_sign(sm, m, n, sk) { + var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); + var i, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; + + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + var smlen = n + 64; + for (i = 0; i < n; i++) sm[64 + i] = m[i]; + for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; + + crypto_hash(r, sm.subarray(32), n+32); + reduce(r); + scalarbase(p, r); + pack(sm, p); + + for (i = 32; i < 64; i++) sm[i] = sk[i]; + crypto_hash(h, sm, n + 64); + reduce(h); + + for (i = 0; i < 64; i++) x[i] = 0; + for (i = 0; i < 32; i++) x[i] = r[i]; + for (i = 0; i < 32; i++) { + for (j = 0; j < 32; j++) { + x[i+j] += h[i] * d[j]; + } + } + + modL(sm.subarray(32), x); + return smlen; +} + +function unpackneg(r, p) { + var t = gf(), chk = gf(), num = gf(), + den = gf(), den2 = gf(), den4 = gf(), + den6 = gf(); + + set25519(r[2], gf1); + unpack25519(r[1], p); + S(num, r[1]); + M(den, num, D); + Z(num, num, r[2]); + A(den, r[2], den); + + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t, den6, num); + M(t, t, den); + + pow2523(t, t); + M(t, t, num); + M(t, t, den); + M(t, t, den); + M(r[0], t, den); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) M(r[0], r[0], I); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) return -1; + + if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); + + M(r[3], r[0], r[1]); + return 0; +} + +function crypto_sign_open(m, sm, n, pk) { + var i; + var t = new Uint8Array(32), h = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()], + q = [gf(), gf(), gf(), gf()]; + + if (n < 64) return -1; + + if (unpackneg(q, pk)) return -1; + + for (i = 0; i < n; i++) m[i] = sm[i]; + for (i = 0; i < 32; i++) m[i+32] = pk[i]; + crypto_hash(h, m, n); + reduce(h); + scalarmult(p, q, h); + + scalarbase(q, sm.subarray(32)); + add(p, q); + pack(t, p); + + n -= 64; + if (crypto_verify_32(sm, 0, t, 0)) { + for (i = 0; i < n; i++) m[i] = 0; + return -1; + } + + for (i = 0; i < n; i++) m[i] = sm[i + 64]; + return n; +} + +var crypto_secretbox_KEYBYTES = 32, + crypto_secretbox_NONCEBYTES = 24, + crypto_secretbox_ZEROBYTES = 32, + crypto_secretbox_BOXZEROBYTES = 16, + crypto_scalarmult_BYTES = 32, + crypto_scalarmult_SCALARBYTES = 32, + crypto_box_PUBLICKEYBYTES = 32, + crypto_box_SECRETKEYBYTES = 32, + crypto_box_BEFORENMBYTES = 32, + crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, + crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, + crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, + crypto_sign_BYTES = 64, + crypto_sign_PUBLICKEYBYTES = 32, + crypto_sign_SECRETKEYBYTES = 64, + crypto_sign_SEEDBYTES = 32, + crypto_hash_BYTES = 64; + +nacl.lowlevel = { + crypto_core_hsalsa20: crypto_core_hsalsa20, + crypto_stream_xor: crypto_stream_xor, + crypto_stream: crypto_stream, + crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, + crypto_stream_salsa20: crypto_stream_salsa20, + crypto_onetimeauth: crypto_onetimeauth, + crypto_onetimeauth_verify: crypto_onetimeauth_verify, + crypto_verify_16: crypto_verify_16, + crypto_verify_32: crypto_verify_32, + crypto_secretbox: crypto_secretbox, + crypto_secretbox_open: crypto_secretbox_open, + crypto_scalarmult: crypto_scalarmult, + crypto_scalarmult_base: crypto_scalarmult_base, + crypto_box_beforenm: crypto_box_beforenm, + crypto_box_afternm: crypto_box_afternm, + crypto_box: crypto_box, + crypto_box_open: crypto_box_open, + crypto_box_keypair: crypto_box_keypair, + crypto_hash: crypto_hash, + crypto_sign: crypto_sign, + crypto_sign_keypair: crypto_sign_keypair, + crypto_sign_open: crypto_sign_open, + + crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, + crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, + crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, + crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, + crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, + crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, + crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, + crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, + crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, + crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, + crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, + crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, + crypto_sign_BYTES: crypto_sign_BYTES, + crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, + crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, + crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, + crypto_hash_BYTES: crypto_hash_BYTES, + + gf: gf, + D: D, + L: L, + pack25519: pack25519, + unpack25519: unpack25519, + M: M, + A: A, + S: S, + Z: Z, + pow2523: pow2523, + add: add, + set25519: set25519, + modL: modL, + scalarmult: scalarmult, + scalarbase: scalarbase, +}; + +/* High-level API */ + +function checkLengths(k, n) { + if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); + if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); +} + +function checkBoxLengths(pk, sk) { + if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); + if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); +} + +function checkArrayTypes() { + for (var i = 0; i < arguments.length; i++) { + if (!(arguments[i] instanceof Uint8Array)) + throw new TypeError('unexpected type, use Uint8Array'); + } +} + +function cleanup(arr) { + for (var i = 0; i < arr.length; i++) arr[i] = 0; +} + +nacl.randomBytes = function(n) { + var b = new Uint8Array(n); + randombytes(b, n); + return b; +}; + +nacl.secretbox = function(msg, nonce, key) { + checkArrayTypes(msg, nonce, key); + checkLengths(key, nonce); + var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); + var c = new Uint8Array(m.length); + for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; + crypto_secretbox(c, m, m.length, nonce, key); + return c.subarray(crypto_secretbox_BOXZEROBYTES); +}; + +nacl.secretbox.open = function(box, nonce, key) { + checkArrayTypes(box, nonce, key); + checkLengths(key, nonce); + var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); + var m = new Uint8Array(c.length); + for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; + if (c.length < 32) return null; + if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null; + return m.subarray(crypto_secretbox_ZEROBYTES); +}; + +nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; +nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; +nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; + +nacl.scalarMult = function(n, p) { + checkArrayTypes(n, p); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult(q, n, p); + return q; +}; + +nacl.scalarMult.base = function(n) { + checkArrayTypes(n); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult_base(q, n); + return q; +}; + +nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; +nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; + +nacl.box = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox(msg, nonce, k); +}; + +nacl.box.before = function(publicKey, secretKey) { + checkArrayTypes(publicKey, secretKey); + checkBoxLengths(publicKey, secretKey); + var k = new Uint8Array(crypto_box_BEFORENMBYTES); + crypto_box_beforenm(k, publicKey, secretKey); + return k; +}; + +nacl.box.after = nacl.secretbox; + +nacl.box.open = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox.open(msg, nonce, k); +}; + +nacl.box.open.after = nacl.secretbox.open; + +nacl.box.keyPair = function() { + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); + crypto_box_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.box.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_box_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + crypto_scalarmult_base(pk, secretKey); + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; +nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; +nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; +nacl.box.nonceLength = crypto_box_NONCEBYTES; +nacl.box.overheadLength = nacl.secretbox.overheadLength; + +nacl.sign = function(msg, secretKey) { + checkArrayTypes(msg, secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); + crypto_sign(signedMsg, msg, msg.length, secretKey); + return signedMsg; +}; + +nacl.sign.open = function(signedMsg, publicKey) { + checkArrayTypes(signedMsg, publicKey); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var tmp = new Uint8Array(signedMsg.length); + var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); + if (mlen < 0) return null; + var m = new Uint8Array(mlen); + for (var i = 0; i < m.length; i++) m[i] = tmp[i]; + return m; +}; + +nacl.sign.detached = function(msg, secretKey) { + var signedMsg = nacl.sign(msg, secretKey); + var sig = new Uint8Array(crypto_sign_BYTES); + for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; + return sig; +}; + +nacl.sign.detached.verify = function(msg, sig, publicKey) { + checkArrayTypes(msg, sig, publicKey); + if (sig.length !== crypto_sign_BYTES) + throw new Error('bad signature size'); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var sm = new Uint8Array(crypto_sign_BYTES + msg.length); + var m = new Uint8Array(crypto_sign_BYTES + msg.length); + var i; + for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; + for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; + return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); +}; + +nacl.sign.keyPair = function() { + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + crypto_sign_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.sign.keyPair.fromSeed = function(seed) { + checkArrayTypes(seed); + if (seed.length !== crypto_sign_SEEDBYTES) + throw new Error('bad seed size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + for (var i = 0; i < 32; i++) sk[i] = seed[i]; + crypto_sign_keypair(pk, sk, true); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; +nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; +nacl.sign.seedLength = crypto_sign_SEEDBYTES; +nacl.sign.signatureLength = crypto_sign_BYTES; + +nacl.hash = function(msg) { + checkArrayTypes(msg); + var h = new Uint8Array(crypto_hash_BYTES); + crypto_hash(h, msg, msg.length); + return h; +}; + +nacl.hash.hashLength = crypto_hash_BYTES; + +nacl.verify = function(x, y) { + checkArrayTypes(x, y); + // Zero length arguments are considered not equal. + if (x.length === 0 || y.length === 0) return false; + if (x.length !== y.length) return false; + return (vn(x, 0, y, 0, x.length) === 0) ? true : false; +}; + +nacl.setPRNG = function(fn) { + randombytes = fn; +}; + +(function() { + // Initialize PRNG if environment provides CSPRNG. + // If not, methods calling randombytes will throw. + var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; + if (crypto && crypto.getRandomValues) { + // Browsers. + var QUOTA = 65536; + nacl.setPRNG(function(x, n) { + var i, v = new Uint8Array(n); + for (i = 0; i < n; i += QUOTA) { + crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); + } + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } else if (true) { + // Node.js. + crypto = __webpack_require__(5024); + if (crypto && crypto.randomBytes) { + nacl.setPRNG(function(x, n) { + var i, v = crypto.randomBytes(n); + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } + } +})(); + +})( true && module.exports ? module.exports : (self.nacl = self.nacl || {})); + + +/***/ }), + +/***/ 4927: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!__webpack_require__.g.localStorage) return false; + } catch (_) { + return false; + } + var val = __webpack_require__.g.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + + +/***/ }), + +/***/ 5140: +/***/ (function(__unused_webpack_module, exports) { + +var indexOf = function (xs, item) { + if (xs.indexOf) return xs.indexOf(item); + else for (var i = 0; i < xs.length; i++) { + if (xs[i] === item) return i; + } + return -1; +}; +var Object_keys = function (obj) { + if (Object.keys) return Object.keys(obj) + else { + var res = []; + for (var key in obj) res.push(key) + return res; + } +}; + +var forEach = function (xs, fn) { + if (xs.forEach) return xs.forEach(fn) + else for (var i = 0; i < xs.length; i++) { + fn(xs[i], i, xs); + } +}; + +var defineProp = (function() { + try { + Object.defineProperty({}, '_', {}); + return function(obj, name, value) { + Object.defineProperty(obj, name, { + writable: true, + enumerable: false, + configurable: true, + value: value + }) + }; + } catch(e) { + return function(obj, name, value) { + obj[name] = value; + }; + } +}()); + +var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function', +'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError', +'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError', +'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape', +'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape']; + +function Context() {} +Context.prototype = {}; + +var Script = exports.Script = function NodeScript (code) { + if (!(this instanceof Script)) return new Script(code); + this.code = code; +}; + +Script.prototype.runInContext = function (context) { + if (!(context instanceof Context)) { + throw new TypeError("needs a 'context' argument."); + } + + var iframe = document.createElement('iframe'); + if (!iframe.style) iframe.style = {}; + iframe.style.display = 'none'; + + document.body.appendChild(iframe); + + var win = iframe.contentWindow; + var wEval = win.eval, wExecScript = win.execScript; + + if (!wEval && wExecScript) { + // win.eval() magically appears when this is called in IE: + wExecScript.call(win, 'null'); + wEval = win.eval; + } + + forEach(Object_keys(context), function (key) { + win[key] = context[key]; + }); + forEach(globals, function (key) { + if (context[key]) { + win[key] = context[key]; + } + }); + + var winKeys = Object_keys(win); + + var res = wEval.call(win, this.code); + + forEach(Object_keys(win), function (key) { + // Avoid copying circular objects like `top` and `window` by only + // updating existing context properties or new properties in the `win` + // that was only introduced after the eval. + if (key in context || indexOf(winKeys, key) === -1) { + context[key] = win[key]; + } + }); + + forEach(globals, function (key) { + if (!(key in context)) { + defineProp(context, key, win[key]); + } + }); + + document.body.removeChild(iframe); + + return res; +}; + +Script.prototype.runInThisContext = function () { + return eval(this.code); // maybe... +}; + +Script.prototype.runInNewContext = function (context) { + var ctx = Script.createContext(context); + var res = this.runInContext(ctx); + + if (context) { + forEach(Object_keys(ctx), function (key) { + context[key] = ctx[key]; + }); + } + + return res; +}; + +forEach(Object_keys(Script.prototype), function (name) { + exports[name] = Script[name] = function (code) { + var s = Script(code); + return s[name].apply(s, [].slice.call(arguments, 1)); + }; +}); + +exports.isContext = function (context) { + return context instanceof Context; +}; + +exports.createScript = function (code) { + return exports.Script(code); +}; + +exports.createContext = Script.createContext = function (context) { + var copy = new Context(); + if(typeof context === 'object') { + forEach(Object_keys(context), function (key) { + copy[key] = context[key]; + }); + } + return copy; +}; + + +/***/ }), + +/***/ 8677: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 2808: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 8188: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 6601: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 1922: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 2363: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 1476: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 5819: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 2361: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 4616: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 9862: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 964: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 5024: +/***/ (function() { + +/* (ignored) */ + +/***/ }), + +/***/ 6559: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const format = __webpack_require__(5346) + +module.exports = pino + +const _console = pfGlobalThisOrFallback().console || {} +const stdSerializers = { + mapHttpRequest: mock, + mapHttpResponse: mock, + wrapRequestSerializer: passthrough, + wrapResponseSerializer: passthrough, + wrapErrorSerializer: passthrough, + req: mock, + res: mock, + err: asErrValue, + errWithCause: asErrValue +} +function levelToValue (level, logger) { + return level === 'silent' + ? Infinity + : logger.levels.values[level] +} +const baseLogFunctionSymbol = Symbol('pino.logFuncs') +const hierarchySymbol = Symbol('pino.hierarchy') + +const logFallbackMap = { + error: 'log', + fatal: 'error', + warn: 'error', + info: 'log', + debug: 'log', + trace: 'log' +} + +function appendChildLogger (parentLogger, childLogger) { + const newEntry = { + logger: childLogger, + parent: parentLogger[hierarchySymbol] + } + childLogger[hierarchySymbol] = newEntry +} + +function setupBaseLogFunctions (logger, levels, proto) { + const logFunctions = {} + levels.forEach(level => { + logFunctions[level] = proto[level] ? proto[level] : (_console[level] || _console[logFallbackMap[level] || 'log'] || noop) + }) + logger[baseLogFunctionSymbol] = logFunctions +} + +function shouldSerialize (serialize, serializers) { + if (Array.isArray(serialize)) { + const hasToFilter = serialize.filter(function (k) { + return k !== '!stdSerializers.err' + }) + return hasToFilter + } else if (serialize === true) { + return Object.keys(serializers) + } + + return false +} + +function pino (opts) { + opts = opts || {} + opts.browser = opts.browser || {} + + const transmit = opts.browser.transmit + if (transmit && typeof transmit.send !== 'function') { throw Error('pino: transmit option must have a send function') } + + const proto = opts.browser.write || _console + if (opts.browser.write) opts.browser.asObject = true + const serializers = opts.serializers || {} + const serialize = shouldSerialize(opts.browser.serialize, serializers) + let stdErrSerialize = opts.browser.serialize + + if ( + Array.isArray(opts.browser.serialize) && + opts.browser.serialize.indexOf('!stdSerializers.err') > -1 + ) stdErrSerialize = false + + const customLevels = Object.keys(opts.customLevels || {}) + const levels = ['error', 'fatal', 'warn', 'info', 'debug', 'trace'].concat(customLevels) + + if (typeof proto === 'function') { + levels.forEach(function (level) { + proto[level] = proto + }) + } + if (opts.enabled === false || opts.browser.disabled) opts.level = 'silent' + const level = opts.level || 'info' + const logger = Object.create(proto) + if (!logger.log) logger.log = noop + + setupBaseLogFunctions(logger, levels, proto) + // setup root hierarchy entry + appendChildLogger({}, logger) + + Object.defineProperty(logger, 'levelVal', { + get: getLevelVal + }) + Object.defineProperty(logger, 'level', { + get: getLevel, + set: setLevel + }) + + const setOpts = { + transmit, + serialize, + asObject: opts.browser.asObject, + formatters: opts.browser.formatters, + levels, + timestamp: getTimeFunction(opts) + } + logger.levels = getLevels(opts) + logger.level = level + + logger.setMaxListeners = logger.getMaxListeners = + logger.emit = logger.addListener = logger.on = + logger.prependListener = logger.once = + logger.prependOnceListener = logger.removeListener = + logger.removeAllListeners = logger.listeners = + logger.listenerCount = logger.eventNames = + logger.write = logger.flush = noop + logger.serializers = serializers + logger._serialize = serialize + logger._stdErrSerialize = stdErrSerialize + logger.child = child + + if (transmit) logger._logEvent = createLogEventShape() + + function getLevelVal () { + return levelToValue(this.level, this) + } + + function getLevel () { + return this._level + } + function setLevel (level) { + if (level !== 'silent' && !this.levels.values[level]) { + throw Error('unknown level ' + level) + } + this._level = level + + set(this, setOpts, logger, 'error') // <-- must stay first + set(this, setOpts, logger, 'fatal') + set(this, setOpts, logger, 'warn') + set(this, setOpts, logger, 'info') + set(this, setOpts, logger, 'debug') + set(this, setOpts, logger, 'trace') + + customLevels.forEach((level) => { + set(this, setOpts, logger, level) + }) + } + + function child (bindings, childOptions) { + if (!bindings) { + throw new Error('missing bindings for child Pino') + } + childOptions = childOptions || {} + if (serialize && bindings.serializers) { + childOptions.serializers = bindings.serializers + } + const childOptionsSerializers = childOptions.serializers + if (serialize && childOptionsSerializers) { + var childSerializers = Object.assign({}, serializers, childOptionsSerializers) + var childSerialize = opts.browser.serialize === true + ? Object.keys(childSerializers) + : serialize + delete bindings.serializers + applySerializers([bindings], childSerialize, childSerializers, this._stdErrSerialize) + } + function Child (parent) { + this._childLevel = (parent._childLevel | 0) + 1 + + // make sure bindings are available in the `set` function + this.bindings = bindings + + if (childSerializers) { + this.serializers = childSerializers + this._serialize = childSerialize + } + if (transmit) { + this._logEvent = createLogEventShape( + [].concat(parent._logEvent.bindings, bindings) + ) + } + } + Child.prototype = this + const newLogger = new Child(this) + + // must happen before the level is assigned + appendChildLogger(this, newLogger) + // required to actually initialize the logger functions for any given child + newLogger.level = this.level + + return newLogger + } + return logger +} + +function getLevels (opts) { + const customLevels = opts.customLevels || {} + + const values = Object.assign({}, pino.levels.values, customLevels) + const labels = Object.assign({}, pino.levels.labels, invertObject(customLevels)) + + return { + values, + labels + } +} + +function invertObject (obj) { + const inverted = {} + Object.keys(obj).forEach(function (key) { + inverted[obj[key]] = key + }) + return inverted +} + +pino.levels = { + values: { + fatal: 60, + error: 50, + warn: 40, + info: 30, + debug: 20, + trace: 10 + }, + labels: { + 10: 'trace', + 20: 'debug', + 30: 'info', + 40: 'warn', + 50: 'error', + 60: 'fatal' + } +} + +pino.stdSerializers = stdSerializers +pino.stdTimeFunctions = Object.assign({}, { nullTime, epochTime, unixTime, isoTime }) + +function getBindingChain (logger) { + const bindings = [] + if (logger.bindings) { + bindings.push(logger.bindings) + } + + // traverse up the tree to get all bindings + let hierarchy = logger[hierarchySymbol] + while (hierarchy.parent) { + hierarchy = hierarchy.parent + if (hierarchy.logger.bindings) { + bindings.push(hierarchy.logger.bindings) + } + } + + return bindings.reverse() +} + +function set (self, opts, rootLogger, level) { + // override the current log functions with either `noop` or the base log function + Object.defineProperty(self, level, { + value: (levelToValue(self.level, rootLogger) > levelToValue(level, rootLogger) + ? noop + : rootLogger[baseLogFunctionSymbol][level]), + writable: true, + enumerable: true, + configurable: true + }) + + if (!opts.transmit && self[level] === noop) { + return + } + + // make sure the log format is correct + self[level] = createWrap(self, opts, rootLogger, level) + + // prepend bindings if it is not the root logger + const bindings = getBindingChain(self) + if (bindings.length === 0) { + // early exit in case for rootLogger + return + } + self[level] = prependBindingsInArguments(bindings, self[level]) +} + +function prependBindingsInArguments (bindings, logFunc) { + return function () { + return logFunc.apply(this, [...bindings, ...arguments]) + } +} + +function createWrap (self, opts, rootLogger, level) { + return (function (write) { + return function LOG () { + const ts = opts.timestamp() + const args = new Array(arguments.length) + const proto = (Object.getPrototypeOf && Object.getPrototypeOf(this) === _console) ? _console : this + for (var i = 0; i < args.length; i++) args[i] = arguments[i] + + if (opts.serialize && !opts.asObject) { + applySerializers(args, this._serialize, this.serializers, this._stdErrSerialize) + } + if (opts.asObject || opts.formatters) { + write.call(proto, asObject(this, level, args, ts, opts.formatters)) + } else write.apply(proto, args) + + if (opts.transmit) { + const transmitLevel = opts.transmit.level || self._level + const transmitValue = rootLogger.levels.values[transmitLevel] + const methodValue = rootLogger.levels.values[level] + if (methodValue < transmitValue) return + transmit(this, { + ts, + methodLevel: level, + methodValue, + transmitLevel, + transmitValue: rootLogger.levels.values[opts.transmit.level || self._level], + send: opts.transmit.send, + val: levelToValue(self._level, rootLogger) + }, args) + } + } + })(self[baseLogFunctionSymbol][level]) +} + +function asObject (logger, level, args, ts, formatters = {}) { + const { + level: levelFormatter = () => logger.levels.values[level], + log: logObjectFormatter = (obj) => obj + } = formatters + if (logger._serialize) applySerializers(args, logger._serialize, logger.serializers, logger._stdErrSerialize) + const argsCloned = args.slice() + let msg = argsCloned[0] + const logObject = {} + if (ts) { + logObject.time = ts + } + logObject.level = levelFormatter(level, logger.levels.values[level]) + + let lvl = (logger._childLevel | 0) + 1 + if (lvl < 1) lvl = 1 + // deliberate, catching objects, arrays + if (msg !== null && typeof msg === 'object') { + while (lvl-- && typeof argsCloned[0] === 'object') { + Object.assign(logObject, argsCloned.shift()) + } + msg = argsCloned.length ? format(argsCloned.shift(), argsCloned) : undefined + } else if (typeof msg === 'string') msg = format(argsCloned.shift(), argsCloned) + if (msg !== undefined) logObject.msg = msg + + const formattedLogObject = logObjectFormatter(logObject) + return formattedLogObject +} + +function applySerializers (args, serialize, serializers, stdErrSerialize) { + for (const i in args) { + if (stdErrSerialize && args[i] instanceof Error) { + args[i] = pino.stdSerializers.err(args[i]) + } else if (typeof args[i] === 'object' && !Array.isArray(args[i])) { + for (const k in args[i]) { + if (serialize && serialize.indexOf(k) > -1 && k in serializers) { + args[i][k] = serializers[k](args[i][k]) + } + } + } + } +} + +function transmit (logger, opts, args) { + const send = opts.send + const ts = opts.ts + const methodLevel = opts.methodLevel + const methodValue = opts.methodValue + const val = opts.val + const bindings = logger._logEvent.bindings + + applySerializers( + args, + logger._serialize || Object.keys(logger.serializers), + logger.serializers, + logger._stdErrSerialize === undefined ? true : logger._stdErrSerialize + ) + logger._logEvent.ts = ts + logger._logEvent.messages = args.filter(function (arg) { + // bindings can only be objects, so reference equality check via indexOf is fine + return bindings.indexOf(arg) === -1 + }) + + logger._logEvent.level.label = methodLevel + logger._logEvent.level.value = methodValue + + send(methodLevel, logger._logEvent, val) + + logger._logEvent = createLogEventShape(bindings) +} + +function createLogEventShape (bindings) { + return { + ts: 0, + messages: [], + bindings: bindings || [], + level: { label: '', value: 0 } + } +} + +function asErrValue (err) { + const obj = { + type: err.constructor.name, + msg: err.message, + stack: err.stack + } + for (const key in err) { + if (obj[key] === undefined) { + obj[key] = err[key] + } + } + return obj +} + +function getTimeFunction (opts) { + if (typeof opts.timestamp === 'function') { + return opts.timestamp + } + if (opts.timestamp === false) { + return nullTime + } + return epochTime +} + +function mock () { return {} } +function passthrough (a) { return a } +function noop () {} + +function nullTime () { return false } +function epochTime () { return Date.now() } +function unixTime () { return Math.round(Date.now() / 1000.0) } +function isoTime () { return new Date(Date.now()).toISOString() } // using Date.now() for testability + +/* eslint-disable */ +/* istanbul ignore next */ +function pfGlobalThisOrFallback () { + function defd (o) { return typeof o !== 'undefined' && o } + try { + if (typeof globalThis !== 'undefined') return globalThis + Object.defineProperty(Object.prototype, 'globalThis', { + get: function () { + delete Object.prototype.globalThis + return (this.globalThis = this) + }, + configurable: true + }) + return globalThis + } catch (e) { + return defd(self) || defd(window) || defd(this) || {} + } +} +/* eslint-enable */ + +module.exports["default"] = pino +module.exports.pino = pino + + +/***/ }), + +/***/ 4946: +/***/ (function(module) { + +"use strict"; +module.exports = JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}'); + +/***/ }), + +/***/ 5207: +/***/ (function(module) { + +"use strict"; +module.exports = JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}'); + +/***/ }), + +/***/ 1308: +/***/ (function(module) { + +"use strict"; +module.exports = JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}'); + +/***/ }), + +/***/ 5341: +/***/ (function(module) { + +"use strict"; +module.exports = {"i8":"6.5.7"}; + +/***/ }), + +/***/ 9799: +/***/ (function(module) { + +"use strict"; +module.exports = JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}'); + +/***/ }), + +/***/ 8597: +/***/ (function(module) { + +"use strict"; +module.exports = {"i8":"6.5.4"}; + +/***/ }), + +/***/ 2562: +/***/ (function(module) { + +"use strict"; +module.exports = JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ loaded: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/amd options */ +/******/ !function() { +/******/ __webpack_require__.amdO = {}; +/******/ }(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/create fake namespace object */ +/******/ !function() { +/******/ var getProto = Object.getPrototypeOf ? function(obj) { return Object.getPrototypeOf(obj); } : function(obj) { return obj.__proto__; }; +/******/ var leafPrototypes; +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 16: return value when it's Promise-like +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = this(value); +/******/ if(mode & 8) return value; +/******/ if(typeof value === 'object' && value) { +/******/ if((mode & 4) && value.__esModule) return value; +/******/ if((mode & 16) && typeof value.then === 'function') return value; +/******/ } +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ var def = {}; +/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; +/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { +/******/ Object.getOwnPropertyNames(current).forEach(function(key) { def[key] = function() { return value[key]; }; }); +/******/ } +/******/ def['default'] = function() { return value; }; +/******/ __webpack_require__.d(ns, def); +/******/ return ns; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/global */ +/******/ !function() { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/node module decorator */ +/******/ !function() { +/******/ __webpack_require__.nmd = function(module) { +/******/ module.paths = []; +/******/ if (!module.children) module.children = []; +/******/ return module; +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +!function() { +"use strict"; +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "BladeUnitySDK": function() { return /* binding */ BladeUnitySDK; } +}); + +// NAMESPACE OBJECT: ./node_modules/axios/lib/platform/common/utils.js +var common_utils_namespaceObject = {}; +__webpack_require__.r(common_utils_namespaceObject); +__webpack_require__.d(common_utils_namespaceObject, { + "hasBrowserEnv": function() { return hasBrowserEnv; }, + "hasStandardBrowserEnv": function() { return hasStandardBrowserEnv; }, + "hasStandardBrowserWebWorkerEnv": function() { return hasStandardBrowserWebWorkerEnv; }, + "navigator": function() { return _navigator; }, + "origin": function() { return origin; } +}); + +// EXTERNAL MODULE: ./node_modules/buffer/index.js +var node_modules_buffer = __webpack_require__(8764); +// EXTERNAL MODULE: ./node_modules/text-encoding/index.js +var text_encoding = __webpack_require__(8731); +// EXTERNAL MODULE: ./node_modules/long/src/long.js +var src_long = __webpack_require__(3720); +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @type {string[]} + */ +const byteToHex = []; + +for (let n = 0; n <= 0xff; n += 1) { + byteToHex.push(n.toString(16).padStart(2, "0")); +} + +/** + * @param {Uint8Array} data + * @returns {string} + */ +function hex_browser_encode(data) { + let string = ""; + + for (const byte of data) { + string += byteToHex[byte]; + } + + return string; +} + +/** + * @param {string} text + * @returns {Uint8Array} + */ +function decode(text) { + const str = text.startsWith("0x") ? text.substring(2) : text; + const result = str.match(/.{1,2}/gu); + + return new Uint8Array( + (result == null ? [] : result).map((byte) => parseInt(byte, 16)), + ); +} + +/** + * Encode with a specified length. Supports zero padding if the most significant byte is 0 + * + * https://github.com/ethers-io/ethers.js/blob/master/packages/bytes/src.ts/index.ts#L315 + * + * @param {Uint8Array} value + * @param {number} length + * @returns {string} + */ +function hexZeroPadded(value, length) { + const HexCharacters = "0123456789abcdef"; + + // https://github.com/ethers-io/ethers.js/blob/master/packages/bytes/src.ts/index.ts#L243 + let result = "0x"; + for (let i = 0; i < value.length; i++) { + let v = value[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + + // https://github.com/ethers-io/ethers.js/blob/master/packages/bytes/src.ts/index.ts#L315 + if (result.length > 2 * length + 2) { + console.log("result out of range", "result"); + } + + while (result.length < 2 * length + 2) { + result = "0x0" + result.substring(2); + } + + return result.substring(2); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/BadEntityIdError.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +class BadEntityIdError extends Error { + /** + * @param {Long} shard + * @param {Long} realm + * @param {Long} num + * @param {string} presentChecksum + * @param {string} expectedChecksum + */ + constructor(shard, realm, num, presentChecksum, expectedChecksum) { + super( + `Entity ID ${shard.toString()}.${realm.toString()}.${num.toString()}-${presentChecksum} was incorrect.`, + ); + + this.name = "BadEntityIdException"; + + this.shard = shard; + this.realm = realm; + this.num = num; + this.presentChecksum = presentChecksum; + this.expectedChecksum = expectedChecksum; + } +} + +;// CONCATENATED MODULE: ./node_modules/bignumber.js/bignumber.mjs +/* + * bignumber.js v9.1.2 + * A JavaScript library for arbitrary-precision arithmetic. + * https://github.com/MikeMcl/bignumber.js + * Copyright (c) 2022 Michael Mclaughlin + * MIT Licensed. + * + * BigNumber.prototype methods | BigNumber methods + * | + * absoluteValue abs | clone + * comparedTo | config set + * decimalPlaces dp | DECIMAL_PLACES + * dividedBy div | ROUNDING_MODE + * dividedToIntegerBy idiv | EXPONENTIAL_AT + * exponentiatedBy pow | RANGE + * integerValue | CRYPTO + * isEqualTo eq | MODULO_MODE + * isFinite | POW_PRECISION + * isGreaterThan gt | FORMAT + * isGreaterThanOrEqualTo gte | ALPHABET + * isInteger | isBigNumber + * isLessThan lt | maximum max + * isLessThanOrEqualTo lte | minimum min + * isNaN | random + * isNegative | sum + * isPositive | + * isZero | + * minus | + * modulo mod | + * multipliedBy times | + * negated | + * plus | + * precision sd | + * shiftedBy | + * squareRoot sqrt | + * toExponential | + * toFixed | + * toFormat | + * toFraction | + * toJSON | + * toNumber | + * toPrecision | + * toString | + * valueOf | + * + */ + + +var + isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, + mathceil = Math.ceil, + mathfloor = Math.floor, + + bignumberError = '[BigNumber Error] ', + tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ', + + BASE = 1e14, + LOG_BASE = 14, + MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 + // MAX_INT32 = 0x7fffffff, // 2^31 - 1 + POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], + SQRT_BASE = 1e7, + + // EDITABLE + // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and + // the arguments to toExponential, toFixed, toFormat, and toPrecision. + MAX = 1E9; // 0 to MAX_INT32 + + +/* + * Create and return a BigNumber constructor. + */ +function clone(configObject) { + var div, convertBase, parseNumeric, + P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null }, + ONE = new BigNumber(1), + + + //----------------------------- EDITABLE CONFIG DEFAULTS ------------------------------- + + + // The default values below must be integers within the inclusive ranges stated. + // The values can also be changed at run-time using BigNumber.set. + + // The maximum number of decimal places for operations involving division. + DECIMAL_PLACES = 20, // 0 to MAX + + // The rounding mode used when rounding to the above decimal places, and when using + // toExponential, toFixed, toFormat and toPrecision, and round (default value). + // UP 0 Away from zero. + // DOWN 1 Towards zero. + // CEIL 2 Towards +Infinity. + // FLOOR 3 Towards -Infinity. + // HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + ROUNDING_MODE = 4, // 0 to 8 + + // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] + + // The exponent value at and beneath which toString returns exponential notation. + // Number type: -7 + TO_EXP_NEG = -7, // 0 to -MAX + + // The exponent value at and above which toString returns exponential notation. + // Number type: 21 + TO_EXP_POS = 21, // 0 to MAX + + // RANGE : [MIN_EXP, MAX_EXP] + + // The minimum exponent value, beneath which underflow to zero occurs. + // Number type: -324 (5e-324) + MIN_EXP = -1e7, // -1 to -MAX + + // The maximum exponent value, above which overflow to Infinity occurs. + // Number type: 308 (1.7976931348623157e+308) + // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. + MAX_EXP = 1e7, // 1 to MAX + + // Whether to use cryptographically-secure random number generation, if available. + CRYPTO = false, // true or false + + // The modulo mode used when calculating the modulus: a mod n. + // The quotient (q = a / n) is calculated according to the corresponding rounding mode. + // The remainder (r) is calculated as: r = a - n * q. + // + // UP 0 The remainder is positive if the dividend is negative, else is negative. + // DOWN 1 The remainder has the same sign as the dividend. + // This modulo mode is commonly known as 'truncated division' and is + // equivalent to (a % n) in JavaScript. + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). + // The remainder is always positive. + // + // The truncated division, floored division, Euclidian division and IEEE 754 remainder + // modes are commonly used for the modulus operation. + // Although the other rounding modes can also be used, they may not give useful results. + MODULO_MODE = 1, // 0 to 9 + + // The maximum number of significant digits of the result of the exponentiatedBy operation. + // If POW_PRECISION is 0, there will be unlimited significant digits. + POW_PRECISION = 0, // 0 to MAX + + // The format specification used by the BigNumber.prototype.toFormat method. + FORMAT = { + prefix: '', + groupSize: 3, + secondaryGroupSize: 0, + groupSeparator: ',', + decimalSeparator: '.', + fractionGroupSize: 0, + fractionGroupSeparator: '\xA0', // non-breaking space + suffix: '' + }, + + // The alphabet used for base conversion. It must be at least 2 characters long, with no '+', + // '-', '.', whitespace, or repeated character. + // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' + ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz', + alphabetHasNormalDecimalDigits = true; + + + //------------------------------------------------------------------------------------------ + + + // CONSTRUCTOR + + + /* + * The BigNumber constructor and exported function. + * Create and return a new instance of a BigNumber object. + * + * v {number|string|BigNumber} A numeric value. + * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive. + */ + function BigNumber(v, b) { + var alphabet, c, caseChanged, e, i, isNum, len, str, + x = this; + + // Enable constructor call without `new`. + if (!(x instanceof BigNumber)) return new BigNumber(v, b); + + if (b == null) { + + if (v && v._isBigNumber === true) { + x.s = v.s; + + if (!v.c || v.e > MAX_EXP) { + x.c = x.e = null; + } else if (v.e < MIN_EXP) { + x.c = [x.e = 0]; + } else { + x.e = v.e; + x.c = v.c.slice(); + } + + return; + } + + if ((isNum = typeof v == 'number') && v * 0 == 0) { + + // Use `1 / n` to handle minus zero also. + x.s = 1 / v < 0 ? (v = -v, -1) : 1; + + // Fast path for integers, where n < 2147483648 (2**31). + if (v === ~~v) { + for (e = 0, i = v; i >= 10; i /= 10, e++); + + if (e > MAX_EXP) { + x.c = x.e = null; + } else { + x.e = e; + x.c = [v]; + } + + return; + } + + str = String(v); + } else { + + if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum); + + x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; + } + + // Decimal point? + if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); + + // Exponential form? + if ((i = str.search(/e/i)) > 0) { + + // Determine exponent. + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + + // Integer. + e = str.length; + } + + } else { + + // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' + intCheck(b, 2, ALPHABET.length, 'Base'); + + // Allow exponential notation to be used with base 10 argument, while + // also rounding to DECIMAL_PLACES as with other bases. + if (b == 10 && alphabetHasNormalDecimalDigits) { + x = new BigNumber(v); + return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); + } + + str = String(v); + + if (isNum = typeof v == 'number') { + + // Avoid potential interpretation of Infinity and NaN as base 44+ values. + if (v * 0 != 0) return parseNumeric(x, str, isNum, b); + + x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; + + // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' + if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) { + throw Error + (tooManyDigits + v); + } + } else { + x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; + } + + alphabet = ALPHABET.slice(0, b); + e = i = 0; + + // Check that str is a valid base b number. + // Don't use RegExp, so alphabet can contain special characters. + for (len = str.length; i < len; i++) { + if (alphabet.indexOf(c = str.charAt(i)) < 0) { + if (c == '.') { + + // If '.' is not the first character and it has not be found before. + if (i > e) { + e = len; + continue; + } + } else if (!caseChanged) { + + // Allow e.g. hexadecimal 'FF' as well as 'ff'. + if (str == str.toUpperCase() && (str = str.toLowerCase()) || + str == str.toLowerCase() && (str = str.toUpperCase())) { + caseChanged = true; + i = -1; + e = 0; + continue; + } + } + + return parseNumeric(x, String(v), isNum, b); + } + } + + // Prevent later check for length on converted number. + isNum = false; + str = convertBase(str, b, 10, x.s); + + // Decimal point? + if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); + else e = str.length; + } + + // Determine leading zeros. + for (i = 0; str.charCodeAt(i) === 48; i++); + + // Determine trailing zeros. + for (len = str.length; str.charCodeAt(--len) === 48;); + + if (str = str.slice(i, ++len)) { + len -= i; + + // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' + if (isNum && BigNumber.DEBUG && + len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { + throw Error + (tooManyDigits + (x.s * v)); + } + + // Overflow? + if ((e = e - i - 1) > MAX_EXP) { + + // Infinity. + x.c = x.e = null; + + // Underflow? + } else if (e < MIN_EXP) { + + // Zero. + x.c = [x.e = 0]; + } else { + x.e = e; + x.c = []; + + // Transform base + + // e is the base 10 exponent. + // i is where to slice str to get the first element of the coefficient array. + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; // i < 1 + + if (i < len) { + if (i) x.c.push(+str.slice(0, i)); + + for (len -= LOG_BASE; i < len;) { + x.c.push(+str.slice(i, i += LOG_BASE)); + } + + i = LOG_BASE - (str = str.slice(i)).length; + } else { + i -= len; + } + + for (; i--; str += '0'); + x.c.push(+str); + } + } else { + + // Zero. + x.c = [x.e = 0]; + } + } + + + // CONSTRUCTOR PROPERTIES + + + BigNumber.clone = clone; + + BigNumber.ROUND_UP = 0; + BigNumber.ROUND_DOWN = 1; + BigNumber.ROUND_CEIL = 2; + BigNumber.ROUND_FLOOR = 3; + BigNumber.ROUND_HALF_UP = 4; + BigNumber.ROUND_HALF_DOWN = 5; + BigNumber.ROUND_HALF_EVEN = 6; + BigNumber.ROUND_HALF_CEIL = 7; + BigNumber.ROUND_HALF_FLOOR = 8; + BigNumber.EUCLID = 9; + + + /* + * Configure infrequently-changing library-wide settings. + * + * Accept an object with the following optional properties (if the value of a property is + * a number, it must be an integer within the inclusive range stated): + * + * DECIMAL_PLACES {number} 0 to MAX + * ROUNDING_MODE {number} 0 to 8 + * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX] + * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX] + * CRYPTO {boolean} true or false + * MODULO_MODE {number} 0 to 9 + * POW_PRECISION {number} 0 to MAX + * ALPHABET {string} A string of two or more unique characters which does + * not contain '.'. + * FORMAT {object} An object with some of the following properties: + * prefix {string} + * groupSize {number} + * secondaryGroupSize {number} + * groupSeparator {string} + * decimalSeparator {string} + * fractionGroupSize {number} + * fractionGroupSeparator {string} + * suffix {string} + * + * (The values assigned to the above FORMAT object properties are not checked for validity.) + * + * E.g. + * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) + * + * Ignore properties/parameters set to null or undefined, except for ALPHABET. + * + * Return an object with the properties current values. + */ + BigNumber.config = BigNumber.set = function (obj) { + var p, v; + + if (obj != null) { + + if (typeof obj == 'object') { + + // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. + // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) { + v = obj[p]; + intCheck(v, 0, MAX, p); + DECIMAL_PLACES = v; + } + + // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. + // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) { + v = obj[p]; + intCheck(v, 0, 8, p); + ROUNDING_MODE = v; + } + + // EXPONENTIAL_AT {number|number[]} + // Integer, -MAX to MAX inclusive or + // [integer -MAX to 0 inclusive, 0 to MAX inclusive]. + // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) { + v = obj[p]; + if (v && v.pop) { + intCheck(v[0], -MAX, 0, p); + intCheck(v[1], 0, MAX, p); + TO_EXP_NEG = v[0]; + TO_EXP_POS = v[1]; + } else { + intCheck(v, -MAX, MAX, p); + TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); + } + } + + // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or + // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. + // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}' + if (obj.hasOwnProperty(p = 'RANGE')) { + v = obj[p]; + if (v && v.pop) { + intCheck(v[0], -MAX, -1, p); + intCheck(v[1], 1, MAX, p); + MIN_EXP = v[0]; + MAX_EXP = v[1]; + } else { + intCheck(v, -MAX, MAX, p); + if (v) { + MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); + } else { + throw Error + (bignumberError + p + ' cannot be zero: ' + v); + } + } + } + + // CRYPTO {boolean} true or false. + // '[BigNumber Error] CRYPTO not true or false: {v}' + // '[BigNumber Error] crypto unavailable' + if (obj.hasOwnProperty(p = 'CRYPTO')) { + v = obj[p]; + if (v === !!v) { + if (v) { + if (typeof crypto != 'undefined' && crypto && + (crypto.getRandomValues || crypto.randomBytes)) { + CRYPTO = v; + } else { + CRYPTO = !v; + throw Error + (bignumberError + 'crypto unavailable'); + } + } else { + CRYPTO = v; + } + } else { + throw Error + (bignumberError + p + ' not true or false: ' + v); + } + } + + // MODULO_MODE {number} Integer, 0 to 9 inclusive. + // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'MODULO_MODE')) { + v = obj[p]; + intCheck(v, 0, 9, p); + MODULO_MODE = v; + } + + // POW_PRECISION {number} Integer, 0 to MAX inclusive. + // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}' + if (obj.hasOwnProperty(p = 'POW_PRECISION')) { + v = obj[p]; + intCheck(v, 0, MAX, p); + POW_PRECISION = v; + } + + // FORMAT {object} + // '[BigNumber Error] FORMAT not an object: {v}' + if (obj.hasOwnProperty(p = 'FORMAT')) { + v = obj[p]; + if (typeof v == 'object') FORMAT = v; + else throw Error + (bignumberError + p + ' not an object: ' + v); + } + + // ALPHABET {string} + // '[BigNumber Error] ALPHABET invalid: {v}' + if (obj.hasOwnProperty(p = 'ALPHABET')) { + v = obj[p]; + + // Disallow if less than two characters, + // or if it contains '+', '-', '.', whitespace, or a repeated character. + if (typeof v == 'string' && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) { + alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789'; + ALPHABET = v; + } else { + throw Error + (bignumberError + p + ' invalid: ' + v); + } + } + + } else { + + // '[BigNumber Error] Object expected: {v}' + throw Error + (bignumberError + 'Object expected: ' + obj); + } + } + + return { + DECIMAL_PLACES: DECIMAL_PLACES, + ROUNDING_MODE: ROUNDING_MODE, + EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], + RANGE: [MIN_EXP, MAX_EXP], + CRYPTO: CRYPTO, + MODULO_MODE: MODULO_MODE, + POW_PRECISION: POW_PRECISION, + FORMAT: FORMAT, + ALPHABET: ALPHABET + }; + }; + + + /* + * Return true if v is a BigNumber instance, otherwise return false. + * + * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed. + * + * v {any} + * + * '[BigNumber Error] Invalid BigNumber: {v}' + */ + BigNumber.isBigNumber = function (v) { + if (!v || v._isBigNumber !== true) return false; + if (!BigNumber.DEBUG) return true; + + var i, n, + c = v.c, + e = v.e, + s = v.s; + + out: if ({}.toString.call(c) == '[object Array]') { + + if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { + + // If the first element is zero, the BigNumber value must be zero. + if (c[0] === 0) { + if (e === 0 && c.length === 1) return true; + break out; + } + + // Calculate number of digits that c[0] should have, based on the exponent. + i = (e + 1) % LOG_BASE; + if (i < 1) i += LOG_BASE; + + // Calculate number of digits of c[0]. + //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) { + if (String(c[0]).length == i) { + + for (i = 0; i < c.length; i++) { + n = c[i]; + if (n < 0 || n >= BASE || n !== mathfloor(n)) break out; + } + + // Last element cannot be zero, unless it is the only element. + if (n !== 0) return true; + } + } + + // Infinity/NaN + } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { + return true; + } + + throw Error + (bignumberError + 'Invalid BigNumber: ' + v); + }; + + + /* + * Return a new BigNumber whose value is the maximum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.maximum = BigNumber.max = function () { + return maxOrMin(arguments, -1); + }; + + + /* + * Return a new BigNumber whose value is the minimum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.minimum = BigNumber.min = function () { + return maxOrMin(arguments, 1); + }; + + + /* + * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, + * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing + * zeros are produced). + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}' + * '[BigNumber Error] crypto unavailable' + */ + BigNumber.random = (function () { + var pow2_53 = 0x20000000000000; + + // Return a 53 bit integer n, where 0 <= n < 9007199254740992. + // Check if Math.random() produces more than 32 bits of randomness. + // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. + // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. + var random53bitInt = (Math.random() * pow2_53) & 0x1fffff + ? function () { return mathfloor(Math.random() * pow2_53); } + : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + + (Math.random() * 0x800000 | 0); }; + + return function (dp) { + var a, b, e, k, v, + i = 0, + c = [], + rand = new BigNumber(ONE); + + if (dp == null) dp = DECIMAL_PLACES; + else intCheck(dp, 0, MAX); + + k = mathceil(dp / LOG_BASE); + + if (CRYPTO) { + + // Browsers supporting crypto.getRandomValues. + if (crypto.getRandomValues) { + + a = crypto.getRandomValues(new Uint32Array(k *= 2)); + + for (; i < k;) { + + // 53 bits: + // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) + // 11111 11111111 11111111 11111111 11100000 00000000 00000000 + // ((Math.pow(2, 32) - 1) >>> 11).toString(2) + // 11111 11111111 11111111 + // 0x20000 is 2^21. + v = a[i] * 0x20000 + (a[i + 1] >>> 11); + + // Rejection sampling: + // 0 <= v < 9007199254740992 + // Probability that v >= 9e15, is + // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 + if (v >= 9e15) { + b = crypto.getRandomValues(new Uint32Array(2)); + a[i] = b[0]; + a[i + 1] = b[1]; + } else { + + // 0 <= v <= 8999999999999999 + // 0 <= (v % 1e14) <= 99999999999999 + c.push(v % 1e14); + i += 2; + } + } + i = k / 2; + + // Node.js supporting crypto.randomBytes. + } else if (crypto.randomBytes) { + + // buffer + a = crypto.randomBytes(k *= 7); + + for (; i < k;) { + + // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 + // 0x100000000 is 2^32, 0x1000000 is 2^24 + // 11111 11111111 11111111 11111111 11111111 11111111 11111111 + // 0 <= v < 9007199254740992 + v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) + + (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) + + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; + + if (v >= 9e15) { + crypto.randomBytes(7).copy(a, i); + } else { + + // 0 <= (v % 1e14) <= 99999999999999 + c.push(v % 1e14); + i += 7; + } + } + i = k / 7; + } else { + CRYPTO = false; + throw Error + (bignumberError + 'crypto unavailable'); + } + } + + // Use Math.random. + if (!CRYPTO) { + + for (; i < k;) { + v = random53bitInt(); + if (v < 9e15) c[i++] = v % 1e14; + } + } + + k = c[--i]; + dp %= LOG_BASE; + + // Convert trailing digits to zeros according to dp. + if (k && dp) { + v = POWS_TEN[LOG_BASE - dp]; + c[i] = mathfloor(k / v) * v; + } + + // Remove trailing elements which are zero. + for (; c[i] === 0; c.pop(), i--); + + // Zero? + if (i < 0) { + c = [e = 0]; + } else { + + // Remove leading elements which are zero and adjust exponent accordingly. + for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); + + // Count the digits of the first element of c to determine leading zeros, and... + for (i = 1, v = c[0]; v >= 10; v /= 10, i++); + + // adjust the exponent accordingly. + if (i < LOG_BASE) e -= LOG_BASE - i; + } + + rand.e = e; + rand.c = c; + return rand; + }; + })(); + + + /* + * Return a BigNumber whose value is the sum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.sum = function () { + var i = 1, + args = arguments, + sum = new BigNumber(args[0]); + for (; i < args.length;) sum = sum.plus(args[i++]); + return sum; + }; + + + // PRIVATE FUNCTIONS + + + // Called by BigNumber and BigNumber.prototype.toString. + convertBase = (function () { + var decimal = '0123456789'; + + /* + * Convert string of baseIn to an array of numbers of baseOut. + * Eg. toBaseOut('255', 10, 16) returns [15, 15]. + * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5]. + */ + function toBaseOut(str, baseIn, baseOut, alphabet) { + var j, + arr = [0], + arrL, + i = 0, + len = str.length; + + for (; i < len;) { + for (arrL = arr.length; arrL--; arr[arrL] *= baseIn); + + arr[0] += alphabet.indexOf(str.charAt(i++)); + + for (j = 0; j < arr.length; j++) { + + if (arr[j] > baseOut - 1) { + if (arr[j + 1] == null) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + + return arr.reverse(); + } + + // Convert a numeric string of baseIn to a numeric string of baseOut. + // If the caller is toString, we are converting from base 10 to baseOut. + // If the caller is BigNumber, we are converting from baseIn to base 10. + return function (str, baseIn, baseOut, sign, callerIsToString) { + var alphabet, d, e, k, r, x, xc, y, + i = str.indexOf('.'), + dp = DECIMAL_PLACES, + rm = ROUNDING_MODE; + + // Non-integer. + if (i >= 0) { + k = POW_PRECISION; + + // Unlimited precision. + POW_PRECISION = 0; + str = str.replace('.', ''); + y = new BigNumber(baseIn); + x = y.pow(str.length - i); + POW_PRECISION = k; + + // Convert str as if an integer, then restore the fraction part by dividing the + // result by its base raised to a power. + + y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), + 10, baseOut, decimal); + y.e = y.c.length; + } + + // Convert the number as integer. + + xc = toBaseOut(str, baseIn, baseOut, callerIsToString + ? (alphabet = ALPHABET, decimal) + : (alphabet = decimal, ALPHABET)); + + // xc now represents str as an integer and converted to baseOut. e is the exponent. + e = k = xc.length; + + // Remove trailing zeros. + for (; xc[--k] == 0; xc.pop()); + + // Zero? + if (!xc[0]) return alphabet.charAt(0); + + // Does str represent an integer? If so, no need for the division. + if (i < 0) { + --e; + } else { + x.c = xc; + x.e = e; + + // The sign is needed for correct rounding. + x.s = sign; + x = div(x, y, dp, rm, baseOut); + xc = x.c; + r = x.r; + e = x.e; + } + + // xc now represents str converted to baseOut. + + // THe index of the rounding digit. + d = e + dp + 1; + + // The rounding digit: the digit to the right of the digit that may be rounded up. + i = xc[d]; + + // Look at the rounding digits and mode to determine whether to round up. + + k = baseOut / 2; + r = r || d < 0 || xc[d + 1] != null; + + r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) + : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 || + rm == (x.s < 0 ? 8 : 7)); + + // If the index of the rounding digit is not greater than zero, or xc represents + // zero, then the result of the base conversion is zero or, if rounding up, a value + // such as 0.00001. + if (d < 1 || !xc[0]) { + + // 1^-dp or 0 + str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); + } else { + + // Truncate xc to the required number of decimal places. + xc.length = d; + + // Round up? + if (r) { + + // Rounding up may mean the previous digit has to be rounded up and so on. + for (--baseOut; ++xc[--d] > baseOut;) { + xc[d] = 0; + + if (!d) { + ++e; + xc = [1].concat(xc); + } + } + } + + // Determine trailing zeros. + for (k = xc.length; !xc[--k];); + + // E.g. [4, 11, 15] becomes 4bf. + for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])); + + // Add leading zeros, decimal point and trailing zeros as required. + str = toFixedPoint(str, e, alphabet.charAt(0)); + } + + // The caller will add the sign. + return str; + }; + })(); + + + // Perform division in the specified base. Called by div and convertBase. + div = (function () { + + // Assume non-zero x and k. + function multiply(x, k, base) { + var m, temp, xlo, xhi, + carry = 0, + i = x.length, + klo = k % SQRT_BASE, + khi = k / SQRT_BASE | 0; + + for (x = x.slice(); i--;) { + xlo = x[i] % SQRT_BASE; + xhi = x[i] / SQRT_BASE | 0; + m = khi * xlo + xhi * klo; + temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry; + carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; + x[i] = temp % base; + } + + if (carry) x = [carry].concat(x); + + return x; + } + + function compare(a, b, aL, bL) { + var i, cmp; + + if (aL != bL) { + cmp = aL > bL ? 1 : -1; + } else { + + for (i = cmp = 0; i < aL; i++) { + + if (a[i] != b[i]) { + cmp = a[i] > b[i] ? 1 : -1; + break; + } + } + } + + return cmp; + } + + function subtract(a, b, aL, base) { + var i = 0; + + // Subtract b from a. + for (; aL--;) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + + // Remove leading zeros. + for (; !a[0] && a.length > 1; a.splice(0, 1)); + } + + // x: dividend, y: divisor. + return function (x, y, dp, rm, base) { + var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, + yL, yz, + s = x.s == y.s ? 1 : -1, + xc = x.c, + yc = y.c; + + // Either NaN, Infinity or 0? + if (!xc || !xc[0] || !yc || !yc[0]) { + + return new BigNumber( + + // Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : + + // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. + xc && xc[0] == 0 || !yc ? s * 0 : s / 0 + ); + } + + q = new BigNumber(s); + qc = q.c = []; + e = x.e - y.e; + s = dp + e + 1; + + if (!base) { + base = BASE; + e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); + s = s / LOG_BASE | 0; + } + + // Result exponent may be one less then the current value of e. + // The coefficients of the BigNumbers from convertBase may have trailing zeros. + for (i = 0; yc[i] == (xc[i] || 0); i++); + + if (yc[i] > (xc[i] || 0)) e--; + + if (s < 0) { + qc.push(1); + more = true; + } else { + xL = xc.length; + yL = yc.length; + i = 0; + s += 2; + + // Normalise xc and yc so highest order digit of yc is >= base / 2. + + n = mathfloor(base / (yc[0] + 1)); + + // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1. + // if (n > 1 || n++ == 1 && yc[0] < base / 2) { + if (n > 1) { + yc = multiply(yc, n, base); + xc = multiply(xc, n, base); + yL = yc.length; + xL = xc.length; + } + + xi = yL; + rem = xc.slice(0, yL); + remL = rem.length; + + // Add zeros to make remainder as long as divisor. + for (; remL < yL; rem[remL++] = 0); + yz = yc.slice(); + yz = [0].concat(yz); + yc0 = yc[0]; + if (yc[1] >= base / 2) yc0++; + // Not necessary, but to prevent trial digit n > base, when using base 3. + // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15; + + do { + n = 0; + + // Compare divisor and remainder. + cmp = compare(yc, rem, yL, remL); + + // If divisor < remainder. + if (cmp < 0) { + + // Calculate trial digit, n. + + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + + // n is how many times the divisor goes into the current remainder. + n = mathfloor(rem0 / yc0); + + // Algorithm: + // product = divisor multiplied by trial digit (n). + // Compare product and remainder. + // If product is greater than remainder: + // Subtract divisor from product, decrement trial digit. + // Subtract product from remainder. + // If product was less than remainder at the last compare: + // Compare new remainder and divisor. + // If remainder is greater than divisor: + // Subtract divisor from remainder, increment trial digit. + + if (n > 1) { + + // n may be > base only when base is 3. + if (n >= base) n = base - 1; + + // product = divisor * trial digit. + prod = multiply(yc, n, base); + prodL = prod.length; + remL = rem.length; + + // Compare product and remainder. + // If product > remainder then trial digit n too high. + // n is 1 too high about 5% of the time, and is not known to have + // ever been more than 1 too high. + while (compare(prod, rem, prodL, remL) == 1) { + n--; + + // Subtract divisor from product. + subtract(prod, yL < prodL ? yz : yc, prodL, base); + prodL = prod.length; + cmp = 1; + } + } else { + + // n is 0 or 1, cmp is -1. + // If n is 0, there is no need to compare yc and rem again below, + // so change cmp to 1 to avoid it. + // If n is 1, leave cmp as -1, so yc and rem are compared again. + if (n == 0) { + + // divisor < remainder, so n must be at least 1. + cmp = n = 1; + } + + // product = divisor + prod = yc.slice(); + prodL = prod.length; + } + + if (prodL < remL) prod = [0].concat(prod); + + // Subtract product from remainder. + subtract(rem, prod, remL, base); + remL = rem.length; + + // If product was < remainder. + if (cmp == -1) { + + // Compare divisor and new remainder. + // If divisor < new remainder, subtract divisor from remainder. + // Trial digit n too low. + // n is 1 too low about 5% of the time, and very rarely 2 too low. + while (compare(yc, rem, yL, remL) < 1) { + n++; + + // Subtract divisor from remainder. + subtract(rem, yL < remL ? yz : yc, remL, base); + remL = rem.length; + } + } + } else if (cmp === 0) { + n++; + rem = [0]; + } // else cmp === 1 and n will be 0 + + // Add the next digit, n, to the result array. + qc[i++] = n; + + // Update the remainder. + if (rem[0]) { + rem[remL++] = xc[xi] || 0; + } else { + rem = [xc[xi]]; + remL = 1; + } + } while ((xi++ < xL || rem[0] != null) && s--); + + more = rem[0] != null; + + // Leading zero? + if (!qc[0]) qc.splice(0, 1); + } + + if (base == BASE) { + + // To calculate q.e, first get the number of digits of qc[0]. + for (i = 1, s = qc[0]; s >= 10; s /= 10, i++); + + round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); + + // Caller is convertBase. + } else { + q.e = e; + q.r = +more; + } + + return q; + }; + })(); + + + /* + * Return a string representing the value of BigNumber n in fixed-point or exponential + * notation rounded to the specified decimal places or significant digits. + * + * n: a BigNumber. + * i: the index of the last digit required (i.e. the digit that may be rounded up). + * rm: the rounding mode. + * id: 1 (toExponential) or 2 (toPrecision). + */ + function format(n, i, rm, id) { + var c0, e, ne, len, str; + + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + + if (!n.c) return n.toString(); + + c0 = n.c[0]; + ne = n.e; + + if (i == null) { + str = coeffToString(n.c); + str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) + ? toExponential(str, ne) + : toFixedPoint(str, ne, '0'); + } else { + n = round(new BigNumber(n), i, rm); + + // n.e may have changed if the value was rounded up. + e = n.e; + + str = coeffToString(n.c); + len = str.length; + + // toPrecision returns exponential notation if the number of significant digits + // specified is less than the number of digits necessary to represent the integer + // part of the value in fixed-point notation. + + // Exponential notation. + if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { + + // Append zeros? + for (; len < i; str += '0', len++); + str = toExponential(str, e); + + // Fixed-point notation. + } else { + i -= ne; + str = toFixedPoint(str, e, '0'); + + // Append zeros? + if (e + 1 > len) { + if (--i > 0) for (str += '.'; i--; str += '0'); + } else { + i += e - len; + if (i > 0) { + if (e + 1 == len) str += '.'; + for (; i--; str += '0'); + } + } + } + } + + return n.s < 0 && c0 ? '-' + str : str; + } + + + // Handle BigNumber.max and BigNumber.min. + // If any number is NaN, return NaN. + function maxOrMin(args, n) { + var k, y, + i = 1, + x = new BigNumber(args[0]); + + for (; i < args.length; i++) { + y = new BigNumber(args[i]); + if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) { + x = y; + } + } + + return x; + } + + + /* + * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. + * Called by minus, plus and times. + */ + function normalise(n, c, e) { + var i = 1, + j = c.length; + + // Remove trailing zeros. + for (; !c[--j]; c.pop()); + + // Calculate the base 10 exponent. First get the number of digits of c[0]. + for (j = c[0]; j >= 10; j /= 10, i++); + + // Overflow? + if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { + + // Infinity. + n.c = n.e = null; + + // Underflow? + } else if (e < MIN_EXP) { + + // Zero. + n.c = [n.e = 0]; + } else { + n.e = e; + n.c = c; + } + + return n; + } + + + // Handle values that fail the validity test in BigNumber. + parseNumeric = (function () { + var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, + dotAfter = /^([^.]+)\.$/, + dotBefore = /^\.([^.]+)$/, + isInfinityOrNaN = /^-?(Infinity|NaN)$/, + whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; + + return function (x, str, isNum, b) { + var base, + s = isNum ? str : str.replace(whitespaceOrPlus, ''); + + // No exception on ±Infinity or NaN. + if (isInfinityOrNaN.test(s)) { + x.s = isNaN(s) ? null : s < 0 ? -1 : 1; + } else { + if (!isNum) { + + // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i + s = s.replace(basePrefix, function (m, p1, p2) { + base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8; + return !b || b == base ? p1 : m; + }); + + if (b) { + base = b; + + // E.g. '1.' to '1', '.1' to '0.1' + s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1'); + } + + if (str != s) return new BigNumber(s, base); + } + + // '[BigNumber Error] Not a number: {n}' + // '[BigNumber Error] Not a base {b} number: {n}' + if (BigNumber.DEBUG) { + throw Error + (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str); + } + + // NaN + x.s = null; + } + + x.c = x.e = null; + } + })(); + + + /* + * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. + * If r is truthy, it is known that there are more digits after the rounding digit. + */ + function round(x, sd, rm, r) { + var d, i, j, k, n, ni, rd, + xc = x.c, + pows10 = POWS_TEN; + + // if x is not Infinity or NaN... + if (xc) { + + // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. + // n is a base 1e14 number, the value of the element of array x.c containing rd. + // ni is the index of n within x.c. + // d is the number of digits of n. + // i is the index of rd within n including leading zeros. + // j is the actual index of rd within n (if < 0, rd is a leading zero). + out: { + + // Get the number of digits of the first element of xc. + for (d = 1, k = xc[0]; k >= 10; k /= 10, d++); + i = sd - d; + + // If the rounding digit is in the first element of xc... + if (i < 0) { + i += LOG_BASE; + j = sd; + n = xc[ni = 0]; + + // Get the rounding digit at index j of n. + rd = mathfloor(n / pows10[d - j - 1] % 10); + } else { + ni = mathceil((i + 1) / LOG_BASE); + + if (ni >= xc.length) { + + if (r) { + + // Needed by sqrt. + for (; xc.length <= ni; xc.push(0)); + n = rd = 0; + d = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + n = k = xc[ni]; + + // Get the number of digits of n. + for (d = 1; k >= 10; k /= 10, d++); + + // Get the index of rd within n. + i %= LOG_BASE; + + // Get the index of rd within n, adjusted for leading zeros. + // The number of leading zeros of n is given by LOG_BASE - d. + j = i - LOG_BASE + d; + + // Get the rounding digit at index j of n. + rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10); + } + } + + r = r || sd < 0 || + + // Are there any non-zero digits after the rounding digit? + // The expression n % pows10[d - j - 1] returns all digits of n to the right + // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. + xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); + + r = rm < 4 + ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) + : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && + + // Check whether the digit to the left of the rounding digit is odd. + ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 || + rm == (x.s < 0 ? 8 : 7)); + + if (sd < 1 || !xc[0]) { + xc.length = 0; + + if (r) { + + // Convert sd to decimal places. + sd -= x.e + 1; + + // 1, 0.1, 0.01, 0.001, 0.0001 etc. + xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; + x.e = -sd || 0; + } else { + + // Zero. + xc[0] = x.e = 0; + } + + return x; + } + + // Remove excess digits. + if (i == 0) { + xc.length = ni; + k = 1; + ni--; + } else { + xc.length = ni + 1; + k = pows10[LOG_BASE - i]; + + // E.g. 56700 becomes 56000 if 7 is the rounding digit. + // j > 0 means i > number of leading zeros of n. + xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; + } + + // Round up? + if (r) { + + for (; ;) { + + // If the digit to be rounded up is in the first element of xc... + if (ni == 0) { + + // i will be the length of xc[0] before k is added. + for (i = 1, j = xc[0]; j >= 10; j /= 10, i++); + j = xc[0] += k; + for (k = 1; j >= 10; j /= 10, k++); + + // if i != k the length has increased. + if (i != k) { + x.e++; + if (xc[0] == BASE) xc[0] = 1; + } + + break; + } else { + xc[ni] += k; + if (xc[ni] != BASE) break; + xc[ni--] = 0; + k = 1; + } + } + } + + // Remove trailing zeros. + for (i = xc.length; xc[--i] === 0; xc.pop()); + } + + // Overflow? Infinity. + if (x.e > MAX_EXP) { + x.c = x.e = null; + + // Underflow? Zero. + } else if (x.e < MIN_EXP) { + x.c = [x.e = 0]; + } + } + + return x; + } + + + function valueOf(n) { + var str, + e = n.e; + + if (e === null) return n.toString(); + + str = coeffToString(n.c); + + str = e <= TO_EXP_NEG || e >= TO_EXP_POS + ? toExponential(str, e) + : toFixedPoint(str, e, '0'); + + return n.s < 0 ? '-' + str : str; + } + + + // PROTOTYPE/INSTANCE METHODS + + + /* + * Return a new BigNumber whose value is the absolute value of this BigNumber. + */ + P.absoluteValue = P.abs = function () { + var x = new BigNumber(this); + if (x.s < 0) x.s = 1; + return x; + }; + + + /* + * Return + * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), + * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), + * 0 if they have the same value, + * or null if the value of either is NaN. + */ + P.comparedTo = function (y, b) { + return compare(this, new BigNumber(y, b)); + }; + + + /* + * If dp is undefined or null or true or false, return the number of decimal places of the + * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. + * + * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this + * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or + * ROUNDING_MODE if rm is omitted. + * + * [dp] {number} Decimal places: integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + */ + P.decimalPlaces = P.dp = function (dp, rm) { + var c, n, v, + x = this; + + if (dp != null) { + intCheck(dp, 0, MAX); + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + + return round(new BigNumber(x), dp + x.e + 1, rm); + } + + if (!(c = x.c)) return null; + n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; + + // Subtract the number of trailing zeros of the last number. + if (v = c[v]) for (; v % 10 == 0; v /= 10, n--); + if (n < 0) n = 0; + + return n; + }; + + + /* + * n / 0 = I + * n / N = N + * n / I = 0 + * 0 / n = 0 + * 0 / 0 = N + * 0 / N = N + * 0 / I = 0 + * N / n = N + * N / 0 = N + * N / N = N + * N / I = N + * I / n = I + * I / 0 = I + * I / N = N + * I / I = N + * + * Return a new BigNumber whose value is the value of this BigNumber divided by the value of + * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. + */ + P.dividedBy = P.div = function (y, b) { + return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE); + }; + + + /* + * Return a new BigNumber whose value is the integer part of dividing the value of this + * BigNumber by the value of BigNumber(y, b). + */ + P.dividedToIntegerBy = P.idiv = function (y, b) { + return div(this, new BigNumber(y, b), 0, 1); + }; + + + /* + * Return a BigNumber whose value is the value of this BigNumber exponentiated by n. + * + * If m is present, return the result modulo m. + * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. + * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE. + * + * The modular power operation works efficiently when x, n, and m are integers, otherwise it + * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0. + * + * n {number|string|BigNumber} The exponent. An integer. + * [m] {number|string|BigNumber} The modulus. + * + * '[BigNumber Error] Exponent not an integer: {n}' + */ + P.exponentiatedBy = P.pow = function (n, m) { + var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, + x = this; + + n = new BigNumber(n); + + // Allow NaN and ±Infinity, but not other non-integers. + if (n.c && !n.isInteger()) { + throw Error + (bignumberError + 'Exponent not an integer: ' + valueOf(n)); + } + + if (m != null) m = new BigNumber(m); + + // Exponent of MAX_SAFE_INTEGER is 15. + nIsBig = n.e > 14; + + // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0. + if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { + + // The sign of the result of pow when x is negative depends on the evenness of n. + // If +n overflows to ±Infinity, the evenness of n would be not be known. + y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n))); + return m ? y.mod(m) : y; + } + + nIsNeg = n.s < 0; + + if (m) { + + // x % m returns NaN if abs(m) is zero, or m is NaN. + if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN); + + isModExp = !nIsNeg && x.isInteger() && m.isInteger(); + + if (isModExp) x = x.mod(m); + + // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15. + // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15. + } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 + // [1, 240000000] + ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 + // [80000000000000] [99999750000000] + : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { + + // If x is negative and n is odd, k = -0, else k = 0. + k = x.s < 0 && isOdd(n) ? -0 : 0; + + // If x >= 1, k = ±Infinity. + if (x.e > -1) k = 1 / k; + + // If n is negative return ±0, else return ±Infinity. + return new BigNumber(nIsNeg ? 1 / k : k); + + } else if (POW_PRECISION) { + + // Truncating each coefficient array to a length of k after each multiplication + // equates to truncating significant digits to POW_PRECISION + [28, 41], + // i.e. there will be a minimum of 28 guard digits retained. + k = mathceil(POW_PRECISION / LOG_BASE + 2); + } + + if (nIsBig) { + half = new BigNumber(0.5); + if (nIsNeg) n.s = 1; + nIsOdd = isOdd(n); + } else { + i = Math.abs(+valueOf(n)); + nIsOdd = i % 2; + } + + y = new BigNumber(ONE); + + // Performs 54 loop iterations for n of 9007199254740991. + for (; ;) { + + if (nIsOdd) { + y = y.times(x); + if (!y.c) break; + + if (k) { + if (y.c.length > k) y.c.length = k; + } else if (isModExp) { + y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m)); + } + } + + if (i) { + i = mathfloor(i / 2); + if (i === 0) break; + nIsOdd = i % 2; + } else { + n = n.times(half); + round(n, n.e + 1, 1); + + if (n.e > 14) { + nIsOdd = isOdd(n); + } else { + i = +valueOf(n); + if (i === 0) break; + nIsOdd = i % 2; + } + } + + x = x.times(x); + + if (k) { + if (x.c && x.c.length > k) x.c.length = k; + } else if (isModExp) { + x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m)); + } + } + + if (isModExp) return y; + if (nIsNeg) y = ONE.div(y); + + return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer + * using rounding mode rm, or ROUNDING_MODE if rm is omitted. + * + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}' + */ + P.integerValue = function (rm) { + var n = new BigNumber(this); + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + return round(n, n.e + 1, rm); + }; + + + /* + * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), + * otherwise return false. + */ + P.isEqualTo = P.eq = function (y, b) { + return compare(this, new BigNumber(y, b)) === 0; + }; + + + /* + * Return true if the value of this BigNumber is a finite number, otherwise return false. + */ + P.isFinite = function () { + return !!this.c; + }; + + + /* + * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), + * otherwise return false. + */ + P.isGreaterThan = P.gt = function (y, b) { + return compare(this, new BigNumber(y, b)) > 0; + }; + + + /* + * Return true if the value of this BigNumber is greater than or equal to the value of + * BigNumber(y, b), otherwise return false. + */ + P.isGreaterThanOrEqualTo = P.gte = function (y, b) { + return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0; + + }; + + + /* + * Return true if the value of this BigNumber is an integer, otherwise return false. + */ + P.isInteger = function () { + return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; + }; + + + /* + * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), + * otherwise return false. + */ + P.isLessThan = P.lt = function (y, b) { + return compare(this, new BigNumber(y, b)) < 0; + }; + + + /* + * Return true if the value of this BigNumber is less than or equal to the value of + * BigNumber(y, b), otherwise return false. + */ + P.isLessThanOrEqualTo = P.lte = function (y, b) { + return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0; + }; + + + /* + * Return true if the value of this BigNumber is NaN, otherwise return false. + */ + P.isNaN = function () { + return !this.s; + }; + + + /* + * Return true if the value of this BigNumber is negative, otherwise return false. + */ + P.isNegative = function () { + return this.s < 0; + }; + + + /* + * Return true if the value of this BigNumber is positive, otherwise return false. + */ + P.isPositive = function () { + return this.s > 0; + }; + + + /* + * Return true if the value of this BigNumber is 0 or -0, otherwise return false. + */ + P.isZero = function () { + return !!this.c && this.c[0] == 0; + }; + + + /* + * n - 0 = n + * n - N = N + * n - I = -I + * 0 - n = -n + * 0 - 0 = 0 + * 0 - N = N + * 0 - I = -I + * N - n = N + * N - 0 = N + * N - N = N + * N - I = N + * I - n = I + * I - 0 = I + * I - N = N + * I - I = N + * + * Return a new BigNumber whose value is the value of this BigNumber minus the value of + * BigNumber(y, b). + */ + P.minus = function (y, b) { + var i, j, t, xLTy, + x = this, + a = x.s; + + y = new BigNumber(y, b); + b = y.s; + + // Either NaN? + if (!a || !b) return new BigNumber(NaN); + + // Signs differ? + if (a != b) { + y.s = -b; + return x.plus(y); + } + + var xe = x.e / LOG_BASE, + ye = y.e / LOG_BASE, + xc = x.c, + yc = y.c; + + if (!xe || !ye) { + + // Either Infinity? + if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); + + // Either zero? + if (!xc[0] || !yc[0]) { + + // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. + return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : + + // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity + ROUNDING_MODE == 3 ? -0 : 0); + } + } + + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + + // Determine which is the bigger number. + if (a = xe - ye) { + + if (xLTy = a < 0) { + a = -a; + t = xc; + } else { + ye = xe; + t = yc; + } + + t.reverse(); + + // Prepend zeros to equalise exponents. + for (b = a; b--; t.push(0)); + t.reverse(); + } else { + + // Exponents equal. Check digit by digit. + j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; + + for (a = b = 0; b < j; b++) { + + if (xc[b] != yc[b]) { + xLTy = xc[b] < yc[b]; + break; + } + } + } + + // x < y? Point xc to the array of the bigger number. + if (xLTy) { + t = xc; + xc = yc; + yc = t; + y.s = -y.s; + } + + b = (j = yc.length) - (i = xc.length); + + // Append zeros to xc if shorter. + // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. + if (b > 0) for (; b--; xc[i++] = 0); + b = BASE - 1; + + // Subtract yc from xc. + for (; j > a;) { + + if (xc[--j] < yc[j]) { + for (i = j; i && !xc[--i]; xc[i] = b); + --xc[i]; + xc[j] += BASE; + } + + xc[j] -= yc[j]; + } + + // Remove leading zeros and adjust exponent accordingly. + for (; xc[0] == 0; xc.splice(0, 1), --ye); + + // Zero? + if (!xc[0]) { + + // Following IEEE 754 (2008) 6.3, + // n - n = +0 but n - n = -0 when rounding towards -Infinity. + y.s = ROUNDING_MODE == 3 ? -1 : 1; + y.c = [y.e = 0]; + return y; + } + + // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity + // for finite x and y. + return normalise(y, xc, ye); + }; + + + /* + * n % 0 = N + * n % N = N + * n % I = n + * 0 % n = 0 + * -0 % n = -0 + * 0 % 0 = N + * 0 % N = N + * 0 % I = 0 + * N % n = N + * N % 0 = N + * N % N = N + * N % I = N + * I % n = N + * I % 0 = N + * I % N = N + * I % I = N + * + * Return a new BigNumber whose value is the value of this BigNumber modulo the value of + * BigNumber(y, b). The result depends on the value of MODULO_MODE. + */ + P.modulo = P.mod = function (y, b) { + var q, s, + x = this; + + y = new BigNumber(y, b); + + // Return NaN if x is Infinity or NaN, or y is NaN or zero. + if (!x.c || !y.s || y.c && !y.c[0]) { + return new BigNumber(NaN); + + // Return x if y is Infinity or x is zero. + } else if (!y.c || x.c && !x.c[0]) { + return new BigNumber(x); + } + + if (MODULO_MODE == 9) { + + // Euclidian division: q = sign(y) * floor(x / abs(y)) + // r = x - qy where 0 <= r < abs(y) + s = y.s; + y.s = 1; + q = div(x, y, 0, 3); + y.s = s; + q.s *= s; + } else { + q = div(x, y, 0, MODULO_MODE); + } + + y = x.minus(q.times(y)); + + // To match JavaScript %, ensure sign of zero is sign of dividend. + if (!y.c[0] && MODULO_MODE == 1) y.s = x.s; + + return y; + }; + + + /* + * n * 0 = 0 + * n * N = N + * n * I = I + * 0 * n = 0 + * 0 * 0 = 0 + * 0 * N = N + * 0 * I = N + * N * n = N + * N * 0 = N + * N * N = N + * N * I = N + * I * n = I + * I * 0 = N + * I * N = N + * I * I = I + * + * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value + * of BigNumber(y, b). + */ + P.multipliedBy = P.times = function (y, b) { + var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, + base, sqrtBase, + x = this, + xc = x.c, + yc = (y = new BigNumber(y, b)).c; + + // Either NaN, ±Infinity or ±0? + if (!xc || !yc || !xc[0] || !yc[0]) { + + // Return NaN if either is NaN, or one is 0 and the other is Infinity. + if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { + y.c = y.e = y.s = null; + } else { + y.s *= x.s; + + // Return ±Infinity if either is ±Infinity. + if (!xc || !yc) { + y.c = y.e = null; + + // Return ±0 if either is ±0. + } else { + y.c = [0]; + y.e = 0; + } + } + + return y; + } + + e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); + y.s *= x.s; + xcL = xc.length; + ycL = yc.length; + + // Ensure xc points to longer array and xcL to its length. + if (xcL < ycL) { + zc = xc; + xc = yc; + yc = zc; + i = xcL; + xcL = ycL; + ycL = i; + } + + // Initialise the result array with zeros. + for (i = xcL + ycL, zc = []; i--; zc.push(0)); + + base = BASE; + sqrtBase = SQRT_BASE; + + for (i = ycL; --i >= 0;) { + c = 0; + ylo = yc[i] % sqrtBase; + yhi = yc[i] / sqrtBase | 0; + + for (k = xcL, j = i + k; j > i;) { + xlo = xc[--k] % sqrtBase; + xhi = xc[k] / sqrtBase | 0; + m = yhi * xlo + xhi * ylo; + xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c; + c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; + zc[j--] = xlo % base; + } + + zc[j] = c; + } + + if (c) { + ++e; + } else { + zc.splice(0, 1); + } + + return normalise(y, zc, e); + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber negated, + * i.e. multiplied by -1. + */ + P.negated = function () { + var x = new BigNumber(this); + x.s = -x.s || null; + return x; + }; + + + /* + * n + 0 = n + * n + N = N + * n + I = I + * 0 + n = n + * 0 + 0 = 0 + * 0 + N = N + * 0 + I = I + * N + n = N + * N + 0 = N + * N + N = N + * N + I = N + * I + n = I + * I + 0 = I + * I + N = N + * I + I = I + * + * Return a new BigNumber whose value is the value of this BigNumber plus the value of + * BigNumber(y, b). + */ + P.plus = function (y, b) { + var t, + x = this, + a = x.s; + + y = new BigNumber(y, b); + b = y.s; + + // Either NaN? + if (!a || !b) return new BigNumber(NaN); + + // Signs differ? + if (a != b) { + y.s = -b; + return x.minus(y); + } + + var xe = x.e / LOG_BASE, + ye = y.e / LOG_BASE, + xc = x.c, + yc = y.c; + + if (!xe || !ye) { + + // Return ±Infinity if either ±Infinity. + if (!xc || !yc) return new BigNumber(a / 0); + + // Either zero? + // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. + if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0); + } + + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + + // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. + if (a = xe - ye) { + if (a > 0) { + ye = xe; + t = yc; + } else { + a = -a; + t = xc; + } + + t.reverse(); + for (; a--; t.push(0)); + t.reverse(); + } + + a = xc.length; + b = yc.length; + + // Point xc to the longer array, and b to the shorter length. + if (a - b < 0) { + t = yc; + yc = xc; + xc = t; + b = a; + } + + // Only start adding at yc.length - 1 as the further digits of xc can be ignored. + for (a = 0; b;) { + a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; + xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; + } + + if (a) { + xc = [a].concat(xc); + ++ye; + } + + // No need to check for zero, as +x + +y != 0 && -x + -y != 0 + // ye = MAX_EXP + 1 possible + return normalise(y, xc, ye); + }; + + + /* + * If sd is undefined or null or true or false, return the number of significant digits of + * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. + * If sd is true include integer-part trailing zeros in the count. + * + * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this + * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or + * ROUNDING_MODE if rm is omitted. + * + * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive. + * boolean: whether to count integer-part trailing zeros: true or false. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' + */ + P.precision = P.sd = function (sd, rm) { + var c, n, v, + x = this; + + if (sd != null && sd !== !!sd) { + intCheck(sd, 1, MAX); + if (rm == null) rm = ROUNDING_MODE; + else intCheck(rm, 0, 8); + + return round(new BigNumber(x), sd, rm); + } + + if (!(c = x.c)) return null; + v = c.length - 1; + n = v * LOG_BASE + 1; + + if (v = c[v]) { + + // Subtract the number of trailing zeros of the last element. + for (; v % 10 == 0; v /= 10, n--); + + // Add the number of digits of the first element. + for (v = c[0]; v >= 10; v /= 10, n++); + } + + if (sd && x.e + 1 > n) n = x.e + 1; + + return n; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber shifted by k places + * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. + * + * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}' + */ + P.shiftedBy = function (k) { + intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); + return this.times('1e' + k); + }; + + + /* + * sqrt(-n) = N + * sqrt(N) = N + * sqrt(-I) = N + * sqrt(I) = I + * sqrt(0) = 0 + * sqrt(-0) = -0 + * + * Return a new BigNumber whose value is the square root of the value of this BigNumber, + * rounded according to DECIMAL_PLACES and ROUNDING_MODE. + */ + P.squareRoot = P.sqrt = function () { + var m, n, r, rep, t, + x = this, + c = x.c, + s = x.s, + e = x.e, + dp = DECIMAL_PLACES + 4, + half = new BigNumber('0.5'); + + // Negative/NaN/Infinity/zero? + if (s !== 1 || !c || !c[0]) { + return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); + } + + // Initial estimate. + s = Math.sqrt(+valueOf(x)); + + // Math.sqrt underflow/overflow? + // Pass x to Math.sqrt as integer, then adjust the exponent of the result. + if (s == 0 || s == 1 / 0) { + n = coeffToString(c); + if ((n.length + e) % 2 == 0) n += '0'; + s = Math.sqrt(+n); + e = bitFloor((e + 1) / 2) - (e < 0 || e % 2); + + if (s == 1 / 0) { + n = '5e' + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf('e') + 1) + e; + } + + r = new BigNumber(n); + } else { + r = new BigNumber(s + ''); + } + + // Check for zero. + // r could be zero if MIN_EXP is changed after the this value was created. + // This would cause a division by zero (x/t) and hence Infinity below, which would cause + // coeffToString to throw. + if (r.c[0]) { + e = r.e; + s = e + dp; + if (s < 3) s = 0; + + // Newton-Raphson iteration. + for (; ;) { + t = r; + r = half.times(t.plus(div(x, t, dp, 1))); + + if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { + + // The exponent of r may here be one less than the final result exponent, + // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits + // are indexed correctly. + if (r.e < e) --s; + n = n.slice(s - 3, s + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits + // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the + // iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the + // exact result as the nines may infinitely repeat. + if (!rep) { + round(t, t.e + DECIMAL_PLACES + 2, 0); + + if (t.times(t).eq(x)) { + r = t; + break; + } + } + + dp += 4; + s += 4; + rep = 1; + } else { + + // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact + // result. If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + round(r, r.e + DECIMAL_PLACES + 2, 1); + m = !r.times(r).eq(x); + } + + break; + } + } + } + } + + return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); + }; + + + /* + * Return a string representing the value of this BigNumber in exponential notation and + * rounded using ROUNDING_MODE to dp fixed decimal places. + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + */ + P.toExponential = function (dp, rm) { + if (dp != null) { + intCheck(dp, 0, MAX); + dp++; + } + return format(this, dp, rm, 1); + }; + + + /* + * Return a string representing the value of this BigNumber in fixed-point notation rounding + * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. + * + * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', + * but e.g. (-0.00001).toFixed(0) is '-0'. + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + */ + P.toFixed = function (dp, rm) { + if (dp != null) { + intCheck(dp, 0, MAX); + dp = dp + this.e + 1; + } + return format(this, dp, rm); + }; + + + /* + * Return a string representing the value of this BigNumber in fixed-point notation rounded + * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties + * of the format or FORMAT object (see BigNumber.set). + * + * The formatting object may contain some or all of the properties shown below. + * + * FORMAT = { + * prefix: '', + * groupSize: 3, + * secondaryGroupSize: 0, + * groupSeparator: ',', + * decimalSeparator: '.', + * fractionGroupSize: 0, + * fractionGroupSeparator: '\xA0', // non-breaking space + * suffix: '' + * }; + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * [format] {object} Formatting options. See FORMAT pbject above. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' + * '[BigNumber Error] Argument not an object: {format}' + */ + P.toFormat = function (dp, rm, format) { + var str, + x = this; + + if (format == null) { + if (dp != null && rm && typeof rm == 'object') { + format = rm; + rm = null; + } else if (dp && typeof dp == 'object') { + format = dp; + dp = rm = null; + } else { + format = FORMAT; + } + } else if (typeof format != 'object') { + throw Error + (bignumberError + 'Argument not an object: ' + format); + } + + str = x.toFixed(dp, rm); + + if (x.c) { + var i, + arr = str.split('.'), + g1 = +format.groupSize, + g2 = +format.secondaryGroupSize, + groupSeparator = format.groupSeparator || '', + intPart = arr[0], + fractionPart = arr[1], + isNeg = x.s < 0, + intDigits = isNeg ? intPart.slice(1) : intPart, + len = intDigits.length; + + if (g2) { + i = g1; + g1 = g2; + g2 = i; + len -= i; + } + + if (g1 > 0 && len > 0) { + i = len % g1 || g1; + intPart = intDigits.substr(0, i); + for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1); + if (g2 > 0) intPart += groupSeparator + intDigits.slice(i); + if (isNeg) intPart = '-' + intPart; + } + + str = fractionPart + ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) + ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'), + '$&' + (format.fractionGroupSeparator || '')) + : fractionPart) + : intPart; + } + + return (format.prefix || '') + str + (format.suffix || ''); + }; + + + /* + * Return an array of two BigNumbers representing the value of this BigNumber as a simple + * fraction with an integer numerator and an integer denominator. + * The denominator will be a positive non-zero value less than or equal to the specified + * maximum denominator. If a maximum denominator is not specified, the denominator will be + * the lowest value necessary to represent the number exactly. + * + * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator. + * + * '[BigNumber Error] Argument {not an integer|out of range} : {md}' + */ + P.toFraction = function (md) { + var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, + x = this, + xc = x.c; + + if (md != null) { + n = new BigNumber(md); + + // Throw if md is less than one or is not an integer, unless it is Infinity. + if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { + throw Error + (bignumberError + 'Argument ' + + (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n)); + } + } + + if (!xc) return new BigNumber(x); + + d = new BigNumber(ONE); + n1 = d0 = new BigNumber(ONE); + d1 = n0 = new BigNumber(ONE); + s = coeffToString(xc); + + // Determine initial denominator. + // d is a power of 10 and the minimum max denominator that specifies the value exactly. + e = d.e = s.length - x.e - 1; + d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; + md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n; + + exp = MAX_EXP; + MAX_EXP = 1 / 0; + n = new BigNumber(s); + + // n0 = d1 = 0 + n0.c[0] = 0; + + for (; ;) { + q = div(n, d, 0, 1); + d2 = d0.plus(q.times(d1)); + if (d2.comparedTo(md) == 1) break; + d0 = d1; + d1 = d2; + n1 = n0.plus(q.times(d2 = n1)); + n0 = d2; + d = n.minus(q.times(d2 = d)); + n = d2; + } + + d2 = div(md.minus(d0), d1, 0, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + e = e * 2; + + // Determine which fraction is closer to x, n0/d0 or n1/d1 + r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( + div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; + + MAX_EXP = exp; + + return r; + }; + + + /* + * Return the value of this BigNumber converted to a number primitive. + */ + P.toNumber = function () { + return +valueOf(this); + }; + + + /* + * Return a string representing the value of this BigNumber rounded to sd significant digits + * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits + * necessary to represent the integer part of the value in fixed-point notation, then use + * exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' + */ + P.toPrecision = function (sd, rm) { + if (sd != null) intCheck(sd, 1, MAX); + return format(this, sd, rm, 2); + }; + + + /* + * Return a string representing the value of this BigNumber in base b, or base 10 if b is + * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and + * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent + * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than + * TO_EXP_NEG, return exponential notation. + * + * [b] {number} Integer, 2 to ALPHABET.length inclusive. + * + * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' + */ + P.toString = function (b) { + var str, + n = this, + s = n.s, + e = n.e; + + // Infinity or NaN? + if (e === null) { + if (s) { + str = 'Infinity'; + if (s < 0) str = '-' + str; + } else { + str = 'NaN'; + } + } else { + if (b == null) { + str = e <= TO_EXP_NEG || e >= TO_EXP_POS + ? toExponential(coeffToString(n.c), e) + : toFixedPoint(coeffToString(n.c), e, '0'); + } else if (b === 10 && alphabetHasNormalDecimalDigits) { + n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); + str = toFixedPoint(coeffToString(n.c), n.e, '0'); + } else { + intCheck(b, 2, ALPHABET.length, 'Base'); + str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true); + } + + if (s < 0 && n.c[0]) str = '-' + str; + } + + return str; + }; + + + /* + * Return as toString, but do not accept a base argument, and include the minus sign for + * negative zero. + */ + P.valueOf = P.toJSON = function () { + return valueOf(this); + }; + + + P._isBigNumber = true; + + P[Symbol.toStringTag] = 'BigNumber'; + + // Node.js v10.12.0+ + P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf; + + if (configObject != null) BigNumber.set(configObject); + + return BigNumber; +} + + +// PRIVATE HELPER FUNCTIONS + +// These functions don't need access to variables, +// e.g. DECIMAL_PLACES, in the scope of the `clone` function above. + + +function bitFloor(n) { + var i = n | 0; + return n > 0 || n === i ? i : i - 1; +} + + +// Return a coefficient array as a string of base 10 digits. +function coeffToString(a) { + var s, z, + i = 1, + j = a.length, + r = a[0] + ''; + + for (; i < j;) { + s = a[i++] + ''; + z = LOG_BASE - s.length; + for (; z--; s = '0' + s); + r += s; + } + + // Determine trailing zeros. + for (j = r.length; r.charCodeAt(--j) === 48;); + + return r.slice(0, j + 1 || 1); +} + + +// Compare the value of BigNumbers x and y. +function compare(x, y) { + var a, b, + xc = x.c, + yc = y.c, + i = x.s, + j = y.s, + k = x.e, + l = y.e; + + // Either NaN? + if (!i || !j) return null; + + a = xc && !xc[0]; + b = yc && !yc[0]; + + // Either zero? + if (a || b) return a ? b ? 0 : -j : i; + + // Signs differ? + if (i != j) return i; + + a = i < 0; + b = k == l; + + // Either Infinity? + if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1; + + // Compare exponents. + if (!b) return k > l ^ a ? 1 : -1; + + j = (k = xc.length) < (l = yc.length) ? k : l; + + // Compare digit by digit. + for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1; + + // Compare lengths. + return k == l ? 0 : k > l ^ a ? 1 : -1; +} + + +/* + * Check that n is a primitive number, an integer, and in range, otherwise throw. + */ +function intCheck(n, min, max, name) { + if (n < min || n > max || n !== mathfloor(n)) { + throw Error + (bignumberError + (name || 'Argument') + (typeof n == 'number' + ? n < min || n > max ? ' out of range: ' : ' not an integer: ' + : ' not a primitive number: ') + String(n)); + } +} + + +// Assumes finite n. +function isOdd(n) { + var k = n.c.length - 1; + return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; +} + + +function toExponential(str, e) { + return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) + + (e < 0 ? 'e' : 'e+') + e; +} + + +function toFixedPoint(str, e, z) { + var len, zs; + + // Negative exponent? + if (e < 0) { + + // Prepend zeros. + for (zs = z + '.'; ++e; zs += z); + str = zs + str; + + // Positive exponent + } else { + len = str.length; + + // Append zeros. + if (++e > len) { + for (zs = z, e -= len; --e; zs += z); + str += zs; + } else if (e < len) { + str = str.slice(0, e) + '.' + str.slice(e); + } + } + + return str; +} + + +// EXPORT + + +var bignumber_BigNumber = clone(); + +/* harmony default export */ var bignumber = (bignumber_BigNumber); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/util.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {import("./Hbar.js").default} Hbar + */ + +/** + * Utility Error Messages + */ +const REQUIRE_NON_NULL_ERROR = "This value cannot be null | undefined."; +const REQUIRE_STRING_ERROR = "This value must be a string."; +const REQUIRE_UINT8ARRAY_ERROR = "This value must be a Uint8Array."; +const REQUIRE_STRING_OR_UINT8ARRAY_ERROR = + "This value must be a string or Uint8Array."; +const REQUIRE_NUMBER_ERROR = "This value must be a Number."; +const REQUIRE_BIGNUMBER_ERROR = "This value must be a BigNumber."; +const REQUIRE_ARRAY_ERROR = "The provided variable must be an Array."; +const REQUIRE_LONG_ERROR = "This value must be a Long."; + +const REQUIRE_TYPE_ERROR = + "The provided variables are not matching types."; + +const FUNCTION_CONVERT_TO_BIGNUMBER_ERROR = + "This value must be a String, Number, or BigNumber to be converted."; +const FUNCTION_CONVERT_TO_NUMBER_ERROR = + "This value must be a String, Number, or BigNumber to be converted."; +const FUNCTION_CONVERT_TO_NUMBER_PARSE_ERROR = + "Unable to parse given variable. Returns NaN."; + +//Soft Checks + +/** + * Takes any param and returns false if null or undefined. + * + * @param {any | null | undefined} variable + * @returns {boolean} + */ +function isNonNull(variable) { + return variable != null; +} + +/** + * Takes any param and returns true if param variable and type are the same. + * + * @param {any | null | undefined} variable + * @param {any | null | undefined} type + * @returns {boolean} + */ +function isType(variable, type) { + return typeof variable == typeof type; +} + +/** + * Takes any param and returns true if param is not null and of type Uint8Array. + * + * @param {any | null | undefined} variable + * @returns {boolean} + */ +function isUint8Array(variable) { + return isNonNull(variable) && variable instanceof Uint8Array; +} + +/** + * Takes any param and returns true if param is not null and of type Number. + * + * @param {any | null | undefined} variable + * @returns {boolean} + */ +function isNumber(variable) { + return ( + isNonNull(variable) && + (typeof variable == "number" || variable instanceof Number) + ); +} + +/** + * Takes any param and returns true if param is not null and of type BigNumber. + * + * @param {any | null | undefined} variable + * @returns {boolean} + */ +function isBigNumber(variable) { + return isNonNull(variable) && variable instanceof bignumber; +} + +/** + * Takes any param and returns true if param is not null and of type BigNumber. + * + * @param {any | null | undefined} variable + * @returns {boolean} + */ +function isLong(variable) { + return isNonNull(variable) && variable instanceof src_long; +} + +/** + * Takes any param and returns true if param is not null and of type string. + * + * @param {any | null | undefined} variable + * @returns {boolean} + */ +function isString(variable) { + return isNonNull(variable) && typeof variable == "string"; +} + +/** + * Takes any param and returns true if param is not null and type string or Uint8Array. + * + * @param {any | null | undefined} variable + * @returns {boolean} + */ +function isStringOrUint8Array(variable) { + return ( + isNonNull(variable) && (isString(variable) || isUint8Array(variable)) + ); +} + +/** + * Takes an address as `Uint8Array` and returns whether or not this is a long-zero address + * + * @param {Uint8Array} address + * @returns {boolean} + */ +function isLongZeroAddress(address) { + for (let i = 0; i < 12; i++) { + if (address[i] != 0) { + return false; + } + } + return true; +} + +/** + * Takes any param and returns false if null or undefined. + * + * @template {Long | Hbar} T + * @param {T} variable + * @returns {T} + */ +function requireNotNegative(variable) { + if (variable.isNegative()) { + throw new Error("negative value not allowed"); + } + + return variable; +} + +/** + * Takes any param and throws custom error if null or undefined. + * + * @param {any} variable + * @returns {object} + */ +function requireNonNull(variable) { + if (!isNonNull(variable)) { + throw new Error(REQUIRE_NON_NULL_ERROR); + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return variable; + } +} + +/** + * Takes any param and throws custom error if params are not same type. + * + * @param {any | null | undefined} variable + * @param {any | null | undefined} type + * @returns {object} + */ +function requireType(variable, type) { + if (!isType(variable, type)) { + throw new Error(REQUIRE_TYPE_ERROR); + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return variable; + } +} + +/** + * Takes any param and throws custom error if non BigNumber. + * + * @param {any | null | undefined} variable + * @returns {BigNumber} + */ +function requireBigNumber(variable) { + if (!isBigNumber(requireNonNull(variable))) { + throw new Error(REQUIRE_BIGNUMBER_ERROR); + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return /** @type {BigNumber} */ (variable); + } +} + +/** + * Takes any param and throws custom error if non BigNumber. + * + * @param {any | null | undefined} variable + * @returns {Long} + */ +function requireLong(variable) { + if (!isLong(requireNonNull(variable))) { + throw new Error(REQUIRE_LONG_ERROR); + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return /** @type {Long} */ (variable); + } +} + +/** + * Takes any param and throws custom error if non string. + * + * @param {any | null | undefined} variable + * @returns {string} + */ +function requireString(variable) { + if (!isString(requireNonNull(variable))) { + throw new Error(REQUIRE_STRING_ERROR); + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return /** @type {string} */ (variable); + } +} + +/** + * Takes any param and throws custom error if non Uint8Array. + * + * @param {any | null | undefined} variable + * @returns {Uint8Array} + */ +function requireUint8Array(variable) { + if (!isUint8Array(requireNonNull(variable))) { + throw new Error(REQUIRE_UINT8ARRAY_ERROR); + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return /** @type {Uint8Array} */ (variable); + } +} + +/** + * Takes any param and throws custom error if non Uint8Array. + * + * @param {any | null | undefined} variable + * @returns {number} + */ +function requireNumber(variable) { + if (!isNumber(requireNonNull(variable))) { + throw new Error(REQUIRE_NUMBER_ERROR); + } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return /** @type {number} */ (variable); + } +} + +/** + * Takes any param and throws custom error if null or undefined and not a string or Uint8Array. + * + * @param {any | null | undefined} variable + * @returns {string | Uint8Array} + */ +function requireStringOrUint8Array(variable) { + if (isStringOrUint8Array(requireNonNull(variable))) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return /** @type {string | Uint8Array} */ (variable); + } else { + throw new Error(REQUIRE_STRING_OR_UINT8ARRAY_ERROR); + } +} + +//Conversions + +/** + * Converts number or string to BigNumber. + * + * @param {any | null | undefined} variable + * @returns {BigNumber} + */ +function convertToBigNumber(variable) { + requireNonNull(variable); + if ( + isBigNumber(variable) || + isString(variable) || + isNumber(variable) || + isLong(variable) + ) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + return new bignumber(variable); + } + throw new Error(FUNCTION_CONVERT_TO_BIGNUMBER_ERROR); +} + +/** + * Converts Array of Numbers or Strings to Array of BigNumbers. + * + * @param {any | null | undefined} variable + * @returns {Array} + */ +function convertToBigNumberArray(variable) { + if (variable instanceof Array) { + return /** @type {Array} */ ( + variable.map(convertToBigNumber) + ); + } else { + throw new Error(REQUIRE_ARRAY_ERROR); + } +} + +/** + * @param {*} variable + * @returns {number} + */ +function convertToNumber(variable) { + requireNonNull(variable); + if ( + isBigNumber(variable) || + isString(variable) || + isNumber(variable) || + isLong(variable) + ) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const num = parseInt(variable); + if (isNaN(num)) { + throw new Error(FUNCTION_CONVERT_TO_NUMBER_PARSE_ERROR); + } else { + return num; + } + } else { + throw new Error(FUNCTION_CONVERT_TO_NUMBER_ERROR); + } +} + +/** + * Creates a DataView on top of an Uint8Array that could be or not be pooled, ensuring that we don't get out of bounds. + * + * @param {Uint8Array | Int8Array} arr + * @param {number | undefined} offset + * @param {number | undefined} length + * @returns {DataView} + */ +function safeView(arr, offset = 0, length = arr.byteLength) { + if (!(Number.isInteger(offset) && offset >= 0)) + throw new Error("Invalid offset!"); + if (!(Number.isInteger(length) && length >= 0)) + throw new Error("Invalid length!"); + return new DataView( + arr.buffer, + arr.byteOffset + offset, + Math.min(length, arr.byteLength - offset), + ); +} + +/** + * @param {any} a + * @param {any} b + * @param {Set=} ignore + * @returns {boolean} + */ +function util_compare(a, b, ignore = new Set()) { + if (typeof a === "object" && typeof b === "object") { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const aKeys = Object.keys(a); + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) { + return false; + } + + for (let i = 0; i < aKeys.length; i++) { + if (aKeys[i] !== bKeys[i]) { + return false; + } + + if (ignore.has(aKeys[i])) { + continue; + } + + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + if (!util_compare(a[aKeys[i]], b[bKeys[i]], ignore)) { + return false; + } + } + + return true; + } else if (typeof a === "number" && typeof b === "number") { + return a === b; + } else if (typeof a === "string" && typeof b === "string") { + return a === b; + } else if (typeof a === "boolean" && typeof b === "boolean") { + return a === b; + } else { + return false; + } +} + +/** + * https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array + * + * @template T + * @param {Array} array + */ +function shuffle(array) { + var currentIndex = array.length, + temporaryValue, + randomIndex; + + // While there remain elements to shuffle... + while (0 !== currentIndex) { + // Pick a remaining element... + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } +} + +/** + * @param {Uint8Array} array1 + * @param {Uint8Array} array2 + * @returns {boolean} + */ +function arrayEqual(array1, array2) { + if (array1 === array2) { + return true; + } + + if (array1.byteLength !== array2.byteLength) { + return false; + } + + const view1 = new DataView( + array1.buffer, + array1.byteOffset, + array1.byteLength, + ); + const view2 = new DataView( + array2.buffer, + array2.byteOffset, + array2.byteLength, + ); + + let i = array1.byteLength; + + while (i--) { + if (view1.getUint8(i) !== view2.getUint8(i)) { + return false; + } + } + + return true; +} + +/** + * @description Function that delays an execution for a given time (in milliseconds) + * @param {number} ms + * @returns {Promise} + */ +function wait(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +;// CONCATENATED MODULE: ./node_modules/rfc4648/lib/rfc4648.js +/* eslint-disable @typescript-eslint/strict-boolean-expressions */ +function parse(string, encoding, opts) { + var _opts$out; + + if (opts === void 0) { + opts = {}; + } + + // Build the character lookup table: + if (!encoding.codes) { + encoding.codes = {}; + + for (var i = 0; i < encoding.chars.length; ++i) { + encoding.codes[encoding.chars[i]] = i; + } + } // The string must have a whole number of bytes: + + + if (!opts.loose && string.length * encoding.bits & 7) { + throw new SyntaxError('Invalid padding'); + } // Count the padding bytes: + + + var end = string.length; + + while (string[end - 1] === '=') { + --end; // If we get a whole number of bytes, there is too much padding: + + if (!opts.loose && !((string.length - end) * encoding.bits & 7)) { + throw new SyntaxError('Invalid padding'); + } + } // Allocate the output: + + + var out = new ((_opts$out = opts.out) != null ? _opts$out : Uint8Array)(end * encoding.bits / 8 | 0); // Parse the data: + + var bits = 0; // Number of bits currently in the buffer + + var buffer = 0; // Bits waiting to be written out, MSB first + + var written = 0; // Next byte to write + + for (var _i = 0; _i < end; ++_i) { + // Read one character from the string: + var value = encoding.codes[string[_i]]; + + if (value === undefined) { + throw new SyntaxError('Invalid character ' + string[_i]); + } // Append the bits to the buffer: + + + buffer = buffer << encoding.bits | value; + bits += encoding.bits; // Write out some bits if the buffer has a byte's worth: + + if (bits >= 8) { + bits -= 8; + out[written++] = 0xff & buffer >> bits; + } + } // Verify that we have received just enough bits: + + + if (bits >= encoding.bits || 0xff & buffer << 8 - bits) { + throw new SyntaxError('Unexpected end of data'); + } + + return out; +} +function stringify(data, encoding, opts) { + if (opts === void 0) { + opts = {}; + } + + var _opts = opts, + _opts$pad = _opts.pad, + pad = _opts$pad === void 0 ? true : _opts$pad; + var mask = (1 << encoding.bits) - 1; + var out = ''; + var bits = 0; // Number of bits currently in the buffer + + var buffer = 0; // Bits waiting to be written out, MSB first + + for (var i = 0; i < data.length; ++i) { + // Slurp data into the buffer: + buffer = buffer << 8 | 0xff & data[i]; + bits += 8; // Write out as much as we can: + + while (bits > encoding.bits) { + bits -= encoding.bits; + out += encoding.chars[mask & buffer >> bits]; + } + } // Partial character: + + + if (bits) { + out += encoding.chars[mask & buffer << encoding.bits - bits]; + } // Add padding characters until we hit a byte boundary: + + + if (pad) { + while (out.length * encoding.bits & 7) { + out += '='; + } + } + + return out; +} + +/* eslint-disable @typescript-eslint/strict-boolean-expressions */ +var base16Encoding = { + chars: '0123456789ABCDEF', + bits: 4 +}; +var base32Encoding = { + chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', + bits: 5 +}; +var base32HexEncoding = { + chars: '0123456789ABCDEFGHIJKLMNOPQRSTUV', + bits: 5 +}; +var base64Encoding = { + chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', + bits: 6 +}; +var base64UrlEncoding = { + chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', + bits: 6 +}; +var base16 = { + parse: function parse$1(string, opts) { + return parse(string.toUpperCase(), base16Encoding, opts); + }, + stringify: function stringify$1(data, opts) { + return stringify(data, base16Encoding, opts); + } +}; +var rfc4648_base32 = { + parse: function parse$1(string, opts) { + if (opts === void 0) { + opts = {}; + } + + return parse(opts.loose ? string.toUpperCase().replace(/0/g, 'O').replace(/1/g, 'L').replace(/8/g, 'B') : string, base32Encoding, opts); + }, + stringify: function stringify$1(data, opts) { + return stringify(data, base32Encoding, opts); + } +}; +var base32hex = { + parse: function parse$1(string, opts) { + return parse(string, base32HexEncoding, opts); + }, + stringify: function stringify$1(data, opts) { + return stringify(data, base32HexEncoding, opts); + } +}; +var base64 = { + parse: function parse$1(string, opts) { + return parse(string, base64Encoding, opts); + }, + stringify: function stringify$1(data, opts) { + return stringify(data, base64Encoding, opts); + } +}; +var base64url = { + parse: function parse$1(string, opts) { + return parse(string, base64UrlEncoding, opts); + }, + stringify: function stringify$1(data, opts) { + return stringify(data, base64UrlEncoding, opts); + } +}; +var codec = { + parse: parse, + stringify: stringify +}; + + + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/base32.js +/* + * Copyright (C) 2019-2023 Hedera Hashgraph, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// HIP-32: https://hips.hedera.com/hip/hip-32 + + +const decodeOpts = { loose: true }; +const encodeOpts = { pad: false }; + +/** + * Decodes the rfc4648 base32 string into a {@link Uint8Array}. If the input string is null, returns null. + * @param {string} str the base32 string. + * @returns {Uint8Array | ''} + */ +// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call +const base32_decode = (str) => str && rfc4648_base32.parse(str, decodeOpts); + +/** + * Encodes the byte array into a rfc4648 base32 string without padding. If the input is null, returns null. Note with + * the rfc4648 loose = true option, it allows lower case letters, padding, and auto corrects 0 -> O, 1 -> L, 8 -> B + * @param {Buffer|Uint8Array} data + * @returns {string} + */ +// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call +const base32_encode = (data) => data && rfc4648_base32.stringify(data, encodeOpts); + +/* harmony default export */ var src_base32 = ({ + decode: base32_decode, + encode: base32_encode, +}); + +// EXTERNAL MODULE: ./node_modules/@hashgraph/proto/lib/index.js +var lib = __webpack_require__(6854); +var lib_namespaceObject = /*#__PURE__*/__webpack_require__.t(lib, 2); +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/KeyList.js + + +/** + * A list of Keys (`Key`) with an optional threshold. + */ +class KeyList_KeyList extends (/* unused pure expression or super */ null && (Key)) { + /** + * @param {?Key[]} [keys] + * @param {?number} [threshold] + */ + constructor(keys, threshold) { + super(); + + /** + * @private + * @type {Key[]} + */ + // @ts-ignore + if (keys == null) this._keys = []; + //checks if the value for `keys` is passed as a single key + //rather than a list that contains just one key + else if (keys instanceof Key) this._keys = [keys]; + else this._keys = keys; + + /** + * @type {?number} + */ + this._threshold = threshold == null ? null : threshold; + } + + /** + * @param {Key[]} keys + * @returns {KeyList} + */ + static of(...keys) { + return new KeyList_KeyList(keys, null); + } + + /** + * @template T + * @param {ArrayLike} arrayLike + * @param {((key: Key) => Key)} [mapFn] + * @param {T} [thisArg] + * @returns {KeyList} + */ + static from(arrayLike, mapFn, thisArg) { + if (mapFn == null) { + return new KeyList_KeyList(Array.from(arrayLike)); + } + + return new KeyList_KeyList(Array.from(arrayLike, mapFn, thisArg)); + } + + /** + * @returns {?number} + */ + get threshold() { + return this._threshold; + } + + /** + * @param {number} threshold + * @returns {this} + */ + setThreshold(threshold) { + this._threshold = threshold; + return this; + } + + /** + * @param {Key[]} keys + * @returns {number} + */ + push(...keys) { + return this._keys.push(...keys); + } + + /** + * @param {number} start + * @param {number} deleteCount + * @param {Key[]} items + * @returns {KeyList} + */ + splice(start, deleteCount, ...items) { + return new KeyList_KeyList( + this._keys.splice(start, deleteCount, ...items), + this.threshold, + ); + } + + /** + * @param {number=} start + * @param {number=} end + * @returns {KeyList} + */ + slice(start, end) { + return new KeyList_KeyList(this._keys.slice(start, end), this.threshold); + } + + /** + * @returns {Iterator} + */ + [Symbol.iterator]() { + return this._keys[Symbol.iterator](); + } + + /** + * @returns {Key[]} + */ + toArray() { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return this._keys.slice(); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify({ + threshold: this._threshold, + keys: this._keys.toString(), + }); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/BadKeyError.js +/** + * Signals that a key could not be realized from the input. + */ +class BadKeyError extends Error { + /** + * @param {Error | string} messageOrCause + */ + constructor(messageOrCause) { + super( + messageOrCause instanceof Error + ? messageOrCause.message + : messageOrCause, + ); + + this.name = "BadKeyError"; + + if (messageOrCause instanceof Error) { + /** @type {Error=} */ + this.cause = messageOrCause; + this.stack = messageOrCause.stack; + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/Key.js +class Key_Key {} + +// EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js +var nacl_fast = __webpack_require__(780); +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/util/array.js +/** + * @param {Uint8Array} array1 + * @param {Uint8Array} array2 + * @returns {boolean} + */ +function array_arrayEqual(array1, array2) { + if (array1 === array2) { + return true; + } + + if (array1.byteLength !== array2.byteLength) { + return false; + } + + const view1 = new DataView( + array1.buffer, + array1.byteOffset, + array1.byteLength, + ); + const view2 = new DataView( + array2.buffer, + array2.byteOffset, + array2.byteLength, + ); + + let i = array1.byteLength; + + while (i--) { + if (view1.getUint8(i) !== view2.getUint8(i)) { + return false; + } + } + + return true; +} + +/** + * @param {Uint8Array} array + * @param {Uint8Array} arrayPrefix + * @returns {boolean} + */ +function arrayStartsWith(array, arrayPrefix) { + if (array.byteLength < arrayPrefix.byteLength) { + return false; + } + + let i = arrayPrefix.byteLength; + + while (i--) { + if (array[i] !== arrayPrefix[i]) { + return false; + } + } + + return true; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js +/** + * @type {string[]} + */ +const hex_browser_byteToHex = []; + +for (let n = 0; n <= 0xff; n += 1) { + hex_browser_byteToHex.push(n.toString(16).padStart(2, "0")); +} + +/** + * @param {Uint8Array} data + * @returns {string} + */ +function encoding_hex_browser_encode(data) { + let string = ""; + + for (const byte of data) { + string += hex_browser_byteToHex[byte]; + } + + return string; +} + +/** + * @param {string} text + * @returns {Uint8Array} + */ +function hex_browser_decode(text) { + const str = text.startsWith("0x") ? text.substring(2) : text; + const result = str.match(/.{1,2}/gu); + + return new Uint8Array( + (result == null ? [] : result).map((byte) => parseInt(byte, 16)), + ); +} + +/** + * Encode with a specified length. Supports zero padding if the most significant byte is 0 + * + * https://github.com/ethers-io/ethers.js/blob/master/packages/bytes/src.ts/index.ts#L315 + * @param {Uint8Array} value + * @param {number} length + * @returns {string} + */ +function hex_browser_hexZeroPadded(value, length) { + const HexCharacters = "0123456789abcdef"; + + // https://github.com/ethers-io/ethers.js/blob/master/packages/bytes/src.ts/index.ts#L243 + let result = "0x"; + for (let i = 0; i < value.length; i++) { + let v = value[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + + // https://github.com/ethers-io/ethers.js/blob/master/packages/bytes/src.ts/index.ts#L315 + if (result.length > 2 * length + 2) { + console.log("result out of range", "result"); + } + + while (result.length < 2 * length + 2) { + result = "0x0" + result.substring(2); + } + + return result.substring(2); +} + +// EXTERNAL MODULE: ./node_modules/node-forge/lib/index.js +var node_forge_lib = __webpack_require__(2079); +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/Ed25519PublicKey.js + + + + + + + +const derPrefix = "302a300506032b6570032100"; +const derPrefixBytes = hex_browser_decode(derPrefix); + +/** + * An public key on the Hedera™ network. + */ +class Ed25519PublicKey extends Key_Key { + /** + * @internal + * @hideconstructor + * @param {Uint8Array} keyData + */ + constructor(keyData) { + super(); + + /** + * @type {Uint8Array} + * @private + * @readonly + */ + this._keyData = keyData; + } + + /** + * @returns {string} + */ + get _type() { + return "ED25519"; + } + + /** + * @param {Uint8Array} data + * @returns {Ed25519PublicKey} + */ + static fromBytes(data) { + switch (data.length) { + case 32: + return Ed25519PublicKey.fromBytesRaw(data); + case 44: + return Ed25519PublicKey.fromBytesDer(data); + default: + throw new BadKeyError( + `invalid public key length: ${data.length} bytes`, + ); + } + } + + /** + * @param {Uint8Array} data + * @returns {Ed25519PublicKey} + */ + static fromBytesDer(data) { + const asn = node_forge_lib.asn1.fromDer(new node_forge_lib.util.ByteStringBuffer(data)); + + /** * @type {Uint8Array} */ + let publicKey; + + try { + publicKey = node_forge_lib.pki.ed25519.publicKeyFromAsn1(asn); + } catch (error) { + const message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + throw new BadKeyError( + `cannot decode ED25519 public key data from DER format: ${message}`, + ); + } + + return new Ed25519PublicKey(publicKey); + } + + /** + * @param {Uint8Array} data + * @returns {Ed25519PublicKey} + */ + static fromBytesRaw(data) { + if (data.length != 32) { + throw new BadKeyError( + `invalid public key length: ${data.length} bytes`, + ); + } + + return new Ed25519PublicKey(data); + } + + /** + * Parse a public key from a string of hexadecimal digits. + * + * The public key may optionally be prefixed with + * the DER header. + * @param {string} text + * @returns {Ed25519PublicKey} + */ + static fromString(text) { + return Ed25519PublicKey.fromBytes(hex_browser_decode(text)); + } + + /** + * Verify a signature on a message with this public key. + * @param {Uint8Array} message + * @param {Uint8Array} signature + * @returns {boolean} + */ + verify(message, signature) { + return nacl_fast.sign.detached.verify(message, signature, this._keyData); + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + const bytes = new Uint8Array(derPrefixBytes.length + 32); + + bytes.set(derPrefixBytes, 0); + bytes.set(this._keyData.subarray(0, 32), derPrefixBytes.length); + + return bytes; + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + return this._keyData.slice(); + } + + /** + * @param {Ed25519PublicKey} other + * @returns {boolean} + */ + equals(other) { + return array_arrayEqual(this._keyData, other._keyData); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/random.js + + +/** + * @param {number} count + * @returns {Uint8Array} + */ +function bytes(count) { + return nacl_fast.randomBytes(count); +} + +/** + * @param {number} count + * @returns {Promise} + */ +function bytesAsync(count) { + return Promise.resolve(nacl_fast.randomBytes(count)); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/encoding/utf8.browser.js +/** + * @param {Uint8Array} data + * @returns {string} + */ +function utf8_browser_decode(data) { + // eslint-disable-next-line n/no-unsupported-features/node-builtins + return new TextDecoder().decode(data); +} + +/** + * @param {string} text + * @returns {Uint8Array} + */ +function utf8_browser_encode(text) { + // eslint-disable-next-line n/no-unsupported-features/node-builtins + return new TextEncoder().encode(text); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js + + +/** + * @enum {string} + */ +const HashAlgorithm = { + Sha256: "SHA-256", + Sha384: "SHA-384", + Sha512: "SHA-512", +}; + +/** + * @param {HashAlgorithm} algorithm + * @param {Uint8Array | string} secretKey + * @param {Uint8Array | string} data + * @returns {Promise} + */ +async function hmac_browser_hash(algorithm, secretKey, data) { + const key = + typeof secretKey === "string" ? utf8_browser_encode(secretKey) : secretKey; + const value = typeof data === "string" ? utf8_browser_encode(data) : data; + + try { + const key_ = await window.crypto.subtle.importKey( + "raw", + key, + { + name: "HMAC", + hash: algorithm, + }, + false, + ["sign"], + ); + + return new Uint8Array( + await window.crypto.subtle.sign("HMAC", key_, value), + ); + } catch { + throw new Error("Fallback if SubtleCrypto fails is not implemented"); + } +} + +// EXTERNAL MODULE: ./node_modules/elliptic/lib/elliptic.js +var elliptic = __webpack_require__(6266); +// EXTERNAL MODULE: ./node_modules/@hashgraph/cryptography/node_modules/bn.js/lib/bn.js +var bn = __webpack_require__(1058); +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/bip32.browser.js + + + + + +const secp256k1 = new elliptic.ec("secp256k1"); + +// https://github.com/ethers-io/ethers.js/blob/master/packages/hdnode/src.ts/index.ts#L23 +const N = new bn( + "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", + "hex", +); +const HARDENED_BIT = 0x80000000; + +/** + * Mostly copied from https://github.com/bitcoinjs/bip32/blob/master/ts-src/bip32.ts + * We cannot use that library directly because it uses `Buffer` and we want to avoid + * polyfills as much as possible. Also, we only need the `derive` function. + * @param {Uint8Array} parentKey + * @param {Uint8Array} chainCode + * @param {number} index + * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>} + */ +async function derive(parentKey, chainCode, index) { + const isHardened = isHardenedIndex(index); + const data = new Uint8Array(37); + + const publicKey = hex_browser_decode( + secp256k1.keyFromPrivate(parentKey).getPublic(true, "hex"), + ); + + // Hardened child + if (isHardened) { + // data = 0x00 || ser256(kpar) || ser32(index) + data[0] = 0x00; + data.set(parentKey, 1); + + // Normal child + } else { + // data = serP(point(kpar)) || ser32(index) + // = serP(Kpar) || ser32(index) + data.set(publicKey, 0); + } + + new DataView(data.buffer, data.byteOffset, data.byteLength).setUint32( + 33, + index, + false, + ); + + const I = await hmac_browser_hash(HashAlgorithm.Sha512, chainCode, data); + const IL = I.subarray(0, 32); + const IR = I.subarray(32); + + // if parse256(IL) >= n, proceed with the next value for i + try { + // ki = parse256(IL) + kpar (mod n) + const ki = secp256k1 + .keyFromPrivate(parentKey) + .getPrivate() + .add(secp256k1.keyFromPrivate(IL).getPrivate()) + .mod(N); + const hexZeroPadded = hex_browser_hexZeroPadded( + Uint8Array.from(ki.toArray()), + 32, + ); + // const ki = Buffer.from(ecc.privateAdd(this.privateKey!, IL)!); + + // In case ki == 0, proceed with the next value for i + if (ki.eqn(0)) { + return derive(parentKey, chainCode, index + 1); + } + + return { + keyData: hex_browser_decode(hexZeroPadded), + chainCode: IR, + }; + } catch { + return derive(parentKey, chainCode, index + 1); + } +} + +/** + * @param {Uint8Array} seed + * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>} + */ +async function fromSeed(seed) { + if (seed.length < 16) + throw new TypeError("Seed should be at least 128 bits"); + if (seed.length > 64) + throw new TypeError("Seed should be at most 512 bits"); + + const I = await hmac_browser_hash(HashAlgorithm.Sha512, "Bitcoin seed", seed); + + const IL = I.subarray(0, 32); + const IR = I.subarray(32); + + return { keyData: IL, chainCode: IR }; +} + +/** + * Harden the index + * @param {number} index the derivation index + * @returns {number} the hardened index + */ +function toHardenedIndex(index) { + return index | HARDENED_BIT; +} + +/** + * Check if the index is hardened + * @param {number} index the derivation index + * @returns {boolean} true if the index is hardened + */ +function isHardenedIndex(index) { + return (index & HARDENED_BIT) !== 0; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/slip10.js + + + +/** + * @param {Uint8Array} parentKey + * @param {Uint8Array} chainCode + * @param {number} index + * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>} + */ +async function slip10_derive(parentKey, chainCode, index) { + if (isHardenedIndex(index)) { + throw new Error("the index should not be pre-hardened"); + } + + const input = new Uint8Array(37); + + // 0x00 + parentKey + index(BE) + input[0] = 0; + input.set(parentKey, 1); + new DataView(input.buffer, input.byteOffset, input.byteLength).setUint32( + 33, + index, + false, + ); + + // set the index to hardened + input[33] |= 128; + + const digest = await hmac_browser_hash(HashAlgorithm.Sha512, chainCode, input); + + return { keyData: digest.subarray(0, 32), chainCode: digest.subarray(32) }; +} + +/** + * @param {Uint8Array} seed + * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>} + */ +async function slip10_fromSeed(seed) { + const digest = await hmac_browser_hash( + HashAlgorithm.Sha512, + "ed25519 seed", + seed, + ); + + return { keyData: digest.subarray(0, 32), chainCode: digest.subarray(32) }; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/Ed25519PrivateKey.js + + + + + + + + +const Ed25519PrivateKey_derPrefix = "302e020100300506032b657004220420"; +const Ed25519PrivateKey_derPrefixBytes = hex_browser_decode(Ed25519PrivateKey_derPrefix); + +class Ed25519PrivateKey { + /** + * @hideconstructor + * @internal + * @param {nacl.SignKeyPair | Uint8Array} keyPair + * @param {Uint8Array=} chainCode + */ + constructor(keyPair, chainCode) { + /** + * @type {nacl.SignKeyPair} + * @readonly + * @private + */ + this._keyPair = + keyPair instanceof Uint8Array + ? nacl_fast.sign.keyPair.fromSeed(keyPair) + : keyPair; + + /** + * @type {?Uint8Array} + * @readonly + */ + this._chainCode = chainCode != null ? chainCode : null; + } + + /** + * @returns {string} + */ + get _type() { + return "ED25519"; + } + + /** + * Generate a random Ed25519 private key. + * @returns {Ed25519PrivateKey} + */ + static generate() { + // 32 bytes for the secret key + // 32 bytes for the chain code (to support derivation) + const entropy = bytes(64); + + return new Ed25519PrivateKey( + nacl_fast.sign.keyPair.fromSeed(entropy.subarray(0, 32)), + entropy.subarray(32), + ); + } + + /** + * Generate a random Ed25519 private key. + * @returns {Promise} + */ + static async generateAsync() { + // 32 bytes for the secret key + // 32 bytes for the chain code (to support derivation) + const entropy = await bytesAsync(64); + + return new Ed25519PrivateKey( + nacl_fast.sign.keyPair.fromSeed(entropy.subarray(0, 32)), + entropy.subarray(32), + ); + } + + /** + * Construct a private key from bytes. + * @param {Uint8Array} data + * @returns {Ed25519PrivateKey} + */ + static fromBytes(data) { + switch (data.length) { + case 48: + return Ed25519PrivateKey.fromBytesDer(data); + case 32: + case 64: + return Ed25519PrivateKey.fromBytesRaw(data); + default: + throw new BadKeyError( + `invalid private key length: ${data.length} bytes`, + ); + } + } + + /** + * Construct a private key from bytes with DER header. + * @param {Uint8Array} data + * @returns {Ed25519PrivateKey} + */ + static fromBytesDer(data) { + const asn = node_forge_lib.asn1.fromDer(new node_forge_lib.util.ByteStringBuffer(data)); + + /** * @type {Uint8Array} */ + let privateKey; + + try { + privateKey = + node_forge_lib.pki.ed25519.privateKeyFromAsn1(asn).privateKeyBytes; + } catch (error) { + const message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + throw new BadKeyError( + `cannot decode ED25519 private key data from DER format: ${message}`, + ); + } + + const keyPair = nacl_fast.sign.keyPair.fromSeed(privateKey); + return new Ed25519PrivateKey(keyPair); + } + + /** + * Construct a private key from bytes without DER header. + * @param {Uint8Array} data + * @returns {Ed25519PrivateKey} + */ + static fromBytesRaw(data) { + switch (data.length) { + case 32: + return new Ed25519PrivateKey(nacl_fast.sign.keyPair.fromSeed(data)); + + case 64: + // priv + pub key + return new Ed25519PrivateKey( + nacl_fast.sign.keyPair.fromSecretKey(data), + ); + + default: + } + + throw new BadKeyError( + `invalid private key length: ${data.length} bytes`, + ); + } + + /** + * Construct a private key from a hex-encoded string. + * @param {string} text + * @returns {Ed25519PrivateKey} + */ + static fromString(text) { + return Ed25519PrivateKey.fromBytes(hex_browser_decode(text)); + } + + /** + * Construct a private key from a hex-encoded string. + * @param {string} text + * @returns {Ed25519PrivateKey} + */ + static fromStringDer(text) { + return Ed25519PrivateKey.fromBytesDer(hex_browser_decode(text)); + } + + /** + * Construct a private key from a hex-encoded string. + * @param {string} text + * @returns {Ed25519PrivateKey} + */ + static fromStringRaw(text) { + return Ed25519PrivateKey.fromBytesRaw(hex_browser_decode(text)); + } + + /** + * Construct a ED25519 private key from a Uint8Array seed. + * @param {Uint8Array} seed + * @returns {Promise} + */ + static async fromSeed(seed) { + const { keyData, chainCode } = await slip10_fromSeed(seed); + return new Ed25519PrivateKey(keyData, chainCode); + } + + /** + * Get the public key associated with this private key. + * + * The public key can be freely given and used by other parties to verify + * the signatures generated by this private key. + * @returns {Ed25519PublicKey} + */ + get publicKey() { + return new Ed25519PublicKey(this._keyPair.publicKey); + } + + /** + * Sign a message with this private key. + * @param {Uint8Array} bytes + * @returns {Uint8Array} - The signature bytes without the message + */ + sign(bytes) { + return nacl_fast.sign.detached(bytes, this._keyPair.secretKey); + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + const bytes = new Uint8Array(Ed25519PrivateKey_derPrefixBytes.length + 32); + const privateKey = this._keyPair.secretKey.subarray(0, 32); + const leadingZeroes = 32 - privateKey.length; + const privateKeyOffset = Ed25519PrivateKey_derPrefixBytes.length + leadingZeroes; + + bytes.set(Ed25519PrivateKey_derPrefixBytes, 0); + bytes.set(privateKey, privateKeyOffset); + + return bytes; + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + // copy the bytes so they can't be modified accidentally + return this._keyPair.secretKey.slice(0, 32); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/keccak.js +// Originally sourced from: +// https://github.com/MaiaVictor/eth-lib/blob/da0971f5b09964d9c8449975fa87933f0c9fef35/src/hash.js +// - added type declarations +// - switched to es6 module syntax +// +// Disable linting for entire file because it's nearly all pure JS +// eslint-disable + +const HEX_CHARS = "0123456789abcdef".split(""); +const KECCAK_PADDING = [1, 256, 65536, 16777216]; +const SHIFT = [0, 8, 16, 24]; +const RC = [ + 1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, + 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, + 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, + 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, + 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, + 2147483649, 0, 2147516424, 2147483648, +]; + +/** + * @typedef {object} KeccakT + * @property {number[]} blocks + * @property {number} blockCount + * @property {number} outputBlocks + * @property {number[]} s + * @property {number} start + * @property {number} block + * @property {boolean} reset + * @property {number=} lastByteIndex + */ + +/** @type {(bits: number) => KeccakT} */ +const Keccak = (bits) => ({ + blocks: [], + reset: true, + block: 0, + start: 0, + blockCount: (1600 - (bits << 1)) >> 5, + outputBlocks: bits >> 5, + // @ts-ignore + s: ((s) => [].concat(s, s, s, s, s))([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), +}); + +/** @type {(state: KeccakT, message: string | number[]) => string} */ +const update = (state, /** @type {string | number[]} */ message) => { + var length = message.length, + blocks = state.blocks, + byteCount = state.blockCount << 2, + blockCount = state.blockCount, + outputBlocks = state.outputBlocks, + s = state.s, + index = 0, + i, + code; + + // update + while (index < length) { + if (state.reset) { + state.reset = false; + blocks[0] = state.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (typeof message !== "string") { + for (i = state.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = state.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= + (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = + 0x10000 + + (((code & 0x3ff) << 10) | + (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= + (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= + (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + state.lastByteIndex = i; + if (i >= byteCount) { + state.start = i - byteCount; + state.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + state.reset = true; + } else { + state.start = i; + } + } + + // finalize + i = state.lastByteIndex; + // @ts-ignore + blocks[i >> 2] |= KECCAK_PADDING[i & 3]; + if (state.lastByteIndex === byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + + // toString + var hex = ""; + var block; + var j = 0; + i = 0; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += + HEX_CHARS[(block >> 4) & 0x0f] + + HEX_CHARS[block & 0x0f] + + HEX_CHARS[(block >> 12) & 0x0f] + + HEX_CHARS[(block >> 8) & 0x0f] + + HEX_CHARS[(block >> 20) & 0x0f] + + HEX_CHARS[(block >> 16) & 0x0f] + + HEX_CHARS[(block >> 28) & 0x0f] + + HEX_CHARS[(block >> 24) & 0x0f]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } + } + // @ts-ignore + return "0x" + hex; +}; + +/** @type {(s: number[]) => void} */ +const f = (s) => { + var h, + l, + n, + c0, + c1, + c2, + c3, + c4, + c5, + c6, + c7, + c8, + c9, + b0, + b1, + b2, + b3, + b4, + b5, + b6, + b7, + b8, + b9, + b10, + b11, + b12, + b13, + b14, + b15, + b16, + b17, + b18, + b19, + b20, + b21, + b22, + b23, + b24, + b25, + b26, + b27, + b28, + b29, + b30, + b31, + b32, + b33, + b34, + b35, + b36, + b37, + b38, + b39, + b40, + b41, + b42, + b43, + b44, + b45, + b46, + b47, + b48, + b49; + + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } +}; + +const keccak = (/** @type {number} */ bits) => (/** @type {string} */ str) => { + var msg; + if (str.slice(0, 2) === "0x") { + msg = []; + for (var i = 2, l = str.length; i < l; i += 2) + msg.push(parseInt(str.slice(i, i + 2), 16)); + } else { + msg = str; + } + // @ts-ignore + return update(Keccak(bits), msg); +}; + +/** + * @type {(message: string) => string} + */ +const keccak_keccak256 = keccak(256); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js + + + + +const ecdsa_secp256k1 = new elliptic.ec("secp256k1"); + +/** + * @typedef {import("../EcdsaPrivateKey.js").KeyPair} KeyPair + */ + +/** + * @returns {KeyPair} + */ +function generate() { + const keypair = ecdsa_secp256k1.genKeyPair(); + + return { + privateKey: hex_browser_decode(keypair.getPrivate("hex")), + publicKey: hex_browser_decode(keypair.getPublic(true, "hex")), + }; +} + +/** + * @returns {Promise} + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +async function generateAsync() { + return Promise.resolve(generate()); +} + +/** + * @param {Uint8Array} data + * @returns {KeyPair} + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function fromBytes(data) { + const keypair = ecdsa_secp256k1.keyFromPrivate(data); + + return { + privateKey: hex_browser_decode(keypair.getPrivate("hex")), + publicKey: hex_browser_decode(keypair.getPublic(true, "hex")), + }; +} + +/** + * @param {Uint8Array} data + * @returns {Uint8Array} + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getFullPublicKey(data) { + const keypair = ecdsa_secp256k1.keyFromPublic(data); + + return hex_browser_decode(keypair.getPublic(false, "hex")); +} + +/** + * @param {Uint8Array} keydata + * @param {Uint8Array} message + * @returns {Uint8Array} + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function sign(keydata, message) { + const msg = encoding_hex_browser_encode(message); + const data = hex_browser_decode(keccak_keccak256(`0x${msg}`)); + const keypair = ecdsa_secp256k1.keyFromPrivate(keydata); + const signature = keypair.sign(data); + + const r = signature.r.toArray("be", 32); + const s = signature.s.toArray("be", 32); + + const result = new Uint8Array(64); + result.set(r, 0); + result.set(s, 32); + return result; +} + +/** + * @param {Uint8Array} keydata + * @param {Uint8Array} message + * @param {Uint8Array} signature + * @returns {boolean} + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function verify(keydata, message, signature) { + const msg = encoding_hex_browser_encode(message); + const data = hex_browser_decode(keccak_keccak256(`0x${msg}`)); + const keypair = ecdsa_secp256k1.keyFromPublic(keydata); + + return keypair.verify(data, { + r: signature.subarray(0, 32), + s: signature.subarray(32, 64), + }); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/EcdsaPublicKey.js + + + + + + + +const ec = new elliptic.ec("secp256k1"); + +const legacyDerPrefix = "302d300706052b8104000a032200"; +const legacyDerPrefixBytes = hex_browser_decode(legacyDerPrefix); + +const EcdsaPublicKey_derPrefix = "3036301006072a8648ce3d020106052b8104000a032200"; +const EcdsaPublicKey_derPrefixBytes = hex_browser_decode(EcdsaPublicKey_derPrefix); + +/** + * An public key on the Hedera™ network. + */ +class EcdsaPublicKey extends Key_Key { + /** + * @internal + * @hideconstructor + * @param {Uint8Array} keyData + */ + constructor(keyData) { + super(); + + /** + * @type {Uint8Array} + * @private + * @readonly + */ + this._keyData = keyData; + } + + /** + * @returns {string} + */ + get _type() { + return "secp256k1"; + } + + /** + * @param {Uint8Array} data + * @returns {EcdsaPublicKey} + */ + static fromBytes(data) { + switch (data.length) { + case 33: + return EcdsaPublicKey.fromBytesRaw(data); + default: + return EcdsaPublicKey.fromBytesDer(data); + } + } + + /** + * @param {Uint8Array} data + * @returns {EcdsaPublicKey} + */ + static fromBytesDer(data) { + let ecdsaPublicKeyBytes = new Uint8Array(); + + switch (data.length) { + case 47: // In the case of legace DER prefix + ecdsaPublicKeyBytes = data.subarray( + legacyDerPrefixBytes.length, + ); + break; + case 56: // The lengths of all other bytePrefixes is equal, so we treat them equally + ecdsaPublicKeyBytes = data.subarray( + EcdsaPublicKey_derPrefixBytes.length, + EcdsaPublicKey_derPrefixBytes.length + 33, + ); + break; + default: // In the case of uncompressed DER prefix public keys + /* eslint-disable no-case-declarations */ + const keyPair = ec.keyFromPublic( + data.subarray(EcdsaPublicKey_derPrefixBytes.length), + "der", + ); + + const pk = keyPair.getPublic(); + + const compressedPublicKeyBytes = pk.encodeCompressed("hex"); + ecdsaPublicKeyBytes = hex_browser_decode(compressedPublicKeyBytes); + break; + /* eslint-enable no-case-declarations */ + } + if (ecdsaPublicKeyBytes.length == 0) { + throw new BadKeyError( + `cannot decode ECDSA private key data from DER format`, + ); + } + return new EcdsaPublicKey(ecdsaPublicKeyBytes); + } + + /** + * @param {Uint8Array} data + * @returns {EcdsaPublicKey} + */ + static fromBytesRaw(data) { + if (data.length != 33) { + throw new BadKeyError( + `invalid public key length: ${data.length} bytes`, + ); + } + + return new EcdsaPublicKey(data); + } + + /** + * Parse a public key from a string of hexadecimal digits. + * + * The public key may optionally be prefixed with + * the DER header. + * @param {string} text + * @returns {EcdsaPublicKey} + */ + static fromString(text) { + return EcdsaPublicKey.fromBytes(hex_browser_decode(text)); + } + + /** + * Verify a signature on a message with this public key. + * @param {Uint8Array} message + * @param {Uint8Array} signature + * @returns {boolean} + */ + verify(message, signature) { + return verify(this._keyData, message, signature); + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + const bytes = new Uint8Array( + legacyDerPrefixBytes.length + this._keyData.length, + ); + + bytes.set(legacyDerPrefixBytes, 0); + bytes.set(this._keyData, legacyDerPrefixBytes.length); + + return bytes; + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + return new Uint8Array(this._keyData.subarray()); + } + + /** + * @returns {string} + */ + toEthereumAddress() { + const hash = hex_browser_decode( + keccak_keccak256( + `0x${encoding_hex_browser_encode( + getFullPublicKey(this.toBytesRaw()).subarray(1), + )}`, + ), + ); + return encoding_hex_browser_encode(hash.subarray(12)); + } + + /** + * @param {EcdsaPublicKey} other + * @returns {boolean} + */ + equals(other) { + return array_arrayEqual(this._keyData, other._keyData); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/EcdsaPrivateKey.js + + + + + + +const EcdsaPrivateKey_derPrefix = "3030020100300706052b8104000a04220420"; +const EcdsaPrivateKey_derPrefixBytes = hex_browser_decode(EcdsaPrivateKey_derPrefix); + +const derPrefix2 = "30540201010420"; +const derPrefixBytes2 = hex_browser_decode(derPrefix2); + +/** + * @typedef {object} KeyPair + * @property {Uint8Array} publicKey + * @property {Uint8Array} privateKey + */ + +class EcdsaPrivateKey { + /** + * @hideconstructor + * @internal + * @param {KeyPair} keyPair + * @param {(Uint8Array)=} chainCode + */ + constructor(keyPair, chainCode) { + /** + * @type {KeyPair} + * @readonly + * @private + */ + this._keyPair = keyPair; + + /** + * @type {?Uint8Array} + * @readonly + */ + this._chainCode = chainCode != null ? chainCode : null; + } + + /** + * @returns {string} + */ + get _type() { + return "secp256k1"; + } + + /** + * Generate a random ECDSA private key. + * @returns {EcdsaPrivateKey} + */ + static generate() { + return new EcdsaPrivateKey(generate()); + } + + /** + * Generate a random Ed25519 private key. + * @returns {Promise} + */ + static async generateAsync() { + return new EcdsaPrivateKey(await generateAsync()); + } + + /** + * Construct a private key from bytes. + * @param {Uint8Array} data + * @returns {EcdsaPrivateKey} + */ + static fromBytes(data) { + switch (data.length) { + case 32: + return EcdsaPrivateKey.fromBytesRaw(data); + default: + return EcdsaPrivateKey.fromBytesDer(data); + } + } + + /** + * Construct a private key from bytes. + * @param {Uint8Array} data + * @returns {EcdsaPrivateKey} + */ + static fromBytesDer(data) { + let ecdsaPrivateKeyBytes = new Uint8Array(); + + if (arrayStartsWith(data, EcdsaPrivateKey_derPrefixBytes)) { + ecdsaPrivateKeyBytes = data.subarray(EcdsaPrivateKey_derPrefixBytes.length); + } else { + // For now, we assume that if we get to the `else` statement + // the lengths of all other bytePrefixes is equal, so we treat them equally + ecdsaPrivateKeyBytes = data.subarray( + derPrefixBytes2.length, + derPrefixBytes2.length + 32, + ); + } + + return new EcdsaPrivateKey(fromBytes(ecdsaPrivateKeyBytes)); + } + + /** + * Construct a private key from bytes. + * @param {Uint8Array} data + * @returns {EcdsaPrivateKey} + */ + static fromBytesRaw(data) { + return new EcdsaPrivateKey(fromBytes(data)); + } + + /** + * Construct a private key from a hex-encoded string. + * @param {string} text + * @returns {EcdsaPrivateKey} + */ + static fromString(text) { + return EcdsaPrivateKey.fromBytes(hex_browser_decode(text)); + } + + /** + * Construct a private key from a hex-encoded string. + * @param {string} text + * @returns {EcdsaPrivateKey} + */ + static fromStringDer(text) { + return EcdsaPrivateKey.fromBytesDer(hex_browser_decode(text)); + } + + /** + * Construct a private key from a hex-encoded string. + * @param {string} text + * @returns {EcdsaPrivateKey} + */ + static fromStringRaw(text) { + return EcdsaPrivateKey.fromBytesRaw(hex_browser_decode(text)); + } + + /** + * Construct a ECDSA private key from a Uint8Array seed. + * @param {Uint8Array} seed + * @returns {Promise} + */ + static async fromSeed(seed) { + const { keyData, chainCode } = await fromSeed(seed); + return new EcdsaPrivateKey(fromBytes(keyData), chainCode); + } + + /** + * Get the public key associated with this private key. + * + * The public key can be freely given and used by other parties to verify + * the signatures generated by this private key. + * @returns {EcdsaPublicKey} + */ + get publicKey() { + return new EcdsaPublicKey(this._keyPair.publicKey); + } + + /** + * Sign a message with this private key. + * @param {Uint8Array} bytes + * @returns {Uint8Array} - The signature bytes without the message + */ + sign(bytes) { + return sign(this._keyPair.privateKey, bytes); + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + const bytes = new Uint8Array(EcdsaPrivateKey_derPrefixBytes.length + 32); + const privateKey = this._keyPair.privateKey.subarray(0, 32); + const leadingZeroes = 32 - privateKey.length; + const privateKeyOffset = EcdsaPrivateKey_derPrefixBytes.length + leadingZeroes; + bytes.set(EcdsaPrivateKey_derPrefixBytes, 0); + bytes.set(privateKey, privateKeyOffset); + return bytes; + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + const bytes = new Uint8Array(32); + bytes.set(this._keyPair.privateKey.slice(0, 32), 0); + return bytes; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/PublicKey.js + + + + + + + +/** + * @typedef {import("./PrivateKey.js").Transaction} Transaction + */ + +/** + * An public key on the Hedera™ network. + */ +class PublicKey_PublicKey extends Key_Key { + /** + * @internal + * @hideconstructor + * @param {Ed25519PublicKey | EcdsaPublicKey} key + */ + constructor(key) { + super(); + + /** + * @type {Ed25519PublicKey | EcdsaPublicKey} + * @private + * @readonly + */ + this._key = key; + } + + /** + * @returns {string} + */ + get _type() { + return this._key._type; + } + + /** + * @param {Uint8Array} data + * @returns {PublicKey} + */ + static fromBytes(data) { + let message; + try { + return new PublicKey_PublicKey(Ed25519PublicKey.fromBytes(data)); + } catch (error) { + message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + } + + try { + return new PublicKey_PublicKey(EcdsaPublicKey.fromBytes(data)); + } catch (error) { + message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + } + + throw new BadKeyError( + `public key cannot be decoded from bytes: ${message}`, + ); + } + + /** + * @param {Uint8Array} data + * @returns {PublicKey} + */ + static fromBytesED25519(data) { + return new PublicKey_PublicKey(Ed25519PublicKey.fromBytes(data)); + } + + /** + * @param {Uint8Array} data + * @returns {PublicKey} + */ + static fromBytesECDSA(data) { + return new PublicKey_PublicKey(EcdsaPublicKey.fromBytes(data)); + } + + /** + * Parse a public key from a string of hexadecimal digits. + * + * The public key may optionally be prefixed with + * the DER header. + * @param {string} text + * @returns {PublicKey} + */ + static fromString(text) { + return PublicKey_PublicKey.fromBytes(hex_browser_decode(text)); + } + + /** + * @param {string} text + * @returns {PublicKey} + */ + static fromStringED25519(text) { + return PublicKey_PublicKey.fromBytesED25519(hex_browser_decode(text)); + } + + /** + * @param {string} text + * @returns {PublicKey} + */ + static fromStringECDSA(text) { + return PublicKey_PublicKey.fromBytesECDSA(hex_browser_decode(text)); + } + + /** + * Verify a signature on a message with this public key. + * @param {Uint8Array} message + * @param {Uint8Array} signature + * @returns {boolean} + */ + verify(message, signature) { + return this._key.verify(message, signature); + } + + /** + * @deprecated - use `@hashgraph/sdk`.PublicKey instead + * @param {Transaction} transaction + * @returns {boolean} + */ + verifyTransaction(transaction) { + //NOSONAR + console.log("Deprecated: use `@hashgraph/sdk`.PublicKey instead"); + + transaction._requireFrozen(); + + if (!transaction.isFrozen()) { + transaction.freeze(); + } + + for (const signedTransaction of transaction._signedTransactions) { + if ( + signedTransaction.sigMap != null && + signedTransaction.sigMap.sigPair != null + ) { + let found = false; + for (const sigPair of signedTransaction.sigMap.sigPair) { + const pubKeyPrefix = /** @type {Uint8Array} */ ( + sigPair.pubKeyPrefix + ); + if (array_arrayEqual(pubKeyPrefix, this.toBytesRaw())) { + found = true; + const bodyBytes = /** @type {Uint8Array} */ ( + signedTransaction.bodyBytes + ); + const signature = + sigPair.ed25519 != null + ? sigPair.ed25519 + : /** @type {Uint8Array} */ ( + sigPair.ECDSASecp256k1 + ); + if (!this.verify(bodyBytes, signature)) { + return false; + } + } + } + + if (!found) { + return false; + } + } + } + + return true; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + if (this._key instanceof Ed25519PublicKey) { + return this.toBytesRaw(); + } else { + return this.toBytesDer(); + } + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + return this._key.toBytesDer(); + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + return this._key.toBytesRaw(); + } + + /** + * @returns {string} + */ + toString() { + return this.toStringDer(); + } + + /** + * @returns {string} + */ + toStringDer() { + return encoding_hex_browser_encode(this.toBytesDer()); + } + + /** + * @returns {string} + */ + toStringRaw() { + return encoding_hex_browser_encode(this.toBytesRaw()); + } + + /** + * @returns {string} + */ + toEthereumAddress() { + if (this._key instanceof EcdsaPublicKey) { + return this._key.toEthereumAddress(); + } else { + throw new Error("unsupported operation on Ed25519PublicKey"); + } + } + + /** + * @param {PublicKey} other + * @returns {boolean} + */ + equals(other) { + if ( + this._key instanceof Ed25519PublicKey && + other._key instanceof Ed25519PublicKey + ) { + return this._key.equals(other._key); + } else if ( + this._key instanceof EcdsaPublicKey && + other._key instanceof EcdsaPublicKey + ) { + return this._key.equals(other._key); + } else { + return false; + } + } +} + +// EXTERNAL MODULE: ./node_modules/spark-md5/spark-md5.js +var spark_md5 = __webpack_require__(8322); +// EXTERNAL MODULE: ./node_modules/@hashgraph/cryptography/node_modules/buffer/index.js +var buffer = __webpack_require__(2864); +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/aes.browser.js + + + + + +const CipherAlgorithm = { + Aes128Ctr: "AES-128-CTR", + Aes128Cbc: "AES-128-CBC", +}; + +/** + * @param {string} algorithm + * @param {Uint8Array} key + * @param {Uint8Array} iv + * @param {Uint8Array} data + * @returns {Promise} + */ +async function createCipheriv(algorithm, key, iv, data) { + let algorithm_; + + switch (algorithm.toUpperCase()) { + case CipherAlgorithm.Aes128Ctr: + algorithm_ = { + name: "AES-CTR", + counter: iv, + length: 128, + }; + break; + case CipherAlgorithm.Aes128Cbc: + algorithm_ = { + name: "AES-CBC", + iv: iv, + }; + break; + default: + throw new Error( + "(BUG) non-exhaustive switch statement for CipherAlgorithm", + ); + } + + const key_ = await window.crypto.subtle.importKey( + "raw", + key, + algorithm_.name, + false, + ["encrypt"], + ); + + return new Uint8Array( + // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#return_value + /** @type {ArrayBuffer} */ ( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + await window.crypto.subtle.encrypt(algorithm_, key_, data) + ), + ); +} + +/** + * @param {string} algorithm + * @param {Uint8Array} key + * @param {Uint8Array} iv + * @param {Uint8Array} data + * @returns {Promise} + */ +async function createDecipheriv(algorithm, key, iv, data) { + let algorithm_; + + switch (algorithm.toUpperCase()) { + case CipherAlgorithm.Aes128Ctr: + algorithm_ = { + name: "AES-CTR", + counter: iv, + length: 128, + }; + break; + case CipherAlgorithm.Aes128Cbc: + algorithm_ = { + name: "AES-CBC", + iv, + }; + break; + default: + throw new Error( + "(BUG) non-exhaustive switch statement for CipherAlgorithm", + ); + } + + const key_ = await window.crypto.subtle.importKey( + "raw", + key, + algorithm_.name, + false, + ["decrypt"], + ); + let decrypted; + try { + decrypted = await window.crypto.subtle.decrypt(algorithm_, key_, data); + } catch (error) { + const message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + + throw new Error(`Unable to decrypt: ${message}`); + } + return new Uint8Array( + // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#return_value + /** @type {ArrayBuffer} */ ( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + decrypted + ), + ); +} + +/** + * @param {string} passphrase + * @param {string} iv + * @returns {Promise} + */ +async function messageDigest(passphrase, iv) { + const pass = utf8_browser_encode(passphrase); + const sliced = hex_browser_decode(iv).slice(0, 8); + const result = spark_md5.ArrayBuffer.hash( + buffer/* Buffer.concat */.lW.concat([buffer/* Buffer.from */.lW.from(pass), buffer/* Buffer.from */.lW.from(sliced)]), + ); + + return Promise.resolve(hex_browser_decode(result)); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js + + +/** + * @typedef {import("./hmac.js").HashAlgorithm} HashAlgorithm + */ + +/** + * @param {HashAlgorithm} algorithm + * @param {Uint8Array | string} password + * @param {Uint8Array | string} salt + * @param {number} iterations + * @param {number} length + * @returns {Promise} + */ +async function deriveKey(algorithm, password, salt, iterations, length) { + const pass = + typeof password === "string" + ? // Valid ASCII is also valid UTF-8 so encoding the password as UTF-8 + // should be fine if only valid ASCII characters are used in the password + utf8_browser_encode(password) + : password; + + const nacl = typeof salt === "string" ? utf8_browser_encode(salt) : salt; + + try { + const key = await window.crypto.subtle.importKey( + "raw", + pass, + { + name: "PBKDF2", + hash: algorithm, + }, + false, + ["deriveBits"], + ); + + return new Uint8Array( + await window.crypto.subtle.deriveBits( + { + name: "PBKDF2", + hash: algorithm, + salt: nacl, + iterations, + }, + key, + length << 3, + ), + ); + } catch { + throw new Error("(BUG) Non-Exhaustive switch statement for algorithms"); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/keystore.js + + + + + + + + +const HMAC_SHA256 = "hmac-sha256"; + +/** + * @typedef {object} KeystoreKdfParams + * @property {number} dkLen + * @property {string} salt + * @property {number} c + * @property {string} prf + */ + +/** + * @typedef {object} KeystoreCipherParams + * @property {string} iv + */ + +/** + * @typedef {object} KeystoreCrypto + * @property {string} ciphertext + * @property {KeystoreCipherParams} cipherparams + * @property {string} cipher + * @property {string} kdf + * @property {KeystoreKdfParams} kdfparams + * @property {string} mac + */ + +/** + * @typedef {object} Keystore + * @property {number} version + * @property {KeystoreCrypto} crypto + */ + +/** + * @param {Uint8Array} privateKey + * @param {string} passphrase + * @returns {Promise} + */ +async function createKeystore(privateKey, passphrase) { + // all values taken from https://github.com/ethereumjs/ethereumjs-wallet/blob/de3a92e752673ada1d78f95cf80bc56ae1f59775/src/index.ts#L25 + const dkLen = 32; + const c = 262144; + const saltLen = 32; + const salt = await bytesAsync(saltLen); + + const key = await deriveKey( + HashAlgorithm.Sha256, + passphrase, + salt, + c, + dkLen, + ); + + const iv = await bytesAsync(16); + + // AES-128-CTR with the first half of the derived key and a random IV + const cipherText = await createCipheriv( + CipherAlgorithm.Aes128Ctr, + key.slice(0, 16), + iv, + privateKey, + ); + + const mac = await hmac_browser_hash( + HashAlgorithm.Sha384, + key.slice(16), + cipherText, + ); + + /** + * @type {Keystore} + */ + const keystore = { + version: 1, + crypto: { + ciphertext: encoding_hex_browser_encode(cipherText), + cipherparams: { iv: encoding_hex_browser_encode(iv) }, + cipher: CipherAlgorithm.Aes128Ctr, + kdf: "pbkdf2", + kdfparams: { + dkLen, + salt: encoding_hex_browser_encode(salt), + c, + prf: HMAC_SHA256, + }, + mac: encoding_hex_browser_encode(mac), + }, + }; + + return utf8_browser_encode(JSON.stringify(keystore)); +} + +/** + * @param {Uint8Array} keystoreBytes + * @param {string} passphrase + * @returns {Promise} + */ +async function loadKeystore(keystoreBytes, passphrase) { + /** + * @type {Keystore} + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const keystore = JSON.parse(utf8_browser_decode(keystoreBytes)); + + if (keystore.version !== 1) { + throw new BadKeyError( + `unsupported keystore version: ${keystore.version}`, + ); + } + + const { + ciphertext, + cipherparams: { iv }, + cipher, + kdf, + kdfparams: { dkLen, salt, c, prf }, + mac, + } = keystore.crypto; + + if (kdf !== "pbkdf2") { + throw new BadKeyError(`unsupported key derivation function:" + ${kdf}`); + } + + if (prf !== HMAC_SHA256) { + throw new BadKeyError( + `unsupported key derivation hash function: ${prf}`, + ); + } + + const saltBytes = hex_browser_decode(salt); + const ivBytes = hex_browser_decode(iv); + const cipherBytes = hex_browser_decode(ciphertext); + + const key = await deriveKey( + HashAlgorithm.Sha256, + passphrase, + saltBytes, + c, + dkLen, + ); + + const macHex = hex_browser_decode(mac); + const verifyHmac = await hmac_browser_hash( + HashAlgorithm.Sha384, + key.slice(16), + cipherBytes, + ); + + // compare that these two Uint8Arrays are equivalent + if (!macHex.every((b, i) => b === verifyHmac[i])) { + throw new BadKeyError("HMAC mismatch; passphrase is incorrect"); + } + + return createDecipheriv( + cipher, + key.slice(0, 16), + ivBytes, + cipherBytes, + ); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/encoding/der.js +/** + * @typedef {object} AsnSeq + * @property {AsnType[]} seq + */ + +/** + * @typedef {object} AsnInt + * @property {number} int + */ + +/** + * @typedef {object} AsnBytes + * @property {Uint8Array} bytes + */ + +/** + * @typedef {object} AsnIdent + * @property {string} ident + */ + +/** + * @typedef {{}} AsnNull + */ + +/** + * @typedef {AsnSeq | AsnInt | AsnBytes | AsnIdent | AsnNull} AsnType + */ + +/** + * Note: may throw weird errors on malformed input. Catch and rethrow with, e.g. `BadKeyError`. + *@param {Uint8Array} data + *@returns {AsnType} + */ +function der_decode(data) { + return decodeIncremental(data)[0]; +} + +/** + * @param {Uint8Array} bytes + * @returns {[AsnType, Uint8Array]} + */ +function decodeIncremental(bytes) { + // slice off the initial tag byte, `decodeLength` returns a slice of the remaining data + const [len, rem] = decodeLength(bytes.subarray(1)); + const data = rem.subarray(0, len); + const tail = rem.subarray(len); + + switch (bytes[0]) { + case 2: + return [{ int: decodeInt(data) }, tail]; + case 4: // must always be primitive form in DER; for OCTET STRING this is literal bytes + return [{ bytes: data }, tail]; + case 5: // empty + return [{}, tail]; + case 6: + return [{ ident: decodeObjectIdent(data) }, tail]; + case 48: + return [{ seq: decodeSeq(data) }, tail]; + default: + throw new Error(`unsupported DER type tag: ${bytes[0]}`); + } +} + +/** + * @param {Uint8Array} seqBytes + * @returns {AsnType[]} + */ +function decodeSeq(seqBytes) { + let data = seqBytes; + + const seq = []; + + while (data.length !== 0) { + const [decoded, remaining] = decodeIncremental(data); + seq.push(decoded); + data = remaining; + } + + return seq; +} + +/** + * @param {Uint8Array} idBytes + * @returns {string} + */ +function decodeObjectIdent(idBytes) { + const id = [ + // first octet is 40 * value1 + value2 + Math.floor(idBytes[0] / 40), + idBytes[0] % 40, + ]; + + // each following ID component is big-endian base128 where the MSB is set if another byte + // follows for the same value + let val = 0; + + for (const byte of idBytes.subarray(1)) { + // shift the entire value left by 7 bits + val *= 128; + + if (byte < 128) { + // no more octets follow for this value, finish it off + val += byte; + id.push(val); + val = 0; + } else { + // zero the MSB + val += byte & 127; + } + } + + return id.join("."); +} + +/** + * @param {Uint8Array} lenBytes + * @returns {[number, Uint8Array]} + */ +function decodeLength(lenBytes) { + if (lenBytes[0] < 128) { + // definite, short form + return [lenBytes[0], lenBytes.subarray(1)]; + } + + const numBytes = lenBytes[0] - 128; + + const intBytes = lenBytes.subarray(1, numBytes + 1); + const rem = lenBytes.subarray(numBytes + 1); + + return [decodeInt(intBytes), rem]; +} + +/** + * @param {Uint8Array} intBytes + * @returns {number} + */ +function decodeInt(intBytes) { + const len = intBytes.length; + if (len === 1) { + return intBytes[0]; + } + + let view = new DataView( + intBytes.buffer, + intBytes.byteOffset, + intBytes.byteLength, + ); + + if (len === 2) return view.getUint16(0, false); + + if (len === 3) { + // prefix a zero byte and we'll treat it as a 32-bit int + const data = Uint8Array.of(0, ...intBytes); + view = new DataView(data.buffer, data.byteOffset, data.byteLength); + } + + if (len > 4) { + // this probably means a bug in the decoding as this would mean a >4GB structure + throw new Error(`unsupported DER integer length of ${len} bytes`); + } + + return view.getUint32(0, false); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/pkcs.js + + + + + +class AlgorithmIdentifier { + /** + * @param {import("../encoding/der.js").AsnType} asn + */ + constructor(asn) { + if ("seq" in asn && asn.seq.length >= 1 && "ident" in asn.seq[0]) { + /** + * @type {string} + */ + this.algIdent = asn.seq[0].ident; + + /** + * @type {import("../encoding/der.js").AsnType | undefined} + */ + this.parameters = asn.seq[1]; + } else { + throw new Error( + `error parsing AlgorithmIdentifier from ${JSON.stringify(asn)}`, + ); + } + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this); + } +} + +class PBES2Params { + /** + * @param {import("../encoding/der.js").AsnType} asn + */ + constructor(asn) { + if ("seq" in asn && asn.seq.length === 2) { + /** + * @type {AlgorithmIdentifier} + */ + this.kdf = new AlgorithmIdentifier(asn.seq[0]); + + /** + * @type {AlgorithmIdentifier} + */ + this.encScheme = new AlgorithmIdentifier(asn.seq[1]); + } else { + throw new Error( + `error parsing PBES2Params from ${JSON.stringify(asn)}`, + ); + } + } +} + +class PBKDF2Params { + /** + * @param {import("../encoding/der.js").AsnType} asn + */ + constructor(asn) { + if ( + "seq" in asn && + asn.seq.length >= 2 && + "bytes" in asn.seq[0] && + "int" in asn.seq[1] + ) { + /** + * @type {Uint8Array} + */ + this.salt = asn.seq[0].bytes; + + /** + * @type {number} + */ + this.iterCount = asn.seq[1]["int"]; + + if (asn.seq.length > 2) { + if ("seq" in asn.seq[2]) { + this.prf = new AlgorithmIdentifier(asn.seq[2]); + return; + } else if ("int" in asn.seq[2]) { + /** + * @type {number | undefined} + */ + this.keyLength = asn.seq[2]["int"]; + } + + if (asn.seq.length === 4) { + /** + * @type {AlgorithmIdentifier | undefined} + */ + this.prf = new AlgorithmIdentifier(asn.seq[3]); + } + + return; + } + } + + throw new Error( + `error parsing PBKDF2Params from ${JSON.stringify(asn)}`, + ); + } +} + +class PrivateKeyInfo { + /** + * @param {import("../encoding/der.js").AsnType} asn + */ + constructor(asn) { + if ("seq" in asn && asn.seq.length === 3) { + if ("int" in asn.seq[0] && asn.seq[0]["int"] === 0) { + /** + * @type {number} + */ + this.version = 0; + } else { + throw new Error( + `expected version = 0, got ${JSON.stringify(asn.seq[0])}`, + ); + } + + /** + * @type {AlgorithmIdentifier} + */ + this.algId = new AlgorithmIdentifier(asn.seq[1]); + + if ("bytes" in asn.seq[2]) { + /** + * @type {Uint8Array} + */ + this.privateKey = asn.seq[2].bytes; + } else { + throw new Error( + `expected octet string as 3rd element, got ${JSON.stringify( + asn.seq[2], + )}`, + ); + } + + return; + } + + throw new Error( + `error parsing PrivateKeyInfo from ${JSON.stringify(asn)}`, + ); + } + + /** + * @param {Uint8Array} encoded + * @returns {PrivateKeyInfo} + */ + static parse(encoded) { + return new PrivateKeyInfo(der_decode(encoded)); + } +} + +class EncryptedPrivateKeyInfo { + /** + * @param {import("../encoding/der.js").AsnType} asn + */ + constructor(asn) { + if ("seq" in asn && asn.seq.length === 2 && "bytes" in asn.seq[1]) { + /** + * @type {AlgorithmIdentifier} + */ + this.algId = new AlgorithmIdentifier(asn.seq[0]); + + /** + * @type {Uint8Array} + */ + this.data = asn.seq[1].bytes; + return; + } + + throw new Error( + `error parsing EncryptedPrivateKeyInfo from ${JSON.stringify(asn)}`, + ); + } + + /** + * @param {Uint8Array} encoded + * @returns {EncryptedPrivateKeyInfo} + */ + static parse(encoded) { + return new EncryptedPrivateKeyInfo(der_decode(encoded)); + } + + /** + * @param {string} passphrase + * @returns {Promise} + */ + async decrypt(passphrase) { + if ( + this.algId.algIdent !== "1.2.840.113549.1.5.13" || + !this.algId.parameters + ) { + // PBES2 + throw new Error( + `unsupported key encryption algorithm: ${this.algId.toString()}`, + ); + } + + const pbes2Params = new PBES2Params(this.algId.parameters); + + if ( + pbes2Params.kdf.algIdent !== "1.2.840.113549.1.5.12" || + !pbes2Params.kdf.parameters + ) { + // PBKDF2 + throw new Error( + `unsupported key derivation function: ${pbes2Params.kdf.toString()}`, + ); + } + + const pbkdf2Params = new PBKDF2Params(pbes2Params.kdf.parameters); + + if (!pbkdf2Params.prf) { + throw new Error("unsupported PRF HMAC-SHA-1"); + } else if (pbkdf2Params.prf.algIdent !== "1.2.840.113549.2.9") { + // HMAC-SHA-256 + throw new Error(`unsupported PRF ${pbkdf2Params.prf.toString()}`); + } + + if (pbes2Params.encScheme.algIdent !== "2.16.840.1.101.3.4.1.2") { + // AES-128-CBC + throw new Error( + `unsupported encryption scheme: ${pbes2Params.encScheme.toString()}`, + ); + } + + if ( + !pbes2Params.encScheme.parameters || + !("bytes" in pbes2Params.encScheme.parameters) + ) { + throw new Error( + "expected IV as bytes for AES-128-CBC, " + + `got: ${JSON.stringify(pbes2Params.encScheme.parameters)}`, + ); + } + + const keyLen = pbkdf2Params.keyLength || 16; + const iv = pbes2Params.encScheme.parameters.bytes; + + const key = await deriveKey( + HashAlgorithm.Sha256, + passphrase, + pbkdf2Params.salt, + pbkdf2Params.iterCount, + keyLen, + ); + + const decrypted = await createDecipheriv( + CipherAlgorithm.Aes128Cbc, + key, + iv, + this.data, + ); + + return PrivateKeyInfo.parse(decrypted); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/encoding/base64.browser.js + + +/** + * @param {string} text + * @returns {Uint8Array} + */ +function base64_browser_decode(text) { + return Uint8Array.from(buffer/* Buffer.from */.lW.from(text, "base64")); +} + +/** + * @param {Uint8Array} data + * @returns {string}; + */ +function base64_browser_encode(data) { + return Buffer.from(data).toString("base64"); +} + +// EXTERNAL MODULE: ./node_modules/pvtsutils/build/index.js +var build = __webpack_require__(2043); +;// CONCATENATED MODULE: ./node_modules/pvutils/build/utils.es.js +/*! + Copyright (c) Peculiar Ventures, LLC +*/ + +function getUTCDate(date) { + return new Date(date.getTime() + (date.getTimezoneOffset() * 60000)); +} +function getParametersValue(parameters, name, defaultValue) { + var _a; + if ((parameters instanceof Object) === false) { + return defaultValue; + } + return (_a = parameters[name]) !== null && _a !== void 0 ? _a : defaultValue; +} +function bufferToHexCodes(inputBuffer, inputOffset = 0, inputLength = (inputBuffer.byteLength - inputOffset), insertSpace = false) { + let result = ""; + for (const item of (new Uint8Array(inputBuffer, inputOffset, inputLength))) { + const str = item.toString(16).toUpperCase(); + if (str.length === 1) { + result += "0"; + } + result += str; + if (insertSpace) { + result += " "; + } + } + return result.trim(); +} +function checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) { + if (!(inputBuffer instanceof ArrayBuffer)) { + baseBlock.error = "Wrong parameter: inputBuffer must be \"ArrayBuffer\""; + return false; + } + if (!inputBuffer.byteLength) { + baseBlock.error = "Wrong parameter: inputBuffer has zero length"; + return false; + } + if (inputOffset < 0) { + baseBlock.error = "Wrong parameter: inputOffset less than zero"; + return false; + } + if (inputLength < 0) { + baseBlock.error = "Wrong parameter: inputLength less than zero"; + return false; + } + if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) { + baseBlock.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; + return false; + } + return true; +} +function utilFromBase(inputBuffer, inputBase) { + let result = 0; + if (inputBuffer.length === 1) { + return inputBuffer[0]; + } + for (let i = (inputBuffer.length - 1); i >= 0; i--) { + result += inputBuffer[(inputBuffer.length - 1) - i] * Math.pow(2, inputBase * i); + } + return result; +} +function utilToBase(value, base, reserved = (-1)) { + const internalReserved = reserved; + let internalValue = value; + let result = 0; + let biggest = Math.pow(2, base); + for (let i = 1; i < 8; i++) { + if (value < biggest) { + let retBuf; + if (internalReserved < 0) { + retBuf = new ArrayBuffer(i); + result = i; + } + else { + if (internalReserved < i) { + return (new ArrayBuffer(0)); + } + retBuf = new ArrayBuffer(internalReserved); + result = internalReserved; + } + const retView = new Uint8Array(retBuf); + for (let j = (i - 1); j >= 0; j--) { + const basis = Math.pow(2, j * base); + retView[result - j - 1] = Math.floor(internalValue / basis); + internalValue -= (retView[result - j - 1]) * basis; + } + return retBuf; + } + biggest *= Math.pow(2, base); + } + return new ArrayBuffer(0); +} +function utilConcatBuf(...buffers) { + let outputLength = 0; + let prevLength = 0; + for (const buffer of buffers) { + outputLength += buffer.byteLength; + } + const retBuf = new ArrayBuffer(outputLength); + const retView = new Uint8Array(retBuf); + for (const buffer of buffers) { + retView.set(new Uint8Array(buffer), prevLength); + prevLength += buffer.byteLength; + } + return retBuf; +} +function utilConcatView(...views) { + let outputLength = 0; + let prevLength = 0; + for (const view of views) { + outputLength += view.length; + } + const retBuf = new ArrayBuffer(outputLength); + const retView = new Uint8Array(retBuf); + for (const view of views) { + retView.set(view, prevLength); + prevLength += view.length; + } + return retView; +} +function utilDecodeTC() { + const buf = new Uint8Array(this.valueHex); + if (this.valueHex.byteLength >= 2) { + const condition1 = (buf[0] === 0xFF) && (buf[1] & 0x80); + const condition2 = (buf[0] === 0x00) && ((buf[1] & 0x80) === 0x00); + if (condition1 || condition2) { + this.warnings.push("Needlessly long format"); + } + } + const bigIntBuffer = new ArrayBuffer(this.valueHex.byteLength); + const bigIntView = new Uint8Array(bigIntBuffer); + for (let i = 0; i < this.valueHex.byteLength; i++) { + bigIntView[i] = 0; + } + bigIntView[0] = (buf[0] & 0x80); + const bigInt = utilFromBase(bigIntView, 8); + const smallIntBuffer = new ArrayBuffer(this.valueHex.byteLength); + const smallIntView = new Uint8Array(smallIntBuffer); + for (let j = 0; j < this.valueHex.byteLength; j++) { + smallIntView[j] = buf[j]; + } + smallIntView[0] &= 0x7F; + const smallInt = utilFromBase(smallIntView, 8); + return (smallInt - bigInt); +} +function utilEncodeTC(value) { + const modValue = (value < 0) ? (value * (-1)) : value; + let bigInt = 128; + for (let i = 1; i < 8; i++) { + if (modValue <= bigInt) { + if (value < 0) { + const smallInt = bigInt - modValue; + const retBuf = utilToBase(smallInt, 8, i); + const retView = new Uint8Array(retBuf); + retView[0] |= 0x80; + return retBuf; + } + let retBuf = utilToBase(modValue, 8, i); + let retView = new Uint8Array(retBuf); + if (retView[0] & 0x80) { + const tempBuf = retBuf.slice(0); + const tempView = new Uint8Array(tempBuf); + retBuf = new ArrayBuffer(retBuf.byteLength + 1); + retView = new Uint8Array(retBuf); + for (let k = 0; k < tempBuf.byteLength; k++) { + retView[k + 1] = tempView[k]; + } + retView[0] = 0x00; + } + return retBuf; + } + bigInt *= Math.pow(2, 8); + } + return (new ArrayBuffer(0)); +} +function isEqualBuffer(inputBuffer1, inputBuffer2) { + if (inputBuffer1.byteLength !== inputBuffer2.byteLength) { + return false; + } + const view1 = new Uint8Array(inputBuffer1); + const view2 = new Uint8Array(inputBuffer2); + for (let i = 0; i < view1.length; i++) { + if (view1[i] !== view2[i]) { + return false; + } + } + return true; +} +function padNumber(inputNumber, fullLength) { + const str = inputNumber.toString(10); + if (fullLength < str.length) { + return ""; + } + const dif = fullLength - str.length; + const padding = new Array(dif); + for (let i = 0; i < dif; i++) { + padding[i] = "0"; + } + const paddingString = padding.join(""); + return paddingString.concat(str); +} +const base64Template = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; +const base64UrlTemplate = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="; +function toBase64(input, useUrlTemplate = false, skipPadding = false, skipLeadingZeros = false) { + let i = 0; + let flag1 = 0; + let flag2 = 0; + let output = ""; + const template = (useUrlTemplate) ? base64UrlTemplate : base64Template; + if (skipLeadingZeros) { + let nonZeroPosition = 0; + for (let i = 0; i < input.length; i++) { + if (input.charCodeAt(i) !== 0) { + nonZeroPosition = i; + break; + } + } + input = input.slice(nonZeroPosition); + } + while (i < input.length) { + const chr1 = input.charCodeAt(i++); + if (i >= input.length) { + flag1 = 1; + } + const chr2 = input.charCodeAt(i++); + if (i >= input.length) { + flag2 = 1; + } + const chr3 = input.charCodeAt(i++); + const enc1 = chr1 >> 2; + const enc2 = ((chr1 & 0x03) << 4) | (chr2 >> 4); + let enc3 = ((chr2 & 0x0F) << 2) | (chr3 >> 6); + let enc4 = chr3 & 0x3F; + if (flag1 === 1) { + enc3 = enc4 = 64; + } + else { + if (flag2 === 1) { + enc4 = 64; + } + } + if (skipPadding) { + if (enc3 === 64) { + output += `${template.charAt(enc1)}${template.charAt(enc2)}`; + } + else { + if (enc4 === 64) { + output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}`; + } + else { + output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; + } + } + } + else { + output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; + } + } + return output; +} +function fromBase64(input, useUrlTemplate = false, cutTailZeros = false) { + const template = (useUrlTemplate) ? base64UrlTemplate : base64Template; + function indexOf(toSearch) { + for (let i = 0; i < 64; i++) { + if (template.charAt(i) === toSearch) + return i; + } + return 64; + } + function test(incoming) { + return ((incoming === 64) ? 0x00 : incoming); + } + let i = 0; + let output = ""; + while (i < input.length) { + const enc1 = indexOf(input.charAt(i++)); + const enc2 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++)); + const enc3 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++)); + const enc4 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++)); + const chr1 = (test(enc1) << 2) | (test(enc2) >> 4); + const chr2 = ((test(enc2) & 0x0F) << 4) | (test(enc3) >> 2); + const chr3 = ((test(enc3) & 0x03) << 6) | test(enc4); + output += String.fromCharCode(chr1); + if (enc3 !== 64) { + output += String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output += String.fromCharCode(chr3); + } + } + if (cutTailZeros) { + const outputLength = output.length; + let nonZeroStart = (-1); + for (let i = (outputLength - 1); i >= 0; i--) { + if (output.charCodeAt(i) !== 0) { + nonZeroStart = i; + break; + } + } + if (nonZeroStart !== (-1)) { + output = output.slice(0, nonZeroStart + 1); + } + else { + output = ""; + } + } + return output; +} +function arrayBufferToString(buffer) { + let resultString = ""; + const view = new Uint8Array(buffer); + for (const element of view) { + resultString += String.fromCharCode(element); + } + return resultString; +} +function stringToArrayBuffer(str) { + const stringLength = str.length; + const resultBuffer = new ArrayBuffer(stringLength); + const resultView = new Uint8Array(resultBuffer); + for (let i = 0; i < stringLength; i++) { + resultView[i] = str.charCodeAt(i); + } + return resultBuffer; +} +const log2 = Math.log(2); +function nearestPowerOf2(length) { + const base = (Math.log(length) / log2); + const floor = Math.floor(base); + const round = Math.round(base); + return ((floor === round) ? floor : round); +} +function clearProps(object, propsArray) { + for (const prop of propsArray) { + delete object[prop]; + } +} + + + +;// CONCATENATED MODULE: ./node_modules/asn1js/build/index.es.js +/*! + * Copyright (c) 2014, GMO GlobalSign + * Copyright (c) 2015-2022, Peculiar Ventures + * All rights reserved. + * + * Author 2014-2019, Yury Strozhevsky + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + + +function assertBigInt() { + if (typeof BigInt === "undefined") { + throw new Error("BigInt is not defined. Your environment doesn't implement BigInt."); + } +} +function index_es_concat(buffers) { + let outputLength = 0; + let prevLength = 0; + for (let i = 0; i < buffers.length; i++) { + const buffer = buffers[i]; + outputLength += buffer.byteLength; + } + const retView = new Uint8Array(outputLength); + for (let i = 0; i < buffers.length; i++) { + const buffer = buffers[i]; + retView.set(new Uint8Array(buffer), prevLength); + prevLength += buffer.byteLength; + } + return retView.buffer; +} +function index_es_checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) { + if (!(inputBuffer instanceof Uint8Array)) { + baseBlock.error = "Wrong parameter: inputBuffer must be 'Uint8Array'"; + return false; + } + if (!inputBuffer.byteLength) { + baseBlock.error = "Wrong parameter: inputBuffer has zero length"; + return false; + } + if (inputOffset < 0) { + baseBlock.error = "Wrong parameter: inputOffset less than zero"; + return false; + } + if (inputLength < 0) { + baseBlock.error = "Wrong parameter: inputLength less than zero"; + return false; + } + if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) { + baseBlock.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; + return false; + } + return true; +} + +class ViewWriter { + constructor() { + this.items = []; + } + write(buf) { + this.items.push(buf); + } + final() { + return index_es_concat(this.items); + } +} + +const powers2 = [new Uint8Array([1])]; +const digitsString = "0123456789"; +const NAME = "name"; +const VALUE_HEX_VIEW = "valueHexView"; +const IS_HEX_ONLY = "isHexOnly"; +const ID_BLOCK = "idBlock"; +const TAG_CLASS = "tagClass"; +const TAG_NUMBER = "tagNumber"; +const IS_CONSTRUCTED = "isConstructed"; +const FROM_BER = "fromBER"; +const TO_BER = "toBER"; +const LOCAL = "local"; +const EMPTY_STRING = ""; +const EMPTY_BUFFER = new ArrayBuffer(0); +const EMPTY_VIEW = new Uint8Array(0); +const END_OF_CONTENT_NAME = "EndOfContent"; +const OCTET_STRING_NAME = "OCTET STRING"; +const BIT_STRING_NAME = "BIT STRING"; + +function HexBlock(BaseClass) { + var _a; + return _a = class Some extends BaseClass { + constructor(...args) { + var _a; + super(...args); + const params = args[0] || {}; + this.isHexOnly = (_a = params.isHexOnly) !== null && _a !== void 0 ? _a : false; + this.valueHexView = params.valueHex ? build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(params.valueHex) : EMPTY_VIEW; + } + get valueHex() { + return this.valueHexView.slice().buffer; + } + set valueHex(value) { + this.valueHexView = new Uint8Array(value); + } + fromBER(inputBuffer, inputOffset, inputLength) { + const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer; + if (!index_es_checkBufferParams(this, view, inputOffset, inputLength)) { + return -1; + } + const endLength = inputOffset + inputLength; + this.valueHexView = view.subarray(inputOffset, endLength); + if (!this.valueHexView.length) { + this.warnings.push("Zero buffer length"); + return inputOffset; + } + this.blockLength = inputLength; + return endLength; + } + toBER(sizeOnly = false) { + if (!this.isHexOnly) { + this.error = "Flag 'isHexOnly' is not set, abort"; + return EMPTY_BUFFER; + } + if (sizeOnly) { + return new ArrayBuffer(this.valueHexView.byteLength); + } + return (this.valueHexView.byteLength === this.valueHexView.buffer.byteLength) + ? this.valueHexView.buffer + : this.valueHexView.slice().buffer; + } + toJSON() { + return { + ...super.toJSON(), + isHexOnly: this.isHexOnly, + valueHex: build/* Convert.ToHex */.ep.ToHex(this.valueHexView), + }; + } + }, + _a.NAME = "hexBlock", + _a; +} + +class LocalBaseBlock { + constructor({ blockLength = 0, error = EMPTY_STRING, warnings = [], valueBeforeDecode = EMPTY_VIEW, } = {}) { + this.blockLength = blockLength; + this.error = error; + this.warnings = warnings; + this.valueBeforeDecodeView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(valueBeforeDecode); + } + static blockName() { + return this.NAME; + } + get valueBeforeDecode() { + return this.valueBeforeDecodeView.slice().buffer; + } + set valueBeforeDecode(value) { + this.valueBeforeDecodeView = new Uint8Array(value); + } + toJSON() { + return { + blockName: this.constructor.NAME, + blockLength: this.blockLength, + error: this.error, + warnings: this.warnings, + valueBeforeDecode: build/* Convert.ToHex */.ep.ToHex(this.valueBeforeDecodeView), + }; + } +} +LocalBaseBlock.NAME = "baseBlock"; + +class ValueBlock extends LocalBaseBlock { + fromBER(inputBuffer, inputOffset, inputLength) { + throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'"); + } + toBER(sizeOnly, writer) { + throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'"); + } +} +ValueBlock.NAME = "valueBlock"; + +class LocalIdentificationBlock extends HexBlock(LocalBaseBlock) { + constructor({ idBlock = {}, } = {}) { + var _a, _b, _c, _d; + super(); + if (idBlock) { + this.isHexOnly = (_a = idBlock.isHexOnly) !== null && _a !== void 0 ? _a : false; + this.valueHexView = idBlock.valueHex ? build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(idBlock.valueHex) : EMPTY_VIEW; + this.tagClass = (_b = idBlock.tagClass) !== null && _b !== void 0 ? _b : -1; + this.tagNumber = (_c = idBlock.tagNumber) !== null && _c !== void 0 ? _c : -1; + this.isConstructed = (_d = idBlock.isConstructed) !== null && _d !== void 0 ? _d : false; + } + else { + this.tagClass = -1; + this.tagNumber = -1; + this.isConstructed = false; + } + } + toBER(sizeOnly = false) { + let firstOctet = 0; + switch (this.tagClass) { + case 1: + firstOctet |= 0x00; + break; + case 2: + firstOctet |= 0x40; + break; + case 3: + firstOctet |= 0x80; + break; + case 4: + firstOctet |= 0xC0; + break; + default: + this.error = "Unknown tag class"; + return EMPTY_BUFFER; + } + if (this.isConstructed) + firstOctet |= 0x20; + if (this.tagNumber < 31 && !this.isHexOnly) { + const retView = new Uint8Array(1); + if (!sizeOnly) { + let number = this.tagNumber; + number &= 0x1F; + firstOctet |= number; + retView[0] = firstOctet; + } + return retView.buffer; + } + if (!this.isHexOnly) { + const encodedBuf = utilToBase(this.tagNumber, 7); + const encodedView = new Uint8Array(encodedBuf); + const size = encodedBuf.byteLength; + const retView = new Uint8Array(size + 1); + retView[0] = (firstOctet | 0x1F); + if (!sizeOnly) { + for (let i = 0; i < (size - 1); i++) + retView[i + 1] = encodedView[i] | 0x80; + retView[size] = encodedView[size - 1]; + } + return retView.buffer; + } + const retView = new Uint8Array(this.valueHexView.byteLength + 1); + retView[0] = (firstOctet | 0x1F); + if (!sizeOnly) { + const curView = this.valueHexView; + for (let i = 0; i < (curView.length - 1); i++) + retView[i + 1] = curView[i] | 0x80; + retView[this.valueHexView.byteLength] = curView[curView.length - 1]; + } + return retView.buffer; + } + fromBER(inputBuffer, inputOffset, inputLength) { + const inputView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + if (!index_es_checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + if (intBuffer.length === 0) { + this.error = "Zero buffer length"; + return -1; + } + const tagClassMask = intBuffer[0] & 0xC0; + switch (tagClassMask) { + case 0x00: + this.tagClass = (1); + break; + case 0x40: + this.tagClass = (2); + break; + case 0x80: + this.tagClass = (3); + break; + case 0xC0: + this.tagClass = (4); + break; + default: + this.error = "Unknown tag class"; + return -1; + } + this.isConstructed = (intBuffer[0] & 0x20) === 0x20; + this.isHexOnly = false; + const tagNumberMask = intBuffer[0] & 0x1F; + if (tagNumberMask !== 0x1F) { + this.tagNumber = (tagNumberMask); + this.blockLength = 1; + } + else { + let count = 1; + let intTagNumberBuffer = this.valueHexView = new Uint8Array(255); + let tagNumberBufferMaxLength = 255; + while (intBuffer[count] & 0x80) { + intTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F; + count++; + if (count >= intBuffer.length) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + if (count === tagNumberBufferMaxLength) { + tagNumberBufferMaxLength += 255; + const tempBufferView = new Uint8Array(tagNumberBufferMaxLength); + for (let i = 0; i < intTagNumberBuffer.length; i++) + tempBufferView[i] = intTagNumberBuffer[i]; + intTagNumberBuffer = this.valueHexView = new Uint8Array(tagNumberBufferMaxLength); + } + } + this.blockLength = (count + 1); + intTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F; + const tempBufferView = new Uint8Array(count); + for (let i = 0; i < count; i++) + tempBufferView[i] = intTagNumberBuffer[i]; + intTagNumberBuffer = this.valueHexView = new Uint8Array(count); + intTagNumberBuffer.set(tempBufferView); + if (this.blockLength <= 9) + this.tagNumber = utilFromBase(intTagNumberBuffer, 7); + else { + this.isHexOnly = true; + this.warnings.push("Tag too long, represented as hex-coded"); + } + } + if (((this.tagClass === 1)) && + (this.isConstructed)) { + switch (this.tagNumber) { + case 1: + case 2: + case 5: + case 6: + case 9: + case 13: + case 14: + case 23: + case 24: + case 31: + case 32: + case 33: + case 34: + this.error = "Constructed encoding used for primitive type"; + return -1; + } + } + return (inputOffset + this.blockLength); + } + toJSON() { + return { + ...super.toJSON(), + tagClass: this.tagClass, + tagNumber: this.tagNumber, + isConstructed: this.isConstructed, + }; + } +} +LocalIdentificationBlock.NAME = "identificationBlock"; + +class LocalLengthBlock extends LocalBaseBlock { + constructor({ lenBlock = {}, } = {}) { + var _a, _b, _c; + super(); + this.isIndefiniteForm = (_a = lenBlock.isIndefiniteForm) !== null && _a !== void 0 ? _a : false; + this.longFormUsed = (_b = lenBlock.longFormUsed) !== null && _b !== void 0 ? _b : false; + this.length = (_c = lenBlock.length) !== null && _c !== void 0 ? _c : 0; + } + fromBER(inputBuffer, inputOffset, inputLength) { + const view = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + if (!index_es_checkBufferParams(this, view, inputOffset, inputLength)) { + return -1; + } + const intBuffer = view.subarray(inputOffset, inputOffset + inputLength); + if (intBuffer.length === 0) { + this.error = "Zero buffer length"; + return -1; + } + if (intBuffer[0] === 0xFF) { + this.error = "Length block 0xFF is reserved by standard"; + return -1; + } + this.isIndefiniteForm = intBuffer[0] === 0x80; + if (this.isIndefiniteForm) { + this.blockLength = 1; + return (inputOffset + this.blockLength); + } + this.longFormUsed = !!(intBuffer[0] & 0x80); + if (this.longFormUsed === false) { + this.length = (intBuffer[0]); + this.blockLength = 1; + return (inputOffset + this.blockLength); + } + const count = intBuffer[0] & 0x7F; + if (count > 8) { + this.error = "Too big integer"; + return -1; + } + if ((count + 1) > intBuffer.length) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + const lenOffset = inputOffset + 1; + const lengthBufferView = view.subarray(lenOffset, lenOffset + count); + if (lengthBufferView[count - 1] === 0x00) + this.warnings.push("Needlessly long encoded length"); + this.length = utilFromBase(lengthBufferView, 8); + if (this.longFormUsed && (this.length <= 127)) + this.warnings.push("Unnecessary usage of long length form"); + this.blockLength = count + 1; + return (inputOffset + this.blockLength); + } + toBER(sizeOnly = false) { + let retBuf; + let retView; + if (this.length > 127) + this.longFormUsed = true; + if (this.isIndefiniteForm) { + retBuf = new ArrayBuffer(1); + if (sizeOnly === false) { + retView = new Uint8Array(retBuf); + retView[0] = 0x80; + } + return retBuf; + } + if (this.longFormUsed) { + const encodedBuf = utilToBase(this.length, 8); + if (encodedBuf.byteLength > 127) { + this.error = "Too big length"; + return (EMPTY_BUFFER); + } + retBuf = new ArrayBuffer(encodedBuf.byteLength + 1); + if (sizeOnly) + return retBuf; + const encodedView = new Uint8Array(encodedBuf); + retView = new Uint8Array(retBuf); + retView[0] = encodedBuf.byteLength | 0x80; + for (let i = 0; i < encodedBuf.byteLength; i++) + retView[i + 1] = encodedView[i]; + return retBuf; + } + retBuf = new ArrayBuffer(1); + if (sizeOnly === false) { + retView = new Uint8Array(retBuf); + retView[0] = this.length; + } + return retBuf; + } + toJSON() { + return { + ...super.toJSON(), + isIndefiniteForm: this.isIndefiniteForm, + longFormUsed: this.longFormUsed, + length: this.length, + }; + } +} +LocalLengthBlock.NAME = "lengthBlock"; + +const typeStore = {}; + +class BaseBlock extends LocalBaseBlock { + constructor({ name = EMPTY_STRING, optional = false, primitiveSchema, ...parameters } = {}, valueBlockType) { + super(parameters); + this.name = name; + this.optional = optional; + if (primitiveSchema) { + this.primitiveSchema = primitiveSchema; + } + this.idBlock = new LocalIdentificationBlock(parameters); + this.lenBlock = new LocalLengthBlock(parameters); + this.valueBlock = valueBlockType ? new valueBlockType(parameters) : new ValueBlock(parameters); + } + fromBER(inputBuffer, inputOffset, inputLength) { + const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length); + if (resultOffset === -1) { + this.error = this.valueBlock.error; + return resultOffset; + } + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + if (!this.valueBlock.error.length) + this.blockLength += this.valueBlock.blockLength; + return resultOffset; + } + toBER(sizeOnly, writer) { + const _writer = writer || new ViewWriter(); + if (!writer) { + prepareIndefiniteForm(this); + } + const idBlockBuf = this.idBlock.toBER(sizeOnly); + _writer.write(idBlockBuf); + if (this.lenBlock.isIndefiniteForm) { + _writer.write(new Uint8Array([0x80]).buffer); + this.valueBlock.toBER(sizeOnly, _writer); + _writer.write(new ArrayBuffer(2)); + } + else { + const valueBlockBuf = this.valueBlock.toBER(sizeOnly); + this.lenBlock.length = valueBlockBuf.byteLength; + const lenBlockBuf = this.lenBlock.toBER(sizeOnly); + _writer.write(lenBlockBuf); + _writer.write(valueBlockBuf); + } + if (!writer) { + return _writer.final(); + } + return EMPTY_BUFFER; + } + toJSON() { + const object = { + ...super.toJSON(), + idBlock: this.idBlock.toJSON(), + lenBlock: this.lenBlock.toJSON(), + valueBlock: this.valueBlock.toJSON(), + name: this.name, + optional: this.optional, + }; + if (this.primitiveSchema) + object.primitiveSchema = this.primitiveSchema.toJSON(); + return object; + } + toString(encoding = "ascii") { + if (encoding === "ascii") { + return this.onAsciiEncoding(); + } + return build/* Convert.ToHex */.ep.ToHex(this.toBER()); + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${build/* Convert.ToHex */.ep.ToHex(this.valueBlock.valueBeforeDecodeView)}`; + } + isEqual(other) { + if (this === other) { + return true; + } + if (!(other instanceof this.constructor)) { + return false; + } + const thisRaw = this.toBER(); + const otherRaw = other.toBER(); + return isEqualBuffer(thisRaw, otherRaw); + } +} +BaseBlock.NAME = "BaseBlock"; +function prepareIndefiniteForm(baseBlock) { + if (baseBlock instanceof typeStore.Constructed) { + for (const value of baseBlock.valueBlock.value) { + if (prepareIndefiniteForm(value)) { + baseBlock.lenBlock.isIndefiniteForm = true; + } + } + } + return !!baseBlock.lenBlock.isIndefiniteForm; +} + +class BaseStringBlock extends BaseBlock { + constructor({ value = EMPTY_STRING, ...parameters } = {}, stringValueBlockType) { + super(parameters, stringValueBlockType); + if (value) { + this.fromString(value); + } + } + getValue() { + return this.valueBlock.value; + } + setValue(value) { + this.valueBlock.value = value; + } + fromBER(inputBuffer, inputOffset, inputLength) { + const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length); + if (resultOffset === -1) { + this.error = this.valueBlock.error; + return resultOffset; + } + this.fromBuffer(this.valueBlock.valueHexView); + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + if (!this.valueBlock.error.length) + this.blockLength += this.valueBlock.blockLength; + return resultOffset; + } + onAsciiEncoding() { + return `${this.constructor.NAME} : '${this.valueBlock.value}'`; + } +} +BaseStringBlock.NAME = "BaseStringBlock"; + +class LocalPrimitiveValueBlock extends HexBlock(ValueBlock) { + constructor({ isHexOnly = true, ...parameters } = {}) { + super(parameters); + this.isHexOnly = isHexOnly; + } +} +LocalPrimitiveValueBlock.NAME = "PrimitiveValueBlock"; + +var _a$w; +class Primitive extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalPrimitiveValueBlock); + this.idBlock.isConstructed = false; + } +} +_a$w = Primitive; +(() => { + typeStore.Primitive = _a$w; +})(); +Primitive.NAME = "PRIMITIVE"; + +function localChangeType(inputObject, newType) { + if (inputObject instanceof newType) { + return inputObject; + } + const newObject = new newType(); + newObject.idBlock = inputObject.idBlock; + newObject.lenBlock = inputObject.lenBlock; + newObject.warnings = inputObject.warnings; + newObject.valueBeforeDecodeView = inputObject.valueBeforeDecodeView; + return newObject; +} +function localFromBER(inputBuffer, inputOffset = 0, inputLength = inputBuffer.length) { + const incomingOffset = inputOffset; + let returnObject = new BaseBlock({}, ValueBlock); + const baseBlock = new LocalBaseBlock(); + if (!index_es_checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength)) { + returnObject.error = baseBlock.error; + return { + offset: -1, + result: returnObject + }; + } + const intBuffer = inputBuffer.subarray(inputOffset, inputOffset + inputLength); + if (!intBuffer.length) { + returnObject.error = "Zero buffer length"; + return { + offset: -1, + result: returnObject + }; + } + let resultOffset = returnObject.idBlock.fromBER(inputBuffer, inputOffset, inputLength); + if (returnObject.idBlock.warnings.length) { + returnObject.warnings.concat(returnObject.idBlock.warnings); + } + if (resultOffset === -1) { + returnObject.error = returnObject.idBlock.error; + return { + offset: -1, + result: returnObject + }; + } + inputOffset = resultOffset; + inputLength -= returnObject.idBlock.blockLength; + resultOffset = returnObject.lenBlock.fromBER(inputBuffer, inputOffset, inputLength); + if (returnObject.lenBlock.warnings.length) { + returnObject.warnings.concat(returnObject.lenBlock.warnings); + } + if (resultOffset === -1) { + returnObject.error = returnObject.lenBlock.error; + return { + offset: -1, + result: returnObject + }; + } + inputOffset = resultOffset; + inputLength -= returnObject.lenBlock.blockLength; + if (!returnObject.idBlock.isConstructed && + returnObject.lenBlock.isIndefiniteForm) { + returnObject.error = "Indefinite length form used for primitive encoding form"; + return { + offset: -1, + result: returnObject + }; + } + let newASN1Type = BaseBlock; + switch (returnObject.idBlock.tagClass) { + case 1: + if ((returnObject.idBlock.tagNumber >= 37) && + (returnObject.idBlock.isHexOnly === false)) { + returnObject.error = "UNIVERSAL 37 and upper tags are reserved by ASN.1 standard"; + return { + offset: -1, + result: returnObject + }; + } + switch (returnObject.idBlock.tagNumber) { + case 0: + if ((returnObject.idBlock.isConstructed) && + (returnObject.lenBlock.length > 0)) { + returnObject.error = "Type [UNIVERSAL 0] is reserved"; + return { + offset: -1, + result: returnObject + }; + } + newASN1Type = typeStore.EndOfContent; + break; + case 1: + newASN1Type = typeStore.Boolean; + break; + case 2: + newASN1Type = typeStore.Integer; + break; + case 3: + newASN1Type = typeStore.BitString; + break; + case 4: + newASN1Type = typeStore.OctetString; + break; + case 5: + newASN1Type = typeStore.Null; + break; + case 6: + newASN1Type = typeStore.ObjectIdentifier; + break; + case 10: + newASN1Type = typeStore.Enumerated; + break; + case 12: + newASN1Type = typeStore.Utf8String; + break; + case 13: + newASN1Type = typeStore.RelativeObjectIdentifier; + break; + case 14: + newASN1Type = typeStore.TIME; + break; + case 15: + returnObject.error = "[UNIVERSAL 15] is reserved by ASN.1 standard"; + return { + offset: -1, + result: returnObject + }; + case 16: + newASN1Type = typeStore.Sequence; + break; + case 17: + newASN1Type = typeStore.Set; + break; + case 18: + newASN1Type = typeStore.NumericString; + break; + case 19: + newASN1Type = typeStore.PrintableString; + break; + case 20: + newASN1Type = typeStore.TeletexString; + break; + case 21: + newASN1Type = typeStore.VideotexString; + break; + case 22: + newASN1Type = typeStore.IA5String; + break; + case 23: + newASN1Type = typeStore.UTCTime; + break; + case 24: + newASN1Type = typeStore.GeneralizedTime; + break; + case 25: + newASN1Type = typeStore.GraphicString; + break; + case 26: + newASN1Type = typeStore.VisibleString; + break; + case 27: + newASN1Type = typeStore.GeneralString; + break; + case 28: + newASN1Type = typeStore.UniversalString; + break; + case 29: + newASN1Type = typeStore.CharacterString; + break; + case 30: + newASN1Type = typeStore.BmpString; + break; + case 31: + newASN1Type = typeStore.DATE; + break; + case 32: + newASN1Type = typeStore.TimeOfDay; + break; + case 33: + newASN1Type = typeStore.DateTime; + break; + case 34: + newASN1Type = typeStore.Duration; + break; + default: { + const newObject = returnObject.idBlock.isConstructed + ? new typeStore.Constructed() + : new typeStore.Primitive(); + newObject.idBlock = returnObject.idBlock; + newObject.lenBlock = returnObject.lenBlock; + newObject.warnings = returnObject.warnings; + returnObject = newObject; + } + } + break; + case 2: + case 3: + case 4: + default: { + newASN1Type = returnObject.idBlock.isConstructed + ? typeStore.Constructed + : typeStore.Primitive; + } + } + returnObject = localChangeType(returnObject, newASN1Type); + resultOffset = returnObject.fromBER(inputBuffer, inputOffset, returnObject.lenBlock.isIndefiniteForm ? inputLength : returnObject.lenBlock.length); + returnObject.valueBeforeDecodeView = inputBuffer.subarray(incomingOffset, incomingOffset + returnObject.blockLength); + return { + offset: resultOffset, + result: returnObject + }; +} +function fromBER(inputBuffer) { + if (!inputBuffer.byteLength) { + const result = new BaseBlock({}, ValueBlock); + result.error = "Input buffer has zero length"; + return { + offset: -1, + result + }; + } + return localFromBER(build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength); +} + +function checkLen(indefiniteLength, length) { + if (indefiniteLength) { + return 1; + } + return length; +} +class LocalConstructedValueBlock extends ValueBlock { + constructor({ value = [], isIndefiniteForm = false, ...parameters } = {}) { + super(parameters); + this.value = value; + this.isIndefiniteForm = isIndefiniteForm; + } + fromBER(inputBuffer, inputOffset, inputLength) { + const view = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + if (!index_es_checkBufferParams(this, view, inputOffset, inputLength)) { + return -1; + } + this.valueBeforeDecodeView = view.subarray(inputOffset, inputOffset + inputLength); + if (this.valueBeforeDecodeView.length === 0) { + this.warnings.push("Zero buffer length"); + return inputOffset; + } + let currentOffset = inputOffset; + while (checkLen(this.isIndefiniteForm, inputLength) > 0) { + const returnObject = localFromBER(view, currentOffset, inputLength); + if (returnObject.offset === -1) { + this.error = returnObject.result.error; + this.warnings.concat(returnObject.result.warnings); + return -1; + } + currentOffset = returnObject.offset; + this.blockLength += returnObject.result.blockLength; + inputLength -= returnObject.result.blockLength; + this.value.push(returnObject.result); + if (this.isIndefiniteForm && returnObject.result.constructor.NAME === END_OF_CONTENT_NAME) { + break; + } + } + if (this.isIndefiniteForm) { + if (this.value[this.value.length - 1].constructor.NAME === END_OF_CONTENT_NAME) { + this.value.pop(); + } + else { + this.warnings.push("No EndOfContent block encoded"); + } + } + return currentOffset; + } + toBER(sizeOnly, writer) { + const _writer = writer || new ViewWriter(); + for (let i = 0; i < this.value.length; i++) { + this.value[i].toBER(sizeOnly, _writer); + } + if (!writer) { + return _writer.final(); + } + return EMPTY_BUFFER; + } + toJSON() { + const object = { + ...super.toJSON(), + isIndefiniteForm: this.isIndefiniteForm, + value: [], + }; + for (const value of this.value) { + object.value.push(value.toJSON()); + } + return object; + } +} +LocalConstructedValueBlock.NAME = "ConstructedValueBlock"; + +var _a$v; +class Constructed extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalConstructedValueBlock); + this.idBlock.isConstructed = true; + } + fromBER(inputBuffer, inputOffset, inputLength) { + this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm; + const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length); + if (resultOffset === -1) { + this.error = this.valueBlock.error; + return resultOffset; + } + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + if (!this.valueBlock.error.length) + this.blockLength += this.valueBlock.blockLength; + return resultOffset; + } + onAsciiEncoding() { + const values = []; + for (const value of this.valueBlock.value) { + values.push(value.toString("ascii").split("\n").map(o => ` ${o}`).join("\n")); + } + const blockName = this.idBlock.tagClass === 3 + ? `[${this.idBlock.tagNumber}]` + : this.constructor.NAME; + return values.length + ? `${blockName} :\n${values.join("\n")}` + : `${blockName} :`; + } +} +_a$v = Constructed; +(() => { + typeStore.Constructed = _a$v; +})(); +Constructed.NAME = "CONSTRUCTED"; + +class LocalEndOfContentValueBlock extends ValueBlock { + fromBER(inputBuffer, inputOffset, inputLength) { + return inputOffset; + } + toBER(sizeOnly) { + return EMPTY_BUFFER; + } +} +LocalEndOfContentValueBlock.override = "EndOfContentValueBlock"; + +var _a$u; +class EndOfContent extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalEndOfContentValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 0; + } +} +_a$u = EndOfContent; +(() => { + typeStore.EndOfContent = _a$u; +})(); +EndOfContent.NAME = END_OF_CONTENT_NAME; + +var _a$t; +class Null extends BaseBlock { + constructor(parameters = {}) { + super(parameters, ValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 5; + } + fromBER(inputBuffer, inputOffset, inputLength) { + if (this.lenBlock.length > 0) + this.warnings.push("Non-zero length of value block for Null type"); + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + this.blockLength += inputLength; + if ((inputOffset + inputLength) > inputBuffer.byteLength) { + this.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; + return -1; + } + return (inputOffset + inputLength); + } + toBER(sizeOnly, writer) { + const retBuf = new ArrayBuffer(2); + if (!sizeOnly) { + const retView = new Uint8Array(retBuf); + retView[0] = 0x05; + retView[1] = 0x00; + } + if (writer) { + writer.write(retBuf); + } + return retBuf; + } + onAsciiEncoding() { + return `${this.constructor.NAME}`; + } +} +_a$t = Null; +(() => { + typeStore.Null = _a$t; +})(); +Null.NAME = "NULL"; + +class LocalBooleanValueBlock extends HexBlock(ValueBlock) { + constructor({ value, ...parameters } = {}) { + super(parameters); + if (parameters.valueHex) { + this.valueHexView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(parameters.valueHex); + } + else { + this.valueHexView = new Uint8Array(1); + } + if (value) { + this.value = value; + } + } + get value() { + for (const octet of this.valueHexView) { + if (octet > 0) { + return true; + } + } + return false; + } + set value(value) { + this.valueHexView[0] = value ? 0xFF : 0x00; + } + fromBER(inputBuffer, inputOffset, inputLength) { + const inputView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + if (!index_es_checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + this.valueHexView = inputView.subarray(inputOffset, inputOffset + inputLength); + if (inputLength > 1) + this.warnings.push("Boolean value encoded in more then 1 octet"); + this.isHexOnly = true; + utilDecodeTC.call(this); + this.blockLength = inputLength; + return (inputOffset + inputLength); + } + toBER() { + return this.valueHexView.slice(); + } + toJSON() { + return { + ...super.toJSON(), + value: this.value, + }; + } +} +LocalBooleanValueBlock.NAME = "BooleanValueBlock"; + +var _a$s; +class index_es_Boolean extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalBooleanValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 1; + } + getValue() { + return this.valueBlock.value; + } + setValue(value) { + this.valueBlock.value = value; + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.getValue}`; + } +} +_a$s = index_es_Boolean; +(() => { + typeStore.Boolean = _a$s; +})(); +index_es_Boolean.NAME = "BOOLEAN"; + +class LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock) { + constructor({ isConstructed = false, ...parameters } = {}) { + super(parameters); + this.isConstructed = isConstructed; + } + fromBER(inputBuffer, inputOffset, inputLength) { + let resultOffset = 0; + if (this.isConstructed) { + this.isHexOnly = false; + resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength); + if (resultOffset === -1) + return resultOffset; + for (let i = 0; i < this.value.length; i++) { + const currentBlockName = this.value[i].constructor.NAME; + if (currentBlockName === END_OF_CONTENT_NAME) { + if (this.isIndefiniteForm) + break; + else { + this.error = "EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only"; + return -1; + } + } + if (currentBlockName !== OCTET_STRING_NAME) { + this.error = "OCTET STRING may consists of OCTET STRINGs only"; + return -1; + } + } + } + else { + this.isHexOnly = true; + resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength); + this.blockLength = inputLength; + } + return resultOffset; + } + toBER(sizeOnly, writer) { + if (this.isConstructed) + return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer); + return sizeOnly + ? new ArrayBuffer(this.valueHexView.byteLength) + : this.valueHexView.slice().buffer; + } + toJSON() { + return { + ...super.toJSON(), + isConstructed: this.isConstructed, + }; + } +} +LocalOctetStringValueBlock.NAME = "OctetStringValueBlock"; + +var _a$r; +class OctetString extends BaseBlock { + constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) { + var _b, _c; + (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length)); + super({ + idBlock: { + isConstructed: parameters.isConstructed, + ...idBlock, + }, + lenBlock: { + ...lenBlock, + isIndefiniteForm: !!parameters.isIndefiniteForm, + }, + ...parameters, + }, LocalOctetStringValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 4; + } + fromBER(inputBuffer, inputOffset, inputLength) { + this.valueBlock.isConstructed = this.idBlock.isConstructed; + this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm; + if (inputLength === 0) { + if (this.idBlock.error.length === 0) + this.blockLength += this.idBlock.blockLength; + if (this.lenBlock.error.length === 0) + this.blockLength += this.lenBlock.blockLength; + return inputOffset; + } + if (!this.valueBlock.isConstructed) { + const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer; + const buf = view.subarray(inputOffset, inputOffset + inputLength); + try { + if (buf.byteLength) { + const asn = localFromBER(buf, 0, buf.byteLength); + if (asn.offset !== -1 && asn.offset === inputLength) { + this.valueBlock.value = [asn.result]; + } + } + } + catch (e) { + } + } + return super.fromBER(inputBuffer, inputOffset, inputLength); + } + onAsciiEncoding() { + if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) { + return Constructed.prototype.onAsciiEncoding.call(this); + } + return `${this.constructor.NAME} : ${build/* Convert.ToHex */.ep.ToHex(this.valueBlock.valueHexView)}`; + } + getValue() { + if (!this.idBlock.isConstructed) { + return this.valueBlock.valueHexView.slice().buffer; + } + const array = []; + for (const content of this.valueBlock.value) { + if (content instanceof OctetString) { + array.push(content.valueBlock.valueHexView); + } + } + return build/* BufferSourceConverter.concat */.vJ.concat(array); + } +} +_a$r = OctetString; +(() => { + typeStore.OctetString = _a$r; +})(); +OctetString.NAME = OCTET_STRING_NAME; + +class LocalBitStringValueBlock extends HexBlock(LocalConstructedValueBlock) { + constructor({ unusedBits = 0, isConstructed = false, ...parameters } = {}) { + super(parameters); + this.unusedBits = unusedBits; + this.isConstructed = isConstructed; + this.blockLength = this.valueHexView.byteLength; + } + fromBER(inputBuffer, inputOffset, inputLength) { + if (!inputLength) { + return inputOffset; + } + let resultOffset = -1; + if (this.isConstructed) { + resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength); + if (resultOffset === -1) + return resultOffset; + for (const value of this.value) { + const currentBlockName = value.constructor.NAME; + if (currentBlockName === END_OF_CONTENT_NAME) { + if (this.isIndefiniteForm) + break; + else { + this.error = "EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only"; + return -1; + } + } + if (currentBlockName !== BIT_STRING_NAME) { + this.error = "BIT STRING may consists of BIT STRINGs only"; + return -1; + } + const valueBlock = value.valueBlock; + if ((this.unusedBits > 0) && (valueBlock.unusedBits > 0)) { + this.error = "Using of \"unused bits\" inside constructive BIT STRING allowed for least one only"; + return -1; + } + this.unusedBits = valueBlock.unusedBits; + } + return resultOffset; + } + const inputView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + if (!index_es_checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + this.unusedBits = intBuffer[0]; + if (this.unusedBits > 7) { + this.error = "Unused bits for BitString must be in range 0-7"; + return -1; + } + if (!this.unusedBits) { + const buf = intBuffer.subarray(1); + try { + if (buf.byteLength) { + const asn = localFromBER(buf, 0, buf.byteLength); + if (asn.offset !== -1 && asn.offset === (inputLength - 1)) { + this.value = [asn.result]; + } + } + } + catch (e) { + } + } + this.valueHexView = intBuffer.subarray(1); + this.blockLength = intBuffer.length; + return (inputOffset + inputLength); + } + toBER(sizeOnly, writer) { + if (this.isConstructed) { + return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer); + } + if (sizeOnly) { + return new ArrayBuffer(this.valueHexView.byteLength + 1); + } + if (!this.valueHexView.byteLength) { + return EMPTY_BUFFER; + } + const retView = new Uint8Array(this.valueHexView.length + 1); + retView[0] = this.unusedBits; + retView.set(this.valueHexView, 1); + return retView.buffer; + } + toJSON() { + return { + ...super.toJSON(), + unusedBits: this.unusedBits, + isConstructed: this.isConstructed, + }; + } +} +LocalBitStringValueBlock.NAME = "BitStringValueBlock"; + +var _a$q; +class BitString extends BaseBlock { + constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) { + var _b, _c; + (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length)); + super({ + idBlock: { + isConstructed: parameters.isConstructed, + ...idBlock, + }, + lenBlock: { + ...lenBlock, + isIndefiniteForm: !!parameters.isIndefiniteForm, + }, + ...parameters, + }, LocalBitStringValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 3; + } + fromBER(inputBuffer, inputOffset, inputLength) { + this.valueBlock.isConstructed = this.idBlock.isConstructed; + this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm; + return super.fromBER(inputBuffer, inputOffset, inputLength); + } + onAsciiEncoding() { + if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) { + return Constructed.prototype.onAsciiEncoding.call(this); + } + else { + const bits = []; + const valueHex = this.valueBlock.valueHexView; + for (const byte of valueHex) { + bits.push(byte.toString(2).padStart(8, "0")); + } + const bitsStr = bits.join(""); + return `${this.constructor.NAME} : ${bitsStr.substring(0, bitsStr.length - this.valueBlock.unusedBits)}`; + } + } +} +_a$q = BitString; +(() => { + typeStore.BitString = _a$q; +})(); +BitString.NAME = BIT_STRING_NAME; + +var _a$p; +function viewAdd(first, second) { + const c = new Uint8Array([0]); + const firstView = new Uint8Array(first); + const secondView = new Uint8Array(second); + let firstViewCopy = firstView.slice(0); + const firstViewCopyLength = firstViewCopy.length - 1; + const secondViewCopy = secondView.slice(0); + const secondViewCopyLength = secondViewCopy.length - 1; + let value = 0; + const max = (secondViewCopyLength < firstViewCopyLength) ? firstViewCopyLength : secondViewCopyLength; + let counter = 0; + for (let i = max; i >= 0; i--, counter++) { + switch (true) { + case (counter < secondViewCopy.length): + value = firstViewCopy[firstViewCopyLength - counter] + secondViewCopy[secondViewCopyLength - counter] + c[0]; + break; + default: + value = firstViewCopy[firstViewCopyLength - counter] + c[0]; + } + c[0] = value / 10; + switch (true) { + case (counter >= firstViewCopy.length): + firstViewCopy = utilConcatView(new Uint8Array([value % 10]), firstViewCopy); + break; + default: + firstViewCopy[firstViewCopyLength - counter] = value % 10; + } + } + if (c[0] > 0) + firstViewCopy = utilConcatView(c, firstViewCopy); + return firstViewCopy; +} +function power2(n) { + if (n >= powers2.length) { + for (let p = powers2.length; p <= n; p++) { + const c = new Uint8Array([0]); + let digits = (powers2[p - 1]).slice(0); + for (let i = (digits.length - 1); i >= 0; i--) { + const newValue = new Uint8Array([(digits[i] << 1) + c[0]]); + c[0] = newValue[0] / 10; + digits[i] = newValue[0] % 10; + } + if (c[0] > 0) + digits = utilConcatView(c, digits); + powers2.push(digits); + } + } + return powers2[n]; +} +function viewSub(first, second) { + let b = 0; + const firstView = new Uint8Array(first); + const secondView = new Uint8Array(second); + const firstViewCopy = firstView.slice(0); + const firstViewCopyLength = firstViewCopy.length - 1; + const secondViewCopy = secondView.slice(0); + const secondViewCopyLength = secondViewCopy.length - 1; + let value; + let counter = 0; + for (let i = secondViewCopyLength; i >= 0; i--, counter++) { + value = firstViewCopy[firstViewCopyLength - counter] - secondViewCopy[secondViewCopyLength - counter] - b; + switch (true) { + case (value < 0): + b = 1; + firstViewCopy[firstViewCopyLength - counter] = value + 10; + break; + default: + b = 0; + firstViewCopy[firstViewCopyLength - counter] = value; + } + } + if (b > 0) { + for (let i = (firstViewCopyLength - secondViewCopyLength + 1); i >= 0; i--, counter++) { + value = firstViewCopy[firstViewCopyLength - counter] - b; + if (value < 0) { + b = 1; + firstViewCopy[firstViewCopyLength - counter] = value + 10; + } + else { + b = 0; + firstViewCopy[firstViewCopyLength - counter] = value; + break; + } + } + } + return firstViewCopy.slice(); +} +class LocalIntegerValueBlock extends HexBlock(ValueBlock) { + constructor({ value, ...parameters } = {}) { + super(parameters); + this._valueDec = 0; + if (parameters.valueHex) { + this.setValueHex(); + } + if (value !== undefined) { + this.valueDec = value; + } + } + setValueHex() { + if (this.valueHexView.length >= 4) { + this.warnings.push("Too big Integer for decoding, hex only"); + this.isHexOnly = true; + this._valueDec = 0; + } + else { + this.isHexOnly = false; + if (this.valueHexView.length > 0) { + this._valueDec = utilDecodeTC.call(this); + } + } + } + set valueDec(v) { + this._valueDec = v; + this.isHexOnly = false; + this.valueHexView = new Uint8Array(utilEncodeTC(v)); + } + get valueDec() { + return this._valueDec; + } + fromDER(inputBuffer, inputOffset, inputLength, expectedLength = 0) { + const offset = this.fromBER(inputBuffer, inputOffset, inputLength); + if (offset === -1) + return offset; + const view = this.valueHexView; + if ((view[0] === 0x00) && ((view[1] & 0x80) !== 0)) { + this.valueHexView = view.subarray(1); + } + else { + if (expectedLength !== 0) { + if (view.length < expectedLength) { + if ((expectedLength - view.length) > 1) + expectedLength = view.length + 1; + this.valueHexView = view.subarray(expectedLength - view.length); + } + } + } + return offset; + } + toDER(sizeOnly = false) { + const view = this.valueHexView; + switch (true) { + case ((view[0] & 0x80) !== 0): + { + const updatedView = new Uint8Array(this.valueHexView.length + 1); + updatedView[0] = 0x00; + updatedView.set(view, 1); + this.valueHexView = updatedView; + } + break; + case ((view[0] === 0x00) && ((view[1] & 0x80) === 0)): + { + this.valueHexView = this.valueHexView.subarray(1); + } + break; + } + return this.toBER(sizeOnly); + } + fromBER(inputBuffer, inputOffset, inputLength) { + const resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength); + if (resultOffset === -1) { + return resultOffset; + } + this.setValueHex(); + return resultOffset; + } + toBER(sizeOnly) { + return sizeOnly + ? new ArrayBuffer(this.valueHexView.length) + : this.valueHexView.slice().buffer; + } + toJSON() { + return { + ...super.toJSON(), + valueDec: this.valueDec, + }; + } + toString() { + const firstBit = (this.valueHexView.length * 8) - 1; + let digits = new Uint8Array((this.valueHexView.length * 8) / 3); + let bitNumber = 0; + let currentByte; + const asn1View = this.valueHexView; + let result = ""; + let flag = false; + for (let byteNumber = (asn1View.byteLength - 1); byteNumber >= 0; byteNumber--) { + currentByte = asn1View[byteNumber]; + for (let i = 0; i < 8; i++) { + if ((currentByte & 1) === 1) { + switch (bitNumber) { + case firstBit: + digits = viewSub(power2(bitNumber), digits); + result = "-"; + break; + default: + digits = viewAdd(digits, power2(bitNumber)); + } + } + bitNumber++; + currentByte >>= 1; + } + } + for (let i = 0; i < digits.length; i++) { + if (digits[i]) + flag = true; + if (flag) + result += digitsString.charAt(digits[i]); + } + if (flag === false) + result += digitsString.charAt(0); + return result; + } +} +_a$p = LocalIntegerValueBlock; +LocalIntegerValueBlock.NAME = "IntegerValueBlock"; +(() => { + Object.defineProperty(_a$p.prototype, "valueHex", { + set: function (v) { + this.valueHexView = new Uint8Array(v); + this.setValueHex(); + }, + get: function () { + return this.valueHexView.slice().buffer; + }, + }); +})(); + +var _a$o; +class Integer extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalIntegerValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 2; + } + toBigInt() { + assertBigInt(); + return BigInt(this.valueBlock.toString()); + } + static fromBigInt(value) { + assertBigInt(); + const bigIntValue = BigInt(value); + const writer = new ViewWriter(); + const hex = bigIntValue.toString(16).replace(/^-/, ""); + const view = new Uint8Array(build/* Convert.FromHex */.ep.FromHex(hex)); + if (bigIntValue < 0) { + const first = new Uint8Array(view.length + (view[0] & 0x80 ? 1 : 0)); + first[0] |= 0x80; + const firstInt = BigInt(`0x${build/* Convert.ToHex */.ep.ToHex(first)}`); + const secondInt = firstInt + bigIntValue; + const second = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(build/* Convert.FromHex */.ep.FromHex(secondInt.toString(16))); + second[0] |= 0x80; + writer.write(second); + } + else { + if (view[0] & 0x80) { + writer.write(new Uint8Array([0])); + } + writer.write(view); + } + const res = new Integer({ + valueHex: writer.final(), + }); + return res; + } + convertToDER() { + const integer = new Integer({ valueHex: this.valueBlock.valueHexView }); + integer.valueBlock.toDER(); + return integer; + } + convertFromDER() { + return new Integer({ + valueHex: this.valueBlock.valueHexView[0] === 0 + ? this.valueBlock.valueHexView.subarray(1) + : this.valueBlock.valueHexView, + }); + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.valueBlock.toString()}`; + } +} +_a$o = Integer; +(() => { + typeStore.Integer = _a$o; +})(); +Integer.NAME = "INTEGER"; + +var _a$n; +class Enumerated extends Integer { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 10; + } +} +_a$n = Enumerated; +(() => { + typeStore.Enumerated = _a$n; +})(); +Enumerated.NAME = "ENUMERATED"; + +class LocalSidValueBlock extends HexBlock(ValueBlock) { + constructor({ valueDec = -1, isFirstSid = false, ...parameters } = {}) { + super(parameters); + this.valueDec = valueDec; + this.isFirstSid = isFirstSid; + } + fromBER(inputBuffer, inputOffset, inputLength) { + if (!inputLength) { + return inputOffset; + } + const inputView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + if (!index_es_checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + this.valueHexView = new Uint8Array(inputLength); + for (let i = 0; i < inputLength; i++) { + this.valueHexView[i] = intBuffer[i] & 0x7F; + this.blockLength++; + if ((intBuffer[i] & 0x80) === 0x00) + break; + } + const tempView = new Uint8Array(this.blockLength); + for (let i = 0; i < this.blockLength; i++) { + tempView[i] = this.valueHexView[i]; + } + this.valueHexView = tempView; + if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + if (this.valueHexView[0] === 0x00) + this.warnings.push("Needlessly long format of SID encoding"); + if (this.blockLength <= 8) + this.valueDec = utilFromBase(this.valueHexView, 7); + else { + this.isHexOnly = true; + this.warnings.push("Too big SID for decoding, hex only"); + } + return (inputOffset + this.blockLength); + } + set valueBigInt(value) { + assertBigInt(); + let bits = BigInt(value).toString(2); + while (bits.length % 7) { + bits = "0" + bits; + } + const bytes = new Uint8Array(bits.length / 7); + for (let i = 0; i < bytes.length; i++) { + bytes[i] = parseInt(bits.slice(i * 7, i * 7 + 7), 2) + (i + 1 < bytes.length ? 0x80 : 0); + } + this.fromBER(bytes.buffer, 0, bytes.length); + } + toBER(sizeOnly) { + if (this.isHexOnly) { + if (sizeOnly) + return (new ArrayBuffer(this.valueHexView.byteLength)); + const curView = this.valueHexView; + const retView = new Uint8Array(this.blockLength); + for (let i = 0; i < (this.blockLength - 1); i++) + retView[i] = curView[i] | 0x80; + retView[this.blockLength - 1] = curView[this.blockLength - 1]; + return retView.buffer; + } + const encodedBuf = utilToBase(this.valueDec, 7); + if (encodedBuf.byteLength === 0) { + this.error = "Error during encoding SID value"; + return EMPTY_BUFFER; + } + const retView = new Uint8Array(encodedBuf.byteLength); + if (!sizeOnly) { + const encodedView = new Uint8Array(encodedBuf); + const len = encodedBuf.byteLength - 1; + for (let i = 0; i < len; i++) + retView[i] = encodedView[i] | 0x80; + retView[len] = encodedView[len]; + } + return retView; + } + toString() { + let result = ""; + if (this.isHexOnly) + result = build/* Convert.ToHex */.ep.ToHex(this.valueHexView); + else { + if (this.isFirstSid) { + let sidValue = this.valueDec; + if (this.valueDec <= 39) + result = "0."; + else { + if (this.valueDec <= 79) { + result = "1."; + sidValue -= 40; + } + else { + result = "2."; + sidValue -= 80; + } + } + result += sidValue.toString(); + } + else + result = this.valueDec.toString(); + } + return result; + } + toJSON() { + return { + ...super.toJSON(), + valueDec: this.valueDec, + isFirstSid: this.isFirstSid, + }; + } +} +LocalSidValueBlock.NAME = "sidBlock"; + +class LocalObjectIdentifierValueBlock extends ValueBlock { + constructor({ value = EMPTY_STRING, ...parameters } = {}) { + super(parameters); + this.value = []; + if (value) { + this.fromString(value); + } + } + fromBER(inputBuffer, inputOffset, inputLength) { + let resultOffset = inputOffset; + while (inputLength > 0) { + const sidBlock = new LocalSidValueBlock(); + resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength); + if (resultOffset === -1) { + this.blockLength = 0; + this.error = sidBlock.error; + return resultOffset; + } + if (this.value.length === 0) + sidBlock.isFirstSid = true; + this.blockLength += sidBlock.blockLength; + inputLength -= sidBlock.blockLength; + this.value.push(sidBlock); + } + return resultOffset; + } + toBER(sizeOnly) { + const retBuffers = []; + for (let i = 0; i < this.value.length; i++) { + const valueBuf = this.value[i].toBER(sizeOnly); + if (valueBuf.byteLength === 0) { + this.error = this.value[i].error; + return EMPTY_BUFFER; + } + retBuffers.push(valueBuf); + } + return index_es_concat(retBuffers); + } + fromString(string) { + this.value = []; + let pos1 = 0; + let pos2 = 0; + let sid = ""; + let flag = false; + do { + pos2 = string.indexOf(".", pos1); + if (pos2 === -1) + sid = string.substring(pos1); + else + sid = string.substring(pos1, pos2); + pos1 = pos2 + 1; + if (flag) { + const sidBlock = this.value[0]; + let plus = 0; + switch (sidBlock.valueDec) { + case 0: + break; + case 1: + plus = 40; + break; + case 2: + plus = 80; + break; + default: + this.value = []; + return; + } + const parsedSID = parseInt(sid, 10); + if (isNaN(parsedSID)) + return; + sidBlock.valueDec = parsedSID + plus; + flag = false; + } + else { + const sidBlock = new LocalSidValueBlock(); + if (sid > Number.MAX_SAFE_INTEGER) { + assertBigInt(); + const sidValue = BigInt(sid); + sidBlock.valueBigInt = sidValue; + } + else { + sidBlock.valueDec = parseInt(sid, 10); + if (isNaN(sidBlock.valueDec)) + return; + } + if (!this.value.length) { + sidBlock.isFirstSid = true; + flag = true; + } + this.value.push(sidBlock); + } + } while (pos2 !== -1); + } + toString() { + let result = ""; + let isHexOnly = false; + for (let i = 0; i < this.value.length; i++) { + isHexOnly = this.value[i].isHexOnly; + let sidStr = this.value[i].toString(); + if (i !== 0) + result = `${result}.`; + if (isHexOnly) { + sidStr = `{${sidStr}}`; + if (this.value[i].isFirstSid) + result = `2.{${sidStr} - 80}`; + else + result += sidStr; + } + else + result += sidStr; + } + return result; + } + toJSON() { + const object = { + ...super.toJSON(), + value: this.toString(), + sidArray: [], + }; + for (let i = 0; i < this.value.length; i++) { + object.sidArray.push(this.value[i].toJSON()); + } + return object; + } +} +LocalObjectIdentifierValueBlock.NAME = "ObjectIdentifierValueBlock"; + +var _a$m; +class ObjectIdentifier extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalObjectIdentifierValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 6; + } + getValue() { + return this.valueBlock.toString(); + } + setValue(value) { + this.valueBlock.fromString(value); + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.valueBlock.toString() || "empty"}`; + } + toJSON() { + return { + ...super.toJSON(), + value: this.getValue(), + }; + } +} +_a$m = ObjectIdentifier; +(() => { + typeStore.ObjectIdentifier = _a$m; +})(); +ObjectIdentifier.NAME = "OBJECT IDENTIFIER"; + +class LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) { + constructor({ valueDec = 0, ...parameters } = {}) { + super(parameters); + this.valueDec = valueDec; + } + fromBER(inputBuffer, inputOffset, inputLength) { + if (inputLength === 0) + return inputOffset; + const inputView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + if (!index_es_checkBufferParams(this, inputView, inputOffset, inputLength)) + return -1; + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + this.valueHexView = new Uint8Array(inputLength); + for (let i = 0; i < inputLength; i++) { + this.valueHexView[i] = intBuffer[i] & 0x7F; + this.blockLength++; + if ((intBuffer[i] & 0x80) === 0x00) + break; + } + const tempView = new Uint8Array(this.blockLength); + for (let i = 0; i < this.blockLength; i++) + tempView[i] = this.valueHexView[i]; + this.valueHexView = tempView; + if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + if (this.valueHexView[0] === 0x00) + this.warnings.push("Needlessly long format of SID encoding"); + if (this.blockLength <= 8) + this.valueDec = utilFromBase(this.valueHexView, 7); + else { + this.isHexOnly = true; + this.warnings.push("Too big SID for decoding, hex only"); + } + return (inputOffset + this.blockLength); + } + toBER(sizeOnly) { + if (this.isHexOnly) { + if (sizeOnly) + return (new ArrayBuffer(this.valueHexView.byteLength)); + const curView = this.valueHexView; + const retView = new Uint8Array(this.blockLength); + for (let i = 0; i < (this.blockLength - 1); i++) + retView[i] = curView[i] | 0x80; + retView[this.blockLength - 1] = curView[this.blockLength - 1]; + return retView.buffer; + } + const encodedBuf = utilToBase(this.valueDec, 7); + if (encodedBuf.byteLength === 0) { + this.error = "Error during encoding SID value"; + return EMPTY_BUFFER; + } + const retView = new Uint8Array(encodedBuf.byteLength); + if (!sizeOnly) { + const encodedView = new Uint8Array(encodedBuf); + const len = encodedBuf.byteLength - 1; + for (let i = 0; i < len; i++) + retView[i] = encodedView[i] | 0x80; + retView[len] = encodedView[len]; + } + return retView.buffer; + } + toString() { + let result = ""; + if (this.isHexOnly) + result = build/* Convert.ToHex */.ep.ToHex(this.valueHexView); + else { + result = this.valueDec.toString(); + } + return result; + } + toJSON() { + return { + ...super.toJSON(), + valueDec: this.valueDec, + }; + } +} +LocalRelativeSidValueBlock.NAME = "relativeSidBlock"; + +class LocalRelativeObjectIdentifierValueBlock extends ValueBlock { + constructor({ value = EMPTY_STRING, ...parameters } = {}) { + super(parameters); + this.value = []; + if (value) { + this.fromString(value); + } + } + fromBER(inputBuffer, inputOffset, inputLength) { + let resultOffset = inputOffset; + while (inputLength > 0) { + const sidBlock = new LocalRelativeSidValueBlock(); + resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength); + if (resultOffset === -1) { + this.blockLength = 0; + this.error = sidBlock.error; + return resultOffset; + } + this.blockLength += sidBlock.blockLength; + inputLength -= sidBlock.blockLength; + this.value.push(sidBlock); + } + return resultOffset; + } + toBER(sizeOnly, writer) { + const retBuffers = []; + for (let i = 0; i < this.value.length; i++) { + const valueBuf = this.value[i].toBER(sizeOnly); + if (valueBuf.byteLength === 0) { + this.error = this.value[i].error; + return EMPTY_BUFFER; + } + retBuffers.push(valueBuf); + } + return index_es_concat(retBuffers); + } + fromString(string) { + this.value = []; + let pos1 = 0; + let pos2 = 0; + let sid = ""; + do { + pos2 = string.indexOf(".", pos1); + if (pos2 === -1) + sid = string.substring(pos1); + else + sid = string.substring(pos1, pos2); + pos1 = pos2 + 1; + const sidBlock = new LocalRelativeSidValueBlock(); + sidBlock.valueDec = parseInt(sid, 10); + if (isNaN(sidBlock.valueDec)) + return true; + this.value.push(sidBlock); + } while (pos2 !== -1); + return true; + } + toString() { + let result = ""; + let isHexOnly = false; + for (let i = 0; i < this.value.length; i++) { + isHexOnly = this.value[i].isHexOnly; + let sidStr = this.value[i].toString(); + if (i !== 0) + result = `${result}.`; + if (isHexOnly) { + sidStr = `{${sidStr}}`; + result += sidStr; + } + else + result += sidStr; + } + return result; + } + toJSON() { + const object = { + ...super.toJSON(), + value: this.toString(), + sidArray: [], + }; + for (let i = 0; i < this.value.length; i++) + object.sidArray.push(this.value[i].toJSON()); + return object; + } +} +LocalRelativeObjectIdentifierValueBlock.NAME = "RelativeObjectIdentifierValueBlock"; + +var _a$l; +class RelativeObjectIdentifier extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalRelativeObjectIdentifierValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 13; + } + getValue() { + return this.valueBlock.toString(); + } + setValue(value) { + this.valueBlock.fromString(value); + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.valueBlock.toString() || "empty"}`; + } + toJSON() { + return { + ...super.toJSON(), + value: this.getValue(), + }; + } +} +_a$l = RelativeObjectIdentifier; +(() => { + typeStore.RelativeObjectIdentifier = _a$l; +})(); +RelativeObjectIdentifier.NAME = "RelativeObjectIdentifier"; + +var _a$k; +class Sequence extends Constructed { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 16; + } +} +_a$k = Sequence; +(() => { + typeStore.Sequence = _a$k; +})(); +Sequence.NAME = "SEQUENCE"; + +var _a$j; +class index_es_Set extends Constructed { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 17; + } +} +_a$j = index_es_Set; +(() => { + typeStore.Set = _a$j; +})(); +index_es_Set.NAME = "SET"; + +class LocalStringValueBlock extends HexBlock(ValueBlock) { + constructor({ ...parameters } = {}) { + super(parameters); + this.isHexOnly = true; + this.value = EMPTY_STRING; + } + toJSON() { + return { + ...super.toJSON(), + value: this.value, + }; + } +} +LocalStringValueBlock.NAME = "StringValueBlock"; + +class LocalSimpleStringValueBlock extends LocalStringValueBlock { +} +LocalSimpleStringValueBlock.NAME = "SimpleStringValueBlock"; + +class LocalSimpleStringBlock extends BaseStringBlock { + constructor({ ...parameters } = {}) { + super(parameters, LocalSimpleStringValueBlock); + } + fromBuffer(inputBuffer) { + this.valueBlock.value = String.fromCharCode.apply(null, build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer)); + } + fromString(inputString) { + const strLen = inputString.length; + const view = this.valueBlock.valueHexView = new Uint8Array(strLen); + for (let i = 0; i < strLen; i++) + view[i] = inputString.charCodeAt(i); + this.valueBlock.value = inputString; + } +} +LocalSimpleStringBlock.NAME = "SIMPLE STRING"; + +class LocalUtf8StringValueBlock extends LocalSimpleStringBlock { + fromBuffer(inputBuffer) { + this.valueBlock.valueHexView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + try { + this.valueBlock.value = build/* Convert.ToUtf8String */.ep.ToUtf8String(inputBuffer); + } + catch (ex) { + this.warnings.push(`Error during "decodeURIComponent": ${ex}, using raw string`); + this.valueBlock.value = build/* Convert.ToBinary */.ep.ToBinary(inputBuffer); + } + } + fromString(inputString) { + this.valueBlock.valueHexView = new Uint8Array(build/* Convert.FromUtf8String */.ep.FromUtf8String(inputString)); + this.valueBlock.value = inputString; + } +} +LocalUtf8StringValueBlock.NAME = "Utf8StringValueBlock"; + +var _a$i; +class Utf8String extends LocalUtf8StringValueBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 12; + } +} +_a$i = Utf8String; +(() => { + typeStore.Utf8String = _a$i; +})(); +Utf8String.NAME = "UTF8String"; + +class LocalBmpStringValueBlock extends LocalSimpleStringBlock { + fromBuffer(inputBuffer) { + this.valueBlock.value = build/* Convert.ToUtf16String */.ep.ToUtf16String(inputBuffer); + this.valueBlock.valueHexView = build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer); + } + fromString(inputString) { + this.valueBlock.value = inputString; + this.valueBlock.valueHexView = new Uint8Array(build/* Convert.FromUtf16String */.ep.FromUtf16String(inputString)); + } +} +LocalBmpStringValueBlock.NAME = "BmpStringValueBlock"; + +var _a$h; +class BmpString extends LocalBmpStringValueBlock { + constructor({ ...parameters } = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 30; + } +} +_a$h = BmpString; +(() => { + typeStore.BmpString = _a$h; +})(); +BmpString.NAME = "BMPString"; + +class LocalUniversalStringValueBlock extends LocalSimpleStringBlock { + fromBuffer(inputBuffer) { + const copyBuffer = ArrayBuffer.isView(inputBuffer) ? inputBuffer.slice().buffer : inputBuffer.slice(0); + const valueView = new Uint8Array(copyBuffer); + for (let i = 0; i < valueView.length; i += 4) { + valueView[i] = valueView[i + 3]; + valueView[i + 1] = valueView[i + 2]; + valueView[i + 2] = 0x00; + valueView[i + 3] = 0x00; + } + this.valueBlock.value = String.fromCharCode.apply(null, new Uint32Array(copyBuffer)); + } + fromString(inputString) { + const strLength = inputString.length; + const valueHexView = this.valueBlock.valueHexView = new Uint8Array(strLength * 4); + for (let i = 0; i < strLength; i++) { + const codeBuf = utilToBase(inputString.charCodeAt(i), 8); + const codeView = new Uint8Array(codeBuf); + if (codeView.length > 4) + continue; + const dif = 4 - codeView.length; + for (let j = (codeView.length - 1); j >= 0; j--) + valueHexView[i * 4 + j + dif] = codeView[j]; + } + this.valueBlock.value = inputString; + } +} +LocalUniversalStringValueBlock.NAME = "UniversalStringValueBlock"; + +var _a$g; +class UniversalString extends LocalUniversalStringValueBlock { + constructor({ ...parameters } = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 28; + } +} +_a$g = UniversalString; +(() => { + typeStore.UniversalString = _a$g; +})(); +UniversalString.NAME = "UniversalString"; + +var _a$f; +class NumericString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 18; + } +} +_a$f = NumericString; +(() => { + typeStore.NumericString = _a$f; +})(); +NumericString.NAME = "NumericString"; + +var _a$e; +class PrintableString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 19; + } +} +_a$e = PrintableString; +(() => { + typeStore.PrintableString = _a$e; +})(); +PrintableString.NAME = "PrintableString"; + +var _a$d; +class TeletexString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 20; + } +} +_a$d = TeletexString; +(() => { + typeStore.TeletexString = _a$d; +})(); +TeletexString.NAME = "TeletexString"; + +var _a$c; +class VideotexString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 21; + } +} +_a$c = VideotexString; +(() => { + typeStore.VideotexString = _a$c; +})(); +VideotexString.NAME = "VideotexString"; + +var _a$b; +class IA5String extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 22; + } +} +_a$b = IA5String; +(() => { + typeStore.IA5String = _a$b; +})(); +IA5String.NAME = "IA5String"; + +var _a$a; +class GraphicString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 25; + } +} +_a$a = GraphicString; +(() => { + typeStore.GraphicString = _a$a; +})(); +GraphicString.NAME = "GraphicString"; + +var _a$9; +class VisibleString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 26; + } +} +_a$9 = VisibleString; +(() => { + typeStore.VisibleString = _a$9; +})(); +VisibleString.NAME = "VisibleString"; + +var _a$8; +class GeneralString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 27; + } +} +_a$8 = GeneralString; +(() => { + typeStore.GeneralString = _a$8; +})(); +GeneralString.NAME = "GeneralString"; + +var _a$7; +class CharacterString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 29; + } +} +_a$7 = CharacterString; +(() => { + typeStore.CharacterString = _a$7; +})(); +CharacterString.NAME = "CharacterString"; + +var _a$6; +class UTCTime extends VisibleString { + constructor({ value, valueDate, ...parameters } = {}) { + super(parameters); + this.year = 0; + this.month = 0; + this.day = 0; + this.hour = 0; + this.minute = 0; + this.second = 0; + if (value) { + this.fromString(value); + this.valueBlock.valueHexView = new Uint8Array(value.length); + for (let i = 0; i < value.length; i++) + this.valueBlock.valueHexView[i] = value.charCodeAt(i); + } + if (valueDate) { + this.fromDate(valueDate); + this.valueBlock.valueHexView = new Uint8Array(this.toBuffer()); + } + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 23; + } + fromBuffer(inputBuffer) { + this.fromString(String.fromCharCode.apply(null, build/* BufferSourceConverter.toUint8Array */.vJ.toUint8Array(inputBuffer))); + } + toBuffer() { + const str = this.toString(); + const buffer = new ArrayBuffer(str.length); + const view = new Uint8Array(buffer); + for (let i = 0; i < str.length; i++) + view[i] = str.charCodeAt(i); + return buffer; + } + fromDate(inputDate) { + this.year = inputDate.getUTCFullYear(); + this.month = inputDate.getUTCMonth() + 1; + this.day = inputDate.getUTCDate(); + this.hour = inputDate.getUTCHours(); + this.minute = inputDate.getUTCMinutes(); + this.second = inputDate.getUTCSeconds(); + } + toDate() { + return (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second))); + } + fromString(inputString) { + const parser = /(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig; + const parserArray = parser.exec(inputString); + if (parserArray === null) { + this.error = "Wrong input string for conversion"; + return; + } + const year = parseInt(parserArray[1], 10); + if (year >= 50) + this.year = 1900 + year; + else + this.year = 2000 + year; + this.month = parseInt(parserArray[2], 10); + this.day = parseInt(parserArray[3], 10); + this.hour = parseInt(parserArray[4], 10); + this.minute = parseInt(parserArray[5], 10); + this.second = parseInt(parserArray[6], 10); + } + toString(encoding = "iso") { + if (encoding === "iso") { + const outputArray = new Array(7); + outputArray[0] = padNumber(((this.year < 2000) ? (this.year - 1900) : (this.year - 2000)), 2); + outputArray[1] = padNumber(this.month, 2); + outputArray[2] = padNumber(this.day, 2); + outputArray[3] = padNumber(this.hour, 2); + outputArray[4] = padNumber(this.minute, 2); + outputArray[5] = padNumber(this.second, 2); + outputArray[6] = "Z"; + return outputArray.join(""); + } + return super.toString(encoding); + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.toDate().toISOString()}`; + } + toJSON() { + return { + ...super.toJSON(), + year: this.year, + month: this.month, + day: this.day, + hour: this.hour, + minute: this.minute, + second: this.second, + }; + } +} +_a$6 = UTCTime; +(() => { + typeStore.UTCTime = _a$6; +})(); +UTCTime.NAME = "UTCTime"; + +var _a$5; +class GeneralizedTime extends UTCTime { + constructor(parameters = {}) { + var _b; + super(parameters); + (_b = this.millisecond) !== null && _b !== void 0 ? _b : (this.millisecond = 0); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 24; + } + fromDate(inputDate) { + super.fromDate(inputDate); + this.millisecond = inputDate.getUTCMilliseconds(); + } + toDate() { + return (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond))); + } + fromString(inputString) { + let isUTC = false; + let timeString = ""; + let dateTimeString = ""; + let fractionPart = 0; + let parser; + let hourDifference = 0; + let minuteDifference = 0; + if (inputString[inputString.length - 1] === "Z") { + timeString = inputString.substring(0, inputString.length - 1); + isUTC = true; + } + else { + const number = new Number(inputString[inputString.length - 1]); + if (isNaN(number.valueOf())) + throw new Error("Wrong input string for conversion"); + timeString = inputString; + } + if (isUTC) { + if (timeString.indexOf("+") !== -1) + throw new Error("Wrong input string for conversion"); + if (timeString.indexOf("-") !== -1) + throw new Error("Wrong input string for conversion"); + } + else { + let multiplier = 1; + let differencePosition = timeString.indexOf("+"); + let differenceString = ""; + if (differencePosition === -1) { + differencePosition = timeString.indexOf("-"); + multiplier = -1; + } + if (differencePosition !== -1) { + differenceString = timeString.substring(differencePosition + 1); + timeString = timeString.substring(0, differencePosition); + if ((differenceString.length !== 2) && (differenceString.length !== 4)) + throw new Error("Wrong input string for conversion"); + let number = parseInt(differenceString.substring(0, 2), 10); + if (isNaN(number.valueOf())) + throw new Error("Wrong input string for conversion"); + hourDifference = multiplier * number; + if (differenceString.length === 4) { + number = parseInt(differenceString.substring(2, 4), 10); + if (isNaN(number.valueOf())) + throw new Error("Wrong input string for conversion"); + minuteDifference = multiplier * number; + } + } + } + let fractionPointPosition = timeString.indexOf("."); + if (fractionPointPosition === -1) + fractionPointPosition = timeString.indexOf(","); + if (fractionPointPosition !== -1) { + const fractionPartCheck = new Number(`0${timeString.substring(fractionPointPosition)}`); + if (isNaN(fractionPartCheck.valueOf())) + throw new Error("Wrong input string for conversion"); + fractionPart = fractionPartCheck.valueOf(); + dateTimeString = timeString.substring(0, fractionPointPosition); + } + else + dateTimeString = timeString; + switch (true) { + case (dateTimeString.length === 8): + parser = /(\d{4})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) + throw new Error("Wrong input string for conversion"); + break; + case (dateTimeString.length === 10): + parser = /(\d{4})(\d{2})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) { + let fractionResult = 60 * fractionPart; + this.minute = Math.floor(fractionResult); + fractionResult = 60 * (fractionResult - this.minute); + this.second = Math.floor(fractionResult); + fractionResult = 1000 * (fractionResult - this.second); + this.millisecond = Math.floor(fractionResult); + } + break; + case (dateTimeString.length === 12): + parser = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) { + let fractionResult = 60 * fractionPart; + this.second = Math.floor(fractionResult); + fractionResult = 1000 * (fractionResult - this.second); + this.millisecond = Math.floor(fractionResult); + } + break; + case (dateTimeString.length === 14): + parser = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) { + const fractionResult = 1000 * fractionPart; + this.millisecond = Math.floor(fractionResult); + } + break; + default: + throw new Error("Wrong input string for conversion"); + } + const parserArray = parser.exec(dateTimeString); + if (parserArray === null) + throw new Error("Wrong input string for conversion"); + for (let j = 1; j < parserArray.length; j++) { + switch (j) { + case 1: + this.year = parseInt(parserArray[j], 10); + break; + case 2: + this.month = parseInt(parserArray[j], 10); + break; + case 3: + this.day = parseInt(parserArray[j], 10); + break; + case 4: + this.hour = parseInt(parserArray[j], 10) + hourDifference; + break; + case 5: + this.minute = parseInt(parserArray[j], 10) + minuteDifference; + break; + case 6: + this.second = parseInt(parserArray[j], 10); + break; + default: + throw new Error("Wrong input string for conversion"); + } + } + if (isUTC === false) { + const tempDate = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); + this.year = tempDate.getUTCFullYear(); + this.month = tempDate.getUTCMonth(); + this.day = tempDate.getUTCDay(); + this.hour = tempDate.getUTCHours(); + this.minute = tempDate.getUTCMinutes(); + this.second = tempDate.getUTCSeconds(); + this.millisecond = tempDate.getUTCMilliseconds(); + } + } + toString(encoding = "iso") { + if (encoding === "iso") { + const outputArray = []; + outputArray.push(padNumber(this.year, 4)); + outputArray.push(padNumber(this.month, 2)); + outputArray.push(padNumber(this.day, 2)); + outputArray.push(padNumber(this.hour, 2)); + outputArray.push(padNumber(this.minute, 2)); + outputArray.push(padNumber(this.second, 2)); + if (this.millisecond !== 0) { + outputArray.push("."); + outputArray.push(padNumber(this.millisecond, 3)); + } + outputArray.push("Z"); + return outputArray.join(""); + } + return super.toString(encoding); + } + toJSON() { + return { + ...super.toJSON(), + millisecond: this.millisecond, + }; + } +} +_a$5 = GeneralizedTime; +(() => { + typeStore.GeneralizedTime = _a$5; +})(); +GeneralizedTime.NAME = "GeneralizedTime"; + +var _a$4; +class DATE extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 31; + } +} +_a$4 = DATE; +(() => { + typeStore.DATE = _a$4; +})(); +DATE.NAME = "DATE"; + +var _a$3; +class TimeOfDay extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 32; + } +} +_a$3 = TimeOfDay; +(() => { + typeStore.TimeOfDay = _a$3; +})(); +TimeOfDay.NAME = "TimeOfDay"; + +var _a$2; +class DateTime extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 33; + } +} +_a$2 = DateTime; +(() => { + typeStore.DateTime = _a$2; +})(); +DateTime.NAME = "DateTime"; + +var _a$1; +class Duration extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 34; + } +} +_a$1 = Duration; +(() => { + typeStore.Duration = _a$1; +})(); +Duration.NAME = "Duration"; + +var _a; +class TIME extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 14; + } +} +_a = TIME; +(() => { + typeStore.TIME = _a; +})(); +TIME.NAME = "TIME"; + +class Any { + constructor({ name = EMPTY_STRING, optional = false, } = {}) { + this.name = name; + this.optional = optional; + } +} + +class Choice extends (/* unused pure expression or super */ null && (Any)) { + constructor({ value = [], ...parameters } = {}) { + super(parameters); + this.value = value; + } +} + +class Repeated extends (/* unused pure expression or super */ null && (Any)) { + constructor({ value = new Any(), local = false, ...parameters } = {}) { + super(parameters); + this.value = value; + this.local = local; + } +} + +class RawData { + constructor({ data = EMPTY_VIEW } = {}) { + this.dataView = pvtsutils.BufferSourceConverter.toUint8Array(data); + } + get data() { + return this.dataView.slice().buffer; + } + set data(value) { + this.dataView = pvtsutils.BufferSourceConverter.toUint8Array(value); + } + fromBER(inputBuffer, inputOffset, inputLength) { + const endLength = inputOffset + inputLength; + this.dataView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength); + return endLength; + } + toBER(sizeOnly) { + return this.dataView.slice().buffer; + } +} + +function compareSchema(root, inputData, inputSchema) { + if (inputSchema instanceof Choice) { + for (let j = 0; j < inputSchema.value.length; j++) { + const result = compareSchema(root, inputData, inputSchema.value[j]); + if (result.verified) { + return { + verified: true, + result: root + }; + } + } + { + const _result = { + verified: false, + result: { + error: "Wrong values for Choice type" + }, + }; + if (inputSchema.hasOwnProperty(NAME)) + _result.name = inputSchema.name; + return _result; + } + } + if (inputSchema instanceof Any) { + if (inputSchema.hasOwnProperty(NAME)) + root[inputSchema.name] = inputData; + return { + verified: true, + result: root + }; + } + if ((root instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong root object" } + }; + } + if ((inputData instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 data" } + }; + } + if ((inputSchema instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + if ((ID_BLOCK in inputSchema) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + if ((FROM_BER in inputSchema.idBlock) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + if ((TO_BER in inputSchema.idBlock) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + const encodedId = inputSchema.idBlock.toBER(false); + if (encodedId.byteLength === 0) { + return { + verified: false, + result: { error: "Error encoding idBlock for ASN.1 schema" } + }; + } + const decodedOffset = inputSchema.idBlock.fromBER(encodedId, 0, encodedId.byteLength); + if (decodedOffset === -1) { + return { + verified: false, + result: { error: "Error decoding idBlock for ASN.1 schema" } + }; + } + if (inputSchema.idBlock.hasOwnProperty(TAG_CLASS) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + if (inputSchema.idBlock.tagClass !== inputData.idBlock.tagClass) { + return { + verified: false, + result: root + }; + } + if (inputSchema.idBlock.hasOwnProperty(TAG_NUMBER) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + if (inputSchema.idBlock.tagNumber !== inputData.idBlock.tagNumber) { + return { + verified: false, + result: root + }; + } + if (inputSchema.idBlock.hasOwnProperty(IS_CONSTRUCTED) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + if (inputSchema.idBlock.isConstructed !== inputData.idBlock.isConstructed) { + return { + verified: false, + result: root + }; + } + if (!(IS_HEX_ONLY in inputSchema.idBlock)) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + if (inputSchema.idBlock.isHexOnly !== inputData.idBlock.isHexOnly) { + return { + verified: false, + result: root + }; + } + if (inputSchema.idBlock.isHexOnly) { + if ((VALUE_HEX_VIEW in inputSchema.idBlock) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" } + }; + } + const schemaView = inputSchema.idBlock.valueHexView; + const asn1View = inputData.idBlock.valueHexView; + if (schemaView.length !== asn1View.length) { + return { + verified: false, + result: root + }; + } + for (let i = 0; i < schemaView.length; i++) { + if (schemaView[i] !== asn1View[1]) { + return { + verified: false, + result: root + }; + } + } + } + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + root[inputSchema.name] = inputData; + } + if (inputSchema instanceof typeStore.Constructed) { + let admission = 0; + let result = { + verified: false, + result: { + error: "Unknown error", + } + }; + let maxLength = inputSchema.valueBlock.value.length; + if (maxLength > 0) { + if (inputSchema.valueBlock.value[0] instanceof Repeated) { + maxLength = inputData.valueBlock.value.length; + } + } + if (maxLength === 0) { + return { + verified: true, + result: root + }; + } + if ((inputData.valueBlock.value.length === 0) && + (inputSchema.valueBlock.value.length !== 0)) { + let _optional = true; + for (let i = 0; i < inputSchema.valueBlock.value.length; i++) + _optional = _optional && (inputSchema.valueBlock.value[i].optional || false); + if (_optional) { + return { + verified: true, + result: root + }; + } + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + delete root[inputSchema.name]; + } + root.error = "Inconsistent object length"; + return { + verified: false, + result: root + }; + } + for (let i = 0; i < maxLength; i++) { + if ((i - admission) >= inputData.valueBlock.value.length) { + if (inputSchema.valueBlock.value[i].optional === false) { + const _result = { + verified: false, + result: root + }; + root.error = "Inconsistent length between ASN.1 data and schema"; + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) { + delete root[inputSchema.name]; + _result.name = inputSchema.name; + } + } + return _result; + } + } + else { + if (inputSchema.valueBlock.value[0] instanceof Repeated) { + result = compareSchema(root, inputData.valueBlock.value[i], inputSchema.valueBlock.value[0].value); + if (result.verified === false) { + if (inputSchema.valueBlock.value[0].optional) + admission++; + else { + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + delete root[inputSchema.name]; + } + return result; + } + } + if ((NAME in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].name.length > 0)) { + let arrayRoot = {}; + if ((LOCAL in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].local)) + arrayRoot = inputData; + else + arrayRoot = root; + if (typeof arrayRoot[inputSchema.valueBlock.value[0].name] === "undefined") + arrayRoot[inputSchema.valueBlock.value[0].name] = []; + arrayRoot[inputSchema.valueBlock.value[0].name].push(inputData.valueBlock.value[i]); + } + } + else { + result = compareSchema(root, inputData.valueBlock.value[i - admission], inputSchema.valueBlock.value[i]); + if (result.verified === false) { + if (inputSchema.valueBlock.value[i].optional) + admission++; + else { + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + delete root[inputSchema.name]; + } + return result; + } + } + } + } + } + if (result.verified === false) { + const _result = { + verified: false, + result: root + }; + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) { + delete root[inputSchema.name]; + _result.name = inputSchema.name; + } + } + return _result; + } + return { + verified: true, + result: root + }; + } + if (inputSchema.primitiveSchema && + (VALUE_HEX_VIEW in inputData.valueBlock)) { + const asn1 = localFromBER(inputData.valueBlock.valueHexView); + if (asn1.offset === -1) { + const _result = { + verified: false, + result: asn1.result + }; + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) { + delete root[inputSchema.name]; + _result.name = inputSchema.name; + } + } + return _result; + } + return compareSchema(root, asn1.result, inputSchema.primitiveSchema); + } + return { + verified: true, + result: root + }; +} +function verifySchema(inputBuffer, inputSchema) { + if ((inputSchema instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema type" } + }; + } + const asn1 = localFromBER(pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer)); + if (asn1.offset === -1) { + return { + verified: false, + result: asn1.result + }; + } + return compareSchema(asn1.result, asn1.result, inputSchema); +} + + + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/encoding/pem.js + + + + + + + + + + + + +const ID_ED25519 = "1.3.101.112"; + +/** + * @param {string} pem + * @param {string} [passphrase] + * @returns {Promise} + */ +async function readPemED25519(pem, passphrase) { + const pemKeyData = pem.replace( + /-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g, + "", + ); + + const key = base64_browser_decode(pemKeyData); + if (passphrase) { + let encrypted; + + try { + encrypted = EncryptedPrivateKeyInfo.parse(key); + } catch (error) { + const message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + + throw new BadKeyError( + `failed to parse encrypted private key: ${message}`, + ); + } + + const decrypted = await encrypted.decrypt(passphrase); + + let privateKey = null; + + if (decrypted.algId.algIdent === ID_ED25519) { + privateKey = Ed25519PrivateKey; + } else { + throw new BadKeyError( + `unknown private key algorithm ${decrypted.algId.toString()}`, + ); + } + + const keyData = der_decode(decrypted.privateKey); + + if (!("bytes" in keyData)) { + throw new BadKeyError( + `expected ASN bytes, got ${JSON.stringify(keyData)}`, + ); + } + + return privateKey.fromBytes(keyData.bytes); + } + + return key.subarray(16); +} + +/** + * @param {string} pem + * @param {string} [passphrase] + * @returns {Promise} + */ +async function readPemECDSA(pem, passphrase) { + const pemKeyData = pem.replace( + /-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g, + "", + ); + const key = base64_browser_decode(pemKeyData); + + if (passphrase) { + const decodedPem = node_forge_lib.pem.decode(pem)[0]; + /** @type {string} */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment + const ivString = decodedPem.dekInfo.parameters; + const iv = hex_browser_decode(ivString); + const pemLines = pem.split("\n"); + const key = await messageDigest(passphrase, ivString); + const dataToDecrypt = buffer/* Buffer.from */.lW.from( + pemLines.slice(4, pemLines.length - 1).join(""), + "base64", + ); + const keyDerBytes = await createDecipheriv( + CipherAlgorithm.Aes128Cbc, + key, + iv, + dataToDecrypt, + ); + + return EcdsaPrivateKey.fromBytesDer(keyDerBytes); + } else { + const asnData = fromBER(key); + const parsedKey = asnData.result; + + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return + return parsedKey.valueBlock.value[1].valueBlock.valueHexView; + } +} + +/** + * @param {string} pem + * @param {string} [passphrase] + * @returns {Promise} + */ +async function read(pem, passphrase) { + // If not then it is ED25519 type + const isEcdsa = pem.includes("BEGIN EC PRIVATE KEY") ? true : false; + if (isEcdsa) { + return readPemECDSA(pem, passphrase); + } else { + return readPemED25519(pem, passphrase); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/util/derive.js + + + +/** + * @param {Uint8Array} seed + * @param {number} index + * @returns {Promise} + */ +function legacy(seed, index) { + const password = new Uint8Array(seed.length + 8); + password.set(seed, 0); + + const view = new DataView( + password.buffer, + password.byteOffset, + password.byteLength, + ); + + if (index === 0xffffffffff) { + view.setInt32(seed.length + 0, 0xff); + view.setInt32(seed.length + 4, -1); // 0xffffffff + } else { + view.setInt32(seed.length + 0, index < 0 ? -1 : 0); + view.setInt32(seed.length + 4, index); + } + + const salt = Uint8Array.from([0xff]); + return deriveKey( + HashAlgorithm.Sha512, + password, + salt, + 2048, + 32, + ); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/Cache.js +/** + * @typedef {import("./PrivateKey.js").default} PrivateKey + * @typedef {import("./Ed25519PrivateKey.js").default} Ed25519PrivateKey + * @typedef {import("./EcdsaPrivateKey.js").default} EcdsaPrivateKey + * @typedef {import("./Mnemonic.js").default} Mnemonic + */ + +const CACHE = { + /** @type {((key: Ed25519PrivateKey | EcdsaPrivateKey) => PrivateKey) | null} */ + privateKeyConstructor: null, + + /** @type {((bytes: Uint8Array) => PrivateKey) | null} */ + privateKeyFromBytes: null, + + /** @type {((words: string) => Mnemonic) | null} */ + mnemonicFromString: null, +}; + +/* harmony default export */ var Cache = (CACHE); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/PrivateKey.js + + + + + + + + + + + + + + +/** + * @typedef {object} ProtoSignaturePair + * @property {(Uint8Array | null)=} pubKeyPrefix + * @property {(Uint8Array | null)=} ed25519 + * @property {(Uint8Array | null)=} ECDSASecp256k1 + */ + +/** + * @typedef {object} ProtoSigMap + * @property {(ProtoSignaturePair[] | null)=} sigPair + */ + +/** + * @typedef {object} ProtoSignedTransaction + * @property {(Uint8Array | null)=} bodyBytes + * @property {(ProtoSigMap | null)=} sigMap + */ + +/** + * @typedef {object} Transaction + * @property {() => boolean} isFrozen + * @property {ProtoSignedTransaction[]} _signedTransactions + * @property {Set} _signerPublicKeys + * @property {(publicKey: PublicKey, signature: Uint8Array) => Transaction} addSignature + * @property {() => void} _requireFrozen + * @property {() => Transaction} freeze + */ + +/** + * @typedef {import("./Mnemonic.js").default} Mnemonic + */ + +/** + * A private key on the Hedera™ network. + */ +class PrivateKey_PrivateKey extends Key_Key { + /** + * @hideconstructor + * @internal + * @param {Ed25519PrivateKey | EcdsaPrivateKey} key + */ + constructor(key) { + super(); + + /** + * @type {Ed25519PrivateKey | EcdsaPrivateKey} + * @readonly + * @private + */ + this._key = key; + } + + /** + * @returns {string} + */ + get _type() { + return this._key._type; + } + + /** + * @returns {Uint8Array | null} + */ + get _chainCode() { + return this._key._chainCode; + } + + /** + * Generate a random Ed25519 private key. + * @returns {PrivateKey} + */ + static generateED25519() { + return new PrivateKey_PrivateKey(Ed25519PrivateKey.generate()); + } + + /** + * Generate a random EDSA private key. + * @returns {PrivateKey} + */ + static generateECDSA() { + return new PrivateKey_PrivateKey(EcdsaPrivateKey.generate()); + } + + /** + * Depredated - Use `generateED25519()` instead + * Generate a random Ed25519 private key. + * @returns {PrivateKey} + */ + static generate() { + return PrivateKey_PrivateKey.generateED25519(); + } + + /** + * Depredated - Use `generateED25519Async()` instead + * Generate a random Ed25519 private key. + * @returns {Promise} + */ + static async generateAsync() { + return PrivateKey_PrivateKey.generateED25519Async(); + } + + /** + * Generate a random Ed25519 private key. + * @returns {Promise} + */ + static async generateED25519Async() { + return new PrivateKey_PrivateKey(await Ed25519PrivateKey.generateAsync()); + } + + /** + * Generate a random ECDSA private key. + * @returns {Promise} + */ + static async generateECDSAAsync() { + return new PrivateKey_PrivateKey(await EcdsaPrivateKey.generateAsync()); + } + + /** + * Construct a private key from bytes. Requires DER header. + * @param {Uint8Array} data + * @returns {PrivateKey} + */ + static fromBytes(data) { + let message; + + if (data.length == 32) { + console.warn( + "WARNING: Consider using fromStringECDSA() or fromStringED25519() on a HEX-encoded string and fromStringDer() on a HEX-encoded string with DER prefix instead.", + ); + } + + try { + return new PrivateKey_PrivateKey(Ed25519PrivateKey.fromBytes(data)); + } catch (error) { + message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + } + + try { + return new PrivateKey_PrivateKey(EcdsaPrivateKey.fromBytes(data)); + } catch (error) { + message = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + error != null && /** @type {Error} */ (error).message != null + ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + /** @type {Error} */ (error).message + : ""; + } + + throw new BadKeyError( + `private key cannot be decoded from bytes: ${message}`, + ); + } + + /** + * Construct a ECDSA private key from bytes. + * @param {Uint8Array} data + * @returns {PrivateKey} + */ + static fromBytesECDSA(data) { + return new PrivateKey_PrivateKey(EcdsaPrivateKey.fromBytes(data)); + } + + /** + * Construct a ED25519 private key from bytes. + * @param {Uint8Array} data + * @returns {PrivateKey} + */ + static fromBytesED25519(data) { + return new PrivateKey_PrivateKey(Ed25519PrivateKey.fromBytes(data)); + } + + /** + * Construct a private key from a hex-encoded string. Requires DER header. + * @param {string} text + * @returns {PrivateKey} + */ + static fromString(text) { + return PrivateKey_PrivateKey.fromBytes(hex_browser_decode(text)); + } + + /** + * Construct a ECDSA private key from a hex-encoded string. + * @param {string} text + * @returns {PrivateKey} + */ + static fromStringECDSA(text) { + return PrivateKey_PrivateKey.fromBytesECDSA(hex_browser_decode(text)); + } + + /** + * Construct a Ed25519 private key from a hex-encoded string. + * @param {string} text + * @returns {PrivateKey} + */ + static fromStringED25519(text) { + return PrivateKey_PrivateKey.fromBytesED25519(hex_browser_decode(text)); + } + + /** + * Construct a Ed25519 private key from a Uint8Array seed. + * @param {Uint8Array} seed + * @returns {Promise} + */ + static async fromSeedED25519(seed) { + const ed25519Key = await Ed25519PrivateKey.fromSeed(seed); + return new PrivateKey_PrivateKey(ed25519Key); + } + + /** + * Construct a ECDSA private key from a Uint8Array seed. + * @param {Uint8Array} seed + * @returns {Promise} + */ + static async fromSeedECDSAsecp256k1(seed) { + const ecdsaKey = await EcdsaPrivateKey.fromSeed(seed); + return new PrivateKey_PrivateKey(ecdsaKey); + } + + /** + * @deprecated - Use `Mnemonic.from[Words|String]().toStandard[Ed25519|ECDSAsecp256k1]PrivateKey()` instead + * + * Recover a private key from a mnemonic phrase (and optionally a password). + * @param {Mnemonic | string} mnemonic + * @param {string} [passphrase] + * @returns {Promise} + */ + static async fromMnemonic(mnemonic, passphrase = "") { + if (Cache.mnemonicFromString == null) { + throw new Error("Mnemonic not found in cache"); + } + + return ( + ( + typeof mnemonic === "string" + ? Cache.mnemonicFromString(mnemonic) + : mnemonic + ) + // eslint-disable-next-line deprecation/deprecation + .toEd25519PrivateKey(passphrase) + ); + } + + /** + * Recover a private key from a keystore, previously created by `.toKeystore()`. + * + * This key will _not_ support child key derivation. + * @param {Uint8Array} data + * @param {string} [passphrase] + * @returns {Promise} + * @throws {BadKeyError} If the passphrase is incorrect or the hash fails to validate. + */ + static async fromKeystore(data, passphrase = "") { + return PrivateKey_PrivateKey.fromBytes(await loadKeystore(data, passphrase)); + } + + /** + * Recover a private key from a pem string; the private key may be encrypted. + * + * This method assumes the .pem file has been converted to a string already. + * + * If `passphrase` is not null or empty, this looks for the first `ENCRYPTED PRIVATE KEY` + * section and uses `passphrase` to decrypt it; otherwise, it looks for the first `PRIVATE KEY` + * section and decodes that as a DER-encoded private key. + * @param {string} data + * @param {string} [passphrase] + * @returns {Promise} + */ + static async fromPem(data, passphrase = "") { + const pem = await read(data, passphrase); + + if ( + pem instanceof Ed25519PrivateKey || + pem instanceof EcdsaPrivateKey + ) { + return new PrivateKey_PrivateKey(pem); + } + + const isEcdsa = data.includes("BEGIN EC PRIVATE KEY") ? true : false; + if (isEcdsa) { + return new PrivateKey_PrivateKey(EcdsaPrivateKey.fromBytes(pem)); + } else { + return new PrivateKey_PrivateKey(Ed25519PrivateKey.fromBytes(pem)); + } + } + + /** + * Derive a new private key at the given wallet index. + * + * Only currently supported for keys created with from mnemonics; other keys will throw + * an error. + * + * You can check if a key supports derivation with `.supportsDerivation()` + * @param {number} index + * @returns {Promise} + * @throws If this key does not support derivation. + */ + async derive(index) { + if (this._key._chainCode == null) { + throw new Error("this private key does not support key derivation"); + } + + if (this._key instanceof Ed25519PrivateKey) { + const { keyData, chainCode } = await slip10_derive( + this.toBytesRaw(), + this._key._chainCode, + index, + ); + + return new PrivateKey_PrivateKey(new Ed25519PrivateKey(keyData, chainCode)); + } else { + const { keyData, chainCode } = await derive( + this.toBytesRaw(), + this._key._chainCode, + index, + ); + + return new PrivateKey_PrivateKey( + new EcdsaPrivateKey(fromBytes(keyData), chainCode), + ); + } + } + + /** + * @param {number} index + * @returns {Promise} + * @throws If this key does not support derivation. + */ + async legacyDerive(index) { + const keyBytes = await legacy( + this.toBytesRaw().subarray(0, 32), + index, + ); + + /** @type {new (bytes: Uint8Array) => Ed25519PrivateKey | EcdsaPrivateKey} */ + const constructor = /** @type {any} */ (this._key.constructor); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + return new PrivateKey_PrivateKey(new constructor(keyBytes)); + } + + /** + * Get the public key associated with this private key. + * + * The public key can be freely given and used by other parties to verify + * the signatures generated by this private key. + * @returns {PublicKey} + */ + get publicKey() { + return new PublicKey_PublicKey(this._key.publicKey); + } + + /** + * Sign a message with this private key. + * @param {Uint8Array} bytes + * @returns {Uint8Array} - The signature bytes without the message + */ + sign(bytes) { + return this._key.sign(bytes); + } + + /** + * @param {Transaction} transaction + * @returns {Uint8Array} + */ + signTransaction(transaction) { + if (!transaction.isFrozen()) { + transaction.freeze(); + } + + if (transaction._signedTransactions.length != 1) { + throw new Error( + "`PrivateKey.signTransaction()` requires `Transaction` to have a single node `AccountId` set", + ); + } + + const tx = /** @type {ProtoSignedTransaction} */ ( + transaction._signedTransactions[0] + ); + + const publicKeyHex = encoding_hex_browser_encode(this.publicKey.toBytesRaw()); + + if (tx.sigMap == null) { + tx.sigMap = {}; + } + + if (tx.sigMap.sigPair == null) { + tx.sigMap.sigPair = []; + } + + for (const sigPair of tx.sigMap.sigPair) { + if ( + sigPair.pubKeyPrefix != null && + encoding_hex_browser_encode(sigPair.pubKeyPrefix) === publicKeyHex + ) { + switch (this._type) { + case "ED25519": + return /** @type {Uint8Array} */ (sigPair.ed25519); + case "secp256k1": + return /** @type {Uint8Array} */ ( + sigPair.ECDSASecp256k1 + ); + } + } + } + + const siganture = this.sign( + tx.bodyBytes != null ? tx.bodyBytes : new Uint8Array(), + ); + + /** @type {ProtoSignaturePair} */ + const protoSignature = { + pubKeyPrefix: this.publicKey.toBytesRaw(), + }; + + switch (this._type) { + case "ED25519": + protoSignature.ed25519 = siganture; + break; + case "secp256k1": + protoSignature.ECDSASecp256k1 = siganture; + break; + } + + tx.sigMap.sigPair.push(protoSignature); + transaction._signerPublicKeys.add(publicKeyHex); + + return siganture; + } + + /** + * Check if `derive` can be called on this private key. + * + * This is only the case if the key was created from a mnemonic. + * @returns {boolean} + */ + isDerivable() { + return this._key._chainCode != null; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + if (this._key instanceof Ed25519PrivateKey) { + return this.toBytesRaw(); + } else { + return this.toBytesDer(); + } + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + return this._key.toBytesDer(); + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + return this._key.toBytesRaw(); + } + + /** + * @returns {string} + */ + toString() { + return this.toStringDer(); + } + + /** + * @returns {string} + */ + toStringDer() { + return encoding_hex_browser_encode(this.toBytesDer()); + } + + /** + * @returns {string} + */ + toStringRaw() { + return encoding_hex_browser_encode(this.toBytesRaw()); + } + + /** + * Create a keystore with a given passphrase. + * + * The key can be recovered later with `fromKeystore()`. + * + * Note that this will not retain the ancillary data used for + * deriving child keys, thus `.derive()` on the restored key will + * throw even if this instance supports derivation. + * @param {string} [passphrase] + * @returns {Promise} + */ + toKeystore(passphrase = "") { + return createKeystore(this.toBytesRaw(), passphrase); + } +} + +Cache.privateKeyConstructor = (key) => new PrivateKey_PrivateKey(key); +Cache.privateKeyFromBytes = (bytes) => PrivateKey_PrivateKey.fromBytes(bytes); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/BadMnemonicReason.js +/** + * Possible statuses for {@link Mnemonic#validate()}. + * @readonly + * @enum {string} + */ +const BadMnemonicReason = Object.freeze({ + /** + * The mnemonic did not have a supported number of words (12 or 24 for regular and 22 for legacy). + */ + BadLength: "BadLength", + + /** + * The mnemonic contained words which were not found in the word list. + */ + UnknownWords: "UnknownWords", + + /** + * The checksum encoded in the mnemonic did not match the checksum we just calculated for + * that mnemonic. + * + * 24-word mnemonics have an 8-bit checksum that is appended to the 32 bytes of source entropy + * after being calculated from it, before being encoded into words. + * + * This could happen if two or more of the words were entered out of the original order or + * replaced with another from the standard word list (as this is only returned if all the words + * exist in the word list). + */ + ChecksumMismatch: "ChecksumMismatch", +}); + +/* harmony default export */ var src_BadMnemonicReason = (BadMnemonicReason); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/BadMnemonicError.js +/** @typedef {import("./Mnemonic.js").default} Mnemonic */ + + +class BadMnemonicError extends Error { + /** + * @param {Mnemonic} mnemonic + * @param {string} reason + * @param {number[]} unknownWordIndices + * @hideconstructor + */ + constructor(mnemonic, reason, unknownWordIndices) { + let reasonMessage; + + switch (reason) { + case src_BadMnemonicReason.BadLength: + reasonMessage = "mnemonic is of an unexpected number of words"; + break; + + case src_BadMnemonicReason.ChecksumMismatch: + reasonMessage = + "checksum byte in mnemonic did not match the rest of the mnemonic"; + break; + + case src_BadMnemonicReason.UnknownWords: + reasonMessage = + "mnemonic contained words that are not in the standard word list"; + break; + + default: + throw new Error( + `unexpected value ${reason.toString()} for 'reason'`, + ); + } + + super(`invalid mnemonic: ${reasonMessage}`); + + if (typeof Error.captureStackTrace !== "undefined") { + Error.captureStackTrace(this, BadMnemonicError); + } + + this.name = "BadMnemonicError"; + + /** The reason for which the mnemonic failed validation. */ + this.reason = reason; + + /** The mnemonic that failed validation. */ + this.mnemonic = mnemonic; + + /** + * The indices in the mnemonic that were not found in the BIP-39 + * standard English word list. + */ + this.unknownWordIndices = unknownWordIndices; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/words/legacy.js +/* harmony default export */ var words_legacy = ([ + "aback", + "abbey", + "abbot", + "abide", + "ablaze", + "able", + "aboard", + "abode", + "abort", + "abound", + "about", + "above", + "abroad", + "abrupt", + "absent", + "absorb", + "absurd", + "abuse", + "accent", + "accept", + "access", + "accord", + "accuse", + "ace", + "ache", + "aching", + "acid", + "acidic", + "acorn", + "acre", + "across", + "act", + "action", + "active", + "actor", + "actual", + "acute", + "adam", + "adapt", + "add", + "added", + "addict", + "adept", + "adhere", + "adjust", + "admire", + "admit", + "adobe", + "adopt", + "adrift", + "adult", + "adverb", + "advice", + "aerial", + "afar", + "affair", + "affect", + "afford", + "afghan", + "afield", + "afloat", + "afraid", + "afresh", + "after", + "again", + "age", + "agency", + "agenda", + "agent", + "aghast", + "agile", + "ago", + "agony", + "agree", + "agreed", + "ahead", + "aid", + "aide", + "aim", + "air", + "airman", + "airy", + "akin", + "alarm", + "alaska", + "albeit", + "album", + "ale", + "alert", + "alibi", + "alice", + "alien", + "alight", + "align", + "alike", + "alive", + "alkali", + "all", + "alley", + "allied", + "allow", + "alloy", + "ally", + "almond", + "almost", + "aloft", + "alone", + "along", + "aloof", + "aloud", + "alpha", + "alpine", + "also", + "altar", + "alter", + "always", + "amaze", + "amazon", + "amber", + "ambush", + "amen", + "amend", + "amid", + "amidst", + "amiss", + "among", + "amount", + "ample", + "amuse", + "anchor", + "and", + "andrew", + "anew", + "angel", + "anger", + "angle", + "angry", + "animal", + "ankle", + "annoy", + "annual", + "answer", + "anthem", + "any", + "anyhow", + "anyway", + "apart", + "apathy", + "apex", + "apiece", + "appeal", + "appear", + "apple", + "apply", + "april", + "apron", + "arab", + "arcade", + "arcane", + "arch", + "arctic", + "ardent", + "are", + "area", + "argue", + "arid", + "arise", + "ark", + "arm", + "armful", + "army", + "aroma", + "around", + "arouse", + "array", + "arrest", + "arrive", + "arrow", + "arson", + "art", + "artery", + "artful", + "artist", + "ascent", + "ash", + "ashen", + "ashore", + "aside", + "ask", + "asleep", + "aspect", + "assay", + "assent", + "assert", + "assess", + "asset", + "assign", + "assist", + "assume", + "assure", + "asthma", + "astute", + "asylum", + "ate", + "athens", + "atlas", + "atom", + "atomic", + "attach", + "attack", + "attain", + "attend", + "attic", + "auburn", + "audio", + "audit", + "august", + "aunt", + "auntie", + "aura", + "austin", + "author", + "auto", + "autumn", + "avail", + "avenge", + "avenue", + "avert", + "avid", + "avoid", + "await", + "awake", + "awaken", + "award", + "aware", + "awash", + "away", + "awful", + "awhile", + "axe", + "axes", + "axiom", + "axis", + "axle", + "aye", + "babe", + "baby", + "bach", + "back", + "backup", + "bacon", + "bad", + "badge", + "badly", + "bag", + "baggy", + "bail", + "bait", + "bake", + "baker", + "bakery", + "bald", + "ball", + "ballad", + "ballet", + "ballot", + "baltic", + "bamboo", + "ban", + "banal", + "banana", + "band", + "bang", + "bank", + "bar", + "barber", + "bare", + "barely", + "barge", + "bark", + "barley", + "barn", + "baron", + "barrel", + "barren", + "basalt", + "base", + "basic", + "basil", + "basin", + "basis", + "basket", + "bass", + "bat", + "batch", + "bath", + "baton", + "battle", + "bay", + "beach", + "beacon", + "beak", + "beam", + "bean", + "bear", + "beard", + "beast", + "beat", + "beauty", + "become", + "bed", + "beech", + "beef", + "beefy", + "beep", + "beer", + "beet", + "beetle", + "before", + "beg", + "beggar", + "begin", + "behalf", + "behave", + "behind", + "beige", + "being", + "belief", + "bell", + "belly", + "belong", + "below", + "belt", + "bench", + "bend", + "benign", + "bent", + "berlin", + "berry", + "berth", + "beset", + "beside", + "best", + "bestow", + "bet", + "beta", + "betray", + "better", + "beware", + "beyond", + "bias", + "biceps", + "bicker", + "bid", + "big", + "bigger", + "bike", + "bile", + "bill", + "bin", + "binary", + "bind", + "biopsy", + "birch", + "bird", + "birdie", + "birth", + "bishop", + "bit", + "bitch", + "bite", + "bitter", + "black", + "blade", + "blame", + "bland", + "blast", + "blaze", + "bleak", + "blend", + "bless", + "blew", + "blind", + "blink", + "blip", + "bliss", + "blitz", + "block", + "blond", + "blood", + "bloody", + "bloom", + "blot", + "blouse", + "blow", + "blue", + "bluff", + "blunt", + "blur", + "blush", + "boar", + "board", + "boast", + "boat", + "bob", + "bodily", + "body", + "bogus", + "boil", + "bold", + "bolt", + "bomb", + "bombay", + "bond", + "bone", + "bonn", + "bonnet", + "bonus", + "bony", + "book", + "boom", + "boost", + "boot", + "booth", + "booze", + "border", + "bore", + "borrow", + "bosom", + "boss", + "boston", + "both", + "bother", + "bottle", + "bottom", + "bought", + "bounce", + "bound", + "bounty", + "bout", + "bovine", + "bow", + "bowel", + "bowl", + "box", + "boy", + "boyish", + "brace", + "brain", + "brainy", + "brake", + "bran", + "branch", + "brand", + "brandy", + "brass", + "brave", + "bravo", + "brazil", + "breach", + "bread", + "break", + "breast", + "breath", + "bred", + "breed", + "breeze", + "brew", + "bribe", + "brick", + "bride", + "bridge", + "brief", + "bright", + "brim", + "brine", + "bring", + "brink", + "brisk", + "broad", + "broke", + "broken", + "bronze", + "brook", + "broom", + "brown", + "bruise", + "brush", + "brutal", + "brute", + "bubble", + "buck", + "bucket", + "buckle", + "budget", + "buffet", + "buggy", + "build", + "bulb", + "bulge", + "bulk", + "bulky", + "bull", + "bullet", + "bully", + "bump", + "bumpy", + "bunch", + "bundle", + "bunk", + "bunny", + "burden", + "bureau", + "burial", + "buried", + "burly", + "burn", + "burnt", + "burrow", + "burst", + "bury", + "bus", + "bush", + "bust", + "bustle", + "busy", + "but", + "butler", + "butt", + "butter", + "button", + "buy", + "buyer", + "buzz", + "bye", + "byte", + "cab", + "cabin", + "cable", + "cache", + "cactus", + "caesar", + "cage", + "cairo", + "cajun", + "cajole", + "cake", + "calf", + "call", + "caller", + "calm", + "calmly", + "came", + "camel", + "camera", + "camp", + "campus", + "can", + "canada", + "canal", + "canary", + "cancel", + "cancer", + "candid", + "candle", + "candy", + "cane", + "canine", + "canoe", + "canopy", + "canvas", + "canyon", + "cap", + "cape", + "car", + "carbon", + "card", + "care", + "career", + "caress", + "cargo", + "carl", + "carnal", + "carol", + "carp", + "carpet", + "carrot", + "carry", + "cart", + "cartel", + "case", + "cash", + "cask", + "cast", + "castle", + "casual", + "cat", + "catch", + "cater", + "cattle", + "caught", + "causal", + "cause", + "cave", + "cease", + "celery", + "cell", + "cellar", + "celtic", + "cement", + "censor", + "census", + "cent", + "cereal", + "chain", + "chair", + "chalk", + "chalky", + "champ", + "chance", + "change", + "chant", + "chaos", + "chap", + "chapel", + "charge", + "charm", + "chart", + "chase", + "chat", + "cheap", + "cheat", + "check", + "cheek", + "cheeky", + "cheer", + "cheery", + "cheese", + "chef", + "cheque", + "cherry", + "chess", + "chest", + "chew", + "chic", + "chick", + "chief", + "child", + "chile", + "chill", + "chilly", + "chin", + "china", + "chip", + "choice", + "choir", + "choose", + "chop", + "choppy", + "chord", + "chorus", + "chose", + "chosen", + "chris", + "chrome", + "chunk", + "chunky", + "church", + "cider", + "cigar", + "cinema", + "circa", + "circle", + "circus", + "cite", + "city", + "civic", + "civil", + "clad", + "claim", + "clammy", + "clan", + "clap", + "clash", + "clasp", + "class", + "clause", + "claw", + "clay", + "clean", + "clear", + "clergy", + "clerk", + "clever", + "click", + "client", + "cliff", + "climax", + "climb", + "clinch", + "cling", + "clinic", + "clip", + "cloak", + "clock", + "clone", + "close", + "closer", + "closet", + "cloth", + "cloud", + "cloudy", + "clout", + "clown", + "club", + "clue", + "clumsy", + "clung", + "clutch", + "coach", + "coal", + "coarse", + "coast", + "coat", + "coax", + "cobalt", + "cobra", + "coca", + "cock", + "cocoa", + "code", + "coffee", + "coffin", + "cohort", + "coil", + "coin", + "coke", + "cold", + "collar", + "colon", + "colony", + "colt", + "column", + "comb", + "combat", + "come", + "comedy", + "comic", + "commit", + "common", + "compel", + "comply", + "concur", + "cone", + "confer", + "congo", + "consul", + "convex", + "convey", + "convoy", + "cook", + "cool", + "cope", + "copper", + "copy", + "coral", + "cord", + "core", + "cork", + "corn", + "corner", + "corps", + "corpse", + "corpus", + "cortex", + "cosmic", + "cosmos", + "cost", + "costly", + "cotton", + "couch", + "cough", + "could", + "count", + "county", + "coup", + "couple", + "coupon", + "course", + "court", + "cousin", + "cove", + "cover", + "covert", + "cow", + "coward", + "cowboy", + "cozy", + "crab", + "crack", + "cradle", + "craft", + "crafty", + "crag", + "crane", + "crash", + "crate", + "crater", + "crawl", + "crazy", + "creak", + "cream", + "creamy", + "create", + "credit", + "creed", + "creek", + "creep", + "creepy", + "crept", + "crest", + "crew", + "cried", + "crime", + "crisis", + "crisp", + "critic", + "crook", + "crop", + "cross", + "crow", + "crowd", + "crown", + "crude", + "cruel", + "cruise", + "crunch", + "crush", + "crust", + "crux", + "cry", + "crypt", + "cuba", + "cube", + "cubic", + "cuckoo", + "cuff", + "cult", + "cup", + "curb", + "cure", + "curfew", + "curl", + "curry", + "curse", + "cursor", + "curve", + "cuss", + "custom", + "cut", + "cute", + "cycle", + "cyclic", + "cynic", + "czech", + "dad", + "daddy", + "dagger", + "daily", + "dairy", + "daisy", + "dale", + "dam", + "damage", + "damp", + "dampen", + "dance", + "danger", + "danish", + "dare", + "dark", + "darken", + "darn", + "dart", + "dash", + "data", + "date", + "david", + "dawn", + "day", + "dead", + "deadly", + "deaf", + "deal", + "dealer", + "dean", + "dear", + "death", + "debate", + "debit", + "debris", + "debt", + "debtor", + "decade", + "decay", + "decent", + "decide", + "deck", + "decor", + "decree", + "deduce", + "deed", + "deep", + "deeply", + "deer", + "defeat", + "defect", + "defend", + "defer", + "define", + "defy", + "degree", + "deity", + "delay", + "delete", + "delhi", + "delta", + "demand", + "demise", + "demo", + "demure", + "denial", + "denote", + "dense", + "dental", + "deny", + "depart", + "depend", + "depict", + "deploy", + "depot", + "depth", + "deputy", + "derive", + "desert", + "design", + "desire", + "desist", + "desk", + "detail", + "detect", + "deter", + "detest", + "detour", + "device", + "devise", + "devoid", + "devote", + "devour", + "dial", + "diana", + "diary", + "dice", + "dictum", + "did", + "die", + "diesel", + "diet", + "differ", + "dig", + "digest", + "digit", + "dine", + "dinghy", + "dinner", + "diode", + "dip", + "dire", + "direct", + "dirt", + "dirty", + "disc", + "disco", + "dish", + "disk", + "dismal", + "dispel", + "ditch", + "dive", + "divert", + "divide", + "divine", + "dizzy", + "docile", + "dock", + "doctor", + "dog", + "dogma", + "dole", + "doll", + "dollar", + "dolly", + "domain", + "dome", + "domino", + "donate", + "done", + "donkey", + "donor", + "doom", + "door", + "dorsal", + "dose", + "dot", + "double", + "doubt", + "dough", + "dour", + "dove", + "down", + "dozen", + "draft", + "drag", + "dragon", + "drain", + "drama", + "drank", + "draw", + "drawer", + "dread", + "dream", + "dreary", + "dress", + "drew", + "dried", + "drift", + "drill", + "drink", + "drip", + "drive", + "driver", + "drop", + "drove", + "drown", + "drug", + "drum", + "drunk", + "dry", + "dual", + "duck", + "duct", + "due", + "duel", + "duet", + "duke", + "dull", + "duly", + "dumb", + "dummy", + "dump", + "dune", + "dung", + "duress", + "during", + "dusk", + "dust", + "dusty", + "dutch", + "duty", + "dwarf", + "dwell", + "dyer", + "dying", + "dynamo", + "each", + "eager", + "eagle", + "ear", + "earl", + "early", + "earn", + "earth", + "ease", + "easel", + "easily", + "east", + "easter", + "easy", + "eat", + "eaten", + "eater", + "echo", + "eddy", + "eden", + "edge", + "edible", + "edict", + "edit", + "editor", + "eel", + "eerie", + "eerily", + "effect", + "effort", + "egg", + "ego", + "eight", + "eighth", + "eighty", + "either", + "elbow", + "elder", + "eldest", + "elect", + "eleven", + "elicit", + "elite", + "else", + "elude", + "elves", + "embark", + "emblem", + "embryo", + "emerge", + "emit", + "empire", + "employ", + "empty", + "enable", + "enamel", + "end", + "endure", + "enemy", + "energy", + "engage", + "engine", + "enjoy", + "enlist", + "enough", + "ensure", + "entail", + "enter", + "entire", + "entry", + "envoy", + "envy", + "enzyme", + "epic", + "epoch", + "equal", + "equate", + "equip", + "equity", + "era", + "erect", + "eric", + "erode", + "erotic", + "errant", + "error", + "escape", + "escort", + "essay", + "essex", + "estate", + "esteem", + "ethic", + "ethnic", + "europe", + "evade", + "eve", + "even", + "event", + "ever", + "every", + "evict", + "evil", + "evoke", + "evolve", + "exact", + "exam", + "exceed", + "excel", + "except", + "excess", + "excise", + "excite", + "excuse", + "exempt", + "exert", + "exile", + "exist", + "exit", + "exodus", + "exotic", + "expand", + "expect", + "expert", + "expire", + "export", + "expose", + "extend", + "extra", + "eye", + "eyed", + "fabric", + "face", + "facial", + "fact", + "factor", + "fade", + "fail", + "faint", + "fair", + "fairly", + "fairy", + "faith", + "fake", + "falcon", + "fall", + "false", + "falter", + "fame", + "family", + "famine", + "famous", + "fan", + "fancy", + "far", + "farce", + "fare", + "farm", + "farmer", + "fast", + "fasten", + "faster", + "fat", + "fatal", + "fate", + "father", + "fatty", + "fault", + "faulty", + "fauna", + "fear", + "feast", + "feat", + "fed", + "fee", + "feeble", + "feed", + "feel", + "feet", + "fell", + "fellow", + "felt", + "female", + "fence", + "fend", + "ferry", + "fetal", + "fetch", + "feudal", + "fever", + "few", + "fewer", + "fiasco", + "fiddle", + "field", + "fiend", + "fierce", + "fiery", + "fifth", + "fifty", + "fig", + "fight", + "figure", + "file", + "fill", + "filled", + "filler", + "film", + "filter", + "filth", + "filthy", + "final", + "finale", + "find", + "fine", + "finery", + "finger", + "finish", + "finite", + "fire", + "firm", + "firmly", + "first", + "fiscal", + "fish", + "fisher", + "fist", + "fit", + "fitful", + "five", + "fix", + "flag", + "flair", + "flak", + "flame", + "flank", + "flap", + "flare", + "flash", + "flask", + "flat", + "flavor", + "flaw", + "fled", + "flee", + "fleece", + "fleet", + "flesh", + "fleshy", + "flew", + "flick", + "flight", + "flimsy", + "flint", + "flirt", + "float", + "flock", + "flood", + "floor", + "floppy", + "flora", + "floral", + "flour", + "flow", + "flower", + "fluent", + "fluffy", + "fluid", + "flung", + "flurry", + "flush", + "flute", + "flux", + "fly", + "flyer", + "foal", + "foam", + "focal", + "focus", + "fog", + "foil", + "fold", + "folk", + "follow", + "folly", + "fond", + "fondly", + "font", + "food", + "fool", + "foot", + "for", + "forbid", + "force", + "ford", + "forest", + "forge", + "forget", + "fork", + "form", + "formal", + "format", + "former", + "fort", + "forth", + "forty", + "forum", + "fossil", + "foster", + "foul", + "found", + "four", + "fourth", + "fox", + "foyer", + "frail", + "frame", + "franc", + "france", + "frank", + "fraud", + "fred", + "free", + "freed", + "freely", + "freeze", + "french", + "frenzy", + "fresh", + "friar", + "friday", + "fridge", + "fried", + "friend", + "fright", + "fringe", + "frock", + "frog", + "from", + "front", + "frost", + "frosty", + "frown", + "frozen", + "frugal", + "fruit", + "fry", + "fudge", + "fuel", + "full", + "fully", + "fumes", + "fun", + "fund", + "funny", + "fur", + "furry", + "fury", + "fuse", + "fusion", + "fuss", + "fussy", + "futile", + "future", + "fuzzy", + "gadget", + "gain", + "gala", + "galaxy", + "gale", + "gall", + "galley", + "gallon", + "gallop", + "gamble", + "game", + "gamma", + "gandhi", + "gang", + "gap", + "garage", + "garden", + "garlic", + "gas", + "gasp", + "gate", + "gather", + "gauge", + "gaunt", + "gave", + "gaze", + "gear", + "geese", + "gem", + "gemini", + "gender", + "gene", + "geneva", + "genial", + "genius", + "genre", + "gentle", + "gently", + "gentry", + "genus", + "george", + "germ", + "get", + "ghetto", + "ghost", + "giant", + "gift", + "giggle", + "gill", + "gilt", + "ginger", + "girl", + "give", + "given", + "glad", + "glade", + "glance", + "gland", + "glare", + "glass", + "glassy", + "gleam", + "glee", + "glide", + "global", + "globe", + "gloom", + "gloomy", + "gloria", + "glory", + "gloss", + "glossy", + "glove", + "glow", + "glue", + "gnat", + "gnu", + "goal", + "goat", + "gold", + "golden", + "golf", + "gone", + "gong", + "goo", + "good", + "goose", + "gore", + "gorge", + "gory", + "gosh", + "gospel", + "gossip", + "got", + "gothic", + "govern", + "gown", + "grab", + "grace", + "grade", + "grail", + "grain", + "grand", + "grant", + "grape", + "graph", + "grasp", + "grass", + "grassy", + "grate", + "grave", + "gravel", + "gravy", + "grease", + "greasy", + "great", + "greece", + "greed", + "greedy", + "greek", + "green", + "greet", + "grew", + "grey", + "grid", + "grief", + "grill", + "grim", + "grin", + "grind", + "grip", + "grit", + "gritty", + "groan", + "groin", + "groom", + "groove", + "gross", + "ground", + "group", + "grove", + "grow", + "grown", + "growth", + "grudge", + "grunt", + "guard", + "guess", + "guest", + "guide", + "guild", + "guilt", + "guilty", + "guise", + "guitar", + "gulf", + "gully", + "gun", + "gunman", + "guru", + "gut", + "guy", + "gypsy", + "habit", + "hack", + "had", + "hail", + "hair", + "hairy", + "haiti", + "hale", + "half", + "hall", + "halt", + "hamlet", + "hammer", + "hand", + "handle", + "handy", + "hang", + "hangar", + "hanoi", + "happen", + "happy", + "harass", + "harbor", + "hard", + "harder", + "hardly", + "hare", + "harem", + "harm", + "harp", + "harry", + "harsh", + "has", + "hash", + "hassle", + "haste", + "hasten", + "hasty", + "hat", + "hatch", + "hate", + "haul", + "haunt", + "havana", + "have", + "haven", + "havoc", + "hawaii", + "hawk", + "hay", + "hazard", + "haze", + "hazel", + "hazy", + "head", + "heal", + "health", + "heap", + "hear", + "heard", + "heart", + "hearth", + "hearty", + "heat", + "heater", + "heaven", + "heavy", + "hebrew", + "heck", + "hectic", + "hedge", + "heel", + "hefty", + "height", + "heir", + "held", + "helium", + "helix", + "hell", + "hello", + "helm", + "helmet", + "help", + "hemp", + "hence", + "henry", + "her", + "herald", + "herb", + "herd", + "here", + "hereby", + "hermes", + "hernia", + "hero", + "heroic", + "heroin", + "hey", + "heyday", + "hick", + "hidden", + "hide", + "high", + "higher", + "highly", + "hill", + "him", + "hind", + "hinder", + "hint", + "hippie", + "hire", + "his", + "hiss", + "hit", + "hive", + "hoard", + "hoarse", + "hobby", + "hockey", + "hold", + "holder", + "hole", + "hollow", + "holly", + "holy", + "home", + "honest", + "honey", + "hood", + "hook", + "hope", + "horn", + "horrid", + "horror", + "horse", + "hose", + "host", + "hot", + "hotel", + "hound", + "hour", + "house", + "hover", + "how", + "huge", + "hull", + "human", + "humane", + "humble", + "humid", + "hung", + "hunger", + "hungry", + "hunt", + "hurdle", + "hurl", + "hurry", + "hurt", + "hush", + "hut", + "hybrid", + "hymn", + "hyphen", + "ice", + "icing", + "icon", + "idaho", + "idea", + "ideal", + "idiom", + "idiot", + "idle", + "idly", + "idol", + "ignite", + "ignore", + "ill", + "image", + "immune", + "impact", + "imply", + "import", + "impose", + "inca", + "incest", + "inch", + "income", + "incur", + "indeed", + "index", + "india", + "indian", + "indoor", + "induce", + "inept", + "inert", + "infant", + "infect", + "infer", + "influx", + "inform", + "inject", + "injure", + "injury", + "ink", + "inlaid", + "inland", + "inlet", + "inmate", + "inn", + "innate", + "inner", + "input", + "insane", + "insect", + "insert", + "inset", + "inside", + "insist", + "insult", + "insure", + "intact", + "intake", + "intend", + "inter", + "into", + "invade", + "invent", + "invest", + "invite", + "invoke", + "inward", + "iowa", + "iran", + "iraq", + "irish", + "iron", + "ironic", + "irony", + "isaac", + "isabel", + "island", + "isle", + "israel", + "issue", + "italy", + "itch", + "item", + "itself", + "ivan", + "ivory", + "jack", + "jacket", + "jacob", + "jade", + "jaguar", + "jail", + "james", + "jane", + "japan", + "jargon", + "java", + "jaw", + "jazz", + "jeep", + "jelly", + "jerky", + "jest", + "jet", + "jewel", + "jewish", + "jim", + "job", + "jock", + "jockey", + "joe", + "john", + "join", + "joint", + "joke", + "jolly", + "jolt", + "jordan", + "joseph", + "joy", + "joyful", + "joyous", + "judge", + "judy", + "juice", + "juicy", + "july", + "jumble", + "jumbo", + "jump", + "june", + "jungle", + "junior", + "junk", + "junta", + "jury", + "just", + "kansas", + "karate", + "karl", + "keel", + "keen", + "keep", + "keeper", + "kenya", + "kept", + "kernel", + "kettle", + "key", + "khaki", + "kick", + "kid", + "kidnap", + "kidney", + "kill", + "killer", + "kin", + "kind", + "kindly", + "king", + "kiss", + "kite", + "kitten", + "knack", + "knee", + "kneel", + "knew", + "knife", + "knight", + "knit", + "knob", + "knock", + "knot", + "know", + "known", + "koran", + "korea", + "kuwait", + "label", + "lace", + "lack", + "lad", + "ladder", + "laden", + "lady", + "lagoon", + "laity", + "lake", + "lamb", + "lame", + "lamp", + "lance", + "land", + "lane", + "lap", + "lapse", + "large", + "larval", + "laser", + "last", + "latch", + "late", + "lately", + "latent", + "later", + "latest", + "latin", + "latter", + "laugh", + "launch", + "lava", + "lavish", + "law", + "lawful", + "lawn", + "lawyer", + "lay", + "layer", + "layman", + "lazy", + "lead", + "leader", + "leaf", + "leafy", + "league", + "leak", + "leaky", + "lean", + "leap", + "learn", + "lease", + "leash", + "least", + "leave", + "led", + "ledge", + "left", + "leg", + "legacy", + "legal", + "legend", + "legion", + "lemon", + "lend", + "length", + "lens", + "lent", + "leo", + "leper", + "lesion", + "less", + "lessen", + "lesser", + "lesson", + "lest", + "let", + "lethal", + "letter", + "level", + "lever", + "levy", + "lewis", + "liable", + "liar", + "libel", + "libya", + "lice", + "lick", + "lid", + "lie", + "lied", + "lier", + "life", + "lift", + "light", + "like", + "likely", + "limb", + "lime", + "limit", + "limp", + "line", + "linear", + "linen", + "linger", + "link", + "lint", + "lion", + "lip", + "liquid", + "liquor", + "list", + "listen", + "lit", + "live", + "lively", + "liver", + "liz", + "lizard", + "load", + "loaf", + "loan", + "lobby", + "lobe", + "local", + "locate", + "lock", + "locus", + "lodge", + "loft", + "lofty", + "log", + "logic", + "logo", + "london", + "lone", + "lonely", + "long", + "longer", + "look", + "loop", + "loose", + "loosen", + "loot", + "lord", + "lorry", + "lose", + "loss", + "lost", + "lot", + "lotion", + "lotus", + "loud", + "loudly", + "lounge", + "lousy", + "love", + "lovely", + "lover", + "low", + "lower", + "lowest", + "loyal", + "lucid", + "luck", + "lucky", + "lucy", + "lull", + "lump", + "lumpy", + "lunacy", + "lunar", + "lunch", + "lung", + "lure", + "lurid", + "lush", + "lust", + "lute", + "luther", + "luxury", + "lying", + "lymph", + "lynch", + "lyric", + "macho", + "macro", + "mad", + "madam", + "made", + "mafia", + "magic", + "magma", + "magnet", + "magnum", + "magpie", + "maid", + "maiden", + "mail", + "main", + "mainly", + "major", + "make", + "maker", + "male", + "malice", + "mall", + "malt", + "mammal", + "manage", + "mane", + "mania", + "manic", + "manner", + "manor", + "mantle", + "manual", + "manure", + "many", + "map", + "maple", + "marble", + "march", + "mare", + "margin", + "maria", + "marina", + "mark", + "market", + "marry", + "mars", + "marsh", + "martin", + "martyr", + "mary", + "mask", + "mason", + "mass", + "mast", + "master", + "mat", + "match", + "mate", + "matrix", + "matter", + "mature", + "maxim", + "may", + "maybe", + "mayor", + "maze", + "mead", + "meadow", + "meal", + "mean", + "meant", + "meat", + "medal", + "media", + "median", + "medic", + "medium", + "meet", + "mellow", + "melody", + "melon", + "melt", + "member", + "memo", + "memory", + "menace", + "mend", + "mental", + "mentor", + "menu", + "mercy", + "mere", + "merely", + "merge", + "merger", + "merit", + "merry", + "mesh", + "mess", + "messy", + "met", + "metal", + "meter", + "method", + "methyl", + "metric", + "metro", + "mexico", + "miami", + "mickey", + "mid", + "midday", + "middle", + "midst", + "midway", + "might", + "mighty", + "mild", + "mildew", + "mile", + "milk", + "milky", + "mill", + "mimic", + "mince", + "mind", + "mine", + "mini", + "mink", + "minor", + "mint", + "minus", + "minute", + "mire", + "mirror", + "mirth", + "misery", + "miss", + "mist", + "misty", + "mite", + "mix", + "moan", + "moat", + "mob", + "mobile", + "mock", + "mode", + "model", + "modem", + "modern", + "modest", + "modify", + "module", + "moist", + "molar", + "mold", + "mole", + "molten", + "moment", + "monday", + "money", + "monk", + "monkey", + "month", + "mood", + "moody", + "moon", + "moor", + "moral", + "morale", + "morbid", + "more", + "morgue", + "mortal", + "mortar", + "mosaic", + "moscow", + "moses", + "mosque", + "moss", + "most", + "mostly", + "moth", + "mother", + "motion", + "motive", + "motor", + "mount", + "mourn", + "mouse", + "mouth", + "move", + "movie", + "mrs", + "much", + "muck", + "mucus", + "mud", + "muddle", + "muddy", + "mule", + "mummy", + "munich", + "murder", + "murky", + "murmur", + "muscle", + "museum", + "music", + "mussel", + "must", + "mutant", + "mute", + "mutiny", + "mutter", + "mutton", + "mutual", + "muzzle", + "myopic", + "myriad", + "myself", + "mystic", + "myth", + "nadir", + "nail", + "naked", + "name", + "namely", + "nape", + "napkin", + "naples", + "narrow", + "nasal", + "nasty", + "nathan", + "nation", + "native", + "nature", + "nausea", + "naval", + "nave", + "navy", + "near", + "nearer", + "nearly", + "neat", + "neatly", + "neck", + "need", + "needle", + "needy", + "negate", + "neon", + "nepal", + "nephew", + "nerve", + "nest", + "net", + "neural", + "never", + "newly", + "next", + "nice", + "nicely", + "niche", + "nickel", + "niece", + "night", + "nile", + "nimble", + "nine", + "ninety", + "ninth", + "nobel", + "noble", + "nobody", + "node", + "noise", + "noisy", + "none", + "noon", + "nor", + "norm", + "normal", + "north", + "norway", + "nose", + "nosy", + "not", + "note", + "notice", + "notify", + "notion", + "noun", + "novel", + "novice", + "now", + "nozzle", + "null", + "numb", + "number", + "nurse", + "nut", + "nylon", + "nymph", + "oak", + "oar", + "oasis", + "oath", + "obese", + "obey", + "object", + "oblige", + "oboe", + "obtain", + "obtuse", + "occult", + "occupy", + "occur", + "ocean", + "octave", + "odd", + "off", + "offend", + "offer", + "office", + "offset", + "often", + "ohio", + "oil", + "oily", + "okay", + "old", + "older", + "oldest", + "olive", + "omega", + "omen", + "omit", + "once", + "one", + "onion", + "only", + "onset", + "onto", + "onus", + "onward", + "opaque", + "open", + "openly", + "opera", + "opium", + "oppose", + "optic", + "option", + "oracle", + "oral", + "orange", + "orbit", + "orchid", + "ordeal", + "order", + "organ", + "orgasm", + "orient", + "origin", + "ornate", + "orphan", + "oscar", + "other", + "otter", + "ought", + "ounce", + "our", + "out", + "outer", + "output", + "outset", + "oval", + "oven", + "over", + "overt", + "owe", + "owing", + "owl", + "own", + "owner", + "oxford", + "oxide", + "oxygen", + "oyster", + "ozone", + "pace", + "pack", + "packet", + "pact", + "pad", + "paddle", + "paddy", + "pagan", + "page", + "paid", + "pain", + "paint", + "pair", + "palace", + "pale", + "palm", + "pan", + "panama", + "panel", + "panic", + "papa", + "papal", + "paper", + "parade", + "parcel", + "pardon", + "parent", + "paris", + "parish", + "park", + "parody", + "parrot", + "part", + "partly", + "party", + "pascal", + "pass", + "past", + "paste", + "pastel", + "pastor", + "pastry", + "pat", + "patch", + "patent", + "path", + "patio", + "patrol", + "patron", + "paul", + "pause", + "pave", + "paw", + "pawn", + "pay", + "peace", + "peach", + "peak", + "pear", + "pearl", + "pedal", + "peel", + "peer", + "peking", + "pelvic", + "pelvis", + "pen", + "penal", + "pence", + "pencil", + "penny", + "people", + "pepper", + "per", + "perch", + "peril", + "period", + "perish", + "permit", + "person", + "peru", + "pest", + "pet", + "peter", + "petite", + "petrol", + "petty", + "phase", + "philip", + "phone", + "photo", + "phrase", + "piano", + "pick", + "picket", + "picnic", + "pie", + "piece", + "pier", + "pierce", + "piety", + "pig", + "pigeon", + "piggy", + "pike", + "pile", + "pill", + "pillar", + "pillow", + "pilot", + "pin", + "pinch", + "pine", + "pink", + "pint", + "pious", + "pipe", + "pirate", + "piss", + "pistol", + "piston", + "pit", + "pitch", + "pity", + "pivot", + "pixel", + "pizza", + "place", + "placid", + "plague", + "plain", + "plan", + "plane", + "planet", + "plank", + "plant", + "plasma", + "plate", + "play", + "player", + "plea", + "plead", + "please", + "pledge", + "plenty", + "plight", + "plot", + "plough", + "ploy", + "plug", + "plum", + "plump", + "plunge", + "plural", + "plus", + "plush", + "pocket", + "poem", + "poet", + "poetic", + "poetry", + "point", + "poison", + "poland", + "polar", + "pole", + "police", + "policy", + "polish", + "polite", + "poll", + "pollen", + "polo", + "pond", + "ponder", + "pony", + "pool", + "poor", + "poorly", + "pop", + "poppy", + "pore", + "pork", + "port", + "portal", + "pose", + "posh", + "post", + "postal", + "pot", + "potato", + "potent", + "pouch", + "pound", + "pour", + "powder", + "power", + "praise", + "pray", + "prayer", + "preach", + "prefer", + "prefix", + "press", + "pretty", + "price", + "pride", + "priest", + "primal", + "prime", + "prince", + "print", + "prior", + "prism", + "prison", + "privy", + "prize", + "probe", + "profit", + "prompt", + "prone", + "proof", + "propel", + "proper", + "prose", + "proton", + "proud", + "prove", + "proven", + "proxy", + "prune", + "pry", + "psalm", + "pseudo", + "psyche", + "pub", + "public", + "puff", + "pull", + "pulp", + "pulpit", + "pulsar", + "pulse", + "pump", + "punch", + "punish", + "punk", + "pupil", + "puppet", + "puppy", + "pure", + "purely", + "purge", + "purify", + "purple", + "purse", + "pursue", + "push", + "pushy", + "put", + "putt", + "puzzle", + "quaint", + "quake", + "quarry", + "quart", + "quartz", + "quebec", + "queen", + "queer", + "query", + "quest", + "queue", + "quick", + "quid", + "quiet", + "quilt", + "quirk", + "quit", + "quite", + "quiver", + "quiz", + "quota", + "quote", + "rabbit", + "race", + "racial", + "racism", + "rack", + "racket", + "radar", + "radio", + "radish", + "radius", + "raffle", + "raft", + "rage", + "raid", + "rail", + "rain", + "rainy", + "raise", + "rake", + "rally", + "ramp", + "random", + "range", + "rank", + "ransom", + "rape", + "rapid", + "rare", + "rarely", + "rarity", + "rash", + "rat", + "rate", + "rather", + "ratify", + "ratio", + "rattle", + "rave", + "raven", + "raw", + "ray", + "razor", + "reach", + "react", + "read", + "reader", + "ready", + "real", + "really", + "realm", + "reap", + "rear", + "reason", + "rebel", + "recall", + "recent", + "recess", + "recipe", + "reckon", + "record", + "recoup", + "rector", + "red", + "redeem", + "redo", + "reduce", + "reed", + "reef", + "reek", + "refer", + "reform", + "refuge", + "refuse", + "regal", + "regard", + "regent", + "regime", + "region", + "regret", + "reign", + "reject", + "relate", + "relax", + "relay", + "relic", + "relief", + "relish", + "rely", + "remain", + "remark", + "remedy", + "remind", + "remit", + "remote", + "remove", + "renal", + "render", + "rent", + "rental", + "repair", + "repeal", + "repeat", + "repent", + "reply", + "report", + "rescue", + "resent", + "reside", + "resign", + "resin", + "resist", + "resort", + "rest", + "result", + "resume", + "retail", + "retain", + "retina", + "retire", + "return", + "reveal", + "review", + "revise", + "revive", + "revolt", + "reward", + "rex", + "rhine", + "rhino", + "rhyme", + "rhythm", + "ribbon", + "rice", + "rich", + "rick", + "rid", + "ride", + "rider", + "ridge", + "rife", + "rifle", + "rift", + "right", + "rigid", + "rile", + "rim", + "ring", + "rinse", + "riot", + "ripe", + "ripen", + "ripple", + "rise", + "risk", + "risky", + "rite", + "ritual", + "ritz", + "rival", + "river", + "road", + "roar", + "roast", + "rob", + "robe", + "robert", + "robin", + "robot", + "robust", + "rock", + "rocket", + "rocky", + "rod", + "rode", + "rodent", + "rogue", + "role", + "roll", + "roman", + "rome", + "roof", + "room", + "root", + "rope", + "rose", + "rosy", + "rot", + "rotate", + "rotor", + "rotten", + "rouge", + "rough", + "round", + "route", + "rover", + "row", + "royal", + "rub", + "rubber", + "rubble", + "ruby", + "rudder", + "rude", + "rug", + "rugby", + "ruin", + "rule", + "ruler", + "rumble", + "rump", + "run", + "rune", + "rung", + "runway", + "rural", + "rush", + "russia", + "rust", + "rustic", + "rusty", + "sack", + "sacred", + "sad", + "saddle", + "sadism", + "sadly", + "safari", + "safe", + "safely", + "safer", + "safety", + "saga", + "sage", + "sahara", + "said", + "sail", + "sailor", + "saint", + "sake", + "salad", + "salary", + "sale", + "saline", + "saliva", + "salmon", + "saloon", + "salt", + "salty", + "salute", + "sam", + "same", + "sample", + "sand", + "sandy", + "sane", + "sash", + "satin", + "satire", + "saturn", + "sauce", + "saucer", + "saudi", + "sauna", + "savage", + "save", + "saw", + "say", + "scale", + "scalp", + "scan", + "scant", + "scar", + "scarce", + "scare", + "scarf", + "scary", + "scene", + "scenic", + "scent", + "school", + "scold", + "scope", + "score", + "scorn", + "scotch", + "scott", + "scout", + "scrap", + "scrape", + "scream", + "screen", + "screw", + "script", + "scroll", + "scrub", + "scum", + "sea", + "seal", + "seam", + "seaman", + "search", + "season", + "seat", + "second", + "secret", + "sect", + "sector", + "secure", + "see", + "seed", + "seeing", + "seek", + "seem", + "seize", + "seldom", + "select", + "self", + "sell", + "seller", + "semi", + "senate", + "send", + "senile", + "senior", + "sense", + "sensor", + "sent", + "sentry", + "seoul", + "sequel", + "serene", + "serial", + "series", + "sermon", + "serum", + "serve", + "server", + "set", + "settle", + "seven", + "severe", + "sew", + "sewage", + "shabby", + "shade", + "shadow", + "shady", + "shaft", + "shaggy", + "shah", + "shake", + "shaky", + "shall", + "sham", + "shame", + "shape", + "share", + "shark", + "sharp", + "shawl", + "she", + "shear", + "sheen", + "sheep", + "sheer", + "sheet", + "shelf", + "shell", + "sherry", + "shield", + "shift", + "shine", + "shiny", + "ship", + "shire", + "shirk", + "shirt", + "shiver", + "shock", + "shoe", + "shook", + "shoot", + "shop", + "shore", + "short", + "shot", + "should", + "shout", + "show", + "shower", + "shrank", + "shrewd", + "shrill", + "shrimp", + "shrine", + "shrink", + "shrub", + "shrug", + "shut", + "shy", + "shyly", + "sick", + "side", + "siege", + "sigh", + "sight", + "sigma", + "sign", + "signal", + "silent", + "silk", + "silken", + "silky", + "sill", + "silly", + "silo", + "silver", + "simple", + "simply", + "since", + "sinful", + "sing", + "singer", + "single", + "sink", + "sir", + "sire", + "siren", + "sister", + "sit", + "site", + "sitter", + "six", + "sixth", + "sixty", + "size", + "sketch", + "skill", + "skin", + "skinny", + "skip", + "skirt", + "skull", + "sky", + "slab", + "slack", + "slain", + "slam", + "slang", + "slap", + "slat", + "slate", + "slave", + "sleek", + "sleep", + "sleepy", + "sleeve", + "slice", + "slick", + "slid", + "slide", + "slight", + "slim", + "slimy", + "sling", + "slip", + "slit", + "slogan", + "slope", + "sloppy", + "slot", + "slow", + "slowly", + "slug", + "slum", + "slump", + "smack", + "small", + "smart", + "smash", + "smear", + "smell", + "smelly", + "smelt", + "smile", + "smite", + "smoke", + "smoky", + "smooth", + "smug", + "snack", + "snail", + "snake", + "snap", + "snatch", + "sneak", + "snow", + "snowy", + "snug", + "soak", + "soap", + "sober", + "soccer", + "social", + "sock", + "socket", + "socks", + "soda", + "sodden", + "sodium", + "sofa", + "soft", + "soften", + "softly", + "soggy", + "soil", + "solar", + "sold", + "sole", + "solely", + "solemn", + "solid", + "solo", + "solve", + "some", + "son", + "sonar", + "sonata", + "song", + "sonic", + "sony", + "soon", + "sooner", + "soot", + "soothe", + "sordid", + "sore", + "sorrow", + "sorry", + "sort", + "soul", + "sound", + "soup", + "sour", + "source", + "soviet", + "sow", + "space", + "spade", + "spain", + "span", + "spare", + "spark", + "sparse", + "spasm", + "spat", + "spate", + "speak", + "spear", + "speech", + "speed", + "speedy", + "spell", + "spend", + "sphere", + "spice", + "spicy", + "spider", + "spiky", + "spill", + "spin", + "spinal", + "spine", + "spiral", + "spirit", + "spit", + "spite", + "splash", + "split", + "spoil", + "spoke", + "sponge", + "spoon", + "sport", + "spot", + "spouse", + "spray", + "spread", + "spree", + "spring", + "sprint", + "spur", + "squad", + "square", + "squash", + "squat", + "squid", + "stab", + "stable", + "stack", + "staff", + "stage", + "stain", + "stair", + "stairs", + "stake", + "stale", + "stall", + "stamp", + "stance", + "stand", + "staple", + "star", + "starch", + "stare", + "stark", + "start", + "starve", + "state", + "static", + "statue", + "status", + "stay", + "stead", + "steady", + "steak", + "steal", + "steam", + "steel", + "steep", + "steer", + "stem", + "stench", + "step", + "stereo", + "stern", + "stew", + "stick", + "sticky", + "stiff", + "stifle", + "stigma", + "still", + "sting", + "stint", + "stir", + "stitch", + "stock", + "stocky", + "stone", + "stony", + "stool", + "stop", + "store", + "storm", + "stormy", + "story", + "stout", + "stove", + "stow", + "strain", + "strait", + "strand", + "strap", + "strata", + "straw", + "stray", + "streak", + "stream", + "street", + "stress", + "strict", + "stride", + "strife", + "strike", + "string", + "strip", + "stripe", + "strive", + "stroke", + "stroll", + "strong", + "stud", + "studio", + "study", + "stuff", + "stuffy", + "stunt", + "stupid", + "sturdy", + "style", + "submit", + "subtle", + "subtly", + "suburb", + "such", + "sudden", + "sue", + "suez", + "suffer", + "sugar", + "suit", + "suite", + "suitor", + "sullen", + "sultan", + "sum", + "summer", + "summit", + "summon", + "sun", + "sunday", + "sunny", + "sunset", + "super", + "superb", + "supper", + "supple", + "supply", + "sure", + "surely", + "surf", + "surge", + "survey", + "suture", + "swamp", + "swan", + "swap", + "swarm", + "sway", + "swear", + "sweat", + "sweaty", + "sweden", + "sweep", + "sweet", + "swell", + "swift", + "swim", + "swine", + "swing", + "swirl", + "swiss", + "switch", + "sword", + "swore", + "sydney", + "symbol", + "synod", + "syntax", + "syria", + "syrup", + "system", + "table", + "tablet", + "taboo", + "tacit", + "tackle", + "tact", + "tactic", + "tail", + "tailor", + "taiwan", + "take", + "tale", + "talent", + "talk", + "tall", + "tally", + "tame", + "tampa", + "tan", + "tandem", + "tangle", + "tank", + "tap", + "tape", + "target", + "tariff", + "tarp", + "tart", + "tarzan", + "task", + "taste", + "tasty", + "tattoo", + "taurus", + "taut", + "tavern", + "tax", + "taxi", + "tea", + "teach", + "teak", + "team", + "tear", + "tease", + "tech", + "teeth", + "tell", + "temper", + "temple", + "tempo", + "tempt", + "ten", + "tenant", + "tend", + "tender", + "tendon", + "tennis", + "tenor", + "tense", + "tent", + "tenth", + "tenure", + "teresa", + "term", + "terror", + "terse", + "test", + "texas", + "text", + "thank", + "thaw", + "them", + "theme", + "thence", + "theory", + "there", + "these", + "thesis", + "they", + "thick", + "thief", + "thigh", + "thin", + "thing", + "think", + "third", + "thirst", + "thirty", + "this", + "thomas", + "thorn", + "those", + "though", + "thread", + "threat", + "three", + "thrill", + "thrive", + "throat", + "throne", + "throng", + "throw", + "thrust", + "thud", + "thug", + "thumb", + "thus", + "thyme", + "tibet", + "tick", + "ticket", + "tidal", + "tide", + "tidy", + "tie", + "tier", + "tiger", + "tight", + "tile", + "till", + "tilt", + "timber", + "time", + "timid", + "tin", + "tiny", + "tip", + "tire", + "tissue", + "title", + "toad", + "toast", + "today", + "toe", + "toilet", + "token", + "tokyo", + "told", + "toll", + "tom", + "tomato", + "tomb", + "tonal", + "tone", + "tongue", + "tonic", + "too", + "took", + "tool", + "tooth", + "top", + "topaz", + "topic", + "torch", + "torque", + "torso", + "tort", + "toss", + "total", + "touch", + "tough", + "tour", + "toward", + "towel", + "tower", + "town", + "toxic", + "toxin", + "toy", + "trace", + "track", + "tract", + "trade", + "tragic", + "trail", + "train", + "trait", + "tram", + "trance", + "trap", + "trauma", + "travel", + "tray", + "tread", + "treat", + "treaty", + "treble", + "tree", + "trek", + "tremor", + "trench", + "trend", + "trendy", + "trial", + "tribal", + "tribe", + "trick", + "tricky", + "tried", + "trifle", + "trim", + "trio", + "trip", + "triple", + "troop", + "trophy", + "trot", + "trough", + "trout", + "truce", + "truck", + "true", + "truly", + "trunk", + "trust", + "truth", + "try", + "tube", + "tumble", + "tuna", + "tundra", + "tune", + "tunic", + "tunnel", + "turban", + "turf", + "turk", + "turkey", + "turn", + "turtle", + "tutor", + "tweed", + "twelve", + "twenty", + "twice", + "twin", + "twist", + "two", + "tycoon", + "tying", + "type", + "tyrant", + "ugly", + "ulcer", + "ultra", + "umpire", + "unable", + "uncle", + "under", + "uneasy", + "unfair", + "unify", + "union", + "unique", + "unit", + "unite", + "unity", + "unlike", + "unrest", + "unruly", + "until", + "update", + "upheld", + "uphill", + "uphold", + "upon", + "upper", + "uproar", + "upset", + "upshot", + "uptake", + "upturn", + "upward", + "urban", + "urge", + "urgent", + "urging", + "urine", + "usable", + "usage", + "use", + "useful", + "user", + "usual", + "utmost", + "utter", + "vacant", + "vacuum", + "vague", + "vain", + "valet", + "valid", + "valley", + "value", + "valve", + "van", + "vanish", + "vanity", + "vary", + "vase", + "vast", + "vat", + "vault", + "vector", + "veil", + "vein", + "velvet", + "vendor", + "veneer", + "venice", + "venom", + "vent", + "venue", + "venus", + "verb", + "verbal", + "verge", + "verify", + "verity", + "verse", + "versus", + "very", + "vessel", + "vest", + "vet", + "veto", + "via", + "viable", + "vicar", + "vice", + "victim", + "victor", + "video", + "vienna", + "view", + "vigil", + "viking", + "vile", + "villa", + "vine", + "vinyl", + "viola", + "violet", + "violin", + "viral", + "virgo", + "virtue", + "virus", + "visa", + "vision", + "visit", + "visual", + "vital", + "vivid", + "vocal", + "vodka", + "vogue", + "voice", + "void", + "volley", + "volume", + "vote", + "vowel", + "voyage", + "vulgar", + "wade", + "wage", + "waist", + "wait", + "waiter", + "wake", + "walk", + "walker", + "wall", + "wallet", + "walnut", + "wander", + "want", + "war", + "warden", + "warm", + "warmth", + "warn", + "warp", + "warsaw", + "wary", + "was", + "wash", + "wasp", + "waste", + "watch", + "water", + "watery", + "wave", + "wax", + "way", + "weak", + "weaken", + "wealth", + "weapon", + "wear", + "weary", + "weave", + "wedge", + "wee", + "weed", + "week", + "weekly", + "weep", + "weigh", + "weight", + "weird", + "well", + "were", + "west", + "wet", + "whale", + "wharf", + "what", + "wheat", + "wheel", + "when", + "whence", + "where", + "which", + "whiff", + "while", + "whim", + "whip", + "whisky", + "white", + "who", + "whole", + "wholly", + "whom", + "whose", + "why", + "wicked", + "wide", + "widely", + "widen", + "wider", + "widow", + "width", + "wife", + "wig", + "wild", + "wildly", + "will", + "willow", + "wily", + "win", + "wind", + "window", + "windy", + "wine", + "wing", + "wink", + "winner", + "winter", + "wipe", + "wire", + "wisdom", + "wise", + "wish", + "wit", + "witch", + "with", + "within", + "witty", + "wizard", + "woke", + "wolf", + "wolves", + "woman", + "womb", + "won", + "wonder", + "wood", + "wooden", + "woods", + "woody", + "wool", + "word", + "work", + "worker", + "world", + "worm", + "worry", + "worse", + "worst", + "worth", + "worthy", + "would", + "wound", + "wrap", + "wrath", + "wreath", + "wreck", + "wring", + "wrist", + "writ", + "write", + "writer", + "wrong", + "xerox", + "yacht", + "yale", + "yard", + "yarn", + "yeah", + "year", + "yeard", + "yeast", + "yellow", + "yet", + "yield", + "yogurt", + "yolk", + "you", + "young", + "your", + "youth", + "zaire", + "zeal", + "zebra", + "zenith", + "zero", + "zeus", + "zigzag", + "zinc", + "zombie", + "zone", +]); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/words/bip39.js +/* harmony default export */ var bip39 = ([ + "abandon", + "ability", + "able", + "about", + "above", + "absent", + "absorb", + "abstract", + "absurd", + "abuse", + "access", + "accident", + "account", + "accuse", + "achieve", + "acid", + "acoustic", + "acquire", + "across", + "act", + "action", + "actor", + "actress", + "actual", + "adapt", + "add", + "addict", + "address", + "adjust", + "admit", + "adult", + "advance", + "advice", + "aerobic", + "affair", + "afford", + "afraid", + "again", + "age", + "agent", + "agree", + "ahead", + "aim", + "air", + "airport", + "aisle", + "alarm", + "album", + "alcohol", + "alert", + "alien", + "all", + "alley", + "allow", + "almost", + "alone", + "alpha", + "already", + "also", + "alter", + "always", + "amateur", + "amazing", + "among", + "amount", + "amused", + "analyst", + "anchor", + "ancient", + "anger", + "angle", + "angry", + "animal", + "ankle", + "announce", + "annual", + "another", + "answer", + "antenna", + "antique", + "anxiety", + "any", + "apart", + "apology", + "appear", + "apple", + "approve", + "april", + "arch", + "arctic", + "area", + "arena", + "argue", + "arm", + "armed", + "armor", + "army", + "around", + "arrange", + "arrest", + "arrive", + "arrow", + "art", + "artefact", + "artist", + "artwork", + "ask", + "aspect", + "assault", + "asset", + "assist", + "assume", + "asthma", + "athlete", + "atom", + "attack", + "attend", + "attitude", + "attract", + "auction", + "audit", + "august", + "aunt", + "author", + "auto", + "autumn", + "average", + "avocado", + "avoid", + "awake", + "aware", + "away", + "awesome", + "awful", + "awkward", + "axis", + "baby", + "bachelor", + "bacon", + "badge", + "bag", + "balance", + "balcony", + "ball", + "bamboo", + "banana", + "banner", + "bar", + "barely", + "bargain", + "barrel", + "base", + "basic", + "basket", + "battle", + "beach", + "bean", + "beauty", + "because", + "become", + "beef", + "before", + "begin", + "behave", + "behind", + "believe", + "below", + "belt", + "bench", + "benefit", + "best", + "betray", + "better", + "between", + "beyond", + "bicycle", + "bid", + "bike", + "bind", + "biology", + "bird", + "birth", + "bitter", + "black", + "blade", + "blame", + "blanket", + "blast", + "bleak", + "bless", + "blind", + "blood", + "blossom", + "blouse", + "blue", + "blur", + "blush", + "board", + "boat", + "body", + "boil", + "bomb", + "bone", + "bonus", + "book", + "boost", + "border", + "boring", + "borrow", + "boss", + "bottom", + "bounce", + "box", + "boy", + "bracket", + "brain", + "brand", + "brass", + "brave", + "bread", + "breeze", + "brick", + "bridge", + "brief", + "bright", + "bring", + "brisk", + "broccoli", + "broken", + "bronze", + "broom", + "brother", + "brown", + "brush", + "bubble", + "buddy", + "budget", + "buffalo", + "build", + "bulb", + "bulk", + "bullet", + "bundle", + "bunker", + "burden", + "burger", + "burst", + "bus", + "business", + "busy", + "butter", + "buyer", + "buzz", + "cabbage", + "cabin", + "cable", + "cactus", + "cage", + "cake", + "call", + "calm", + "camera", + "camp", + "can", + "canal", + "cancel", + "candy", + "cannon", + "canoe", + "canvas", + "canyon", + "capable", + "capital", + "captain", + "car", + "carbon", + "card", + "cargo", + "carpet", + "carry", + "cart", + "case", + "cash", + "casino", + "castle", + "casual", + "cat", + "catalog", + "catch", + "category", + "cattle", + "caught", + "cause", + "caution", + "cave", + "ceiling", + "celery", + "cement", + "census", + "century", + "cereal", + "certain", + "chair", + "chalk", + "champion", + "change", + "chaos", + "chapter", + "charge", + "chase", + "chat", + "cheap", + "check", + "cheese", + "chef", + "cherry", + "chest", + "chicken", + "chief", + "child", + "chimney", + "choice", + "choose", + "chronic", + "chuckle", + "chunk", + "churn", + "cigar", + "cinnamon", + "circle", + "citizen", + "city", + "civil", + "claim", + "clap", + "clarify", + "claw", + "clay", + "clean", + "clerk", + "clever", + "click", + "client", + "cliff", + "climb", + "clinic", + "clip", + "clock", + "clog", + "close", + "cloth", + "cloud", + "clown", + "club", + "clump", + "cluster", + "clutch", + "coach", + "coast", + "coconut", + "code", + "coffee", + "coil", + "coin", + "collect", + "color", + "column", + "combine", + "come", + "comfort", + "comic", + "common", + "company", + "concert", + "conduct", + "confirm", + "congress", + "connect", + "consider", + "control", + "convince", + "cook", + "cool", + "copper", + "copy", + "coral", + "core", + "corn", + "correct", + "cost", + "cotton", + "couch", + "country", + "couple", + "course", + "cousin", + "cover", + "coyote", + "crack", + "cradle", + "craft", + "cram", + "crane", + "crash", + "crater", + "crawl", + "crazy", + "cream", + "credit", + "creek", + "crew", + "cricket", + "crime", + "crisp", + "critic", + "crop", + "cross", + "crouch", + "crowd", + "crucial", + "cruel", + "cruise", + "crumble", + "crunch", + "crush", + "cry", + "crystal", + "cube", + "culture", + "cup", + "cupboard", + "curious", + "current", + "curtain", + "curve", + "cushion", + "custom", + "cute", + "cycle", + "dad", + "damage", + "damp", + "dance", + "danger", + "daring", + "dash", + "daughter", + "dawn", + "day", + "deal", + "debate", + "debris", + "decade", + "december", + "decide", + "decline", + "decorate", + "decrease", + "deer", + "defense", + "define", + "defy", + "degree", + "delay", + "deliver", + "demand", + "demise", + "denial", + "dentist", + "deny", + "depart", + "depend", + "deposit", + "depth", + "deputy", + "derive", + "describe", + "desert", + "design", + "desk", + "despair", + "destroy", + "detail", + "detect", + "develop", + "device", + "devote", + "diagram", + "dial", + "diamond", + "diary", + "dice", + "diesel", + "diet", + "differ", + "digital", + "dignity", + "dilemma", + "dinner", + "dinosaur", + "direct", + "dirt", + "disagree", + "discover", + "disease", + "dish", + "dismiss", + "disorder", + "display", + "distance", + "divert", + "divide", + "divorce", + "dizzy", + "doctor", + "document", + "dog", + "doll", + "dolphin", + "domain", + "donate", + "donkey", + "donor", + "door", + "dose", + "double", + "dove", + "draft", + "dragon", + "drama", + "drastic", + "draw", + "dream", + "dress", + "drift", + "drill", + "drink", + "drip", + "drive", + "drop", + "drum", + "dry", + "duck", + "dumb", + "dune", + "during", + "dust", + "dutch", + "duty", + "dwarf", + "dynamic", + "eager", + "eagle", + "early", + "earn", + "earth", + "easily", + "east", + "easy", + "echo", + "ecology", + "economy", + "edge", + "edit", + "educate", + "effort", + "egg", + "eight", + "either", + "elbow", + "elder", + "electric", + "elegant", + "element", + "elephant", + "elevator", + "elite", + "else", + "embark", + "embody", + "embrace", + "emerge", + "emotion", + "employ", + "empower", + "empty", + "enable", + "enact", + "end", + "endless", + "endorse", + "enemy", + "energy", + "enforce", + "engage", + "engine", + "enhance", + "enjoy", + "enlist", + "enough", + "enrich", + "enroll", + "ensure", + "enter", + "entire", + "entry", + "envelope", + "episode", + "equal", + "equip", + "era", + "erase", + "erode", + "erosion", + "error", + "erupt", + "escape", + "essay", + "essence", + "estate", + "eternal", + "ethics", + "evidence", + "evil", + "evoke", + "evolve", + "exact", + "example", + "excess", + "exchange", + "excite", + "exclude", + "excuse", + "execute", + "exercise", + "exhaust", + "exhibit", + "exile", + "exist", + "exit", + "exotic", + "expand", + "expect", + "expire", + "explain", + "expose", + "express", + "extend", + "extra", + "eye", + "eyebrow", + "fabric", + "face", + "faculty", + "fade", + "faint", + "faith", + "fall", + "false", + "fame", + "family", + "famous", + "fan", + "fancy", + "fantasy", + "farm", + "fashion", + "fat", + "fatal", + "father", + "fatigue", + "fault", + "favorite", + "feature", + "february", + "federal", + "fee", + "feed", + "feel", + "female", + "fence", + "festival", + "fetch", + "fever", + "few", + "fiber", + "fiction", + "field", + "figure", + "file", + "film", + "filter", + "final", + "find", + "fine", + "finger", + "finish", + "fire", + "firm", + "first", + "fiscal", + "fish", + "fit", + "fitness", + "fix", + "flag", + "flame", + "flash", + "flat", + "flavor", + "flee", + "flight", + "flip", + "float", + "flock", + "floor", + "flower", + "fluid", + "flush", + "fly", + "foam", + "focus", + "fog", + "foil", + "fold", + "follow", + "food", + "foot", + "force", + "forest", + "forget", + "fork", + "fortune", + "forum", + "forward", + "fossil", + "foster", + "found", + "fox", + "fragile", + "frame", + "frequent", + "fresh", + "friend", + "fringe", + "frog", + "front", + "frost", + "frown", + "frozen", + "fruit", + "fuel", + "fun", + "funny", + "furnace", + "fury", + "future", + "gadget", + "gain", + "galaxy", + "gallery", + "game", + "gap", + "garage", + "garbage", + "garden", + "garlic", + "garment", + "gas", + "gasp", + "gate", + "gather", + "gauge", + "gaze", + "general", + "genius", + "genre", + "gentle", + "genuine", + "gesture", + "ghost", + "giant", + "gift", + "giggle", + "ginger", + "giraffe", + "girl", + "give", + "glad", + "glance", + "glare", + "glass", + "glide", + "glimpse", + "globe", + "gloom", + "glory", + "glove", + "glow", + "glue", + "goat", + "goddess", + "gold", + "good", + "goose", + "gorilla", + "gospel", + "gossip", + "govern", + "gown", + "grab", + "grace", + "grain", + "grant", + "grape", + "grass", + "gravity", + "great", + "green", + "grid", + "grief", + "grit", + "grocery", + "group", + "grow", + "grunt", + "guard", + "guess", + "guide", + "guilt", + "guitar", + "gun", + "gym", + "habit", + "hair", + "half", + "hammer", + "hamster", + "hand", + "happy", + "harbor", + "hard", + "harsh", + "harvest", + "hat", + "have", + "hawk", + "hazard", + "head", + "health", + "heart", + "heavy", + "hedgehog", + "height", + "hello", + "helmet", + "help", + "hen", + "hero", + "hidden", + "high", + "hill", + "hint", + "hip", + "hire", + "history", + "hobby", + "hockey", + "hold", + "hole", + "holiday", + "hollow", + "home", + "honey", + "hood", + "hope", + "horn", + "horror", + "horse", + "hospital", + "host", + "hotel", + "hour", + "hover", + "hub", + "huge", + "human", + "humble", + "humor", + "hundred", + "hungry", + "hunt", + "hurdle", + "hurry", + "hurt", + "husband", + "hybrid", + "ice", + "icon", + "idea", + "identify", + "idle", + "ignore", + "ill", + "illegal", + "illness", + "image", + "imitate", + "immense", + "immune", + "impact", + "impose", + "improve", + "impulse", + "inch", + "include", + "income", + "increase", + "index", + "indicate", + "indoor", + "industry", + "infant", + "inflict", + "inform", + "inhale", + "inherit", + "initial", + "inject", + "injury", + "inmate", + "inner", + "innocent", + "input", + "inquiry", + "insane", + "insect", + "inside", + "inspire", + "install", + "intact", + "interest", + "into", + "invest", + "invite", + "involve", + "iron", + "island", + "isolate", + "issue", + "item", + "ivory", + "jacket", + "jaguar", + "jar", + "jazz", + "jealous", + "jeans", + "jelly", + "jewel", + "job", + "join", + "joke", + "journey", + "joy", + "judge", + "juice", + "jump", + "jungle", + "junior", + "junk", + "just", + "kangaroo", + "keen", + "keep", + "ketchup", + "key", + "kick", + "kid", + "kidney", + "kind", + "kingdom", + "kiss", + "kit", + "kitchen", + "kite", + "kitten", + "kiwi", + "knee", + "knife", + "knock", + "know", + "lab", + "label", + "labor", + "ladder", + "lady", + "lake", + "lamp", + "language", + "laptop", + "large", + "later", + "latin", + "laugh", + "laundry", + "lava", + "law", + "lawn", + "lawsuit", + "layer", + "lazy", + "leader", + "leaf", + "learn", + "leave", + "lecture", + "left", + "leg", + "legal", + "legend", + "leisure", + "lemon", + "lend", + "length", + "lens", + "leopard", + "lesson", + "letter", + "level", + "liar", + "liberty", + "library", + "license", + "life", + "lift", + "light", + "like", + "limb", + "limit", + "link", + "lion", + "liquid", + "list", + "little", + "live", + "lizard", + "load", + "loan", + "lobster", + "local", + "lock", + "logic", + "lonely", + "long", + "loop", + "lottery", + "loud", + "lounge", + "love", + "loyal", + "lucky", + "luggage", + "lumber", + "lunar", + "lunch", + "luxury", + "lyrics", + "machine", + "mad", + "magic", + "magnet", + "maid", + "mail", + "main", + "major", + "make", + "mammal", + "man", + "manage", + "mandate", + "mango", + "mansion", + "manual", + "maple", + "marble", + "march", + "margin", + "marine", + "market", + "marriage", + "mask", + "mass", + "master", + "match", + "material", + "math", + "matrix", + "matter", + "maximum", + "maze", + "meadow", + "mean", + "measure", + "meat", + "mechanic", + "medal", + "media", + "melody", + "melt", + "member", + "memory", + "mention", + "menu", + "mercy", + "merge", + "merit", + "merry", + "mesh", + "message", + "metal", + "method", + "middle", + "midnight", + "milk", + "million", + "mimic", + "mind", + "minimum", + "minor", + "minute", + "miracle", + "mirror", + "misery", + "miss", + "mistake", + "mix", + "mixed", + "mixture", + "mobile", + "model", + "modify", + "mom", + "moment", + "monitor", + "monkey", + "monster", + "month", + "moon", + "moral", + "more", + "morning", + "mosquito", + "mother", + "motion", + "motor", + "mountain", + "mouse", + "move", + "movie", + "much", + "muffin", + "mule", + "multiply", + "muscle", + "museum", + "mushroom", + "music", + "must", + "mutual", + "myself", + "mystery", + "myth", + "naive", + "name", + "napkin", + "narrow", + "nasty", + "nation", + "nature", + "near", + "neck", + "need", + "negative", + "neglect", + "neither", + "nephew", + "nerve", + "nest", + "net", + "network", + "neutral", + "never", + "news", + "next", + "nice", + "night", + "noble", + "noise", + "nominee", + "noodle", + "normal", + "north", + "nose", + "notable", + "note", + "nothing", + "notice", + "novel", + "now", + "nuclear", + "number", + "nurse", + "nut", + "oak", + "obey", + "object", + "oblige", + "obscure", + "observe", + "obtain", + "obvious", + "occur", + "ocean", + "october", + "odor", + "off", + "offer", + "office", + "often", + "oil", + "okay", + "old", + "olive", + "olympic", + "omit", + "once", + "one", + "onion", + "online", + "only", + "open", + "opera", + "opinion", + "oppose", + "option", + "orange", + "orbit", + "orchard", + "order", + "ordinary", + "organ", + "orient", + "original", + "orphan", + "ostrich", + "other", + "outdoor", + "outer", + "output", + "outside", + "oval", + "oven", + "over", + "own", + "owner", + "oxygen", + "oyster", + "ozone", + "pact", + "paddle", + "page", + "pair", + "palace", + "palm", + "panda", + "panel", + "panic", + "panther", + "paper", + "parade", + "parent", + "park", + "parrot", + "party", + "pass", + "patch", + "path", + "patient", + "patrol", + "pattern", + "pause", + "pave", + "payment", + "peace", + "peanut", + "pear", + "peasant", + "pelican", + "pen", + "penalty", + "pencil", + "people", + "pepper", + "perfect", + "permit", + "person", + "pet", + "phone", + "photo", + "phrase", + "physical", + "piano", + "picnic", + "picture", + "piece", + "pig", + "pigeon", + "pill", + "pilot", + "pink", + "pioneer", + "pipe", + "pistol", + "pitch", + "pizza", + "place", + "planet", + "plastic", + "plate", + "play", + "please", + "pledge", + "pluck", + "plug", + "plunge", + "poem", + "poet", + "point", + "polar", + "pole", + "police", + "pond", + "pony", + "pool", + "popular", + "portion", + "position", + "possible", + "post", + "potato", + "pottery", + "poverty", + "powder", + "power", + "practice", + "praise", + "predict", + "prefer", + "prepare", + "present", + "pretty", + "prevent", + "price", + "pride", + "primary", + "print", + "priority", + "prison", + "private", + "prize", + "problem", + "process", + "produce", + "profit", + "program", + "project", + "promote", + "proof", + "property", + "prosper", + "protect", + "proud", + "provide", + "public", + "pudding", + "pull", + "pulp", + "pulse", + "pumpkin", + "punch", + "pupil", + "puppy", + "purchase", + "purity", + "purpose", + "purse", + "push", + "put", + "puzzle", + "pyramid", + "quality", + "quantum", + "quarter", + "question", + "quick", + "quit", + "quiz", + "quote", + "rabbit", + "raccoon", + "race", + "rack", + "radar", + "radio", + "rail", + "rain", + "raise", + "rally", + "ramp", + "ranch", + "random", + "range", + "rapid", + "rare", + "rate", + "rather", + "raven", + "raw", + "razor", + "ready", + "real", + "reason", + "rebel", + "rebuild", + "recall", + "receive", + "recipe", + "record", + "recycle", + "reduce", + "reflect", + "reform", + "refuse", + "region", + "regret", + "regular", + "reject", + "relax", + "release", + "relief", + "rely", + "remain", + "remember", + "remind", + "remove", + "render", + "renew", + "rent", + "reopen", + "repair", + "repeat", + "replace", + "report", + "require", + "rescue", + "resemble", + "resist", + "resource", + "response", + "result", + "retire", + "retreat", + "return", + "reunion", + "reveal", + "review", + "reward", + "rhythm", + "rib", + "ribbon", + "rice", + "rich", + "ride", + "ridge", + "rifle", + "right", + "rigid", + "ring", + "riot", + "ripple", + "risk", + "ritual", + "rival", + "river", + "road", + "roast", + "robot", + "robust", + "rocket", + "romance", + "roof", + "rookie", + "room", + "rose", + "rotate", + "rough", + "round", + "route", + "royal", + "rubber", + "rude", + "rug", + "rule", + "run", + "runway", + "rural", + "sad", + "saddle", + "sadness", + "safe", + "sail", + "salad", + "salmon", + "salon", + "salt", + "salute", + "same", + "sample", + "sand", + "satisfy", + "satoshi", + "sauce", + "sausage", + "save", + "say", + "scale", + "scan", + "scare", + "scatter", + "scene", + "scheme", + "school", + "science", + "scissors", + "scorpion", + "scout", + "scrap", + "screen", + "script", + "scrub", + "sea", + "search", + "season", + "seat", + "second", + "secret", + "section", + "security", + "seed", + "seek", + "segment", + "select", + "sell", + "seminar", + "senior", + "sense", + "sentence", + "series", + "service", + "session", + "settle", + "setup", + "seven", + "shadow", + "shaft", + "shallow", + "share", + "shed", + "shell", + "sheriff", + "shield", + "shift", + "shine", + "ship", + "shiver", + "shock", + "shoe", + "shoot", + "shop", + "short", + "shoulder", + "shove", + "shrimp", + "shrug", + "shuffle", + "shy", + "sibling", + "sick", + "side", + "siege", + "sight", + "sign", + "silent", + "silk", + "silly", + "silver", + "similar", + "simple", + "since", + "sing", + "siren", + "sister", + "situate", + "six", + "size", + "skate", + "sketch", + "ski", + "skill", + "skin", + "skirt", + "skull", + "slab", + "slam", + "sleep", + "slender", + "slice", + "slide", + "slight", + "slim", + "slogan", + "slot", + "slow", + "slush", + "small", + "smart", + "smile", + "smoke", + "smooth", + "snack", + "snake", + "snap", + "sniff", + "snow", + "soap", + "soccer", + "social", + "sock", + "soda", + "soft", + "solar", + "soldier", + "solid", + "solution", + "solve", + "someone", + "song", + "soon", + "sorry", + "sort", + "soul", + "sound", + "soup", + "source", + "south", + "space", + "spare", + "spatial", + "spawn", + "speak", + "special", + "speed", + "spell", + "spend", + "sphere", + "spice", + "spider", + "spike", + "spin", + "spirit", + "split", + "spoil", + "sponsor", + "spoon", + "sport", + "spot", + "spray", + "spread", + "spring", + "spy", + "square", + "squeeze", + "squirrel", + "stable", + "stadium", + "staff", + "stage", + "stairs", + "stamp", + "stand", + "start", + "state", + "stay", + "steak", + "steel", + "stem", + "step", + "stereo", + "stick", + "still", + "sting", + "stock", + "stomach", + "stone", + "stool", + "story", + "stove", + "strategy", + "street", + "strike", + "strong", + "struggle", + "student", + "stuff", + "stumble", + "style", + "subject", + "submit", + "subway", + "success", + "such", + "sudden", + "suffer", + "sugar", + "suggest", + "suit", + "summer", + "sun", + "sunny", + "sunset", + "super", + "supply", + "supreme", + "sure", + "surface", + "surge", + "surprise", + "surround", + "survey", + "suspect", + "sustain", + "swallow", + "swamp", + "swap", + "swarm", + "swear", + "sweet", + "swift", + "swim", + "swing", + "switch", + "sword", + "symbol", + "symptom", + "syrup", + "system", + "table", + "tackle", + "tag", + "tail", + "talent", + "talk", + "tank", + "tape", + "target", + "task", + "taste", + "tattoo", + "taxi", + "teach", + "team", + "tell", + "ten", + "tenant", + "tennis", + "tent", + "term", + "test", + "text", + "thank", + "that", + "theme", + "then", + "theory", + "there", + "they", + "thing", + "this", + "thought", + "three", + "thrive", + "throw", + "thumb", + "thunder", + "ticket", + "tide", + "tiger", + "tilt", + "timber", + "time", + "tiny", + "tip", + "tired", + "tissue", + "title", + "toast", + "tobacco", + "today", + "toddler", + "toe", + "together", + "toilet", + "token", + "tomato", + "tomorrow", + "tone", + "tongue", + "tonight", + "tool", + "tooth", + "top", + "topic", + "topple", + "torch", + "tornado", + "tortoise", + "toss", + "total", + "tourist", + "toward", + "tower", + "town", + "toy", + "track", + "trade", + "traffic", + "tragic", + "train", + "transfer", + "trap", + "trash", + "travel", + "tray", + "treat", + "tree", + "trend", + "trial", + "tribe", + "trick", + "trigger", + "trim", + "trip", + "trophy", + "trouble", + "truck", + "true", + "truly", + "trumpet", + "trust", + "truth", + "try", + "tube", + "tuition", + "tumble", + "tuna", + "tunnel", + "turkey", + "turn", + "turtle", + "twelve", + "twenty", + "twice", + "twin", + "twist", + "two", + "type", + "typical", + "ugly", + "umbrella", + "unable", + "unaware", + "uncle", + "uncover", + "under", + "undo", + "unfair", + "unfold", + "unhappy", + "uniform", + "unique", + "unit", + "universe", + "unknown", + "unlock", + "until", + "unusual", + "unveil", + "update", + "upgrade", + "uphold", + "upon", + "upper", + "upset", + "urban", + "urge", + "usage", + "use", + "used", + "useful", + "useless", + "usual", + "utility", + "vacant", + "vacuum", + "vague", + "valid", + "valley", + "valve", + "van", + "vanish", + "vapor", + "various", + "vast", + "vault", + "vehicle", + "velvet", + "vendor", + "venture", + "venue", + "verb", + "verify", + "version", + "very", + "vessel", + "veteran", + "viable", + "vibrant", + "vicious", + "victory", + "video", + "view", + "village", + "vintage", + "violin", + "virtual", + "virus", + "visa", + "visit", + "visual", + "vital", + "vivid", + "vocal", + "voice", + "void", + "volcano", + "volume", + "vote", + "voyage", + "wage", + "wagon", + "wait", + "walk", + "wall", + "walnut", + "want", + "warfare", + "warm", + "warrior", + "wash", + "wasp", + "waste", + "water", + "wave", + "way", + "wealth", + "weapon", + "wear", + "weasel", + "weather", + "web", + "wedding", + "weekend", + "weird", + "welcome", + "west", + "wet", + "whale", + "what", + "wheat", + "wheel", + "when", + "where", + "whip", + "whisper", + "wide", + "width", + "wife", + "wild", + "will", + "win", + "window", + "wine", + "wing", + "wink", + "winner", + "winter", + "wire", + "wisdom", + "wise", + "wish", + "witness", + "wolf", + "woman", + "wonder", + "wood", + "wool", + "word", + "work", + "world", + "worry", + "worth", + "wrap", + "wreck", + "wrestle", + "wrist", + "write", + "wrong", + "yard", + "year", + "yellow", + "you", + "young", + "youth", + "zebra", + "zero", + "zone", + "zoo", +]); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/sha256.browser.js +/** + * @param {Uint8Array} data + * @returns {Promise} + */ +async function digest(data) { + // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest + return new Uint8Array(await crypto.subtle.digest("SHA-256", data)); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/primitive/bip39.js + + + +/** + * @param {string[]} words + * @param {string} passphrase + * @returns {Promise} + */ +async function toSeed(words, passphrase) { + const input = words.join(" "); + const salt = `mnemonic${passphrase}`.normalize("NFKD"); + + return deriveKey(HashAlgorithm.Sha512, input, salt, 2048, 64); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/util/entropy.js + + + +/** + * @param {string[]} words + * @param {string[]} wordlist + * @returns {[Uint8Array, number]} + */ +function legacy1(words, wordlist) { + const indicies = words.map((word) => wordlist.indexOf(word.toLowerCase())); + + const data = convertRadix(indicies, wordlist.length, 256, 33); + const checksum = data[data.length - 1]; + const result = new Uint8Array(data.length - 1); + + for (let i = 0; i < data.length - 1; i += 1) { + result[i] = data[i] ^ checksum; + } + + return [result, checksum]; +} + +/** + * @param {string[]} words + * @param {string[]} wordlist + * @returns {Promise} + */ +async function legacy2(words, wordlist) { + const concatBitsLen = words.length * 11; + /** @type {boolean[]} */ + const concatBits = []; + concatBits.fill(false, 0, concatBitsLen); + + for (const [wordIndex, word] of words.entries()) { + const index = wordlist.indexOf(word.toLowerCase()); + + if (index < 0) { + throw new Error(`Word not found in wordlist: ${word}`); + } + + for (let i = 0; i < 11; i += 1) { + concatBits[wordIndex * 11 + i] = (index & (1 << (10 - i))) !== 0; + } + } + + const checksumBitsLen = concatBitsLen / 33; + const entropyBitsLen = concatBitsLen - checksumBitsLen; + const entropy = new Uint8Array(entropyBitsLen / 8); + + for (let i = 0; i < entropy.length; i += 1) { + for (let j = 0; j < 8; j += 1) { + if (concatBits[i * 8 + j]) { + entropy[i] |= 1 << (7 - j); + } + } + } + + // Checksum validation + const hash = await digest(entropy); + const hashBits = bytesToBits(hash); + + for (let i = 0; i < checksumBitsLen; i += 1) { + if (concatBits[entropyBitsLen + i] !== hashBits[i]) { + throw new Error("Checksum mismatch"); + } + } + + return entropy; +} + +/** + * @param {Uint8Array} data + * @returns {number} + */ +function crc8(data) { + let crc = 0xff; + + for (let i = 0; i < data.length - 1; i += 1) { + crc ^= data[i]; + for (let j = 0; j < 8; j += 1) { + crc = (crc >>> 1) ^ ((crc & 1) === 0 ? 0 : 0xb2); + } + } + + return crc ^ 0xff; +} + +/** + * @param {number[]} nums + * @param {number} fromRadix + * @param {number} toRadix + * @param {number} toLength + * @returns {Uint8Array} + */ +function convertRadix(nums, fromRadix, toRadix, toLength) { + let num = new bignumber(0); + + for (const element of nums) { + num = num.times(fromRadix); + num = num.plus(element); + } + + const result = new Uint8Array(toLength); + + for (let i = toLength - 1; i >= 0; i -= 1) { + const tem = num.dividedToIntegerBy(toRadix); + const rem = num.modulo(toRadix); + num = tem; + result[i] = rem.toNumber(); + } + + return result; +} + +/** + * @param {Uint8Array} data + * @returns {boolean[]} + */ +function bytesToBits(data) { + /** @type {boolean[]} */ + const bits = []; + bits.fill(false, 0, data.length * 8); + + for (let i = 0; i < data.length; i += 1) { + for (let j = 0; j < 8; j += 1) { + bits[i * 8 + j] = (data[i] & (1 << (7 - j))) !== 0; + } + } + + return bits; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/Mnemonic.js + + + + + + + + + + + + + + + + + + +const ED25519_SEED_TEXT = "ed25519 seed"; +const ECDSA_SEED_TEXT = "Bitcoin seed"; + +const HARDENED = 0x80000000; + +/// m/44'/3030'/0'/0' - All paths in EdDSA derivation are implicitly hardened. +const HEDERA_PATH = [44, 3030, 0, 0]; + +/// m/44'/3030'/0'/0 +const SLIP44_ECDSA_HEDERA_PATH = [ + 44 | HARDENED, + 3030 | HARDENED, + 0 | HARDENED, + 0, +]; + +/// m/44'/60'/0'/0 +const SLIP44_ECDSA_ETH_PATH = [ + 44 | HARDENED, + 60 | HARDENED, + 0 | HARDENED, + 0, + 0, +]; + +/** + * Multi-word mnemonic phrase (BIP-39). + * + * Compatible with the official Hedera mobile + * wallets (24-words or 22-words) and BRD (12-words). + */ +class Mnemonic_Mnemonic { + /** + * @param {object} props + * @param {string[]} props.words + * @throws {BadMnemonicError} + * @hideconstructor + * @private + */ + constructor({ words }) { + this.words = words; + } + + /** + * Returns a new random 24-word mnemonic from the BIP-39 + * standard English word list. + * @returns {Promise} + */ + static generate() { + return Mnemonic_Mnemonic._generate(24); + } + + /** + * Returns a new random 12-word mnemonic from the BIP-39 + * standard English word list. + * @returns {Promise} + */ + static generate12() { + return Mnemonic_Mnemonic._generate(12); + } + + /** + * @param {number} length + * @returns {Promise} + */ + static async _generate(length) { + // only 12-word or 24-word lengths are supported + let neededEntropy; + + if (length === 12) neededEntropy = 16; + else if (length === 24) neededEntropy = 32; + else { + throw new Error( + `unsupported phrase length ${length}, only 12 or 24 are supported`, + ); + } + + // inlined from (ISC) with heavy alternations for modern crypto + // https://github.com/bitcoinjs/bip39/blob/8461e83677a1d2c685d0d5a9ba2a76bd228f74c6/ts_src/index.ts#L125 + const seed = await bytesAsync(neededEntropy); + const entropyBits = bytesToBinary(Array.from(seed)); + const checksumBits = await deriveChecksumBits(seed); + const bits = entropyBits + checksumBits; + const chunks = bits.match(/(.{1,11})/g); + + const words = (chunks != null ? chunks : []).map( + (binary) => bip39[binaryToByte(binary)], + ); + + return new Mnemonic_Mnemonic({ words }); + } + + /** + * Construct a mnemonic from a list of words. Handles 12, 22 (legacy), and 24 words. + * + * An exception of BadMnemonicError will be thrown if the mnemonic + * contains unknown words or fails the checksum. An invalid mnemonic + * can still be used to create private keys, the exception will + * contain the failing mnemonic in case you wish to ignore the + * validation error and continue. + * @param {string[]} words + * @throws {BadMnemonicError} + * @returns {Promise} + */ + static fromWords(words) { + return new Mnemonic_Mnemonic({ + words, + })._validate(); + } + + /** + * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead + * Recover a private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @returns {Promise} + */ + toPrivateKey(passphrase = "") { + // eslint-disable-next-line deprecation/deprecation + return this.toEd25519PrivateKey(passphrase); + } + + /** + * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead + * Recover an Ed25519 private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @param {number[]} [path] + * @returns {Promise} + */ + async toEd25519PrivateKey(passphrase = "", path = HEDERA_PATH) { + let { keyData, chainCode } = await this._toKeyData( + passphrase, + ED25519_SEED_TEXT, + ); + + for (const index of path) { + ({ keyData, chainCode } = await slip10_derive( + keyData, + chainCode, + index, + )); + } + + const keyPair = nacl_fast.sign.keyPair.fromSeed(keyData); + + if (Cache.privateKeyConstructor == null) { + throw new Error("PrivateKey not found in cache"); + } + + return Cache.privateKeyConstructor( + new Ed25519PrivateKey(keyPair, chainCode), + ); + } + + /** + * Recover an Ed25519 private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @param {number} [index] + * @returns {Promise} + */ + async toStandardEd25519PrivateKey(passphrase = "", index) { + const seed = await Mnemonic_Mnemonic.toSeed(this.words, passphrase); + let derivedKey = await PrivateKey_PrivateKey.fromSeedED25519(seed); + index = index == null ? 0 : index; + + for (const currentIndex of [44, 3030, 0, 0, index]) { + derivedKey = await derivedKey.derive(currentIndex); + } + + return derivedKey; + } + + /** + * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead + * Recover an ECDSA private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @param {number[]} [path] + * @returns {Promise} + */ + async toEcdsaPrivateKey(passphrase = "", path = HEDERA_PATH) { + let { keyData, chainCode } = await this._toKeyData( + passphrase, + ECDSA_SEED_TEXT, + ); + + for (const index of path) { + ({ keyData, chainCode } = await derive( + keyData, + chainCode, + index, + )); + } + + if (Cache.privateKeyConstructor == null) { + throw new Error("PrivateKey not found in cache"); + } + + return Cache.privateKeyConstructor( + new EcdsaPrivateKey(fromBytes(keyData), chainCode), + ); + } + + /** + * Recover an ECDSA private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @param {number} [index] + * @returns {Promise} + */ + async toStandardECDSAsecp256k1PrivateKey(passphrase = "", index) { + const seed = await Mnemonic_Mnemonic.toSeed(this.words, passphrase); + let derivedKey = await PrivateKey_PrivateKey.fromSeedECDSAsecp256k1(seed); + index = index == null ? 0 : index; + + for (const currentIndex of [ + toHardenedIndex(44), + toHardenedIndex(3030), + toHardenedIndex(0), + 0, + index, + ]) { + derivedKey = await derivedKey.derive(currentIndex); + } + + return derivedKey; + } + + /** + * @param {string[]} words + * @param {string} passphrase + * @returns {Promise} + */ + static async toSeed(words, passphrase) { + return await toSeed(words, passphrase); + } + + /** + * @param {string} passphrase + * @param {string} seedText + * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>} seedText + */ + async _toKeyData(passphrase, seedText) { + const seed = await toSeed(this.words, passphrase); + const digest = await hmac_browser_hash( + HashAlgorithm.Sha512, + seedText, + seed, + ); + + return { + keyData: digest.subarray(0, 32), + chainCode: digest.subarray(32), + }; + } + + /** + * Recover a mnemonic phrase from a string, splitting on spaces. Handles 12, 22 (legacy), and 24 words. + * @param {string} mnemonic + * @returns {Promise} + */ + static async fromString(mnemonic) { + return Mnemonic_Mnemonic.fromWords(mnemonic.split(/\s|,/)); + } + + /** + * @returns {Promise} + * @private + */ + async _validate() { + //NOSONAR + // Validate that this is a valid BIP-39 mnemonic + // as generated by BIP-39's rules. + + // Technically, invalid mnemonics can still be used to generate valid private keys, + // but if they became invalid due to user error then it will be difficult for the user + // to tell the difference unless they compare the generated keys. + + // During validation, the following conditions are checked in order + + // 1)) 24 or 12 words + + // 2) All strings in {@link this.words} exist in the BIP-39 + // standard English word list (no normalization is done) + + // 3) The calculated checksum for the mnemonic equals the + // checksum encoded in the mnemonic + + // If words count is 22, it means that this is a legacy private key + if (this.words.length === 22) { + const unknownWordIndices = this.words.reduce( + (/** @type {number[]} */ unknowns, word, index) => + words_legacy.includes(word.toLowerCase()) + ? unknowns + : [...unknowns, index], + [], + ); + + if (unknownWordIndices.length > 0) { + throw new BadMnemonicError( + this, + src_BadMnemonicReason.UnknownWords, + unknownWordIndices, + ); + } + + const [seed, checksum] = legacy1(this.words, words_legacy); + const newChecksum = crc8(seed); + + if (checksum !== newChecksum) { + throw new BadMnemonicError( + this, + src_BadMnemonicReason.ChecksumMismatch, + [], + ); + } + } else { + if (!(this.words.length === 12 || this.words.length === 24)) { + throw new BadMnemonicError( + this, + src_BadMnemonicReason.BadLength, + [], + ); + } + + const unknownWordIndices = this.words.reduce( + (/** @type {number[]} */ unknowns, word, index) => + bip39.includes(word) ? unknowns : [...unknowns, index], + [], + ); + + if (unknownWordIndices.length > 0) { + throw new BadMnemonicError( + this, + src_BadMnemonicReason.UnknownWords, + unknownWordIndices, + ); + } + + // FIXME: calculate checksum and compare + // https://github.com/bitcoinjs/bip39/blob/master/ts_src/index.ts#L112 + + const bits = this.words + .map((word) => { + return bip39.indexOf(word) + .toString(2) + .padStart(11, "0"); + }) + .join(""); + + const dividerIndex = Math.floor(bits.length / 33) * 32; + const entropyBits = bits.slice(0, dividerIndex); + const checksumBits = bits.slice(dividerIndex); + const entropyBitsRegex = entropyBits.match(/(.{1,8})/g); + const entropyBytes = /** @type {RegExpMatchArray} */ ( + entropyBitsRegex + ).map(binaryToByte); + + const newChecksum = await deriveChecksumBits( + Uint8Array.from(entropyBytes), + ); + + if (newChecksum !== checksumBits) { + throw new BadMnemonicError( + this, + src_BadMnemonicReason.ChecksumMismatch, + [], + ); + } + } + + return this; + } + + /** + * @returns {Promise} + */ + async toLegacyPrivateKey() { + let seed; + if (this.words.length === 22) { + [seed] = legacy1(this.words, words_legacy); + } else { + seed = await legacy2(this.words, bip39); + } + + if (Cache.privateKeyFromBytes == null) { + throw new Error("PrivateKey not found in cache"); + } + + return Cache.privateKeyFromBytes(seed); + } + + /** + * @returns {string} + */ + toString() { + return this.words.join(" "); + } +} + +/** + * @param {string} bin + * @returns {number} + */ +function binaryToByte(bin) { + return parseInt(bin, 2); +} + +/** + * @param {number[]} bytes + * @returns {string} + */ +function bytesToBinary(bytes) { + return bytes.map((x) => x.toString(2).padStart(8, "0")).join(""); +} + +/** + * @param {Uint8Array} entropyBuffer + * @returns {Promise} + */ +async function deriveChecksumBits(entropyBuffer) { + const ENT = entropyBuffer.length * 8; + const CS = ENT / 32; + const hash = await digest(entropyBuffer); + + return bytesToBinary(Array.from(hash)).slice(0, CS); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/cryptography/src/index.js + + + + + + + + + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/array.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * A simple efficient function for comparing byte arrays + * + * @param {Uint8Array} array1 + * @param {Uint8Array} array2 + * @returns {boolean} + */ +function src_array_arrayEqual(array1, array2) { + if (array1 === array2) { + return true; + } + + if (array1.byteLength !== array2.byteLength) { + return false; + } + + const view1 = new DataView( + array1.buffer, + array1.byteOffset, + array1.byteLength, + ); + const view2 = new DataView( + array2.buffer, + array2.byteOffset, + array2.byteLength, + ); + + let i = array1.byteLength; + + while (i--) { + if (view1.getUint8(i) !== view2.getUint8(i)) { + return false; + } + } + + return true; +} + +/** + * @param {Uint8Array} array + * @param {Uint8Array} arrayPrefix + * @returns {boolean} + */ +function array_arrayStartsWith(array, arrayPrefix) { + if (array.byteLength < arrayPrefix.byteLength) { + return false; + } + + let i = arrayPrefix.byteLength; + + while (i--) { + if (array[i] !== arrayPrefix[i]) { + return false; + } + } + + return true; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Cache.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @typedef {import("./contract/ContractId.js").default} ContractId + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./KeyList.js").default} KeyList + * @typedef {import("./PublicKey.js").default} PublicKey + * @typedef {import("./PrivateKey.js").default} PrivateKey + * @typedef {import("./Mnemonic.js").default} Mnemonic + * @typedef {import("./EvmAddress.js").default} EvmAddress + * @typedef {import("./EthereumTransactionData.js").default} EthereumTransactionData + * @typedef {import("./transaction/TransactionReceiptQuery.js").default} TransactionReceiptQuery + * @typedef {import("./transaction/TransactionRecordQuery.js").default} TransactionRecordQuery + * @typedef {import("./network/AddressBookQuery.js").default} AddressBookQuery + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + * @typedef {import("@hashgraph/proto").proto.IKeyList} HashgraphProto.proto.IKeyList + * @typedef {import("@hashgraph/proto").proto.IThresholdKey} HashgraphProto.proto.IThresholdKey + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + */ + +/** + * @namespace cryptography + * @typedef {import("@hashgraph/cryptography").PrivateKey} cryptography.PrivateKey + * @typedef {import("@hashgraph/cryptography").Mnemonic} cryptography.Mnemonic + */ + +/** + * @template {object} ProtobufT + * @template {object} SdkT + * @typedef {{ (proto: ProtobufT): SdkT }} FromProtobufKeyFuncT + */ + +/** + * This variable is strictly designed to prevent cyclic dependencies. + */ +class Cache_Cache { + constructor() { + /** @type {number} */ + this._timeDrift = 0; + + /** @type {FromProtobufKeyFuncT | null} */ + this._contractId = null; + + /** @type {FromProtobufKeyFuncT | null} */ + this._keyList = null; + + /** @type {FromProtobufKeyFuncT | null} */ + this._thresholdKey = null; + + /** @type {FromProtobufKeyFuncT | null} */ + this._publicKeyED25519 = null; + + /** @type {FromProtobufKeyFuncT | null} */ + this._publicKeyECDSA = null; + + /** @type {((key: cryptography.PrivateKey) => PrivateKey) | null} */ + this._privateKeyConstructor = null; + + /** @type {((key: cryptography.Mnemonic) => Mnemonic) | null} */ + this._mnemonicFromString = null; + + /** @type {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId) | null} */ + this._accountIdConstructor = null; + + /** @type {FromProtobufKeyFuncT | null} */ + this._delegateContractId = null; + + /** @type {FromProtobufKeyFuncT | null} */ + this._evmAddress = null; + + /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */ + this._ethereumTransactionDataLegacyFromBytes = null; + + /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */ + this._ethereumTransactionDataEip1559FromBytes = null; + + /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */ + this._ethereumTransactionDataEip2930FromBytes = null; + + /** @type {(() => TransactionReceiptQuery) | null} */ + this._transactionReceiptQueryConstructor = null; + + /** @type {(() => TransactionRecordQuery) | null} */ + this._transactionRecordQueryConstructor = null; + } + + /** + * @param {number} timeDrift + */ + setTimeDrift(timeDrift) { + this._timeDrift = timeDrift; + } + + /** + * @returns {number} + */ + get timeDrift() { + if (this._timeDrift == null) { + throw new Error("Cache.timeDrift was used before it was set"); + } + + return this._timeDrift; + } + + /** + * @param {FromProtobufKeyFuncT} contractId + */ + setContractId(contractId) { + this._contractId = contractId; + } + + /** + * @returns {FromProtobufKeyFuncT} + */ + get contractId() { + if (this._contractId == null) { + throw new Error("Cache.contractId was used before it was set"); + } + + return this._contractId; + } + + /** + * @param {FromProtobufKeyFuncT} keyList + */ + setKeyList(keyList) { + this._keyList = keyList; + } + + /** + * @returns {FromProtobufKeyFuncT} + */ + get keyList() { + if (this._keyList == null) { + throw new Error("Cache.keyList was used before it was set"); + } + + return this._keyList; + } + + /** + * @param {FromProtobufKeyFuncT} thresholdKey + */ + setThresholdKey(thresholdKey) { + this._thresholdKey = thresholdKey; + } + + /** + * @returns {FromProtobufKeyFuncT} + */ + get thresholdKey() { + if (this._thresholdKey == null) { + throw new Error("Cache.thresholdKey was used before it was set"); + } + + return this._thresholdKey; + } + + /** + * @param {FromProtobufKeyFuncT} publicKeyED25519 + */ + setPublicKeyED25519(publicKeyED25519) { + this._publicKeyED25519 = publicKeyED25519; + } + + /** + * @returns {FromProtobufKeyFuncT} + */ + get publicKeyED25519() { + if (this._publicKeyED25519 == null) { + throw new Error( + "Cache.publicKeyED25519 was used before it was set", + ); + } + + return this._publicKeyED25519; + } + + /** + * @param {FromProtobufKeyFuncT} publicKeyECDSA + */ + setPublicKeyECDSA(publicKeyECDSA) { + this._publicKeyECDSA = publicKeyECDSA; + } + + /** + * @returns {FromProtobufKeyFuncT} + */ + get publicKeyECDSA() { + if (this._publicKeyECDSA == null) { + throw new Error("Cache.publicKeyECDSA was used before it was set"); + } + + return this._publicKeyECDSA; + } + + /** + * @param {((key: cryptography.PrivateKey) => PrivateKey)} privateKeyConstructor + */ + setPrivateKeyConstructor(privateKeyConstructor) { + this._privateKeyConstructor = privateKeyConstructor; + } + + /** + * @returns {((key: cryptography.PrivateKey) => PrivateKey)} + */ + get privateKeyConstructor() { + if (this._privateKeyConstructor == null) { + throw new Error( + "Cache.privateKeyConstructor was used before it was set", + ); + } + + return this._privateKeyConstructor; + } + + /** + * @param {((key: cryptography.Mnemonic) => Mnemonic)} mnemonicFromString + */ + setMnemonicFromString(mnemonicFromString) { + this._mnemonicFromString = mnemonicFromString; + } + + /** + * @returns {((key: cryptography.PrivateKey) => PrivateKey)} + */ + get mnemonicFromString() { + if (this._mnemonicFromString == null) { + throw new Error( + "Cache.mnemonicFromString was used before it was set", + ); + } + + return this.mnemonicFromString; + } + + /** + * @param {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)} accountIdConstructor + */ + setAccountIdConstructor(accountIdConstructor) { + this._accountIdConstructor = accountIdConstructor; + } + + /** + * @returns {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)} + */ + get accountIdConstructor() { + if (this._accountIdConstructor == null) { + throw new Error( + "Cache.accountIdConstructor was used before it was set", + ); + } + + return this._accountIdConstructor; + } + + /** + * @param {FromProtobufKeyFuncT} delegateContractId + */ + setDelegateContractId(delegateContractId) { + this._delegateContractId = delegateContractId; + } + + /** + * @returns {FromProtobufKeyFuncT} + */ + get delegateContractId() { + if (this._delegateContractId == null) { + throw new Error( + "Cache.delegateContractId was used before it was set", + ); + } + + return this._delegateContractId; + } + + /** + * @param {FromProtobufKeyFuncT} evmAddress + */ + setEvmAddress(evmAddress) { + this._evmAddress = evmAddress; + } + + /** + * @returns {FromProtobufKeyFuncT} + */ + get evmAddress() { + if (this._evmAddress == null) { + throw new Error("Cache.evmAddress was used before it was set"); + } + + return this._evmAddress; + } + + /** + * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataLegacyFromBytes + */ + setEthereumTransactionDataLegacyFromBytes( + ethereumTransactionDataLegacyFromBytes, + ) { + this._ethereumTransactionDataLegacyFromBytes = + ethereumTransactionDataLegacyFromBytes; + } + + /** + * @returns {((bytes: Uint8Array) => EthereumTransactionData)} + */ + get ethereumTransactionDataLegacyFromBytes() { + if (this._ethereumTransactionDataLegacyFromBytes == null) { + throw new Error( + "Cache.ethereumTransactionDataLegacyFromBytes was used before it was set", + ); + } + + return this._ethereumTransactionDataLegacyFromBytes; + } + + /** + * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip1559FromBytes + */ + setEthereumTransactionDataEip1559FromBytes( + ethereumTransactionDataEip1559FromBytes, + ) { + this._ethereumTransactionDataEip1559FromBytes = + ethereumTransactionDataEip1559FromBytes; + } + + /** + * @returns {((bytes: Uint8Array) => EthereumTransactionData)} + */ + get ethereumTransactionDataEip1559FromBytes() { + if (this._ethereumTransactionDataEip1559FromBytes == null) { + throw new Error( + "Cache.ethereumTransactionDataEip1559FromBytes was used before it was set", + ); + } + + return this._ethereumTransactionDataEip1559FromBytes; + } + + /** + * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip2930FromBytes + */ + setEthereumTransactionDataEip2930FromBytes( + ethereumTransactionDataEip2930FromBytes, + ) { + this._ethereumTransactionDataEip2930FromBytes = + ethereumTransactionDataEip2930FromBytes; + } + + /** + * @returns {((bytes: Uint8Array) => EthereumTransactionData)} + */ + get ethereumTransactionDataEip2930FromBytes() { + if (this._ethereumTransactionDataEip2930FromBytes == null) { + throw new Error( + "Cache.ethereumTransactionDataEip2930FromBytes was used before it was set", + ); + } + + return this._ethereumTransactionDataEip2930FromBytes; + } + + /** + * @param {(() => TransactionReceiptQuery)} transactionReceiptQueryConstructor + */ + setTransactionReceiptQueryConstructor(transactionReceiptQueryConstructor) { + this._transactionReceiptQueryConstructor = + transactionReceiptQueryConstructor; + } + + /** + * @returns {(() => TransactionReceiptQuery)} + */ + get transactionReceiptQueryConstructor() { + if (this._transactionReceiptQueryConstructor == null) { + throw new Error( + "Cache.transactionReceiptQueryConstructor was used before it was set", + ); + } + + return this._transactionReceiptQueryConstructor; + } + + /** + * @param {(() => TransactionRecordQuery)} transactionRecordQueryConstructor + */ + setTransactionRecordQueryConstructor(transactionRecordQueryConstructor) { + this._transactionRecordQueryConstructor = + transactionRecordQueryConstructor; + } + + /** + * @returns {(() => TransactionRecordQuery)} + */ + get transactionRecordQueryConstructor() { + if (this._transactionRecordQueryConstructor == null) { + throw new Error( + "Cache.transactionRecordQueryConstructor was used before it was set", + ); + } + + return this._transactionRecordQueryConstructor; + } + + /** + * @param {() => AddressBookQuery} addressBookQueryConstructor + */ + setAddressBookQueryConstructor(addressBookQueryConstructor) { + this._addressBookQueryConstructor = addressBookQueryConstructor; + } + + /** + * @returns {() => AddressBookQuery} + */ + get addressBookQueryConstructor() { + if (this._addressBookQueryConstructor == null) { + throw new Error( + "Cache.addressBookQueryConstructor was used before it was set", + ); + } + + return this._addressBookQueryConstructor; + } +} + +const Cache_CACHE = new Cache_Cache(); + +/* harmony default export */ var src_Cache = (Cache_CACHE); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Key.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + */ + +class src_Key_Key { + /** + * @internal + * @abstract + * @returns {HashgraphProto.proto.IKey} + */ + // eslint-disable-next-line jsdoc/require-returns-check + _toProtobufKey() { + throw new Error("not implemented"); + } + + /** + * @internal + * @param {HashgraphProto.proto.IKey} key + * @returns {Key} + */ + static _fromProtobufKey(key) { + if (key.contractID != null) { + return src_Cache.contractId(key.contractID); + } + + if (key.delegatableContractId != null) { + return src_Cache.delegateContractId(key.delegatableContractId); + } + + if (key.ed25519 != null && key.ed25519.byteLength > 0) { + return src_Cache.publicKeyED25519(key.ed25519); + } + + if (key.ECDSASecp256k1 != null && key.ECDSASecp256k1.byteLength > 0) { + return src_Cache.publicKeyECDSA(key.ECDSASecp256k1); + } + + if (key.thresholdKey != null && key.thresholdKey.threshold != null) { + return src_Cache.thresholdKey(key.thresholdKey); + } + + if (key.keyList != null) { + return src_Cache.keyList(key.keyList); + } + + // @ts-ignore + return null; + + /* throw new Error( + `(BUG) keyFromProtobuf: not implemented key case: ${JSON.stringify( + key + )}` + ); */ + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/PublicKey.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @typedef {import("./transaction/Transaction.js").default} Transaction + * @typedef {import("./account/AccountId.js").default} AccountId + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignaturePair} HashgraphProto.proto.ISignaturePair + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + */ + +class src_PublicKey_PublicKey extends src_Key_Key { + /** + * @internal + * @hideconstructor + * @param {cryptography.PublicKey} key + */ + constructor(key) { + super(); + + this._key = key; + } + + /** + * @param {Uint8Array} data + * @returns {PublicKey} + */ + static fromBytes(data) { + return new src_PublicKey_PublicKey(PublicKey_PublicKey.fromBytes(data)); + } + + /** + * @param {Uint8Array} data + * @returns {PublicKey} + */ + static fromBytesED25519(data) { + return new src_PublicKey_PublicKey(PublicKey_PublicKey.fromBytesED25519(data)); + } + + /** + * @param {Uint8Array} data + * @returns {PublicKey} + */ + static fromBytesECDSA(data) { + return new src_PublicKey_PublicKey(PublicKey_PublicKey.fromBytesECDSA(data)); + } + + /** + * Parse a public key from a string of hexadecimal digits. + * + * The public key may optionally be prefixed with + * the DER header. + * + * @param {string} text + * @returns {PublicKey} + */ + static fromString(text) { + return new src_PublicKey_PublicKey(PublicKey_PublicKey.fromString(text)); + } + + /** + * Parse an ECDSA public key from a string of hexadecimal digits. + * + * @param {string} text + * @returns {PublicKey} + */ + static fromStringECDSA(text) { + return new src_PublicKey_PublicKey(PublicKey_PublicKey.fromStringECDSA(text)); + } + + /** + * Parse an ED25519 public key from a string of hexadecimal digits. + * + * @param {string} text + * @returns {PublicKey} + */ + static fromStringED25519(text) { + return new src_PublicKey_PublicKey(PublicKey_PublicKey.fromStringED25519(text)); + } + + /** + * Verify a signature on a message with this public key. + * + * @param {Uint8Array} message + * @param {Uint8Array} signature + * @returns {boolean} + */ + verify(message, signature) { + return this._key.verify(message, signature); + } + + /** + * @param {Transaction} transaction + * @returns {boolean} + */ + verifyTransaction(transaction) { + transaction._requireFrozen(); + + if (!transaction.isFrozen()) { + transaction.freeze(); + } + + for (const signedTransaction of transaction._signedTransactions.list) { + if ( + signedTransaction.sigMap != null && + signedTransaction.sigMap.sigPair != null + ) { + let found = false; + for (const sigPair of signedTransaction.sigMap.sigPair) { + const pubKeyPrefix = /** @type {Uint8Array} */ ( + sigPair.pubKeyPrefix + ); + if (src_array_arrayEqual(pubKeyPrefix, this.toBytesRaw())) { + found = true; + + const bodyBytes = /** @type {Uint8Array} */ ( + signedTransaction.bodyBytes + ); + + let signature = null; + if (sigPair.ed25519 != null) { + signature = sigPair.ed25519; + } else if (sigPair.ECDSASecp256k1 != null) { + signature = sigPair.ECDSASecp256k1; + } + + if (signature == null) { + continue; + } + + if (!this.verify(bodyBytes, signature)) { + return false; + } + } + } + + if (!found) { + return false; + } + } + } + + return true; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return this._key.toBytes(); + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + return this._key.toBytesDer(); + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + return this._key.toBytesRaw(); + } + + /** + * @deprecated Use `toEvmAddress()` instead. + * @returns {string} + */ + toEthereumAddress() { + return this._key.toEthereumAddress(); + } + + /** + * @returns {string} + */ + toEvmAddress() { + return this._key.toEthereumAddress(); + } + + /** + * @returns {string} + */ + toString() { + return this._key.toString(); + } + + /** + * @returns {string} + */ + toStringDer() { + return this._key.toStringDer(); + } + + /** + * @returns {string} + */ + toStringRaw() { + return this._key.toStringRaw(); + } + + /** + * @param {PublicKey} other + * @returns {boolean} + */ + equals(other) { + return this._key.equals(other._key); + } + + /** + * @returns {HashgraphProto.proto.IKey} + */ + _toProtobufKey() { + switch (this._key._type) { + case "ED25519": + return { + ed25519: this._key.toBytesRaw(), + }; + case "secp256k1": + return { + ECDSASecp256k1: this._key.toBytesRaw(), + }; + default: + throw new Error(`unrecognized key type ${this._key._type}`); + } + } + + /** + * @param {Uint8Array} signature + * @returns {HashgraphProto.proto.ISignaturePair} + */ + _toProtobufSignature(signature) { + switch (this._key._type) { + case "ED25519": + return { + pubKeyPrefix: this._key.toBytesRaw(), + ed25519: signature, + }; + case "secp256k1": + return { + pubKeyPrefix: this._key.toBytesRaw(), + ECDSASecp256k1: signature, + }; + default: + throw new Error(`unrecognized key type ${this._key._type}`); + } + } + + /** + * @param {Long | number} shard + * @param {Long | number} realm + * @returns {AccountId} + */ + toAccountId(shard, realm) { + return src_Cache.accountIdConstructor(shard, realm, this); + } + + /** + * Returns an "unusable" public key. + * “Unusable” refers to a key such as an Ed25519 0x00000... public key, + * since it is (presumably) impossible to find the 32-byte string whose SHA-512 hash begins with 32 bytes of zeros. + * + * @returns {PublicKey} + */ + static unusableKey() { + return src_PublicKey_PublicKey.fromStringED25519( + "0000000000000000000000000000000000000000000000000000000000000000", + ); + } +} + +src_Cache.setPublicKeyED25519((key) => src_PublicKey_PublicKey.fromBytesED25519(key)); +src_Cache.setPublicKeyECDSA((key) => src_PublicKey_PublicKey.fromBytesECDSA(key)); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EntityIdHelper.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + +/** + * @typedef {import("./client/Client.js").default<*, *>} Client + */ + +/** + * @typedef {object} IEntityId + * @property {number | Long} num + * @property {(number | Long)=} shard + * @property {(number | Long)=} realm + */ + +/** + * @typedef {object} IEntityIdResult + * @property {Long} shard + * @property {Long} realm + * @property {Long} num + */ + +/** + * @typedef {object} IEntityIdParts + * @property {string?} shard + * @property {string?} realm + * @property {string} numOrHex + * @property {string?} checksum + */ + +/** + * @typedef {object} IEntityIdResultWithChecksum + * @property {Long} shard + * @property {Long} realm + * @property {Long} num + * @property {string | null} checksum + */ + +const regex = + /"^(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))(?:-([a-z]{5}))?$/; + +/** + * This regex supports entity IDs + * - as stand alone nubmers + * - as shard.realm.num + * - as shard.realm.hex + * - can optionally provide checksum for any of the above + */ +const ENTITY_ID_REGEX = /^(\d+)(?:\.(\d+)\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/; + +/** + * This method is called by most entity ID constructors. It's purpose is to + * deduplicate the constuctors. + * + * @param {number | Long | IEntityId} props + * @param {(number | null | Long)=} realmOrNull + * @param {(number | null | Long)=} numOrNull + * @returns {IEntityIdResult} + */ +function EntityIdHelper_constructor(props, realmOrNull, numOrNull) { + // Make sure either both the second and third parameter are + // set or not set; we shouldn't have one set, but the other not set. + // + //NOSONAR + if ( + (realmOrNull == null && numOrNull != null) || + (realmOrNull != null && numOrNull == null) + ) { + throw new Error("invalid entity ID"); + } + + // If the first parameter is a number then we need to convert the + // first, second, and third parameters into numbers. Otherwise, + // we should look at the fields `shard`, `realm`, and `num` on + // `props` + const [shard, realm, num] = + typeof props === "number" || src_long.isLong(props) + ? [ + numOrNull != null + ? src_long.fromValue(/** @type {Long | number} */ (props)) + : src_long.ZERO, + realmOrNull != null ? src_long.fromValue(realmOrNull) : src_long.ZERO, + numOrNull != null + ? src_long.fromValue(numOrNull) + : src_long.fromValue(/** @type {Long | number} */ (props)), + ] + : [ + props.shard != null ? src_long.fromValue(props.shard) : src_long.ZERO, + props.realm != null ? src_long.fromValue(props.realm) : src_long.ZERO, + src_long.fromValue(props.num), + ]; + + // Make sure none of the numbers are negative + if (shard.isNegative() || realm.isNegative() || num.isNegative()) { + throw new Error("negative numbers are not allowed in IDs"); + } + + return { + shard, + realm, + num, + }; +} + +/** + * A simple comparison function for comparing entity IDs + * + * @param {[Long, Long, Long]} a + * @param {[Long, Long, Long]} b + * @returns {number} + */ +function EntityIdHelper_compare(a, b) { + let comparison = a[0].compare(b[0]); + if (comparison != 0) { + return comparison; + } + + comparison = a[1].compare(b[1]); + if (comparison != 0) { + return comparison; + } + + return a[2].compare(b[2]); +} + +/** + * This type is part of the entity ID checksums feature which + * is responsible for checking if an entity ID was created on + * the same ledger ID as the client is currently using. + * + * @typedef {object} ParseAddressResult + * @property {number} status + * @property {Long} [num1] + * @property {Long} [num2] + * @property {Long} [num3] + * @property {string} [correctChecksum] + * @property {string} [givenChecksum] + * @property {string} [noChecksumFormat] + * @property {string} [withChecksumFormat] + */ + +/** + * @param {string} text + * @returns {IEntityIdParts} + */ +function fromStringSplitter(text) { + const match = ENTITY_ID_REGEX.exec(text); + + if (match == null) { + throw new Error(`failed to parse entity id: ${text}`); + } + + if (match[2] == null && match[3] == null) { + return { + shard: "0", + realm: "0", + numOrHex: match[1], + checksum: match[4], + }; + } else { + return { + shard: match[1], + realm: match[2], + numOrHex: match[3], + checksum: match[4], + }; + } +} + +/** + * @param {string} text + * @returns {IEntityIdResultWithChecksum} + */ +function fromString(text) { + const result = fromStringSplitter(text); + + if ( + Number.isNaN(result.shard) || + Number.isNaN(result.realm) || + Number.isNaN(result.numOrHex) + ) { + throw new Error("invalid format for entity ID"); + } + + return { + shard: result.shard != null ? src_long.fromString(result.shard) : src_long.ZERO, + realm: result.realm != null ? src_long.fromString(result.realm) : src_long.ZERO, + num: src_long.fromString(result.numOrHex), + checksum: result.checksum, + }; +} + +/** + * Return the shard, realm, and num from a solidity address. + * + * Solidity addresses are 20 bytes long and hex encoded, where the first 4 + * bytes represent the shard, the next 8 bytes represent the realm, and + * the last 8 bytes represent the num. All in Big Endian format + * + * @param {string} address + * @returns {[Long, Long, Long]} + */ +function fromSolidityAddress(address) { + const addr = address.startsWith("0x") + ? decode(address.slice(2)) + : decode(address); + + if (addr.length !== 20) { + throw new Error(`Invalid hex encoded solidity address length: + expected length 40, got length ${address.length}`); + } + + const shard = src_long.fromBytesBE([0, 0, 0, 0, ...addr.slice(0, 4)]); + const realm = src_long.fromBytesBE(Array.from(addr.slice(4, 12))); + const num = src_long.fromBytesBE(Array.from(addr.slice(12, 20))); + + return [shard, realm, num]; +} + +/** + * Convert shard, realm, and num into a solidity address. + * + * See `fromSolidityAddress()` for more documentation. + * + * @param {[Long,Long,Long] | [number,number,number]} address + * @returns {string} + */ +function toSolidityAddress(address) { + const buffer = new Uint8Array(20); + const view = safeView(buffer); + const [shard, realm, num] = address; + + view.setUint32(0, convertToNumber(shard)); + view.setUint32(8, convertToNumber(realm)); + view.setUint32(16, convertToNumber(num)); + + return hex_browser_encode(buffer); +} + +/** + * Parse the address string addr and return an object with the results (8 fields). + * The first four fields are numbers, which could be implemented as signed 32 bit + * integers, and the last four are strings. + * + * status; //the status of the parsed address + * // 0 = syntax error + * // 1 = an invalid with-checksum address (bad checksum) + * // 2 = a valid no-checksum address + * // 3 = a valid with-checksum address + * num1; //the 3 numbers in the address, such as 1.2.3, with leading zeros removed + * num2; + * num3; + * correctchecksum; //the correct checksum + * givenChecksum; //the checksum in the address that was parsed + * noChecksumFormat; //the address in no-checksum format + * withChecksumFormat; //the address in with-checksum format + * + * @param {Uint8Array} ledgerId + * @param {string} addr + * @returns {ParseAddressResult} + */ +function _parseAddress(ledgerId, addr) { + let match = regex.exec(addr); + if (match === null) { + let result = { status: 0 }; // When status == 0, the rest of the fields should be ignored + return result; + } + let a = [ + Long.fromString(match[1]), + Long.fromString(match[2]), + Long.fromString(match[3]), + ]; + let ad = `${a[0].toString()}.${a[1].toString()}.${a[2].toString()}`; + let c = _checksum(ledgerId, ad); + let s = match[4] === undefined ? 2 : c == match[4] ? 3 : 1; //NOSONAR + return { + status: s, + num1: a[0], + num2: a[1], + num3: a[2], + givenChecksum: match[4], + correctChecksum: c, + noChecksumFormat: ad, + withChecksumFormat: `${ad}-${c}`, + }; +} + +/** + * Given an address like "0.0.123", return a checksum like "laujm" + * + * @param {Uint8Array} ledgerId + * @param {string} addr + * @returns {string} + */ +function _checksum(ledgerId, addr) { + let answer = ""; + let d = []; // Digits with 10 for ".", so if addr == "0.0.123" then d == [0, 10, 0, 10, 1, 2, 3] + let s0 = 0; // Sum of even positions (mod 11) + let s1 = 0; // Sum of odd positions (mod 11) + let s = 0; // Weighted sum of all positions (mod p3) + let sh = 0; // Hash of the ledger ID + let c = 0; // The checksum, as a single number + const p3 = 26 * 26 * 26; // 3 digits in base 26 + const p5 = 26 * 26 * 26 * 26 * 26; // 5 digits in base 26 + const ascii_a = "a".charCodeAt(0); // 97 + const m = 1000003; // Min prime greater than a million. Used for the final permutation. + const w = 31; // Sum s of digit values weights them by powers of w. Should be coprime to p5. + + let h = new Uint8Array(ledgerId.length + 6); + h.set(ledgerId, 0); + h.set([0, 0, 0, 0, 0, 0], ledgerId.length); + for (let i = 0; i < addr.length; i++) { + //NOSONAR + d.push(addr[i] === "." ? 10 : parseInt(addr[i], 10)); + } + for (let i = 0; i < d.length; i++) { + s = (w * s + d[i]) % p3; + if (i % 2 === 0) { + s0 = (s0 + d[i]) % 11; + } else { + s1 = (s1 + d[i]) % 11; + } + } + for (let i = 0; i < h.length; i++) { + sh = (w * sh + h[i]) % p5; + } + c = ((((addr.length % 5) * 11 + s0) * 11 + s1) * p3 + s + sh) % p5; + c = (c * m) % p5; + + for (let i = 0; i < 5; i++) { + answer = String.fromCharCode(ascii_a + (c % 26)) + answer; + c /= 26; + } + + return answer; +} + +/** + * Validate an entity ID checksum against a client + * + * @param {Long} shard + * @param {Long} realm + * @param {Long} num + * @param {string | null} checksum + * @param {Client} client + */ +function validateChecksum(shard, realm, num, checksum, client) { + if (client._network._ledgerId == null || checksum == null) { + return; + } + + const expectedChecksum = _checksum( + client._network._ledgerId._ledgerId, + `${shard.toString()}.${realm.toString()}.${num.toString()}`, + ); + + if (checksum != expectedChecksum) { + throw new BadEntityIdError( + shard, + realm, + num, + checksum, + expectedChecksum, + ); + } +} + +/** + * Stringify the entity ID with a checksum. + * + * @param {string} string + * @param {Client} client + * @returns {string} + */ +function toStringWithChecksum(string, client) { + if (client == null) { + throw new Error("client cannot be null"); + } + + if (client._network._ledgerId == null) { + throw new Error( + "cannot calculate checksum with a client that does not contain a recognzied ledger ID", + ); + } + + const checksum = _checksum(client._network._ledgerId._ledgerId, string); + + return `${string}-${checksum}`; +} + +/** + * Append Buffers. + * @param {Uint8Array} buffer1 + * @param {Uint8Array} buffer2 + * @returns {Uint8Array} + */ +function appendBuffer(buffer1, buffer2) { + var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength); + tmp.set(new Uint8Array(buffer1), 0); + tmp.set(new Uint8Array(buffer2), buffer1.byteLength); + return tmp; +} + +/** + * Convert bytes to hex string. + * @param {Uint8Array} bytes + * @returns {string} + */ +function toHexString(bytes) { + var s = "0x"; + bytes.forEach(function (byte) { + s += ("0" + (byte & 0xff).toString(16)).slice(-2); + }); + return s; +} + +/** + * Deserialize the alias to public key. + * Alias is created from ed25519 or ECDSASecp256k1 types of accounts. If hollow account is used, the alias is created from evm address. + * For hollow accounts, please use aliasToEvmAddress. + * + * @param {string} alias + * @returns {PublicKey | null} + */ +function aliasToPublicKey(alias) { + const bytes = base32.decode(alias); + if (!bytes) { + return null; + } + let key; + try { + key = HashgraphProto.proto.Key.decode(bytes); + } catch (e) { + throw new Error( + "The alias is created with hollow account. Please use aliasToEvmAddress!", + ); + } + + if (key.ed25519 != null && key.ed25519.byteLength > 0) { + return PublicKey.fromBytes(key.ed25519); + } + + if (key.ECDSASecp256k1 != null && key.ECDSASecp256k1.byteLength > 0) { + return PublicKey.fromBytes(key.ECDSASecp256k1); + } + + return null; +} + +/** + * Deserialize the alias to evm address. + * Alias is created from hollow account. + * For ed25519 or ECDSASecp256k1 accounts, please use aliasToPublicKey. + * + * @param {string} alias + * @returns {string | null} + */ +function aliasToEvmAddress(alias) { + const bytes = base32.decode(alias); + if (!bytes) { + return null; + } + try { + HashgraphProto.proto.Key.decode(bytes); + throw new Error( + "The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!", + ); + } catch (e) { + return toHexString(bytes); + } +} + +/** + * Serialize the public key to alias. + * Alias is created from ed25519 or ECDSASecp256k1 types of accounts. If hollow account is used, the alias is created from evm address. + * + * @param {string | PublicKey} publicKey + * @returns {string | null} + */ +function publicKeyToAlias(publicKey) { + if ( + typeof publicKey === "string" && + ((publicKey.startsWith("0x") && publicKey.length == 42) || + publicKey.length == 40) + ) { + if (!publicKey.startsWith("0x")) { + publicKey = `0x${publicKey}`; + } + + const bytes = arrayify(publicKey); + if (!bytes) { + return null; + } + return base32.encode(bytes); + } + + const publicKeyRaw = + typeof publicKey === "string" + ? PublicKey.fromString(publicKey) + : publicKey; + let publicKeyHex = publicKeyRaw.toStringRaw(); + let leadingHex = ""; + + if (publicKeyRaw._key._type === "secp256k1") { + leadingHex = "0x3A21"; // LEADING BYTES FROM PROTOBUFS + } + + if (publicKeyRaw._key._type === "ED25519") { + leadingHex = "0x1220"; // LEADING BYTES FROM PROTOBUFS + } + + if (!publicKeyHex.startsWith("0x")) { + publicKeyHex = `0x${publicKeyHex}`; + } + + const leadingBytes = arrayify(leadingHex); + const publicKeyBytes = arrayify(publicKeyHex); + const publicKeyInBytes = appendBuffer(leadingBytes, publicKeyBytes); + const alias = base32.encode(publicKeyInBytes); + return alias; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Mnemonic.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {import("./PrivateKey.js").default} PrivateKey + */ + +const Mnemonic_HARDENED_BIT = 0x80000000; + +/** + * Multi-word mnemonic phrase (BIP-39). + * + * Compatible with the official Hedera mobile + * wallets (24-words or 22-words) and BRD (12-words). + */ +class Mnemonic { + /** + * @param {cryptography.Mnemonic} mnemonic + * @hideconstructor + * @private + */ + constructor(mnemonic) { + this._mnemonic = mnemonic; + } + + /** + * Returns a new random 24-word mnemonic from the BIP-39 + * standard English word list. + * + * @returns {Promise} + */ + static async generate() { + return new Mnemonic(await Mnemonic_Mnemonic._generate(24)); + } + + /** + * Returns a new random 12-word mnemonic from the BIP-39 + * standard English word list. + * + * @returns {Promise} + */ + static async generate12() { + return new Mnemonic(await Mnemonic_Mnemonic._generate(12)); + } + + /** + * Construct a mnemonic from a list of words. Handles 12, 22 (legacy), and 24 words. + * + * An exception of BadMnemonicError will be thrown if the mnemonic + * contains unknown words or fails the checksum. An invalid mnemonic + * can still be used to create private keys, the exception will + * contain the failing mnemonic in case you wish to ignore the + * validation error and continue. + * + * @param {string[]} words + * @throws {cryptography.BadMnemonicError} + * @returns {Promise} + */ + static async fromWords(words) { + return new Mnemonic(await Mnemonic_Mnemonic.fromWords(words)); + } + + /** + * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead + * Recover a private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @returns {Promise} + */ + async toPrivateKey(passphrase = "") { + return src_Cache.privateKeyConstructor( + // eslint-disable-next-line deprecation/deprecation + await this._mnemonic.toPrivateKey(passphrase), + ); + } + + /** + * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead + * Recover an Ed25519 private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @param {number[]} [path] + * @returns {Promise} + */ + async toEd25519PrivateKey(passphrase = "", path) { + return src_Cache.privateKeyConstructor( + // eslint-disable-next-line deprecation/deprecation + await this._mnemonic.toEd25519PrivateKey(passphrase, path), + ); + } + + /** + * Recover an Ed25519 private key from this mnemonic phrase, with an + * optional passphrase. + * + * @param {string} [passphrase] + * @param {number} [index] + * @returns {Promise} + */ + async toStandardEd25519PrivateKey(passphrase = "", index) { + return src_Cache.privateKeyConstructor( + await this._mnemonic.toStandardEd25519PrivateKey(passphrase, index), + ); + } + + /** + * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead + * Recover an ECDSA private key from this mnemonic phrase, with an + * optional passphrase. + * @param {string} [passphrase] + * @param {number[]} [path] + * @returns {Promise} + */ + async toEcdsaPrivateKey(passphrase = "", path) { + return src_Cache.privateKeyConstructor( + // eslint-disable-next-line deprecation/deprecation + await this._mnemonic.toEcdsaPrivateKey(passphrase, path), + ); + } + + /** + * Converts a derivation path from string to an array of integers. + * Note that this expects precisely 5 components in the derivation path, + * as per BIP-44: + * `m / purpose' / coin_type' / account' / change / address_index` + * Takes into account `'` for hardening as per BIP-32, + * and does not prescribe which components should be hardened. + * + * @param {string} derivationPath the derivation path in BIP-44 format, + * e.g. "m/44'/60'/0'/0/0" + * @returns {Array} to be used with PrivateKey#derive + */ + calculateDerivationPathValues(derivationPath) { + // Parse the derivation path from string into values + const pattern = /m\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)/; + const matches = pattern.exec(derivationPath); + const values = new Array(5); // as Array; + if (matches) { + // Extract numbers and use apostrophe to select if is hardened + for (let i = 1; i <= 5; i++) { + let value = matches[i]; + if (value.endsWith("'")) { + value = value.substring(0, value.length - 1); + values[i - 1] = parseInt(value, 10) | Mnemonic_HARDENED_BIT; + } else { + values[i - 1] = parseInt(value, 10); + } + } + } + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return values; + } + + /** + * Common implementation for both `toStandardECDSAsecp256k1PrivateKey` + * functions. + * + * @param {string} passphrase the passphrase used to protect the + * mnemonic, use "" for none + * @param {Array} derivationPathValues derivation path as an + * integer array, + * see: `calculateDerivationPathValues` + * @returns {Promise} a private key + */ + async toStandardECDSAsecp256k1PrivateKeyImpl( + passphrase, + derivationPathValues, + ) { + // eslint-disable-next-line deprecation/deprecation + return await this.toEcdsaPrivateKey(passphrase, derivationPathValues); + } + + /** + * Recover an ECDSA private key from this mnemonic phrase, with an + * optional passphrase. + * + * @param {string} [passphrase] + * @param {number} [index] + * @returns {Promise} + */ + async toStandardECDSAsecp256k1PrivateKey(passphrase = "", index) { + return src_Cache.privateKeyConstructor( + await this._mnemonic.toStandardECDSAsecp256k1PrivateKey( + passphrase, + index, + ), + ); + } + + /** + * Recover an ECDSAsecp256k1 private key from this mnemonic phrase and + * derivation path, with an optional passphrase + * + * @param {string} passphrase the passphrase used to protect the mnemonic, + * use "" for none + * @param {string} derivationPath the derivation path in BIP-44 format, + * e.g. "m/44'/60'/0'/0/0" + * @returns {Promise} the private key + */ + async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath( + passphrase = "", + derivationPath, + ) { + const derivationPathValues = + this.calculateDerivationPathValues(derivationPath); + return await this.toStandardECDSAsecp256k1PrivateKeyImpl( + passphrase, + derivationPathValues, + ); + } + + /** + * Recover a mnemonic phrase from a string, splitting on spaces. Handles 12, 22 (legacy), and 24 words. + * + * @param {string} mnemonic + * @returns {Promise} + */ + static async fromString(mnemonic) { + return new Mnemonic(await Mnemonic_Mnemonic.fromString(mnemonic)); + } + + /** + * @returns {Promise} + */ + async toLegacyPrivateKey() { + return src_Cache.privateKeyConstructor( + await this._mnemonic.toLegacyPrivateKey(), + ); + } + + /** + * @param {string} passphrase + * @returns {Promise} + */ + async toSeed(passphrase) { + return await Mnemonic_Mnemonic.toSeed( + this._mnemonic.words, + passphrase, + ); + } + + /** + * @returns {string} + */ + toString() { + return this._mnemonic.toString(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/PrivateKey.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + +/** + * @typedef {import("./transaction/Transaction.js").default} Transaction + * @typedef {import("./account/AccountId.js").default} AccountId + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignaturePair} HashgraphProto.proto.ISignaturePair + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + */ + +class src_PrivateKey_PrivateKey extends src_Key_Key { + /** + * @internal + * @hideconstructor + * @param {cryptography.PrivateKey} key + */ + constructor(key) { + super(); + + this._key = key; + } + + /** + * Generate a random Ed25519 private key. + * + * @returns {PrivateKey} + */ + static generateED25519() { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.generateED25519()); + } + + /** + * Generate a random EDSA private key. + * + * @returns {PrivateKey} + */ + static generateECDSA() { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.generateECDSA()); + } + + /** + * Depredated - Use `generateED25519()` instead + * Generate a random Ed25519 private key. + * + * @returns {PrivateKey} + */ + static generate() { + return src_PrivateKey_PrivateKey.generateED25519(); + } + + /** + * Depredated - Use `generateED25519Async()` instead + * Generate a random Ed25519 private key. + * + * @returns {Promise} + */ + static async generateAsync() { + return new src_PrivateKey_PrivateKey(await PrivateKey_PrivateKey.generateAsync()); + } + + /** + * Generate a random Ed25519 private key. + * + * @returns {Promise} + */ + static async generateED25519Async() { + return new src_PrivateKey_PrivateKey( + await PrivateKey_PrivateKey.generateED25519Async(), + ); + } + + /** + * Generate a random ECDSA private key. + * + * @returns {Promise} + */ + static async generateECDSAAsync() { + return new src_PrivateKey_PrivateKey( + await PrivateKey_PrivateKey.generateECDSAAsync(), + ); + } + + /** + * Construct a private key from bytes. Requires DER header. + * + * @param {Uint8Array} data + * @returns {PrivateKey} + */ + static fromBytes(data) { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.fromBytes(data)); + } + + /** + * Construct a ECDSA private key from bytes. + * + * @param {Uint8Array} data + * @returns {PrivateKey} + */ + static fromBytesECDSA(data) { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.fromBytesECDSA(data)); + } + + /** + * Construct a ED25519 private key from bytes. + * + * @param {Uint8Array} data + * @returns {PrivateKey} + */ + static fromBytesED25519(data) { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.fromBytesED25519(data)); + } + + /** + * @deprecated - Use fromStringECDSA() or fromStringED2551() on a HEX-encoded string + * and fromStringDer() on a HEX-encoded string with DER prefix instead. + * Construct a private key from a hex-encoded string. Requires DER header. + * @param {string} text + * @returns {PrivateKey} + */ + static fromString(text) { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.fromString(text)); + } + + /** + * Construct a private key from a HEX-encoded string with a der prefix + * + * @param {string} text + * @returns {PrivateKey} + */ + static fromStringDer(text) { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.fromString(text)); + } + + /** + * Construct a ECDSA private key from a hex-encoded string. + * + * @param {string} text + * @returns {PrivateKey} + */ + static fromStringECDSA(text) { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.fromStringECDSA(text)); + } + + /** + * Construct a Ed25519 private key from a hex-encoded string. + * + * @param {string} text + * @returns {PrivateKey} + */ + static fromStringED25519(text) { + return new src_PrivateKey_PrivateKey(PrivateKey_PrivateKey.fromStringED25519(text)); + } + + /** + * Construct a Ed25519 private key from a Uint8Array seed. + * + * @param {Uint8Array} seed + * @returns {Promise} + */ + static async fromSeedED25519(seed) { + return new src_PrivateKey_PrivateKey( + await PrivateKey_PrivateKey.fromSeedED25519(seed), + ); + } + + /** + * Construct a Ed25519 private key from a Uint8Array seed. + * + * @param {Uint8Array} seed + * @returns {Promise} + */ + static async fromSeedECDSAsecp256k1(seed) { + return new src_PrivateKey_PrivateKey( + await PrivateKey_PrivateKey.fromSeedECDSAsecp256k1(seed), + ); + } + + /** + * @deprecated - Use `Mnemonic.from[Words|String]().to[Ed25519|Ecdsa]PrivateKey()` instead + * + * Recover a private key from a mnemonic phrase (and optionally a password). + * @param {Mnemonic | cryptography.Mnemonic | string} mnemonic + * @param {string} [passphrase] + * @returns {Promise} + */ + static async fromMnemonic(mnemonic, passphrase = "") { + if (mnemonic instanceof Mnemonic) { + return new src_PrivateKey_PrivateKey( + // eslint-disable-next-line deprecation/deprecation + await PrivateKey_PrivateKey.fromMnemonic( + mnemonic._mnemonic, + passphrase, + ), + ); + } + + return new src_PrivateKey_PrivateKey( + // eslint-disable-next-line deprecation/deprecation + await PrivateKey_PrivateKey.fromMnemonic(mnemonic, passphrase), + ); + } + + /** + * Recover a private key from a keystore, previously created by `.toKeystore()`. + * + * This key will _not_ support child key derivation. + * + * @param {Uint8Array} data + * @param {string} [passphrase] + * @returns {Promise} + * @throws {cryptography.BadKeyError} If the passphrase is incorrect or the hash fails to validate. + */ + static async fromKeystore(data, passphrase = "") { + return new src_PrivateKey_PrivateKey( + await PrivateKey_PrivateKey.fromKeystore(data, passphrase), + ); + } + + /** + * Recover a private key from a pem string; the private key may be encrypted. + * + * This method assumes the .pem file has been converted to a string already. + * + * If `passphrase` is not null or empty, this looks for the first `ENCRYPTED PRIVATE KEY` + * section and uses `passphrase` to decrypt it; otherwise, it looks for the first `PRIVATE KEY` + * section and decodes that as a DER-encoded private key. + * + * @param {string} data + * @param {string} [passphrase] + * @returns {Promise} + */ + static async fromPem(data, passphrase = "") { + return new src_PrivateKey_PrivateKey( + await PrivateKey_PrivateKey.fromPem(data, passphrase), + ); + } + + /** + * Derive a new private key at the given wallet index. + * + * Only currently supported for keys created with `fromMnemonic()`; other keys will throw + * an error. + * + * You can check if a key supports derivation with `.supportsDerivation()` + * + * @param {number} index + * @returns {Promise} + * @throws If this key does not support derivation. + */ + async derive(index) { + return new src_PrivateKey_PrivateKey(await this._key.derive(index)); + } + + /** + * @param {number} index + * @returns {Promise} + * @throws If this key does not support derivation. + */ + async legacyDerive(index) { + return new src_PrivateKey_PrivateKey(await this._key.legacyDerive(index)); + } + + /** + * Get the public key associated with this private key. + * + * The public key can be freely given and used by other parties to verify + * the signatures generated by this private key. + * + * @returns {PublicKey} + */ + get publicKey() { + return new src_PublicKey_PublicKey(this._key.publicKey); + } + + /** + * Get the public key associated with this private key. + * + * The public key can be freely given and used by other parties to verify + * the signatures generated by this private key. + * + * @returns {?Uint8Array} + */ + get chainCode() { + return this._key._chainCode; + } + + /** + * Sign a message with this private key. + * + * @param {Uint8Array} bytes + * @returns {Uint8Array} - The signature bytes without the message + */ + sign(bytes) { + return this._key.sign(bytes); + } + + /** + * @param {Transaction} transaction + * @returns {Uint8Array | Uint8Array[]} + */ + signTransaction(transaction) { + const signatures = transaction._signedTransactions.list.map( + (signedTransaction) => { + const bodyBytes = signedTransaction.bodyBytes; + + if (!bodyBytes) { + return new Uint8Array(); + } + + return this._key.sign(bodyBytes); + }, + ); + + transaction.addSignature(this.publicKey, signatures); + + // Return directly Uint8Array if there is only one signature + return signatures.length === 1 ? signatures[0] : signatures; + } + + /** + * Check if `derive` can be called on this private key. + * + * This is only the case if the key was created from a mnemonic. + * + * @returns {boolean} + */ + isDerivable() { + return this._key.isDerivable(); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return this._key.toBytes(); + } + + /** + * @returns {Uint8Array} + */ + toBytesDer() { + return this._key.toBytesDer(); + } + + /** + * @returns {Uint8Array} + */ + toBytesRaw() { + return this._key.toBytesRaw(); + } + + /** + * @returns {string} + */ + toString() { + return this._key.toStringDer(); + } + + /** + * @returns {string} + */ + toStringDer() { + return this._key.toStringDer(); + } + + /** + * @returns {string} + */ + toStringRaw() { + return this._key.toStringRaw(); + } + + /** + * Create a keystore with a given passphrase. + * + * The key can be recovered later with `fromKeystore()`. + * + * Note that this will not retain the ancillary data used for + * deriving child keys, thus `.derive()` on the restored key will + * throw even if this instance supports derivation. + * + * @param {string} [passphrase] + * @returns {Promise} + */ + toKeystore(passphrase = "") { + return this._key.toKeystore(passphrase); + } + + /** + * @returns {HashgraphProto.proto.IKey} + */ + _toProtobufKey() { + return this.publicKey._toProtobufKey(); + } + + /** + * @param {Long | number} shard + * @param {Long | number} realm + * @returns {AccountId} + */ + toAccountId(shard, realm) { + return this.publicKey.toAccountId(shard, realm); + } + + /** + * @returns {string} + */ + get type() { + return this._key._type; + } +} + +src_Cache.setPrivateKeyConstructor((key) => new src_PrivateKey_PrivateKey(key)); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/KeyList.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + * @typedef {import("@hashgraph/proto").proto.IKeyList} HashgraphProto.proto.IKeyList + * @typedef {import("@hashgraph/proto").proto.IThresholdKey} HashgraphProto.proto.IThresholdKey + */ + +/** + * A list of Keys (`Key`) with an optional threshold. + */ +class src_KeyList_KeyList extends src_Key_Key { + /** + * @param {?Key[]} [keys] + * @param {?number} [threshold] + */ + constructor(keys, threshold) { + super(); + + /** + * @private + * @type {Key[]} + */ + // @ts-ignore + if (keys == null) this._keys = []; + //checks if the value for `keys` is passed as a single key + //rather than a list that contains just one key + else if (keys instanceof src_Key_Key) this._keys = [keys]; + else this._keys = keys; + + /** + * @type {?number} + */ + this._threshold = threshold == null ? null : threshold; + } + + /** + * @param {Key[]} keys + * @returns {KeyList} + */ + static of(...keys) { + return new src_KeyList_KeyList(keys, null); + } + + /** + * @template T + * @param {ArrayLike} arrayLike + * @param {((key: Key) => Key)} [mapFn] + * @param {T} [thisArg] + * @returns {KeyList} + */ + static from(arrayLike, mapFn, thisArg) { + if (mapFn == null) { + return new src_KeyList_KeyList(Array.from(arrayLike)); + } + + return new src_KeyList_KeyList(Array.from(arrayLike, mapFn, thisArg)); + } + + /** + * @returns {?number} + */ + get threshold() { + return this._threshold; + } + + /** + * @param {number} threshold + * @returns {this} + */ + setThreshold(threshold) { + this._threshold = threshold; + return this; + } + + /** + * @param {Key[]} keys + * @returns {number} + */ + push(...keys) { + return this._keys.push(...keys); + } + + /** + * @param {number} start + * @param {number} deleteCount + * @param {Key[]} items + * @returns {KeyList} + */ + splice(start, deleteCount, ...items) { + return new src_KeyList_KeyList( + this._keys.splice(start, deleteCount, ...items), + this.threshold, + ); + } + + /** + * @param {number=} start + * @param {number=} end + * @returns {KeyList} + */ + slice(start, end) { + return new src_KeyList_KeyList(this._keys.slice(start, end), this.threshold); + } + + /** + * @returns {Iterator} + */ + [Symbol.iterator]() { + return this._keys[Symbol.iterator](); + } + + /** + * @returns {Key[]} + */ + toArray() { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return this._keys.slice(); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify({ + threshold: this._threshold, + keys: this._keys.toString(), + }); + } + + /** + * @returns {HashgraphProto.proto.IKey} + */ + _toProtobufKey() { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return + const keys = this._keys.map((key) => key._toProtobufKey()); + + if (this.threshold == null) { + return { keyList: { keys } }; + } else { + return { + thresholdKey: { + threshold: this.threshold, + keys: { keys }, + }, + }; + } + } + + /** + * @param {HashgraphProto.proto.IKeyList} key + * @returns {KeyList} + */ + static __fromProtobufKeyList(key) { + const keys = (key.keys != null ? key.keys : []).map((key) => + src_Key_Key._fromProtobufKey(key), + ); + return new src_KeyList_KeyList(keys); + } + + /** + * @param {HashgraphProto.proto.IThresholdKey} key + * @returns {KeyList} + */ + static __fromProtobufThresoldKey(key) { + const list = src_KeyList_KeyList.__fromProtobufKeyList( + key.keys != null ? key.keys : {}, + ); + list.setThreshold(key.threshold != null ? key.threshold : 0); + return list; + } +} + +src_Cache.setKeyList((key) => src_KeyList_KeyList.__fromProtobufKeyList(key)); +src_Cache.setThresholdKey((key) => src_KeyList_KeyList.__fromProtobufThresoldKey(key)); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/long.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @typedef {{low: number, high: number, unsigned: boolean}} LongObject + * @typedef {import("long")} Long + */ + +/** + * @param {Long | number | string | LongObject | BigNumber} value + * @returns {BigNumber} + */ +function valueToLong(value) { + if (bignumber.isBigNumber(value)) { + return value; + } else { + return new bignumber(value.toString()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/HbarUnit.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +class HbarUnit { + /** + * @internal + * @param {string} name + * @param {string} symbol + * @param {BigNumber} tinybar + */ + constructor(name, symbol, tinybar) { + /** + * @internal + * @readonly + */ + this._name = name; + + /** + * @internal + * @readonly + */ + this._symbol = symbol; + + /** + * @internal + * @readonly + */ + this._tinybar = tinybar; + + Object.freeze(this); + } + + /** + * @param {string} unit + * @returns {HbarUnit} + */ + static fromString(unit) { + switch (unit) { + case HbarUnit.Hbar._symbol: + return HbarUnit.Hbar; + case HbarUnit.Tinybar._symbol: + return HbarUnit.Tinybar; + case HbarUnit.Microbar._symbol: + return HbarUnit.Microbar; + case HbarUnit.Millibar._symbol: + return HbarUnit.Millibar; + case HbarUnit.Kilobar._symbol: + return HbarUnit.Kilobar; + case HbarUnit.Megabar._symbol: + return HbarUnit.Megabar; + case HbarUnit.Gigabar._symbol: + return HbarUnit.Gigabar; + default: + throw new Error("Unknown unit."); + } + } +} + +HbarUnit.Tinybar = new HbarUnit("tinybar", "tℏ", new bignumber(1)); + +HbarUnit.Microbar = new HbarUnit("microbar", "μℏ", new bignumber(100)); + +HbarUnit.Millibar = new HbarUnit("millibar", "mℏ", new bignumber(100000)); + +HbarUnit.Hbar = new HbarUnit("hbar", "ℏ", new bignumber("100000000")); + +HbarUnit.Kilobar = new HbarUnit( + "kilobar", + "kℏ", + new bignumber(1000).multipliedBy(new bignumber("100000000")), +); + +HbarUnit.Megabar = new HbarUnit( + "megabar", + "Mℏ", + new bignumber(1000000).multipliedBy(new bignumber("100000000")), +); + +HbarUnit.Gigabar = new HbarUnit( + "gigabar", + "Gℏ", + new bignumber("1000000000").multipliedBy(new bignumber("100000000")), +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Hbar.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + +/** + * @typedef {import("./long.js").LongObject} LongObject + */ + +class Hbar_Hbar { + /** + * @param {number | string | Long | LongObject | BigNumber} amount + * @param {HbarUnit=} unit + */ + constructor(amount, unit = HbarUnit.Hbar) { + if (unit === HbarUnit.Tinybar) { + this._valueInTinybar = valueToLong(amount); + } else { + /** @type {BigNumber} */ + let bigAmount; + + if (src_long.isLong(amount)) { + bigAmount = new bignumber(amount.toString(10)); + } else if ( + bignumber.isBigNumber(amount) || + typeof amount === "string" || + typeof amount === "number" + ) { + bigAmount = new bignumber(amount); + } else { + bigAmount = new bignumber(0); + } + + /** + * @type {BigNumber} + */ + this._valueInTinybar = bigAmount.multipliedBy(unit._tinybar); + } + if (!this._valueInTinybar.isInteger()) { + throw new Error("Hbar in tinybars contains decimals"); + } + } + + /** + * @param {number | Long | BigNumber} amount + * @param {HbarUnit} unit + * @returns {Hbar} + */ + static from(amount, unit) { + return new Hbar_Hbar(amount, unit); + } + + /** + * @param {number | Long | string | BigNumber} amount + * @returns {Hbar} + */ + static fromTinybars(amount) { + if (typeof amount === "string") { + return this.fromString(amount, HbarUnit.Tinybar); + } + return new Hbar_Hbar(amount, HbarUnit.Tinybar); + } + + /** + * @param {string} str + * @param {HbarUnit=} unit + * @returns {Hbar} + */ + static fromString(str, unit = HbarUnit.Hbar) { + const pattern = /^((?:\+|-)?\d+(?:\.\d+)?)(?: (tℏ|μℏ|mℏ|ℏ|kℏ|Mℏ|Gℏ))?$/; + if (pattern.test(str)) { + let [amount, symbol] = str.split(" "); + if (symbol != null) { + unit = HbarUnit.fromString(symbol); + } + return new Hbar_Hbar(new bignumber(amount), unit); + } else { + throw new Error("invalid argument provided"); + } + } + + /** + * @param {HbarUnit} unit + * @returns {BigNumber} + */ + to(unit) { + return this._valueInTinybar.dividedBy(unit._tinybar); + } + + /** + * @returns {BigNumber} + */ + toBigNumber() { + return this.to(HbarUnit.Hbar); + } + + /** + * @returns {Long} + */ + toTinybars() { + return src_long.fromValue(this._valueInTinybar.toFixed()); + } + + /** + * @returns {Hbar} + */ + negated() { + return Hbar_Hbar.fromTinybars(this._valueInTinybar.negated()); + } + + /** + * @returns {boolean} + */ + isNegative() { + return this._valueInTinybar.isNegative(); + } + + /** + * @param {HbarUnit=} unit + * @returns {string} + */ + toString(unit) { + if (unit != null) { + return `${this._valueInTinybar + .dividedBy(unit._tinybar) + .toString()} ${unit._symbol}`; + } + + if ( + this._valueInTinybar.isLessThan(10000) && + this._valueInTinybar.isGreaterThan(-10000) + ) { + return `${this._valueInTinybar.toFixed()} ${ + HbarUnit.Tinybar._symbol + }`; + } + + return `${this.to(HbarUnit.Hbar).toString()} ${HbarUnit.Hbar._symbol}`; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/StatusError.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @typedef {import("./Status.js").default} Status + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + */ + +/** + * @typedef {object} StatusErrorJSON + * @property {string} name + * @property {string} status + * @property {string} transactionId + * @property {string} message + */ + +class StatusError extends Error { + /** + * @param {object} props + * @param {Status} props.status + * @param {TransactionId} props.transactionId + * @param {string} message + */ + constructor(props, message) { + super(message); + + this.name = "StatusError"; + + this.status = props.status; + + this.transactionId = props.transactionId; + + this.message = message; + + if (typeof Error.captureStackTrace !== "undefined") { + Error.captureStackTrace(this, StatusError); + } + } + + /** + * @returns {StatusErrorJSON} + */ + toJSON() { + return { + name: this.name, + status: this.status.toString(), + transactionId: this.transactionId.toString(), + message: this.message, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * @returns {StatusErrorJSON} + */ + valueOf() { + return this.toJSON(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @typedef {import("./Status.js").default} Status + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("./transaction/TransactionReceipt.js").default} TransactionReceipt + */ + +class ReceiptStatusError extends StatusError { + /** + * @param {object} props + * @param {TransactionReceipt} props.transactionReceipt + * @param {Status} props.status + * @param {TransactionId} props.transactionId + */ + constructor(props) { + super( + props, + `receipt for transaction ${props.transactionId.toString()} contained error status ${props.status.toString()}`, + ); + + /** + * @type {TransactionReceipt} + * @readonly + */ + this.transactionReceipt = props.transactionReceipt; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Status.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ResponseCodeEnum} HashgraphProto.proto.ResponseCodeEnum + */ + +class Status { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case Status.Ok: + return "OK"; + case Status.InvalidTransaction: + return "INVALID_TRANSACTION"; + case Status.PayerAccountNotFound: + return "PAYER_ACCOUNT_NOT_FOUND"; + case Status.InvalidNodeAccount: + return "INVALID_NODE_ACCOUNT"; + case Status.TransactionExpired: + return "TRANSACTION_EXPIRED"; + case Status.InvalidTransactionStart: + return "INVALID_TRANSACTION_START"; + case Status.InvalidTransactionDuration: + return "INVALID_TRANSACTION_DURATION"; + case Status.InvalidSignature: + return "INVALID_SIGNATURE"; + case Status.MemoTooLong: + return "MEMO_TOO_LONG"; + case Status.InsufficientTxFee: + return "INSUFFICIENT_TX_FEE"; + case Status.InsufficientPayerBalance: + return "INSUFFICIENT_PAYER_BALANCE"; + case Status.DuplicateTransaction: + return "DUPLICATE_TRANSACTION"; + case Status.Busy: + return "BUSY"; + case Status.NotSupported: + return "NOT_SUPPORTED"; + case Status.InvalidFileId: + return "INVALID_FILE_ID"; + case Status.InvalidAccountId: + return "INVALID_ACCOUNT_ID"; + case Status.InvalidContractId: + return "INVALID_CONTRACT_ID"; + case Status.InvalidTransactionId: + return "INVALID_TRANSACTION_ID"; + case Status.ReceiptNotFound: + return "RECEIPT_NOT_FOUND"; + case Status.RecordNotFound: + return "RECORD_NOT_FOUND"; + case Status.InvalidSolidityId: + return "INVALID_SOLIDITY_ID"; + case Status.Unknown: + return "UNKNOWN"; + case Status.Success: + return "SUCCESS"; + case Status.FailInvalid: + return "FAIL_INVALID"; + case Status.FailFee: + return "FAIL_FEE"; + case Status.FailBalance: + return "FAIL_BALANCE"; + case Status.KeyRequired: + return "KEY_REQUIRED"; + case Status.BadEncoding: + return "BAD_ENCODING"; + case Status.InsufficientAccountBalance: + return "INSUFFICIENT_ACCOUNT_BALANCE"; + case Status.InvalidSolidityAddress: + return "INVALID_SOLIDITY_ADDRESS"; + case Status.InsufficientGas: + return "INSUFFICIENT_GAS"; + case Status.ContractSizeLimitExceeded: + return "CONTRACT_SIZE_LIMIT_EXCEEDED"; + case Status.LocalCallModificationException: + return "LOCAL_CALL_MODIFICATION_EXCEPTION"; + case Status.ContractRevertExecuted: + return "CONTRACT_REVERT_EXECUTED"; + case Status.ContractExecutionException: + return "CONTRACT_EXECUTION_EXCEPTION"; + case Status.InvalidReceivingNodeAccount: + return "INVALID_RECEIVING_NODE_ACCOUNT"; + case Status.MissingQueryHeader: + return "MISSING_QUERY_HEADER"; + case Status.AccountUpdateFailed: + return "ACCOUNT_UPDATE_FAILED"; + case Status.InvalidKeyEncoding: + return "INVALID_KEY_ENCODING"; + case Status.NullSolidityAddress: + return "NULL_SOLIDITY_ADDRESS"; + case Status.ContractUpdateFailed: + return "CONTRACT_UPDATE_FAILED"; + case Status.InvalidQueryHeader: + return "INVALID_QUERY_HEADER"; + case Status.InvalidFeeSubmitted: + return "INVALID_FEE_SUBMITTED"; + case Status.InvalidPayerSignature: + return "INVALID_PAYER_SIGNATURE"; + case Status.KeyNotProvided: + return "KEY_NOT_PROVIDED"; + case Status.InvalidExpirationTime: + return "INVALID_EXPIRATION_TIME"; + case Status.NoWaclKey: + return "NO_WACL_KEY"; + case Status.FileContentEmpty: + return "FILE_CONTENT_EMPTY"; + case Status.InvalidAccountAmounts: + return "INVALID_ACCOUNT_AMOUNTS"; + case Status.EmptyTransactionBody: + return "EMPTY_TRANSACTION_BODY"; + case Status.InvalidTransactionBody: + return "INVALID_TRANSACTION_BODY"; + case Status.InvalidSignatureTypeMismatchingKey: + return "INVALID_SIGNATURE_TYPE_MISMATCHING_KEY"; + case Status.InvalidSignatureCountMismatchingKey: + return "INVALID_SIGNATURE_COUNT_MISMATCHING_KEY"; + case Status.EmptyLiveHashBody: + return "EMPTY_LIVE_HASH_BODY"; + case Status.EmptyLiveHash: + return "EMPTY_LIVE_HASH"; + case Status.EmptyLiveHashKeys: + return "EMPTY_LIVE_HASH_KEYS"; + case Status.InvalidLiveHashSize: + return "INVALID_LIVE_HASH_SIZE"; + case Status.EmptyQueryBody: + return "EMPTY_QUERY_BODY"; + case Status.EmptyLiveHashQuery: + return "EMPTY_LIVE_HASH_QUERY"; + case Status.LiveHashNotFound: + return "LIVE_HASH_NOT_FOUND"; + case Status.AccountIdDoesNotExist: + return "ACCOUNT_ID_DOES_NOT_EXIST"; + case Status.LiveHashAlreadyExists: + return "LIVE_HASH_ALREADY_EXISTS"; + case Status.InvalidFileWacl: + return "INVALID_FILE_WACL"; + case Status.SerializationFailed: + return "SERIALIZATION_FAILED"; + case Status.TransactionOversize: + return "TRANSACTION_OVERSIZE"; + case Status.TransactionTooManyLayers: + return "TRANSACTION_TOO_MANY_LAYERS"; + case Status.ContractDeleted: + return "CONTRACT_DELETED"; + case Status.PlatformNotActive: + return "PLATFORM_NOT_ACTIVE"; + case Status.KeyPrefixMismatch: + return "KEY_PREFIX_MISMATCH"; + case Status.PlatformTransactionNotCreated: + return "PLATFORM_TRANSACTION_NOT_CREATED"; + case Status.InvalidRenewalPeriod: + return "INVALID_RENEWAL_PERIOD"; + case Status.InvalidPayerAccountId: + return "INVALID_PAYER_ACCOUNT_ID"; + case Status.AccountDeleted: + return "ACCOUNT_DELETED"; + case Status.FileDeleted: + return "FILE_DELETED"; + case Status.AccountRepeatedInAccountAmounts: + return "ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS"; + case Status.SettingNegativeAccountBalance: + return "SETTING_NEGATIVE_ACCOUNT_BALANCE"; + case Status.ObtainerRequired: + return "OBTAINER_REQUIRED"; + case Status.ObtainerSameContractId: + return "OBTAINER_SAME_CONTRACT_ID"; + case Status.ObtainerDoesNotExist: + return "OBTAINER_DOES_NOT_EXIST"; + case Status.ModifyingImmutableContract: + return "MODIFYING_IMMUTABLE_CONTRACT"; + case Status.FileSystemException: + return "FILE_SYSTEM_EXCEPTION"; + case Status.AutorenewDurationNotInRange: + return "AUTORENEW_DURATION_NOT_IN_RANGE"; + case Status.ErrorDecodingBytestring: + return "ERROR_DECODING_BYTESTRING"; + case Status.ContractFileEmpty: + return "CONTRACT_FILE_EMPTY"; + case Status.ContractBytecodeEmpty: + return "CONTRACT_BYTECODE_EMPTY"; + case Status.InvalidInitialBalance: + return "INVALID_INITIAL_BALANCE"; + case Status.InvalidReceiveRecordThreshold: + return "INVALID_RECEIVE_RECORD_THRESHOLD"; + case Status.InvalidSendRecordThreshold: + return "INVALID_SEND_RECORD_THRESHOLD"; + case Status.AccountIsNotGenesisAccount: + return "ACCOUNT_IS_NOT_GENESIS_ACCOUNT"; + case Status.PayerAccountUnauthorized: + return "PAYER_ACCOUNT_UNAUTHORIZED"; + case Status.InvalidFreezeTransactionBody: + return "INVALID_FREEZE_TRANSACTION_BODY"; + case Status.FreezeTransactionBodyNotFound: + return "FREEZE_TRANSACTION_BODY_NOT_FOUND"; + case Status.TransferListSizeLimitExceeded: + return "TRANSFER_LIST_SIZE_LIMIT_EXCEEDED"; + case Status.ResultSizeLimitExceeded: + return "RESULT_SIZE_LIMIT_EXCEEDED"; + case Status.NotSpecialAccount: + return "NOT_SPECIAL_ACCOUNT"; + case Status.ContractNegativeGas: + return "CONTRACT_NEGATIVE_GAS"; + case Status.ContractNegativeValue: + return "CONTRACT_NEGATIVE_VALUE"; + case Status.InvalidFeeFile: + return "INVALID_FEE_FILE"; + case Status.InvalidExchangeRateFile: + return "INVALID_EXCHANGE_RATE_FILE"; + case Status.InsufficientLocalCallGas: + return "INSUFFICIENT_LOCAL_CALL_GAS"; + case Status.EntityNotAllowedToDelete: + return "ENTITY_NOT_ALLOWED_TO_DELETE"; + case Status.AuthorizationFailed: + return "AUTHORIZATION_FAILED"; + case Status.FileUploadedProtoInvalid: + return "FILE_UPLOADED_PROTO_INVALID"; + case Status.FileUploadedProtoNotSavedToDisk: + return "FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK"; + case Status.FeeScheduleFilePartUploaded: + return "FEE_SCHEDULE_FILE_PART_UPLOADED"; + case Status.ExchangeRateChangeLimitExceeded: + return "EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED"; + case Status.MaxContractStorageExceeded: + return "MAX_CONTRACT_STORAGE_EXCEEDED"; + case Status.TransferAccountSameAsDeleteAccount: + return "TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT"; + case Status.TotalLedgerBalanceInvalid: + return "TOTAL_LEDGER_BALANCE_INVALID"; + case Status.ExpirationReductionNotAllowed: + return "EXPIRATION_REDUCTION_NOT_ALLOWED"; + case Status.MaxGasLimitExceeded: + return "MAX_GAS_LIMIT_EXCEEDED"; + case Status.MaxFileSizeExceeded: + return "MAX_FILE_SIZE_EXCEEDED"; + case Status.ReceiverSigRequired: + return "RECEIVER_SIG_REQUIRED"; + case Status.InvalidTopicId: + return "INVALID_TOPIC_ID"; + case Status.InvalidAdminKey: + return "INVALID_ADMIN_KEY"; + case Status.InvalidSubmitKey: + return "INVALID_SUBMIT_KEY"; + case Status.Unauthorized: + return "UNAUTHORIZED"; + case Status.InvalidTopicMessage: + return "INVALID_TOPIC_MESSAGE"; + case Status.InvalidAutorenewAccount: + return "INVALID_AUTORENEW_ACCOUNT"; + case Status.AutorenewAccountNotAllowed: + return "AUTORENEW_ACCOUNT_NOT_ALLOWED"; + case Status.TopicExpired: + return "TOPIC_EXPIRED"; + case Status.InvalidChunkNumber: + return "INVALID_CHUNK_NUMBER"; + case Status.InvalidChunkTransactionId: + return "INVALID_CHUNK_TRANSACTION_ID"; + case Status.AccountFrozenForToken: + return "ACCOUNT_FROZEN_FOR_TOKEN"; + case Status.TokensPerAccountLimitExceeded: + return "TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED"; + case Status.InvalidTokenId: + return "INVALID_TOKEN_ID"; + case Status.InvalidTokenDecimals: + return "INVALID_TOKEN_DECIMALS"; + case Status.InvalidTokenInitialSupply: + return "INVALID_TOKEN_INITIAL_SUPPLY"; + case Status.InvalidTreasuryAccountForToken: + return "INVALID_TREASURY_ACCOUNT_FOR_TOKEN"; + case Status.InvalidTokenSymbol: + return "INVALID_TOKEN_SYMBOL"; + case Status.TokenHasNoFreezeKey: + return "TOKEN_HAS_NO_FREEZE_KEY"; + case Status.TransfersNotZeroSumForToken: + return "TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN"; + case Status.MissingTokenSymbol: + return "MISSING_TOKEN_SYMBOL"; + case Status.TokenSymbolTooLong: + return "TOKEN_SYMBOL_TOO_LONG"; + case Status.AccountKycNotGrantedForToken: + return "ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN"; + case Status.TokenHasNoKycKey: + return "TOKEN_HAS_NO_KYC_KEY"; + case Status.InsufficientTokenBalance: + return "INSUFFICIENT_TOKEN_BALANCE"; + case Status.TokenWasDeleted: + return "TOKEN_WAS_DELETED"; + case Status.TokenHasNoSupplyKey: + return "TOKEN_HAS_NO_SUPPLY_KEY"; + case Status.TokenHasNoWipeKey: + return "TOKEN_HAS_NO_WIPE_KEY"; + case Status.InvalidTokenMintAmount: + return "INVALID_TOKEN_MINT_AMOUNT"; + case Status.InvalidTokenBurnAmount: + return "INVALID_TOKEN_BURN_AMOUNT"; + case Status.TokenNotAssociatedToAccount: + return "TOKEN_NOT_ASSOCIATED_TO_ACCOUNT"; + case Status.CannotWipeTokenTreasuryAccount: + return "CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT"; + case Status.InvalidKycKey: + return "INVALID_KYC_KEY"; + case Status.InvalidWipeKey: + return "INVALID_WIPE_KEY"; + case Status.InvalidFreezeKey: + return "INVALID_FREEZE_KEY"; + case Status.InvalidSupplyKey: + return "INVALID_SUPPLY_KEY"; + case Status.MissingTokenName: + return "MISSING_TOKEN_NAME"; + case Status.TokenNameTooLong: + return "TOKEN_NAME_TOO_LONG"; + case Status.InvalidWipingAmount: + return "INVALID_WIPING_AMOUNT"; + case Status.TokenIsImmutable: + return "TOKEN_IS_IMMUTABLE"; + case Status.TokenAlreadyAssociatedToAccount: + return "TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT"; + case Status.TransactionRequiresZeroTokenBalances: + return "TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES"; + case Status.AccountIsTreasury: + return "ACCOUNT_IS_TREASURY"; + case Status.TokenIdRepeatedInTokenList: + return "TOKEN_ID_REPEATED_IN_TOKEN_LIST"; + case Status.TokenTransferListSizeLimitExceeded: + return "TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED"; + case Status.EmptyTokenTransferBody: + return "EMPTY_TOKEN_TRANSFER_BODY"; + case Status.EmptyTokenTransferAccountAmounts: + return "EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS"; + case Status.InvalidScheduleId: + return "INVALID_SCHEDULE_ID"; + case Status.ScheduleIsImmutable: + return "SCHEDULE_IS_IMMUTABLE"; + case Status.InvalidSchedulePayerId: + return "INVALID_SCHEDULE_PAYER_ID"; + case Status.InvalidScheduleAccountId: + return "INVALID_SCHEDULE_ACCOUNT_ID"; + case Status.NoNewValidSignatures: + return "NO_NEW_VALID_SIGNATURES"; + case Status.UnresolvableRequiredSigners: + return "UNRESOLVABLE_REQUIRED_SIGNERS"; + case Status.ScheduledTransactionNotInWhitelist: + return "SCHEDULED_TRANSACTION_NOT_IN_WHITELIST"; + case Status.SomeSignaturesWereInvalid: + return "SOME_SIGNATURES_WERE_INVALID"; + case Status.TransactionIdFieldNotAllowed: + return "TRANSACTION_ID_FIELD_NOT_ALLOWED"; + case Status.IdenticalScheduleAlreadyCreated: + return "IDENTICAL_SCHEDULE_ALREADY_CREATED"; + case Status.InvalidZeroByteInString: + return "INVALID_ZERO_BYTE_IN_STRING"; + case Status.ScheduleAlreadyDeleted: + return "SCHEDULE_ALREADY_DELETED"; + case Status.ScheduleAlreadyExecuted: + return "SCHEDULE_ALREADY_EXECUTED"; + case Status.MessageSizeTooLarge: + return "MESSAGE_SIZE_TOO_LARGE"; + case Status.OperationRepeatedInBucketGroups: + return "OPERATION_REPEATED_IN_BUCKET_GROUPS"; + case Status.BucketCapacityOverflow: + return "BUCKET_CAPACITY_OVERFLOW"; + case Status.NodeCapacityNotSufficientForOperation: + return "NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION"; + case Status.BucketHasNoThrottleGroups: + return "BUCKET_HAS_NO_THROTTLE_GROUPS"; + case Status.ThrottleGroupHasZeroOpsPerSec: + return "THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC"; + case Status.SuccessButMissingExpectedOperation: + return "SUCCESS_BUT_MISSING_EXPECTED_OPERATION"; + case Status.UnparseableThrottleDefinitions: + return "UNPARSEABLE_THROTTLE_DEFINITIONS"; + case Status.InvalidThrottleDefinitions: + return "INVALID_THROTTLE_DEFINITIONS"; + case Status.AccountExpiredAndPendingRemoval: + return "ACCOUNT_EXPIRED_AND_PENDING_REMOVAL"; + case Status.InvalidTokenMaxSupply: + return "INVALID_TOKEN_MAX_SUPPLY"; + case Status.InvalidTokenNftSerialNumber: + return "INVALID_TOKEN_NFT_SERIAL_NUMBER"; + case Status.InvalidNftId: + return "INVALID_NFT_ID"; + case Status.MetadataTooLong: + return "METADATA_TOO_LONG"; + case Status.BatchSizeLimitExceeded: + return "BATCH_SIZE_LIMIT_EXCEEDED"; + case Status.InvalidQueryRange: + return "INVALID_QUERY_RANGE"; + case Status.FractionDividesByZero: + return "FRACTION_DIVIDES_BY_ZERO"; + case Status.InsufficientPayerBalanceForCustomFee: + return "INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE"; + case Status.CustomFeesListTooLong: + return "CUSTOM_FEES_LIST_TOO_LONG"; + case Status.InvalidCustomFeeCollector: + return "INVALID_CUSTOM_FEE_COLLECTOR"; + case Status.InvalidTokenIdInCustomFees: + return "INVALID_TOKEN_ID_IN_CUSTOM_FEES"; + case Status.TokenNotAssociatedToFeeCollector: + return "TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR"; + case Status.TokenMaxSupplyReached: + return "TOKEN_MAX_SUPPLY_REACHED"; + case Status.SenderDoesNotOwnNftSerialNo: + return "SENDER_DOES_NOT_OWN_NFT_SERIAL_NO"; + case Status.CustomFeeNotFullySpecified: + return "CUSTOM_FEE_NOT_FULLY_SPECIFIED"; + case Status.CustomFeeMustBePositive: + return "CUSTOM_FEE_MUST_BE_POSITIVE"; + case Status.TokenHasNoFeeScheduleKey: + return "TOKEN_HAS_NO_FEE_SCHEDULE_KEY"; + case Status.CustomFeeOutsideNumericRange: + return "CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE"; + case Status.RoyaltyFractionCannotExceedOne: + return "ROYALTY_FRACTION_CANNOT_EXCEED_ONE"; + case Status.FractionalFeeMaxAmountLessThanMinAmount: + return "FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT"; + case Status.CustomScheduleAlreadyHasNoFees: + return "CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES"; + case Status.CustomFeeDenominationMustBeFungibleCommon: + return "CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON"; + case Status.CustomFractionalFeeOnlyAllowedForFungibleCommon: + return "CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON"; + case Status.InvalidCustomFeeScheduleKey: + return "INVALID_CUSTOM_FEE_SCHEDULE_KEY"; + case Status.InvalidTokenMintMetadata: + return "INVALID_TOKEN_MINT_METADATA"; + case Status.InvalidTokenBurnMetadata: + return "INVALID_TOKEN_BURN_METADATA"; + case Status.CurrentTreasuryStillOwnsNfts: + return "CURRENT_TREASURY_STILL_OWNS_NFTS"; + case Status.AccountStillOwnsNfts: + return "ACCOUNT_STILL_OWNS_NFTS"; + case Status.TreasuryMustOwnBurnedNft: + return "TREASURY_MUST_OWN_BURNED_NFT"; + case Status.AccountDoesNotOwnWipedNft: + return "ACCOUNT_DOES_NOT_OWN_WIPED_NFT"; + case Status.AccountAmountTransfersOnlyAllowedForFungibleCommon: + return "ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON"; + case Status.MaxNftsInPriceRegimeHaveBeenMinted: + return "MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED"; + case Status.PayerAccountDeleted: + return "PAYER_ACCOUNT_DELETED"; + case Status.CustomFeeChargingExceededMaxRecursionDepth: + return "CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH"; + case Status.CustomFeeChargingExceededMaxAccountAmounts: + return "CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS"; + case Status.InsufficientSenderAccountBalanceForCustomFee: + return "INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE"; + case Status.SerialNumberLimitReached: + return "SERIAL_NUMBER_LIMIT_REACHED"; + case Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique: + return "CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE"; + case Status.NoRemainingAutomaticAssociations: + return "NO_REMAINING_AUTOMATIC_ASSOCIATIONS"; + case Status.ExistingAutomaticAssociationsExceedGivenLimit: + return "EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT"; + case Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit: + return "REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT"; + case Status.TokenIsPaused: + return "TOKEN_IS_PAUSED"; + case Status.TokenHasNoPauseKey: + return "TOKEN_HAS_NO_PAUSE_KEY"; + case Status.InvalidPauseKey: + return "INVALID_PAUSE_KEY"; + case Status.FreezeUpdateFileDoesNotExist: + return "FREEZE_UPDATE_FILE_DOES_NOT_EXIST"; + case Status.FreezeUpdateFileHashDoesNotMatch: + return "FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH"; + case Status.NoUpgradeHasBeenPrepared: + return "NO_UPGRADE_HAS_BEEN_PREPARED"; + case Status.NoFreezeIsScheduled: + return "NO_FREEZE_IS_SCHEDULED"; + case Status.UpdateFileHashChangedSincePrepareUpgrade: + return "UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE"; + case Status.FreezeStartTimeMustBeFuture: + return "FREEZE_START_TIME_MUST_BE_FUTURE"; + case Status.PreparedUpdateFileIsImmutable: + return "PREPARED_UPDATE_FILE_IS_IMMUTABLE"; + case Status.FreezeAlreadyScheduled: + return "FREEZE_ALREADY_SCHEDULED"; + case Status.FreezeUpgradeInProgress: + return "FREEZE_UPGRADE_IN_PROGRESS"; + case Status.UpdateFileIdDoesNotMatchPrepared: + return "UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED"; + case Status.UpdateFileHashDoesNotMatchPrepared: + return "UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED"; + case Status.ConsensusGasExhausted: + return "CONSENSUS_GAS_EXHAUSTED"; + case Status.RevertedSuccess: + return "REVERTED_SUCCESS"; + case Status.MaxStorageInPriceRegimeHasBeenUsed: + return "MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED"; + case Status.InvalidAliasKey: + return "INVALID_ALIAS_KEY"; + case Status.UnexpectedTokenDecimals: + return "UNEXPECTED_TOKEN_DECIMALS"; + case Status.InvalidProxyAccountId: + return "INVALID_PROXY_ACCOUNT_ID"; + case Status.InvalidTransferAccountId: + return "INVALID_TRANSFER_ACCOUNT_ID"; + case Status.InvalidFeeCollectorAccountId: + return "INVALID_FEE_COLLECTOR_ACCOUNT_ID"; + case Status.AliasIsImmutable: + return "ALIAS_IS_IMMUTABLE"; + case Status.SpenderAccountSameAsOwner: + return "SPENDER_ACCOUNT_SAME_AS_OWNER"; + case Status.AmountExceedsTokenMaxSupply: + return "AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY"; + case Status.NegativeAllowanceAmount: + return "NEGATIVE_ALLOWANCE_AMOUNT"; + case Status.CannotApproveForAllFungibleCommon: + return "CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON"; + case Status.SpenderDoesNotHaveAllowance: + return "SPENDER_DOES_NOT_HAVE_ALLOWANCE"; + case Status.AmountExceedsAllowance: + return "AMOUNT_EXCEEDS_ALLOWANCE"; + case Status.MaxAllowancesExceeded: + return "MAX_ALLOWANCES_EXCEEDED"; + case Status.EmptyAllowances: + return "EMPTY_ALLOWANCES"; + case Status.SpenderAccountRepeatedInAllowances: + return "SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES"; + case Status.RepeatedSerialNumsInNftAllowances: + return "REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES"; + case Status.FungibleTokenInNftAllowances: + return "FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES"; + case Status.NftInFungibleTokenAllowances: + return "NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES"; + case Status.InvalidAllowanceOwnerId: + return "INVALID_ALLOWANCE_OWNER_ID"; + case Status.InvalidAllowanceSpenderId: + return "INVALID_ALLOWANCE_SPENDER_ID"; + case Status.RepeatedAllowancesToDelete: + return "REPEATED_ALLOWANCES_TO_DELETE"; + case Status.InvalidDelegatingSpender: + return "INVALID_DELEGATING_SPENDER"; + case Status.DelegatingSpenderCannotGrantApproveForAll: + return "DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL"; + case Status.DelegatingSpenderDoesNotHaveApproveForAll: + return "DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL"; + case Status.ScheduleExpirationTimeTooFarInFuture: + return "SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE"; + case Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime: + return "SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME"; + case Status.ScheduleFutureThrottleExceeded: + return "SCHEDULE_FUTURE_THROTTLE_EXCEEDED"; + case Status.ScheduleFutureGasLimitExceeded: + return "SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED"; + case Status.InvalidEthereumTransaction: + return "INVALID_ETHEREUM_TRANSACTION"; + case Status.WrongChainId: + return "WRONG_CHAIN_ID"; + case Status.WrongNonce: + return "WRONG_NONCE"; + case Status.AccessListUnsupported: + return "ACCESS_LIST_UNSUPPORTED"; + case Status.SchedulePendingExpiration: + return "SCHEDULE_PENDING_EXPIRATION"; + case Status.ContractIsTokenTreasury: + return "CONTRACT_IS_TOKEN_TREASURY"; + case Status.ContractHasNonZeroTokenBalances: + return "CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES"; + case Status.ContractExpiredAndPendingRemoval: + return "CONTRACT_EXPIRED_AND_PENDING_REMOVAL"; + case Status.ContractHasNoAutoRenewAccount: + return "CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT"; + case Status.PermanentRemovalRequiresSystemInitiation: + return "PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION"; + case Status.ProxyAccountIdFieldIsDeprecated: + return "PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED"; + case Status.SelfStakingIsNotAllowed: + return "SELF_STAKING_IS_NOT_ALLOWED"; + case Status.InvalidStakingId: + return "INVALID_STAKING_ID"; + case Status.StakingNotEnabled: + return "STAKING_NOT_ENABLED"; + case Status.InvalidPrngRange: + return "INVALID_PRNG_RANGE"; + case Status.MaxEntitiesInPriceRegimeHaveBeenCreated: + return "MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED"; + case Status.InvalidFullPrefixSignatureForPrecompile: + return "INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE"; + case Status.InsufficientBalancesForStorageRent: + return "INSUFFICIENT_BALANCES_FOR_STORAGE_RENT"; + case Status.MaxChildRecordsExceeded: + return "MAX_CHILD_RECORDS_EXCEEDED"; + case Status.InsufficientBalancesForRenewalFees: + return "INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES"; + case Status.TransactionHasUnknownFields: + return "TRANSACTION_HAS_UNKNOWN_FIELDS"; + case Status.AccountIsImmutable: + return "ACCOUNT_IS_IMMUTABLE"; + case Status.AliasAlreadyAssigned: + return "ALIAS_ALREADY_ASSIGNED"; + case Status.InvalidMetadataKey: + return "INVALID_METADATA_KEY"; + case Status.TokenHasNoMetadataKey: + return "TOKEN_HAS_NO_METADATA_KEY"; + case Status.MissingTokenMetadata: + return "MISSING_TOKEN_METADATA"; + case Status.MissingSerialNumbers: + return "MISSING_SERIAL_NUMBERS"; + case Status.TokenHasNoAdminKey: + return "TOKEN_HAS_NO_ADMIN_KEY"; + case Status.NodeDeleted: + return "NODE_DELETED"; + case Status.InvalidNodeId: + return "INVALID_NODE_ID"; + case Status.InvalidGossipEndpoint: + return "INVALID_GOSSIP_ENDPOINT"; + case Status.InvalidNodeAccountId: + return "INVALID_NODE_ACCOUNT_ID"; + case Status.InvalidNodeDescription: + return "INVALID_NODE_DESCRIPTION"; + case Status.InvalidServiceEndpoint: + return "INVALID_SERVICE_ENDPOINT"; + case Status.InvalidGossipCaCertificate: + return "INVALID_GOSSIP_CA_CERTIFICATE"; + case Status.InvalidGrpcCertificate: + return "INVALID_GRPC_CERTIFICATE"; + case Status.InvalidMaxAutoAssociations: + return "INVALID_MAX_AUTO_ASSOCIATIONS"; + case Status.MaxNodesCreated: + return "MAX_NODES_CREATED"; + case Status.IpFqdnCannotBeSetForSameEndpoint: + return "IP_FQDN_CANNOT_BE_SET_FOR_SAME_ENDPOINT"; + case Status.GossipEndpointCannotHaveFqdn: + return "GOSSIP_ENDPOINT_CANNOT_HAVE_FQDN"; + case Status.FqdnSizeTooLarge: + return "FQDN_SIZE_TOO_LARGE"; + case Status.InvalidEndpoint: + return "INVALID_ENDPOINT"; + case Status.GossipEndpointsExceededLimit: + return "GOSSIP_ENDPOINTS_EXCEEDED_LIMIT"; + case Status.ServiceEndpointsExceededLimit: + return "SERVICE_ENDPOINTS_EXCEEDED_LIMIT"; + case Status.InvalidIpv4Address: + return "INVALID_IPV4_ADDRESS"; + case Status.TokenReferenceRepeated: + return "TOKEN_REFERENCE_REPEATED"; + case Status.InvalidOwnerId: + return "INVALID_OWNER_ID"; + case Status.TokenReferenceListSizeLimitExceeded: + return "TOKEN_REFERENCE_LIST_SIZE_LIMIT_EXCEEDED"; + case Status.EmptyTokenReferenceList: + return "EMPTY_TOKEN_REFERENCE_LIST"; + case Status.UpdateNodeAccountNotAllowed: + return "UPDATE_NODE_ACCOUNT_NOT_ALLOWED"; + case Status.TokenHasNoMetadataOrSupplyKey: + return "TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY"; + case Status.EmptyPendingAirdropIdList: + return "EMPTY_PENDING_AIRDROP_ID_LIST"; + case Status.PendingAirdropIdRepeated: + return "PENDING_AIRDROP_ID_REPEATED"; + case Status.MaxPendingAirdropIdExceeded: + return "MAX_PENDING_AIRDROP_ID_EXCEEDED"; + case Status.PendingNftAirdropAlreadyExists: + return "PENDING_NFT_AIRDROP_ALREADY_EXISTS"; + case Status.AccountHasPendingAirdrops: + return "ACCOUNT_HAS_PENDING_AIRDROPS"; + case Status.ThrottledAtConsensus: + return "THROTTLED_AT_CONSENSUS"; + case Status.InvalidPendingAirdropId: + return "INVALID_PENDING_AIRDROP_ID"; + case Status.TokenAirdropWithFallbackRoyalty: + return "TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY"; + case Status.InvalidTokenInPendingAirdrop: + return "INVALID_TOKEN_IN_PENDING_AIRDROP"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @internal + * @param {number} code + * @returns {Status} + */ + static _fromCode(code) { + switch (code) { + case 0: + return Status.Ok; + case 1: + return Status.InvalidTransaction; + case 2: + return Status.PayerAccountNotFound; + case 3: + return Status.InvalidNodeAccount; + case 4: + return Status.TransactionExpired; + case 5: + return Status.InvalidTransactionStart; + case 6: + return Status.InvalidTransactionDuration; + case 7: + return Status.InvalidSignature; + case 8: + return Status.MemoTooLong; + case 9: + return Status.InsufficientTxFee; + case 10: + return Status.InsufficientPayerBalance; + case 11: + return Status.DuplicateTransaction; + case 12: + return Status.Busy; + case 13: + return Status.NotSupported; + case 14: + return Status.InvalidFileId; + case 15: + return Status.InvalidAccountId; + case 16: + return Status.InvalidContractId; + case 17: + return Status.InvalidTransactionId; + case 18: + return Status.ReceiptNotFound; + case 19: + return Status.RecordNotFound; + case 20: + return Status.InvalidSolidityId; + case 21: + return Status.Unknown; + case 22: + return Status.Success; + case 23: + return Status.FailInvalid; + case 24: + return Status.FailFee; + case 25: + return Status.FailBalance; + case 26: + return Status.KeyRequired; + case 27: + return Status.BadEncoding; + case 28: + return Status.InsufficientAccountBalance; + case 29: + return Status.InvalidSolidityAddress; + case 30: + return Status.InsufficientGas; + case 31: + return Status.ContractSizeLimitExceeded; + case 32: + return Status.LocalCallModificationException; + case 33: + return Status.ContractRevertExecuted; + case 34: + return Status.ContractExecutionException; + case 35: + return Status.InvalidReceivingNodeAccount; + case 36: + return Status.MissingQueryHeader; + case 37: + return Status.AccountUpdateFailed; + case 38: + return Status.InvalidKeyEncoding; + case 39: + return Status.NullSolidityAddress; + case 40: + return Status.ContractUpdateFailed; + case 41: + return Status.InvalidQueryHeader; + case 42: + return Status.InvalidFeeSubmitted; + case 43: + return Status.InvalidPayerSignature; + case 44: + return Status.KeyNotProvided; + case 45: + return Status.InvalidExpirationTime; + case 46: + return Status.NoWaclKey; + case 47: + return Status.FileContentEmpty; + case 48: + return Status.InvalidAccountAmounts; + case 49: + return Status.EmptyTransactionBody; + case 50: + return Status.InvalidTransactionBody; + case 51: + return Status.InvalidSignatureTypeMismatchingKey; + case 52: + return Status.InvalidSignatureCountMismatchingKey; + case 53: + return Status.EmptyLiveHashBody; + case 54: + return Status.EmptyLiveHash; + case 55: + return Status.EmptyLiveHashKeys; + case 56: + return Status.InvalidLiveHashSize; + case 57: + return Status.EmptyQueryBody; + case 58: + return Status.EmptyLiveHashQuery; + case 59: + return Status.LiveHashNotFound; + case 60: + return Status.AccountIdDoesNotExist; + case 61: + return Status.LiveHashAlreadyExists; + case 62: + return Status.InvalidFileWacl; + case 63: + return Status.SerializationFailed; + case 64: + return Status.TransactionOversize; + case 65: + return Status.TransactionTooManyLayers; + case 66: + return Status.ContractDeleted; + case 67: + return Status.PlatformNotActive; + case 68: + return Status.KeyPrefixMismatch; + case 69: + return Status.PlatformTransactionNotCreated; + case 70: + return Status.InvalidRenewalPeriod; + case 71: + return Status.InvalidPayerAccountId; + case 72: + return Status.AccountDeleted; + case 73: + return Status.FileDeleted; + case 74: + return Status.AccountRepeatedInAccountAmounts; + case 75: + return Status.SettingNegativeAccountBalance; + case 76: + return Status.ObtainerRequired; + case 77: + return Status.ObtainerSameContractId; + case 78: + return Status.ObtainerDoesNotExist; + case 79: + return Status.ModifyingImmutableContract; + case 80: + return Status.FileSystemException; + case 81: + return Status.AutorenewDurationNotInRange; + case 82: + return Status.ErrorDecodingBytestring; + case 83: + return Status.ContractFileEmpty; + case 84: + return Status.ContractBytecodeEmpty; + case 85: + return Status.InvalidInitialBalance; + case 86: + return Status.InvalidReceiveRecordThreshold; + case 87: + return Status.InvalidSendRecordThreshold; + case 88: + return Status.AccountIsNotGenesisAccount; + case 89: + return Status.PayerAccountUnauthorized; + case 90: + return Status.InvalidFreezeTransactionBody; + case 91: + return Status.FreezeTransactionBodyNotFound; + case 92: + return Status.TransferListSizeLimitExceeded; + case 93: + return Status.ResultSizeLimitExceeded; + case 94: + return Status.NotSpecialAccount; + case 95: + return Status.ContractNegativeGas; + case 96: + return Status.ContractNegativeValue; + case 97: + return Status.InvalidFeeFile; + case 98: + return Status.InvalidExchangeRateFile; + case 99: + return Status.InsufficientLocalCallGas; + case 100: + return Status.EntityNotAllowedToDelete; + case 101: + return Status.AuthorizationFailed; + case 102: + return Status.FileUploadedProtoInvalid; + case 103: + return Status.FileUploadedProtoNotSavedToDisk; + case 104: + return Status.FeeScheduleFilePartUploaded; + case 105: + return Status.ExchangeRateChangeLimitExceeded; + case 106: + return Status.MaxContractStorageExceeded; + case 107: + return Status.TransferAccountSameAsDeleteAccount; + case 108: + return Status.TotalLedgerBalanceInvalid; + case 110: + return Status.ExpirationReductionNotAllowed; + case 111: + return Status.MaxGasLimitExceeded; + case 112: + return Status.MaxFileSizeExceeded; + case 113: + return Status.ReceiverSigRequired; + case 150: + return Status.InvalidTopicId; + case 155: + return Status.InvalidAdminKey; + case 156: + return Status.InvalidSubmitKey; + case 157: + return Status.Unauthorized; + case 158: + return Status.InvalidTopicMessage; + case 159: + return Status.InvalidAutorenewAccount; + case 160: + return Status.AutorenewAccountNotAllowed; + case 162: + return Status.TopicExpired; + case 163: + return Status.InvalidChunkNumber; + case 164: + return Status.InvalidChunkTransactionId; + case 165: + return Status.AccountFrozenForToken; + case 166: + return Status.TokensPerAccountLimitExceeded; + case 167: + return Status.InvalidTokenId; + case 168: + return Status.InvalidTokenDecimals; + case 169: + return Status.InvalidTokenInitialSupply; + case 170: + return Status.InvalidTreasuryAccountForToken; + case 171: + return Status.InvalidTokenSymbol; + case 172: + return Status.TokenHasNoFreezeKey; + case 173: + return Status.TransfersNotZeroSumForToken; + case 174: + return Status.MissingTokenSymbol; + case 175: + return Status.TokenSymbolTooLong; + case 176: + return Status.AccountKycNotGrantedForToken; + case 177: + return Status.TokenHasNoKycKey; + case 178: + return Status.InsufficientTokenBalance; + case 179: + return Status.TokenWasDeleted; + case 180: + return Status.TokenHasNoSupplyKey; + case 181: + return Status.TokenHasNoWipeKey; + case 182: + return Status.InvalidTokenMintAmount; + case 183: + return Status.InvalidTokenBurnAmount; + case 184: + return Status.TokenNotAssociatedToAccount; + case 185: + return Status.CannotWipeTokenTreasuryAccount; + case 186: + return Status.InvalidKycKey; + case 187: + return Status.InvalidWipeKey; + case 188: + return Status.InvalidFreezeKey; + case 189: + return Status.InvalidSupplyKey; + case 190: + return Status.MissingTokenName; + case 191: + return Status.TokenNameTooLong; + case 192: + return Status.InvalidWipingAmount; + case 193: + return Status.TokenIsImmutable; + case 194: + return Status.TokenAlreadyAssociatedToAccount; + case 195: + return Status.TransactionRequiresZeroTokenBalances; + case 196: + return Status.AccountIsTreasury; + case 197: + return Status.TokenIdRepeatedInTokenList; + case 198: + return Status.TokenTransferListSizeLimitExceeded; + case 199: + return Status.EmptyTokenTransferBody; + case 200: + return Status.EmptyTokenTransferAccountAmounts; + case 201: + return Status.InvalidScheduleId; + case 202: + return Status.ScheduleIsImmutable; + case 203: + return Status.InvalidSchedulePayerId; + case 204: + return Status.InvalidScheduleAccountId; + case 205: + return Status.NoNewValidSignatures; + case 206: + return Status.UnresolvableRequiredSigners; + case 207: + return Status.ScheduledTransactionNotInWhitelist; + case 208: + return Status.SomeSignaturesWereInvalid; + case 209: + return Status.TransactionIdFieldNotAllowed; + case 210: + return Status.IdenticalScheduleAlreadyCreated; + case 211: + return Status.InvalidZeroByteInString; + case 212: + return Status.ScheduleAlreadyDeleted; + case 213: + return Status.ScheduleAlreadyExecuted; + case 214: + return Status.MessageSizeTooLarge; + case 215: + return Status.OperationRepeatedInBucketGroups; + case 216: + return Status.BucketCapacityOverflow; + case 217: + return Status.NodeCapacityNotSufficientForOperation; + case 218: + return Status.BucketHasNoThrottleGroups; + case 219: + return Status.ThrottleGroupHasZeroOpsPerSec; + case 220: + return Status.SuccessButMissingExpectedOperation; + case 221: + return Status.UnparseableThrottleDefinitions; + case 222: + return Status.InvalidThrottleDefinitions; + case 223: + return Status.AccountExpiredAndPendingRemoval; + case 224: + return Status.InvalidTokenMaxSupply; + case 225: + return Status.InvalidTokenNftSerialNumber; + case 226: + return Status.InvalidNftId; + case 227: + return Status.MetadataTooLong; + case 228: + return Status.BatchSizeLimitExceeded; + case 229: + return Status.InvalidQueryRange; + case 230: + return Status.FractionDividesByZero; + case 231: + return Status.InsufficientPayerBalanceForCustomFee; + case 232: + return Status.CustomFeesListTooLong; + case 233: + return Status.InvalidCustomFeeCollector; + case 234: + return Status.InvalidTokenIdInCustomFees; + case 235: + return Status.TokenNotAssociatedToFeeCollector; + case 236: + return Status.TokenMaxSupplyReached; + case 237: + return Status.SenderDoesNotOwnNftSerialNo; + case 238: + return Status.CustomFeeNotFullySpecified; + case 239: + return Status.CustomFeeMustBePositive; + case 240: + return Status.TokenHasNoFeeScheduleKey; + case 241: + return Status.CustomFeeOutsideNumericRange; + case 242: + return Status.RoyaltyFractionCannotExceedOne; + case 243: + return Status.FractionalFeeMaxAmountLessThanMinAmount; + case 244: + return Status.CustomScheduleAlreadyHasNoFees; + case 245: + return Status.CustomFeeDenominationMustBeFungibleCommon; + case 246: + return Status.CustomFractionalFeeOnlyAllowedForFungibleCommon; + case 247: + return Status.InvalidCustomFeeScheduleKey; + case 248: + return Status.InvalidTokenMintMetadata; + case 249: + return Status.InvalidTokenBurnMetadata; + case 250: + return Status.CurrentTreasuryStillOwnsNfts; + case 251: + return Status.AccountStillOwnsNfts; + case 252: + return Status.TreasuryMustOwnBurnedNft; + case 253: + return Status.AccountDoesNotOwnWipedNft; + case 254: + return Status.AccountAmountTransfersOnlyAllowedForFungibleCommon; + case 255: + return Status.MaxNftsInPriceRegimeHaveBeenMinted; + case 256: + return Status.PayerAccountDeleted; + case 257: + return Status.CustomFeeChargingExceededMaxRecursionDepth; + case 258: + return Status.CustomFeeChargingExceededMaxAccountAmounts; + case 259: + return Status.InsufficientSenderAccountBalanceForCustomFee; + case 260: + return Status.SerialNumberLimitReached; + case 261: + return Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique; + case 262: + return Status.NoRemainingAutomaticAssociations; + case 263: + return Status.ExistingAutomaticAssociationsExceedGivenLimit; + case 264: + return Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit; + case 265: + return Status.TokenIsPaused; + case 266: + return Status.TokenHasNoPauseKey; + case 267: + return Status.InvalidPauseKey; + case 268: + return Status.FreezeUpdateFileDoesNotExist; + case 269: + return Status.FreezeUpdateFileHashDoesNotMatch; + case 270: + return Status.NoUpgradeHasBeenPrepared; + case 271: + return Status.NoFreezeIsScheduled; + case 272: + return Status.UpdateFileHashChangedSincePrepareUpgrade; + case 273: + return Status.FreezeStartTimeMustBeFuture; + case 274: + return Status.PreparedUpdateFileIsImmutable; + case 275: + return Status.FreezeAlreadyScheduled; + case 276: + return Status.FreezeUpgradeInProgress; + case 277: + return Status.UpdateFileIdDoesNotMatchPrepared; + case 278: + return Status.UpdateFileHashDoesNotMatchPrepared; + case 279: + return Status.ConsensusGasExhausted; + case 280: + return Status.RevertedSuccess; + case 281: + return Status.MaxStorageInPriceRegimeHasBeenUsed; + case 282: + return Status.InvalidAliasKey; + case 283: + return Status.UnexpectedTokenDecimals; + case 284: + return Status.InvalidProxyAccountId; + case 285: + return Status.InvalidTransferAccountId; + case 286: + return Status.InvalidFeeCollectorAccountId; + case 287: + return Status.AliasIsImmutable; + case 288: + return Status.SpenderAccountSameAsOwner; + case 289: + return Status.AmountExceedsTokenMaxSupply; + case 290: + return Status.NegativeAllowanceAmount; + case 291: + return Status.CannotApproveForAllFungibleCommon; + case 292: + return Status.SpenderDoesNotHaveAllowance; + case 293: + return Status.AmountExceedsAllowance; + case 294: + return Status.MaxAllowancesExceeded; + case 295: + return Status.EmptyAllowances; + case 296: + return Status.SpenderAccountRepeatedInAllowances; + case 297: + return Status.RepeatedSerialNumsInNftAllowances; + case 298: + return Status.FungibleTokenInNftAllowances; + case 299: + return Status.NftInFungibleTokenAllowances; + case 300: + return Status.InvalidAllowanceOwnerId; + case 301: + return Status.InvalidAllowanceSpenderId; + case 302: + return Status.RepeatedAllowancesToDelete; + case 303: + return Status.InvalidDelegatingSpender; + case 304: + return Status.DelegatingSpenderCannotGrantApproveForAll; + case 305: + return Status.DelegatingSpenderDoesNotHaveApproveForAll; + case 306: + return Status.ScheduleExpirationTimeTooFarInFuture; + case 307: + return Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime; + case 308: + return Status.ScheduleFutureThrottleExceeded; + case 309: + return Status.ScheduleFutureGasLimitExceeded; + case 310: + return Status.InvalidEthereumTransaction; + case 311: + return Status.WrongChainId; + case 312: + return Status.WrongNonce; + case 313: + return Status.AccessListUnsupported; + case 314: + return Status.SchedulePendingExpiration; + case 315: + return Status.ContractIsTokenTreasury; + case 316: + return Status.ContractHasNonZeroTokenBalances; + case 317: + return Status.ContractExpiredAndPendingRemoval; + case 318: + return Status.ContractHasNoAutoRenewAccount; + case 319: + return Status.PermanentRemovalRequiresSystemInitiation; + case 320: + return Status.ProxyAccountIdFieldIsDeprecated; + case 321: + return Status.SelfStakingIsNotAllowed; + case 322: + return Status.InvalidStakingId; + case 323: + return Status.StakingNotEnabled; + case 324: + return Status.InvalidPrngRange; + case 325: + return Status.MaxEntitiesInPriceRegimeHaveBeenCreated; + case 326: + return Status.InvalidFullPrefixSignatureForPrecompile; + case 327: + return Status.InsufficientBalancesForStorageRent; + case 328: + return Status.MaxChildRecordsExceeded; + case 329: + return Status.InsufficientBalancesForRenewalFees; + case 330: + return Status.TransactionHasUnknownFields; + case 331: + return Status.AccountIsImmutable; + case 332: + return Status.AliasAlreadyAssigned; + case 333: + return Status.InvalidMetadataKey; + case 334: + return Status.TokenHasNoMetadataKey; + case 335: + return Status.MissingTokenMetadata; + case 336: + return Status.MissingSerialNumbers; + case 337: + return Status.TokenHasNoAdminKey; + case 338: + return Status.NodeDeleted; + case 339: + return Status.InvalidNodeId; + case 340: + return Status.InvalidGossipEndpoint; + case 341: + return Status.InvalidNodeAccountId; + case 342: + return Status.InvalidNodeDescription; + case 343: + return Status.InvalidServiceEndpoint; + case 344: + return Status.InvalidGossipCaCertificate; + case 345: + return Status.InvalidGrpcCertificate; + case 346: + return Status.InvalidMaxAutoAssociations; + case 347: + return Status.MaxNodesCreated; + case 348: + return Status.IpFqdnCannotBeSetForSameEndpoint; + case 349: + return Status.GossipEndpointCannotHaveFqdn; + case 350: + return Status.FqdnSizeTooLarge; + case 351: + return Status.InvalidEndpoint; + case 352: + return Status.GossipEndpointsExceededLimit; + case 353: + return Status.TokenReferenceRepeated; + case 354: + return Status.InvalidOwnerId; + case 355: + return Status.TokenReferenceListSizeLimitExceeded; + case 356: + return Status.ServiceEndpointsExceededLimit; + case 357: + return Status.InvalidIpv4Address; + case 358: + return Status.EmptyTokenReferenceList; + case 359: + return Status.UpdateNodeAccountNotAllowed; + case 360: + return Status.TokenHasNoMetadataOrSupplyKey; + case 361: + return Status.EmptyPendingAirdropIdList; + case 362: + return Status.PendingAirdropIdRepeated; + case 363: + return Status.MaxPendingAirdropIdExceeded; + case 364: + return Status.PendingNftAirdropAlreadyExists; + case 365: + return Status.AccountHasPendingAirdrops; + case 366: + return Status.ThrottledAtConsensus; + case 367: + return Status.InvalidPendingAirdropId; + case 368: + return Status.TokenAirdropWithFallbackRoyalty; + case 369: + return Status.InvalidTokenInPendingAirdrop; + default: + throw new Error( + `(BUG) Status.fromCode() does not handle code: ${code}`, + ); + } + } + + /** + * @returns {HashgraphProto.proto.ResponseCodeEnum} + */ + valueOf() { + return this._code; + } +} + +/** + * The transaction passed the precheck validations. + */ +Status.Ok = new Status(0); + +/** + * For any error not handled by specific error codes listed below. + */ +Status.InvalidTransaction = new Status(1); + +/** + * Payer account does not exist. + */ +Status.PayerAccountNotFound = new Status(2); + +/** + * Node Account provided does not match the node account of the node the transaction was submitted + * to. + */ +Status.InvalidNodeAccount = new Status(3); + +/** + * Pre-Check error when TransactionValidStart + transactionValidDuration is less than current + * consensus time. + */ +Status.TransactionExpired = new Status(4); + +/** + * Transaction start time is greater than current consensus time + */ +Status.InvalidTransactionStart = new Status(5); + +/** + * The given transactionValidDuration was either non-positive, or greater than the maximum + * valid duration of 180 secs. + * + */ +Status.InvalidTransactionDuration = new Status(6); + +/** + * The transaction signature is not valid + */ +Status.InvalidSignature = new Status(7); + +/** + * Transaction memo size exceeded 100 bytes + */ +Status.MemoTooLong = new Status(8); + +/** + * The fee provided in the transaction is insufficient for this type of transaction + */ +Status.InsufficientTxFee = new Status(9); + +/** + * The payer account has insufficient cryptocurrency to pay the transaction fee + */ +Status.InsufficientPayerBalance = new Status(10); + +/** + * This transaction ID is a duplicate of one that was submitted to this node or reached consensus + * in the last 180 seconds (receipt period) + */ +Status.DuplicateTransaction = new Status(11); + +/** + * If API is throttled out + */ +Status.Busy = new Status(12); + +/** + * The API is not currently supported + */ +Status.NotSupported = new Status(13); + +/** + * The file id is invalid or does not exist + */ +Status.InvalidFileId = new Status(14); + +/** + * The account id is invalid or does not exist + */ +Status.InvalidAccountId = new Status(15); + +/** + * The contract id is invalid or does not exist + */ +Status.InvalidContractId = new Status(16); + +/** + * Transaction id is not valid + */ +Status.InvalidTransactionId = new Status(17); + +/** + * Receipt for given transaction id does not exist + */ +Status.ReceiptNotFound = new Status(18); + +/** + * Record for given transaction id does not exist + */ +Status.RecordNotFound = new Status(19); + +/** + * The solidity id is invalid or entity with this solidity id does not exist + */ +Status.InvalidSolidityId = new Status(20); + +/** + * The responding node has submitted the transaction to the network. Its final status is still + * unknown. + */ +Status.Unknown = new Status(21); + +/** + * The transaction succeeded + */ +Status.Success = new Status(22); + +/** + * There was a system error and the transaction failed because of invalid request parameters. + */ +Status.FailInvalid = new Status(23); + +/** + * There was a system error while performing fee calculation, reserved for future. + */ +Status.FailFee = new Status(24); + +/** + * There was a system error while performing balance checks, reserved for future. + */ +Status.FailBalance = new Status(25); + +/** + * Key not provided in the transaction body + */ +Status.KeyRequired = new Status(26); + +/** + * Unsupported algorithm/encoding used for keys in the transaction + */ +Status.BadEncoding = new Status(27); + +/** + * When the account balance is not sufficient for the transfer + */ +Status.InsufficientAccountBalance = new Status(28); + +/** + * During an update transaction when the system is not able to find the Users Solidity address + */ +Status.InvalidSolidityAddress = new Status(29); + +/** + * Not enough gas was supplied to execute transaction + */ +Status.InsufficientGas = new Status(30); + +/** + * contract byte code size is over the limit + */ +Status.ContractSizeLimitExceeded = new Status(31); + +/** + * local execution (query) is requested for a function which changes state + */ +Status.LocalCallModificationException = new Status(32); + +/** + * Contract REVERT OPCODE executed + */ +Status.ContractRevertExecuted = new Status(33); + +/** + * For any contract execution related error not handled by specific error codes listed above. + */ +Status.ContractExecutionException = new Status(34); + +/** + * In Query validation, account with +ve(amount) value should be Receiving node account, the + * receiver account should be only one account in the list + */ +Status.InvalidReceivingNodeAccount = new Status(35); + +/** + * Header is missing in Query request + */ +Status.MissingQueryHeader = new Status(36); + +/** + * The update of the account failed + */ +Status.AccountUpdateFailed = new Status(37); + +/** + * Provided key encoding was not supported by the system + */ +Status.InvalidKeyEncoding = new Status(38); + +/** + * null solidity address + */ +Status.NullSolidityAddress = new Status(39); + +/** + * update of the contract failed + */ +Status.ContractUpdateFailed = new Status(40); + +/** + * the query header is invalid + */ +Status.InvalidQueryHeader = new Status(41); + +/** + * Invalid fee submitted + */ +Status.InvalidFeeSubmitted = new Status(42); + +/** + * Payer signature is invalid + */ +Status.InvalidPayerSignature = new Status(43); + +/** + * The keys were not provided in the request. + */ +Status.KeyNotProvided = new Status(44); + +/** + * Expiration time provided in the transaction was invalid. + */ +Status.InvalidExpirationTime = new Status(45); + +/** + * WriteAccess Control Keys are not provided for the file + */ +Status.NoWaclKey = new Status(46); + +/** + * The contents of file are provided as empty. + */ +Status.FileContentEmpty = new Status(47); + +/** + * The crypto transfer credit and debit do not sum equal to 0 + */ +Status.InvalidAccountAmounts = new Status(48); + +/** + * Transaction body provided is empty + */ +Status.EmptyTransactionBody = new Status(49); + +/** + * Invalid transaction body provided + */ +Status.InvalidTransactionBody = new Status(50); + +/** + * the type of key (base ed25519 key, KeyList, or ThresholdKey) does not match the type of + * signature (base ed25519 signature, SignatureList, or ThresholdKeySignature) + */ +Status.InvalidSignatureTypeMismatchingKey = new Status(51); + +/** + * the number of key (KeyList, or ThresholdKey) does not match that of signature (SignatureList, + * or ThresholdKeySignature). e.g. if a keyList has 3 base keys, then the corresponding + * signatureList should also have 3 base signatures. + */ +Status.InvalidSignatureCountMismatchingKey = new Status(52); + +/** + * the livehash body is empty + */ +Status.EmptyLiveHashBody = new Status(53); + +/** + * the livehash data is missing + */ +Status.EmptyLiveHash = new Status(54); + +/** + * the keys for a livehash are missing + */ +Status.EmptyLiveHashKeys = new Status(55); + +/** + * the livehash data is not the output of a SHA-384 digest + */ +Status.InvalidLiveHashSize = new Status(56); + +/** + * the query body is empty + */ +Status.EmptyQueryBody = new Status(57); + +/** + * the crypto livehash query is empty + */ +Status.EmptyLiveHashQuery = new Status(58); + +/** + * the livehash is not present + */ +Status.LiveHashNotFound = new Status(59); + +/** + * the account id passed has not yet been created. + */ +Status.AccountIdDoesNotExist = new Status(60); + +/** + * the livehash already exists for a given account + */ +Status.LiveHashAlreadyExists = new Status(61); + +/** + * File WACL keys are invalid + */ +Status.InvalidFileWacl = new Status(62); + +/** + * Serialization failure + */ +Status.SerializationFailed = new Status(63); + +/** + * The size of the Transaction is greater than transactionMaxBytes + */ +Status.TransactionOversize = new Status(64); + +/** + * The Transaction has more than 50 levels + */ +Status.TransactionTooManyLayers = new Status(65); + +/** + * Contract is marked as deleted + */ +Status.ContractDeleted = new Status(66); + +/** + * the platform node is either disconnected or lagging behind. + */ +Status.PlatformNotActive = new Status(67); + +/** + * one public key matches more than one prefixes on the signature map + */ +Status.KeyPrefixMismatch = new Status(68); + +/** + * transaction not created by platform due to large backlog + */ +Status.PlatformTransactionNotCreated = new Status(69); + +/** + * auto renewal period is not a positive number of seconds + */ +Status.InvalidRenewalPeriod = new Status(70); + +/** + * the response code when a smart contract id is passed for a crypto API request + */ +Status.InvalidPayerAccountId = new Status(71); + +/** + * the account has been marked as deleted + */ +Status.AccountDeleted = new Status(72); + +/** + * the file has been marked as deleted + */ +Status.FileDeleted = new Status(73); + +/** + * same accounts repeated in the transfer account list + */ +Status.AccountRepeatedInAccountAmounts = new Status(74); + +/** + * attempting to set negative balance value for crypto account + */ +Status.SettingNegativeAccountBalance = new Status(75); + +/** + * when deleting smart contract that has crypto balance either transfer account or transfer smart + * contract is required + */ +Status.ObtainerRequired = new Status(76); + +/** + * when deleting smart contract that has crypto balance you can not use the same contract id as + * transferContractId as the one being deleted + */ +Status.ObtainerSameContractId = new Status(77); + +/** + * transferAccountId or transferContractId specified for contract delete does not exist + */ +Status.ObtainerDoesNotExist = new Status(78); + +/** + * attempting to modify (update or delete a immutable smart contract, i.e. one created without a + * admin key) + */ +Status.ModifyingImmutableContract = new Status(79); + +/** + * Unexpected exception thrown by file system functions + */ +Status.FileSystemException = new Status(80); + +/** + * the duration is not a subset of [MINIMUM_AUTORENEW_DURATION,MAXIMUM_AUTORENEW_DURATION] + */ +Status.AutorenewDurationNotInRange = new Status(81); + +/** + * Decoding the smart contract binary to a byte array failed. Check that the input is a valid hex + * string. + */ +Status.ErrorDecodingBytestring = new Status(82); + +/** + * File to create a smart contract was of length zero + */ +Status.ContractFileEmpty = new Status(83); + +/** + * Bytecode for smart contract is of length zero + */ +Status.ContractBytecodeEmpty = new Status(84); + +/** + * Attempt to set negative initial balance + */ +Status.InvalidInitialBalance = new Status(85); + +/** + * [Deprecated]. attempt to set negative receive record threshold + */ +Status.InvalidReceiveRecordThreshold = new Status(86); + +/** + * [Deprecated]. attempt to set negative send record threshold + */ +Status.InvalidSendRecordThreshold = new Status(87); + +/** + * Special Account Operations should be performed by only Genesis account, return this code if it + * is not Genesis Account + */ +Status.AccountIsNotGenesisAccount = new Status(88); + +/** + * The fee payer account doesn't have permission to submit such Transaction + */ +Status.PayerAccountUnauthorized = new Status(89); + +/** + * FreezeTransactionBody is invalid + */ +Status.InvalidFreezeTransactionBody = new Status(90); + +/** + * FreezeTransactionBody does not exist + */ +Status.FreezeTransactionBodyNotFound = new Status(91); + +/** + * Exceeded the number of accounts (both from and to) allowed for crypto transfer list + */ +Status.TransferListSizeLimitExceeded = new Status(92); + +/** + * Smart contract result size greater than specified maxResultSize + */ +Status.ResultSizeLimitExceeded = new Status(93); + +/** + * The payer account is not a special account(account 0.0.55) + */ +Status.NotSpecialAccount = new Status(94); + +/** + * Negative gas was offered in smart contract call + */ +Status.ContractNegativeGas = new Status(95); + +/** + * Negative value / initial balance was specified in a smart contract call / create + */ +Status.ContractNegativeValue = new Status(96); + +/** + * Failed to update fee file + */ +Status.InvalidFeeFile = new Status(97); + +/** + * Failed to update exchange rate file + */ +Status.InvalidExchangeRateFile = new Status(98); + +/** + * Payment tendered for contract local call cannot cover both the fee and the gas + */ +Status.InsufficientLocalCallGas = new Status(99); + +/** + * Entities with Entity ID below 1000 are not allowed to be deleted + */ +Status.EntityNotAllowedToDelete = new Status(100); + +/** + * Violating one of these rules: 1) treasury account can update all entities below 0.0.1000, 2) + * account 0.0.50 can update all entities from 0.0.51 - 0.0.80, 3) Network Function Master Account + * A/c 0.0.50 - Update all Network Function accounts & perform all the Network Functions listed + * below, 4) Network Function Accounts: i) A/c 0.0.55 - Update Address Book files (0.0.101/102), + * ii) A/c 0.0.56 - Update Fee schedule (0.0.111), iii) A/c 0.0.57 - Update Exchange Rate + * (0.0.112). + */ +Status.AuthorizationFailed = new Status(101); + +/** + * Fee Schedule Proto uploaded but not valid (append or update is required) + */ +Status.FileUploadedProtoInvalid = new Status(102); + +/** + * Fee Schedule Proto uploaded but not valid (append or update is required) + */ +Status.FileUploadedProtoNotSavedToDisk = new Status(103); + +/** + * Fee Schedule Proto File Part uploaded + */ +Status.FeeScheduleFilePartUploaded = new Status(104); + +/** + * The change on Exchange Rate exceeds Exchange_Rate_Allowed_Percentage + */ +Status.ExchangeRateChangeLimitExceeded = new Status(105); + +/** + * Contract permanent storage exceeded the currently allowable limit + */ +Status.MaxContractStorageExceeded = new Status(106); + +/** + * Transfer Account should not be same as Account to be deleted + */ +Status.TransferAccountSameAsDeleteAccount = new Status(107); + +Status.TotalLedgerBalanceInvalid = new Status(108); +/** + * The expiration date/time on a smart contract may not be reduced + */ +Status.ExpirationReductionNotAllowed = new Status(110); + +/** + * Gas exceeded currently allowable gas limit per transaction + */ +Status.MaxGasLimitExceeded = new Status(111); + +/** + * File size exceeded the currently allowable limit + */ +Status.MaxFileSizeExceeded = new Status(112); + +/** + * When a valid signature is not provided for operations on account with receiverSigRequired=true + */ +Status.ReceiverSigRequired = new Status(113); + +/** + * The Topic ID specified is not in the system. + */ +Status.InvalidTopicId = new Status(150); + +/** + * A provided admin key was invalid. + */ +Status.InvalidAdminKey = new Status(155); + +/** + * A provided submit key was invalid. + */ +Status.InvalidSubmitKey = new Status(156); + +/** + * An attempted operation was not authorized (ie - a deleteTopic for a topic with no adminKey). + */ +Status.Unauthorized = new Status(157); + +/** + * A ConsensusService message is empty. + */ +Status.InvalidTopicMessage = new Status(158); + +/** + * The autoRenewAccount specified is not a valid, active account. + */ +Status.InvalidAutorenewAccount = new Status(159); + +/** + * An adminKey was not specified on the topic, so there must not be an autoRenewAccount. + */ +Status.AutorenewAccountNotAllowed = new Status(160); + +/** + * The topic has expired, was not automatically renewed, and is in a 7 day grace period before the + * topic will be deleted unrecoverably. This error response code will not be returned until + * autoRenew functionality is supported by HAPI. + */ +Status.TopicExpired = new Status(162); + +/** + * chunk number must be from 1 to total (chunks) inclusive. + */ +Status.InvalidChunkNumber = new Status(163); + +/** + * For every chunk, the payer account that is part of initialTransactionID must match the Payer Account of this transaction. The entire initialTransactionID should match the transactionID of the first chunk, but this is not checked or enforced by Hedera except when the chunk number is 1. + */ +Status.InvalidChunkTransactionId = new Status(164); + +/** + * Account is frozen and cannot transact with the token + */ +Status.AccountFrozenForToken = new Status(165); + +/** + * An involved account already has more than tokens.maxPerAccount associations with non-deleted tokens. + */ +Status.TokensPerAccountLimitExceeded = new Status(166); + +/** + * The token is invalid or does not exist + */ +Status.InvalidTokenId = new Status(167); + +/** + * Invalid token decimals + */ +Status.InvalidTokenDecimals = new Status(168); + +/** + * Invalid token initial supply + */ +Status.InvalidTokenInitialSupply = new Status(169); + +/** + * Treasury Account does not exist or is deleted + */ +Status.InvalidTreasuryAccountForToken = new Status(170); + +/** + * Token Symbol is not UTF-8 capitalized alphabetical string + */ +Status.InvalidTokenSymbol = new Status(171); + +/** + * Freeze key is not set on token + */ +Status.TokenHasNoFreezeKey = new Status(172); + +/** + * Amounts in transfer list are not net zero + */ +Status.TransfersNotZeroSumForToken = new Status(173); + +/** + * A token symbol was not provided + */ +Status.MissingTokenSymbol = new Status(174); + +/** + * The provided token symbol was too long + */ +Status.TokenSymbolTooLong = new Status(175); + +/** + * KYC must be granted and account does not have KYC granted + */ +Status.AccountKycNotGrantedForToken = new Status(176); + +/** + * KYC key is not set on token + */ +Status.TokenHasNoKycKey = new Status(177); + +/** + * Token balance is not sufficient for the transaction + */ +Status.InsufficientTokenBalance = new Status(178); + +/** + * Token transactions cannot be executed on deleted token + */ +Status.TokenWasDeleted = new Status(179); + +/** + * Supply key is not set on token + */ +Status.TokenHasNoSupplyKey = new Status(180); + +/** + * Wipe key is not set on token + */ +Status.TokenHasNoWipeKey = new Status(181); + +/** + * The requested token mint amount would cause an invalid total supply + */ +Status.InvalidTokenMintAmount = new Status(182); + +/** + * The requested token burn amount would cause an invalid total supply + */ +Status.InvalidTokenBurnAmount = new Status(183); + +/** + * A required token-account relationship is missing + */ +Status.TokenNotAssociatedToAccount = new Status(184); + +/** + * The target of a wipe operation was the token treasury account + */ +Status.CannotWipeTokenTreasuryAccount = new Status(185); + +/** + * The provided KYC key was invalid. + */ +Status.InvalidKycKey = new Status(186); + +/** + * The provided wipe key was invalid. + */ +Status.InvalidWipeKey = new Status(187); + +/** + * The provided freeze key was invalid. + */ +Status.InvalidFreezeKey = new Status(188); + +/** + * The provided supply key was invalid. + */ +Status.InvalidSupplyKey = new Status(189); + +/** + * Token Name is not provided + */ +Status.MissingTokenName = new Status(190); + +/** + * Token Name is too long + */ +Status.TokenNameTooLong = new Status(191); + +/** + * The provided wipe amount must not be negative, zero or bigger than the token holder balance + */ +Status.InvalidWipingAmount = new Status(192); + +/** + * Token does not have Admin key set, thus update/delete transactions cannot be performed + */ +Status.TokenIsImmutable = new Status(193); + +/** + * An associateToken operation specified a token already associated to the account + */ +Status.TokenAlreadyAssociatedToAccount = new Status(194); + +/** + * An attempted operation is invalid until all token balances for the target account are zero + */ +Status.TransactionRequiresZeroTokenBalances = new Status(195); + +/** + * An attempted operation is invalid because the account is a treasury + */ +Status.AccountIsTreasury = new Status(196); + +/** + * Same TokenIDs present in the token list + */ +Status.TokenIdRepeatedInTokenList = new Status(197); + +/** + * Exceeded the number of token transfers (both from and to) allowed for token transfer list + */ +Status.TokenTransferListSizeLimitExceeded = new Status(198); + +/** + * TokenTransfersTransactionBody has no TokenTransferList + */ +Status.EmptyTokenTransferBody = new Status(199); + +/** + * TokenTransfersTransactionBody has a TokenTransferList with no AccountAmounts + */ +Status.EmptyTokenTransferAccountAmounts = new Status(200); + +/** + * The Scheduled entity does not exist; or has now expired, been deleted, or been executed + */ +Status.InvalidScheduleId = new Status(201); + +/** + * The Scheduled entity cannot be modified. Admin key not set + */ +Status.ScheduleIsImmutable = new Status(202); + +/** + * The provided Scheduled Payer does not exist + */ +Status.InvalidSchedulePayerId = new Status(203); + +/** + * The Schedule Create Transaction TransactionID account does not exist + */ +Status.InvalidScheduleAccountId = new Status(204); + +/** + * The provided sig map did not contain any new valid signatures from required signers of the scheduled transaction + */ +Status.NoNewValidSignatures = new Status(205); + +/** + * The required signers for a scheduled transaction cannot be resolved, for example because they do not exist or have been deleted + */ +Status.UnresolvableRequiredSigners = new Status(206); + +/** + * Only whitelisted transaction types may be scheduled + */ +Status.ScheduledTransactionNotInWhitelist = new Status(207); + +/** + * At least one of the signatures in the provided sig map did not represent a valid signature for any required signer + */ +Status.SomeSignaturesWereInvalid = new Status(208); + +/** + * The scheduled field in the TransactionID may not be set to true + */ +Status.TransactionIdFieldNotAllowed = new Status(209); + +/** + * A schedule already exists with the same identifying fields of an attempted ScheduleCreate (that is, all fields other than scheduledPayerAccountID) + */ +Status.IdenticalScheduleAlreadyCreated = new Status(210); + +/** + * A string field in the transaction has a UTF-8 encoding with the prohibited zero byte + */ +Status.InvalidZeroByteInString = new Status(211); + +/** + * A schedule being signed or deleted has already been deleted + */ +Status.ScheduleAlreadyDeleted = new Status(212); + +/** + * A schedule being signed or deleted has already been executed + */ +Status.ScheduleAlreadyExecuted = new Status(213); + +/** + * ConsensusSubmitMessage request's message size is larger than allowed. + */ +Status.MessageSizeTooLarge = new Status(214); + +/** + * An operation was assigned to more than one throttle group in a given bucket + */ +Status.OperationRepeatedInBucketGroups = new Status(215); + +/** + * The capacity needed to satisfy all opsPerSec groups in a bucket overflowed a signed 8-byte integral type + */ +Status.BucketCapacityOverflow = new Status(216); + +/** + * Given the network size in the address book, the node-level capacity for an operation would never be enough to accept a single request; usually means a bucket burstPeriod should be increased + */ +Status.NodeCapacityNotSufficientForOperation = new Status(217); + +/** + * A bucket was defined without any throttle groups + */ +Status.BucketHasNoThrottleGroups = new Status(218); + +/** + * A throttle group was granted zero opsPerSec + */ +Status.ThrottleGroupHasZeroOpsPerSec = new Status(219); + +/** + * The throttle definitions file was updated, but some supported operations were not assigned a bucket + */ +Status.SuccessButMissingExpectedOperation = new Status(220); + +/** + * The new contents for the throttle definitions system file were not valid protobuf + */ +Status.UnparseableThrottleDefinitions = new Status(221); + +/** + * The new throttle definitions system file were invalid, and no more specific error could be divined + */ +Status.InvalidThrottleDefinitions = new Status(222); + +/** + * The transaction references an account which has passed its expiration without renewal funds available, and currently remains in the ledger only because of the grace period given to expired entities + */ +Status.AccountExpiredAndPendingRemoval = new Status(223); + +/** + * Invalid token max supply + */ +Status.InvalidTokenMaxSupply = new Status(224); + +/** + * Invalid token nft serial number + */ +Status.InvalidTokenNftSerialNumber = new Status(225); + +/** + * Invalid nft id + */ +Status.InvalidNftId = new Status(226); + +/** + * Nft metadata is too long + */ +Status.MetadataTooLong = new Status(227); + +/** + * Repeated operations count exceeds the limit + */ +Status.BatchSizeLimitExceeded = new Status(228); + +/** + * The range of data to be gathered is out of the set boundaries + */ +Status.InvalidQueryRange = new Status(229); + +/** + * A custom fractional fee set a denominator of zero + */ +Status.FractionDividesByZero = new Status(230); + +/** + * The transaction payer could not afford a custom fee + */ +Status.InsufficientPayerBalanceForCustomFee = new Status(231); + +/** + * More than 10 custom fees were specified + */ +Status.CustomFeesListTooLong = new Status(232); + +/** + * Any of the feeCollector accounts for customFees is invalid + */ +Status.InvalidCustomFeeCollector = new Status(233); + +/** + * Any of the token Ids in customFees is invalid + */ +Status.InvalidTokenIdInCustomFees = new Status(234); + +/** + * Any of the token Ids in customFees are not associated to feeCollector + */ +Status.TokenNotAssociatedToFeeCollector = new Status(235); + +/** + * A token cannot have more units minted due to its configured supply ceiling + */ +Status.TokenMaxSupplyReached = new Status(236); + +/** + * The transaction attempted to move an NFT serial number from an account other than its owner + */ +Status.SenderDoesNotOwnNftSerialNo = new Status(237); + +/** + * A custom fee schedule entry did not specify either a fixed or fractional fee + */ +Status.CustomFeeNotFullySpecified = new Status(238); + +/** + * Only positive fees may be assessed at this time + */ +Status.CustomFeeMustBePositive = new Status(239); + +/** + * Fee schedule key is not set on token + */ +Status.TokenHasNoFeeScheduleKey = new Status(240); + +/** + * A fractional custom fee exceeded the range of a 64-bit signed integer + */ +Status.CustomFeeOutsideNumericRange = new Status(241); + +/** + * A royalty cannot exceed the total fungible value exchanged for an NFT + */ +Status.RoyaltyFractionCannotExceedOne = new Status(242); + +/** + * Each fractional custom fee must have its maximum_amount, if specified, at least its minimum_amount + */ +Status.FractionalFeeMaxAmountLessThanMinAmount = new Status(243); + +/** + * A fee schedule update tried to clear the custom fees from a token whose fee schedule was already empty + */ +Status.CustomScheduleAlreadyHasNoFees = new Status(244); + +/** + * Only tokens of type FUNGIBLE_COMMON can be used to as fee schedule denominations + */ +Status.CustomFeeDenominationMustBeFungibleCommon = new Status(245); + +/** + * Only tokens of type FUNGIBLE_COMMON can have fractional fees + */ +Status.CustomFractionalFeeOnlyAllowedForFungibleCommon = new Status(246); + +/** + * The provided custom fee schedule key was invalid + */ +Status.InvalidCustomFeeScheduleKey = new Status(247); + +/** + * The requested token mint metadata was invalid + */ +Status.InvalidTokenMintMetadata = new Status(248); + +/** + * The requested token burn metadata was invalid + */ +Status.InvalidTokenBurnMetadata = new Status(249); + +/** + * The treasury for a unique token cannot be changed until it owns no NFTs + */ +Status.CurrentTreasuryStillOwnsNfts = new Status(250); + +/** + * An account cannot be dissociated from a unique token if it owns NFTs for the token + */ +Status.AccountStillOwnsNfts = new Status(251); + +/** + * A NFT can only be burned when owned by the unique token's treasury + */ +Status.TreasuryMustOwnBurnedNft = new Status(252); + +/** + * An account did not own the NFT to be wiped + */ +Status.AccountDoesNotOwnWipedNft = new Status(253); + +/** + * An AccountAmount token transfers list referenced a token type other than FUNGIBLE_COMMON + */ +Status.AccountAmountTransfersOnlyAllowedForFungibleCommon = new Status(254); + +/** + * All the NFTs allowed in the current price regime have already been minted + */ +Status.MaxNftsInPriceRegimeHaveBeenMinted = new Status(255); + +/** + * The payer account has been marked as deleted + */ +Status.PayerAccountDeleted = new Status(256); + +/** + * The reference chain of custom fees for a transferred token exceeded the maximum length of 2 + */ +Status.CustomFeeChargingExceededMaxRecursionDepth = new Status(257); + +/** + * More than 20 balance adjustments were to satisfy a CryptoTransfer and its implied custom fee payments + */ +Status.CustomFeeChargingExceededMaxAccountAmounts = new Status(258); + +/** + * The sender account in the token transfer transaction could not afford a custom fee + */ +Status.InsufficientSenderAccountBalanceForCustomFee = new Status(259); + +/** + * Currently no more than 4,294,967,295 NFTs may be minted for a given unique token type + */ +Status.SerialNumberLimitReached = new Status(260); + +/** + * Only tokens of type NON_FUNGIBLE_UNIQUE can have royalty fees + */ +Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique = new Status(261); + +/** + * The account has reached the limit on the automatic associations count. + */ +Status.NoRemainingAutomaticAssociations = new Status(262); + +/** + * Already existing automatic associations are more than the new maximum automatic associations. + */ +Status.ExistingAutomaticAssociationsExceedGivenLimit = new Status(263); + +/** + * Cannot set the number of automatic associations for an account more than the maximum allowed + * token associations tokens.maxPerAccount. + */ +Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit = new Status( + 264, +); + +/** + * Token is paused. This Token cannot be a part of any kind of Transaction until unpaused. + */ +Status.TokenIsPaused = new Status(265); + +/** + * Pause key is not set on token + */ +Status.TokenHasNoPauseKey = new Status(266); + +/** + * The provided pause key was invalid + */ +Status.InvalidPauseKey = new Status(267); + +/** + * The update file in a freeze transaction body must exist. + */ +Status.FreezeUpdateFileDoesNotExist = new Status(268); + +/** + * The hash of the update file in a freeze transaction body must match the in-memory hash. + */ +Status.FreezeUpdateFileHashDoesNotMatch = new Status(269); + +/** + * A FREEZE_UPGRADE transaction was handled with no previous update prepared. + */ +Status.NoUpgradeHasBeenPrepared = new Status(270); + +/** + * A FREEZE_ABORT transaction was handled with no scheduled freeze. + */ +Status.NoFreezeIsScheduled = new Status(271); + +/** + * The update file hash when handling a FREEZE_UPGRADE transaction differs from the file + * hash at the time of handling the PREPARE_UPGRADE transaction. + */ +Status.UpdateFileHashChangedSincePrepareUpgrade = new Status(272); + +/** + * The given freeze start time was in the (consensus) past. + */ +Status.FreezeStartTimeMustBeFuture = new Status(273); + +/** + * The prepared update file cannot be updated or appended until either the upgrade has + * been completed, or a FREEZE_ABORT has been handled. + */ +Status.PreparedUpdateFileIsImmutable = new Status(274); + +/** + * Once a freeze is scheduled, it must be aborted before any other type of freeze can + * can be performed. + */ +Status.FreezeAlreadyScheduled = new Status(275); + +/** + * If an NMT upgrade has been prepared, the following operation must be a FREEZE_UPGRADE. + * (To issue a FREEZE_ONLY, submit a FREEZE_ABORT first.) + */ +Status.FreezeUpgradeInProgress = new Status(276); + +/** + * If an NMT upgrade has been prepared, the subsequent FREEZE_UPGRADE transaction must + * confirm the id of the file to be used in the upgrade. + */ +Status.UpdateFileIdDoesNotMatchPrepared = new Status(277); + +/** + * If an NMT upgrade has been prepared, the subsequent FREEZE_UPGRADE transaction must + * confirm the hash of the file to be used in the upgrade. + */ +Status.UpdateFileHashDoesNotMatchPrepared = new Status(278); + +/** + * Consensus throttle did not allow execution of this transaction. System is throttled at + * consensus level. + */ +Status.ConsensusGasExhausted = new Status(279); + +/** + * A precompiled contract succeeded, but was later reverted. + */ +Status.RevertedSuccess = new Status(280); + +/** + * All contract storage allocated to the current price regime has been consumed. + */ +Status.MaxStorageInPriceRegimeHasBeenUsed = new Status(281); + +/** + * An alias used in a CryptoTransfer transaction is not the serialization of a primitive Key + * message--that is, a Key with a single Ed25519 or ECDSA(secp256k1) public key and no + * unknown protobuf fields. + */ +Status.InvalidAliasKey = new Status(282); + +/** + * A fungible token transfer expected a different number of decimals than the involved + * type actually has. + */ +Status.UnexpectedTokenDecimals = new Status(283); + +/** + * The proxy account id is invalid or does not exist. + */ +Status.InvalidProxyAccountId = new Status(284); + +/** + * The transfer account id in CryptoDelete transaction is invalid or does not exist. + */ +Status.InvalidTransferAccountId = new Status(285); + +/** + * The fee collector account id in TokenFeeScheduleUpdate is invalid or does not exist. + */ +Status.InvalidFeeCollectorAccountId = new Status(286); + +/** + * The alias already set on an account cannot be updated using CryptoUpdate transaction. + */ +Status.AliasIsImmutable = new Status(287); + +/** + * An approved allowance specifies a spender account that is the same as the hbar/token + * owner account. + */ +Status.SpenderAccountSameAsOwner = new Status(288); + +/** + * The establishment or adjustment of an approved allowance cause the token allowance + * to exceed the token maximum supply. + */ +Status.AmountExceedsTokenMaxSupply = new Status(289); + +/** + * The specified amount for an approved allowance cannot be negative. + */ +Status.NegativeAllowanceAmount = new Status(290); + +/** + * The approveForAll flag cannot be set for a fungible token. + */ +Status.CannotApproveForAllFungibleCommon = new Status(291); + +/** + * The spender does not have an existing approved allowance with the hbar/token owner. + */ +Status.SpenderDoesNotHaveAllowance = new Status(292); + +/** + * The transfer amount exceeds the current approved allowance for the spender account. + */ +Status.AmountExceedsAllowance = new Status(293); + +/** + * The payer account of an approveAllowances or adjustAllowance transaction is attempting + * to go beyond the maximum allowed number of allowances. + */ +Status.MaxAllowancesExceeded = new Status(294); + +/** + * No allowances have been specified in the approval/adjust transaction. + */ +Status.EmptyAllowances = new Status(295); + +/** + * Spender is repeated more than once in Crypto or Token or NFT allowance lists in a single + * CryptoApproveAllowance or CryptoAdjustAllowance transaction. + */ +Status.SpenderAccountRepeatedInAllowances = new Status(296); + +/** + * Serial numbers are repeated in nft allowance for a single spender account + */ +Status.RepeatedSerialNumsInNftAllowances = new Status(297); + +/** + * Fungible common token used in NFT allowances + */ +Status.FungibleTokenInNftAllowances = new Status(298); + +/** + * Non fungible token used in fungible token allowances + */ +Status.NftInFungibleTokenAllowances = new Status(299); + +/** + * The account id specified as the owner is invalid or does not exist. + */ +Status.InvalidAllowanceOwnerId = new Status(300); + +/** + * The account id specified as the spender is invalid or does not exist. + */ +Status.InvalidAllowanceSpenderId = new Status(301); + +/** + * If the CryptoDeleteAllowance transaction has repeated crypto or token or Nft allowances to delete. + */ +Status.RepeatedAllowancesToDelete = new Status(302); + +/** + * If the account Id specified as the delegating spender is invalid or does not exist. + */ +Status.InvalidDelegatingSpender = new Status(303); + +/** + * The delegating Spender cannot grant approveForAll allowance on a NFT token type for another spender. + */ +Status.DelegatingSpenderCannotGrantApproveForAll = new Status(304); + +/** + * The delegating Spender cannot grant allowance on a NFT serial for another spender as it doesnt not have approveForAll + * granted on token-owner. + */ +Status.DelegatingSpenderDoesNotHaveApproveForAll = new Status(305); + +/** + * The scheduled transaction could not be created because it's expiration_time was too far in the future. + */ +Status.ScheduleExpirationTimeTooFarInFuture = new Status(306); + +/** + * The scheduled transaction could not be created because it's expiration_time was less than or equal to the consensus time. + */ +Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime = new Status(307); + +/** + * The scheduled transaction could not be created because it would cause throttles to be violated on the specified expiration_time. + */ +Status.ScheduleFutureThrottleExceeded = new Status(308); + +/** + * The scheduled transaction could not be created because it would cause the gas limit to be violated on the specified expiration_time. + */ +Status.ScheduleFutureGasLimitExceeded = new Status(309); + +/** + * The ethereum transaction either failed parsing or failed signature validation, or some other EthereumTransaction error not covered by another response code. + */ +Status.InvalidEthereumTransaction = new Status(310); + +/** + * EthereumTransaction was signed against a chainId that this network does not support. + */ +Status.WrongChainId = new Status(311); + +/** + * This transaction specified an ethereumNonce that is not the current ethereumNonce of the account. + */ +Status.WrongNonce = new Status(312); + +/** + * The ethereum transaction specified an access list, which the network does not support. + */ +Status.AccessListUnsupported = new Status(313); + +/** + * The scheduled transaction is pending expiration. + */ +Status.SchedulePendingExpiration = new Status(314); + +/** + * A selfdestruct or ContractDelete targeted a contract that is a token treasury. + */ +Status.ContractIsTokenTreasury = new Status(315); + +/** + * A selfdestruct or ContractDelete targeted a contract with non-zero token balances. + */ +Status.ContractHasNonZeroTokenBalances = new Status(316); + +/** + * A contract referenced by a transaction is "detached"; that is, expired and lacking any + * hbar funds for auto-renewal payment---but still within its post-expiry grace period. + */ +Status.ContractExpiredAndPendingRemoval = new Status(317); + +/** + * A ContractUpdate requested removal of a contract's auto-renew account, but that contract has + * no auto-renew account. + */ +Status.ContractHasNoAutoRenewAccount = new Status(318); + +/** + * A delete transaction submitted via HAPI set permanent_removal=true + */ +Status.PermanentRemovalRequiresSystemInitiation = new Status(319); + +/* + * A CryptoCreate or ContractCreate used the deprecated proxyAccountID field. + */ +Status.ProxyAccountIdFieldIsDeprecated = new Status(320); + +/** + * An account set the staked_account_id to itself in CryptoUpdate or ContractUpdate transactions. + */ +Status.SelfStakingIsNotAllowed = new Status(321); + +/** + * The staking account id or staking node id given is invalid or does not exist. + */ +Status.InvalidStakingId = new Status(322); + +/** + * Native staking, while implemented, has not yet enabled by the council. + */ +Status.StakingNotEnabled = new Status(323); + +/** + * The range provided in PRNG transaction is negative. + */ +Status.InvalidPrngRange = new Status(324); + +/** + * The maximum number of entities allowed in the current price regime have been created. + */ +Status.MaxEntitiesInPriceRegimeHaveBeenCreated = new Status(325); + +/** + * The full prefix signature for precompile is not valid + */ +Status.InvalidFullPrefixSignatureForPrecompile = new Status(326); + +/** + * The combined balances of a contract and its auto-renew account (if any) did not cover + * the rent charged for net new storage used in a transaction. + */ +Status.InsufficientBalancesForStorageRent = new Status(327); + +/** + * A contract transaction tried to use more than the allowed number of child records, via + * either system contract records or internal contract creations. + */ +Status.MaxChildRecordsExceeded = new Status(328); + +/** + * The combined balances of a contract and its auto-renew account (if any) or balance of an account did not cover + * the auto-renewal fees in a transaction. + */ +Status.InsufficientBalancesForRenewalFees = new Status(329); + +/** + * A transaction's protobuf message includes unknown fields; could mean that a client + * expects not-yet-released functionality to be available. + */ +Status.TransactionHasUnknownFields = new Status(330); + +/** + * The account cannot be modified. Account's key is not set + */ +Status.AccountIsImmutable = new Status(331); + +/** + * An alias that is assigned to an account or contract cannot be assigned to another account or contract. + */ +Status.AliasAlreadyAssigned = new Status(332); + +/** + * A provided metadata key was invalid. Verification includes, for example, checking the size of Ed25519 and ECDSA(secp256k1) public keys. + */ +Status.InvalidMetadataKey = new Status(333); + +/** + * Metadata key is not set on token + */ +Status.TokenHasNoMetadataKey = new Status(334); + +/** + * Token Metadata is not provided + */ +Status.MissingTokenMetadata = new Status(335); + +/** + * NFT serial numbers are missing in the TokenUpdateNftsTransactionBody + */ +Status.MissingSerialNumbers = new Status(336); + +/** + * Admin key is not set on token + */ +Status.TokenHasNoAdminKey = new Status(337); + +/** + * The node has been marked as deleted + */ +Status.NodeDeleted = new Status(338); + +/** + * A node is not found during update and delete node transaction + */ +Status.InvalidNodeId = new Status(339); + +/** + * gossip_endpoint has a fully qualified domain name instead of ip + */ +Status.InvalidGossipEndpoint = new Status(340); + +/** + * The node account_id is invalid + */ +Status.InvalidNodeAccountId = new Status(341); + +/** + * The node description is invalid + */ +Status.InvalidNodeDescription = new Status(342); + +/** + * service_endpoint is invalid + */ +Status.InvalidServiceEndpoint = new Status(343); + +/** + * gossip_ca_certificate is invalid + */ +Status.InvalidGossipCaCertificate = new Status(344); + +/** + * grpc_certificate_hash is invalid + */ +Status.InvalidGrpcCertificate = new Status(345); + +/** + * The maximum automatic associations value is not valid. + * The most common cause for this error is a value less than `-1`. + */ +Status.InvalidMaxAutoAssociations = new Status(346); + +/** + * The maximum number of nodes allowed in the address book have been created. + */ +Status.MaxNodesCreated = new Status(347); + +/** + * In ServiceEndpoint, domain_name and ipAddressV4 are mutually exclusive + */ +Status.IpFqdnCannotBeSetForSameEndpoint = new Status(348); + +/** + * Fully qualified domain name is not allowed in gossip_endpoint + */ +Status.GossipEndpointCannotHaveFqdn = new Status(349); + +/** + * In ServiceEndpoint, domain_name size too large + */ +Status.FqdnSizeTooLarge = new Status(350); + +/** + * ServiceEndpoint is invalid + */ +Status.InvalidEndpoint = new Status(351); + +/** + * The number of gossip endpoints exceeds the limit + */ +Status.GossipEndpointsExceededLimit = new Status(352); + +/** + * The transaction attempted to use duplicate `TokenReference`.
+ * This affects `TokenReject` attempting to reject same token reference more than once. + */ +Status.TokenReferenceRepeated = new Status(353); + +/** + * The account id specified as the owner in `TokenReject` is invalid or does not exist. + */ +Status.InvalidOwnerId = new Status(354); + +/** + * The transaction attempted to use more than the allowed number of `TokenReference`. + */ +Status.TokenReferenceListSizeLimitExceeded = new Status(355); + +/** + * The number of service endpoints exceeds the limit + */ +Status.ServiceEndpointsExceededLimit = new Status(356); + +/* + * The IPv4 address is invalid + */ +Status.InvalidIpv4Address = new Status(357); + +/** + * The transaction attempted to use empty `TokenReference` list. + */ +Status.EmptyTokenReferenceList = new Status(358); + +/* + * The node account is not allowed to be updated + */ +Status.UpdateNodeAccountNotAllowed = new Status(359); + +/* + * The token has no metadata or supply key + */ +Status.TokenHasNoMetadataOrSupplyKey = new Status(360); + +/** + * The transaction attempted to the use an empty List of `PendingAirdropId`. + */ +Status.EmptyPendingAirdropIdList = new Status(361); + +/** + * The transaction attempted to the same `PendingAirdropId` twice. + */ +Status.PendingAirdropIdRepeated = new Status(362); + +/** + * The transaction attempted to use more than the allowed number of `PendingAirdropId`. + */ +Status.MaxPendingAirdropIdExceeded = new Status(363); + +/* + * A pending airdrop already exists for the specified NFT. + */ +Status.PendingNftAirdropAlreadyExists = new Status(364); + +/* + * The identified account is sender for one or more pending airdrop(s) + * and cannot be deleted.
+ * Requester should cancel all pending airdrops before resending + * this transaction. + */ +Status.AccountHasPendingAirdrops = new Status(365); + +/** + * Consensus throttle did not allow execution of this transaction.
+ * The transaction should be retried after a modest delay. + */ +Status.ThrottledAtConsensus = new Status(366); + +/** + * The provided pending airdrop id is invalid.
+ * This pending airdrop MAY already be claimed or cancelled. + *

+ * The client SHOULD query a mirror node to determine the current status of + * the pending airdrop. + */ +Status.InvalidPendingAirdropId = new Status(367); + +/** + * The token to be airdropped has a fallback royalty fee and cannot be + * sent or claimed via an airdrop transaction. + */ +Status.TokenAirdropWithFallbackRoyalty = new Status(368); + +/** + * This airdrop claim is for a pending airdrop with an invalid token.
+ * The token might be deleted, or the sender may not have enough tokens + * to fulfill the offer. + *

+ * The client SHOULD query mirror node to determine the status of the pending + * airdrop and whether the sender can fulfill the offer. + */ +Status.InvalidTokenInPendingAirdrop = new Status(369); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EvmAddress.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + */ + +/** + * @typedef {import("./client/Client.js").default<*, *>} Client + */ + +class EvmAddress extends src_Key_Key { + /** + * @internal + * @param {Uint8Array} bytes + */ + constructor(bytes) { + super(); + this._bytes = bytes; + } + + /** + * @param {string} text + * @returns {EvmAddress} + */ + static fromString(text) { + return new EvmAddress(decode(text)); + } + + /** + * @param {Uint8Array} bytes + * @returns {EvmAddress} + */ + static fromBytes(bytes) { + return new EvmAddress(bytes); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return this._bytes; + } + + /** + * @returns {string} + */ + toString() { + return hex_browser_encode(this._bytes); + } + + /** + * @param {EvmAddress} other + * @returns {boolean} + */ + equals(other) { + return arrayEqual(this._bytes, other._bytes); + } +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/bind.js + + +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/utils.js +/* provided dependency */ var process = __webpack_require__(4155); + + + + +// utils is a library of generic helper functions non-specific to axios + +const {toString: utils_toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = utils_toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +} + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const utils_isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const utils_isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +} + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +} + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + } + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +} + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +} + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +} + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +} + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!utils_isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +} + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +} + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +} + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const utils_hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +} + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +} + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + } + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +} + +const noop = () => {} + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +} + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz' + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +} + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0] + } + + return str; +} + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + } + + return visit(obj, 0); +} + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +// original code +// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34 + +const _setImmediate = ((setImmediateSupported, postMessageSupported) => { + if (setImmediateSupported) { + return setImmediate; + } + + return postMessageSupported ? ((token, callbacks) => { + _global.addEventListener("message", ({source, data}) => { + if (source === _global && data === token) { + callbacks.length && callbacks.shift()(); + } + }, false); + + return (cb) => { + callbacks.push(cb); + _global.postMessage(token, "*"); + } + })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb); +})( + typeof setImmediate === 'function', + isFunction(_global.postMessage) +); + +const asap = typeof queueMicrotask !== 'undefined' ? + queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate); + +// ********************* + +/* harmony default export */ var utils = ({ + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString: utils_isString, + isNumber: utils_isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty: utils_hasOwnProperty, + hasOwnProp: utils_hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable, + setImmediate: _setImmediate, + asap +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/AxiosError.js + + + + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + if (response) { + this.response = response; + this.status = response.status ? response.status : null; + } +} + +utils.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils.toJSONObject(this.config), + code: this.code, + status: this.status + }; + } +}); + +const AxiosError_prototype = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(AxiosError_prototype, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(AxiosError_prototype); + + utils.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +/* harmony default export */ var core_AxiosError = (AxiosError); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/null.js +// eslint-disable-next-line strict +/* harmony default export */ var helpers_null = (null); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/toFormData.js + + + + +// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored + + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils.isPlainObject(thing) || utils.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (helpers_null || FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils.isSpecCompliantForm(formData); + + if (!utils.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils.isBlob(value)) { + throw new core_AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils.isArray(value) && isFlatArray(value)) || + ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils.forEach(value, function each(el, key) { + const result = !(utils.isUndefined(el) || el === null) && visitor.call( + formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/* harmony default export */ var helpers_toFormData = (toFormData); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/AxiosURLSearchParams.js + + + + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function AxiosURLSearchParams_encode(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && helpers_toFormData(params, this, options); +} + +const AxiosURLSearchParams_prototype = AxiosURLSearchParams.prototype; + +AxiosURLSearchParams_prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +AxiosURLSearchParams_prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, AxiosURLSearchParams_encode); + } : AxiosURLSearchParams_encode; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/* harmony default export */ var helpers_AxiosURLSearchParams = (AxiosURLSearchParams); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/buildURL.js + + + + + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function buildURL_encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || buildURL_encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils.isURLSearchParams(params) ? + params.toString() : + new helpers_AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/InterceptorManager.js + + + + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +/* harmony default export */ var core_InterceptorManager = (InterceptorManager); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/defaults/transitional.js + + +/* harmony default export */ var defaults_transitional = ({ + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/browser/classes/URLSearchParams.js + + + +/* harmony default export */ var classes_URLSearchParams = (typeof URLSearchParams !== 'undefined' ? URLSearchParams : helpers_AxiosURLSearchParams); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/browser/classes/FormData.js + + +/* harmony default export */ var classes_FormData = (typeof FormData !== 'undefined' ? FormData : null); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/browser/classes/Blob.js + + +/* harmony default export */ var classes_Blob = (typeof Blob !== 'undefined' ? Blob : null); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/browser/index.js + + + + +/* harmony default export */ var browser = ({ + isBrowser: true, + classes: { + URLSearchParams: classes_URLSearchParams, + FormData: classes_FormData, + Blob: classes_Blob + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/common/utils.js +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +const _navigator = typeof navigator === 'object' && navigator || undefined; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = hasBrowserEnv && + (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + + + +;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/index.js + + + +/* harmony default export */ var platform = ({ + ...common_utils_namespaceObject, + ...browser +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/toURLEncodedForm.js + + + + + + +function toURLEncodedForm(data, options) { + return helpers_toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/formDataToJSON.js + + + + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils.isArray(target) ? target.length : name; + + if (isLast) { + if (utils.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils.isFormData(formData) && utils.isFunction(formData.entries)) { + const obj = {}; + + utils.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +/* harmony default export */ var helpers_formDataToJSON = (formDataToJSON); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/defaults/index.js + + + + + + + + + + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: defaults_transitional, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils.isObject(data); + + if (isObjectPayload && utils.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(helpers_formDataToJSON(data)) : data; + } + + if (utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) || + utils.isReadableStream(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return helpers_toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils.isResponse(data) || utils.isReadableStream(data)) { + return data; + } + + if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw core_AxiosError.from(e, core_AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +/* harmony default export */ var lib_defaults = (defaults); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/parseHeaders.js + + + + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +/* harmony default export */ var parseHeaders = (rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/AxiosHeaders.js + + + + + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils.isString(value)) return; + + if (utils.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite) + } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils.forEach(this, (value, header) => { + const key = utils.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils.freezeMethods(AxiosHeaders); + +/* harmony default export */ var core_AxiosHeaders = (AxiosHeaders); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/transformData.js + + + + + + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || lib_defaults; + const context = response || config; + const headers = core_AxiosHeaders.from(context.headers); + let data = context.data; + + utils.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/cancel/isCancel.js + + +function isCancel(value) { + return !!(value && value.__CANCEL__); +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/cancel/CanceledError.js + + + + + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + core_AxiosError.call(this, message == null ? 'canceled' : message, core_AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils.inherits(CanceledError, core_AxiosError, { + __CANCEL__: true +}); + +/* harmony default export */ var cancel_CanceledError = (CanceledError); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/settle.js + + + + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new core_AxiosError( + 'Request failed with status code ' + response.status, + [core_AxiosError.ERR_BAD_REQUEST, core_AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/parseProtocol.js + + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/speedometer.js + + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +/* harmony default export */ var helpers_speedometer = (speedometer); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/throttle.js +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + let threshold = 1000 / freq; + let lastArgs; + let timer; + + const invoke = (args, now = Date.now()) => { + timestamp = now; + lastArgs = null; + if (timer) { + clearTimeout(timer); + timer = null; + } + fn.apply(null, args); + } + + const throttled = (...args) => { + const now = Date.now(); + const passed = now - timestamp; + if ( passed >= threshold) { + invoke(args, now); + } else { + lastArgs = args; + if (!timer) { + timer = setTimeout(() => { + timer = null; + invoke(lastArgs) + }, threshold - passed); + } + } + } + + const flush = () => lastArgs && invoke(lastArgs); + + return [throttled, flush]; +} + +/* harmony default export */ var helpers_throttle = (throttle); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/progressEventReducer.js + + + + +const progressEventReducer = (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = helpers_speedometer(50, 250); + + return helpers_throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null, + [isDownloadStream ? 'download' : 'upload']: true + }; + + listener(data); + }, freq); +} + +const progressEventDecorator = (total, throttled) => { + const lengthComputable = total != null; + + return [(loaded) => throttled[0]({ + lengthComputable, + total, + loaded + }), throttled[1]]; +} + +const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args)); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/isURLSameOrigin.js + + + + + +/* harmony default export */ var isURLSameOrigin = (platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })()); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/cookies.js + + + +/* harmony default export */ var cookies = (platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils.isString(path) && cookie.push('path=' + path); + + utils.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }); + + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/isAbsoluteURL.js + + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/combineURLs.js + + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/buildFullPath.js + + + + + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/mergeConfig.js + + + + + +const headersToObject = (thing) => thing instanceof core_AxiosHeaders ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge.call({caseless}, target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/resolveConfig.js + + + + + + + + + +/* harmony default export */ var resolveConfig = ((config) => { + const newConfig = mergeConfig({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = core_AxiosHeaders.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +}); + + +;// CONCATENATED MODULE: ./node_modules/axios/lib/adapters/xhr.js + + + + + + + + + + + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +/* harmony default export */ var xhr = (isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = core_AxiosHeaders.from(_config.headers).normalize(); + let {responseType, onUploadProgress, onDownloadProgress} = _config; + let onCanceled; + let uploadThrottled, downloadThrottled; + let flushUpload, flushDownload; + + function done() { + flushUpload && flushUpload(); // flush events + flushDownload && flushDownload(); // flush events + + _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled); + + _config.signal && _config.signal.removeEventListener('abort', onCanceled); + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = core_AxiosHeaders.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new core_AxiosError('Request aborted', core_AxiosError.ECONNABORTED, config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || defaults_transitional; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new core_AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? core_AxiosError.ETIMEDOUT : core_AxiosError.ECONNABORTED, + config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (onDownloadProgress) { + ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true)); + request.addEventListener('progress', downloadThrottled); + } + + // Not all browsers support upload events + if (onUploadProgress && request.upload) { + ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress)); + + request.upload.addEventListener('progress', uploadThrottled); + + request.upload.addEventListener('loadend', flushUpload); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new cancel_CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new core_AxiosError('Unsupported protocol ' + protocol + ':', core_AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/composeSignals.js + + + + +const composeSignals = (signals, timeout) => { + const {length} = (signals = signals ? signals.filter(Boolean) : []); + + if (timeout || length) { + let controller = new AbortController(); + + let aborted; + + const onabort = function (reason) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = reason instanceof Error ? reason : this.reason; + controller.abort(err instanceof core_AxiosError ? err : new cancel_CanceledError(err instanceof Error ? err.message : err)); + } + } + + let timer = timeout && setTimeout(() => { + timer = null; + onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT)) + }, timeout) + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort); + }); + signals = null; + } + } + + signals.forEach((signal) => signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = () => utils.asap(unsubscribe); + + return signal; + } +} + +/* harmony default export */ var helpers_composeSignals = (composeSignals); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/trackStream.js + +const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +} + +const readBytes = async function* (iterable, chunkSize) { + for await (const chunk of readStream(iterable)) { + yield* streamChunk(chunk, chunkSize); + } +} + +const readStream = async function* (stream) { + if (stream[Symbol.asyncIterator]) { + yield* stream; + return; + } + + const reader = stream.getReader(); + try { + for (;;) { + const {done, value} = await reader.read(); + if (done) { + break; + } + yield value; + } + } finally { + await reader.cancel(); + } +} + +const trackStream = (stream, chunkSize, onProgress, onFinish) => { + const iterator = readBytes(stream, chunkSize); + + let bytes = 0; + let done; + let _onFinish = (e) => { + if (!done) { + done = true; + onFinish && onFinish(e); + } + } + + return new ReadableStream({ + async pull(controller) { + try { + const {done, value} = await iterator.next(); + + if (done) { + _onFinish(); + controller.close(); + return; + } + + let len = value.byteLength; + if (onProgress) { + let loadedBytes = bytes += len; + onProgress(loadedBytes); + } + controller.enqueue(new Uint8Array(value)); + } catch (err) { + _onFinish(err); + throw err; + } + }, + cancel(reason) { + _onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/adapters/fetch.js + + + + + + + + + + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const test = (fn, ...args) => { + try { + return !!fn(...args); + } catch (e) { + return false + } +} + +const supportsRequestStream = isReadableStreamSupported && test(() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +}); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && + test(() => utils.isReadableStream(new Response('').body)); + + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new core_AxiosError(`Response type '${type}' is not supported`, core_AxiosError.ERR_NOT_SUPPORT, config); + }) + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils.isBlob(body)) { + return body.size; + } + + if(utils.isSpecCompliantForm(body)) { + const _request = new Request(platform.origin, { + method: 'POST', + body, + }); + return (await _request.arrayBuffer()).byteLength; + } + + if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) { + return body.byteLength; + } + + if(utils.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils.isString(body)) { + return (await encodeText(body)).byteLength; + } +} + +const resolveBodyLength = async (headers, body) => { + const length = utils.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +} + +/* harmony default export */ var adapters_fetch = (isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let composedSignal = helpers_composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout); + + let request; + + const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => { + composedSignal.unsubscribe(); + }); + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader) + } + + if (_request.body) { + const [onProgress, flush] = progressEventDecorator( + requestContentLength, + progressEventReducer(asyncDecorator(onUploadProgress)) + ); + + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush); + } + } + + if (!utils.isString(withCredentials)) { + withCredentials = withCredentials ? 'include' : 'omit'; + } + + // Cloudflare Workers throws when credentials are defined + // see https://github.com/cloudflare/workerd/issues/902 + const isCredentialsSupported = "credentials" in Request.prototype; + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + credentials: isCredentialsSupported ? withCredentials : undefined + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length')); + + const [onProgress, flush] = onDownloadProgress && progressEventDecorator( + responseContentLength, + progressEventReducer(asyncDecorator(onDownloadProgress), true) + ) || []; + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { + flush && flush(); + unsubscribe && unsubscribe(); + }), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && unsubscribe && unsubscribe(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: core_AxiosHeaders.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }) + }) + } catch (err) { + unsubscribe && unsubscribe(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw core_AxiosError.from(err, err && err.code, config, request); + } +})); + + + +;// CONCATENATED MODULE: ./node_modules/axios/lib/adapters/adapters.js + + + + + + +const knownAdapters = { + http: helpers_null, + xhr: xhr, + fetch: adapters_fetch +} + +utils.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false; + +/* harmony default export */ var adapters = ({ + getAdapter: (adapters) => { + adapters = utils.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new core_AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new core_AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/dispatchRequest.js + + + + + + + + + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new cancel_CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = core_AxiosHeaders.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || lib_defaults.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = core_AxiosHeaders.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = core_AxiosHeaders.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/env/data.js +const VERSION = "1.7.7"; +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/validator.js + + + + + +const validators = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new core_AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + core_AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new core_AxiosError('options must be an object', core_AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new core_AxiosError('option ' + opt + ' must be ' + result, core_AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new core_AxiosError('Unknown option ' + opt, core_AxiosError.ERR_BAD_OPTION); + } + } +} + +/* harmony default export */ var validator = ({ + assertOptions, + validators +}); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/core/Axios.js + + + + + + + + + + + +const Axios_validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new core_InterceptorManager(), + response: new core_InterceptorManager() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: Axios_validators.transitional(Axios_validators.boolean), + forcedJSONParsing: Axios_validators.transitional(Axios_validators.boolean), + clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + } + } else { + validator.assertOptions(paramsSerializer, { + encode: Axios_validators.function, + serialize: Axios_validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils.merge( + headers.common, + headers[config.method] + ); + + headers && utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = core_AxiosHeaders.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +/* harmony default export */ var core_Axios = (Axios); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/cancel/CancelToken.js + + + + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new cancel_CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + toAbortSignal() { + const controller = new AbortController(); + + const abort = (err) => { + controller.abort(err); + }; + + this.subscribe(abort); + + controller.signal.unsubscribe = () => this.unsubscribe(abort); + + return controller.signal; + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +/* harmony default export */ var cancel_CancelToken = (CancelToken); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/spread.js + + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/isAxiosError.js + + + + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError(payload) { + return utils.isObject(payload) && (payload.isAxiosError === true); +} + +;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/HttpStatusCode.js +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +/* harmony default export */ var helpers_HttpStatusCode = (HttpStatusCode); + +;// CONCATENATED MODULE: ./node_modules/axios/lib/axios.js + + + + + + + + + + + + + + + + + + + + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new core_Axios(defaultConfig); + const instance = bind(core_Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, core_Axios.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(lib_defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = core_Axios; + +// Expose Cancel & CancelToken +axios.CanceledError = cancel_CanceledError; +axios.CancelToken = cancel_CancelToken; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = helpers_toFormData; + +// Expose AxiosError class +axios.AxiosError = core_AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = core_AxiosHeaders; + +axios.formToJSON = thing => helpers_formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = helpers_HttpStatusCode; + +axios.default = axios; + +// this module should only have a default export +/* harmony default export */ var lib_axios = (axios); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * The ID for a crypto-currency account on Hedera. + */ +class AccountId_AccountId { + /** + * @param {number | Long | import("../EntityIdHelper").IEntityId} props + * @param {(number | Long)=} realm + * @param {(number | Long)=} num + * @param {(PublicKey)=} aliasKey + * @param {(EvmAddress)=} evmAddress + */ + constructor(props, realm, num, aliasKey, evmAddress) { + const result = EntityIdHelper_constructor(props, realm, num); + + this.shard = result.shard; + this.realm = result.realm; + this.num = result.num; + this.aliasKey = aliasKey != null ? aliasKey : null; + this.evmAddress = evmAddress != null ? evmAddress : null; + + /** + * @type {string | null} + */ + this._checksum = null; + } + + /** + * @description Accepts the following formats as string: + * - as stand alone nubmers + * - as shard.realm.num + * - as shard.realm.hex (wo 0x prefix) + * - hex (w/wo 0x prefix) + * @param {string} text + * @returns {AccountId} + */ + static fromString(text) { + let shard = src_long.ZERO; + let realm = src_long.ZERO; + let num = src_long.ZERO; + let aliasKey = undefined; + let evmAddress = undefined; + + if ((text.startsWith("0x") && text.length == 42) || text.length == 40) { + evmAddress = EvmAddress.fromString(text); + } else { + const result = fromStringSplitter(text); + + if (Number.isNaN(result.shard) || Number.isNaN(result.realm)) { + throw new Error("invalid format for entity ID"); + } + + if (result.shard != null) shard = src_long.fromString(result.shard); + if (result.realm != null) realm = src_long.fromString(result.realm); + + if (result.numOrHex.length < 20) { + num = src_long.fromString(result.numOrHex); + } else if (result.numOrHex.length == 40) { + evmAddress = EvmAddress.fromString(result.numOrHex); + } else { + aliasKey = src_PublicKey_PublicKey.fromString(result.numOrHex); + } + } + + return new AccountId_AccountId(shard, realm, num, aliasKey, evmAddress); + } + + /** + * @description This handles both long-zero format and evm address format addresses. + * If an actual evm address is passed, please use `AccountId.populateAccountNum(client)` method + * to get the actual `num` value, since there is no cryptographic relation to the evm address + * and cannot be populated directly + * @param {Long | number} shard + * @param {Long | number} realm + * @param {EvmAddress | string} evmAddress + * @returns {AccountId} + */ + static fromEvmAddress(shard, realm, evmAddress) { + const evmAddressObj = + typeof evmAddress === "string" + ? EvmAddress.fromString(evmAddress) + : evmAddress; + + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + if (isLongZeroAddress(evmAddressObj.toBytes())) { + // eslint-disable-next-line deprecation/deprecation + return this.fromSolidityAddress(evmAddressObj.toString()); + } else { + return new AccountId_AccountId(shard, realm, 0, undefined, evmAddressObj); + } + } + + /** + * @deprecated - Use `fromEvmAddress` instead + * @summary Accepts an evm address only as `EvmAddress` type + * @param {EvmAddress} evmAddress + * @returns {AccountId} + */ + static fromEvmPublicAddress(evmAddress) { + return new AccountId_AccountId(0, 0, 0, undefined, evmAddress); + } + + /** + * @internal + * @param {HashgraphProto.proto.IAccountID} id + * @returns {AccountId} + */ + static _fromProtobuf(id) { + let aliasKey = undefined; + let evmAddress = undefined; + + if (id.alias != null) { + if (id.alias.length === 20) { + evmAddress = EvmAddress.fromBytes(id.alias); + } else { + aliasKey = src_Key_Key._fromProtobufKey( + lib.proto.Key.decode(id.alias), + ); + } + } + + if (!(aliasKey instanceof src_PublicKey_PublicKey)) { + aliasKey = undefined; + } + + return new AccountId_AccountId( + id.shardNum != null ? id.shardNum : 0, + id.realmNum != null ? id.realmNum : 0, + id.accountNum != null ? id.accountNum : 0, + aliasKey, + evmAddress, + ); + } + + /** + * @returns {string | null} + */ + get checksum() { + return this._checksum; + } + + /** + * @returns {?EvmAddress} + */ + getEvmAddress() { + return this.evmAddress; + } + + /** + * @description Gets the actual `num` field of the `AccountId` from the Mirror Node. + * Should be used after generating `AccountId.fromEvmAddress()` because it sets the `num` field to `0` + * automatically since there is no connection between the `num` and the `evmAddress` + * @param {Client} client + * @returns {Promise} + */ + async populateAccountNum(client) { + if (this.evmAddress === null) { + throw new Error("field `evmAddress` should not be null"); + } + const mirrorUrl = client.mirrorNetwork[0].slice( + 0, + client.mirrorNetwork[0].indexOf(":"), + ); + + await new Promise((resolve) => { + setTimeout(resolve, 3000); + }); + + /* eslint-disable */ + const url = `https://${mirrorUrl}/api/v1/accounts/${this.evmAddress.toString()}`; + const mirrorAccountId = (await lib_axios.get(url)).data.account; + + this.num = src_long.fromString( + mirrorAccountId.slice(mirrorAccountId.lastIndexOf(".") + 1), + ); + /* eslint-enable */ + + return this; + } + + /** + * @description Populates `evmAddress` field of the `AccountId` extracted from the Mirror Node. + * @param {Client} client + * @returns {Promise} + */ + async populateAccountEvmAddress(client) { + if (this.num === null) { + throw new Error("field `num` should not be null"); + } + const mirrorUrl = client.mirrorNetwork[0].slice( + 0, + client.mirrorNetwork[0].indexOf(":"), + ); + + await new Promise((resolve) => { + setTimeout(resolve, 3000); + }); + + /* eslint-disable */ + const url = `https://${mirrorUrl}/api/v1/accounts/${this.num.toString()}`; + const mirrorAccountId = (await lib_axios.get(url)).data.evm_address; + + this.evmAddress = EvmAddress.fromString(mirrorAccountId); + /* eslint-enable */ + + return this; + } + + /** + * @deprecated - Use `validateChecksum` instead + * @param {Client} client + */ + validate(client) { + console.warn("Deprecated: Use `validateChecksum` instead"); + this.validateChecksum(client); + } + + /** + * @param {Client} client + */ + validateChecksum(client) { + if (this.aliasKey != null) { + throw new Error( + "cannot calculate checksum with an account ID that has a aliasKey", + ); + } + + validateChecksum( + this.shard, + this.realm, + this.num, + this._checksum, + client, + ); + } + + /** + * @param {Uint8Array} bytes + * @returns {AccountId} + */ + static fromBytes(bytes) { + return AccountId_AccountId._fromProtobuf( + lib.proto.AccountID.decode(bytes), + ); + } + + /** + * @deprecated - Use `fromEvmAddress` instead + * @param {string} address + * @returns {AccountId} + */ + static fromSolidityAddress(address) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + if (isLongZeroAddress(decode(address))) { + return new AccountId_AccountId(...fromSolidityAddress(address)); + } else { + return this.fromEvmAddress(0, 0, address); + } + } + + /** + * @returns {string} + */ + toSolidityAddress() { + if (this.evmAddress != null) { + return this.evmAddress.toString(); + } else if ( + this.aliasKey != null && + this.aliasKey._key._type == "secp256k1" + ) { + return this.aliasKey.toEvmAddress(); + } else { + return toSolidityAddress([ + this.shard, + this.realm, + this.num, + ]); + } + } + + //TODO remove the comments after we get to HIP-631 + /** + * @internal + * @returns {HashgraphProto.proto.IAccountID} + */ + _toProtobuf() { + let alias = null; + //let evmAddress = null; + + if (this.aliasKey != null) { + alias = lib.proto.Key.encode( + this.aliasKey._toProtobufKey(), + ).finish(); + } else if (this.evmAddress != null) { + alias = this.evmAddress._bytes; + } + + /* if (this.evmAddress != null) { + evmAddress = this.evmAddress._bytes; + } */ + + return { + alias, + accountNum: this.aliasKey != null ? null : this.num, + shardNum: this.shard, + realmNum: this.realm, + //evmAddress, + }; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.AccountID.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {string} + */ + toString() { + let account = this.num.toString(); + + if (this.aliasKey != null) { + account = this.aliasKey.toString(); + } else if (this.evmAddress != null) { + account = this.evmAddress.toString(); + } + + return `${this.shard.toString()}.${this.realm.toString()}.${account}`; + } + + /** + * @param {Client} client + * @returns {string} + */ + toStringWithChecksum(client) { + if (this.aliasKey != null) { + throw new Error( + "cannot calculate checksum with an account ID that has a aliasKey", + ); + } + + return toStringWithChecksum(this.toString(), client); + } + + /** + * @param {this} other + * @returns {boolean} + */ + equals(other) { + let account = false; + + if (this.aliasKey != null && other.aliasKey != null) { + account = this.aliasKey.equals(other.aliasKey); + } else if (this.evmAddress != null && other.evmAddress != null) { + account = this.evmAddress.equals(other.evmAddress); + } else if ( + this.aliasKey == null && + other.aliasKey == null && + this.evmAddress == null && + other.evmAddress == null + ) { + account = this.num.eq(other.num); + } + + return ( + this.shard.eq(other.shard) && this.realm.eq(other.realm) && account + ); + } + + /** + * @returns {AccountId} + */ + clone() { + const id = new AccountId_AccountId(this); + id._checksum = this._checksum; + id.aliasKey = this.aliasKey; + id.evmAddress = this.evmAddress; + return id; + } + + /** + * @param {AccountId} other + * @returns {number} + */ + compare(other) { + let comparison = this.shard.compare(other.shard); + if (comparison != 0) { + return comparison; + } + + comparison = this.realm.compare(other.realm); + if (comparison != 0) { + return comparison; + } + + if (this.aliasKey != null && other.aliasKey != null) { + const t = this.aliasKey.toString(); + const o = other.aliasKey.toString(); + + if (t > o) { + return 1; + } else if (t < o) { + return -1; + } else { + return 0; + } + } else if (this.evmAddress != null && other.evmAddress != null) { + const t = this.evmAddress.toString(); + const o = other.evmAddress.toString(); + + if (t > o) { + return 1; + } else if (t < o) { + return -1; + } else { + return 0; + } + } else if ( + this.aliasKey == null && + other.aliasKey == null && + this.evmAddress == null && + other.evmAddress == null + ) { + return this.num.compare(other.num); + } else { + return 1; + } + } +} + +src_Cache.setAccountIdConstructor( + (shard, realm, key) => new AccountId_AccountId(shard, realm, src_long.ZERO, key), +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/grpc/GrpcStatus.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +class GrpcStatus { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @internal + * @param {number} code + * @returns {GrpcStatus} + */ + static _fromValue(code) { + switch (code) { + case 0: + return GrpcStatus.Ok; + case 1: + return GrpcStatus.Cancelled; + case 2: + return GrpcStatus.Unknown; + case 3: + return GrpcStatus.InvalidArgument; + case 4: + return GrpcStatus.DeadlineExceeded; + case 5: + return GrpcStatus.NotFound; + case 6: + return GrpcStatus.AlreadyExists; + case 7: + return GrpcStatus.PermissionDenied; + case 8: + return GrpcStatus.ResourceExhausted; + case 9: + return GrpcStatus.FailedPrecondition; + case 10: + return GrpcStatus.Aborted; + case 11: + return GrpcStatus.OutOfRange; + case 12: + return GrpcStatus.Unimplemented; + case 13: + return GrpcStatus.Internal; + case 14: + return GrpcStatus.Unavailable; + case 15: + return GrpcStatus.DataLoss; + case 16: + return GrpcStatus.Unauthenticated; + case 17: + return GrpcStatus.Timeout; + case 18: + return GrpcStatus.GrpcWeb; + default: + throw new Error( + "(BUG) non-exhaustive GrpcStatus switch statement", + ); + } + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case GrpcStatus.Ok: + return "OK"; + case GrpcStatus.Cancelled: + return "CANCELLED"; + case GrpcStatus.Unknown: + return "UNKNOWN"; + case GrpcStatus.InvalidArgument: + return "INVALID_ARGUMENT"; + case GrpcStatus.DeadlineExceeded: + return "DEADLINE_EXCEEDED"; + case GrpcStatus.NotFound: + return "NOT_FOUND"; + case GrpcStatus.AlreadyExists: + return "ALREADY_EXISTS"; + case GrpcStatus.PermissionDenied: + return "PERMISSION_DENIED"; + case GrpcStatus.Unauthenticated: + return "UNAUTHENTICATED"; + case GrpcStatus.ResourceExhausted: + return "RESOURCE_EXHAUSTED"; + case GrpcStatus.FailedPrecondition: + return "FAILED_PRECONDITION"; + case GrpcStatus.Aborted: + return "ABORTED"; + case GrpcStatus.OutOfRange: + return "OUT_OF_RANGE"; + case GrpcStatus.Unimplemented: + return "UNIMPLEMENTED"; + case GrpcStatus.Internal: + return "INTERNAL"; + case GrpcStatus.Unavailable: + return "UNAVAILABLE"; + case GrpcStatus.DataLoss: + return "DATA_LOSS"; + case GrpcStatus.Timeout: + return "TIMEOUT"; + case GrpcStatus.GrpcWeb: + return "GRPC_WEB"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @returns {number} + */ + valueOf() { + return this._code; + } +} + +GrpcStatus.Ok = new GrpcStatus(0); +GrpcStatus.Cancelled = new GrpcStatus(1); +GrpcStatus.Unknown = new GrpcStatus(2); +GrpcStatus.InvalidArgument = new GrpcStatus(3); +GrpcStatus.DeadlineExceeded = new GrpcStatus(4); +GrpcStatus.NotFound = new GrpcStatus(5); +GrpcStatus.AlreadyExists = new GrpcStatus(6); +GrpcStatus.PermissionDenied = new GrpcStatus(7); +GrpcStatus.ResourceExhausted = new GrpcStatus(8); +GrpcStatus.FailedPrecondition = new GrpcStatus(9); +GrpcStatus.Aborted = new GrpcStatus(10); +GrpcStatus.OutOfRange = new GrpcStatus(11); +GrpcStatus.Unimplemented = new GrpcStatus(12); +GrpcStatus.Internal = new GrpcStatus(13); +GrpcStatus.Unavailable = new GrpcStatus(14); +GrpcStatus.DataLoss = new GrpcStatus(15); +GrpcStatus.Unauthenticated = new GrpcStatus(16); +GrpcStatus.Timeout = new GrpcStatus(17); +GrpcStatus.GrpcWeb = new GrpcStatus(18); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/grpc/GrpcServiceError.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * Describes how the gRPC request failed. + * + * Exists in order for the Hedera JavaScript SDK to produce the same error type for gRPC errors regardless of + * operating in node or the browser. + * + * Definition taken from . + */ +class GrpcServiceError extends Error { + /** + * @param {GrpcStatus} status + */ + constructor(status) { + super( + `gRPC service failed with: Status: ${status.toString()}, Code: ${status.valueOf()}`, + ); + + /** + * @readonly + */ + this.status = status; + + this.name = "GrpcServiceError"; + + if (typeof Error.captureStackTrace !== "undefined") { + Error.captureStackTrace(this, GrpcServiceError); + } + } + + /** + * @param {Error & { code?: number; details?: string }} obj + * @returns {Error} + */ + static _fromResponse(obj) { + if (obj.code != null && obj.details != null) { + const status = GrpcStatus._fromValue(obj.code); + const err = new GrpcServiceError(status); + err.stack += `\nCaused by: ${ + obj.stack ? obj.stack.toString() : "" + }`; + err.message += `: ${obj.details}`; + return err; + } else { + return /** @type {Error} */ (obj); + } + } + + /** + * @returns {string} + */ + toString() { + return `${this.name}: ${this.message}`; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/List.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * A custom list type which round robins, supports locking, and as additional + * QoL improvements. + * + * @template {any} T + */ +class List { + constructor() { + /** @type {T[]} */ + this.list = []; + this.locked = false; + this.index = 0; + } + + /** + * Overwrite the entire list. + * + * @throws if the list is locked + * @param {T[]} list + * @returns {this} + */ + setList(list) { + if (this.locked) { + throw new Error("list is locked"); + } + + this.list = list; + this.index = 0; + + return this; + } + + /** + * Push items to the end of the list. + * + * @throws if the list is locked + * @param {T[]} items + * @returns {this} + */ + push(...items) { + if (this.locked) { + throw new Error("list is locked"); + } + + this.list.push(...items); + return this; + } + + /** + * Locks the list. + * + * @returns {this} + */ + setLocked() { + this.locked = true; + return this; + } + + /** + * Clear the list + */ + clear() { + this.list = []; + this.index = 0; + } + + /** + * The get value at a particular index. + * + * @param {number} index + * @returns {T} + */ + get(index) { + return this.list[index]; + } + + /** + * Set value at index + * + * @param {number} index + * @param {T} item + * @returns {this} + */ + set(index, item) { + // QoL: If the index is at the end simply push the element to the end + if (index === this.length) { + this.list.push(item); + } else { + this.list[index] = item; + } + + return this; + } + + /** + * Set value at index if it's not already set + * + * @throws if the list is locked + * @param {number} index + * @param {() => T} lambda + * @returns {this} + */ + setIfAbsent(index, lambda) { + if (index == this.length || this.list[index] == null) { + this.set(index, lambda()); + } + + return this; + } + + /** + * Get the current value, and advance the index + * + * @returns {T} + */ + get next() { + return this.get(this.advance()); + } + + /** + * Get the current value. + * + * @returns {T} + */ + get current() { + return this.get(this.index); + } + + /** + * Advance the index to the next element in a round robin fashion + * + * @returns {number} + */ + advance() { + const index = this.index; + this.index = (this.index + 1) % this.list.length; + return index; + } + + /** + * Is the list empty + * + * @returns {boolean} + */ + get isEmpty() { + return this.length === 0; + } + + /** + * Get the length of the list + * + * @returns {number} + */ + get length() { + return this.list.length; + } + + /** + * Shallow clone this list. + * Perhaps we should explicitly call this `shallowClone()` since it doesn't + * clone the list inside? + * + * @returns {List} + */ + clone() { + /** @type {List} */ + const list = new List(); + list.list = this.list; + list.locked = this.locked; + return list; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/http/HttpError.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars + + +/** + * Describes how the http request failed. + */ +class HttpError extends Error { + /** + * @param {HttpStatus} status + */ + constructor(status) { + super(`failed with error code: ${status.toString()}`); + + /** + * @readonly + */ + this.status = status; + + this.name = "HttpError"; + + if (typeof Error.captureStackTrace !== "undefined") { + Error.captureStackTrace(this, HttpError); + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Executable.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + +/** + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./channel/Channel.js").default} Channel + * @typedef {import("./channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("./client/Client.js").ClientOperator} ClientOperator + * @typedef {import("./Signer.js").Signer} Signer + * @typedef {import("./PublicKey.js").default} PublicKey + * @typedef {import("./logger/Logger.js").default} Logger + */ + +/** + * @enum {string} + */ +const ExecutionState = { + Finished: "Finished", + Retry: "Retry", + Error: "Error", +}; + +const Executable_RST_STREAM = /\brst[^0-9a-zA-Z]stream\b/i; +const DEFAULT_MAX_ATTEMPTS = 10; + +/** + * @abstract + * @internal + * @template RequestT + * @template ResponseT + * @template OutputT + */ +class Executable { + constructor() { + /** + * The number of times we can retry the grpc call + * + * @internal + * @type {number} + */ + this._maxAttempts = DEFAULT_MAX_ATTEMPTS; + + /** + * List of node account IDs for each transaction that has been + * built. + * + * @internal + * @type {List} + */ + this._nodeAccountIds = new List(); + + /** + * @internal + */ + this._signOnDemand = false; + + /** + * This is the request's min backoff + * + * @internal + * @type {number | null} + */ + this._minBackoff = null; + + /** + * This is the request's max backoff + * + * @internal + * @type {number} + */ + this._maxBackoff = 8000; + + /** + * The operator that was used to execute this request. + * The reason we save the operator in the request is because of the signing on + * demand feature. This feature requires us to sign new request on each attempt + * meaning if a client with an operator was used we'd need to sign with the operator + * on each attempt. + * + * @internal + * @type {ClientOperator | null} + */ + this._operator = null; + + /** + * The complete timeout for running the `execute()` method + * + * @internal + * @type {number | null} + */ + this._requestTimeout = null; + + /** + * The grpc request timeout aka deadline. + * + * The reason we have this is because there were times that consensus nodes held the grpc + * connection, but didn't return anything; not error nor regular response. This resulted + * in some weird behavior in the SDKs. To fix this we've added a grpc deadline to prevent + * nodes from stalling the executing of a request. + * + * @internal + * @type {number | null} + */ + this._grpcDeadline = null; + + /** + * Logger + * + * @protected + * @type {Logger | null} + */ + this._logger = null; + } + + /** + * Get the list of node account IDs on the request. If no nodes are set, then null is returned. + * The reasoning for this is simply "legacy behavior". + * + * @returns {?AccountId[]} + */ + get nodeAccountIds() { + if (this._nodeAccountIds.isEmpty) { + return null; + } else { + this._nodeAccountIds.setLocked(); + return this._nodeAccountIds.list; + } + } + + /** + * Set the node account IDs on the request + * + * @param {AccountId[]} nodeIds + * @returns {this} + */ + setNodeAccountIds(nodeIds) { + // Set the node account IDs, and lock the list. This will require `execute` + // to use these nodes instead of random nodes from the network. + this._nodeAccountIds.setList(nodeIds).setLocked(); + return this; + } + + /** + * @deprecated + * @returns {number} + */ + get maxRetries() { + console.warn("Deprecated: use maxAttempts instead"); + return this.maxAttempts; + } + + /** + * @param {number} maxRetries + * @returns {this} + */ + setMaxRetries(maxRetries) { + console.warn("Deprecated: use setMaxAttempts() instead"); + return this.setMaxAttempts(maxRetries); + } + + /** + * Get the max attempts on the request + * + * @returns {number} + */ + get maxAttempts() { + return this._maxAttempts; + } + + /** + * Set the max attempts on the request + * + * @param {number} maxAttempts + * @returns {this} + */ + setMaxAttempts(maxAttempts) { + this._maxAttempts = maxAttempts; + + return this; + } + + /** + * Get the grpc deadline + * + * @returns {?number} + */ + get grpcDeadline() { + return this._grpcDeadline; + } + + /** + * Set the grpc deadline + * + * @param {number} grpcDeadline + * @returns {this} + */ + setGrpcDeadline(grpcDeadline) { + this._grpcDeadline = grpcDeadline; + + return this; + } + + /** + * Set the min backoff for the request + * + * @param {number} minBackoff + * @returns {this} + */ + setMinBackoff(minBackoff) { + // Honestly we shouldn't be checking for null since that should be TypeScript's job. + // Also verify that min backoff is not greater than max backoff. + if (minBackoff == null) { + throw new Error("minBackoff cannot be null."); + } else if (this._maxBackoff != null && minBackoff > this._maxBackoff) { + throw new Error("minBackoff cannot be larger than maxBackoff."); + } + this._minBackoff = minBackoff; + return this; + } + + /** + * Get the min backoff + * + * @returns {number | null} + */ + get minBackoff() { + return this._minBackoff; + } + + /** + * Set the max backoff for the request + * + * @param {?number} maxBackoff + * @returns {this} + */ + setMaxBackoff(maxBackoff) { + // Honestly we shouldn't be checking for null since that should be TypeScript's job. + // Also verify that max backoff is not less than min backoff. + if (maxBackoff == null) { + throw new Error("maxBackoff cannot be null."); + } else if (this._minBackoff != null && maxBackoff < this._minBackoff) { + throw new Error("maxBackoff cannot be smaller than minBackoff."); + } + this._maxBackoff = maxBackoff; + return this; + } + + /** + * Get the max backoff + * + * @returns {number} + */ + get maxBackoff() { + return this._maxBackoff; + } + + /** + * This method is responsible for doing any work before the executing process begins. + * For paid queries this will result in executing a cost query, for transactions this + * will make sure we save the operator and sign any requests that need to be signed + * in case signing on demand is disabled. + * + * @abstract + * @protected + * @param {import("./client/Client.js").default} client + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _beforeExecute(client) { + throw new Error("not implemented"); + } + + /** + * Create a protobuf request which will be passed into the `_execute()` method + * + * @abstract + * @protected + * @returns {Promise} + */ + _makeRequestAsync() { + throw new Error("not implemented"); + } + + /** + * This name is a bit wrong now, but the purpose of this method is to map the + * request and response into an error. This method will only be called when + * `_shouldRetry` returned `ExecutionState.Error` + * + * @abstract + * @internal + * @param {RequestT} request + * @param {ResponseT} response + * @param {AccountId} nodeId + * @returns {Error} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapStatusError(request, response, nodeId) { + throw new Error("not implemented"); + } + + /** + * Map the request, response, and the node account ID used for this attempt into a response. + * This method will only be called when `_shouldRetry` returned `ExecutionState.Finished` + * + * @abstract + * @protected + * @param {ResponseT} response + * @param {AccountId} nodeAccountId + * @param {RequestT} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + throw new Error("not implemented"); + } + + /** + * Perform a single grpc call with the given request. Each request has it's own + * required service so we just pass in channel, and it'$ the request's responsiblity + * to use the right service and call the right grpc method. + * + * @abstract + * @internal + * @param {Channel} channel + * @param {RequestT} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _execute(channel, request) { + throw new Error("not implemented"); + } + + /** + * Return the current transaction ID for the request. All requests which are + * use the same transaction ID for each node, but the catch is that `Transaction` + * implicitly supports chunked transactions. Meaning there could be multiple + * transaction IDs stored in the request, and a different transaction ID will be used + * on subsequent calls to `execute()` + * + * FIXME: This method can most likely be removed, although some further inspection + * is required. + * + * @abstract + * @protected + * @returns {TransactionId} + */ + _getTransactionId() { + throw new Error("not implemented"); + } + + /** + * Return the log ID for this particular request + * + * Log IDs are simply a string constructed to make it easy to track each request's + * execution even when mulitple requests are executing in parallel. Typically, this + * method returns the format of `[.]` + * + * Maybe we should deduplicate this using ${this.consturtor.name} + * + * @abstract + * @internal + * @returns {string} + */ + _getLogId() { + throw new Error("not implemented"); + } + + /** + * Serialize the request into bytes + * + * @abstract + * @param {RequestT} request + * @returns {Uint8Array} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _requestToBytes(request) { + throw new Error("not implemented"); + } + + /** + * Serialize the response into bytes + * + * @abstract + * @param {ResponseT} response + * @returns {Uint8Array} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _responseToBytes(response) { + throw new Error("not implemented"); + } + + /** + * Advance the request to the next node + * + * FIXME: This method used to perform different code depending on if we're + * executing a query or transaction, but that is no longer the case + * and hence could be removed. + * + * @protected + * @returns {void} + */ + _advanceRequest() { + this._nodeAccountIds.advance(); + } + + /** + * Determine if we should continue the execution process, error, or finish. + * + * FIXME: This method should really be called something else. Initially it returned + * a boolean so `shouldRetry` made sense, but now it returns an enum, so the name + * no longer makes sense. + * + * @abstract + * @protected + * @param {RequestT} request + * @param {ResponseT} response + * @returns {[Status, ExecutionState]} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _shouldRetry(request, response) { + throw new Error("not implemented"); + } + + /** + * Determine if we should error based on the gRPC status + * + * Unlike `shouldRetry` this method does in fact still return a boolean + * + * @protected + * @param {Error} error + * @returns {boolean} + */ + _shouldRetryExceptionally(error) { + if (error instanceof GrpcServiceError) { + return ( + error.status._code === GrpcStatus.Timeout._code || + error.status._code === GrpcStatus.Unavailable._code || + error.status._code === GrpcStatus.ResourceExhausted._code || + error.status._code === GrpcStatus.GrpcWeb._code || + (error.status._code === GrpcStatus.Internal._code && + Executable_RST_STREAM.test(error.message)) + ); + } else { + // if we get to the 'else' statement, the 'error' is instanceof 'HttpError' + // and in this case, we have to retry always + return true; + } + } + + /** + * A helper method for setting the operator on the request + * + * @internal + * @param {AccountId} accountId + * @param {PublicKey} publicKey + * @param {(message: Uint8Array) => Promise} transactionSigner + * @returns {this} + */ + _setOperatorWith(accountId, publicKey, transactionSigner) { + this._operator = { + transactionSigner, + accountId, + publicKey, + }; + return this; + } + + /** + * Execute this request using the signer + * + * This method is part of the signature providers feature + * https://hips.hedera.com/hip/hip-338 + * + * @param {Signer} signer + * @returns {Promise} + */ + async executeWithSigner(signer) { + return signer.call(this); + } + + /** + * Execute the request using a client and an optional request timeout + * + * @template {Channel} ChannelT + * @template {MirrorChannel} MirrorChannelT + * @param {import("./client/Client.js").default} client + * @param {number=} requestTimeout + * @returns {Promise} + */ + async execute(client, requestTimeout) { + // If the logger on the request is not set, use the logger in client + // (if set, otherwise do not use logger) + this._logger = + this._logger == null + ? client._logger != null + ? client._logger + : null + : this._logger; + + // If the request timeout is set on the request we'll prioritize that instead + // of the parameter provided, and if the parameter isn't provided we'll + // use the default request timeout on client + if (this._requestTimeout == null) { + this._requestTimeout = + requestTimeout != null ? requestTimeout : client.requestTimeout; + } + + // Some request need to perform additional requests before the executing + // such as paid queries need to fetch the cost of the query before + // finally executing the actual query. + await this._beforeExecute(client); + + // If the max backoff on the request is not set, use the default value in client + if (this._maxBackoff == null) { + this._maxBackoff = client.maxBackoff; + } + + // If the min backoff on the request is not set, use the default value in client + if (this._minBackoff == null) { + this._minBackoff = client.minBackoff; + } + + // If the max attempts on the request is not set, use the default value in client + // If the default value in client is not set, use a default of 10. + // + // FIXME: current implementation is wrong, update to follow comment above. + const maxAttempts = + client._maxAttempts != null + ? client._maxAttempts + : this._maxAttempts; + + // Save the start time to be used later with request timeout + const startTime = Date.now(); + + // Saves each error we get so when we err due to max attempts exceeded we'll have + // the last error that was returned by the consensus node + let persistentError = null; + + // The retry loop + for (let attempt = 1; attempt <= maxAttempts; attempt += 1) { + // Determine if we've exceeded request timeout + if ( + this._requestTimeout != null && + startTime + this._requestTimeout <= Date.now() + ) { + throw new Error("timeout exceeded"); + } + + let nodeAccountId; + let node; + + if (this._nodeAccountIds.isEmpty) { + node = client._network.getNode(); + nodeAccountId = node.accountId; + this._nodeAccountIds.setList([nodeAccountId]); + } else { + nodeAccountId = this._nodeAccountIds.current; + node = client._network.getNode(nodeAccountId); + } + + if (node == null) { + throw new Error( + `NodeAccountId not recognized: ${nodeAccountId.toString()}`, + ); + } + + // Get the log ID for the request. + const logId = this._getLogId(); + if (this._logger) { + this._logger.debug( + `[${logId}] Node AccountID: ${node.accountId.toString()}, IP: ${node.address.toString()}`, + ); + } + + const channel = node.getChannel(); + const request = await this._makeRequestAsync(); + + // advance the internal index + // non-free queries and transactions map to more than 1 actual transaction and this will cause + // the next invocation of makeRequest to return the _next_ transaction + // FIXME: This is likely no longer relavent after we've transitioned to using our `List` type + // can be replaced with `this._nodeAccountIds.advance();` + this._advanceRequest(); + + let response; + + // If the node is unhealthy, wait for it to be healthy + // FIXME: This is wrong, we should skip to the next node, and only perform + // a request backoff after we've tried all nodes in the current list. + if (!node.isHealthy() && this._nodeAccountIds.length > 1) { + if (this._logger) { + this._logger.debug( + `[${logId}] node is not healthy, skipping waiting ${node.getRemainingTime()}`, + ); + } + + // We don't need to wait, we can proceed to the next attempt. + continue; + } + + try { + // Race the execution promise against the grpc timeout to prevent grpc connections + // from blocking this request + const promises = []; + + // If a grpc deadline is est, we should race it, otherwise the only thing in the + // list of promises will be the execution promise. + if (this._grpcDeadline != null) { + promises.push( + // eslint-disable-next-line ie11/no-loop-func + new Promise((_, reject) => + setTimeout( + // eslint-disable-next-line ie11/no-loop-func + () => + reject(new Error("grpc deadline exceeded")), + /** @type {number=} */ (this._grpcDeadline), + ), + ), + ); + } + if (this._logger) { + this._logger.trace( + `[${this._getLogId()}] sending protobuf ${hex_browser_encode( + this._requestToBytes(request), + )}`, + ); + } + + promises.push(this._execute(channel, request)); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + response = /** @type {ResponseT} */ ( + await Promise.race(promises) + ); + } catch (err) { + // If we received a grpc status error we need to determine if + // we should retry on this error, or err from the request entirely. + const error = GrpcServiceError._fromResponse( + /** @type {Error} */ (err), + ); + + // Save the error in case we retry + persistentError = error; + if (this._logger) { + this._logger.debug( + `[${logId}] received error ${JSON.stringify(error)}`, + ); + } + + if ( + (error instanceof GrpcServiceError || + error instanceof HttpError) && + this._shouldRetryExceptionally(error) && + attempt <= maxAttempts + ) { + // Increase the backoff for the particular node and remove it from + // the healthy node list + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] node with accountId: ${node.accountId.toString()} and proxy IP: ${node.address.toString()} is unhealthy`, + ); + } + + client._network.increaseBackoff(node); + continue; + } + + throw err; + } + if (this._logger) { + this._logger.trace( + `[${this._getLogId()}] sending protobuf ${hex_browser_encode( + this._responseToBytes(response), + )}`, + ); + } + + // If we didn't receive an error we should decrease the current nodes backoff + // in case it is a recovering node + client._network.decreaseBackoff(node); + + // Determine what execution state we're in by the response + // For transactions this would be as simple as checking the response status is `OK` + // while for _most_ queries it would check if the response status is `SUCCESS` + // The only odd balls are `TransactionReceiptQuery` and `TransactionRecordQuery` + const [status, shouldRetry] = this._shouldRetry(request, response); + if ( + status.toString() !== Status.Ok.toString() && + status.toString() !== Status.Success.toString() + ) { + persistentError = status; + } + + // Determine by the executing state what we should do + switch (shouldRetry) { + case ExecutionState.Retry: + await delayForAttempt( + attempt, + this._minBackoff, + this._maxBackoff, + ); + continue; + case ExecutionState.Finished: + return this._mapResponse(response, nodeAccountId, request); + case ExecutionState.Error: + throw this._mapStatusError( + request, + response, + nodeAccountId, + ); + default: + throw new Error( + "(BUG) non-exhaustive switch statement for `ExecutionState`", + ); + } + } + + // We'll only get here if we've run out of attempts, so we return an error wrapping the + // persistent error we saved before. + throw new Error( + `max attempts of ${maxAttempts.toString()} was reached for request with last error being: ${ + persistentError != null ? persistentError.toString() : "" + }`, + ); + } + + /** + * The current purpose of this method is to easily support signature providers since + * signature providers need to serialize _any_ request into bytes. `Query` and `Transaction` + * already implement `toBytes()` so it only made sense to make it available here too. + * + * @abstract + * @returns {Uint8Array} + */ + toBytes() { + throw new Error("not implemented"); + } + + /** + * Set logger + * + * @param {Logger} logger + * @returns {this} + */ + setLogger(logger) { + this._logger = logger; + return this; + } + + /** + * Get logger if set + * + * @returns {?Logger} + */ + get logger() { + return this._logger; + } +} + +/** + * A simple function that returns a promise timeout for a specific period of time + * + * @param {number} attempt + * @param {number} minBackoff + * @param {number} maxBackoff + * @returns {Promise} + */ +function delayForAttempt(attempt, minBackoff, maxBackoff) { + // 0.1s, 0.2s, 0.4s, 0.8s, ... + const ms = Math.min( + Math.floor(minBackoff * Math.pow(2, attempt)), + maxBackoff, + ); + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Timestamp.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITimestamp} HashgraphProto.proto.ITimestamp + */ + +const MAX_NS = src_long.fromNumber(1000000000); +const generatedIds = new Set(); + +class Timestamp_Timestamp { + /** + * @param {Long | number} seconds + * @param {Long | number} nanos + */ + constructor(seconds, nanos) { + /** + * @readonly + * @type {Long} + */ + this.seconds = + seconds instanceof src_long ? seconds : src_long.fromNumber(seconds); + + /** + * @readonly + * @type {Long} + */ + this.nanos = nanos instanceof src_long ? nanos : src_long.fromNumber(nanos); + + Object.freeze(this); + } + + /** + * @returns {Timestamp} + */ + static generate() { + const jitter = Math.floor(Math.random() * 5000) + 8000; + const now = Date.now() - jitter; + const seconds = Math.floor(now / 1000) + src_Cache.timeDrift; + const nanos = + Math.floor(now % 1000) * 1000000 + + Math.floor(Math.random() * 1000000); + + const timestamp = new Timestamp_Timestamp(seconds, nanos); + if (generatedIds.has(timestamp.toString())) { + return this.generate(); + } else { + generatedIds.add(timestamp.toString()); + return timestamp; + } + } + + /** + * @param {string | number | Date} date + * @returns {Timestamp} + */ + static fromDate(date) { + let nanos; + + if (typeof date === "number") { + nanos = src_long.fromNumber(date); + } else if (typeof date === "string") { + nanos = src_long.fromNumber(Date.parse(date)).mul(1000000); + } else if (date instanceof Date) { + nanos = src_long.fromNumber(date.getTime()).mul(1000000); + } else { + throw new TypeError( + `invalid type '${typeof date}' for 'data', expected 'Date'`, + ); + } + + return new Timestamp_Timestamp(0, 0).plusNanos(nanos); + } + + /** + * @returns {Date} + */ + toDate() { + return new Date( + this.seconds.toInt() * 1000 + + Math.floor(this.nanos.toInt() / 1000000), + ); + } + + /** + * @param {Long | number} nanos + * @returns {Timestamp} + */ + plusNanos(nanos) { + const ns = this.nanos.add(nanos); + + return new Timestamp_Timestamp(this.seconds.add(ns.div(MAX_NS)), ns.mod(MAX_NS)); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ITimestamp} + */ + _toProtobuf() { + return { + seconds: this.seconds, + nanos: this.nanos.toInt(), + }; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITimestamp} timestamp + * @returns {Timestamp} + */ + static _fromProtobuf(timestamp) { + return new Timestamp_Timestamp( + timestamp.seconds instanceof src_long + ? timestamp.seconds.toInt() + : timestamp.seconds != null + ? timestamp.seconds + : 0, + + timestamp.nanos != null ? timestamp.nanos : 0, + ); + } + + /** + * @returns {string} + */ + toString() { + const zeroPaddedNanos = String(this.nanos).padStart(9, "0"); + return `${this.seconds.toString()}.${zeroPaddedNanos}`; + } + + /** + * @param {Timestamp} other + * @returns {number} + */ + compare(other) { + const comparison = this.seconds.compare(other.seconds); + + if (comparison != 0) { + return comparison; + } + + return this.nanos.compare(other.nanos); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("./TransactionReceipt.js").default} TransactionReceipt + * @typedef {import("./TransactionRecord.js").default} TransactionRecord + */ + +/** + * The client-generated ID for a transaction. + * + * This is used for retrieving receipts and records for a transaction, for appending to a file + * right after creating it, for instantiating a smart contract with bytecode in a file just created, + * and internally by the network for detecting when duplicate transactions are submitted. + */ +class TransactionId_TransactionId { + /** + * Don't use this method directly. + * Use `TransactionId.[generate|withNonce|withValidStart]()` instead. + * + * @param {?AccountId} accountId + * @param {?Timestamp} validStart + * @param {?boolean} scheduled + * @param {?Long | number} nonce + */ + constructor(accountId, validStart, scheduled = false, nonce = null) { + /** + * The Account ID that paid for this transaction. + * + * @readonly + */ + this.accountId = accountId; + + /** + * The time from when this transaction is valid. + * + * When a transaction is submitted there is additionally a validDuration (defaults to 120s) + * and together they define a time window that a transaction may be processed in. + * + * @readonly + */ + this.validStart = validStart; + + this.scheduled = scheduled; + + this.nonce = null; + if (nonce != null && nonce != 0) { + this.setNonce(nonce); + } + + Object.seal(this); + } + + /** + * @param {Long | number} nonce + * @returns {TransactionId} + */ + setNonce(nonce) { + this.nonce = typeof nonce === "number" ? src_long.fromNumber(nonce) : nonce; + return this; + } + + /** + * @param {AccountId} accountId + * @param {Timestamp} validStart + * @returns {TransactionId} + */ + static withValidStart(accountId, validStart) { + return new TransactionId_TransactionId(accountId, validStart); + } + + /** + * Generates a new transaction ID for the given account ID. + * + * Note that transaction IDs are made of the valid start of the transaction and the account + * that will be charged the transaction fees for the transaction. + * + * @param {AccountId | string} id + * @returns {TransactionId} + */ + static generate(id) { + return new TransactionId_TransactionId( + typeof id === "string" + ? AccountId_AccountId.fromString(id) + : new AccountId_AccountId(id), + Timestamp_Timestamp.generate(), + ); + } + + /** + * @param {string} wholeId + * @returns {TransactionId} + */ + static fromString(wholeId) { + let account, seconds, nanos, isScheduled, nonce; + let rest; + // 1.1.1@5.4?scheduled/117 + + [account, rest] = wholeId.split("@"); + [seconds, rest] = rest.split("."); + if (rest.includes("?")) { + [nanos, rest] = rest.split("?scheduled"); + isScheduled = true; + if (rest.includes("/")) { + nonce = rest.replace("/", ""); + } else { + nonce = null; + } + } else if (rest.includes("/")) { + [nanos, nonce] = rest.split("/"); + isScheduled = false; + } else { + nanos = rest; + } + + return new TransactionId_TransactionId( + AccountId_AccountId.fromString(account), + new Timestamp_Timestamp(src_long.fromValue(seconds), src_long.fromValue(nanos)), + isScheduled, + nonce != null ? src_long.fromString(nonce) : null, + ); + } + + /** + * @param {boolean} scheduled + * @returns {this} + */ + setScheduled(scheduled) { + this.scheduled = scheduled; + return this; + } + + /** + * @returns {string} + */ + toString() { + if (this.accountId != null && this.validStart != null) { + const zeroPaddedNanos = String(this.validStart.nanos).padStart( + 9, + "0", + ); + const nonce = + this.nonce != null ? "/".concat(this.nonce.toString()) : ""; + const scheduled = this.scheduled ? "?scheduled" : ""; + return `${this.accountId.toString()}@${this.validStart.seconds.toString()}.${zeroPaddedNanos}${scheduled}${nonce}`; + } else { + throw new Error("neither `accountId` nor `validStart` are set"); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransactionID} id + * @returns {TransactionId} + */ + static _fromProtobuf(id) { + if (id.accountID != null && id.transactionValidStart != null) { + return new TransactionId_TransactionId( + AccountId_AccountId._fromProtobuf(id.accountID), + Timestamp_Timestamp._fromProtobuf(id.transactionValidStart), + id.scheduled != null ? id.scheduled : undefined, + id.nonce != null ? id.nonce : undefined, + ); + } else { + throw new Error( + "Neither `nonce` or `accountID` and `transactionValidStart` are set", + ); + } + } + + /** + * @internal + * @returns {HashgraphProto.proto.ITransactionID} + */ + _toProtobuf() { + return { + accountID: + this.accountId != null ? this.accountId._toProtobuf() : null, + transactionValidStart: + this.validStart != null ? this.validStart._toProtobuf() : null, + scheduled: this.scheduled, + nonce: this.nonce != null ? this.nonce.toInt() : null, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {TransactionId} + */ + static fromBytes(bytes) { + return TransactionId_TransactionId._fromProtobuf( + lib.proto.TransactionID.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.TransactionID.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {TransactionId} + */ + clone() { + return new TransactionId_TransactionId( + this.accountId, + this.validStart, + this.scheduled, + this.nonce, + ); + } + + /** + * @param {TransactionId} other + * @returns {number} + */ + compare(other) { + const comparison = /** @type {AccountId} */ (this.accountId).compare( + /** @type {AccountId} */ (other.accountId), + ); + + if (comparison != 0) { + return comparison; + } + + return /** @type {Timestamp} */ (this.validStart).compare( + /** @type {Timestamp} */ (other.validStart), + ); + } + + /** + * @param {Client} client + * @returns {Promise} + */ + getReceipt(client) { + return src_Cache.transactionReceiptQueryConstructor() + .setTransactionId(this) + .execute(client); + } + + /** + * @param {Client} client + * @returns {Promise} + */ + async getRecord(client) { + await this.getReceipt(client); + + return src_Cache.transactionRecordQueryConstructor() + .setTransactionId(this) + .execute(client); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @typedef {import("./Status.js").default} Status + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("./contract/ContractFunctionResult.js").default} ContractFunctionResult + * @typedef {import("./account/AccountId.js").default} AccountId + */ + +/** + * @typedef {object} PrecheckStatusErrorJSON + * @property {string} name + * @property {string} status + * @property {string} transactionId + * @property {?string | null} nodeId + * @property {string} message + * @property {?ContractFunctionResult} contractFunctionResult + */ + +class PrecheckStatusError extends StatusError { + /** + * @param {object} props + * @param {Status} props.status + * @param {TransactionId} props.transactionId + * @param {AccountId} props.nodeId + * @param {?ContractFunctionResult} props.contractFunctionResult + */ + constructor(props) { + super( + props, + `transaction ${props.transactionId.toString()} failed precheck with status ${props.status.toString()} against node account id ${props.nodeId.toString()}`, + ); + + /** + * @type {?ContractFunctionResult} + * @readonly + */ + this.contractFunctionResult = props.contractFunctionResult; + + /** + * @type {AccountId} + * @readonly + */ + this.nodeId = props.nodeId; + } + + /** + * @returns {PrecheckStatusErrorJSON} + */ + toJSON() { + return { + name: this.name, + status: this.status.toString(), + transactionId: this.transactionId.toString(), + nodeId: this.nodeId.toString(), + message: this.message, + contractFunctionResult: this.contractFunctionResult, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/MaxQueryPaymentExceeded.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @typedef {import("./Hbar.js").default} Hbar + */ + +class MaxQueryPaymentExceeded extends Error { + /** + * @param {Hbar} queryCost + * @param {Hbar} maxQueryPayment + */ + constructor(queryCost, maxQueryPayment) { + super(); + + this.message = `query cost of ${queryCost.toString()} HBAR exceeds max set on client: ${maxQueryPayment.toString()} HBAR`; + this.name = "MaxQueryPaymentExceededError"; + this.queryCost = queryCost; + this.maxQueryPayment = maxQueryPayment; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/query/Query.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("../PublicKey.js").default} PublicKey + * @typedef {import("../client/Client.js").ClientOperator} ClientOperator + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../logger/Logger.js").default} Logger + */ + +/** + * This registry holds a bunch of callbacks for `fromProtobuf()` implementations + * Since this is essentially aa cache, perhaps we should move this variable into the `Cache` + * type for consistency? + * + * @type {Map Query<*>>} + */ +const QUERY_REGISTRY = new Map(); + +/** + * Base class for all queries that can be submitted to Hedera. + * + * @abstract + * @template OutputT + * @augments {Executable} + */ +class Query_Query extends Executable { + constructor() { + super(); + + /** + * The payment transaction ID + * + * @type {?TransactionId} + */ + this._paymentTransactionId = null; + + /** + * The payment transactions list where each index points to a different node + * + * @type {HashgraphProto.proto.ITransaction[]} + */ + this._paymentTransactions = []; + + /** + * The amount being paid to the node for this query. + * A user can set this field explicitly, or we'll query the value during execution. + * + * @type {?Hbar} + */ + this._queryPayment = null; + + /** + * The maximum query payment a user is willing to pay. Unlike `Transaction.maxTransactionFee` + * this field only exists in the SDK; there is no protobuf field equivalent. If and when + * we query the actual cost of the query and the cost is greater than the max query payment + * we'll throw a `MaxQueryPaymentExceeded` error. + * + * @type {?Hbar} + */ + this._maxQueryPayment = null; + + /** + * This is strictly used for `_getLogId()` which requires a timestamp. The timestamp it typically + * uses comes from the payment transaction ID, but that field is not set if this query is free. + * For those occasions we use this timestamp field generated at query construction instead. + * + * @type {number} + */ + this._timestamp = Date.now(); + } + + /** + * Deserialize a query from bytes. The bytes should be a `proto.Query`. + * + * @template T + * @param {Uint8Array} bytes + * @returns {Query} + */ + static fromBytes(bytes) { + const query = lib.proto.Query.decode(bytes); + + if (query.query == null) { + throw new Error("(BUG) query.query was not set in the protobuf"); + } + + const fromProtobuf = + /** @type {(query: HashgraphProto.proto.IQuery) => Query} */ ( + QUERY_REGISTRY.get(query.query) + ); + + if (fromProtobuf == null) { + throw new Error( + `(BUG) Query.fromBytes() not implemented for type ${query.query}`, + ); + } + + return fromProtobuf(query); + } + + /** + * Serialize the query into bytes. + * + * **NOTE**: Does not preserve payment transactions + * + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.Query.encode(this._makeRequest()).finish(); + } + + /** + * Set an explicit payment amount for this query. + * + * The client will submit exactly this amount for the payment of this query. Hedera + * will not return any remainder. + * + * @param {Hbar} queryPayment + * @returns {this} + */ + setQueryPayment(queryPayment) { + this._queryPayment = queryPayment; + + return this; + } + + /** + * Set the maximum payment allowable for this query. + * + * @param {Hbar} maxQueryPayment + * @returns {this} + */ + setMaxQueryPayment(maxQueryPayment) { + this._maxQueryPayment = maxQueryPayment; + + return this; + } + + /** + * Fetch the cost of this query from a consensus node + * + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + // The node account IDs must be set to execute a cost query + if (this._nodeAccountIds.isEmpty) { + this._nodeAccountIds.setList( + client._network.getNodeAccountIdsForExecute(), + ); + } + + if (COST_QUERY.length != 1) { + throw new Error("CostQuery has not been loaded yet"); + } + + // Change the timestamp. Should we be doing this? + this._timestamp = Date.now(); + const cost = await COST_QUERY[0](this).execute(client); + return Hbar_Hbar.fromTinybars( + cost._valueInTinybar.multipliedBy(1.1).toFixed(0), + ); + } + + /** + * Set he payment transaction explicitly + * + * @param {TransactionId} paymentTransactionId + * @returns {this} + */ + setPaymentTransactionId(paymentTransactionId) { + this._paymentTransactionId = paymentTransactionId; + return this; + } + + /** + * Get the payment transaction ID + * + * @returns {?TransactionId} + */ + get paymentTransactionId() { + return this._paymentTransactionId; + } + + /** + * Get the current transaction ID, and make sure it's not null + * + * @returns {TransactionId} + */ + _getTransactionId() { + if (this._paymentTransactionId == null) { + throw new Error( + "Query.PaymentTransactionId was not set duration execution", + ); + } + + return this._paymentTransactionId; + } + + /** + * Is payment required for this query. By default most queries require payment + * so the default implementation returns true. + * + * @protected + * @returns {boolean} + */ + _isPaymentRequired() { + return true; + } + + /** + * Validate checksums of the query. + * + * @param {Client} client + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function + _validateChecksums(client) { + // Shouldn't we be checking `paymentTransactionId` here sine it contains an `accountId`? + // Do nothing + } + + /** + * Before we proceed exeuction, we need to do a couple checks + * + * @template {MirrorChannel} MirrorChannelT + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async _beforeExecute(client) { + // If we're executing this query multiple times the the payment transaction ID list + // will already be set + if (this._paymentTransactions.length > 0) { + return; + } + + // Check checksums if enabled + if (client.isAutoValidateChecksumsEnabled()) { + this._validateChecksums(client); + } + + // If the nodes aren't set, set them. + if (this._nodeAccountIds.isEmpty) { + this._nodeAccountIds.setList( + client._network.getNodeAccountIdsForExecute(), + ); + } + + // Save the operator + this._operator = + this._operator != null ? this._operator : client._operator; + + // If the payment transaction ID is not set + if (this._paymentTransactionId == null) { + // And payment is required + if (this._isPaymentRequired()) { + // And the client has an operator + if (this._operator != null) { + // Generate the payment transaction ID + this._paymentTransactionId = TransactionId_TransactionId.generate( + this._operator.accountId, + ); + } else { + // If payment is required, but an operator did not exist, throw an error + throw new Error( + "`client` must have an `operator` or an explicit payment transaction must be provided", + ); + } + } else { + // If the payment transaction ID is not set, but this query doesn't require a payment + // set the payment transaction ID to an empty transaction ID. + // FIXME: Should use `TransactionId.withValidStart()` instead + this._paymentTransactionId = TransactionId_TransactionId.generate( + new AccountId_AccountId(0), + ); + } + } + + let cost = new Hbar_Hbar(0); + + const maxQueryPayment = + this._maxQueryPayment != null + ? this._maxQueryPayment + : client.defaultMaxQueryPayment; + + if (this._queryPayment != null) { + cost = this._queryPayment; + } else if ( + this._paymentTransactions.length === 0 && + this._isPaymentRequired() + ) { + // If the query payment was not explictly set, fetch the actual cost. + const actualCost = await this.getCost(client); + + // Confirm it's less than max query payment + if ( + maxQueryPayment.toTinybars().toInt() < + actualCost.toTinybars().toInt() + ) { + throw new MaxQueryPaymentExceeded(actualCost, maxQueryPayment); + } + + cost = actualCost; + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] received cost for query ${cost.toString()}`, + ); + } + } + + // Set the either queried cost, or the original value back into `queryPayment` + // in case a user executes same query multiple times. However, users should + // really not be executing the same query multiple times meaning this is + // typically not needed. + this._queryPayment = cost; + + // Not sure if we should be overwritting this field tbh. + this._timestamp = Date.now(); + + this._nodeAccountIds.setLocked(); + + // Generate the payment transactions + for (const nodeId of this._nodeAccountIds.list) { + const logId = this._getLogId(); + const paymentTransactionId = + /** @type {import("../transaction/TransactionId.js").default} */ ( + this._paymentTransactionId + ); + const paymentAmount = /** @type {Hbar} */ (this._queryPayment); + + if (this._logger) { + this._logger.debug( + `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`, + ); + } + + this._paymentTransactions.push( + await _makePaymentTransaction( + paymentTransactionId, + nodeId, + this._isPaymentRequired() ? this._operator : null, + paymentAmount, + ), + ); + } + } + + /** + * @abstract + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponseHeader(response) { + throw new Error("not implemented"); + } + + /** + * @protected + * @returns {HashgraphProto.proto.IQueryHeader} + */ + _makeRequestHeader() { + /** @type {HashgraphProto.proto.IQueryHeader} */ + let header = {}; + + if (this._isPaymentRequired() && this._paymentTransactions.length > 0) { + header = { + responseType: lib.proto.ResponseType.ANSWER_ONLY, + payment: this._paymentTransactions[this._nodeAccountIds.index], + }; + } + + return header; + } + + /** + * @abstract + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _onMakeRequest(header) { + throw new Error("not implemented"); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IQuery} + */ + _makeRequest() { + /** @type {HashgraphProto.proto.IQueryHeader} */ + let header = {}; + + if (this._isPaymentRequired() && this._paymentTransactions != null) { + header = { + payment: this._paymentTransactions[this._nodeAccountIds.index], + responseType: lib.proto.ResponseType.ANSWER_ONLY, + }; + } + + return this._onMakeRequest(header); + } + + /** + * @override + * @internal + * @returns {Promise} + */ + async _makeRequestAsync() { + /** @type {HashgraphProto.proto.IQueryHeader} */ + let header = { + responseType: lib.proto.ResponseType.ANSWER_ONLY, + }; + + const logId = this._getLogId(); + const nodeId = this._nodeAccountIds.current; + const paymentTransactionId = TransactionId_TransactionId.generate( + this._operator ? this._operator.accountId : new AccountId_AccountId(0), + ); + const paymentAmount = /** @type {Hbar} */ (this._queryPayment); + + if (this._logger) { + this._logger.debug( + `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`, + ); + } + + header.payment = await _makePaymentTransaction( + paymentTransactionId, + nodeId, + this._isPaymentRequired() ? this._operator : null, + paymentAmount, + ); + + return this._onMakeRequest(header); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @returns {[Status, ExecutionState]} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _shouldRetry(request, response) { + const { nodeTransactionPrecheckCode } = + this._mapResponseHeader(response); + + const status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : lib.proto.ResponseCodeEnum.OK, + ); + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] received status ${status.toString()}`, + ); + } + + switch (status) { + case Status.Busy: + case Status.Unknown: + case Status.PlatformTransactionNotCreated: + case Status.PlatformNotActive: + return [status, ExecutionState.Retry]; + case Status.Ok: + return [status, ExecutionState.Finished]; + default: + return [status, ExecutionState.Error]; + } + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeId + * @returns {Error} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapStatusError(request, response, nodeId) { + const { nodeTransactionPrecheckCode } = + this._mapResponseHeader(response); + + const status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : lib.proto.ResponseCodeEnum.OK, + ); + + return new PrecheckStatusError({ + nodeId, + status, + transactionId: this._getTransactionId(), + contractFunctionResult: null, + }); + } + + /** + * @param {HashgraphProto.proto.Query} request + * @returns {Uint8Array} + */ + _requestToBytes(request) { + return lib.proto.Query.encode(request).finish(); + } + + /** + * @param {HashgraphProto.proto.Response} response + * @returns {Uint8Array} + */ + _responseToBytes(response) { + return lib.proto.Response.encode(response).finish(); + } +} + +/** + * Generate a payment transaction given, aka. `TransferTransaction` + * + * @param {TransactionId} paymentTransactionId + * @param {AccountId} nodeId + * @param {?ClientOperator} operator + * @param {Hbar} paymentAmount + * @returns {Promise} + */ +async function _makePaymentTransaction( + paymentTransactionId, + nodeId, + operator, + paymentAmount, +) { + const accountAmounts = []; + + // If an operator is provided then we should make sure we transfer + // from the operator to the node. + // If an operator is not provided we simply create an effectively + // empty account amounts + if (operator != null) { + accountAmounts.push({ + accountID: operator.accountId._toProtobuf(), + amount: paymentAmount.negated().toTinybars(), + }); + accountAmounts.push({ + accountID: nodeId._toProtobuf(), + amount: paymentAmount.toTinybars(), + }); + } else { + accountAmounts.push({ + accountID: new AccountId_AccountId(0)._toProtobuf(), + // If the account ID is 0, shouldn't we just hard + // code this value to 0? Same for the latter. + amount: paymentAmount.negated().toTinybars(), + }); + accountAmounts.push({ + accountID: nodeId._toProtobuf(), + amount: paymentAmount.toTinybars(), + }); + } + /** + * @type {HashgraphProto.proto.ITransactionBody} + */ + const body = { + transactionID: paymentTransactionId._toProtobuf(), + nodeAccountID: nodeId._toProtobuf(), + transactionFee: new Hbar_Hbar(1).toTinybars(), + transactionValidDuration: { + seconds: src_long.fromNumber(120), + }, + cryptoTransfer: { + transfers: { + accountAmounts, + }, + }, + }; + + /** @type {HashgraphProto.proto.ISignedTransaction} */ + const signedTransaction = { + bodyBytes: lib.proto.TransactionBody.encode(body).finish(), + }; + + // Sign the transaction if an operator is provided + // + // We have _several_ places where we build the transactions, maybe this is + // something we can deduplicate? + if (operator != null) { + const signature = await operator.transactionSigner( + /** @type {Uint8Array} */ (signedTransaction.bodyBytes), + ); + + signedTransaction.sigMap = { + sigPair: [operator.publicKey._toProtobufSignature(signature)], + }; + } + + // Create and return a `proto.Transaction` + return { + signedTransactionBytes: + lib.proto.SignedTransaction.encode( + signedTransaction, + ).finish(), + }; +} + +/** + * Cache for the cost query constructor. This prevents cyclic dependencies. + * + * @type {((query: Query<*>) => import("./CostQuery.js").default<*>)[]} + */ +const COST_QUERY = []; + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * The ID for a crypto-currency contract on Hedera. + */ +class ContractId_ContractId extends src_Key_Key { + /** + * @param {number | Long | import("../EntityIdHelper").IEntityId} props + * @param {(number | Long)=} realm + * @param {(number | Long)=} num + * @param {Uint8Array=} evmAddress + */ + constructor(props, realm, num, evmAddress) { + super(); + + const result = EntityIdHelper_constructor(props, realm, num); + + this.shard = result.shard; + this.realm = result.realm; + this.num = result.num; + + this.evmAddress = evmAddress != null ? evmAddress : null; + + /** + * @type {string | null} + */ + this._checksum = null; + } + + /** + * @description This handles both long-zero format and evm address format addresses. + * If an actual evm address is passed, please use `ContractId.populateAccountNum(client)` method + * to get the actual `num` value, since there is no cryptographic relation to the evm address + * and cannot be populated directly + * @param {Long | number} shard + * @param {Long | number} realm + * @param {string} evmAddress + * @returns {ContractId} + */ + static fromEvmAddress(shard, realm, evmAddress) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + if (isLongZeroAddress(decode(evmAddress))) { + return new ContractId_ContractId(...fromSolidityAddress(evmAddress)); + } else { + return new ContractId_ContractId(shard, realm, 0, decode(evmAddress)); + } + } + + /** + * @param {string} text + * @returns {ContractId} + */ + static fromString(text) { + const result = fromStringSplitter(text); + + if (Number.isNaN(result.shard) || Number.isNaN(result.realm)) { + throw new Error("invalid format for entity ID"); + } + + const shard = + result.shard != null ? src_long.fromString(result.shard) : src_long.ZERO; + const realm = + result.realm != null ? src_long.fromString(result.realm) : src_long.ZERO; + const [num, evmAddress] = + result.numOrHex.length < 40 + ? [src_long.fromString(result.numOrHex), undefined] + : [src_long.ZERO, decode(result.numOrHex)]; + + return new ContractId_ContractId(shard, realm, num, evmAddress); + } + + /** + * @internal + * @param {HashgraphProto.proto.IContractID} id + * @returns {ContractId} + */ + static _fromProtobuf(id) { + const contractId = new ContractId_ContractId( + id.shardNum != null ? id.shardNum : 0, + id.realmNum != null ? id.realmNum : 0, + id.contractNum != null ? id.contractNum : 0, + ); + + return contractId; + } + + /** + * @returns {string | null} + */ + get checksum() { + return this._checksum; + } + + /** + * @description Gets the actual `num` field of the `ContractId` from the Mirror Node. + * Should be used after generating `ContractId.fromEvmAddress()` because it sets the `num` field to `0` + * automatically since there is no connection between the `num` and the `evmAddress` + * @param {Client} client + * @returns {Promise} + */ + async populateAccountNum(client) { + if (this.evmAddress === null) { + throw new Error("field `evmAddress` should not be null"); + } + const mirrorUrl = client.mirrorNetwork[0].slice( + 0, + client.mirrorNetwork[0].indexOf(":"), + ); + + /* eslint-disable */ + const url = `https://${mirrorUrl}/api/v1/contracts/${hex_browser_encode( + this.evmAddress, + )}`; + const mirrorAccountId = (await lib_axios.get(url)).data.contract_id; + + this.num = src_long.fromString( + mirrorAccountId.slice(mirrorAccountId.lastIndexOf(".") + 1), + ); + /* eslint-enable */ + + return this; + } + + /** + * @deprecated - Use `validateChecksum` instead + * @param {Client} client + */ + validate(client) { + console.warn("Deprecated: Use `validateChecksum` instead"); + this.validateChecksum(client); + } + + /** + * @param {Client} client + */ + validateChecksum(client) { + validateChecksum( + this.shard, + this.realm, + this.num, + this._checksum, + client, + ); + } + + /** + * @param {Uint8Array} bytes + * @returns {ContractId} + */ + static fromBytes(bytes) { + return ContractId_ContractId._fromProtobuf( + lib.proto.ContractID.decode(bytes), + ); + } + + /** + * @deprecated - Use `fromEvmAddress` instead + * @param {string} address + * @returns {ContractId} + */ + static fromSolidityAddress(address) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + if (isLongZeroAddress(decode(address))) { + return new ContractId_ContractId(...fromSolidityAddress(address)); + } else { + return this.fromEvmAddress(0, 0, address); + } + } + + /** + * @returns {string} + */ + toSolidityAddress() { + if (this.evmAddress != null) { + return hex_browser_encode(this.evmAddress); + } else { + return toSolidityAddress([ + this.shard, + this.realm, + this.num, + ]); + } + } + + /** + * @internal + * @returns {HashgraphProto.proto.IContractID} + */ + _toProtobuf() { + return { + contractNum: this.num, + shardNum: this.shard, + realmNum: this.realm, + evmAddress: this.evmAddress, + }; + } + + /** + * @returns {string} + */ + toString() { + if (this.evmAddress != null) { + return `${this.shard.toString()}.${this.realm.toString()}.${hex_browser_encode( + this.evmAddress, + )}`; + } else { + return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`; + } + } + + /** + * @param {Client} client + * @returns {string} + */ + toStringWithChecksum(client) { + return toStringWithChecksum(this.toString(), client); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.ContractID.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {ContractId} + */ + clone() { + const id = new ContractId_ContractId(this); + id._checksum = this._checksum; + id.evmAddress = this.evmAddress; + return id; + } + + /** + * @param {ContractId} other + * @returns {number} + */ + compare(other) { + return EntityIdHelper_compare( + [this.shard, this.realm, this.num], + [other.shard, other.realm, other.num], + ); + } + + /** + * @param {this} other + * @returns {boolean} + */ + equals(other) { + let evmAddresses = false; + if (this.evmAddress != null && other.evmAddress != null) { + evmAddresses = src_array_arrayEqual(this.evmAddress, other.evmAddress); + } + + return ( + this.shard.eq(other.shard) && + this.realm.eq(other.realm) && + this.num.eq(other.num) && + evmAddresses + ); + } + + /** + * @returns {HashgraphProto.proto.IKey} + */ + _toProtobufKey() { + return { + contractID: this._toProtobuf(), + }; + } + + /** + * @param {HashgraphProto.proto.IContractID} key + * @returns {ContractId} + */ + static __fromProtobufKey(key) { + return ContractId_ContractId._fromProtobuf(key); + } +} + +src_Cache.setContractId((key) => ContractId_ContractId.__fromProtobufKey(key)); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * The ID for a crypto-currency file on Hedera. + */ +class FileId { + /** + * @param {number | Long | import("../EntityIdHelper").IEntityId} props + * @param {(number | Long)=} realm + * @param {(number | Long)=} num + */ + constructor(props, realm, num) { + const result = EntityIdHelper_constructor(props, realm, num); + + this.shard = result.shard; + this.realm = result.realm; + this.num = result.num; + + /** + * @type {string | null} + */ + this._checksum = null; + } + + /** + * @param {string} text + * @returns {FileId} + */ + static fromString(text) { + const result = fromString(text); + const id = new FileId(result); + id._checksum = result.checksum; + return id; + } + + /** + * @internal + * @param {HashgraphProto.proto.IFileID} id + * @returns {FileId} + */ + static _fromProtobuf(id) { + const fileId = new FileId( + id.shardNum != null ? src_long.fromString(id.shardNum.toString()) : 0, + id.realmNum != null ? src_long.fromString(id.realmNum.toString()) : 0, + id.fileNum != null ? src_long.fromString(id.fileNum.toString()) : 0, + ); + + return fileId; + } + + /** + * @returns {string | null} + */ + get checksum() { + return this._checksum; + } + + /** + * @deprecated - Use `validateChecksum` instead + * @param {Client} client + */ + validate(client) { + console.warn("Deprecated: Use `validateChecksum` instead"); + this.validateChecksum(client); + } + + /** + * @param {Client} client + */ + validateChecksum(client) { + validateChecksum( + this.shard, + this.realm, + this.num, + this._checksum, + client, + ); + } + + /** + * @param {Uint8Array} bytes + * @returns {FileId} + */ + static fromBytes(bytes) { + return FileId._fromProtobuf(lib.proto.FileID.decode(bytes)); + } + + /** + * @param {string} address + * @returns {FileId} + */ + static fromSolidityAddress(address) { + const [shard, realm, file] = fromSolidityAddress(address); + return new FileId(shard, realm, file); + } + + /** + * @returns {string} solidity address + */ + toSolidityAddress() { + return toSolidityAddress([this.shard, this.realm, this.num]); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IFileID} + */ + _toProtobuf() { + return { + fileNum: this.num, + shardNum: this.shard, + realmNum: this.realm, + }; + } + + /** + * @returns {string} + */ + toString() { + return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`; + } + + /** + * @param {Client} client + * @returns {string} + */ + toStringWithChecksum(client) { + return toStringWithChecksum(this.toString(), client); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.FileID.encode(this._toProtobuf()).finish(); + } + + /** + * @returns {FileId} + */ + clone() { + const id = new FileId(this); + id._checksum = this._checksum; + return id; + } + + /** + * @param {FileId} other + * @returns {number} + */ + compare(other) { + return EntityIdHelper_compare( + [this.shard, this.realm, this.num], + [other.shard, other.realm, other.num], + ); + } +} + +/** + * The public node address book for the current network. + */ +FileId.ADDRESS_BOOK = new FileId(102); + +/** + * The current fee schedule for the network. + */ +FileId.FEE_SCHEDULE = new FileId(111); + +/** + * The current exchange rate of HBAR to USD. + */ +FileId.EXCHANGE_RATES = new FileId(112); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {import("long").Long} Long + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * Unique identifier for a topic (used by the consensus service). + */ +class TopicId_TopicId { + /** + * @param {number | Long | import("../EntityIdHelper").IEntityId} props + * @param {(number | Long)=} realm + * @param {(number | Long)=} num + */ + constructor(props, realm, num) { + const result = EntityIdHelper_constructor(props, realm, num); + + this.shard = result.shard; + this.realm = result.realm; + this.num = result.num; + + /** + * @type {string | null} + */ + this._checksum = null; + } + + /** + * @param {string} text + * @returns {TopicId} + */ + static fromString(text) { + const result = fromString(text); + const id = new TopicId_TopicId(result); + id._checksum = result.checksum; + return id; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITopicID} id + * @returns {TopicId} + */ + static _fromProtobuf(id) { + const topicId = new TopicId_TopicId( + id.shardNum != null ? id.shardNum : 0, + id.realmNum != null ? id.realmNum : 0, + id.topicNum != null ? id.topicNum : 0, + ); + + return topicId; + } + + /** + * @returns {string | null} + */ + get checksum() { + return this._checksum; + } + + /** + * @deprecated - Use `validateChecksum` instead + * @param {Client} client + */ + validate(client) { + console.warn("Deprecated: Use `validateChecksum` instead"); + this.validateChecksum(client); + } + + /** + * @param {Client} client + */ + validateChecksum(client) { + validateChecksum( + this.shard, + this.realm, + this.num, + this._checksum, + client, + ); + } + + /** + * @param {Uint8Array} bytes + * @returns {TopicId} + */ + static fromBytes(bytes) { + return TopicId_TopicId._fromProtobuf( + lib.proto.TopicID.decode(bytes), + ); + } + + /** + * @param {string} address + * @returns {TopicId} + */ + static fromSolidityAddress(address) { + const [shard, realm, topic] = fromSolidityAddress(address); + return new TopicId_TopicId(shard, realm, topic); + } + + /** + * @returns {string} + */ + toSolidityAddress() { + return toSolidityAddress([this.shard, this.realm, this.num]); + } + + /** + * @returns {HashgraphProto.proto.ITopicID} + */ + _toProtobuf() { + return { + topicNum: this.num, + shardNum: this.shard, + realmNum: this.realm, + }; + } + + /** + * @returns {string} + */ + toString() { + return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`; + } + + /** + * @param {Client} client + * @returns {string} + */ + toStringWithChecksum(client) { + return toStringWithChecksum(this.toString(), client); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.TopicID.encode(this._toProtobuf()).finish(); + } + + /** + * @returns {TopicId} + */ + clone() { + const id = new TopicId_TopicId(this); + id._checksum = this._checksum; + return id; + } + + /** + * @param {TopicId} other + * @returns {number} + */ + compare(other) { + return EntityIdHelper_compare( + [this.shard, this.realm, this.num], + [other.shard, other.realm, other.num], + ); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {import("long").Long} Long + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * The ID for a crypto-currency token on Hedera. + */ +class TokenId_TokenId { + /** + * @param {number | Long | import("../EntityIdHelper").IEntityId} props + * @param {(number | Long)=} realm + * @param {(number | Long)=} num + */ + constructor(props, realm, num) { + const result = EntityIdHelper_constructor(props, realm, num); + + this.shard = result.shard; + this.realm = result.realm; + this.num = result.num; + + /** + * @type {string | null} + */ + this._checksum = null; + } + + /** + * @param {string} text + * @returns {TokenId} + */ + static fromString(text) { + const result = fromString(text); + const id = new TokenId_TokenId(result); + id._checksum = result.checksum; + return id; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITokenID} id + * @returns {TokenId} + */ + static _fromProtobuf(id) { + const tokenId = new TokenId_TokenId( + id.shardNum != null ? id.shardNum : 0, + id.realmNum != null ? id.realmNum : 0, + id.tokenNum != null ? id.tokenNum : 0, + ); + + return tokenId; + } + + /** + * @returns {string | null} + */ + get checksum() { + return this._checksum; + } + + /** + * @deprecated - Use `validateChecksum` instead + * @param {Client} client + */ + validate(client) { + console.warn("Deprecated: Use `validateChecksum` instead"); + this.validateChecksum(client); + } + + /** + * @param {Client} client + */ + validateChecksum(client) { + validateChecksum( + this.shard, + this.realm, + this.num, + this._checksum, + client, + ); + } + + /** + * @param {Uint8Array} bytes + * @returns {TokenId} + */ + static fromBytes(bytes) { + return TokenId_TokenId._fromProtobuf( + lib.proto.TokenID.decode(bytes), + ); + } + + /** + * @param {string} address + * @returns {TokenId} + */ + static fromSolidityAddress(address) { + return new TokenId_TokenId(...fromSolidityAddress(address)); + } + + /** + * @returns {string} + */ + toSolidityAddress() { + return toSolidityAddress([this.shard, this.realm, this.num]); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ITokenID} + */ + _toProtobuf() { + return { + tokenNum: this.num, + shardNum: this.shard, + realmNum: this.realm, + }; + } + + /** + * @returns {string} + */ + toString() { + return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`; + } + + /** + * @param {Client} client + * @returns {string} + */ + toStringWithChecksum(client) { + return toStringWithChecksum(this.toString(), client); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.TokenID.encode(this._toProtobuf()).finish(); + } + + /** + * @returns {TokenId} + */ + clone() { + const id = new TokenId_TokenId(this); + id._checksum = this._checksum; + return id; + } + + /** + * @param {TokenId} other + * @returns {number} + */ + compare(other) { + return EntityIdHelper_compare( + [this.shard, this.realm, this.num], + [other.shard, other.realm, other.num], + ); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {import("long").Long} Long + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * + * @augments {EntityId} + */ + +class ScheduleId { + /** + * @param {number | Long | import("../EntityIdHelper").IEntityId} props + * @param {(number | Long)=} realm + * @param {(number | Long)=} num + */ + constructor(props, realm, num) { + const result = EntityIdHelper_constructor(props, realm, num); + + this.shard = result.shard; + this.realm = result.realm; + this.num = result.num; + + /** + * @type {string | null} + */ + this._checksum = null; + } + + /** + * @param {string} text + * @returns {ScheduleId} + */ + static fromString(text) { + const result = fromString(text); + const id = new ScheduleId(result); + id._checksum = result.checksum; + return id; + } + + /** + * @internal + * @param {HashgraphProto.proto.IScheduleID} id + * @returns {ScheduleId} + */ + static _fromProtobuf(id) { + const scheduleId = new ScheduleId( + id.shardNum != null ? id.shardNum : 0, + id.realmNum != null ? id.realmNum : 0, + id.scheduleNum != null ? id.scheduleNum : 0, + ); + + return scheduleId; + } + + /** + * @returns {string | null} + */ + get checksum() { + return this._checksum; + } + + /** + * @deprecated - Use `validateChecksum` instead + * @param {Client} client + */ + validate(client) { + console.warn("Deprecated: Use `validateChecksum` instead"); + this.validateChecksum(client); + } + + /** + * @param {Client} client + */ + validateChecksum(client) { + validateChecksum( + this.shard, + this.realm, + this.num, + this._checksum, + client, + ); + } + + /** + * @param {Uint8Array} bytes + * @returns {ScheduleId} + */ + static fromBytes(bytes) { + return ScheduleId._fromProtobuf( + lib.proto.ScheduleID.decode(bytes), + ); + } + + /** + * @param {string} address + * @returns {ScheduleId} + */ + static fromSolidityAddress(address) { + return new ScheduleId(...fromSolidityAddress(address)); + } + + /** + * @returns {string} + */ + toSolidityAddress() { + return toSolidityAddress([this.shard, this.realm, this.num]); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ScheduleID} + */ + _toProtobuf() { + return { + scheduleNum: this.num, + shardNum: this.shard, + realmNum: this.realm, + }; + } + + /** + * @returns {string} + */ + toString() { + return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`; + } + + /** + * @param {Client} client + * @returns {string} + */ + toStringWithChecksum(client) { + return toStringWithChecksum(this.toString(), client); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.ScheduleID.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {ScheduleId} + */ + clone() { + const id = new ScheduleId(this); + id._checksum = this._checksum; + return id; + } + + /** + * @param {ScheduleId} other + * @returns {number} + */ + compare(other) { + return EntityIdHelper_compare( + [this.shard, this.realm, this.num], + [other.shard, other.realm, other.num], + ); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/ExchangeRate.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @typedef {object} ExchangeRateJSON + * @property {number} hbars + * @property {number} cents + * @property {Date} expirationTime + * @property {number} exchangeRateInCents + */ + +class ExchangeRate_ExchangeRate { + /** + * @private + * @param {object} props + * @param {number} props.hbars + * @param {number} props.cents + * @param {Date} props.expirationTime + */ + constructor(props) { + /** + * Denotes Hbar equivalent to cents (USD) + * + * @readonly + * @type {number} + */ + this.hbars = props.hbars; + + /** + * Denotes cents (USD) equivalent to Hbar + * + * @readonly + * @type {number} + */ + this.cents = props.cents; + + /** + * Expiration time of this exchange rate + * + * @readonly + * @type {Date} + */ + this.expirationTime = props.expirationTime; + + /** + * Calculated exchange rate + * + * @readonly + * @type {number} + */ + this.exchangeRateInCents = props.cents / props.hbars; + + Object.freeze(this); + } + + /** + * @internal + * @param {import("@hashgraph/proto").proto.IExchangeRate} rate + * @returns {ExchangeRate} + */ + static _fromProtobuf(rate) { + return new ExchangeRate_ExchangeRate({ + hbars: /** @type {number} */ (rate.hbarEquiv), + cents: /** @type {number} */ (rate.centEquiv), + expirationTime: new Date( + rate.expirationTime != null + ? rate.expirationTime.seconds != null + ? src_long.isLong(rate.expirationTime.seconds) + ? rate.expirationTime.seconds.toInt() * 1000 + : rate.expirationTime.seconds + : 0 + : 0, + ), + }); + } + + /** + * @internal + * @returns {import("@hashgraph/proto").proto.IExchangeRate} + */ + _toProtobuf() { + return { + hbarEquiv: this.hbars, + centEquiv: this.cents, + expirationTime: { + seconds: src_long.fromNumber( + Math.trunc(this.expirationTime.getTime() / 1000), + ), + }, + }; + } + + /** + * @returns {ExchangeRateJSON} + */ + toJSON() { + return { + hbars: this.hbars, + cents: this.cents, + expirationTime: this.expirationTime, + exchangeRateInCents: this.exchangeRateInCents, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + + + +/** + * @typedef {import("../ExchangeRate.js").ExchangeRateJSON} ExchangeRateJSON + */ + +/** + * @typedef {object} TransactionReceiptJSON + * @property {string} status + * @property {?string} accountId + * @property {?string} filedId + * @property {?string} contractId + * @property {?string} topicId + * @property {?string} tokenId + * @property {?string} scheduleId + * @property {?ExchangeRateJSON} exchangeRate + * @property {?string} topicSequenceNumber + * @property {?string} topicRunningHash + * @property {?string} totalSupply + * @property {?string} scheduledTransactionId + * @property {string[]} serials + * @property {TransactionReceiptJSON[]} duplicates + * @property {TransactionReceiptJSON[]} children + * @property {?string} nodeId + */ + +/** + * The consensus result for a transaction, which might not be currently known, + * or may succeed or fail. + */ +class TransactionReceipt { + /** + * @private + * @param {object} props + * @param {Status} props.status + * @param {?AccountId} props.accountId + * @param {?FileId} props.fileId + * @param {?ContractId} props.contractId + * @param {?TopicId} props.topicId + * @param {?TokenId} props.tokenId + * @param {?ScheduleId} props.scheduleId + * @param {?ExchangeRate} props.exchangeRate + * @param {?Long} props.topicSequenceNumber + * @param {?Uint8Array} props.topicRunningHash + * @param {?Long} props.totalSupply + * @param {?TransactionId} props.scheduledTransactionId + * @param {Long[]} props.serials + * @param {TransactionReceipt[]} props.duplicates + * @param {TransactionReceipt[]} props.children + * @param {?Long} props.nodeId + */ + constructor(props) { + /** + * Whether the transaction succeeded or failed (or is unknown). + * + * @readonly + */ + this.status = props.status; + + /** + * The account ID, if a new account was created. + * + * @readonly + */ + this.accountId = props.accountId; + + /** + * The file ID, if a new file was created. + * + * @readonly + */ + this.fileId = props.fileId; + + /** + * The contract ID, if a new contract was created. + * + * @readonly + */ + this.contractId = props.contractId; + + /** + * The topic ID, if a new topic was created. + * + * @readonly + */ + this.topicId = props.topicId; + + /** + * The token ID, if a new token was created. + * + * @readonly + */ + this.tokenId = props.tokenId; + + /** + * The schedule ID, if a new schedule was created. + * + * @readonly + */ + this.scheduleId = props.scheduleId; + + /** + * The exchange rate of Hbars to cents (USD). + * + * @readonly + */ + this.exchangeRate = props.exchangeRate; + + /** + * Updated sequence number for a consensus service topic. + * + * @readonly + */ + this.topicSequenceNumber = props.topicSequenceNumber; + + /** + * Updated running hash for a consensus service topic. + * + * @readonly + */ + this.topicRunningHash = props.topicRunningHash; + + /** + * Updated total supply for a token + * + * @readonly + */ + this.totalSupply = props.totalSupply; + + this.scheduledTransactionId = props.scheduledTransactionId; + + this.serials = props.serials ?? []; + + /** + * @readonly + */ + this.duplicates = props.duplicates ?? []; + + /** + * @readonly + */ + this.children = props.children ?? []; + + /** + * @readonly + * @description In the receipt of a NodeCreate, NodeUpdate, NodeDelete, the id of the newly created node. + * An affected node identifier. + * This value SHALL be set following a `createNode` transaction. + * This value SHALL be set following a `updateNode` transaction. + * This value SHALL be set following a `deleteNode` transaction. + * This value SHALL NOT be set following any other transaction. + */ + this.nodeId = props.nodeId; + + Object.freeze(this); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ITransactionGetReceiptResponse} + */ + _toProtobuf() { + const duplicates = this.duplicates.map( + (receipt) => + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + receipt._toProtobuf().receipt + ), + ); + const children = this.children.map( + (receipt) => + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + receipt._toProtobuf().receipt + ), + ); + + return { + duplicateTransactionReceipts: duplicates, + childTransactionReceipts: children, + receipt: { + status: this.status.valueOf(), + + accountID: + this.accountId != null + ? this.accountId._toProtobuf() + : null, + fileID: this.fileId != null ? this.fileId._toProtobuf() : null, + contractID: + this.contractId != null + ? this.contractId._toProtobuf() + : null, + topicID: + this.topicId != null ? this.topicId._toProtobuf() : null, + tokenID: + this.tokenId != null ? this.tokenId._toProtobuf() : null, + scheduleID: + this.scheduleId != null + ? this.scheduleId._toProtobuf() + : null, + + topicRunningHash: + this.topicRunningHash == null + ? null + : this.topicRunningHash, + + topicSequenceNumber: this.topicSequenceNumber, + + exchangeRate: { + nextRate: null, + currentRate: + this.exchangeRate != null + ? this.exchangeRate._toProtobuf() + : null, + }, + + scheduledTransactionID: + this.scheduledTransactionId != null + ? this.scheduledTransactionId._toProtobuf() + : null, + + serialNumbers: this.serials, + newTotalSupply: this.totalSupply, + nodeId: this.nodeId, + }, + }; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransactionGetReceiptResponse} response + * @returns {TransactionReceipt} + */ + static _fromProtobuf(response) { + const receipt = + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + response.receipt + ); + + const exchangeRateSet = + /** @type {HashgraphProto.proto.IExchangeRateSet} */ ( + receipt.exchangeRate + ); + + const children = + response.childTransactionReceipts != null + ? response.childTransactionReceipts.map((child) => + TransactionReceipt._fromProtobuf({ receipt: child }), + ) + : []; + + const duplicates = + response.duplicateTransactionReceipts != null + ? response.duplicateTransactionReceipts.map((duplicate) => + TransactionReceipt._fromProtobuf({ receipt: duplicate }), + ) + : []; + + return new TransactionReceipt({ + status: Status._fromCode( + receipt.status != null ? receipt.status : 0, + ), + + accountId: + receipt.accountID != null + ? AccountId_AccountId._fromProtobuf(receipt.accountID) + : null, + + fileId: + receipt.fileID != null + ? FileId._fromProtobuf(receipt.fileID) + : null, + + contractId: + receipt.contractID != null + ? ContractId_ContractId._fromProtobuf(receipt.contractID) + : null, + + topicId: + receipt.topicID != null + ? TopicId_TopicId._fromProtobuf(receipt.topicID) + : null, + + tokenId: + receipt.tokenID != null + ? TokenId_TokenId._fromProtobuf(receipt.tokenID) + : null, + + scheduleId: + receipt.scheduleID != null + ? ScheduleId._fromProtobuf(receipt.scheduleID) + : null, + + exchangeRate: + receipt.exchangeRate != null + ? ExchangeRate_ExchangeRate._fromProtobuf( + /** @type {HashgraphProto.proto.IExchangeRate} */ + (exchangeRateSet.currentRate), + ) + : null, + + topicSequenceNumber: + receipt.topicSequenceNumber == null + ? null + : src_long.fromString(receipt.topicSequenceNumber.toString()), + + topicRunningHash: + receipt.topicRunningHash != null + ? new Uint8Array(receipt.topicRunningHash) + : null, + + totalSupply: + receipt.newTotalSupply != null + ? src_long.fromString(receipt.newTotalSupply.toString()) + : null, + + scheduledTransactionId: + receipt.scheduledTransactionID != null + ? TransactionId_TransactionId._fromProtobuf( + receipt.scheduledTransactionID, + ) + : null, + serials: + receipt.serialNumbers != null + ? receipt.serialNumbers.map((serial) => + src_long.fromValue(serial), + ) + : [], + children, + duplicates, + nodeId: receipt.nodeId != null ? receipt.nodeId : null, + }); + } + + /** + * @param {Uint8Array} bytes + * @returns {TransactionReceipt} + */ + static fromBytes(bytes) { + return TransactionReceipt._fromProtobuf( + lib.proto.TransactionGetReceiptResponse.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.TransactionGetReceiptResponse.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {TransactionReceiptJSON} + */ + toJSON() { + return { + status: this.status.toString(), + accountId: this.accountId?.toString() || null, + filedId: this.fileId?.toString() || null, + contractId: this.contractId?.toString() || null, + topicId: this.topicId?.toString() || null, + tokenId: this.tokenId?.toString() || null, + scheduleId: this.scheduleId?.toString() || null, + exchangeRate: this.exchangeRate?.toJSON() || null, + topicSequenceNumber: this.topicSequenceNumber?.toString() || null, + topicRunningHash: + this.topicRunningHash != null + ? hex_browser_encode(this.topicRunningHash) + : null, + totalSupply: this.totalSupply?.toString() || null, + scheduledTransactionId: + this.scheduledTransactionId?.toString() || null, + serials: this.serials.map((serial) => serial.toString()), + duplicates: this.duplicates.map((receipt) => receipt.toJSON()), + children: this.children.map((receipt) => receipt.toJSON()), + nodeId: this.nodeId?.toString() || null, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/TransactionReceiptQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + +const { proto } = lib_namespaceObject; + +/** + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * @augments {Query} + */ +class TransactionReceiptQuery extends Query_Query { + /** + * @param {object} [props] + * @param {TransactionId | string} [props.transactionId] + * @param {boolean} [props.includeDuplicates] + * @param {boolean} [props.includeChildren] + * @param {boolean} [props.validateStatus] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TransactionId} + */ + this._transactionId = null; + + /** + * @private + * @type {?boolean} + */ + this._includeChildren = null; + + /** + * @private + * @type {?boolean} + */ + this._includeDuplicates = null; + + this._validateStatus = true; + + if (props.transactionId != null) { + this.setTransactionId(props.transactionId); + } + + if (props.includeChildren != null) { + this.setIncludeChildren(props.includeChildren); + } + + if (props.includeDuplicates != null) { + this.setIncludeDuplicates(props.includeDuplicates); + } + + if (props.validateStatus != null) { + this.setValidateStatus(props.validateStatus); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {TransactionReceiptQuery} + */ + static _fromProtobuf(query) { + const receipt = + /** @type {HashgraphProto.proto.ITransactionGetReceiptQuery} */ ( + query.transactionGetReceipt + ); + + return new TransactionReceiptQuery({ + transactionId: receipt.transactionID + ? TransactionId_TransactionId._fromProtobuf(receipt.transactionID) + : undefined, + includeDuplicates: + receipt.includeDuplicates != null + ? receipt.includeDuplicates + : undefined, + includeChildren: + receipt.includeChildReceipts != null + ? receipt.includeChildReceipts + : undefined, + }); + } + + /** + * @returns {?TransactionId} + */ + get transactionId() { + return this._transactionId; + } + + /** + * Set the transaction ID for which the receipt is being requested. + * + * @param {TransactionId | string} transactionId + * @returns {this} + */ + setTransactionId(transactionId) { + this._transactionId = + typeof transactionId === "string" + ? TransactionId_TransactionId.fromString(transactionId) + : transactionId.clone(); + + return this; + } + + /** + * @param {boolean} includeDuplicates + * @returns {TransactionReceiptQuery} + */ + setIncludeDuplicates(includeDuplicates) { + this._includeDuplicates = includeDuplicates; + return this; + } + + /** + * @returns {boolean} + */ + get includeDuplicates() { + return this._includeDuplicates != null + ? this._includeDuplicates + : false; + } + + /** + * @param {boolean} includeChildren + * @returns {TransactionReceiptQuery} + */ + setIncludeChildren(includeChildren) { + this._includeChildren = includeChildren; + return this; + } + + /** + * @returns {boolean} + */ + get includeChildren() { + return this._includeChildren != null ? this._includeChildren : false; + } + + /** + * @param {boolean} validateStatus + * @returns {this} + */ + setValidateStatus(validateStatus) { + this._validateStatus = validateStatus; + return this; + } + + /** + * @returns {boolean} + */ + get validateStatus() { + return this._validateStatus; + } + + /** + * @override + * @protected + * @returns {boolean} + */ + _isPaymentRequired() { + return false; + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @returns {[Status, ExecutionState]} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _shouldRetry(request, response) { + const { nodeTransactionPrecheckCode } = + this._mapResponseHeader(response); + + let status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : proto.ResponseCodeEnum.OK, + ); + + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] received node precheck status ${status.toString()}`, + ); + } + + switch (status) { + case Status.Busy: + case Status.Unknown: + case Status.ReceiptNotFound: + case Status.PlatformNotActive: + return [status, ExecutionState.Retry]; + case Status.Ok: + break; + default: + return [status, ExecutionState.Error]; + } + + const transactionGetReceipt = + /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ ( + response.transactionGetReceipt + ); + const receipt = + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + transactionGetReceipt.receipt + ); + const receiptStatusCode = + /** @type {HashgraphProto.proto.ResponseCodeEnum} */ ( + receipt.status + ); + + status = Status._fromCode(receiptStatusCode); + + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] received receipt status ${status.toString()}`, + ); + } + + switch (status) { + case Status.Busy: + case Status.Unknown: + case Status.ReceiptNotFound: + return [status, ExecutionState.Retry]; + case Status.Success: + case Status.FeeScheduleFilePartUploaded: + return [status, ExecutionState.Finished]; + default: + return [ + status, + this._validateStatus + ? ExecutionState.Error + : ExecutionState.Finished, + ]; + } + } + + /** + * @returns {TransactionId} + */ + _getTransactionId() { + if (this._transactionId != null) { + return this._transactionId; + } + + return super._getTransactionId(); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeId + * @returns {Error} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapStatusError(request, response, nodeId) { + const { nodeTransactionPrecheckCode } = + this._mapResponseHeader(response); + + let status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : proto.ResponseCodeEnum.OK, + ); + + switch (status) { + case Status.Ok: + // Do nothing + break; + + default: + return new PrecheckStatusError({ + nodeId, + status, + transactionId: this._getTransactionId(), + contractFunctionResult: null, + }); + } + + const transactionGetReceipt = + /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ ( + response.transactionGetReceipt + ); + const receipt = + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + transactionGetReceipt.receipt + ); + const receiptStatusCode = + /** @type {HashgraphProto.proto.ResponseCodeEnum} */ ( + receipt.status + ); + + status = Status._fromCode(receiptStatusCode); + + if (this._transactionId == null) { + throw new Error( + "Failed to construct `ReceiptStatusError` because `transactionId` is `null`", + ); + } + + return new ReceiptStatusError({ + status, + transactionId: this._transactionId, + transactionReceipt: TransactionReceipt._fromProtobuf( + transactionGetReceipt, + ), + }); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if ( + this._transactionId != null && + this._transactionId.accountId != null + ) { + this._transactionId.accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.getTransactionReceipts(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const transactionGetReceipt = + /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ ( + response.transactionGetReceipt + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + transactionGetReceipt.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const transactionGetReceipt = + /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ ( + response.transactionGetReceipt + ); + + return Promise.resolve( + TransactionReceipt._fromProtobuf(transactionGetReceipt), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + transactionGetReceipt: { + header, + transactionID: + this._transactionId != null + ? this._transactionId._toProtobuf() + : null, + includeDuplicates: this._includeDuplicates, + includeChildReceipts: this._includeChildren, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + return `TransactionReceiptQuery:${this._timestamp.toString()}`; + } +} + +QUERY_REGISTRY.set( + "transactionGetReceipt", + // eslint-disable-next-line @typescript-eslint/unbound-method + TransactionReceiptQuery._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Transfer.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {object} TransferJSON + * @property {string} accountId + * @property {string} amount + * @property {boolean} isApproved + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("long")} Long + */ + +/** + * An account, and the amount that it sends or receives during a cryptocurrency transfer. + */ +class Transfer { + /** + * @internal + * @param {object} props + * @param {AccountId | string} props.accountId + * @param {number | string | Long | BigNumber | Hbar} props.amount + * @param {boolean} props.isApproved + */ + constructor(props) { + /** + * The Account ID that sends or receives cryptocurrency. + * + * @readonly + */ + this.accountId = + props.accountId instanceof AccountId_AccountId + ? props.accountId + : AccountId_AccountId.fromString(props.accountId); + + /** + * The amount of tinybars that the account sends(negative) or receives(positive). + */ + this.amount = + props.amount instanceof Hbar_Hbar + ? props.amount + : new Hbar_Hbar(props.amount); + + this.isApproved = props.isApproved; + } + + /** + * @internal + * @param {HashgraphProto.proto.IAccountAmount[]} accountAmounts + * @returns {Transfer[]} + */ + static _fromProtobuf(accountAmounts) { + const transfers = []; + + for (const transfer of accountAmounts) { + transfers.push( + new Transfer({ + accountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + transfer.accountID + ), + ), + amount: Hbar_Hbar.fromTinybars( + transfer.amount != null ? transfer.amount : 0, + ), + isApproved: /** @type {boolean} */ (transfer.isApproval), + }), + ); + } + + return transfers; + } + + /** + * @internal + * @returns {HashgraphProto.proto.IAccountAmount} + */ + _toProtobuf() { + return { + accountID: this.accountId._toProtobuf(), + amount: this.amount.toTinybars(), + isApproval: this.isApproved, + }; + } + + /** + * @returns {TransferJSON} + */ + toJSON() { + return { + accountId: this.accountId.toString(), + amount: this.amount.toTinybars().toString(), + isApproved: this.isApproved, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractLogInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IContractLoginfo} HashgraphProto.proto.IContractLoginfo + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + */ + +/** + * The log information for an event returned by a smart contract function call. One function call + * may return several such events. + */ +class ContractLogInfo { + /** + * @param {object} props + * @param {ContractId} props.contractId + * @param {Uint8Array} props.bloom + * @param {Uint8Array[]} props.topics + * @param {Uint8Array} props.data + */ + constructor(props) { + /** + * Address of a contract that emitted the event. + * + * @readonly + */ + this.contractId = props.contractId; + + /** + * Bloom filter for a particular log. + * + * @readonly + */ + this.bloom = props.bloom; + + /** + * Topics of a particular event. + * + * @readonly + */ + this.topics = props.topics; + + /** + * Event data. + * + * @readonly + */ + this.data = props.data; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.IContractLoginfo} info + * @returns {ContractLogInfo} + */ + static _fromProtobuf(info) { + return new ContractLogInfo({ + contractId: ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + info.contractID + ), + ), + bloom: info.bloom != null ? info.bloom : new Uint8Array(), + topics: info.topic != null ? info.topic : [], + data: info.data != null ? info.data : new Uint8Array(), + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IContractLoginfo} + */ + _toProtobuf() { + return { + contractID: this.contractId._toProtobuf(), + bloom: this.bloom, + topic: this.topics, + data: this.data, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @param {Uint8Array} data + * @returns {string} + */ +function encoding_utf8_browser_decode(data) { + // eslint-disable-next-line n/no-unsupported-features/node-builtins + return new TextDecoder().decode(data); +} + +/** + * @param {string} text + * @returns {Uint8Array} + */ +function encoding_utf8_browser_encode(text) { + // eslint-disable-next-line n/no-unsupported-features/node-builtins + return new TextEncoder().encode(text); +} + +;// CONCATENATED MODULE: ./node_modules/@ethersproject/logger/lib.esm/_version.js +const version = "logger/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + +let _permanentCensorErrors = false; +let _censorErrors = false; +const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 }; +let _logLevel = LogLevels["default"]; + +let _globalLogger = null; +function _checkNormalize() { + try { + const missing = []; + // Make sure all forms of normalization are supported + ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { + try { + if ("test".normalize(form) !== "test") { + throw new Error("bad normalize"); + } + ; + } + catch (error) { + missing.push(form); + } + }); + if (missing.length) { + throw new Error("missing " + missing.join(", ")); + } + if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) { + throw new Error("broken implementation"); + } + } + catch (error) { + return error.message; + } + return null; +} +const _normalizeError = _checkNormalize(); +var lib_esm_LogLevel; +(function (LogLevel) { + LogLevel["DEBUG"] = "DEBUG"; + LogLevel["INFO"] = "INFO"; + LogLevel["WARNING"] = "WARNING"; + LogLevel["ERROR"] = "ERROR"; + LogLevel["OFF"] = "OFF"; +})(lib_esm_LogLevel || (lib_esm_LogLevel = {})); +var ErrorCode; +(function (ErrorCode) { + /////////////////// + // Generic Errors + // Unknown Error + ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; + // Not Implemented + ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; + // Unsupported Operation + // - operation + ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; + // Network Error (i.e. Ethereum Network, such as an invalid chain ID) + // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) + ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; + // Some sort of bad response from the server + ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; + // Timeout + ErrorCode["TIMEOUT"] = "TIMEOUT"; + /////////////////// + // Operational Errors + // Buffer Overrun + ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; + // Numeric Fault + // - operation: the operation being executed + // - fault: the reason this faulted + ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; + /////////////////// + // Argument Errors + // Missing new operator to an object + // - name: The name of the class + ErrorCode["MISSING_NEW"] = "MISSING_NEW"; + // Invalid argument (e.g. value is incompatible with type) to a function: + // - argument: The argument name that was invalid + // - value: The value of the argument + ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; + // Missing argument to a function: + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; + // Too many arguments + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; + /////////////////// + // Blockchain Errors + // Call exception + // - transaction: the transaction + // - address?: the contract address + // - args?: The arguments passed into the function + // - method?: The Solidity method signature + // - errorSignature?: The EIP848 error signature + // - errorArgs?: The EIP848 error parameters + // - reason: The reason (only for EIP848 "Error(string)") + ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; + // Insufficient funds (< value + gasLimit * gasPrice) + // - transaction: the transaction attempted + ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; + // Nonce has already been used + // - transaction: the transaction attempted + ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; + // The replacement fee for the transaction is too low + // - transaction: the transaction attempted + ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; + // The gas limit could not be estimated + // - transaction: the transaction passed to estimateGas + ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; + // The transaction was replaced by one with a higher gas price + // - reason: "cancelled", "replaced" or "repriced" + // - cancelled: true if reason == "cancelled" or reason == "replaced") + // - hash: original transaction hash + // - replacement: the full TransactionsResponse for the replacement + // - receipt: the receipt of the replacement + ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; + /////////////////// + // Interaction Errors + // The user rejected the action, such as signing a message or sending + // a transaction + ErrorCode["ACTION_REJECTED"] = "ACTION_REJECTED"; +})(ErrorCode || (ErrorCode = {})); +; +const HEX = "0123456789abcdef"; +class lib_esm_Logger { + constructor(version) { + Object.defineProperty(this, "version", { + enumerable: true, + value: version, + writable: false + }); + } + _log(logLevel, args) { + const level = logLevel.toLowerCase(); + if (LogLevels[level] == null) { + this.throwArgumentError("invalid log level name", "logLevel", logLevel); + } + if (_logLevel > LogLevels[level]) { + return; + } + console.log.apply(console, args); + } + debug(...args) { + this._log(lib_esm_Logger.levels.DEBUG, args); + } + info(...args) { + this._log(lib_esm_Logger.levels.INFO, args); + } + warn(...args) { + this._log(lib_esm_Logger.levels.WARNING, args); + } + makeError(message, code, params) { + // Errors are being censored + if (_censorErrors) { + return this.makeError("censored error", code, {}); + } + if (!code) { + code = lib_esm_Logger.errors.UNKNOWN_ERROR; + } + if (!params) { + params = {}; + } + const messageDetails = []; + Object.keys(params).forEach((key) => { + const value = params[key]; + try { + if (value instanceof Uint8Array) { + let hex = ""; + for (let i = 0; i < value.length; i++) { + hex += HEX[value[i] >> 4]; + hex += HEX[value[i] & 0x0f]; + } + messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); + } + else { + messageDetails.push(key + "=" + JSON.stringify(value)); + } + } + catch (error) { + messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); + } + }); + messageDetails.push(`code=${code}`); + messageDetails.push(`version=${this.version}`); + const reason = message; + let url = ""; + switch (code) { + case ErrorCode.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode.CALL_EXCEPTION: + case ErrorCode.INSUFFICIENT_FUNDS: + case ErrorCode.MISSING_NEW: + case ErrorCode.NONCE_EXPIRED: + case ErrorCode.REPLACEMENT_UNDERPRICED: + case ErrorCode.TRANSACTION_REPLACED: + case ErrorCode.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } + if (messageDetails.length) { + message += " (" + messageDetails.join(", ") + ")"; + } + // @TODO: Any?? + const error = new Error(message); + error.reason = reason; + error.code = code; + Object.keys(params).forEach(function (key) { + error[key] = params[key]; + }); + return error; + } + throwError(message, code, params) { + throw this.makeError(message, code, params); + } + throwArgumentError(message, name, value) { + return this.throwError(message, lib_esm_Logger.errors.INVALID_ARGUMENT, { + argument: name, + value: value + }); + } + assert(condition, message, code, params) { + if (!!condition) { + return; + } + this.throwError(message, code, params); + } + assertArgument(condition, message, name, value) { + if (!!condition) { + return; + } + this.throwArgumentError(message, name, value); + } + checkNormalize(message) { + if (message == null) { + message = "platform missing String.prototype.normalize"; + } + if (_normalizeError) { + this.throwError("platform missing String.prototype.normalize", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "String.prototype.normalize", form: _normalizeError + }); + } + } + checkSafeUint53(value, message) { + if (typeof (value) !== "number") { + return; + } + if (message == null) { + message = "value not safe"; + } + if (value < 0 || value >= 0x1fffffffffffff) { + this.throwError(message, lib_esm_Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value: value + }); + } + if (value % 1) { + this.throwError(message, lib_esm_Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value: value + }); + } + } + checkArgumentCount(count, expectedCount, message) { + if (message) { + message = ": " + message; + } + else { + message = ""; + } + if (count < expectedCount) { + this.throwError("missing argument" + message, lib_esm_Logger.errors.MISSING_ARGUMENT, { + count: count, + expectedCount: expectedCount + }); + } + if (count > expectedCount) { + this.throwError("too many arguments" + message, lib_esm_Logger.errors.UNEXPECTED_ARGUMENT, { + count: count, + expectedCount: expectedCount + }); + } + } + checkNew(target, kind) { + if (target === Object || target == null) { + this.throwError("missing new", lib_esm_Logger.errors.MISSING_NEW, { name: kind.name }); + } + } + checkAbstract(target, kind) { + if (target === kind) { + this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); + } + else if (target === Object || target == null) { + this.throwError("missing new", lib_esm_Logger.errors.MISSING_NEW, { name: kind.name }); + } + } + static globalLogger() { + if (!_globalLogger) { + _globalLogger = new lib_esm_Logger(version); + } + return _globalLogger; + } + static setCensorship(censorship, permanent) { + if (!censorship && permanent) { + this.globalLogger().throwError("cannot permanently disable censorship", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + if (_permanentCensorErrors) { + if (!censorship) { + return; + } + this.globalLogger().throwError("error censorship permanent", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + _censorErrors = !!censorship; + _permanentCensorErrors = !!permanent; + } + static setLogLevel(logLevel) { + const level = LogLevels[logLevel.toLowerCase()]; + if (level == null) { + lib_esm_Logger.globalLogger().warn("invalid log level - " + logLevel); + return; + } + _logLevel = level; + } + static from(version) { + return new lib_esm_Logger(version); + } +} +lib_esm_Logger.errors = ErrorCode; +lib_esm_Logger.levels = lib_esm_LogLevel; +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/bytes/lib.esm/_version.js +const _version_version = "bytes/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + + + +const logger = new lib_esm_Logger(_version_version); +/////////////////////////////// +function isHexable(value) { + return !!(value.toHexString); +} +function addSlice(array) { + if (array.slice) { + return array; + } + array.slice = function () { + const args = Array.prototype.slice.call(arguments); + return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); + }; + return array; +} +function isBytesLike(value) { + return ((lib_esm_isHexString(value) && !(value.length % 2)) || lib_esm_isBytes(value)); +} +function isInteger(value) { + return (typeof (value) === "number" && value == value && (value % 1) === 0); +} +function lib_esm_isBytes(value) { + if (value == null) { + return false; + } + if (value.constructor === Uint8Array) { + return true; + } + if (typeof (value) === "string") { + return false; + } + if (!isInteger(value.length) || value.length < 0) { + return false; + } + for (let i = 0; i < value.length; i++) { + const v = value[i]; + if (!isInteger(v) || v < 0 || v >= 256) { + return false; + } + } + return true; +} +function lib_esm_arrayify(value, options) { + if (!options) { + options = {}; + } + if (typeof (value) === "number") { + logger.checkSafeUint53(value, "invalid arrayify value"); + const result = []; + while (value) { + result.unshift(value & 0xff); + value = parseInt(String(value / 256)); + } + if (result.length === 0) { + result.push(0); + } + return addSlice(new Uint8Array(result)); + } + if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (isHexable(value)) { + value = value.toHexString(); + } + if (lib_esm_isHexString(value)) { + let hex = value.substring(2); + if (hex.length % 2) { + if (options.hexPad === "left") { + hex = "0" + hex; + } + else if (options.hexPad === "right") { + hex += "0"; + } + else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + const result = []; + for (let i = 0; i < hex.length; i += 2) { + result.push(parseInt(hex.substring(i, i + 2), 16)); + } + return addSlice(new Uint8Array(result)); + } + if (lib_esm_isBytes(value)) { + return addSlice(new Uint8Array(value)); + } + return logger.throwArgumentError("invalid arrayify value", "value", value); +} +function lib_esm_concat(items) { + const objects = items.map(item => lib_esm_arrayify(item)); + const length = objects.reduce((accum, item) => (accum + item.length), 0); + const result = new Uint8Array(length); + objects.reduce((offset, object) => { + result.set(object, offset); + return offset + object.length; + }, 0); + return addSlice(result); +} +function lib_esm_stripZeros(value) { + let result = lib_esm_arrayify(value); + if (result.length === 0) { + return result; + } + // Find the first non-zero entry + let start = 0; + while (start < result.length && result[start] === 0) { + start++; + } + // If we started with zeros, strip them + if (start) { + result = result.slice(start); + } + return result; +} +function zeroPad(value, length) { + value = lib_esm_arrayify(value); + if (value.length > length) { + logger.throwArgumentError("value out of range", "value", arguments[0]); + } + const result = new Uint8Array(length); + result.set(value, length - value.length); + return addSlice(result); +} +function lib_esm_isHexString(value, length) { + if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (length && value.length !== 2 + 2 * length) { + return false; + } + return true; +} +const HexCharacters = "0123456789abcdef"; +function lib_esm_hexlify(value, options) { + if (!options) { + options = {}; + } + if (typeof (value) === "number") { + logger.checkSafeUint53(value, "invalid hexlify value"); + let hex = ""; + while (value) { + hex = HexCharacters[value & 0xf] + hex; + value = Math.floor(value / 16); + } + if (hex.length) { + if (hex.length % 2) { + hex = "0" + hex; + } + return "0x" + hex; + } + return "0x00"; + } + if (typeof (value) === "bigint") { + value = value.toString(16); + if (value.length % 2) { + return ("0x0" + value); + } + return "0x" + value; + } + if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (isHexable(value)) { + return value.toHexString(); + } + if (lib_esm_isHexString(value)) { + if (value.length % 2) { + if (options.hexPad === "left") { + value = "0x0" + value.substring(2); + } + else if (options.hexPad === "right") { + value += "0"; + } + else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + return value.toLowerCase(); + } + if (lib_esm_isBytes(value)) { + let result = "0x"; + for (let i = 0; i < value.length; i++) { + let v = value[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; + } + return logger.throwArgumentError("invalid hexlify value", "value", value); +} +/* +function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number { + if (typeof(value) === "string" && value.length % 2 && value.substring(0, 2) === "0x") { + return "0x0" + value.substring(2); + } + return value; +} +*/ +function lib_esm_hexDataLength(data) { + if (typeof (data) !== "string") { + data = lib_esm_hexlify(data); + } + else if (!lib_esm_isHexString(data) || (data.length % 2)) { + return null; + } + return (data.length - 2) / 2; +} +function lib_esm_hexDataSlice(data, offset, endOffset) { + if (typeof (data) !== "string") { + data = lib_esm_hexlify(data); + } + else if (!lib_esm_isHexString(data) || (data.length % 2)) { + logger.throwArgumentError("invalid hexData", "value", data); + } + offset = 2 + 2 * offset; + if (endOffset != null) { + return "0x" + data.substring(offset, 2 + 2 * endOffset); + } + return "0x" + data.substring(offset); +} +function hexConcat(items) { + let result = "0x"; + items.forEach((item) => { + result += lib_esm_hexlify(item).substring(2); + }); + return result; +} +function hexValue(value) { + const trimmed = hexStripZeros(lib_esm_hexlify(value, { hexPad: "left" })); + if (trimmed === "0x") { + return "0x0"; + } + return trimmed; +} +function hexStripZeros(value) { + if (typeof (value) !== "string") { + value = lib_esm_hexlify(value); + } + if (!lib_esm_isHexString(value)) { + logger.throwArgumentError("invalid hex string", "value", value); + } + value = value.substring(2); + let offset = 0; + while (offset < value.length && value[offset] === "0") { + offset++; + } + return "0x" + value.substring(offset); +} +function lib_esm_hexZeroPad(value, length) { + if (typeof (value) !== "string") { + value = lib_esm_hexlify(value); + } + else if (!lib_esm_isHexString(value)) { + logger.throwArgumentError("invalid hex string", "value", value); + } + if (value.length > 2 * length + 2) { + logger.throwArgumentError("value out of range", "value", arguments[1]); + } + while (value.length < 2 * length + 2) { + value = "0x0" + value.substring(2); + } + return value; +} +function lib_esm_splitSignature(signature) { + const result = { + r: "0x", + s: "0x", + _vs: "0x", + recoveryParam: 0, + v: 0, + yParityAndS: "0x", + compact: "0x" + }; + if (isBytesLike(signature)) { + let bytes = lib_esm_arrayify(signature); + // Get the r, s and v + if (bytes.length === 64) { + // EIP-2098; pull the v from the top bit of s and clear it + result.v = 27 + (bytes[32] >> 7); + bytes[32] &= 0x7f; + result.r = lib_esm_hexlify(bytes.slice(0, 32)); + result.s = lib_esm_hexlify(bytes.slice(32, 64)); + } + else if (bytes.length === 65) { + result.r = lib_esm_hexlify(bytes.slice(0, 32)); + result.s = lib_esm_hexlify(bytes.slice(32, 64)); + result.v = bytes[64]; + } + else { + logger.throwArgumentError("invalid signature string", "signature", signature); + } + // Allow a recid to be used as the v + if (result.v < 27) { + if (result.v === 0 || result.v === 1) { + result.v += 27; + } + else { + logger.throwArgumentError("signature invalid v byte", "signature", signature); + } + } + // Compute recoveryParam from v + result.recoveryParam = 1 - (result.v % 2); + // Compute _vs from recoveryParam and s + if (result.recoveryParam) { + bytes[32] |= 0x80; + } + result._vs = lib_esm_hexlify(bytes.slice(32, 64)); + } + else { + result.r = signature.r; + result.s = signature.s; + result.v = signature.v; + result.recoveryParam = signature.recoveryParam; + result._vs = signature._vs; + // If the _vs is available, use it to populate missing s, v and recoveryParam + // and verify non-missing s, v and recoveryParam + if (result._vs != null) { + const vs = zeroPad(lib_esm_arrayify(result._vs), 32); + result._vs = lib_esm_hexlify(vs); + // Set or check the recid + const recoveryParam = ((vs[0] >= 128) ? 1 : 0); + if (result.recoveryParam == null) { + result.recoveryParam = recoveryParam; + } + else if (result.recoveryParam !== recoveryParam) { + logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); + } + // Set or check the s + vs[0] &= 0x7f; + const s = lib_esm_hexlify(vs); + if (result.s == null) { + result.s = s; + } + else if (result.s !== s) { + logger.throwArgumentError("signature v mismatch _vs", "signature", signature); + } + } + // Use recid and v to populate each other + if (result.recoveryParam == null) { + if (result.v == null) { + logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature); + } + else if (result.v === 0 || result.v === 1) { + result.recoveryParam = result.v; + } + else { + result.recoveryParam = 1 - (result.v % 2); + } + } + else { + if (result.v == null) { + result.v = 27 + result.recoveryParam; + } + else { + const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2)); + if (result.recoveryParam !== recId) { + logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + } + } + } + if (result.r == null || !lib_esm_isHexString(result.r)) { + logger.throwArgumentError("signature missing or invalid r", "signature", signature); + } + else { + result.r = lib_esm_hexZeroPad(result.r, 32); + } + if (result.s == null || !lib_esm_isHexString(result.s)) { + logger.throwArgumentError("signature missing or invalid s", "signature", signature); + } + else { + result.s = lib_esm_hexZeroPad(result.s, 32); + } + const vs = lib_esm_arrayify(result.s); + if (vs[0] >= 128) { + logger.throwArgumentError("signature s out of range", "signature", signature); + } + if (result.recoveryParam) { + vs[0] |= 0x80; + } + const _vs = lib_esm_hexlify(vs); + if (result._vs) { + if (!lib_esm_isHexString(result._vs)) { + logger.throwArgumentError("signature invalid _vs", "signature", signature); + } + result._vs = lib_esm_hexZeroPad(result._vs, 32); + } + // Set or check the _vs + if (result._vs == null) { + result._vs = _vs; + } + else if (result._vs !== _vs) { + logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature); + } + } + result.yParityAndS = result._vs; + result.compact = result.r + result.yParityAndS.substring(2); + return result; +} +function joinSignature(signature) { + signature = lib_esm_splitSignature(signature); + return lib_esm_hexlify(lib_esm_concat([ + signature.r, + signature.s, + (signature.recoveryParam ? "0x1c" : "0x1b") + ])); +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/properties/lib.esm/_version.js +const lib_esm_version_version = "properties/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + +var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + +const lib_esm_logger = new lib_esm_Logger(lib_esm_version_version); +function lib_esm_defineReadOnly(object, name, value) { + Object.defineProperty(object, name, { + enumerable: true, + value: value, + writable: false, + }); +} +// Crawl up the constructor chain to find a static method +function getStatic(ctor, key) { + for (let i = 0; i < 32; i++) { + if (ctor[key]) { + return ctor[key]; + } + if (!ctor.prototype || typeof (ctor.prototype) !== "object") { + break; + } + ctor = Object.getPrototypeOf(ctor.prototype).constructor; + } + return null; +} +function resolveProperties(object) { + return __awaiter(this, void 0, void 0, function* () { + const promises = Object.keys(object).map((key) => { + const value = object[key]; + return Promise.resolve(value).then((v) => ({ key: key, value: v })); + }); + const results = yield Promise.all(promises); + return results.reduce((accum, result) => { + accum[(result.key)] = result.value; + return accum; + }, {}); + }); +} +function checkProperties(object, properties) { + if (!object || typeof (object) !== "object") { + lib_esm_logger.throwArgumentError("invalid object", "object", object); + } + Object.keys(object).forEach((key) => { + if (!properties[key]) { + lib_esm_logger.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); + } + }); +} +function shallowCopy(object) { + const result = {}; + for (const key in object) { + result[key] = object[key]; + } + return result; +} +const opaque = { bigint: true, boolean: true, "function": true, number: true, string: true }; +function _isFrozen(object) { + // Opaque objects are not mutable, so safe to copy by assignment + if (object === undefined || object === null || opaque[typeof (object)]) { + return true; + } + if (Array.isArray(object) || typeof (object) === "object") { + if (!Object.isFrozen(object)) { + return false; + } + const keys = Object.keys(object); + for (let i = 0; i < keys.length; i++) { + let value = null; + try { + value = object[keys[i]]; + } + catch (error) { + // If accessing a value triggers an error, it is a getter + // designed to do so (e.g. Result) and is therefore "frozen" + continue; + } + if (!_isFrozen(value)) { + return false; + } + } + return true; + } + return lib_esm_logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); +} +// Returns a new copy of object, such that no properties may be replaced. +// New properties may be added only to objects. +function _deepCopy(object) { + if (_isFrozen(object)) { + return object; + } + // Arrays are mutable, so we need to create a copy + if (Array.isArray(object)) { + return Object.freeze(object.map((item) => deepCopy(item))); + } + if (typeof (object) === "object") { + const result = {}; + for (const key in object) { + const value = object[key]; + if (value === undefined) { + continue; + } + lib_esm_defineReadOnly(result, key, deepCopy(value)); + } + return result; + } + return lib_esm_logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); +} +function deepCopy(object) { + return _deepCopy(object); +} +class lib_esm_Description { + constructor(info) { + for (const key in info) { + this[key] = deepCopy(info[key]); + } + } +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/_version.js +const abi_lib_esm_version_version = "abi/5.7.0"; +//# sourceMappingURL=_version.js.map +// EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/node_modules/bn.js/lib/bn.js +var lib_bn = __webpack_require__(3877); +var lib_bn_default = /*#__PURE__*/__webpack_require__.n(lib_bn); +;// CONCATENATED MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/_version.js +const bignumber_lib_esm_version_version = "bignumber/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js + +/** + * BigNumber + * + * A wrapper around the BN.js object. We use the BN.js library + * because it is used by elliptic, so it is required regardless. + * + */ + +var BN = (lib_bn_default()).BN; + + + +const bignumber_logger = new lib_esm_Logger(bignumber_lib_esm_version_version); +const _constructorGuard = {}; +const MAX_SAFE = 0x1fffffffffffff; +function isBigNumberish(value) { + return (value != null) && (lib_esm_bignumber_BigNumber.isBigNumber(value) || + (typeof (value) === "number" && (value % 1) === 0) || + (typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) || + isHexString(value) || + (typeof (value) === "bigint") || + isBytes(value)); +} +// Only warn about passing 10 into radix once +let _warnedToStringRadix = false; +class lib_esm_bignumber_BigNumber { + constructor(constructorGuard, hex) { + if (constructorGuard !== _constructorGuard) { + bignumber_logger.throwError("cannot call constructor directly; use BigNumber.from", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new (BigNumber)" + }); + } + this._hex = hex; + this._isBigNumber = true; + Object.freeze(this); + } + fromTwos(value) { + return toBigNumber(toBN(this).fromTwos(value)); + } + toTwos(value) { + return toBigNumber(toBN(this).toTwos(value)); + } + abs() { + if (this._hex[0] === "-") { + return lib_esm_bignumber_BigNumber.from(this._hex.substring(1)); + } + return this; + } + add(other) { + return toBigNumber(toBN(this).add(toBN(other))); + } + sub(other) { + return toBigNumber(toBN(this).sub(toBN(other))); + } + div(other) { + const o = lib_esm_bignumber_BigNumber.from(other); + if (o.isZero()) { + throwFault("division-by-zero", "div"); + } + return toBigNumber(toBN(this).div(toBN(other))); + } + mul(other) { + return toBigNumber(toBN(this).mul(toBN(other))); + } + mod(other) { + const value = toBN(other); + if (value.isNeg()) { + throwFault("division-by-zero", "mod"); + } + return toBigNumber(toBN(this).umod(value)); + } + pow(other) { + const value = toBN(other); + if (value.isNeg()) { + throwFault("negative-power", "pow"); + } + return toBigNumber(toBN(this).pow(value)); + } + and(other) { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("unbound-bitwise-result", "and"); + } + return toBigNumber(toBN(this).and(value)); + } + or(other) { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("unbound-bitwise-result", "or"); + } + return toBigNumber(toBN(this).or(value)); + } + xor(other) { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("unbound-bitwise-result", "xor"); + } + return toBigNumber(toBN(this).xor(value)); + } + mask(value) { + if (this.isNegative() || value < 0) { + throwFault("negative-width", "mask"); + } + return toBigNumber(toBN(this).maskn(value)); + } + shl(value) { + if (this.isNegative() || value < 0) { + throwFault("negative-width", "shl"); + } + return toBigNumber(toBN(this).shln(value)); + } + shr(value) { + if (this.isNegative() || value < 0) { + throwFault("negative-width", "shr"); + } + return toBigNumber(toBN(this).shrn(value)); + } + eq(other) { + return toBN(this).eq(toBN(other)); + } + lt(other) { + return toBN(this).lt(toBN(other)); + } + lte(other) { + return toBN(this).lte(toBN(other)); + } + gt(other) { + return toBN(this).gt(toBN(other)); + } + gte(other) { + return toBN(this).gte(toBN(other)); + } + isNegative() { + return (this._hex[0] === "-"); + } + isZero() { + return toBN(this).isZero(); + } + toNumber() { + try { + return toBN(this).toNumber(); + } + catch (error) { + throwFault("overflow", "toNumber", this.toString()); + } + return null; + } + toBigInt() { + try { + return BigInt(this.toString()); + } + catch (e) { } + return bignumber_logger.throwError("this platform does not support BigInt", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + value: this.toString() + }); + } + toString() { + // Lots of people expect this, which we do not support, so check (See: #889) + if (arguments.length > 0) { + if (arguments[0] === 10) { + if (!_warnedToStringRadix) { + _warnedToStringRadix = true; + bignumber_logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); + } + } + else if (arguments[0] === 16) { + bignumber_logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", lib_esm_Logger.errors.UNEXPECTED_ARGUMENT, {}); + } + else { + bignumber_logger.throwError("BigNumber.toString does not accept parameters", lib_esm_Logger.errors.UNEXPECTED_ARGUMENT, {}); + } + } + return toBN(this).toString(10); + } + toHexString() { + return this._hex; + } + toJSON(key) { + return { type: "BigNumber", hex: this.toHexString() }; + } + static from(value) { + if (value instanceof lib_esm_bignumber_BigNumber) { + return value; + } + if (typeof (value) === "string") { + if (value.match(/^-?0x[0-9a-f]+$/i)) { + return new lib_esm_bignumber_BigNumber(_constructorGuard, toHex(value)); + } + if (value.match(/^-?[0-9]+$/)) { + return new lib_esm_bignumber_BigNumber(_constructorGuard, toHex(new BN(value))); + } + return bignumber_logger.throwArgumentError("invalid BigNumber string", "value", value); + } + if (typeof (value) === "number") { + if (value % 1) { + throwFault("underflow", "BigNumber.from", value); + } + if (value >= MAX_SAFE || value <= -MAX_SAFE) { + throwFault("overflow", "BigNumber.from", value); + } + return lib_esm_bignumber_BigNumber.from(String(value)); + } + const anyValue = value; + if (typeof (anyValue) === "bigint") { + return lib_esm_bignumber_BigNumber.from(anyValue.toString()); + } + if (lib_esm_isBytes(anyValue)) { + return lib_esm_bignumber_BigNumber.from(lib_esm_hexlify(anyValue)); + } + if (anyValue) { + // Hexable interface (takes priority) + if (anyValue.toHexString) { + const hex = anyValue.toHexString(); + if (typeof (hex) === "string") { + return lib_esm_bignumber_BigNumber.from(hex); + } + } + else { + // For now, handle legacy JSON-ified values (goes away in v6) + let hex = anyValue._hex; + // New-form JSON + if (hex == null && anyValue.type === "BigNumber") { + hex = anyValue.hex; + } + if (typeof (hex) === "string") { + if (lib_esm_isHexString(hex) || (hex[0] === "-" && lib_esm_isHexString(hex.substring(1)))) { + return lib_esm_bignumber_BigNumber.from(hex); + } + } + } + } + return bignumber_logger.throwArgumentError("invalid BigNumber value", "value", value); + } + static isBigNumber(value) { + return !!(value && value._isBigNumber); + } +} +// Normalize the hex string +function toHex(value) { + // For BN, call on the hex string + if (typeof (value) !== "string") { + return toHex(value.toString(16)); + } + // If negative, prepend the negative sign to the normalized positive value + if (value[0] === "-") { + // Strip off the negative sign + value = value.substring(1); + // Cannot have multiple negative signs (e.g. "--0x04") + if (value[0] === "-") { + bignumber_logger.throwArgumentError("invalid hex", "value", value); + } + // Call toHex on the positive component + value = toHex(value); + // Do not allow "-0x00" + if (value === "0x00") { + return value; + } + // Negate the value + return "-" + value; + } + // Add a "0x" prefix if missing + if (value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + // Normalize zero + if (value === "0x") { + return "0x00"; + } + // Make the string even length + if (value.length % 2) { + value = "0x0" + value.substring(2); + } + // Trim to smallest even-length string + while (value.length > 4 && value.substring(0, 4) === "0x00") { + value = "0x" + value.substring(4); + } + return value; +} +function toBigNumber(value) { + return lib_esm_bignumber_BigNumber.from(toHex(value)); +} +function toBN(value) { + const hex = lib_esm_bignumber_BigNumber.from(value).toHexString(); + if (hex[0] === "-") { + return (new BN("-" + hex.substring(3), 16)); + } + return new BN(hex.substring(2), 16); +} +function throwFault(fault, operation, value) { + const params = { fault: fault, operation: operation }; + if (value != null) { + params.value = value; + } + return bignumber_logger.throwError(fault, lib_esm_Logger.errors.NUMERIC_FAULT, params); +} +// value should have no prefix +function _base36To16(value) { + return (new BN(value, 36)).toString(16); +} +// value should have no prefix +function bignumber_base16To36(value) { + return (new BN(value, 16)).toString(36); +} +//# sourceMappingURL=bignumber.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js + + + + + + +const abstract_coder_logger = new lib_esm_Logger(abi_lib_esm_version_version); +function checkResultErrors(result) { + // Find the first error (if any) + const errors = []; + const checkErrors = function (path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + try { + checkErrors(childPath, object[key]); + } + catch (error) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + return errors; +} +class Coder { + constructor(name, type, localName, dynamic) { + // @TODO: defineReadOnly these + this.name = name; + this.type = type; + this.localName = localName; + this.dynamic = dynamic; + } + _throwError(message, value) { + abstract_coder_logger.throwArgumentError(message, this.localName, value); + } +} +class Writer { + constructor(wordSize) { + lib_esm_defineReadOnly(this, "wordSize", wordSize || 32); + this._data = []; + this._dataLength = 0; + this._padding = new Uint8Array(wordSize); + } + get data() { + return hexConcat(this._data); + } + get length() { return this._dataLength; } + _writeData(data) { + this._data.push(data); + this._dataLength += data.length; + return data.length; + } + appendWriter(writer) { + return this._writeData(lib_esm_concat(writer._data)); + } + // Arrayish items; padded on the right to wordSize + writeBytes(value) { + let bytes = lib_esm_arrayify(value); + const paddingOffset = bytes.length % this.wordSize; + if (paddingOffset) { + bytes = lib_esm_concat([bytes, this._padding.slice(paddingOffset)]); + } + return this._writeData(bytes); + } + _getValue(value) { + let bytes = lib_esm_arrayify(lib_esm_bignumber_BigNumber.from(value)); + if (bytes.length > this.wordSize) { + abstract_coder_logger.throwError("value out-of-bounds", lib_esm_Logger.errors.BUFFER_OVERRUN, { + length: this.wordSize, + offset: bytes.length + }); + } + if (bytes.length % this.wordSize) { + bytes = lib_esm_concat([this._padding.slice(bytes.length % this.wordSize), bytes]); + } + return bytes; + } + // BigNumberish items; padded on the left to wordSize + writeValue(value) { + return this._writeData(this._getValue(value)); + } + writeUpdatableValue() { + const offset = this._data.length; + this._data.push(this._padding); + this._dataLength += this.wordSize; + return (value) => { + this._data[offset] = this._getValue(value); + }; + } +} +class Reader { + constructor(data, wordSize, coerceFunc, allowLoose) { + lib_esm_defineReadOnly(this, "_data", lib_esm_arrayify(data)); + lib_esm_defineReadOnly(this, "wordSize", wordSize || 32); + lib_esm_defineReadOnly(this, "_coerceFunc", coerceFunc); + lib_esm_defineReadOnly(this, "allowLoose", allowLoose); + this._offset = 0; + } + get data() { return lib_esm_hexlify(this._data); } + get consumed() { return this._offset; } + // The default Coerce function + static coerce(name, value) { + let match = name.match("^u?int([0-9]+)$"); + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + return value; + } + coerce(name, value) { + if (this._coerceFunc) { + return this._coerceFunc(name, value); + } + return Reader.coerce(name, value); + } + _peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; + if (this._offset + alignedLength > this._data.length) { + if (this.allowLoose && loose && this._offset + length <= this._data.length) { + alignedLength = length; + } + else { + abstract_coder_logger.throwError("data out-of-bounds", lib_esm_Logger.errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + return this._data.slice(this._offset, this._offset + alignedLength); + } + subReader(offset) { + return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + } + readBytes(length, loose) { + let bytes = this._peekBytes(0, length, !!loose); + this._offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + readValue() { + return lib_esm_bignumber_BigNumber.from(this.readBytes(this.wordSize)); + } +} +//# sourceMappingURL=abstract-coder.js.map +// EXTERNAL MODULE: ./node_modules/js-sha3/src/sha3.js +var sha3 = __webpack_require__(1094); +var sha3_default = /*#__PURE__*/__webpack_require__.n(sha3); +;// CONCATENATED MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js + + + +function lib_esm_keccak256(data) { + return '0x' + sha3_default().keccak_256(lib_esm_arrayify(data)); +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/address/lib.esm/_version.js +const address_lib_esm_version_version = "address/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + + + + + + + +const address_lib_esm_logger = new lib_esm_Logger(address_lib_esm_version_version); +function getChecksumAddress(address) { + if (!lib_esm_isHexString(address, 20)) { + address_lib_esm_logger.throwArgumentError("invalid address", "address", address); + } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + const hashed = lib_esm_arrayify(lib_esm_keccak256(expanded)); + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); +} +// Shims for environments that are missing some required constants and functions +const lib_esm_MAX_SAFE_INTEGER = 0x1fffffffffffff; +function log10(x) { + if (Math.log10) { + return Math.log10(x); + } + return Math.log(x) / Math.LN10; +} +// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number +// Create lookup table +const ibanLookup = {}; +for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); +} +for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); +} +// How many decimal digits can we process? (for 64-bit float, this is 15) +const safeDigits = Math.floor(log10(lib_esm_MAX_SAFE_INTEGER)); +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; +} +; +function lib_esm_getAddress(address) { + let result = null; + if (typeof (address) !== "string") { + address_lib_esm_logger.throwArgumentError("invalid address", "address", address); + } + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (address.substring(0, 2) !== "0x") { + address = "0x" + address; + } + result = getChecksumAddress(address); + // It is a checksummed address with a bad checksum + if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { + address_lib_esm_logger.throwArgumentError("bad address checksum", "address", address); + } + // Maybe ICAP? (we only support direct mode) + } + else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + if (address.substring(2, 4) !== ibanChecksum(address)) { + address_lib_esm_logger.throwArgumentError("bad icap checksum", "address", address); + } + result = _base36To16(address.substring(4)); + while (result.length < 40) { + result = "0" + result; + } + result = getChecksumAddress("0x" + result); + } + else { + address_lib_esm_logger.throwArgumentError("invalid address", "address", address); + } + return result; +} +function isAddress(address) { + try { + lib_esm_getAddress(address); + return true; + } + catch (error) { } + return false; +} +function getIcapAddress(address) { + let base36 = _base16To36(lib_esm_getAddress(address).substring(2)).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed +function getContractAddress(transaction) { + let from = null; + try { + from = lib_esm_getAddress(transaction.from); + } + catch (error) { + address_lib_esm_logger.throwArgumentError("missing from address", "transaction", transaction); + } + const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString())); + return lib_esm_getAddress(hexDataSlice(keccak256(encode([from, nonce])), 12)); +} +function getCreate2Address(from, salt, initCodeHash) { + if (hexDataLength(salt) !== 32) { + address_lib_esm_logger.throwArgumentError("salt must be 32 bytes", "salt", salt); + } + if (hexDataLength(initCodeHash) !== 32) { + address_lib_esm_logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); + } + return lib_esm_getAddress(hexDataSlice(keccak256(concat(["0xff", lib_esm_getAddress(from), salt, initCodeHash])), 12)); +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/address.js + + + + +class AddressCoder extends Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, value) { + try { + value = lib_esm_getAddress(value); + } + catch (error) { + this._throwError(error.message, value); + } + return writer.writeValue(value); + } + decode(reader) { + return lib_esm_getAddress(lib_esm_hexZeroPad(reader.readValue().toHexString(), 20)); + } +} +//# sourceMappingURL=address.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js + + +// Clones the functionality of an existing Coder, but without a localName +class AnonymousCoder extends Coder { + constructor(coder) { + super(coder.name, coder.type, undefined, coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } +} +//# sourceMappingURL=anonymous.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/array.js + + + +const array_logger = new lib_esm_Logger(abi_lib_esm_version_version); + + +function pack(writer, coders, values) { + let arrayValues = null; + if (Array.isArray(values)) { + arrayValues = values; + } + else if (values && typeof (values) === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + if (!name) { + array_logger.throwError("cannot encode object for signature with missing names", lib_esm_Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder: coder, + value: values + }); + } + if (unique[name]) { + array_logger.throwError("cannot encode object for signature with duplicate names", lib_esm_Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder: coder, + value: values + }); + } + unique[name] = true; + return values[name]; + }); + } + else { + array_logger.throwArgumentError("invalid tuple value", "tuple", values); + } + if (coders.length !== arrayValues.length) { + array_logger.throwArgumentError("types/value length mismatch", "tuple", values); + } + let staticWriter = new Writer(writer.wordSize); + let dynamicWriter = new Writer(writer.wordSize); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } + else { + coder.encode(staticWriter, value); + } + }); + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +function unpack(reader, coders) { + let values = []; + // A reader anchored to this base + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readValue(); + let offsetReader = baseReader.subReader(offset.toNumber()); + try { + value = coder.decode(offsetReader); + } + catch (error) { + // Cannot recover from this + if (error.code === lib_esm_Logger.errors.BUFFER_OVERRUN) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + else { + try { + value = coder.decode(reader); + } + catch (error) { + // Cannot recover from this + if (error.code === lib_esm_Logger.errors.BUFFER_OVERRUN) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value != undefined) { + values.push(value); + } + }); + // We only output named properties for uniquely named coders + const uniqueNames = coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add any named parameters (i.e. tuples) + coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + const value = values[index]; + if (value instanceof Error) { + Object.defineProperty(values, name, { + enumerable: true, + get: () => { throw value; } + }); + } + else { + values[name] = value; + } + }); + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (value instanceof Error) { + Object.defineProperty(values, i, { + enumerable: true, + get: () => { throw value; } + }); + } + } + return Object.freeze(values); +} +class ArrayCoder extends Coder { + constructor(coder, length, localName) { + const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + this.coder = coder; + this.length = length; + } + defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + encode(writer, value) { + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + array_logger.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readValue().toNumber(); + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + if (count * 32 > reader._data.length) { + array_logger.throwError("insufficient data length", lib_esm_Logger.errors.BUFFER_OVERRUN, { + length: reader._data.length, + count: count + }); + } + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new AnonymousCoder(this.coder)); + } + return reader.coerce(this.name, unpack(reader, coders)); + } +} +//# sourceMappingURL=array.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js + + +class BooleanCoder extends Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, value) { + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return reader.coerce(this.type, !reader.readValue().isZero()); + } +} +//# sourceMappingURL=boolean.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js + + + +class DynamicBytesCoder extends Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = lib_esm_arrayify(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readValue().toNumber(), true); + } +} +class BytesCoder extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return reader.coerce(this.name, lib_esm_hexlify(super.decode(reader))); + } +} +//# sourceMappingURL=bytes.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js + + + +// @TODO: Merge this with bytes +class FixedBytesCoder extends Coder { + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + this.size = size; + } + defaultValue() { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + encode(writer, value) { + let data = lib_esm_arrayify(value); + if (data.length !== this.size) { + this._throwError("incorrect data length", value); + } + return writer.writeBytes(data); + } + decode(reader) { + return reader.coerce(this.name, lib_esm_hexlify(reader.readBytes(this.size))); + } +} +//# sourceMappingURL=fixed-bytes.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/null.js + + +class NullCoder extends Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes([]); + } + decode(reader) { + reader.readBytes(0); + return reader.coerce(this.name, null); + } +} +//# sourceMappingURL=null.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/constants/lib.esm/bignumbers.js + +const NegativeOne = ( /*#__PURE__*/lib_esm_bignumber_BigNumber.from(-1)); +const bignumbers_Zero = ( /*#__PURE__*/lib_esm_bignumber_BigNumber.from(0)); +const One = ( /*#__PURE__*/lib_esm_bignumber_BigNumber.from(1)); +const Two = ( /*#__PURE__*/(/* unused pure expression or super */ null && (BigNumber.from(2)))); +const WeiPerEther = ( /*#__PURE__*/(/* unused pure expression or super */ null && (BigNumber.from("1000000000000000000")))); +const MaxUint256 = ( /*#__PURE__*/lib_esm_bignumber_BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); +const MinInt256 = ( /*#__PURE__*/(/* unused pure expression or super */ null && (BigNumber.from("-0x8000000000000000000000000000000000000000000000000000000000000000")))); +const MaxInt256 = ( /*#__PURE__*/(/* unused pure expression or super */ null && (BigNumber.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")))); + +//# sourceMappingURL=bignumbers.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/number.js + + + + +class NumberCoder extends Coder { + constructor(size, signed, localName) { + const name = ((signed ? "int" : "uint") + (size * 8)); + super(name, name, localName, false); + this.size = size; + this.signed = signed; + } + defaultValue() { + return 0; + } + encode(writer, value) { + let v = lib_esm_bignumber_BigNumber.from(value); + // Check bounds are safe for encoding + let maxUintValue = MaxUint256.mask(writer.wordSize * 8); + if (this.signed) { + let bounds = maxUintValue.mask(this.size * 8 - 1); + if (v.gt(bounds) || v.lt(bounds.add(One).mul(NegativeOne))) { + this._throwError("value out-of-bounds", value); + } + } + else if (v.lt(bignumbers_Zero) || v.gt(maxUintValue.mask(this.size * 8))) { + this._throwError("value out-of-bounds", value); + } + v = v.toTwos(this.size * 8).mask(this.size * 8); + if (this.signed) { + v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize); + } + return writer.writeValue(v); + } + decode(reader) { + let value = reader.readValue().mask(this.size * 8); + if (this.signed) { + value = value.fromTwos(this.size * 8); + } + return reader.coerce(this.name, value); + } +} +//# sourceMappingURL=number.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/strings/lib.esm/_version.js +const strings_lib_esm_version_version = "strings/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js + + + + +const utf8_logger = new lib_esm_Logger(strings_lib_esm_version_version); +/////////////////////////////// +var UnicodeNormalizationForm; +(function (UnicodeNormalizationForm) { + UnicodeNormalizationForm["current"] = ""; + UnicodeNormalizationForm["NFC"] = "NFC"; + UnicodeNormalizationForm["NFD"] = "NFD"; + UnicodeNormalizationForm["NFKC"] = "NFKC"; + UnicodeNormalizationForm["NFKD"] = "NFKD"; +})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {})); +; +var Utf8ErrorReason; +(function (Utf8ErrorReason) { + // A continuation byte was present where there was nothing to continue + // - offset = the index the codepoint began in + Utf8ErrorReason["UNEXPECTED_CONTINUE"] = "unexpected continuation byte"; + // An invalid (non-continuation) byte to start a UTF-8 codepoint was found + // - offset = the index the codepoint began in + Utf8ErrorReason["BAD_PREFIX"] = "bad codepoint prefix"; + // The string is too short to process the expected codepoint + // - offset = the index the codepoint began in + Utf8ErrorReason["OVERRUN"] = "string overrun"; + // A missing continuation byte was expected but not found + // - offset = the index the continuation byte was expected at + Utf8ErrorReason["MISSING_CONTINUE"] = "missing continuation byte"; + // The computed code point is outside the range for UTF-8 + // - offset = start of this codepoint + // - badCodepoint = the computed codepoint; outside the UTF-8 range + Utf8ErrorReason["OUT_OF_RANGE"] = "out of UTF-8 range"; + // UTF-8 strings may not contain UTF-16 surrogate pairs + // - offset = start of this codepoint + // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range + Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate"; + // The string is an overlong representation + // - offset = start of this codepoint + // - badCodepoint = the computed codepoint; already bounds checked + Utf8ErrorReason["OVERLONG"] = "overlong representation"; +})(Utf8ErrorReason || (Utf8ErrorReason = {})); +; +function errorFunc(reason, offset, bytes, output, badCodepoint) { + return utf8_logger.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === Utf8ErrorReason.OVERRUN) { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === Utf8ErrorReason.OVERLONG) { + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} +// Common error handing strategies +const Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + bytes = lib_esm_arrayify(bytes); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result); + } + else { + i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result); + res = null; + break; + } + ; + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array +function toUtf8Bytes(str, form = UnicodeNormalizationForm.current) { + if (form != UnicodeNormalizationForm.current) { + utf8_logger.checkNormalize(); + str = str.normalize(form); + } + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) { + throw new Error("invalid utf-8 string"); + } + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return lib_esm_arrayify(result); +} +; +function escapeChar(value) { + const hex = ("0000" + value.toString(16)); + return "\\u" + hex.substring(hex.length - 4); +} +function _toEscapedUtf8String(bytes, onError) { + return '"' + getUtf8CodePoints(bytes, onError).map((codePoint) => { + if (codePoint < 256) { + switch (codePoint) { + case 8: return "\\b"; + case 9: return "\\t"; + case 10: return "\\n"; + case 13: return "\\r"; + case 34: return "\\\""; + case 92: return "\\\\"; + } + if (codePoint >= 32 && codePoint < 127) { + return String.fromCharCode(codePoint); + } + } + if (codePoint <= 0xffff) { + return escapeChar(codePoint); + } + codePoint -= 0x10000; + return escapeChar(((codePoint >> 10) & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00); + }).join("") + '"'; +} +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); +} +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +function toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} +//# sourceMappingURL=utf8.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/string.js + + + +class StringCoder extends DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, value) { + return super.encode(writer, toUtf8Bytes(value)); + } + decode(reader) { + return toUtf8String(super.decode(reader)); + } +} +//# sourceMappingURL=string.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js + + + +class TupleCoder extends Coder { + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + super("tuple", type, localName, dynamic); + this.coders = coders; + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add named values + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, value) { + return pack(writer, this.coders, value); + } + decode(reader) { + return reader.coerce(this.name, unpack(reader, this.coders)); + } +} +//# sourceMappingURL=tuple.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/fragments.js + + + + + +const fragments_logger = new lib_esm_Logger(abi_lib_esm_version_version); +; +const fragments_constructorGuard = {}; +let ModifiersBytes = { calldata: true, memory: true, storage: true }; +let ModifiersNest = { calldata: true, memory: true }; +function checkModifier(type, name) { + if (type === "bytes" || type === "string") { + if (ModifiersBytes[name]) { + return true; + } + } + else if (type === "address") { + if (name === "payable") { + return true; + } + } + else if (type.indexOf("[") >= 0 || type === "tuple") { + if (ModifiersNest[name]) { + return true; + } + } + if (ModifiersBytes[name] || name === "payable") { + fragments_logger.throwArgumentError("invalid modifier", "name", name); + } + return false; +} +// @TODO: Make sure that children of an indexed tuple are marked with a null indexed +function parseParamType(param, allowIndexed) { + let originalParam = param; + function throwError(i) { + fragments_logger.throwArgumentError(`unexpected character at position ${i}`, "param", param); + } + param = param.replace(/\s/g, " "); + function newNode(parent) { + let node = { type: "", name: "", parent: parent, state: { allowType: true } }; + if (allowIndexed) { + node.indexed = false; + } + return node; + } + let parent = { type: "", name: "", state: { allowType: true } }; + let node = parent; + for (let i = 0; i < param.length; i++) { + let c = param[i]; + switch (c) { + case "(": + if (node.state.allowType && node.type === "") { + node.type = "tuple"; + } + else if (!node.state.allowParams) { + throwError(i); + } + node.state.allowType = false; + node.type = verifyType(node.type); + node.components = [newNode(node)]; + node = node.components[0]; + break; + case ")": + delete node.state; + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i); + } + node.indexed = true; + node.name = ""; + } + if (checkModifier(node.type, node.name)) { + node.name = ""; + } + node.type = verifyType(node.type); + let child = node; + node = node.parent; + if (!node) { + throwError(i); + } + delete child.parent; + node.state.allowParams = false; + node.state.allowName = true; + node.state.allowArray = true; + break; + case ",": + delete node.state; + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i); + } + node.indexed = true; + node.name = ""; + } + if (checkModifier(node.type, node.name)) { + node.name = ""; + } + node.type = verifyType(node.type); + let sibling = newNode(node.parent); + //{ type: "", name: "", parent: node.parent, state: { allowType: true } }; + node.parent.components.push(sibling); + delete node.parent; + node = sibling; + break; + // Hit a space... + case " ": + // If reading type, the type is done and may read a param or name + if (node.state.allowType) { + if (node.type !== "") { + node.type = verifyType(node.type); + delete node.state.allowType; + node.state.allowName = true; + node.state.allowParams = true; + } + } + // If reading name, the name is done + if (node.state.allowName) { + if (node.name !== "") { + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i); + } + if (node.indexed) { + throwError(i); + } + node.indexed = true; + node.name = ""; + } + else if (checkModifier(node.type, node.name)) { + node.name = ""; + } + else { + node.state.allowName = false; + } + } + } + break; + case "[": + if (!node.state.allowArray) { + throwError(i); + } + node.type += c; + node.state.allowArray = false; + node.state.allowName = false; + node.state.readArray = true; + break; + case "]": + if (!node.state.readArray) { + throwError(i); + } + node.type += c; + node.state.readArray = false; + node.state.allowArray = true; + node.state.allowName = true; + break; + default: + if (node.state.allowType) { + node.type += c; + node.state.allowParams = true; + node.state.allowArray = true; + } + else if (node.state.allowName) { + node.name += c; + delete node.state.allowArray; + } + else if (node.state.readArray) { + node.type += c; + } + else { + throwError(i); + } + } + } + if (node.parent) { + fragments_logger.throwArgumentError("unexpected eof", "param", param); + } + delete parent.state; + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(originalParam.length - 7); + } + if (node.indexed) { + throwError(originalParam.length - 7); + } + node.indexed = true; + node.name = ""; + } + else if (checkModifier(node.type, node.name)) { + node.name = ""; + } + parent.type = verifyType(parent.type); + return parent; +} +function populate(object, params) { + for (let key in params) { + lib_esm_defineReadOnly(object, key, params[key]); + } +} +const FormatTypes = Object.freeze({ + // Bare formatting, as is needed for computing a sighash of an event or function + sighash: "sighash", + // Human-Readable with Minimal spacing and without names (compact human-readable) + minimal: "minimal", + // Human-Readable with nice spacing, including all names + full: "full", + // JSON-format a la Solidity + json: "json" +}); +const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/); +class ParamType { + constructor(constructorGuard, params) { + if (constructorGuard !== fragments_constructorGuard) { + fragments_logger.throwError("use fromString", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new ParamType()" + }); + } + populate(this, params); + let match = this.type.match(paramTypeArray); + if (match) { + populate(this, { + arrayLength: parseInt(match[2] || "-1"), + arrayChildren: ParamType.fromObject({ + type: match[1], + components: this.components + }), + baseType: "array" + }); + } + else { + populate(this, { + arrayLength: null, + arrayChildren: null, + baseType: ((this.components != null) ? "tuple" : this.type) + }); + } + this._isParamType = true; + Object.freeze(this); + } + // Format the parameter fragment + // - sighash: "(uint256,address)" + // - minimal: "tuple(uint256,address) indexed" + // - full: "tuple(uint256 foo, address bar) indexed baz" + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + fragments_logger.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + let result = { + type: ((this.baseType === "tuple") ? "tuple" : this.type), + name: (this.name || undefined) + }; + if (typeof (this.indexed) === "boolean") { + result.indexed = this.indexed; + } + if (this.components) { + result.components = this.components.map((comp) => JSON.parse(comp.format(format))); + } + return JSON.stringify(result); + } + let result = ""; + // Array + if (this.baseType === "array") { + result += this.arrayChildren.format(format); + result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]"; + } + else { + if (this.baseType === "tuple") { + if (format !== FormatTypes.sighash) { + result += this.type; + } + result += "(" + this.components.map((comp) => comp.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ")"; + } + else { + result += this.type; + } + } + if (format !== FormatTypes.sighash) { + if (this.indexed === true) { + result += " indexed"; + } + if (format === FormatTypes.full && this.name) { + result += " " + this.name; + } + } + return result; + } + static from(value, allowIndexed) { + if (typeof (value) === "string") { + return ParamType.fromString(value, allowIndexed); + } + return ParamType.fromObject(value); + } + static fromObject(value) { + if (ParamType.isParamType(value)) { + return value; + } + return new ParamType(fragments_constructorGuard, { + name: (value.name || null), + type: verifyType(value.type), + indexed: ((value.indexed == null) ? null : !!value.indexed), + components: (value.components ? value.components.map(ParamType.fromObject) : null) + }); + } + static fromString(value, allowIndexed) { + function ParamTypify(node) { + return ParamType.fromObject({ + name: node.name, + type: node.type, + indexed: node.indexed, + components: node.components + }); + } + return ParamTypify(parseParamType(value, !!allowIndexed)); + } + static isParamType(value) { + return !!(value != null && value._isParamType); + } +} +; +function parseParams(value, allowIndex) { + return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex)); +} +class Fragment { + constructor(constructorGuard, params) { + if (constructorGuard !== fragments_constructorGuard) { + fragments_logger.throwError("use a static from method", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Fragment()" + }); + } + populate(this, params); + this._isFragment = true; + Object.freeze(this); + } + static from(value) { + if (Fragment.isFragment(value)) { + return value; + } + if (typeof (value) === "string") { + return Fragment.fromString(value); + } + return Fragment.fromObject(value); + } + static fromObject(value) { + if (Fragment.isFragment(value)) { + return value; + } + switch (value.type) { + case "function": + return FunctionFragment.fromObject(value); + case "event": + return EventFragment.fromObject(value); + case "constructor": + return ConstructorFragment.fromObject(value); + case "error": + return ErrorFragment.fromObject(value); + case "fallback": + case "receive": + // @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment? + return null; + } + return fragments_logger.throwArgumentError("invalid fragment object", "value", value); + } + static fromString(value) { + // Make sure the "returns" is surrounded by a space and all whitespace is exactly one space + value = value.replace(/\s/g, " "); + value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " "); + value = value.trim(); + if (value.split(" ")[0] === "event") { + return EventFragment.fromString(value.substring(5).trim()); + } + else if (value.split(" ")[0] === "function") { + return FunctionFragment.fromString(value.substring(8).trim()); + } + else if (value.split("(")[0].trim() === "constructor") { + return ConstructorFragment.fromString(value.trim()); + } + else if (value.split(" ")[0] === "error") { + return ErrorFragment.fromString(value.substring(5).trim()); + } + return fragments_logger.throwArgumentError("unsupported fragment", "value", value); + } + static isFragment(value) { + return !!(value && value._isFragment); + } +} +class EventFragment extends Fragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + fragments_logger.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))) + }); + } + let result = ""; + if (format !== FormatTypes.sighash) { + result += "event "; + } + result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; + if (format !== FormatTypes.sighash) { + if (this.anonymous) { + result += "anonymous "; + } + } + return result.trim(); + } + static from(value) { + if (typeof (value) === "string") { + return EventFragment.fromString(value); + } + return EventFragment.fromObject(value); + } + static fromObject(value) { + if (EventFragment.isEventFragment(value)) { + return value; + } + if (value.type !== "event") { + fragments_logger.throwArgumentError("invalid event object", "value", value); + } + const params = { + name: verifyIdentifier(value.name), + anonymous: value.anonymous, + inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []), + type: "event" + }; + return new EventFragment(fragments_constructorGuard, params); + } + static fromString(value) { + let match = value.match(regexParen); + if (!match) { + fragments_logger.throwArgumentError("invalid event string", "value", value); + } + let anonymous = false; + match[3].split(" ").forEach((modifier) => { + switch (modifier.trim()) { + case "anonymous": + anonymous = true; + break; + case "": + break; + default: + fragments_logger.warn("unknown modifier: " + modifier); + } + }); + return EventFragment.fromObject({ + name: match[1].trim(), + anonymous: anonymous, + inputs: parseParams(match[2], true), + type: "event" + }); + } + static isEventFragment(value) { + return (value && value._isFragment && value.type === "event"); + } +} +function parseGas(value, params) { + params.gas = null; + let comps = value.split("@"); + if (comps.length !== 1) { + if (comps.length > 2) { + fragments_logger.throwArgumentError("invalid human-readable ABI signature", "value", value); + } + if (!comps[1].match(/^[0-9]+$/)) { + fragments_logger.throwArgumentError("invalid human-readable ABI signature gas", "value", value); + } + params.gas = lib_esm_bignumber_BigNumber.from(comps[1]); + return comps[0]; + } + return value; +} +function parseModifiers(value, params) { + params.constant = false; + params.payable = false; + params.stateMutability = "nonpayable"; + value.split(" ").forEach((modifier) => { + switch (modifier.trim()) { + case "constant": + params.constant = true; + break; + case "payable": + params.payable = true; + params.stateMutability = "payable"; + break; + case "nonpayable": + params.payable = false; + params.stateMutability = "nonpayable"; + break; + case "pure": + params.constant = true; + params.stateMutability = "pure"; + break; + case "view": + params.constant = true; + params.stateMutability = "view"; + break; + case "external": + case "public": + case "": + break; + default: + console.log("unknown modifier: " + modifier); + } + }); +} +function verifyState(value) { + let result = { + constant: false, + payable: true, + stateMutability: "payable" + }; + if (value.stateMutability != null) { + result.stateMutability = value.stateMutability; + // Set (and check things are consistent) the constant property + result.constant = (result.stateMutability === "view" || result.stateMutability === "pure"); + if (value.constant != null) { + if ((!!value.constant) !== result.constant) { + fragments_logger.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); + } + } + // Set (and check things are consistent) the payable property + result.payable = (result.stateMutability === "payable"); + if (value.payable != null) { + if ((!!value.payable) !== result.payable) { + fragments_logger.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); + } + } + } + else if (value.payable != null) { + result.payable = !!value.payable; + // If payable we can assume non-constant; otherwise we can't assume + if (value.constant == null && !result.payable && value.type !== "constructor") { + fragments_logger.throwArgumentError("unable to determine stateMutability", "value", value); + } + result.constant = !!value.constant; + if (result.constant) { + result.stateMutability = "view"; + } + else { + result.stateMutability = (result.payable ? "payable" : "nonpayable"); + } + if (result.payable && result.constant) { + fragments_logger.throwArgumentError("cannot have constant payable function", "value", value); + } + } + else if (value.constant != null) { + result.constant = !!value.constant; + result.payable = !result.constant; + result.stateMutability = (result.constant ? "view" : "payable"); + } + else if (value.type !== "constructor") { + fragments_logger.throwArgumentError("unable to determine stateMutability", "value", value); + } + return result; +} +class ConstructorFragment extends Fragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + fragments_logger.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "constructor", + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: (this.gas ? this.gas.toNumber() : undefined), + inputs: this.inputs.map((input) => JSON.parse(input.format(format))) + }); + } + if (format === FormatTypes.sighash) { + fragments_logger.throwError("cannot format a constructor for sighash", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "format(sighash)" + }); + } + let result = "constructor(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; + if (this.stateMutability && this.stateMutability !== "nonpayable") { + result += this.stateMutability + " "; + } + return result.trim(); + } + static from(value) { + if (typeof (value) === "string") { + return ConstructorFragment.fromString(value); + } + return ConstructorFragment.fromObject(value); + } + static fromObject(value) { + if (ConstructorFragment.isConstructorFragment(value)) { + return value; + } + if (value.type !== "constructor") { + fragments_logger.throwArgumentError("invalid constructor object", "value", value); + } + let state = verifyState(value); + if (state.constant) { + fragments_logger.throwArgumentError("constructor cannot be constant", "value", value); + } + const params = { + name: null, + type: value.type, + inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []), + payable: state.payable, + stateMutability: state.stateMutability, + gas: (value.gas ? lib_esm_bignumber_BigNumber.from(value.gas) : null) + }; + return new ConstructorFragment(fragments_constructorGuard, params); + } + static fromString(value) { + let params = { type: "constructor" }; + value = parseGas(value, params); + let parens = value.match(regexParen); + if (!parens || parens[1].trim() !== "constructor") { + fragments_logger.throwArgumentError("invalid constructor string", "value", value); + } + params.inputs = parseParams(parens[2].trim(), false); + parseModifiers(parens[3].trim(), params); + return ConstructorFragment.fromObject(params); + } + static isConstructorFragment(value) { + return (value && value._isFragment && value.type === "constructor"); + } +} +class FunctionFragment extends ConstructorFragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + fragments_logger.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: (this.gas ? this.gas.toNumber() : undefined), + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + outputs: this.outputs.map((output) => JSON.parse(output.format(format))), + }); + } + let result = ""; + if (format !== FormatTypes.sighash) { + result += "function "; + } + result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; + if (format !== FormatTypes.sighash) { + if (this.stateMutability) { + if (this.stateMutability !== "nonpayable") { + result += (this.stateMutability + " "); + } + } + else if (this.constant) { + result += "view "; + } + if (this.outputs && this.outputs.length) { + result += "returns (" + this.outputs.map((output) => output.format(format)).join(", ") + ") "; + } + if (this.gas != null) { + result += "@" + this.gas.toString() + " "; + } + } + return result.trim(); + } + static from(value) { + if (typeof (value) === "string") { + return FunctionFragment.fromString(value); + } + return FunctionFragment.fromObject(value); + } + static fromObject(value) { + if (FunctionFragment.isFunctionFragment(value)) { + return value; + } + if (value.type !== "function") { + fragments_logger.throwArgumentError("invalid function object", "value", value); + } + let state = verifyState(value); + const params = { + type: value.type, + name: verifyIdentifier(value.name), + constant: state.constant, + inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []), + outputs: (value.outputs ? value.outputs.map(ParamType.fromObject) : []), + payable: state.payable, + stateMutability: state.stateMutability, + gas: (value.gas ? lib_esm_bignumber_BigNumber.from(value.gas) : null) + }; + return new FunctionFragment(fragments_constructorGuard, params); + } + static fromString(value) { + let params = { type: "function" }; + value = parseGas(value, params); + let comps = value.split(" returns "); + if (comps.length > 2) { + fragments_logger.throwArgumentError("invalid function string", "value", value); + } + let parens = comps[0].match(regexParen); + if (!parens) { + fragments_logger.throwArgumentError("invalid function signature", "value", value); + } + params.name = parens[1].trim(); + if (params.name) { + verifyIdentifier(params.name); + } + params.inputs = parseParams(parens[2], false); + parseModifiers(parens[3].trim(), params); + // We have outputs + if (comps.length > 1) { + let returns = comps[1].match(regexParen); + if (returns[1].trim() != "" || returns[3].trim() != "") { + fragments_logger.throwArgumentError("unexpected tokens", "value", value); + } + params.outputs = parseParams(returns[2], false); + } + else { + params.outputs = []; + } + return FunctionFragment.fromObject(params); + } + static isFunctionFragment(value) { + return (value && value._isFragment && value.type === "function"); + } +} +//export class StructFragment extends Fragment { +//} +function checkForbidden(fragment) { + const sig = fragment.format(); + if (sig === "Error(string)" || sig === "Panic(uint256)") { + fragments_logger.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment); + } + return fragment; +} +class ErrorFragment extends Fragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + fragments_logger.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + let result = ""; + if (format !== FormatTypes.sighash) { + result += "error "; + } + result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; + return result.trim(); + } + static from(value) { + if (typeof (value) === "string") { + return ErrorFragment.fromString(value); + } + return ErrorFragment.fromObject(value); + } + static fromObject(value) { + if (ErrorFragment.isErrorFragment(value)) { + return value; + } + if (value.type !== "error") { + fragments_logger.throwArgumentError("invalid error object", "value", value); + } + const params = { + type: value.type, + name: verifyIdentifier(value.name), + inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []) + }; + return checkForbidden(new ErrorFragment(fragments_constructorGuard, params)); + } + static fromString(value) { + let params = { type: "error" }; + let parens = value.match(regexParen); + if (!parens) { + fragments_logger.throwArgumentError("invalid error signature", "value", value); + } + params.name = parens[1].trim(); + if (params.name) { + verifyIdentifier(params.name); + } + params.inputs = parseParams(parens[2], false); + return checkForbidden(ErrorFragment.fromObject(params)); + } + static isErrorFragment(value) { + return (value && value._isFragment && value.type === "error"); + } +} +function verifyType(type) { + // These need to be transformed to their full description + if (type.match(/^uint($|[^1-9])/)) { + type = "uint256" + type.substring(4); + } + else if (type.match(/^int($|[^1-9])/)) { + type = "int256" + type.substring(3); + } + // @TODO: more verification + return type; +} +// See: https://github.com/ethereum/solidity/blob/1f8f1a3db93a548d0555e3e14cfc55a10e25b60e/docs/grammar/SolidityLexer.g4#L234 +const regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); +function verifyIdentifier(value) { + if (!value || !value.match(regexIdentifier)) { + fragments_logger.throwArgumentError(`invalid identifier "${value}"`, "value", value); + } + return value; +} +const regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"); +function splitNesting(value) { + value = value.trim(); + let result = []; + let accum = ""; + let depth = 0; + for (let offset = 0; offset < value.length; offset++) { + let c = value[offset]; + if (c === "," && depth === 0) { + result.push(accum); + accum = ""; + } + else { + accum += c; + if (c === "(") { + depth++; + } + else if (c === ")") { + depth--; + if (depth === -1) { + fragments_logger.throwArgumentError("unbalanced parenthesis", "value", value); + } + } + } + } + if (accum) { + result.push(accum); + } + return result; +} +//# sourceMappingURL=fragments.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js + +// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI + + + + +const abi_coder_logger = new lib_esm_Logger(abi_lib_esm_version_version); + + + + + + + + + + + +const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); +class AbiCoder { + constructor(coerceFunc) { + lib_esm_defineReadOnly(this, "coerceFunc", coerceFunc || null); + } + _getCoder(param) { + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "array": + return new ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name); + case "tuple": + return new TupleCoder((param.components || []).map((component) => { + return this._getCoder(component); + }), param.name); + case "": + return new NullCoder(param.name); + } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + if (size === 0 || size > 256 || (size % 8) !== 0) { + abi_coder_logger.throwArgumentError("invalid " + match[1] + " bit length", "param", param); + } + return new NumberCoder(size / 8, (match[1] === "int"), param.name); + } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + if (size === 0 || size > 32) { + abi_coder_logger.throwArgumentError("invalid bytes length", "param", param); + } + return new FixedBytesCoder(size, param.name); + } + return abi_coder_logger.throwArgumentError("invalid type", "type", param.type); + } + _getWordSize() { return 32; } + _getReader(data, allowLoose) { + return new Reader(data, this._getWordSize(), this.coerceFunc, allowLoose); + } + _getWriter() { + return new Writer(this._getWordSize()); + } + getDefaultValue(types) { + const coders = types.map((type) => this._getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } + encode(types, values) { + if (types.length !== values.length) { + abi_coder_logger.throwError("types/values length mismatch", lib_esm_Logger.errors.INVALID_ARGUMENT, { + count: { types: types.length, values: values.length }, + value: { types: types, values: values } + }); + } + const coders = types.map((type) => this._getCoder(ParamType.from(type))); + const coder = (new TupleCoder(coders, "_")); + const writer = this._getWriter(); + coder.encode(writer, values); + return writer.data; + } + decode(types, data, loose) { + const coders = types.map((type) => this._getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.decode(this._getReader(lib_esm_arrayify(data), loose)); + } +} +const defaultAbiCoder = new AbiCoder(); +//# sourceMappingURL=abi-coder.js.map +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractNonceInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +const { proto: ContractNonceInfo_proto } = lib_namespaceObject; + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IContractNonceInfo} HashgraphProto.proto.IContractNonceInfo + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + * @typedef {object} ContractNonceInfoJSON + * @property {string} contractId + * @property {number} nonce + */ + +/** + * Info about a contract account's nonce value. + * A nonce of a contract is only incremented when that contract creates another contract. + */ +class ContractNonceInfo { + /** + * @param {object} props + * @param {ContractId} props.contractId + * @param {Long} props.nonce + */ + constructor(props) { + /** + * Id of the contract + * + * @readonly + */ + this.contractId = props.contractId; + + /** + * The current value of the contract account's nonce property + * + * @readonly + */ + this.nonce = props.nonce; + + Object.freeze(this); + } + + /** + * Extract the contractNonce from the protobuf. + * + * @internal + * @param {HashgraphProto.proto.IContractNonceInfo} contractNonceInfo the protobuf + * @returns {ContractNonceInfo} the contract object + */ + static _fromProtobuf(contractNonceInfo) { + return new ContractNonceInfo({ + contractId: ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + contractNonceInfo.contractId + ), + ), + nonce: + contractNonceInfo.nonce != null + ? contractNonceInfo.nonce + : src_long.ZERO, + }); + } + + /** + * Build the protobuf + * + * @internal + * @returns {HashgraphProto.proto.IContractNonceInfo} the protobuf representation + */ + _toProtobuf() { + return { + contractId: this.contractId._toProtobuf(), + nonce: this.nonce, + }; + } + + /** + * Extract the contractNonce from a byte array. + * + * @param {Uint8Array} bytes the byte array + * @returns {ContractNonceInfo} the extracted contract nonce info + */ + static fromBytes(bytes) { + return ContractNonceInfo._fromProtobuf( + ContractNonceInfo_proto.ContractNonceInfo.decode(bytes), + ); + } + + /** + * Create a byte array representation. + * + * @returns {Uint8Array} the byte array representation + */ + toBytes() { + return ContractNonceInfo_proto.ContractNonceInfo.encode(this._toProtobuf()).finish(); + } + + /** + * Create a JSON representation. + * + * @returns {ContractNonceInfoJSON} the JSON representation + */ + toJSON() { + return { + contractId: this.contractId.toString(), + nonce: this.nonce.toNumber(), + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * @param {this} other + * @returns {boolean} + */ + equals(other) { + return ( + this.contractId.equals(other.contractId) && + this.nonce.eq(other.nonce) + ); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractFunctionResult.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + +// eslint-disable-next-line @typescript-eslint/no-unused-vars + + + + +/** + * @typedef {import("./ContractStateChange.js").default} ContractStateChange + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IContractFunctionResult} HashgraphProto.proto.IContractFunctionResult + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + */ + +/** + * The result returned by a call to a smart contract function. This is part of the response to + * a ContractCallLocal query, and is in the record for a ContractCall or ContractCreateInstance + * transaction. The ContractCreateInstance transaction record has the results of the call to + * the constructor. + */ +class ContractFunctionResult { + /** + * Constructor isn't part of the stable API + * + * @param {object} result + * @param {boolean} result._createResult + * @param {?ContractId} result.contractId + * @param {?string} result.errorMessage + * @param {Uint8Array} result.bloom + * @param {Long} result.gasUsed + * @param {ContractLogInfo[]} result.logs + * @param {ContractId[]} result.createdContractIds + * @param {Uint8Array | null} result.evmAddress + * @param {Uint8Array} result.bytes + * @param {Long} result.gas + * @param {Long} result.amount + * @param {Uint8Array} result.functionParameters + * @param {?AccountId} result.senderAccountId + * @param {ContractStateChange[]} result.stateChanges + * @param {ContractNonceInfo[]} result.contractNonces + * @param {Long | null} result.signerNonce + */ + constructor(result) { + /** + * Determines if this result came from `record.contractCreateResult` if true + * or `record.contractCallResult` if false + */ + this._createResult = result._createResult; + + /** + * The smart contract instance whose function was called. + */ + this.contractId = result.contractId; + + this.bytes = result.bytes; + + /** + * Message In case there was an error during smart contract execution. + */ + this.errorMessage = result.errorMessage; + + /** + * Bloom filter for record + */ + this.bloom = result.bloom; + + /** + * Units of gas used to execute contract. + */ + this.gasUsed = result.gasUsed; + + /** + * The log info for events returned by the function. + */ + this.logs = result.logs; + + /** + * @deprecated the list of smart contracts that were created by the function call. + * + * The created ids will now _also_ be externalized through internal transaction + * records, where each record has its alias field populated with the new contract's + * EVM address. (This is needed for contracts created with CREATE2, since + * there is no longer a simple relationship between the new contract's 0.0.X id + * and its Solidity address.) + */ + // eslint-disable-next-line deprecation/deprecation + this.createdContractIds = result.createdContractIds; + + this.evmAddress = result.evmAddress; + + /** + * @deprecated - Use mirror node for contract traceability instead + */ + // eslint-disable-next-line deprecation/deprecation + this.stateChanges = result.stateChanges; + + /** + * The amount of gas available for the call, aka the gasLimit. + */ + this.gas = result.gas; + + /** + * Number of tinybars sent (the function must be payable if this is nonzero). + */ + this.amount = result.amount; + + /** + * The parameters passed into the contract call. + */ + this.functionParameters = result.functionParameters; + + /** + * The account that is the "sender." If not present it is the accountId from the transactionId. + * + * This field should only be populated when the paired TransactionBody in the record stream is not a + * ContractCreateTransactionBody or a ContractCallTransactionBody. + */ + this.senderAccountId = result.senderAccountId; + + /** + * A list of updated contract account nonces containing the new nonce value for each contract account. + * This is always empty in a ContractCallLocalResponse#ContractFunctionResult message, since no internal creations can happen in a static EVM call. + */ + this.contractNonces = result.contractNonces; + + /** + * If not null this field specifies what the value of the signer account nonce is post transaction execution. + * For transactions that don't update the signer nonce (like HAPI ContractCall and ContractCreate transactions) this field should be null. + */ + this.signerNonce = result.signerNonce; + } + + /** + * @param {HashgraphProto.proto.IContractFunctionResult} result + * @param {boolean} _createResult + * @returns {ContractFunctionResult} + */ + static _fromProtobuf(result, _createResult) { + const contractId = + /** @type {HashgraphProto.proto.IContractID | null} */ ( + result.contractID + ); + const gasUsed = /** @type {Long} */ (result.gasUsed); + const gas = /** @type {Long} */ (result.gas ? result.gas : -1); + const amount = /** @type {Long} */ (result.amount ? result.amount : -1); + + return new ContractFunctionResult({ + _createResult, + bytes: /** @type {Uint8Array} */ (result.contractCallResult), + contractId: + contractId != null + ? ContractId_ContractId._fromProtobuf(contractId) + : null, + errorMessage: + result.errorMessage != null ? result.errorMessage : null, + bloom: /** @type {Uint8Array} */ (result.bloom), + gasUsed: + gasUsed instanceof src_long ? gasUsed : src_long.fromValue(gasUsed), + logs: (result.logInfo != null ? result.logInfo : []).map((info) => + ContractLogInfo._fromProtobuf(info), + ), + createdContractIds: (result.createdContractIDs != null + ? result.createdContractIDs + : [] + ).map((contractId) => ContractId_ContractId._fromProtobuf(contractId)), + evmAddress: + result.evmAddress != null && result.evmAddress.value != null + ? result.evmAddress.value + : null, + stateChanges: [], + gas: gas instanceof src_long ? gas : src_long.fromValue(gas), + amount: amount instanceof src_long ? amount : src_long.fromValue(amount), + functionParameters: /** @type {Uint8Array} */ ( + result.functionParameters + ), + senderAccountId: + result.senderId != null + ? AccountId_AccountId._fromProtobuf(result.senderId) + : null, + contractNonces: (result.contractNonces != null + ? result.contractNonces + : [] + ).map((contractNonce) => + ContractNonceInfo._fromProtobuf(contractNonce), + ), + signerNonce: + result.signerNonce != null + ? result.signerNonce.value + ? result.signerNonce.value + : null + : null, + }); + } + + /** + * @returns {Uint8Array} + */ + asBytes() { + return this.bytes; + } + + /** + * @param {number} [index] + * @returns {string} + */ + getString(index) { + return encoding_utf8_browser_decode(this.getBytes(index)); + } + + /** + * @private + * @param {number} [index] + * @returns {Uint8Array} + */ + getBytes(index) { + // Len should never be larger than Number.MAX + // index * 32 is the position of the lenth + // (index + 1) * 32 onward to (index + 1) * 32 + len will be the elements of the array + // Arrays in solidity cannot be longer than 1024: + // https://solidity.readthedocs.io/en/v0.4.21/introduction-to-smart-contracts.html + const offset = this.getInt32(index); + const len = safeView(this.bytes).getInt32(offset + 28); + + return this.bytes.subarray(offset + 32, offset + 32 + len); + } + + /** + * @param {number} [index] + * @returns {Uint8Array} + */ + getBytes32(index) { + return this.bytes.subarray( + (index != null ? index : 0) * 32, + (index != null ? index : 0) * 32 + 32, + ); + } + + /** + * @param {number} [index] + * @returns {boolean} + */ + getBool(index) { + return this.bytes[(index != null ? index : 0) * 32 + 31] !== 0; + } + + /** + * @param {number} [index] + * @returns {number} + */ + getInt8(index) { + const position = (index != null ? index : 0) * 32 + 31; + return safeView(this.bytes).getInt8(position); + } + + /** + * @param {number} [index] + * @returns {number} + */ + getUint8(index) { + return this.bytes[(index != null ? index : 0) * 32 + 31]; + } + + /** + * @param {number} [index] + * @returns {number} + */ + getInt16(index) { + // .getInt32() interprets as big-endian + // Using DataView instead of Uint32Array because the latter interprets + // using platform endianness which is little-endian on x86 + const position = (index != null ? index : 0) * 32 + 28; + return safeView(this.bytes).getInt32(position); + } + + /** + * @param {number} [index] + * @returns {number} + */ + getUint16(index) { + // .getUint32() interprets as big-endian + // Using DataView instead of Uint32Array because the latter interprets + // using platform endianness which is little-endian on x86 + const position = (index != null ? index : 0) * 32 + 28; + return safeView(this.bytes).getUint32(position); + } + + /** + * @param {number} [index] + * @returns {number} + */ + getInt24(index) { + // .getInt32() interprets as big-endian + // Using DataView instead of Uint32Array because the latter interprets + // using platform endianness which is little-endian on x86 + const position = (index != null ? index : 0) * 32 + 28; + return safeView(this.bytes).getInt32(position); + } + + /** + * @param {number} [index] + * @returns {number} + */ + getUint24(index) { + // .getUint32() interprets as big-endian + // Using DataView instead of Uint32Array because the latter interprets + // using platform endianness which is little-endian on x86 + const position = (index != null ? index : 0) * 32 + 28; + return safeView(this.bytes).getUint32(position); + } + + /** + * @param {number} [index] + * @returns {number} + */ + getInt32(index) { + // .getInt32() interprets as big-endian + // Using DataView instead of Uint32Array because the latter interprets + // using platform endianness which is little-endian on x86 + const position = (index != null ? index : 0) * 32 + 28; + return safeView(this.bytes).getInt32(position); + } + + /** + * @param {number} [index] + * @returns {number} + */ + getUint32(index) { + // .getUint32() interprets as big-endian + // Using DataView instead of Uint32Array because the latter interprets + // using platform endianness which is little-endian on x86 + const position = (index != null ? index : 0) * 32 + 28; + return safeView(this.bytes).getUint32(position); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt40(index) { + const result = defaultAbiCoder.decode( + ["int40"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint40(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(27, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt48(index) { + const result = defaultAbiCoder.decode( + ["int48"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint48(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(26, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt56(index) { + const result = defaultAbiCoder.decode( + ["int56"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint56(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(25, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt64(index) { + const result = defaultAbiCoder.decode( + ["int64"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint64(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(24, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt72(index) { + const result = defaultAbiCoder.decode( + ["int72"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint72(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(23, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt80(index) { + const result = defaultAbiCoder.decode( + ["int80"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint80(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(22, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt88(index) { + const result = defaultAbiCoder.decode( + ["int88"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint88(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(21, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt96(index) { + const result = defaultAbiCoder.decode( + ["int96"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint96(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(20, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt104(index) { + const result = defaultAbiCoder.decode( + ["int104"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint104(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(19, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt112(index) { + const result = defaultAbiCoder.decode( + ["int112"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint112(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(18, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt120(index) { + const result = defaultAbiCoder.decode( + ["int120"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint120(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(17, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt128(index) { + const result = defaultAbiCoder.decode( + ["int128"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint128(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(16, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt136(index) { + const result = defaultAbiCoder.decode( + ["int136"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint136(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(15, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt144(index) { + const result = defaultAbiCoder.decode( + ["int144"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint144(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(14, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt152(index) { + const result = defaultAbiCoder.decode( + ["int152"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint152(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(13, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt160(index) { + const result = defaultAbiCoder.decode( + ["int160"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint160(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(12, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt168(index) { + const result = defaultAbiCoder.decode( + ["int168"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint168(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(11, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt176(index) { + const result = defaultAbiCoder.decode( + ["int176"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint176(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(10, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt184(index) { + const result = defaultAbiCoder.decode( + ["int184"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint184(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(9, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt192(index) { + const result = defaultAbiCoder.decode( + ["int192"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint192(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(8, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt200(index) { + const result = defaultAbiCoder.decode( + ["int200"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint200(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(7, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt208(index) { + const result = defaultAbiCoder.decode( + ["int208"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint208(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(6, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt216(index) { + const result = defaultAbiCoder.decode( + ["int216"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint216(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(5, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt224(index) { + const result = defaultAbiCoder.decode( + ["int224"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint224(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(4, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt232(index) { + const result = defaultAbiCoder.decode( + ["int232"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint232(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(3, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt240(index) { + const result = defaultAbiCoder.decode( + ["int240"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint240(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(2, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt248(index) { + const result = defaultAbiCoder.decode( + ["int248"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint248(index) { + return new bignumber( + hex_browser_encode(this._getBytes32(index).subarray(1, 32)), + 16, + ); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getInt256(index) { + const result = defaultAbiCoder.decode( + ["int256"], + this._getBytes32(index != null ? index : 0), + ); + return new bignumber(result.toString()); + } + + /** + * @param {number} [index] + * @returns {BigNumber} + */ + getUint256(index) { + return new bignumber(hex_browser_encode(this._getBytes32(index)), 16); + } + + /** + * @param {number} [index] + * @returns {string} + */ + getAddress(index) { + return hex_browser_encode( + this.bytes.subarray( + (index != null ? index : 0) * 32 + 12, + (index != null ? index : 0) * 32 + 32, + ), + ); + } + + /** + * @description Decode the data according to the array of types, each of which may be a string or ParamType. + * @param {Array} types + * @returns {string | any} + */ + getResult(types) { + return defaultAbiCoder.decode(types, this.bytes); + } + + /** + * @param {number} [index] + * @returns {Uint8Array} + */ + _getBytes32(index) { + return this.bytes.subarray( + (index != null ? index : 0) * 32, + (index != null ? index : 0) * 32 + 32, + ); + } + + /** + * @returns {HashgraphProto.proto.IContractFunctionResult} + */ + _toProtobuf() { + return { + contractID: + this.contractId != null ? this.contractId._toProtobuf() : null, + contractCallResult: this.bytes, + errorMessage: this.errorMessage, + bloom: this.bloom, + gasUsed: this.gasUsed, + logInfo: this.logs.map((log) => log._toProtobuf()), + // eslint-disable-next-line deprecation/deprecation + createdContractIDs: this.createdContractIds.map((id) => + id._toProtobuf(), + ), + evmAddress: + this.evmAddress != null + ? { + value: this.evmAddress, + } + : null, + gas: this.gas, + amount: this.amount, + functionParameters: this.functionParameters, + senderId: + this.senderAccountId != null + ? this.senderAccountId._toProtobuf() + : null, + contractNonces: this.contractNonces.map((contractNonce) => + contractNonce._toProtobuf(), + ), + signerNonce: + this.signerNonce != null + ? { + value: this.signerNonce, + } + : null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/ObjectMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * A simple "map" type that allows indexing by objects other than + * strings, numbers, or booleans, and doesn't use the object pointer. + * + * @abstract + * @template {{ toString(): string }} KeyT + * @template {any} ValueT + */ +class ObjectMap { + /** + * @param {(s: string) => KeyT} fromString + */ + constructor(fromString) { + /** + * This map is from the stringified version of the key, to the value + * + * @type {Map} + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + this._map = new Map(); + + /** + * This map is from the key, to the value + * + * @type {Map} + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + this.__map = new Map(); + + /** + * A function pointer to convert a key into a string. So we can set each + * value in both maps. + */ + this._fromString = fromString; + } + + /** + * Get a value by key or string. + * + * This is the main benefit of this class. If a user provides a `KeyT` we + * implicitly serialize it to a string and use the string version. Otherwise + * the user will get `undefined` even for a key that exists in the map since + * the `KeyT` the provided has a different pointer than the one we have stored. + * The string version doesn't have this issue since JS hashes the string and + * that would result in both `KeyT` hitting the same value even if they're + * different pointers. + * + * @param {KeyT | string} key + * @returns {?ValueT} + */ + get(key) { + const k = typeof key === "string" ? key : key.toString(); + + const value = this._map.get(k); + return value != null ? value : null; + } + + /** + * Set the key to a value in both maps + * + * @internal + * @param {KeyT} key + * @param {ValueT} value + */ + _set(key, value) { + const k = typeof key === "string" ? key : key.toString(); + + this._map.set(k, value); + this.__map.set(key, value); + } + + /** + * Create iterator of values + * + * @returns {IterableIterator} + */ + values() { + return this._map.values(); + } + + /** + * Get the size of the map + * + * @returns {number} + */ + get size() { + return this._map.size; + } + + /** + * Get the keys of the map. + * + * @returns {IterableIterator} + */ + keys() { + return this.__map.keys(); + } + + /** + * Create an iterator over key, value pairs + * + * @returns {IterableIterator<[KeyT, ValueT]>} + */ + [Symbol.iterator]() { + return this.__map[Symbol.iterator](); + } + + /** + * Stringify the map into _something_ readable. + * **NOTE**: This implementation is not stable and can change. + * + * @returns {string} + */ + toString() { + /** @type {{[key: string]: any}} */ + const map = {}; + + for (const [key, value] of this._map) { + map[key] = value; + } + + return JSON.stringify(map); + } + + toJSON() { + const obj = {}; + + this._map.forEach((value, key) => { + // @ts-ignore + obj[key] = value; + }); + + return obj; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenTransferAccountMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @augments {ObjectMap} + */ +class TokenTransferAccountMap extends ObjectMap { + constructor() { + super((s) => AccountId_AccountId.fromString(s)); + } + + toJSON() { + const obj = {}; + + this._map.forEach((value, key) => { + // @ts-ignore + obj[key] = value.toString(); + }); + + return obj; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenTransferMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList + * @typedef {import("@hashgraph/proto").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @augments {ObjectMap} + */ +class TokenTransferMap extends ObjectMap { + constructor() { + super((s) => TokenId_TokenId.fromString(s)); + } + + /** + * @internal + * @param {TokenId} tokenId + * @param {AccountId} accountId + * @param {Long} amount + */ + __set(tokenId, accountId, amount) { + const token = tokenId.toString(); + + let _map = this._map.get(token); + if (_map == null) { + _map = new TokenTransferAccountMap(); + this._map.set(token, _map); + this.__map.set(tokenId, _map); + } + + _map._set(accountId, amount); + } + + /** + * @param {HashgraphProto.proto.ITokenTransferList[]} transfers + * @returns {TokenTransferMap} + */ + static _fromProtobuf(transfers) { + const tokenTransfersMap = new TokenTransferMap(); + + for (const transfer of transfers) { + const token = TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ (transfer.token), + ); + + for (const aa of transfer.transfers != null + ? transfer.transfers + : []) { + const account = AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + aa.accountID + ), + ); + + tokenTransfersMap.__set( + token, + account, + /** @type {Long} */ (aa.amount), + ); + } + } + + return tokenTransfersMap; + } + + /** + * @returns {HashgraphProto.proto.ITokenTransferList[]} + */ + _toProtobuf() { + /** @type {HashgraphProto.proto.ITokenTransferList[]} */ + const tokenTransferList = []; + + for (const [tokenId, value] of this) { + /** @type {HashgraphProto.proto.IAccountAmount[]} */ + const transfers = []; + + for (const [accountId, amount] of value) { + transfers.push({ + accountID: accountId._toProtobuf(), + amount: amount, + }); + } + + tokenTransferList.push({ + token: tokenId._toProtobuf(), + transfers: transfers, + }); + } + + return tokenTransferList; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenNftTransferMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList + * @typedef {import("@hashgraph/proto").proto.INftTransfer} HashgraphProto.proto.INftTransfer + * @typedef {import("@hashgraph/proto").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {object} NftTransfer + * @property {AccountId} sender + * @property {AccountId} recipient + * @property {Long} serial + * @property {boolean} isApproved + */ + +/** + * @augments {ObjectMap} + */ +class TokenNftTransferMap extends ObjectMap { + constructor() { + super((s) => TokenId_TokenId.fromString(s)); + } + + /** + * @internal + * @param {TokenId} tokenId + * @param {NftTransfer} nftTransfer + */ + __set(tokenId, nftTransfer) { + const token = tokenId.toString(); + + let _map = this._map.get(token); + if (_map == null) { + _map = []; + this._map.set(token, _map); + this.__map.set(tokenId, _map); + } + + _map.push(nftTransfer); + } + + /** + * @param {HashgraphProto.proto.ITokenTransferList[]} transfers + * @returns {TokenNftTransferMap} + */ + static _fromProtobuf(transfers) { + const tokenTransfersMap = new TokenNftTransferMap(); + + for (const transfer of transfers) { + const token = TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ (transfer.token), + ); + + for (const aa of transfer.nftTransfers != null + ? transfer.nftTransfers + : []) { + const sender = AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + aa.senderAccountID + ), + ); + const recipient = AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + aa.receiverAccountID + ), + ); + + tokenTransfersMap.__set(token, { + sender, + recipient, + serial: src_long.fromValue( + /** @type {Long} */ (aa.serialNumber), + ), + isApproved: false, + }); + } + } + + return tokenTransfersMap; + } + + /** + * @returns {HashgraphProto.proto.ITokenTransferList[]} + */ + _toProtobuf() { + /** @type {HashgraphProto.proto.ITokenTransferList[]} */ + const tokenTransferList = []; + + for (const [tokenId, value] of this) { + /** @type {HashgraphProto.proto.INftTransfer[]} */ + const transfers = []; + + for (const transfer of value) { + transfers.push({ + senderAccountID: transfer.sender._toProtobuf(), + receiverAccountID: transfer.recipient._toProtobuf(), + serialNumber: transfer.serial, + }); + } + + tokenTransferList.push({ + token: tokenId._toProtobuf(), + nftTransfers: transfers, + }); + } + + return tokenTransferList; + } + + toJSON() { + const obj = {}; + + this._map.forEach((value, key) => { + // @ts-ignore + obj[key] = value.map((nftTransfer) => ({ + sender: nftTransfer.sender.toString(), + recipient: nftTransfer.recipient.toString(), + serial: nftTransfer.serial, + isApproved: nftTransfer.isApproved, + })); + }); + + return obj; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/AssessedCustomFee.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IAssessedCustomFee} HashgraphProto.proto.IAssessedCustomFee + */ + +/** + * @typedef {object} AssessedCustomFeeJSON + * @property {?string} feeCollectorAccountId + * @property {?string} tokenId + * @property {?string} amount + * @property {string[]} payerAccountIds + */ + +class AssessedCustomFee { + /** + * @param {object} props + * @param {AccountId | string} [props.feeCollectorAccountId] + * @param {TokenId | string} [props.tokenId] + * @param {Long | number} [props.amount] + * @param {AccountId[]} [props.payerAccountIds] + */ + constructor(props = {}) { + /** + * @type {?AccountId} + */ + this._feeCollectorAccountId = null; + + if (props.feeCollectorAccountId != null) { + this.setFeeCollectorAccountId(props.feeCollectorAccountId); + } + + /** + * @type {?TokenId} + */ + this._tokenId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + /** + * @type {?Long} + */ + this._amount = null; + + if (props.amount != null) { + this.setAmount(props.amount); + } + + /** + * @type {?AccountId[]} + */ + this._payerAccountIds = null; + + if (props.payerAccountIds != null) { + this.setPayerAccountIds(props.payerAccountIds); + } + } + + /** + * @returns {?AccountId} + */ + get feeCollectorAccountId() { + return this._feeCollectorAccountId; + } + + /** + * @param {AccountId | string} feeCollectorAccountId + * @returns {this} + */ + setFeeCollectorAccountId(feeCollectorAccountId) { + this._feeCollectorAccountId = + typeof feeCollectorAccountId === "string" + ? AccountId_AccountId.fromString(feeCollectorAccountId) + : feeCollectorAccountId; + return this; + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._tokenId = + typeof tokenId === "string" ? TokenId_TokenId.fromString(tokenId) : tokenId; + return this; + } + + /** + * @returns {?Long} + */ + get amount() { + return this._amount; + } + + /** + * @param {Long | number} amount + * @returns {AssessedCustomFee} + */ + setAmount(amount) { + this._amount = + typeof amount === "number" ? src_long.fromNumber(amount) : amount; + return this; + } + + /** + * @returns {?AccountId[]} + */ + get payerAccountIds() { + return this._payerAccountIds; + } + + /** + * @param {AccountId[]} payerAccountIds + * @returns {AssessedCustomFee} + */ + setPayerAccountIds(payerAccountIds) { + this._payerAccountIds = payerAccountIds; + return this; + } + + /** + * @internal + * @param {HashgraphProto.proto.IAssessedCustomFee} fee + * @returns {AssessedCustomFee} + */ + static _fromProtobuf(fee) { + return new AssessedCustomFee({ + feeCollectorAccountId: + fee.feeCollectorAccountId != null + ? AccountId_AccountId._fromProtobuf(fee.feeCollectorAccountId) + : undefined, + tokenId: + fee.tokenId != null + ? TokenId_TokenId._fromProtobuf(fee.tokenId) + : undefined, + amount: fee.amount != null ? fee.amount : undefined, + payerAccountIds: + fee.effectivePayerAccountId != null + ? fee.effectivePayerAccountId.map((id) => + AccountId_AccountId._fromProtobuf(id), + ) + : undefined, + }); + } + + /** + * @internal + * @abstract + * @returns {HashgraphProto.proto.IAssessedCustomFee} + */ + _toProtobuf() { + return { + feeCollectorAccountId: + this.feeCollectorAccountId != null + ? this.feeCollectorAccountId._toProtobuf() + : null, + tokenId: this._tokenId != null ? this._tokenId._toProtobuf() : null, + amount: this._amount, + effectivePayerAccountId: + this._payerAccountIds != null + ? this._payerAccountIds.map((id) => id._toProtobuf()) + : null, + }; + } + + /** + * @returns {AssessedCustomFeeJSON} + */ + toJSON() { + return { + feeCollectorAccountId: + this.feeCollectorAccountId?.toString() || null, + tokenId: this._tokenId?.toString() || null, + amount: this._amount?.toString() || null, + payerAccountIds: + this._payerAccountIds?.map((id) => id.toString()) || [], + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenAssociation.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenAssociation} HashgraphProto.proto.ITokenAssociation + */ + +/** + * @typedef {object} TokenAssociationJSON + * @property {?string} accountId + * @property {?string} tokenId + */ + +class TokenAssociation { + /** + * @param {object} props + * @param {AccountId | string} [props.accountId] + * @param {TokenId | string} [props.tokenId] + */ + constructor(props = {}) { + /** + * @type {?AccountId} + */ + this._accountId = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + + /** + * @type {?TokenId} + */ + this._tokenId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId; + return this; + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._tokenId = + typeof tokenId === "string" ? TokenId_TokenId.fromString(tokenId) : tokenId; + return this; + } + + /** + * @internal + * @abstract + * @param {HashgraphProto.proto.ITokenAssociation} association + * @returns {TokenAssociation} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static _fromProtobuf(association) { + return new TokenAssociation({ + accountId: + association.accountId != null + ? AccountId_AccountId._fromProtobuf(association.accountId) + : undefined, + tokenId: + association.tokenId != null + ? TokenId_TokenId._fromProtobuf(association.tokenId) + : undefined, + }); + } + + /** + * @internal + * @abstract + * @returns {HashgraphProto.proto.ITokenAssociation} + */ + _toProtobuf() { + return { + accountId: + this._accountId != null + ? this._accountId._toProtobuf() + : undefined, + tokenId: + this._tokenId != null ? this._tokenId._toProtobuf() : undefined, + }; + } + + /** + * @returns {TokenAssociationJSON} + */ + toJSON() { + return { + accountId: this._accountId?.toString() || null, + tokenId: this._tokenId?.toString() || null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenTransfer.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList + * @typedef {import("@hashgraph/proto").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + */ + +/** + * @typedef {object} TokenTransferJSON + * @property {string} tokenId + * @property {string} accountId + * @property {?number} expectedDecimals + * @property {string} amount + * @property {boolean} isApproved + */ + +/** + * An account, and the amount that it sends or receives during a cryptocurrency tokentransfer. + */ +class TokenTransfer { + /** + * @internal + * @param {object} props + * @param {TokenId | string} props.tokenId + * @param {AccountId | string} props.accountId + * @param {number | null} props.expectedDecimals + * @param {Long | number} props.amount + * @param {boolean} props.isApproved + */ + constructor(props) { + /** + * The Token ID that sends or receives cryptocurrency. + * + * @readonly + */ + this.tokenId = + props.tokenId instanceof TokenId_TokenId + ? props.tokenId + : TokenId_TokenId.fromString(props.tokenId); + + /** + * The Account ID that sends or receives cryptocurrency. + * + * @readonly + */ + this.accountId = + props.accountId instanceof AccountId_AccountId + ? props.accountId + : AccountId_AccountId.fromString(props.accountId); + + this.expectedDecimals = props.expectedDecimals; + this.amount = src_long.fromValue(props.amount); + this.isApproved = props.isApproved; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITokenTransferList[]} tokenTransfers + * @returns {TokenTransfer[]} + */ + static _fromProtobuf(tokenTransfers) { + const transfers = []; + + for (const tokenTransfer of tokenTransfers) { + const tokenId = TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + tokenTransfer.token + ), + ); + const expectedDecimals = + tokenTransfer.expectedDecimals != null + ? /** @type {number | null } */ ( + tokenTransfer.expectedDecimals.value + ) + : null; + + for (const transfer of tokenTransfer.transfers != null + ? tokenTransfer.transfers + : []) { + transfers.push( + new TokenTransfer({ + tokenId, + accountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + transfer.accountID + ), + ), + expectedDecimals, + amount: + transfer.amount != null + ? transfer.amount + : src_long.ZERO, + isApproved: transfer.isApproval == true, + }), + ); + } + } + + return transfers; + } + + /** + * @internal + * @returns {HashgraphProto.proto.IAccountAmount} + */ + _toProtobuf() { + return { + accountID: this.accountId._toProtobuf(), + amount: this.amount, + isApproval: this.isApproved, + }; + } + + /** + * @returns {TokenTransferJSON} + */ + toJSON() { + return { + tokenId: this.tokenId.toString(), + accountId: this.accountId.toString(), + expectedDecimals: this.expectedDecimals, + amount: this.amount.toString(), + isApproved: this.isApproved, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/NftId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * The ID for a crypto-currency token on Hedera. + * + * @augments {EntityId} + */ +class NftId_NftId { + /** + * @param {TokenId} token + * @param {number | Long} serial + */ + constructor(token, serial) { + this.tokenId = token; + this.serial = + typeof serial === "number" ? src_long.fromNumber(serial) : serial; + + Object.freeze(this); + } + + /** + * @param {string} text + * @returns {NftId} + */ + static fromString(text) { + const strings = + text.split("/").length > 1 ? text.split("/") : text.split("@"); + + for (const string of strings) { + if (string === "") { + throw new Error( + "invalid format for NftId: use [token]/[serial] or [token]@[serial]", + ); + } + } + + const token = TokenId_TokenId.fromString(strings[0]); + const serial = src_long.fromString(strings[1]); + + return new NftId_NftId(token, serial); + } + + /** + * @internal + * @param {HashgraphProto.proto.INftID} id + * @returns {NftId} + */ + static _fromProtobuf(id) { + return new NftId_NftId( + TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ (id.token_ID), + ), + id.serialNumber != null ? id.serialNumber : src_long.ZERO, + ); + } + + /** + * @param {Uint8Array} bytes + * @returns {NftId} + */ + static fromBytes(bytes) { + return NftId_NftId._fromProtobuf(lib.proto.NftID.decode(bytes)); + } + + /** + * @internal + * @returns {HashgraphProto.proto.INftID} + */ + _toProtobuf() { + return { + token_ID: this.tokenId._toProtobuf(), + serialNumber: src_long.fromValue( + this.serial !== undefined ? this.serial : 0, + ), + }; + } + + /** + * @returns {string} + */ + toString() { + return `${this.tokenId.toString()}/${this.serial.toString()}`; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.NftID.encode(this._toProtobuf()).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/PendingAirdropId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.PendingAirdropId} HashgraphProto.proto.PendingAirdropId + */ + + + + + +class PendingAirdropId { + /** + * + * @param {object} props + * @param {AccountId} [props.senderId] + * @param {AccountId} [props.receiverId] + * @param {TokenId?} [props.tokenId] + * @param {NftId?} [props.nftId] + */ + constructor(props = {}) { + this._senderId = null; + this._receiverId = null; + this._tokenId = null; + this._nftId = null; + + if (props.receiverId) { + this._receiverId = props.receiverId; + } + if (props.senderId) { + this._senderId = props.senderId; + } + if (props.tokenId) { + this._tokenId = new TokenId_TokenId(props.tokenId); + } else if (props.nftId) { + this._nftId = new NftId_NftId(props.nftId?.tokenId, props.nftId?.serial); + } + } + + /** + * @param {HashgraphProto.proto.PendingAirdropId} pb + * @returns {PendingAirdropId} + */ + static fromBytes(pb) { + if (pb.senderId == null) { + throw new Error("senderId is required"); + } + + if (pb.receiverId == null) { + throw new Error("receiverId is required"); + } + + if (pb.fungibleTokenType == null && pb.nonFungibleToken == null) { + throw new Error( + "Either fungibleTokenType or nonFungibleToken is required", + ); + } + + return new PendingAirdropId({ + senderId: AccountId_AccountId._fromProtobuf(pb.senderId), + receiverId: AccountId_AccountId._fromProtobuf(pb.receiverId), + nftId: + pb.nonFungibleToken != null + ? NftId_NftId._fromProtobuf(pb.nonFungibleToken) + : null, + tokenId: + pb.fungibleTokenType != null + ? TokenId_TokenId._fromProtobuf(pb.fungibleTokenType) + : null, + }); + } + + /** + * + * @param {AccountId} senderId + * @returns {this} + */ + setSenderid(senderId) { + this._senderId = senderId; + return this; + } + + /** + * @param {AccountId} receiverId + * @returns {this} + */ + setReceiverId(receiverId) { + this._receiverId = receiverId; + return this; + } + + /** + * @param {TokenId} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._nftId = null; + this._tokenId = tokenId; + return this; + } + + /** + * @param {NftId} nftId + * @returns {this} + */ + setNftId(nftId) { + this._tokenId = null; + this._nftId = nftId; + return this; + } + + /** + * @returns {?AccountId} + */ + get senderId() { + return this._senderId; + } + + /** + * @returns {?AccountId} + */ + get receiverId() { + return this._receiverId; + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @returns {?NftId} + */ + get nftId() { + return this._nftId; + } + + /** + * @returns {HashgraphProto.proto.PendingAirdropId} + */ + toBytes() { + return { + senderId: this.senderId?._toProtobuf(), + receiverId: this._receiverId?._toProtobuf(), + fungibleTokenType: this._tokenId?._toProtobuf(), + nonFungibleToken: this._nftId?._toProtobuf(), + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/PendingAirdropRecord.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.PendingAirdropRecord} HashgraphProto.proto.PendingAirdropRecord + */ + + + + +class PendingAirdropRecord { + /** + * @param {object} props + * @param {PendingAirdropId} props.airdropId + * @param {Long} props.amount + */ + constructor(props) { + this.airdropId = props.airdropId; + this.amount = props.amount; + } + + /** + * @returns {HashgraphProto.proto.PendingAirdropRecord} + */ + toBytes() { + return { + pendingAirdropId: this.airdropId.toBytes(), + pendingAirdropValue: { + amount: this.amount, + }, + }; + } + + /** + * @param {HashgraphProto.proto.PendingAirdropRecord} pb + * @returns {PendingAirdropRecord} + */ + static fromBytes(pb) { + if (pb.pendingAirdropId == null) { + throw new Error("pendingAirdropId is required"); + } + + const airdropId = PendingAirdropId.fromBytes(pb.pendingAirdropId); + const amount = pb.pendingAirdropValue?.amount; + + return new PendingAirdropRecord({ + airdropId: airdropId, + amount: amount ? amount : src_long.ZERO, + }); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/TransactionRecord.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + + + + + + + + + +/** + * @typedef {import("../token/TokenId.js").default} TokenId + * @typedef {import("../token/TokenTransfer.js").TokenTransferJSON} TokenTransferJSON + * @typedef {import("../account/HbarAllowance.js").default} HbarAllowance + * @typedef {import("../account/TokenAllowance.js").default} TokenAllowance + * @typedef {import("../account/TokenNftAllowance.js").default} TokenNftAllowance + * @typedef {import("./TransactionReceipt.js").TransactionReceiptJSON} TransactionReceiptJSON + * @typedef {import("../Transfer.js").TransferJSON} TransferJSON + */ + +/** + * @typedef {object} TransactionRecordJSON + * @property {TransactionReceiptJSON} receipt + * @property {?string} transactionHash + * @property {Date} consensusTimestamp + * @property {string} transactionId + * @property {string} transactionMemo + * @property {string} transactionFee + * @property {TransferJSON[]} transfers + * @property {TokenTransferMap} tokenTransfers + * @property {TokenTransferJSON[]} tokenTransfersList + * @property {?string} scheduleRef + * @property {AssessedCustomFee[]} assessedCustomFees + * @property {TokenNftTransferMap} nftTransfers + * @property {TokenAssocation[]} automaticTokenAssociations + * @property {Date | null} parentConsensusTimestamp + * @property {?string} aliasKey + * @property {TransactionRecord[]} duplicates + * @property {TransactionRecord[]} children + * @property {?string} ethereumHash + * @property {Transfer[]} paidStakingRewards + * @property {?string} prngBytes + * @property {?number} prngNumber + * @property {?string} evmAddress + */ + +/** + * Either the record of processing the first consensus transaction with the given id whose + * status was neither INVALID_NODE_ACCOUNT nor INVALID_PAYER_SIGNATURE; + * or, if no such record exists, the record of processing the first transaction to reach + * consensus with the given transaction id. + */ +class TransactionRecord { + /** + * @private + * @param {object} props + * @param {ContractFunctionResult} [props.contractFunctionResult] + * @param {TransactionReceipt} props.receipt + * @param {Uint8Array} props.transactionHash + * @param {Timestamp} props.consensusTimestamp + * @param {TransactionId} props.transactionId + * @param {string} props.transactionMemo + * @param {Hbar} props.transactionFee + * @param {Transfer[]} props.transfers + * @param {TokenTransferMap} props.tokenTransfers + * @param {TokenTransfer[]} props.tokenTransfersList + * @param {?ScheduleId} props.scheduleRef + * @param {AssessedCustomFee[]} props.assessedCustomFees + * @param {TokenNftTransferMap} props.nftTransfers + * @param {TokenAssocation[]} props.automaticTokenAssociations + * @param {Timestamp | null} props.parentConsensusTimestamp + * @param {PublicKey | null} props.aliasKey + * @param {TransactionRecord[]} props.duplicates + * @param {TransactionRecord[]} props.children + * @param {HbarAllowance[]} props.hbarAllowanceAdjustments + * @param {TokenAllowance[]} props.tokenAllowanceAdjustments + * @param {TokenNftAllowance[]} props.nftAllowanceAdjustments + * @param {?Uint8Array} props.ethereumHash + * @param {Transfer[]} props.paidStakingRewards + * @param {?Uint8Array} props.prngBytes + * @param {?number} props.prngNumber + * @param {?EvmAddress} props.evmAddress + * @param {PendingAirdropRecord[]} props.newPendingAirdrops + */ + constructor(props) { + /** + * The status (reach consensus, or failed, or is unknown) and the ID of + * any new account/file/instance created. + * + * @readonly + */ + this.receipt = props.receipt; + + /** + * The hash of the Transaction that executed (not the hash of any Transaction that failed + * for having a duplicate TransactionID). + * + * @readonly + */ + this.transactionHash = props.transactionHash; + + /** + * The consensus timestamp (or null if didn't reach consensus yet). + * + * @readonly + */ + this.consensusTimestamp = props.consensusTimestamp; + + /** + * The ID of the transaction this record represents. + * + * @readonly + */ + this.transactionId = props.transactionId; + + /** + * The memo that was submitted as part of the transaction (max 100 bytes). + * + * @readonly + */ + this.transactionMemo = props.transactionMemo; + + /** + * The actual transaction fee charged, + * not the original transactionFee value from TransactionBody. + * + * @readonly + */ + this.transactionFee = props.transactionFee; + + /** + * All hbar transfers as a result of this transaction, such as fees, or transfers performed + * by the transaction, or by a smart contract it calls, or by the creation of threshold + * records that it triggers. + * + * @readonly + */ + this.transfers = props.transfers; + + /** + * Record of the value returned by the smart contract function or constructor. + * + * @readonly + */ + this.contractFunctionResult = + props.contractFunctionResult != null + ? props.contractFunctionResult + : null; + + /** + * All the token transfers from this account + * + * @readonly + */ + this.tokenTransfers = props.tokenTransfers; + + /** + * All the token transfers from this account + * + * @readonly + */ + this.tokenTransfersList = props.tokenTransfersList; + + /** + * Reference to the scheduled transaction ID that this transaction record represent + * + * @readonly + */ + this.scheduleRef = props.scheduleRef; + + /** + * All custom fees that were assessed during a CryptoTransfer, and must be paid if the + * transaction status resolved to SUCCESS + * + * @readonly + */ + this.assessedCustomFees = props.assessedCustomFees; + + /** @readonly */ + this.nftTransfers = props.nftTransfers; + + /** + * All token associations implicitly created while handling this transaction + * + * @readonly + */ + this.automaticTokenAssociations = props.automaticTokenAssociations; + + /** + * In the record of an internal transaction, the consensus timestamp of the user + * transaction that spawned it. + * + * @readonly + */ + this.parentConsensusTimestamp = props.parentConsensusTimestamp; + + /** + * In the record of an internal CryptoCreate transaction triggered by a user + * transaction with a (previously unused) alias, the new account's alias. + * + * @readonly + */ + this.aliasKey = props.aliasKey; + + /** + * The records of processing all consensus transaction with the same id as the distinguished + * record above, in chronological order. + * + * @readonly + */ + this.duplicates = props.duplicates; + + /** + * The records of processing all child transaction spawned by the transaction with the given + * top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. + * + * @readonly + */ + this.children = props.children; + + /** + * @deprecated + * @readonly + */ + // eslint-disable-next-line deprecation/deprecation + this.hbarAllowanceAdjustments = props.hbarAllowanceAdjustments; + + /** + * @deprecated + * @readonly + */ + // eslint-disable-next-line deprecation/deprecation + this.tokenAllowanceAdjustments = props.tokenAllowanceAdjustments; + + /** + * @deprecated + * @readonly + */ + // eslint-disable-next-line deprecation/deprecation + this.nftAllowanceAdjustments = props.nftAllowanceAdjustments; + + /** + * The keccak256 hash of the ethereumData. This field will only be populated for + * EthereumTransaction. + * + * @readonly + */ + this.ethereumHash = props.ethereumHash; + + /** + * List of accounts with the corresponding staking rewards paid as a result of a transaction. + * + * @readonly + */ + this.paidStakingRewards = props.paidStakingRewards; + + /** + * In the record of a PRNG transaction with no output range, a pseudorandom 384-bit string. + * + * @readonly + */ + this.prngBytes = props.prngBytes; + + /** + * In the record of a PRNG transaction with an output range, the output of a PRNG whose input was a 384-bit string. + * + * @readonly + */ + this.prngNumber = props.prngNumber; + + /** + * The new default EVM address of the account created by this transaction. + * This field is populated only when the EVM address is not specified in the related transaction body. + * + * @readonly + */ + this.evmAddress = props.evmAddress; + + /** + * The new default EVM address of the account created by this transaction. + * This field is populated only when the EVM address is not specified in the related transaction body. + * + * @readonly + */ + this.newPendingAirdrops = props.newPendingAirdrops; + + Object.freeze(this); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ITransactionGetRecordResponse} + */ + _toProtobuf() { + const tokenTransfers = this.tokenTransfers._toProtobuf(); + const nftTransfers = this.nftTransfers._toProtobuf(); + + const tokenTransferLists = []; + + for (const tokenTransfer of tokenTransfers) { + for (const nftTransfer of nftTransfers) { + if ( + tokenTransfer.token != null && + nftTransfer.token != null && + tokenTransfer.token.shardNum === + nftTransfer.token.shardNum && + tokenTransfer.token.realmNum === + nftTransfer.token.realmNum && + tokenTransfer.token.tokenNum === nftTransfer.token.tokenNum + ) { + tokenTransferLists.push({ + token: tokenTransfer.token, + transfers: tokenTransfer.transfers, + nftTransfers: tokenTransfer.nftTransfers, + }); + } else { + tokenTransferLists.push(tokenTransfer); + tokenTransferLists.push(nftTransfer); + } + } + } + + const duplicates = this.duplicates.map( + (record) => + /** @type {HashgraphProto.proto.ITransactionRecord} */ ( + record._toProtobuf().transactionRecord + ), + ); + const children = this.children.map( + (record) => + /** @type {HashgraphProto.proto.ITransactionRecord} */ ( + record._toProtobuf().transactionRecord + ), + ); + + return { + duplicateTransactionRecords: duplicates, + childTransactionRecords: children, + transactionRecord: { + receipt: this.receipt._toProtobuf().receipt, + + transactionHash: + this.transactionHash != null ? this.transactionHash : null, + consensusTimestamp: + this.consensusTimestamp != null + ? this.consensusTimestamp._toProtobuf() + : null, + transactionID: + this.transactionId != null + ? this.transactionId._toProtobuf() + : null, + memo: + this.transactionMemo != null ? this.transactionMemo : null, + + transactionFee: + this.transactionFee != null + ? this.transactionFee.toTinybars() + : null, + + contractCallResult: + this.contractFunctionResult != null && + !this.contractFunctionResult._createResult + ? this.contractFunctionResult._toProtobuf() + : null, + + contractCreateResult: + this.contractFunctionResult != null && + this.contractFunctionResult._createResult + ? this.contractFunctionResult._toProtobuf() + : null, + + transferList: + this.transfers != null + ? { + accountAmounts: this.transfers.map((transfer) => + transfer._toProtobuf(), + ), + } + : null, + tokenTransferLists, + scheduleRef: + this.scheduleRef != null + ? this.scheduleRef._toProtobuf() + : null, + assessedCustomFees: this.assessedCustomFees.map((fee) => + fee._toProtobuf(), + ), + automaticTokenAssociations: this.automaticTokenAssociations.map( + (association) => association._toProtobuf(), + ), + parentConsensusTimestamp: + this.parentConsensusTimestamp != null + ? this.parentConsensusTimestamp._toProtobuf() + : null, + alias: + this.aliasKey != null + ? lib.proto.Key.encode( + this.aliasKey._toProtobufKey(), + ).finish() + : null, + ethereumHash: this.ethereumHash, + + paidStakingRewards: this.paidStakingRewards.map((transfer) => + transfer._toProtobuf(), + ), + + prngBytes: this.prngBytes, + prngNumber: this.prngNumber != null ? this.prngNumber : null, + evmAddress: + this.evmAddress != null ? this.evmAddress.toBytes() : null, + newPendingAirdrops: this.newPendingAirdrops.map((airdrop) => + airdrop.toBytes(), + ), + }, + }; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransactionGetRecordResponse} response + * @returns {TransactionRecord} + */ + static _fromProtobuf(response) { + const record = /** @type {HashgraphProto.proto.ITransactionRecord} */ ( + response.transactionRecord + ); + + let aliasKey = + record.alias != null && record.alias.length > 0 + ? src_Key_Key._fromProtobufKey( + lib.proto.Key.decode(record.alias), + ) + : null; + + if (!(aliasKey instanceof src_PublicKey_PublicKey)) { + aliasKey = null; + } + + const children = + response.childTransactionRecords != null + ? response.childTransactionRecords.map((child) => + TransactionRecord._fromProtobuf({ + transactionRecord: child, + }), + ) + : []; + + const duplicates = + response.duplicateTransactionRecords != null + ? response.duplicateTransactionRecords.map((duplicate) => + TransactionRecord._fromProtobuf({ + transactionRecord: duplicate, + }), + ) + : []; + + const contractFunctionResult = + record.contractCallResult != null + ? ContractFunctionResult._fromProtobuf( + record.contractCallResult, + false, + ) + : record.contractCreateResult != null + ? ContractFunctionResult._fromProtobuf( + record.contractCreateResult, + true, + ) + : undefined; + + const newPendingAirdrops = + record.newPendingAirdrops != null + ? record.newPendingAirdrops.map((airdrop) => + PendingAirdropRecord.fromBytes(airdrop), + ) + : []; + + return new TransactionRecord({ + receipt: TransactionReceipt._fromProtobuf({ + receipt: + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + record.receipt + ), + }), + transactionHash: + record.transactionHash != null + ? record.transactionHash + : new Uint8Array(), + consensusTimestamp: Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ + (record.consensusTimestamp), + ), + transactionId: TransactionId_TransactionId._fromProtobuf( + /** @type {HashgraphProto.proto.ITransactionID} */ ( + record.transactionID + ), + ), + transactionMemo: record.memo != null ? record.memo : "", + transactionFee: Hbar_Hbar.fromTinybars( + record.transactionFee != null ? record.transactionFee : 0, + ), + transfers: Transfer._fromProtobuf( + record.transferList != null + ? record.transferList.accountAmounts != null + ? record.transferList.accountAmounts + : [] + : [], + ), + contractFunctionResult, + tokenTransfers: TokenTransferMap._fromProtobuf( + record.tokenTransferLists != null + ? record.tokenTransferLists + : [], + ), + tokenTransfersList: TokenTransfer._fromProtobuf( + record.tokenTransferLists != null + ? record.tokenTransferLists + : [], + ), + scheduleRef: + record.scheduleRef != null + ? ScheduleId._fromProtobuf(record.scheduleRef) + : null, + assessedCustomFees: + record.assessedCustomFees != null + ? record.assessedCustomFees.map((fee) => + AssessedCustomFee._fromProtobuf(fee), + ) + : [], + nftTransfers: TokenNftTransferMap._fromProtobuf( + record.tokenTransferLists != null + ? record.tokenTransferLists + : [], + ), + automaticTokenAssociations: + record.automaticTokenAssociations != null + ? record.automaticTokenAssociations.map((association) => + TokenAssociation._fromProtobuf(association), + ) + : [], + parentConsensusTimestamp: + record.parentConsensusTimestamp != null + ? Timestamp_Timestamp._fromProtobuf(record.parentConsensusTimestamp) + : null, + aliasKey, + duplicates, + children, + hbarAllowanceAdjustments: [], + tokenAllowanceAdjustments: [], + nftAllowanceAdjustments: [], + ethereumHash: + record.ethereumHash != null ? record.ethereumHash : null, + paidStakingRewards: + record.paidStakingRewards != null + ? Transfer._fromProtobuf(record.paidStakingRewards) + : [], + prngBytes: record.prngBytes != null ? record.prngBytes : null, + prngNumber: record.prngNumber != null ? record.prngNumber : null, + evmAddress: + record.evmAddress != null + ? EvmAddress.fromBytes(record.evmAddress) + : null, + newPendingAirdrops: newPendingAirdrops, + }); + } + + /** + * @param {Uint8Array} bytes + * @returns {TransactionRecord} + */ + static fromBytes(bytes) { + return TransactionRecord._fromProtobuf( + lib.proto.TransactionGetRecordResponse.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.TransactionGetRecordResponse.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {TransactionRecordJSON} + */ + toJSON() { + return { + receipt: this.receipt.toJSON(), + transactionHash: hex_browser_encode(this.transactionHash), + consensusTimestamp: this.consensusTimestamp.toDate(), + transactionId: this.transactionId.toString(), + transactionMemo: this.transactionMemo, + transactionFee: this.transactionFee.toTinybars().toString(), + transfers: this.transfers.map((transfer) => transfer.toJSON()), + tokenTransfers: this.tokenTransfers, + tokenTransfersList: this.tokenTransfersList.map((transfer) => + transfer.toJSON(), + ), + scheduleRef: this.scheduleRef?.toString() || null, + assessedCustomFees: this.assessedCustomFees, + nftTransfers: this.nftTransfers, + automaticTokenAssociations: this.automaticTokenAssociations, + parentConsensusTimestamp: + this.parentConsensusTimestamp?.toDate() || null, + aliasKey: this.aliasKey?.toString() || null, + duplicates: this.duplicates, + children: this.children, + ethereumHash: + this.ethereumHash != null + ? hex_browser_encode(this.ethereumHash) + : null, + paidStakingRewards: this.paidStakingRewards, + prngBytes: + this.prngBytes != null ? hex_browser_encode(this.prngBytes) : null, + prngNumber: this.prngNumber, + evmAddress: this.evmAddress?.toString() || null, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/RecordStatusError.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @typedef {import("./Status.js").default} Status + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("./transaction/TransactionRecord").default} TransactionRecord + */ + +class RecordStatusError extends StatusError { + /** + * @param {object} props + * @param {TransactionRecord} props.transactionRecord + * @param {Status} props.status + * @param {TransactionId} props.transactionId + */ + constructor(props) { + super( + props, + `Record for transaction ${props.transactionId.toString()} contained error status ${props.status.toString()}`, + ); + + /** + * @type {TransactionRecord} + * @readonly + */ + this.transactionRecord = props.transactionRecord; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/TransactionRecordQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + +const { proto: TransactionRecordQuery_proto } = lib_namespaceObject; + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ + +/** + * @augments {Query} + */ +class TransactionRecordQuery extends Query_Query { + /** + * @param {object} [props] + * @param {TransactionId} [props.transactionId] + * @param {boolean} [props.includeChildren] + * @param {boolean} [props.includeDuplicates] + * @param {boolean} [props.validateReceiptStatus] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TransactionId} + */ + this._transactionId = null; + + /** + * @private + * @type {?boolean} + */ + this._includeChildren = null; + + /** + * @private + * @type {?boolean} + */ + this._includeDuplicates = null; + + this._validateReceiptStatus = true; + + if (props.transactionId != null) { + this.setTransactionId(props.transactionId); + } + + if (props.includeChildren != null) { + this.setIncludeChildren(props.includeChildren); + } + + if (props.includeDuplicates != null) { + this.setIncludeDuplicates(props.includeDuplicates); + } + + if (props.validateReceiptStatus != null) { + this.setValidateReceiptStatus(props.validateReceiptStatus); + } + } + + /** + * @returns {?TransactionId} + */ + get transactionId() { + return this._transactionId; + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {TransactionRecordQuery} + */ + static _fromProtobuf(query) { + const record = + /** @type {HashgraphProto.proto.ITransactionGetRecordQuery} */ ( + query.transactionGetRecord + ); + + return new TransactionRecordQuery({ + transactionId: record.transactionID + ? TransactionId_TransactionId._fromProtobuf(record.transactionID) + : undefined, + includeChildren: + record.includeChildRecords != null + ? record.includeChildRecords + : undefined, + includeDuplicates: + record.includeDuplicates != null + ? record.includeDuplicates + : undefined, + }); + } + + /** + * Set the transaction ID for which the record is being requested. + * + * @param {TransactionId | string} transactionId + * @returns {TransactionRecordQuery} + */ + setTransactionId(transactionId) { + this._transactionId = + typeof transactionId === "string" + ? TransactionId_TransactionId.fromString(transactionId) + : transactionId.clone(); + + return this; + } + + /** + * @param {boolean} includeChildren + * @returns {TransactionRecordQuery} + */ + setIncludeChildren(includeChildren) { + this._includeChildren = includeChildren; + return this; + } + + /** + * @returns {boolean} + */ + get includeChildren() { + return this._includeChildren != null ? this._includeChildren : false; + } + + /** + * @param {boolean} includeDuplicates + * @returns {TransactionRecordQuery} + */ + setIncludeDuplicates(includeDuplicates) { + this._duplicates = includeDuplicates; + return this; + } + + /** + * @returns {boolean} + */ + get includeDuplicates() { + return this._duplicates != null ? this._duplicates : false; + } + + /** + * @param {boolean} validateReceiptStatus + * @returns {this} + */ + setValidateReceiptStatus(validateReceiptStatus) { + this._validateReceiptStatus = validateReceiptStatus; + return this; + } + + /** + * @returns {boolean} + */ + get validateReceiptStatus() { + return this._validateReceiptStatus; + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @returns {[Status, ExecutionState]} + */ + _shouldRetry(request, response) { + const { nodeTransactionPrecheckCode } = + this._mapResponseHeader(response); + + let status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : TransactionRecordQuery_proto.ResponseCodeEnum.OK, + ); + + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] received node precheck status ${status.toString()}`, + ); + } + + switch (status) { + case Status.Busy: + case Status.Unknown: + case Status.ReceiptNotFound: + case Status.RecordNotFound: + case Status.PlatformNotActive: + return [status, ExecutionState.Retry]; + + case Status.Ok: + break; + + default: + return [status, ExecutionState.Error]; + } + + const transactionGetRecord = + /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ ( + response.transactionGetRecord + ); + const header = /** @type {HashgraphProto.proto.IResponseHeader} */ ( + transactionGetRecord.header + ); + + if ( + header.responseType === + lib.proto.ResponseType.COST_ANSWER + ) { + return [status, ExecutionState.Finished]; + } + + const record = /** @type {HashgraphProto.proto.ITransactionRecord} */ ( + transactionGetRecord.transactionRecord + ); + const receipt = + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + record.receipt + ); + const receiptStatusCode = + /** @type {HashgraphProto.proto.ResponseCodeEnum} */ ( + receipt.status + ); + status = Status._fromCode(receiptStatusCode); + + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] received record's receipt ${status.toString()}`, + ); + } + + switch (status) { + case Status.Ok: + case Status.Busy: + case Status.Unknown: + case Status.ReceiptNotFound: + case Status.RecordNotFound: + return [status, ExecutionState.Retry]; + + case Status.Success: + return [status, ExecutionState.Finished]; + + default: + return [ + status, + this._validateReceiptStatus + ? ExecutionState.Error + : ExecutionState.Finished, + ]; + } + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeId + * @returns {Error} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapStatusError(request, response, nodeId) { + const { nodeTransactionPrecheckCode } = + this._mapResponseHeader(response); + + let status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : TransactionRecordQuery_proto.ResponseCodeEnum.OK, + ); + switch (status) { + case Status.Ok: + // Do nothing + break; + + case Status.ContractRevertExecuted: + return new RecordStatusError({ + status, + transactionId: this._getTransactionId(), + transactionRecord: TransactionRecord._fromProtobuf({ + transactionRecord: + // @ts-ignore + response.transactionGetRecord.transactionRecord, + }), + }); + + default: + return new PrecheckStatusError({ + nodeId, + status, + transactionId: this._getTransactionId(), + contractFunctionResult: null, + }); + } + + const transactionGetRecord = + /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ ( + response.transactionGetRecord + ); + const record = /** @type {HashgraphProto.proto.ITransactionRecord} */ ( + transactionGetRecord.transactionRecord + ); + const receipt = + /** @type {HashgraphProto.proto.ITransactionReceipt} */ ( + record.receipt + ); + const receiptStatusError = + /** @type {HashgraphProto.proto.ResponseCodeEnum} */ ( + receipt.status + ); + + status = Status._fromCode(receiptStatusError); + + switch (status) { + case Status.ContractRevertExecuted: + return new RecordStatusError({ + status, + transactionId: this._getTransactionId(), + transactionRecord: TransactionRecord._fromProtobuf({ + transactionRecord: + // @ts-ignore + response.transactionGetRecord.transactionRecord, + }), + }); + + default: + return new ReceiptStatusError({ + status, + transactionId: this._getTransactionId(), + transactionReceipt: TransactionReceipt._fromProtobuf({ + receipt, + }), + }); + } + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if ( + this._transactionId != null && + this._transactionId.accountId != null + ) { + this._transactionId.accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.getTxRecordByTxID(request); + } + + /** + * @override + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const transactionGetRecord = + /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ ( + response.transactionGetRecord + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + transactionGetRecord.header + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const record = + /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ ( + response.transactionGetRecord + ); + return Promise.resolve(TransactionRecord._fromProtobuf(record)); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + transactionGetRecord: { + header, + transactionID: + this._transactionId != null + ? this._transactionId._toProtobuf() + : null, + includeChildRecords: this._includeChildren, + includeDuplicates: this._includeDuplicates, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `TransactionRecordQuery:${timestamp.toString()}`; + } +} + +QUERY_REGISTRY.set( + "transactionGetRecord", + // eslint-disable-next-line @typescript-eslint/unbound-method + TransactionRecordQuery._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("./TransactionReceipt.js").default} TransactionReceipt + * @typedef {import("./TransactionRecord.js").default} TransactionRecord + * @typedef {import("../Signer.js").Signer} Signer + */ + +/** + * @typedef {object} TransactionResponseJSON + * @property {string} nodeId + * @property {string} transactionHash + * @property {string} transactionId + */ + +class TransactionResponse { + /** + * @internal + * @param {object} props + * @param {AccountId} props.nodeId + * @param {Uint8Array} props.transactionHash + * @param {TransactionId} props.transactionId + */ + constructor(props) { + /** @readonly */ + this.nodeId = props.nodeId; + + /** @readonly */ + this.transactionHash = props.transactionHash; + + /** @readonly */ + this.transactionId = props.transactionId; + + Object.freeze(this); + } + + /** + * @param {TransactionResponseJSON} json + * @returns {TransactionResponse} + */ + static fromJSON(json) { + return new TransactionResponse({ + nodeId: AccountId_AccountId.fromString(json.nodeId), + transactionHash: decode(json.transactionHash), + transactionId: TransactionId_TransactionId.fromString(json.transactionId), + }); + } + + /** + * @param {Client} client + * @returns {Promise} + */ + async getReceipt(client) { + const receipt = await this.getReceiptQuery().execute(client); + + if ( + receipt.status !== Status.Success && + receipt.status !== Status.FeeScheduleFilePartUploaded + ) { + throw new ReceiptStatusError({ + transactionReceipt: receipt, + status: receipt.status, + transactionId: this.transactionId, + }); + } + + return receipt; + } + + /** + * getRecord is calling getReceipt and in case the receipt status code is not OK, only the receipt is returned. + * + * @param {Client} client + * @returns {Promise} + */ + async getRecord(client) { + await this.getReceipt(client); + + return this.getRecordQuery().execute(client); + } + + /** + * getVerboseRecord is calling getReceipt and in case the receipt status code is not OK, the record is returned. + * + * @param {Client} client + * @returns {Promise} + */ + async getVerboseRecord(client) { + try { + // The receipt needs to be called in order to wait for transaction to be included in the consensus. Otherwise we are going to get "DUPLICATE_TRANSACTION". + await this.getReceiptQuery().execute(client); + return this.getRecordQuery().execute(client); + } catch (e) { + return this.getRecordQuery().execute(client); + } + } + + /** + * @param {Signer} signer + * @returns {Promise} + */ + async getReceiptWithSigner(signer) { + const receipt = await this.getReceiptQuery().executeWithSigner(signer); + + if (receipt.status !== Status.Success) { + throw new ReceiptStatusError({ + transactionReceipt: receipt, + status: receipt.status, + transactionId: this.transactionId, + }); + } + + return receipt; + } + + /** + * @param {Signer} signer + * @returns {Promise} + */ + async getRecordWithSigner(signer) { + await this.getReceiptWithSigner(signer); + + return this.getRecordQuery().executeWithSigner(signer); + } + + /** + * @returns {TransactionReceiptQuery} + */ + getReceiptQuery() { + return new TransactionReceiptQuery() + .setTransactionId(this.transactionId) + .setNodeAccountIds([this.nodeId]); + } + + /** + * @returns {TransactionRecordQuery} + */ + getRecordQuery() { + return new TransactionRecordQuery() + .setTransactionId(this.transactionId) + .setNodeAccountIds([this.nodeId]); + } + + /** + * @returns {TransactionResponseJSON} + */ + toJSON() { + return { + nodeId: this.nodeId.toString(), + transactionHash: hex_browser_encode(this.transactionHash), + transactionId: this.transactionId.toString(), + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/cryptography/sha384.browser.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @param {Uint8Array} data + * @returns {Promise} + */ +async function sha384_browser_digest(data) { + // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest + return new Uint8Array(await window.crypto.subtle.digest("SHA-384", data)); +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/TransactionHashMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + */ + +/** + * @augments {ObjectMap} + */ +class TransactionHashMap extends ObjectMap { + constructor() { + super((s) => AccountId_AccountId.fromString(s)); + } + + /** + * @param {import("./Transaction.js").default} transaction + * @returns {Promise} + */ + static async _fromTransaction(transaction) { + const hashes = new TransactionHashMap(); + + for (let i = 0; i < transaction._nodeAccountIds.length; i++) { + const nodeAccountId = transaction._nodeAccountIds.list[i]; + const tx = /** @type {HashgraphProto.proto.ITransaction} */ ( + transaction._transactions.get(i) + ); + const hash = await sha384_browser_digest( + /** @type {Uint8Array} */ (tx.signedTransactionBytes), + ); + + hashes._set(nodeAccountId, hash); + } + + return hashes; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/NodeAccountIdSignatureMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @augments {ObjectMap} + */ +class NodeAccountIdSignatureMap extends ObjectMap { + constructor() { + super((s) => src_PublicKey_PublicKey.fromString(s)); + } + + /** + * @param {import("@hashgraph/proto").proto.ISignatureMap} sigMap + * @returns {NodeAccountIdSignatureMap} + */ + static _fromTransactionSigMap(sigMap) { + const signatures = new NodeAccountIdSignatureMap(); + + const sigPairs = sigMap.sigPair != null ? sigMap.sigPair : []; + + for (const sigPair of sigPairs) { + if (sigPair.pubKeyPrefix != null) { + if (sigPair.ed25519 != null) { + signatures._set( + src_PublicKey_PublicKey.fromBytesED25519(sigPair.pubKeyPrefix), + sigPair.ed25519, + ); + } else if (sigPair.ECDSASecp256k1 != null) { + signatures._set( + src_PublicKey_PublicKey.fromBytesECDSA(sigPair.pubKeyPrefix), + sigPair.ECDSASecp256k1, + ); + } + } + } + + return signatures; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/SignatureMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @augments {ObjectMap} + */ +class SignatureMap extends ObjectMap { + constructor() { + super((s) => AccountId_AccountId.fromString(s)); + } + + /** + * @param {import("./Transaction.js").default} transaction + * @returns {SignatureMap} + */ + static _fromTransaction(transaction) { + const signatures = new SignatureMap(); + + for (let i = 0; i < transaction._nodeAccountIds.length; i++) { + const sigMap = transaction._signedTransactions.get(i).sigMap; + + if (sigMap != null) { + signatures._set( + transaction._nodeAccountIds.list[i], + NodeAccountIdSignatureMap._fromTransactionSigMap(sigMap), + ); + } + } + + return signatures; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/transaction/Transaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + + + + + + + + +/** + * @typedef {import("bignumber.js").default} BigNumber + */ + +/** + * @typedef {import("../schedule/ScheduleCreateTransaction.js").default} ScheduleCreateTransaction + * @typedef {import("../PrivateKey.js").default} PrivateKey + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../Signer.js").Signer} Signer + */ + +// 90 days (in seconds) +const DEFAULT_AUTO_RENEW_PERIOD = src_long.fromValue(7776000); + +// maximum value of i64 (so there is never a record generated) +const DEFAULT_RECORD_THRESHOLD = Hbar_Hbar.fromTinybars( + src_long.fromString("9223372036854775807"), +); + +// 120 seconds +const DEFAULT_TRANSACTION_VALID_DURATION = 120; + +const CHUNK_SIZE = 1024; + +/** + * @type {Map, (transactions: HashgraphProto.proto.ITransaction[], signedTransactions: HashgraphProto.proto.ISignedTransaction[], transactionIds: TransactionId[], nodeIds: AccountId[], bodies: HashgraphProto.proto.TransactionBody[]) => Transaction>} + */ +const TRANSACTION_REGISTRY = new Map(); + +/** + * Base class for all transactions that may be submitted to Hedera. + * + * @abstract + * @augments {Executable} + */ +class Transaction_Transaction extends Executable { + // A SDK transaction is composed of multiple, raw protobuf transactions. + // These should be functionally identical, with the exception of pointing to + // different nodes. + + // When retrying a transaction after a network error or retry-able + // status response, we try a different transaction and thus a different node. + + constructor() { + super(); + + /** + * List of proto transactions that have been built from this SDK + * transaction. + * + * This is a 2-D array built into one, meaning to + * get to the next row you'd index into this array `row * rowLength + column` + * where `rowLength` is `nodeAccountIds.length` + * + * @internal + * @type {List} + */ + this._transactions = new List(); + + /** + * List of proto transactions that have been built from this SDK + * transaction. + * + * This is a 2-D array built into one, meaning to + * get to the next row you'd index into this array `row * rowLength + column` + * where `rowLength` is `nodeAccountIds.length` + * + * @internal + * @type {List} + */ + this._signedTransactions = new List(); + + /** + * Set of public keys (as string) who have signed this transaction so + * we do not allow them to sign it again. + * + * @internal + * @type {Set} + */ + this._signerPublicKeys = new Set(); + + /** + * The transaction valid duration + * + * @private + * @type {number} + */ + this._transactionValidDuration = DEFAULT_TRANSACTION_VALID_DURATION; + + /** + * The default max transaction fee for this particular transaction type. + * Most transactions use the default of 2 Hbars, but some requests such + * as `TokenCreateTransaction` need to use a different default value. + * + * @protected + * @type {Hbar} + */ + this._defaultMaxTransactionFee = new Hbar_Hbar(2); + + /** + * The max transaction fee on the request. This field is what users are able + * to set, not the `defaultMaxTransactionFee`. The purpose of this field is + * to allow us to determine if the user set the field explicitly, or if we're + * using the default max transation fee for the request. + * + * @private + * @type {Hbar | null} + */ + this._maxTransactionFee = null; + + /** + * The transaction's memo + * + * @private + * @type {string} + */ + this._transactionMemo = ""; + + /** + * The list of transaction IDs. This list will almost always be of length 1. + * The only time this list will be a different length is for chunked transactions. + * The only two chunked transactions supported right now are `FileAppendTransaction` + * and `TopicMessageSubmitTransaction` + * + * @protected + * @type {List} + */ + this._transactionIds = new List(); + + /** + * A list of public keys that will be added to the requests signatures + * + * @private + * @type {PublicKey[]} + */ + this._publicKeys = []; + + /** + * The list of signing function 1-1 with `_publicKeys` which sign the request. + * The reason this list allows `null` is because if we go from bytes into + * a transaction, then we know the public key, but we don't have the signing function. + * + * @private + * @type {(((message: Uint8Array) => Promise) | null)[]} + */ + this._transactionSigners = []; + + /** + * Determine if we should regenerate transaction IDs when we receive `TRANSACITON_EXPIRED` + * + * @private + * @type {?boolean} + */ + this._regenerateTransactionId = null; + } + + /** + * Deserialize a transaction from bytes. The bytes can either be a `proto.Transaction` or + * `proto.TransactionList`. + * + * @param {Uint8Array} bytes + * @returns {Transaction} + */ + static fromBytes(bytes) { + /** @type {HashgraphProto.proto.ISignedTransaction[]} */ + const signedTransactions = []; + + /** @type {TransactionId[]} */ + const transactionIds = []; + + /** @type {AccountId[]} */ + const nodeIds = []; + + /** @type {string[]} */ + const transactionIdStrings = []; + + /** @type {string[]} */ + const nodeIdStrings = []; + + /** @type {HashgraphProto.proto.TransactionBody[]} */ + const bodies = []; + + const list = + lib.proto.TransactionList.decode(bytes).transactionList; + + // If the list is of length 0, then teh bytes provided were not a + // `proto.TransactionList` + // + // FIXME: We should also check to make sure the bytes length is greater than + // 0 otherwise this check is wrong? + if (list.length === 0) { + const transaction = lib.proto.Transaction.decode(bytes); + + // We support `Transaction.signedTransactionBytes` and + // `Transaction.bodyBytes` + `Transaction.sigMap`. If the bytes represent the + // latter, convert them into `signedTransactionBytes` + if (transaction.signedTransactionBytes.length !== 0) { + list.push(transaction); + } else { + list.push({ + signedTransactionBytes: + lib.proto.SignedTransaction.encode({ + sigMap: transaction.sigMap, + bodyBytes: transaction.bodyBytes, + }).finish(), + }); + } + } + + // This loop is responsible for fill out the `signedTransactions`, `transactionIds`, + // `nodeIds`, and `bodies` variables. + for (const transaction of list) { + // The `bodyBytes` or `signedTransactionBytes` should not be null + if ( + transaction.bodyBytes == null && + transaction.signedTransactionBytes == null + ) { + throw new Error( + "bodyBytes and signedTransactionBytes are null", + ); + } + + if (transaction.bodyBytes && transaction.bodyBytes.length != 0) { + // Decode a transaction + const body = lib.proto.TransactionBody.decode( + transaction.bodyBytes, + ); + + // Make sure the transaction ID within the body is set + if (body.transactionID != null) { + const transactionId = TransactionId_TransactionId._fromProtobuf( + /** @type {HashgraphProto.proto.ITransactionID} */ ( + body.transactionID + ), + ); + + // If we haven't already seen this transaction ID in the list, add it + if ( + !transactionIdStrings.includes(transactionId.toString()) + ) { + transactionIds.push(transactionId); + transactionIdStrings.push(transactionId.toString()); + } + } + + // Make sure the node account ID within the body is set + if (body.nodeAccountID != null) { + const nodeAccountId = AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + body.nodeAccountID + ), + ); + + // If we haven't already seen this node account ID in the list, add it + if (!nodeIdStrings.includes(nodeAccountId.toString())) { + nodeIds.push(nodeAccountId); + nodeIdStrings.push(nodeAccountId.toString()); + } + } + + // Make sure the body is set + if (body.data == null) { + throw new Error( + "(BUG) body.data was not set in the protobuf", + ); + } + + bodies.push(body); + } + + if ( + transaction.signedTransactionBytes && + transaction.signedTransactionBytes.length != 0 + ) { + // Decode a signed transaction + const signedTransaction = + lib.proto.SignedTransaction.decode( + transaction.signedTransactionBytes, + ); + + signedTransactions.push(signedTransaction); + + // Decode a transaction body + const body = lib.proto.TransactionBody.decode( + signedTransaction.bodyBytes, + ); + + // Make sure the transaction ID within the body is set + if (body.transactionID != null) { + const transactionId = TransactionId_TransactionId._fromProtobuf( + /** @type {HashgraphProto.proto.ITransactionID} */ ( + body.transactionID + ), + ); + + // If we haven't already seen this transaction ID in the list, add it + if ( + !transactionIdStrings.includes(transactionId.toString()) + ) { + transactionIds.push(transactionId); + transactionIdStrings.push(transactionId.toString()); + } + } + + // Make sure the node account ID within the body is set + if (body.nodeAccountID != null) { + const nodeAccountId = AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + body.nodeAccountID + ), + ); + + // If we haven't already seen this node account ID in the list, add it + if (!nodeIdStrings.includes(nodeAccountId.toString())) { + nodeIds.push(nodeAccountId); + nodeIdStrings.push(nodeAccountId.toString()); + } + } + + // Make sure the body is set + if (body.data == null) { + throw new Error( + "(BUG) body.data was not set in the protobuf", + ); + } + + bodies.push(body); + } + } + + // FIXME: We should have a length check before we access `0` since that would error + const body = bodies[0]; + + // We should have at least more than one body + if (body == null || body.data == null) { + throw new Error( + "No transaction found in bytes or failed to decode TransactionBody", + ); + } + + // Use the registry to call the right transaction's `fromProtobuf` method based + // on the `body.data` string + const fromProtobuf = TRANSACTION_REGISTRY.get(body.data); //NOSONAR + + // If we forgot to update the registry we should error + if (fromProtobuf == null) { + throw new Error( + `(BUG) Transaction.fromBytes() not implemented for type ${body.data}`, + ); + } + + // That the specific transaction type from protobuf implementation and pass in all the + // information we've gathered. + return fromProtobuf( + list, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * Convert this transaction a `ScheduleCreateTransaction` + * + * @returns {ScheduleCreateTransaction} + */ + schedule() { + this._requireNotFrozen(); + + if (SCHEDULE_CREATE_TRANSACTION.length != 1) { + throw new Error( + "ScheduleCreateTransaction has not been loaded yet", + ); + } + + return SCHEDULE_CREATE_TRANSACTION[0]()._setScheduledTransaction(this); + } + + /** + * This method is called by each `*Transaction._fromProtobuf()` method. It does + * all the finalization before the user gets hold of a complete `Transaction` + * + * @template {Transaction} TransactionT + * @param {TransactionT} transaction + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TransactionT} + */ + static _fromProtobufTransactions( + transaction, + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + + // "row" of the 2-D `bodies` array has all the same contents except for `nodeAccountID` + for (let i = 0; i < transactionIds.length; i++) { + for (let j = 0; j < nodeIds.length - 1; j++) { + if ( + !util_compare( + bodies[i * nodeIds.length + j], + bodies[i * nodeIds.length + j + 1], + // eslint-disable-next-line ie11/no-collection-args + new Set(["nodeAccountID"]), + ) + ) { + throw new Error("failed to validate transaction bodies"); + } + } + } + + // Remove node account IDs of 0 + // _IIRC_ this was initial due to some funny behavior with `ScheduleCreateTransaction` + // We may be able to remove this. + const zero = new AccountId_AccountId(0); + for (let i = 0; i < nodeIds.length; i++) { + if (nodeIds[i].equals(zero)) { + nodeIds.splice(i--, 1); + } + } + + // Set the transactions accordingly, but don't lock the list because transactions can + // be regenerated if more signatures are added + transaction._transactions.setList(transactions); + + // Set the signed transactions accordingly. Although, they + // can be manipulated if for instance more signatures are added + transaction._signedTransactions.setList(signedTransactions); + + // Set the transaction IDs accordingly + transaction._transactionIds.setList(transactionIds); + + // Set the node account IDs accordingly + transaction._nodeAccountIds.setList(nodeIds); + + // Make sure to update the rest of the fields + transaction._transactionValidDuration = + body.transactionValidDuration != null && + body.transactionValidDuration.seconds != null + ? src_long.fromValue(body.transactionValidDuration.seconds).toInt() + : DEFAULT_TRANSACTION_VALID_DURATION; + transaction._maxTransactionFee = + body.transactionFee != null && + body.transactionFee > new src_long(0, 0, true) + ? Hbar_Hbar.fromTinybars(body.transactionFee) + : null; + transaction._transactionMemo = body.memo != null ? body.memo : ""; + + // Loop over a single row of `signedTransactions` and add all the public + // keys to the `signerPublicKeys` set, and `publicKeys` list with + // `null` in the `transactionSigners` at the same index. + for (let i = 0; i < nodeIds.length; i++) { + const tx = signedTransactions[i] || transactions[i]; + if (tx.sigMap != null && tx.sigMap.sigPair != null) { + for (const sigPair of tx.sigMap.sigPair) { + transaction._signerPublicKeys.add( + hex_browser_encode( + /** @type {Uint8Array} */ (sigPair.pubKeyPrefix), + ), + ); + + transaction._publicKeys.push( + src_PublicKey_PublicKey.fromBytes( + /** @type {Uint8Array} */ (sigPair.pubKeyPrefix), + ), + ); + transaction._transactionSigners.push(null); + } + } + } + + return transaction; + } + + /** + * Set the node account IDs + * + * @override + * @param {AccountId[]} nodeIds + * @returns {this} + */ + setNodeAccountIds(nodeIds) { + // The reason we overwrite this method is simply because we need to call `requireNotFrozen()` + // Now that I think of it, we could just add an abstract method `setterPrerequiest()` which + // by default does nothing, and `Executable` can call. Then we'd only need to overwrite that + // method once. + this._requireNotFrozen(); + super.setNodeAccountIds(nodeIds); + return this; + } + + /** + * Get the transaction valid duration + * + * @returns {number} + */ + get transactionValidDuration() { + return this._transactionValidDuration; + } + + /** + * Sets the duration (in seconds) that this transaction is valid for. + * + * This is defaulted to 120 seconds (from the time its executed). + * + * @param {number} validDuration + * @returns {this} + */ + setTransactionValidDuration(validDuration) { + this._requireNotFrozen(); + this._transactionValidDuration = validDuration; + + return this; + } + + /** + * Get the max transaction fee + * + * @returns {?Hbar} + */ + get maxTransactionFee() { + return this._maxTransactionFee; + } + + /** + * Set the maximum transaction fee the operator (paying account) + * is willing to pay. + * + * @param {number | string | Long | BigNumber | Hbar} maxTransactionFee + * @returns {this} + */ + setMaxTransactionFee(maxTransactionFee) { + this._requireNotFrozen(); + this._maxTransactionFee = + maxTransactionFee instanceof Hbar_Hbar + ? maxTransactionFee + : new Hbar_Hbar(maxTransactionFee); + + return this; + } + + /** + * Is transaction ID regeneration enabled + * + * @returns {?boolean} + */ + get regenerateTransactionId() { + return this._regenerateTransactionId; + } + + /** + * Set the maximum transaction fee the operator (paying account) + * is willing to pay. + * + * @param {boolean} regenerateTransactionId + * @returns {this} + */ + setRegenerateTransactionId(regenerateTransactionId) { + this._requireNotFrozen(); + this._regenerateTransactionId = regenerateTransactionId; + + return this; + } + + /** + * Get the transaction memo + * + * @returns {string} + */ + get transactionMemo() { + return this._transactionMemo; + } + + /** + * Set a note or description to be recorded in the transaction + * record (maximum length of 100 bytes). + * + * @param {string} transactionMemo + * @returns {this} + */ + setTransactionMemo(transactionMemo) { + this._requireNotFrozen(); + this._transactionMemo = transactionMemo; + + return this; + } + + /** + * Get the curent transaction ID + * + * @returns {?TransactionId} + */ + get transactionId() { + if (this._transactionIds.isEmpty) { + return null; + } + + // If a user calls `.transactionId` that means we need to use that transaction ID + // and **not** regenerate it. To do this, we simply lock the transaction ID list. + // + // This may be a little conffusing since a user can enable transaction ID regenration + // explicity, but if they call `.transactionId` then we will not regenerate transaction + // IDs. + this._transactionIds.setLocked(); + + return this._transactionIds.current; + } + + /** + * Set the ID for this transaction. + * + * The transaction ID includes the operator's account ( the account paying the transaction + * fee). If two transactions have the same transaction ID, they won't both have an effect. One + * will complete normally and the other will fail with a duplicate transaction status. + * + * Normally, you should not use this method. Just before a transaction is executed, a + * transaction ID will be generated from the operator on the client. + * + * @param {TransactionId} transactionId + * @returns {this} + */ + setTransactionId(transactionId) { + this._requireNotFrozen(); + this._transactionIds.setList([transactionId]).setLocked(); + + return this; + } + + /** + * How many chunk sizes are expected + * @abstract + * @internal + * @returns {number} + */ + getRequiredChunks() { + return 1; + } + + /** + * Sign the transaction with the private key + * **NOTE**: This is a thin wrapper around `.signWith()` + * + * @param {PrivateKey} privateKey + * @returns {Promise} + */ + sign(privateKey) { + return this.signWith(privateKey.publicKey, (message) => + Promise.resolve(privateKey.sign(message)), + ); + } + + /** + * Sign the transaction with the public key and signer function + * + * If sign on demand is enabled no signing will be done immediately, instead + * the private key signing function and public key are saved to be used when + * a user calls an exit condition method (not sure what a better name for this is) + * such as `toBytes[Async]()`, `getTransactionHash[PerNode]()` or `execute()`. + * + * @param {PublicKey} publicKey + * @param {(message: Uint8Array) => Promise} transactionSigner + * @returns {Promise} + */ + async signWith(publicKey, transactionSigner) { + // If signing on demand is disabled, we need to make sure + // the request is frozen + if (!this._signOnDemand) { + this._requireFrozen(); + } + const publicKeyData = publicKey.toBytesRaw(); + + // note: this omits the DER prefix on purpose because Hedera doesn't + // support that in the protobuf. this means that we would fail + // to re-inflate [this._signerPublicKeys] during [fromBytes] if we used DER + // prefixes here + const publicKeyHex = hex_browser_encode(publicKeyData); + + if (this._signerPublicKeys.has(publicKeyHex)) { + // this public key has already signed this transaction + return this; + } + + // If we add a new signer, then we need to re-create all transactions + this._transactions.clear(); + + // Save the current public key so we don't attempt to sign twice + this._signerPublicKeys.add(publicKeyHex); + + // If signing on demand is enabled we will save the public key and signer and return + if (this._signOnDemand) { + this._publicKeys.push(publicKey); + this._transactionSigners.push(transactionSigner); + + return this; + } + + // If we get here, signing on demand is disabled, this means the transaction + // is frozen and we need to sign all the transactions immediately. If we're + // signing all the transactions immediately, we need to lock the node account IDs + // and transaction IDs. + // Now that I think of it, this code should likely exist in `freezeWith()`? + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + + // Sign each signed transatcion + for (const signedTransaction of this._signedTransactions.list) { + const bodyBytes = /** @type {Uint8Array} */ ( + signedTransaction.bodyBytes + ); + const signature = await transactionSigner(bodyBytes); + + if (signedTransaction.sigMap == null) { + signedTransaction.sigMap = {}; + } + + if (signedTransaction.sigMap.sigPair == null) { + signedTransaction.sigMap.sigPair = []; + } + + signedTransaction.sigMap.sigPair.push( + publicKey._toProtobufSignature(signature), + ); + } + + return this; + } + + /** + * Sign the transaction with the client operator. This is a thin wrapper + * around `.signWith()` + * + * **NOTE**: If client does not have an operator set, this method will throw + * + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + signWithOperator(client) { + const operator = client._operator; + + if (operator == null) { + throw new Error( + "`client` must have an operator to sign with the operator", + ); + } + + if (!this._isFrozen()) { + this.freezeWith(client); + } + + return this.signWith(operator.publicKey, operator.transactionSigner); + } + + /** + * Add a signature explicitly + * + * This method supports both single and multiple signatures. A single signature will be applied to all transactions, + * While an array of signatures must correspond to each transaction individually. + * + * @param {PublicKey} publicKey + * @param {Uint8Array | Uint8Array[]} signature + * @returns {this} + */ + addSignature(publicKey, signature) { + const isSingleSignature = signature instanceof Uint8Array; + const isArraySignature = Array.isArray(signature); + + if (this.getRequiredChunks() > 1) { + throw new Error( + "Add signature is not supported for chunked transactions", + ); + } + // Check if it is a single signature with NOT exactly one transaction + if (isSingleSignature && this._signedTransactions.length !== 1) { + throw new Error( + "Signature array must match the number of transactions", + ); + } + + // Check if it's an array but the array length doesn't match the number of transactions + if ( + isArraySignature && + signature.length !== this._signedTransactions.length + ) { + throw new Error( + "Signature array must match the number of transactions", + ); + } + + // If the transaction isn't frozen, freeze it. + if (!this.isFrozen()) { + this.freeze(); + } + + const publicKeyData = publicKey.toBytesRaw(); + const publicKeyHex = hex_browser_encode(publicKeyData); + + if (this._signerPublicKeys.has(publicKeyHex)) { + // this public key has already signed this transaction + return this; + } + + // If we add a new signer, then we need to re-create all transactions + this._transactions.clear(); + + // Locking the transaction IDs and node account IDs is necessary for consistency + // between before and after execution + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + this._signedTransactions.setLocked(); + + const signatureArray = isSingleSignature ? [signature] : signature; + + // Add the signature to the signed transaction list + for (let index = 0; index < this._signedTransactions.length; index++) { + const signedTransaction = this._signedTransactions.get(index); + + if (signedTransaction.sigMap == null) { + signedTransaction.sigMap = {}; + } + + if (signedTransaction.sigMap.sigPair == null) { + signedTransaction.sigMap.sigPair = []; + } + + signedTransaction.sigMap.sigPair.push( + publicKey._toProtobufSignature(signatureArray[index]), + ); + } + + this._signerPublicKeys.add(publicKeyHex); + this._publicKeys.push(publicKey); + this._transactionSigners.push(null); + + return this; + } + + /** + * This method removes all signatures from the transaction based on the public key provided. + * + * @param {PublicKey} publicKey - The public key associated with the signature to remove. + * @returns {Uint8Array[]} The removed signatures. + */ + removeSignature(publicKey) { + if (!this.isFrozen()) { + this.freeze(); + } + + const publicKeyData = publicKey.toBytesRaw(); + const publicKeyHex = hex_browser_encode(publicKeyData); + + if (!this._signerPublicKeys.has(publicKeyHex)) { + throw new Error("The public key has not signed this transaction"); + } + + /** @type {Uint8Array[]} */ + const removedSignatures = []; + + // Iterate over the signed transactions and remove matching signatures + for (const transaction of this._signedTransactions.list) { + const removedSignaturesFromTransaction = + this._removeSignaturesFromTransaction( + transaction, + publicKeyHex, + ); + + removedSignatures.push(...removedSignaturesFromTransaction); + } + + // Remove the public key from internal tracking if no signatures remain + this._signerPublicKeys.delete(publicKeyHex); + this._publicKeys = this._publicKeys.filter( + (key) => !key.equals(publicKey), + ); + + // Update transaction signers array + this._transactionSigners.pop(); + + return removedSignatures; + } + + /** + * This method clears all signatures from the transaction and returns them in a specific format. + * + * It will call collectSignatures to get the removed signatures, then clear all signatures + * from the internal tracking. + * + * @returns { Map } The removed signatures in the specified format. + */ + removeAllSignatures() { + if (!this.isFrozen()) { + this.freeze(); + } + + const removedSignatures = this._collectSignaturesByPublicKey(); + + // Iterate over the signed transactions and clear all signatures + for (const transaction of this._signedTransactions.list) { + if (transaction.sigMap && transaction.sigMap.sigPair) { + // Clear all signature pairs from the transaction's signature map + transaction.sigMap.sigPair = []; + } + } + + // Clear the internal tracking of signer public keys and other relevant arrays + this._signerPublicKeys.clear(); + this._publicKeys = []; + this._transactionSigners = []; + + return removedSignatures; + } + + /** + * Get the current signatures on the request + * + * **NOTE**: Does NOT support sign on demand + * + * @returns {SignatureMap} + */ + getSignatures() { + // If a user is attempting to get signatures for a transaction, then the + // transaction must be frozen. + this._requireFrozen(); + + // Sign on demand must be disabled because this is the non-async version and + // signing requires awaiting callbacks. + this._requireNotSignOnDemand(); + + // Build all the transactions + this._buildAllTransactions(); + + // Lock transaction IDs, and node account IDs + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + + // Construct a signature map from this transaction + return SignatureMap._fromTransaction(this); + } + + /** + * Get the current signatures on the request + * + * **NOTE**: Supports sign on demand + * + * @returns {Promise} + */ + async getSignaturesAsync() { + // If sign on demand is enabled, we don't need to care about being frozen + // since we can just regenerate and resign later if some field of the transaction + // changes. + + // Locking the transaction IDs and node account IDs is necessary for consistency + // between before and after execution + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + + // Build all transactions, and sign them + await this._buildAllTransactionsAsync(); + + // Lock transaction IDs, and node account IDs + this._transactions.setLocked(); + this._signedTransactions.setLocked(); + + // Construct a signature map from this transaction + return SignatureMap._fromTransaction(this); + } + + /** + * Not sure why this is called `setTransactionId()` when it doesn't set anything... + * FIXME: Remove this? + */ + _setTransactionId() { + if (this._operatorAccountId == null && this._transactionIds.isEmpty) { + throw new Error( + "`transactionId` must be set or `client` must be provided with `freezeWith`", + ); + } + } + + /** + * Set the node account IDs using the client + * + * @param {?import("../client/Client.js").default} client + */ + _setNodeAccountIds(client) { + if (!this._nodeAccountIds.isEmpty) { + return; + } + + if (client == null) { + throw new Error( + "`nodeAccountId` must be set or `client` must be provided with `freezeWith`", + ); + } + + this._nodeAccountIds.setList( + client._network.getNodeAccountIdsForExecute(), + ); + } + + /** + * Build all the signed transactions from the node account IDs + * + * @private + */ + _buildSignedTransactions() { + if (this._signedTransactions.locked) { + return; + } + + this._signedTransactions.setList( + this._nodeAccountIds.list.map((nodeId) => + this._makeSignedTransaction(nodeId), + ), + ); + } + + /** + * Build all the signed transactions from the node account IDs + * + * @internal + */ + _buildIncompleteTransactions() { + if (this._nodeAccountIds.length == 0) { + this._transactions.setList([this._makeSignedTransaction(null)]); + } else { + // In case the node account ids are set + this._transactions.setList( + this._nodeAccountIds.list.map((nodeId) => + this._makeSignedTransaction(nodeId), + ), + ); + } + } + + /** + * Freeze this transaction from future modification to prepare for + * signing or serialization. + * + * @returns {this} + */ + freeze() { + return this.freezeWith(null); + } + + /** + * @param {?AccountId} accountId + */ + _freezeWithAccountId(accountId) { + if (this._operatorAccountId == null) { + this._operatorAccountId = accountId; + } + } + + /** + * Freeze this transaction from further modification to prepare for + * signing or serialization. + * + * Will use the `Client`, if available, to generate a default Transaction ID and select 1/3 + * nodes to prepare this transaction for. + * + * @param {?import("../client/Client.js").default} client + * @returns {this} + */ + freezeWith(client) { + // Set sign on demand based on client + this._signOnDemand = client != null ? client.signOnDemand : false; + + // Save the operator + this._operator = client != null ? client._operator : null; + this._freezeWithAccountId( + client != null ? client.operatorAccountId : null, + ); + + // Set max transaction fee to either `this._maxTransactionFee`, + // `client._defaultMaxTransactionFee`, or `this._defaultMaxTransactionFee` + // in that priority order depending on if `this._maxTransactionFee` has + // been set or if `client._defaultMaxTransactionFee` has been set. + this._maxTransactionFee = + this._maxTransactionFee == null + ? client != null && client.defaultMaxTransactionFee != null + ? client.defaultMaxTransactionFee + : this._defaultMaxTransactionFee + : this._maxTransactionFee; + + // Determine if transaction ID generation should be enabled. + this._regenerateTransactionId = + client != null && this._regenerateTransactionId == null + ? client.defaultRegenerateTransactionId + : this._regenerateTransactionId; + + // Set the node account IDs via client + this._setNodeAccountIds(client); + + // Make sure a transaction ID or operator is set. + this._setTransactionId(); + + // If a client was not provided, we need to make sure the transaction ID already set + // validates aginst the client. + if (client != null) { + for (const transactionId of this._transactionIds.list) { + if (transactionId.accountId != null) { + transactionId.accountId.validateChecksum(client); + } + } + } + + // Build a list of transaction IDs so that if a user calls `.transactionId` they'll + // get a value, but if they dont' we'll just regenerate transaction IDs during execution + this._buildNewTransactionIdList(); + + // If sign on demand is disabled we need to build out all the signed transactions + if (!this._signOnDemand) { + this._buildSignedTransactions(); + } + + return this; + } + + /** + * Sign the transaction using a signer + * + * This is part of the signature provider feature + * + * @param {Signer} signer + * @returns {Promise} + */ + async signWithSigner(signer) { + await signer.signTransaction(this); + return this; + } + + /** + * Freeze the transaction using a signer + * + * This is part of the signature provider feature. + * + * @param {Signer} signer + * @returns {Promise} + */ + async freezeWithSigner(signer) { + await signer.populateTransaction(this); + this.freeze(); + return this; + } + + /** + * Serialize the request into bytes. This will encode all the transactions + * into a `proto.TransactionList` and return the encoded protobuf. + * + * **NOTE**: Does not support sign on demand + * + * @returns {Uint8Array} + */ + toBytes() { + // Sign on demand must be disabled because this is the non-async version and + // signing requires awaiting callbacks. + this._requireNotSignOnDemand(); + + if (this._isFrozen()) { + // Locking the transaction IDs and node account IDs is necessary for consistency + // between before and after execution + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + + // Build all the transactions without signing + this._buildAllTransactions(); + } else { + this._buildIncompleteTransactions(); + } + + // Construct and encode the transaction list + return lib.proto.TransactionList.encode({ + transactionList: + /** @type {HashgraphProto.proto.ITransaction[]} */ ( + this._transactions.list + ), + }).finish(); + } + + /** + * Serialize the transaction into bytes + * + * **NOTE**: Supports sign on demand + * + * @returns {Promise} + */ + async toBytesAsync() { + // If sign on demand is enabled, we don't need to care about being frozen + // since we can just regenerate and resign later if some field of the transaction + // changes. + + // Locking the transaction IDs and node account IDs is necessary for consistency + // between before and after execution + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + + // Build all transactions, and sign them + await this._buildAllTransactionsAsync(); + + // Lock transaction IDs, and node account IDs + this._transactions.setLocked(); + this._signedTransactions.setLocked(); + + // Construct and encode the transaction list + return lib.proto.TransactionList.encode({ + transactionList: + /** @type {HashgraphProto.proto.ITransaction[]} */ ( + this._transactions.list + ), + }).finish(); + } + + /** + * Get the transaction hash + * + * @returns {Promise} + */ + async getTransactionHash() { + this._requireFrozen(); + + // Locking the transaction IDs and node account IDs is necessary for consistency + // between before and after execution + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + + await this._buildAllTransactionsAsync(); + + this._transactions.setLocked(); + this._signedTransactions.setLocked(); + + return sha384_browser_digest( + /** @type {Uint8Array} */ ( + /** @type {HashgraphProto.proto.ITransaction} */ ( + this._transactions.get(0) + ).signedTransactionBytes + ), + ); + } + + /** + * Get all the transaction hashes + * + * @returns {Promise} + */ + async getTransactionHashPerNode() { + this._requireFrozen(); + + // Locking the transaction IDs and node account IDs is necessary for consistency + // between before and after execution + this._transactionIds.setLocked(); + this._nodeAccountIds.setLocked(); + + await this._buildAllTransactionsAsync(); + + return await TransactionHashMap._fromTransaction(this); + } + + /** + * Is transaction frozen + * + * @returns {boolean} + */ + isFrozen() { + return this._signedTransactions.length > 0; + } + + /** + * Get the current transaction ID, and make sure it's not null + * + * @protected + * @returns {TransactionId} + */ + _getTransactionId() { + const transactionId = this.transactionId; + if (transactionId == null) { + throw new Error( + "transaction must have been frozen before getting the transaction ID, try calling `freeze`", + ); + } + return transactionId; + } + + /** + * @param {Client} client + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function + _validateChecksums(client) { + // Do nothing + } + + /** + * Before we proceed execution, we need to do a couple checks + * + * @override + * @protected + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async _beforeExecute(client) { + if (this._logger) { + this._logger.info( + `Network used: ${client._network.networkName}`, // eslint-disable-line @typescript-eslint/restrict-template-expressions + ); + } + + // Make sure we're frozen + if (!this._isFrozen()) { + this.freezeWith(client); + } + + // Valid checksums if the option is enabled + if (client.isAutoValidateChecksumsEnabled()) { + this._validateChecksums(client); + } + + // Set the operator if the client has one and the current operator is nullish + if (this._operator == null || this._operator == undefined) { + this._operator = client != null ? client._operator : null; + } + + if ( + this._operatorAccountId == null || + this._operatorAccountId == undefined + ) { + this._operatorAccountId = + client != null && client._operator != null + ? client._operator.accountId + : null; + } + + // If the client has an operator, sign this request with the operator + if (this._operator != null) { + await this.signWith( + this._operator.publicKey, + this._operator.transactionSigner, + ); + } + } + + /** + * Construct a protobuf transaction + * + * @override + * @internal + * @returns {Promise} + */ + async _makeRequestAsync() { + // The index for the transaction + const index = + this._transactionIds.index * this._nodeAccountIds.length + + this._nodeAccountIds.index; + + // If sign on demand is disabled we need to simply build that transaction + // and return the result, without signing + if (!this._signOnDemand) { + this._buildTransaction(index); + return /** @type {HashgraphProto.proto.ITransaction} */ ( + this._transactions.get(index) + ); + } + + // Build and sign a transaction + return await this._buildTransactionAsync(); + } + + /** + * Sign a `proto.SignedTransaction` with all the keys + * + * @private + * @returns {Promise} + */ + async _signTransaction() { + const signedTransaction = this._makeSignedTransaction( + this._nodeAccountIds.next, + ); + + const bodyBytes = /** @type {Uint8Array} */ ( + signedTransaction.bodyBytes + ); + + for (let j = 0; j < this._publicKeys.length; j++) { + const publicKey = this._publicKeys[j]; + const transactionSigner = this._transactionSigners[j]; + + if (transactionSigner == null) { + continue; + } + + const signature = await transactionSigner(bodyBytes); + + if (signedTransaction.sigMap == null) { + signedTransaction.sigMap = {}; + } + + if (signedTransaction.sigMap.sigPair == null) { + signedTransaction.sigMap.sigPair = []; + } + + signedTransaction.sigMap.sigPair.push( + publicKey._toProtobufSignature(signature), + ); + } + + return signedTransaction; + } + + /** + * Construct a new transaction ID at the current index + * + * @private + */ + _buildNewTransactionIdList() { + if (this._transactionIds.locked || this._operatorAccountId == null) { + return; + } + + const transactionId = TransactionId_TransactionId.withValidStart( + this._operatorAccountId, + Timestamp_Timestamp.generate(), + ); + + this._transactionIds.set(this._transactionIds.index, transactionId); + } + + /** + * Build each signed transaction in a loop + * + * @internal + */ + _buildAllTransactions() { + for (let i = 0; i < this._signedTransactions.length; i++) { + this._buildTransaction(i); + } + } + + /** + * Build and and sign each transaction in a loop + * + * This method is primary used in the exist condition methods + * which are not `execute()`, e.g. `toBytesAsync()` and `getSignaturesAsync()` + * + * @private + */ + async _buildAllTransactionsAsync() { + if (!this._signOnDemand) { + this._buildAllTransactions(); + return; + } + + this._buildSignedTransactions(); + + if (this._transactions.locked) { + return; + } + + for (let i = 0; i < this._signedTransactions.length; i++) { + this._transactions.push(await this._buildTransactionAsync()); + } + } + + /** + * Build a transaction at a particular index + * + * @internal + * @param {number} index + */ + _buildTransaction(index) { + if (this._transactions.length < index) { + for (let i = this._transactions.length; i < index; i++) { + this._transactions.push(null); + } + } + + // In case when an incomplete transaction is created, serialized and + // deserialized,and then the transaction being frozen, the copy of the + // incomplete transaction must be updated in order to be prepared for execution + if (this._transactions.list[index] != null) { + this._transactions.set(index, { + signedTransactionBytes: + lib.proto.SignedTransaction.encode( + this._signedTransactions.get(index), + ).finish(), + }); + } + + this._transactions.setIfAbsent(index, () => { + return { + signedTransactionBytes: + lib.proto.SignedTransaction.encode( + this._signedTransactions.get(index), + ).finish(), + }; + }); + } + + /** + * Build a trransaction using the current index, where the current + * index is determined by `this._nodeAccountIds.index` and + * `this._transactionIds.index` + * + * @private + * @returns {Promise} + */ + async _buildTransactionAsync() { + return { + signedTransactionBytes: + lib.proto.SignedTransaction.encode( + await this._signTransaction(), + ).finish(), + }; + } + + /** + * Determine what execution state we're in. + * + * @override + * @internal + * @param {HashgraphProto.proto.ITransaction} request + * @param {HashgraphProto.proto.ITransactionResponse} response + * @returns {[Status, ExecutionState]} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _shouldRetry(request, response) { + const { nodeTransactionPrecheckCode } = response; + + // Get the node precheck code, and convert it into an SDK `Status` + const status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : lib.proto.ResponseCodeEnum.OK, + ); + + if (this._logger) { + this._logger.debug( + `[${this._getLogId()}] received status ${status.toString()}`, + ); + this._logger.info( + `SDK Transaction Status Response: ${status.toString()}`, + ); + } + + // Based on the status what execution state are we in + switch (status) { + case Status.Busy: + case Status.Unknown: + case Status.PlatformTransactionNotCreated: + case Status.PlatformNotActive: + return [status, ExecutionState.Retry]; + case Status.Ok: + return [status, ExecutionState.Finished]; + case Status.TransactionExpired: + if ( + this._transactionIds.locked || + (this._regenerateTransactionId != null && + !this._regenerateTransactionId) + ) { + return [status, ExecutionState.Error]; + } else { + this._buildNewTransactionIdList(); + return [status, ExecutionState.Retry]; + } + default: + return [status, ExecutionState.Error]; + } + } + + /** + * Map the request and response into a precheck status error + * + * @override + * @internal + * @param {HashgraphProto.proto.ITransaction} request + * @param {HashgraphProto.proto.ITransactionResponse} response + * @param {AccountId} nodeId + * @returns {Error} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapStatusError(request, response, nodeId) { + const { nodeTransactionPrecheckCode } = response; + + const status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : lib.proto.ResponseCodeEnum.OK, + ); + if (this._logger) { + this._logger.info( + // @ts-ignore + `Transaction Error Info: ${status.toString()}, ${this.transactionId.toString()}`, // eslint-disable-line @typescript-eslint/restrict-template-expressions + ); + } + + return new PrecheckStatusError({ + nodeId, + status, + transactionId: this._getTransactionId(), + contractFunctionResult: null, + }); + } + + /** + * Map the request, response, and node account ID into a `TransactionResponse` + * + * @override + * @protected + * @param {HashgraphProto.proto.ITransactionResponse} response + * @param {AccountId} nodeId + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + async _mapResponse(response, nodeId, request) { + const transactionHash = await sha384_browser_digest( + /** @type {Uint8Array} */ (request.signedTransactionBytes), + ); + const transactionId = this._getTransactionId(); + + this._transactionIds.advance(); + if (this._logger) { + this._logger.info( + `Transaction Info: ${JSON.stringify( + new TransactionResponse({ + nodeId, + transactionHash, + transactionId, + }).toJSON(), + )}`, + ); + } + + return new TransactionResponse({ + nodeId, + transactionHash, + transactionId, + }); + } + + /** + * Make a signed transaction given a node account ID + * + * @internal + * @param {?AccountId} nodeId + * @returns {HashgraphProto.proto.ISignedTransaction} + */ + _makeSignedTransaction(nodeId) { + const body = this._makeTransactionBody(nodeId); + if (this._logger) { + this._logger.info(`Transaction Body: ${JSON.stringify(body)}`); + } + const bodyBytes = + lib.proto.TransactionBody.encode(body).finish(); + + return { + sigMap: { + sigPair: [], + }, + bodyBytes, + }; + } + + /** + * Make a protobuf transaction body + * + * @private + * @param {?AccountId} nodeId + * @returns {HashgraphProto.proto.ITransactionBody} + */ + _makeTransactionBody(nodeId) { + return { + [this._getTransactionDataCase()]: this._makeTransactionData(), + transactionFee: + this._maxTransactionFee != null + ? this._maxTransactionFee.toTinybars() + : null, + memo: this._transactionMemo, + transactionID: + this._transactionIds.current != null + ? this._transactionIds.current._toProtobuf() + : null, + nodeAccountID: nodeId != null ? nodeId._toProtobuf() : null, + transactionValidDuration: { + seconds: src_long.fromNumber(this._transactionValidDuration), + }, + }; + } + + /** + * This method returns a key for the `data` field in a transaction body. + * Each transaction overwrite this to make sure when we build the transaction body + * we set the right data field. + * + * @abstract + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + throw new Error("not implemented"); + } + + /** + * Make a scheduled transaction body + * FIXME: Should really call this `makeScheduledTransactionBody` to be consistent + * + * @internal + * @returns {HashgraphProto.proto.ISchedulableTransactionBody} + */ + _getScheduledTransactionBody() { + return { + memo: this.transactionMemo, + transactionFee: + this._maxTransactionFee == null + ? this._defaultMaxTransactionFee.toTinybars() + : this._maxTransactionFee.toTinybars(), + [this._getTransactionDataCase()]: this._makeTransactionData(), + }; + } + + /** + * Make the transaction body data. + * + * @abstract + * @protected + * @returns {object} + */ + _makeTransactionData() { + throw new Error("not implemented"); + } + + /** + * FIXME: Why do we have `isFrozen` and `_isFrozen()`? + * + * @protected + * @returns {boolean} + */ + _isFrozen() { + return this._signOnDemand || this._signedTransactions.length > 0; + } + + /** + * Require the transaction to NOT be frozen + * + * @internal + */ + _requireNotFrozen() { + if (this._isFrozen()) { + throw new Error( + "transaction is immutable; it has at least one signature or has been explicitly frozen", + ); + } + } + + /** + * Require the transaction to have sign on demand disabled + * + * @internal + */ + _requireNotSignOnDemand() { + if (this._signOnDemand) { + throw new Error( + "Please use `toBytesAsync()` if `signOnDemand` is enabled", + ); + } + } + + /** + * Require the transaction to be frozen + * + * @internal + */ + _requireFrozen() { + if (!this._isFrozen()) { + throw new Error( + "transaction must have been frozen before calculating the hash will be stable, try calling `freeze`", + ); + } + } + + /** + * Require the transaction to have a single node account ID set + * + * @internal + * @protected + */ + _requireOneNodeAccountId() { + if (this._nodeAccountIds.length != 1) { + throw "transaction did not have exactly one node ID set"; + } + } + + /** + * @param {HashgraphProto.proto.Transaction} request + * @returns {Uint8Array} + */ + _requestToBytes(request) { + return lib.proto.Transaction.encode(request).finish(); + } + + /** + * @param {HashgraphProto.proto.TransactionResponse} response + * @returns {Uint8Array} + */ + _responseToBytes(response) { + return lib.proto.TransactionResponse.encode( + response, + ).finish(); + } + + /** + * Removes all signatures from a transaction and collects the removed signatures. + * + * @param {HashgraphProto.proto.ISignedTransaction} transaction - The transaction object to process. + * @param {string} publicKeyHex - The hexadecimal representation of the public key. + * @returns {Uint8Array[]} An array of removed signatures. + */ + _removeSignaturesFromTransaction(transaction, publicKeyHex) { + /** @type {Uint8Array[]} */ + const removedSignatures = []; + + if (!transaction.sigMap || !transaction.sigMap.sigPair) { + return []; + } + + transaction.sigMap.sigPair = transaction.sigMap.sigPair.filter( + (sigPair) => { + const shouldRemove = this._shouldRemoveSignature( + sigPair, + publicKeyHex, + ); + const signature = sigPair.ed25519 ?? sigPair.ECDSASecp256k1; + + if (shouldRemove && signature) { + removedSignatures.push(signature); + } + + return !shouldRemove; + }, + ); + + return removedSignatures; + } + + /** + * Determines whether a signature should be removed based on the provided public key. + * + * @param {HashgraphProto.proto.ISignaturePair} sigPair - The signature pair object that contains + * the public key prefix and signature to be evaluated. + * @param {string} publicKeyHex - The hexadecimal representation of the public key to compare against. + * @returns {boolean} `true` if the public key prefix in the signature pair matches the provided public key, + * indicating that the signature should be removed; otherwise, `false`. + */ + _shouldRemoveSignature = (sigPair, publicKeyHex) => { + const sigPairPublicKeyHex = hex_browser_encode( + sigPair?.pubKeyPrefix || new Uint8Array(), + ); + + const matchesPublicKey = sigPairPublicKeyHex === publicKeyHex; + + return matchesPublicKey; + }; + + /** + * Collects all signatures from signed transactions and returns them in a format keyed by PublicKey. + * + * @returns { Map } The collected signatures keyed by PublicKey. + */ + _collectSignaturesByPublicKey() { + /** @type { Map} */ + const collectedSignatures = new Map(); + /** @type { Record } */ + const publicKeyMap = {}; // Map to hold string representation of the PublicKey object + + // Iterate over the signed transactions and collect signatures + for (const transaction of this._signedTransactions.list) { + if (!(transaction.sigMap && transaction.sigMap.sigPair)) { + return new Map(); + } + + // Collect the signatures + for (const sigPair of transaction.sigMap.sigPair) { + const signature = sigPair.ed25519 ?? sigPair.ECDSASecp256k1; + + if (!signature || !sigPair.pubKeyPrefix) { + return new Map(); + } + + const publicKeyStr = hex_browser_encode(sigPair.pubKeyPrefix); + let publicKeyObj = publicKeyMap[publicKeyStr]; + + // If the PublicKey instance for this string representation doesn't exist, create and store it + if (!publicKeyObj) { + publicKeyObj = src_PublicKey_PublicKey.fromString(publicKeyStr); + publicKeyMap[publicKeyStr] = publicKeyObj; + } + + // Initialize the structure for this publicKey if it doesn't exist + if (!collectedSignatures.has(publicKeyObj)) { + collectedSignatures.set(publicKeyObj, []); + } + + const existingSignatures = + collectedSignatures.get(publicKeyObj); + + // Add the signature to the corresponding public key + if (existingSignatures) { + existingSignatures.push(signature); + } + } + } + + return collectedSignatures; + } +} + +/** + * This is essentially a registry/cache for a callback that creates a `ScheduleCreateTransaction` + * + * @type {(() => ScheduleCreateTransaction)[]} + */ +const SCHEDULE_CREATE_TRANSACTION = []; + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenNftTransfer.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList + * @typedef {import("@hashgraph/proto").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount + * @typedef {import("@hashgraph/proto").proto.INftTransfer} HashgraphProto.proto.INftTransfer + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + */ + +/** + * An account, and the amount that it sends or receives during a cryptocurrency tokentransfer. + */ +class TokenNftTransfer { + /** + * @internal + * @param {object} props + * @param {TokenId | string} props.tokenId + * @param {AccountId | string} props.senderAccountId + * @param {AccountId | string} props.receiverAccountId + * @param {Long | number} props.serialNumber + * @param {boolean} props.isApproved + */ + constructor(props) { + /** + * The Token ID that sends or receives cryptocurrency. + */ + this.tokenId = + props.tokenId instanceof TokenId_TokenId + ? props.tokenId + : TokenId_TokenId.fromString(props.tokenId); + + /** + * The Account ID that sends or receives cryptocurrency. + */ + this.senderAccountId = + props.senderAccountId instanceof AccountId_AccountId + ? props.senderAccountId + : AccountId_AccountId.fromString(props.senderAccountId); + + /** + * The Account ID that sends or receives cryptocurrency. + */ + this.receiverAccountId = + props.receiverAccountId instanceof AccountId_AccountId + ? props.receiverAccountId + : AccountId_AccountId.fromString(props.receiverAccountId); + + this.serialNumber = src_long.fromValue(props.serialNumber); + this.isApproved = props.isApproved; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITokenTransferList[]} tokenTransfers + * @returns {TokenNftTransfer[]} + */ + static _fromProtobuf(tokenTransfers) { + const transfers = []; + + for (const tokenTransfer of tokenTransfers) { + const tokenId = TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + tokenTransfer.token + ), + ); + for (const transfer of tokenTransfer.nftTransfers != null + ? tokenTransfer.nftTransfers + : []) { + transfers.push( + new TokenNftTransfer({ + tokenId, + senderAccountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + transfer.senderAccountID + ), + ), + receiverAccountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + transfer.receiverAccountID + ), + ), + serialNumber: + transfer.serialNumber != null + ? transfer.serialNumber + : src_long.ZERO, + isApproved: transfer.isApproval == true, + }), + ); + } + } + + return transfers; + } + + /** + * @internal + * @returns {HashgraphProto.proto.INftTransfer} + */ + _toProtobuf() { + return { + senderAccountID: this.senderAccountId._toProtobuf(), + receiverAccountID: this.receiverAccountId._toProtobuf(), + serialNumber: this.serialNumber, + isApproval: this.isApproved, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/NullableTokenDecimalMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenBalance} HashgraphProto.proto.ITokenBalance + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ + +/** + * @augments {ObjectMap} + */ +class NullableTokenDecimalMap extends ObjectMap { + constructor() { + super((s) => TokenId_TokenId.fromString(s)); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/AbstractTokenTransferTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenAirdropTransactionBody} HashgraphProto.proto.ITokenAirdropTransactionBody + */ + +/** + * @typedef {object} TransferTokensInput + * @property {TokenId | string} tokenId + * @property {AccountId | string} accountId + * @property {Long | number} amount + */ + +/** + * @typedef {object} TransferNftInput + * @property {TokenId | string} tokenId + * @property {AccountId | string} sender + * @property {AccountId | string} recipient + * @property {Long | number} serial + */ + +class AbstractTokenTransferTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {(TransferTokensInput)[]} [props.tokenTransfers] + * @param {(TransferNftInput)[]} [props.nftTransfers] + */ + constructor(props = {}) { + super(); + + /** + * @protected + * @type {TokenTransfer[]} + */ + this._tokenTransfers = []; + + /** + * @protected + * @type {TokenNftTransfer[]} + */ + this._nftTransfers = []; + + for (const transfer of props.tokenTransfers != null + ? props.tokenTransfers + : []) { + this.addTokenTransfer( + transfer.tokenId, + transfer.accountId, + transfer.amount, + ); + } + + for (const transfer of props.nftTransfers != null + ? props.nftTransfers + : []) { + this.addNftTransfer( + transfer.tokenId, + transfer.serial, + transfer.sender, + transfer.recipient, + ); + } + } + + /** + * @param {NftId | TokenId | string} tokenIdOrNftId + * @param {AccountId | string | Long | number} senderAccountIdOrSerialNumber + * @param {AccountId | string} receiverAccountIdOrSenderAccountId + * @param {(AccountId | string)=} receiver + * @returns {this} + */ + addNftTransfer( + tokenIdOrNftId, + senderAccountIdOrSerialNumber, + receiverAccountIdOrSenderAccountId, + receiver, + ) { + return this._addNftTransfer( + false, + tokenIdOrNftId, + senderAccountIdOrSerialNumber, + receiverAccountIdOrSenderAccountId, + receiver, + ); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string} accountId + * @param {number | Long} amount + * @param {boolean} isApproved + * @param {number | null} expectedDecimals + * @returns {this} + */ + _addTokenTransfer( + tokenId, + accountId, + amount, + isApproved, + expectedDecimals, + ) { + this._requireNotFrozen(); + + const token = + tokenId instanceof TokenId_TokenId ? tokenId : TokenId_TokenId.fromString(tokenId); + const account = + accountId instanceof AccountId_AccountId + ? accountId + : AccountId_AccountId.fromString(accountId); + const value = amount instanceof src_long ? amount : src_long.fromNumber(amount); + + for (const tokenTransfer of this._tokenTransfers) { + if ( + tokenTransfer.tokenId.compare(token) === 0 && + tokenTransfer.accountId.compare(account) === 0 + ) { + tokenTransfer.amount = tokenTransfer.amount.add(value); + tokenTransfer.expectedDecimals = expectedDecimals; + return this; + } + } + + this._tokenTransfers.push( + new TokenTransfer({ + tokenId, + accountId, + expectedDecimals: expectedDecimals, + amount, + isApproved, + }), + ); + + return this; + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string} accountId + * @param {number | Long} amount + * @returns {this} + */ + addTokenTransfer(tokenId, accountId, amount) { + return this._addTokenTransfer(tokenId, accountId, amount, false, null); + } + + /** + * @param {boolean} isApproved + * @param {NftId | TokenId | string} tokenIdOrNftId + * @param {AccountId | string | Long | number} senderAccountIdOrSerialNumber + * @param {AccountId | string} receiverAccountIdOrSenderAccountId + * @param {(AccountId | string)=} receiver + * @returns {this} + */ + _addNftTransfer( + isApproved, + tokenIdOrNftId, + senderAccountIdOrSerialNumber, + receiverAccountIdOrSenderAccountId, + receiver, + ) { + this._requireNotFrozen(); + + let nftId; + let senderAccountId; + let receiverAccountId; + + if (tokenIdOrNftId instanceof NftId_NftId) { + nftId = tokenIdOrNftId; + senderAccountId = + typeof senderAccountIdOrSerialNumber === "string" + ? AccountId_AccountId.fromString(senderAccountIdOrSerialNumber) + : /** @type {AccountId} */ (senderAccountIdOrSerialNumber); + receiverAccountId = + typeof receiverAccountIdOrSenderAccountId === "string" + ? AccountId_AccountId.fromString(receiverAccountIdOrSenderAccountId) + : /** @type {AccountId} */ ( + receiverAccountIdOrSenderAccountId + ); + } else if (tokenIdOrNftId instanceof TokenId_TokenId) { + nftId = new NftId_NftId( + tokenIdOrNftId, + /** @type {Long} */ (senderAccountIdOrSerialNumber), + ); + senderAccountId = + typeof receiverAccountIdOrSenderAccountId === "string" + ? AccountId_AccountId.fromString(receiverAccountIdOrSenderAccountId) + : /** @type {AccountId} */ ( + receiverAccountIdOrSenderAccountId + ); + receiverAccountId = + typeof receiver === "string" + ? AccountId_AccountId.fromString(receiver) + : /** @type {AccountId} */ (receiver); + } else { + try { + nftId = NftId_NftId.fromString(tokenIdOrNftId); + senderAccountId = + typeof senderAccountIdOrSerialNumber === "string" + ? AccountId_AccountId.fromString(senderAccountIdOrSerialNumber) + : /** @type {AccountId} */ ( + senderAccountIdOrSerialNumber + ); + receiverAccountId = + typeof receiverAccountIdOrSenderAccountId === "string" + ? AccountId_AccountId.fromString( + receiverAccountIdOrSenderAccountId, + ) + : /** @type {AccountId} */ ( + receiverAccountIdOrSenderAccountId + ); + } catch (_) { + const tokenId = TokenId_TokenId.fromString(tokenIdOrNftId); + nftId = new NftId_NftId( + tokenId, + /** @type {Long} */ (senderAccountIdOrSerialNumber), + ); + senderAccountId = + typeof receiverAccountIdOrSenderAccountId === "string" + ? AccountId_AccountId.fromString( + receiverAccountIdOrSenderAccountId, + ) + : /** @type {AccountId} */ ( + receiverAccountIdOrSenderAccountId + ); + receiverAccountId = + typeof receiver === "string" + ? AccountId_AccountId.fromString(receiver) + : /** @type {AccountId} */ (receiver); + } + } + + for (const nftTransfer of this._nftTransfers) { + if ( + nftTransfer.tokenId.compare(nftId.tokenId) === 0 && + nftTransfer.serialNumber.compare(nftId.serial) === 0 + ) { + nftTransfer.senderAccountId = senderAccountId; + nftTransfer.receiverAccountId = receiverAccountId; + return this; + } + } + + this._nftTransfers.push( + new TokenNftTransfer({ + tokenId: nftId.tokenId, + serialNumber: nftId.serial, + senderAccountId, + receiverAccountId, + isApproved, + }), + ); + + return this; + } + + /** + * @param {NftId | TokenId | string} tokenIdOrNftId + * @param {AccountId | string | Long | number} senderAccountIdOrSerialNumber + * @param {AccountId | string} receiverAccountIdOrSenderAccountId + * @param {(AccountId | string)=} receiver + * @returns {this} + */ + addApprovedNftTransfer( + tokenIdOrNftId, + senderAccountIdOrSerialNumber, + receiverAccountIdOrSenderAccountId, + receiver, + ) { + return this._addNftTransfer( + true, + tokenIdOrNftId, + senderAccountIdOrSerialNumber, + receiverAccountIdOrSenderAccountId, + receiver, + ); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string} accountId + * @param {number | Long} amount + * @returns {this} + */ + addApprovedTokenTransfer(tokenId, accountId, amount) { + return this._addTokenTransfer(tokenId, accountId, amount, true, null); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string} accountId + * @param {number | Long} amount + * @param {number} decimals + * @returns {this} + */ + addTokenTransferWithDecimals(tokenId, accountId, amount, decimals) { + this._requireNotFrozen(); + + const token = + tokenId instanceof TokenId_TokenId ? tokenId : TokenId_TokenId.fromString(tokenId); + const account = + accountId instanceof AccountId_AccountId + ? accountId + : AccountId_AccountId.fromString(accountId); + const value = amount instanceof src_long ? amount : src_long.fromNumber(amount); + + let found = false; + + for (const tokenTransfer of this._tokenTransfers) { + if (tokenTransfer.tokenId.compare(token) === 0) { + if ( + tokenTransfer.expectedDecimals != null && + tokenTransfer.expectedDecimals !== decimals + ) { + throw new Error("expected decimals mis-match"); + } else { + tokenTransfer.expectedDecimals = decimals; + } + + if (tokenTransfer.accountId.compare(account) === 0) { + tokenTransfer.amount = tokenTransfer.amount.add(value); + tokenTransfer.expectedDecimals = decimals; + found = true; + } + } + } + + if (found) { + return this; + } + + this._tokenTransfers.push( + new TokenTransfer({ + tokenId, + accountId, + expectedDecimals: decimals, + amount, + isApproved: false, + }), + ); + + return this; + } + + /** + * @returns {NullableTokenDecimalMap} + */ + get tokenIdDecimals() { + const map = new NullableTokenDecimalMap(); + + for (const transfer of this._tokenTransfers) { + map._set(transfer.tokenId, transfer.expectedDecimals); + } + + return map; + } + + /** + * @returns {TokenNftTransferMap} + */ + get nftTransfers() { + const map = new TokenNftTransferMap(); + + for (const transfer of this._nftTransfers) { + const transferList = map.get(transfer.tokenId); + + const nftTransfer = { + sender: transfer.senderAccountId, + recipient: transfer.receiverAccountId, + serial: transfer.serialNumber, + isApproved: transfer.isApproved, + }; + + if (transferList != null) { + transferList.push(nftTransfer); + } else { + map._set(transfer.tokenId, [nftTransfer]); + } + } + + return map; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenAirdropTransactionBody} + */ + _makeTransactionData() { + /** @type {{tokenId: TokenId; expectedDecimals: number | null; transfers: TokenTransfer[]; nftTransfers: TokenNftTransfer[];}[]} */ + const tokenTransferList = []; + + this._tokenTransfers.sort((a, b) => { + const compare = a.tokenId.compare(b.tokenId); + + if (compare !== 0) { + return compare; + } + + return a.accountId.compare(b.accountId); + }); + + this._nftTransfers.sort((a, b) => { + const senderComparision = a.senderAccountId.compare( + b.senderAccountId, + ); + if (senderComparision != 0) { + return senderComparision; + } + + const recipientComparision = a.receiverAccountId.compare( + b.receiverAccountId, + ); + if (recipientComparision != 0) { + return recipientComparision; + } + + return a.serialNumber.compare(b.serialNumber); + }); + + let i = 0; + let j = 0; + while ( + i < this._tokenTransfers.length || + j < this._nftTransfers.length + ) { + if ( + i < this._tokenTransfers.length && + j < this._nftTransfers.length + ) { + const iTokenId = this._tokenTransfers[i].tokenId; + const jTokenId = this._nftTransfers[j].tokenId; + + const last = + tokenTransferList.length > 0 + ? tokenTransferList[tokenTransferList.length - 1] + : null; + const lastTokenId = last != null ? last.tokenId : null; + + if ( + last != null && + lastTokenId != null && + lastTokenId.compare(iTokenId) === 0 + ) { + last.transfers.push(this._tokenTransfers[i++]); + continue; + } + + if ( + last != null && + lastTokenId != null && + lastTokenId.compare(jTokenId) === 0 + ) { + last.nftTransfers.push(this._nftTransfers[j++]); + continue; + } + + const result = iTokenId.compare(jTokenId); + + if (result === 0) { + tokenTransferList.push({ + tokenId: iTokenId, + expectedDecimals: + this._tokenTransfers[i].expectedDecimals, + transfers: [this._tokenTransfers[i++]], + nftTransfers: [this._nftTransfers[j++]], + }); + } else if (result < 0) { + tokenTransferList.push({ + tokenId: iTokenId, + expectedDecimals: + this._tokenTransfers[i].expectedDecimals, + transfers: [this._tokenTransfers[i++]], + nftTransfers: [], + }); + } else { + tokenTransferList.push({ + tokenId: jTokenId, + expectedDecimals: null, + transfers: [], + nftTransfers: [this._nftTransfers[j++]], + }); + } + } else if (i < this._tokenTransfers.length) { + const iTokenId = this._tokenTransfers[i].tokenId; + + let last; + for (const transfer of tokenTransferList) { + if (transfer.tokenId.compare(iTokenId) === 0) { + last = transfer; + } + } + const lastTokenId = last != null ? last.tokenId : null; + + if ( + last != null && + lastTokenId != null && + lastTokenId.compare(iTokenId) === 0 + ) { + last.transfers.push(this._tokenTransfers[i++]); + continue; + } + + tokenTransferList.push({ + tokenId: iTokenId, + expectedDecimals: this._tokenTransfers[i].expectedDecimals, + transfers: [this._tokenTransfers[i++]], + nftTransfers: [], + }); + } else if (j < this._nftTransfers.length) { + const jTokenId = this._nftTransfers[j].tokenId; + + let last; + for (const transfer of tokenTransferList) { + if (transfer.tokenId.compare(jTokenId) === 0) { + last = transfer; + } + } + const lastTokenId = last != null ? last.tokenId : null; + + if ( + last != null && + lastTokenId != null && + lastTokenId.compare(jTokenId) === 0 + ) { + last.nftTransfers.push(this._nftTransfers[j++]); + continue; + } + + tokenTransferList.push({ + tokenId: jTokenId, + expectedDecimals: null, + transfers: [], + nftTransfers: [this._nftTransfers[j++]], + }); + } + } + + return { + tokenTransfers: tokenTransferList.map((tokenTransfer) => { + return { + token: tokenTransfer.tokenId._toProtobuf(), + expectedDecimals: + tokenTransfer.expectedDecimals != null + ? { value: tokenTransfer.expectedDecimals } + : null, + transfers: tokenTransfer.transfers.map((transfer) => + transfer._toProtobuf(), + ), + nftTransfers: tokenTransfer.nftTransfers.map((transfer) => + transfer._toProtobuf(), + ), + }; + }), + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenAirdropTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenAirdropTransactionBody} HashgraphProto.proto.ITokenAirdropTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.TransactionID} HashgraphProto.proto.TransactionID + * @typedef {import("@hashgraph/proto").proto.AccountID} HashgraphProto.proto.AccountID + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("./NftId.js").default} NftId + * @typedef {import("./TokenId.js").default} TokenId + */ +class TokenAirdropTransaction extends AbstractTokenTransferTransaction { + /** + * @param {object} props + * @param {TokenTransfer[]} [props.tokenTransfers] + * @param {NftTransfer[]} [props.nftTransfers] + */ + constructor(props = {}) { + super(); + + if (props.tokenTransfers != null) { + for (const tokenTransfer of props.tokenTransfers) { + this._addTokenTransfer( + tokenTransfer.tokenId, + tokenTransfer.accountId, + tokenTransfer.amount, + tokenTransfer.isApproved, + tokenTransfer.expectedDecimals, + ); + } + } + /** + * @private + * @type {NftTransfer[]} + */ + this._nftTransfers = []; + if (props.nftTransfers != null) { + for (const nftTransfer of props.nftTransfers) { + this._addNftTransfer( + nftTransfer.isApproved, + nftTransfer.tokenId, + nftTransfer.serialNumber, + nftTransfer.senderAccountId, + nftTransfer.receiverAccountId, + ); + } + } + } + + /** + * + * @param {TokenId} tokenId + * @param {AccountId} accountId + * @param {Long} amount + * @param {number} expectedDecimals + * @returns {this} + */ + addApprovedTokenTransferWithDecimals( + tokenId, + accountId, + amount, + expectedDecimals, + ) { + this._requireNotFrozen(); + this._addTokenTransfer( + tokenId, + accountId, + amount, + true, + expectedDecimals, + ); + return this; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenAirdropTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const tokenAirdrop = + /** @type {HashgraphProto.proto.ITokenAirdropTransactionBody} */ ( + body.tokenAirdrop + ); + + const tokenTransfers = TokenTransfer._fromProtobuf( + tokenAirdrop.tokenTransfers ?? [], + ); + const nftTransfers = TokenNftTransfer._fromProtobuf( + tokenAirdrop.tokenTransfers ?? [], + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenAirdropTransaction({ + nftTransfers: nftTransfers, + tokenTransfers: tokenTransfers, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.airdropTokens(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenAirdrop"; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenAirdropTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenAirdrop", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenAirdropTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/AirdropPendingTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @typedef {import("../token/PendingAirdropId.js").default} PendingAirdropId + */ +class AirdropPendingTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {PendingAirdropId[]} [props.pendingAirdropIds] + */ + constructor(props) { + /** + * @private + * @type {PendingAirdropId[]} + */ + super(); + + /** + * @private + * @type {PendingAirdropId[]} + */ + this._pendingAirdropIds = []; + + if (props?.pendingAirdropIds != null) { + this._pendingAirdropIds = props.pendingAirdropIds; + } + } + + /** + * @returns {PendingAirdropId[]} + */ + get pendingAirdropIds() { + return this._pendingAirdropIds; + } + + /** + * + * @param {PendingAirdropId} pendingAirdropId + * @returns {this} + */ + addPendingAirdropId(pendingAirdropId) { + this._requireNotFrozen(); + this._pendingAirdropIds.push(pendingAirdropId); + return this; + } + + /** + * + * @param {PendingAirdropId[]} pendingAirdropIds + * @returns {this} + */ + setPendingAirdropIds(pendingAirdropIds) { + this._requireNotFrozen(); + this._pendingAirdropIds = pendingAirdropIds; + return this; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenClaimAirdropTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenClaimAirdropTransactionBody} HashgraphProto.proto.ITokenClaimAirdropTransactionBody + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + */ + +class TokenClaimAirdropTransaction extends AirdropPendingTransaction { + /** + * @param {object} props + * @param {PendingAirdropId[]} [props.pendingAirdropIds] + */ + constructor(props = {}) { + super(props); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.claimAirdrop(request); + } + + /** + * @override + * @internal + * @returns {HashgraphProto.proto.ITokenClaimAirdropTransactionBody} + */ + _makeTransactionData() { + return { + pendingAirdrops: this.pendingAirdropIds.map((pendingAirdropId) => + pendingAirdropId.toBytes(), + ), + }; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenClaimAirdropTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const { pendingAirdrops } = + /** @type {HashgraphProto.proto.ITokenClaimAirdropTransactionBody} */ ( + body.tokenClaimAirdrop + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenClaimAirdropTransaction({ + pendingAirdropIds: pendingAirdrops?.map((pendingAirdrop) => { + return PendingAirdropId.fromBytes(pendingAirdrop); + }), + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenClaimAirdrop"; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenClaimAirdropTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenClaimAirdrop", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenClaimAirdropTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenCancelAirdropTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenCancelAirdropTransactionBody} HashgraphProto.proto.ITokenCancelAirdropTransactionBody + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + */ +class TokenCancelAirdropTransaction extends AirdropPendingTransaction { + /** + * @param {object} props + * @param {PendingAirdropId[]} [props.pendingAirdropIds] + */ + constructor(props = {}) { + super(props); + } + + /** + * @override + * @internal + * @returns {HashgraphProto.proto.ITokenCancelAirdropTransactionBody} + */ + _makeTransactionData() { + return { + pendingAirdrops: this.pendingAirdropIds.map((pendingAirdropId) => + pendingAirdropId.toBytes(), + ), + }; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.cancelAirdrop(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenCancelAirdrop"; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenCancelAirdropTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const { pendingAirdrops } = + /** @type {HashgraphProto.proto.ITokenCancelAirdropTransactionBody} */ ( + body.tokenCancelAirdrop + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenCancelAirdropTransaction({ + pendingAirdropIds: pendingAirdrops?.map((pendingAirdrop) => { + return PendingAirdropId.fromBytes(pendingAirdrop); + }), + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenCancelAirdrop:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenCancelAirdrop", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenCancelAirdropTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/HbarAllowance.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IGrantedCryptoAllowance} HashgraphProto.proto.IGrantedCryptoAllowance + * @typedef {import("@hashgraph/proto").proto.ICryptoAllowance} HashgraphProto.proto.ICryptoAllowance + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("long")} Long + */ + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +class HbarAllowance_HbarAllowance { + /** + * @internal + * @param {object} props + * @param {AccountId | null} props.spenderAccountId + * @param {AccountId | null} props.ownerAccountId + * @param {Hbar | null} props.amount + */ + constructor(props) { + /** + * The account ID of the hbar allowance spender. + * + * @readonly + */ + this.spenderAccountId = props.spenderAccountId; + + /** + * The account ID of the hbar allowance owner. + * + * @readonly + */ + this.ownerAccountId = props.ownerAccountId; + + /** + * The current balance of the spender's allowance in tinybars. + * + * @readonly + */ + this.amount = props.amount; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.ICryptoAllowance} allowance + * @returns {HbarAllowance} + */ + static _fromProtobuf(allowance) { + return new HbarAllowance_HbarAllowance({ + spenderAccountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + allowance.spender + ), + ), + ownerAccountId: + allowance.owner != null + ? AccountId_AccountId._fromProtobuf( + /**@type {HashgraphProto.proto.IAccountID}*/ ( + allowance.owner + ), + ) + : null, + amount: Hbar_Hbar.fromTinybars( + allowance.amount != null ? allowance.amount : 0, + ), + }); + } + + /** + * @internal + * @param {HashgraphProto.proto.IGrantedCryptoAllowance} allowance + * @param {AccountId} ownerAccountId + * @returns {HbarAllowance} + */ + static _fromGrantedProtobuf(allowance, ownerAccountId) { + return new HbarAllowance_HbarAllowance({ + spenderAccountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + allowance.spender + ), + ), + ownerAccountId, + amount: Hbar_Hbar.fromTinybars( + allowance.amount != null ? allowance.amount : 0, + ), + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ICryptoAllowance} + */ + _toProtobuf() { + return { + owner: + this.ownerAccountId != null + ? this.ownerAccountId._toProtobuf() + : null, + spender: + this.spenderAccountId != null + ? this.spenderAccountId._toProtobuf() + : null, + amount: this.amount != null ? this.amount.toTinybars() : null, + }; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this.spenderAccountId != null) { + this.spenderAccountId.validateChecksum(client); + } + + if (this.spenderAccountId != null) { + this.spenderAccountId.validateChecksum(client); + } + } + + /** + * @returns {object} + */ + toJSON() { + return { + ownerAccountId: + this.ownerAccountId != null + ? this.ownerAccountId.toString() + : null, + spenderAccountId: + this.spenderAccountId != null + ? this.spenderAccountId.toString() + : null, + amount: this.amount != null ? this.amount.toString() : null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenAllowance.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IGrantedTokenAllowance} HashgraphProto.proto.IGrantedTokenAllowance + * @typedef {import("@hashgraph/proto").proto.ITokenAllowance} HashgraphProto.proto.ITokenAllowance + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +class TokenAllowance_TokenAllowance { + /** + * @internal + * @param {object} props + * @param {TokenId} props.tokenId + * @param {AccountId | null} props.spenderAccountId + * @param {AccountId | null} props.ownerAccountId + * @param {Long | null} props.amount + */ + constructor(props) { + /** + * The token that the allowance pertains to. + * + * @readonly + */ + this.tokenId = props.tokenId; + + /** + * The account ID of the spender of the hbar allowance. + * + * @readonly + */ + this.spenderAccountId = props.spenderAccountId; + + /** + * The account ID of the owner of the hbar allowance. + * + * @readonly + */ + this.ownerAccountId = props.ownerAccountId; + + /** + * The current balance of the spender's token allowance. + * **NOTE**: If `null`, the spender has access to all of the account owner's NFT instances + * (currently owned and any in the future). + * + * @readonly + */ + this.amount = props.amount; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITokenAllowance} allowance + * @returns {TokenAllowance} + */ + static _fromProtobuf(allowance) { + return new TokenAllowance_TokenAllowance({ + tokenId: TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + allowance.tokenId + ), + ), + spenderAccountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + allowance.spender + ), + ), + ownerAccountId: + allowance.owner != null + ? AccountId_AccountId._fromProtobuf( + /**@type {HashgraphProto.proto.IAccountID}*/ ( + allowance.owner + ), + ) + : null, + amount: + allowance.amount != null + ? src_long.fromValue(/** @type {Long} */ (allowance.amount)) + : null, + }); + } + + /** + * @internal + * @param {HashgraphProto.proto.IGrantedTokenAllowance} allowance + * @param {AccountId} ownerAccountId + * @returns {TokenAllowance} + */ + static _fromGrantedProtobuf(allowance, ownerAccountId) { + return new TokenAllowance_TokenAllowance({ + tokenId: TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + allowance.tokenId + ), + ), + spenderAccountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + allowance.spender + ), + ), + ownerAccountId, + amount: + allowance.amount != null + ? src_long.fromValue(/** @type {Long} */ (allowance.amount)) + : null, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ITokenAllowance} + */ + _toProtobuf() { + return { + tokenId: this.tokenId._toProtobuf(), + spender: + this.spenderAccountId != null + ? this.spenderAccountId._toProtobuf() + : null, + owner: + this.ownerAccountId != null + ? this.ownerAccountId._toProtobuf() + : null, + amount: this.amount, + }; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + this.tokenId.validateChecksum(client); + + if (this.ownerAccountId != null) { + this.ownerAccountId.validateChecksum(client); + } + + if (this.spenderAccountId != null) { + this.spenderAccountId.validateChecksum(client); + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IGrantedNftAllowance} HashgraphProto.proto.IGrantedNftAllowance + * @typedef {import("@hashgraph/proto").proto.INftRemoveAllowance} HashgraphProto.proto.INftRemoveAllowance + * @typedef {import("@hashgraph/proto").proto.INftAllowance} HashgraphProto.proto.INftAllowance + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +class TokenNftAllowance_TokenNftAllowance { + /** + * @internal + * @param {object} props + * @param {TokenId} props.tokenId + * @param {AccountId | null} props.spenderAccountId + * @param {AccountId | null} props.ownerAccountId + * @param {Long[] | null} props.serialNumbers + * @param {boolean | null} props.allSerials + * @param {AccountId | null} props.delegatingSpender + */ + constructor(props) { + /** + * The token that the allowance pertains to. + * + * @readonly + */ + this.tokenId = props.tokenId; + + /** + * The account ID of the spender of the hbar allowance. + * + * @readonly + */ + this.spenderAccountId = props.spenderAccountId; + + /** + * The account ID of the owner of the hbar allowance. + * + * @readonly + */ + this.ownerAccountId = props.ownerAccountId; + + /** + * The current balance of the spender's token allowance. + * **NOTE**: If `null`, the spender has access to all of the account owner's NFT instances + * (currently owned and any in the future). + * + * @readonly + */ + this.serialNumbers = props.serialNumbers; + + /** + * @readonly + */ + this.allSerials = props.allSerials; + + /** + * The account ID of the spender who is granted approvedForAll allowance and granting + * approval on an NFT serial to another spender. + * + * @readonly + */ + this.delegatingSpender = props.delegatingSpender; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.INftAllowance} allowance + * @returns {TokenNftAllowance} + */ + static _fromProtobuf(allowance) { + const allSerials = + allowance.approvedForAll != null && + allowance.approvedForAll.value == true; + return new TokenNftAllowance_TokenNftAllowance({ + tokenId: TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + allowance.tokenId + ), + ), + spenderAccountId: + allowance.spender != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + allowance.spender + ), + ) + : null, + ownerAccountId: + allowance.owner != null + ? AccountId_AccountId._fromProtobuf( + /**@type {HashgraphProto.proto.IAccountID}*/ ( + allowance.owner + ), + ) + : null, + serialNumbers: allSerials + ? null + : allowance.serialNumbers != null + ? allowance.serialNumbers.map((serialNumber) => + src_long.fromValue(serialNumber), + ) + : [], + allSerials, + delegatingSpender: + allowance.delegatingSpender != null + ? AccountId_AccountId._fromProtobuf( + /**@type {HashgraphProto.proto.IAccountID}*/ ( + allowance.delegatingSpender + ), + ) + : null, + }); + } + + /** + * @internal + * @param {HashgraphProto.proto.IGrantedNftAllowance} allowance + * @param {AccountId} ownerAccountId + * @returns {TokenNftAllowance} + */ + static _fromGrantedProtobuf(allowance, ownerAccountId) { + return new TokenNftAllowance_TokenNftAllowance({ + tokenId: TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + allowance.tokenId + ), + ), + spenderAccountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + allowance.spender + ), + ), + ownerAccountId, + serialNumbers: [], + allSerials: null, + delegatingSpender: null, + }); + } + + /** + * @internal + * @param {HashgraphProto.proto.INftRemoveAllowance} allowance + * @returns {TokenNftAllowance} + */ + static _fromRemoveProtobuf(allowance) { + return new TokenNftAllowance_TokenNftAllowance({ + tokenId: TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + allowance.tokenId + ), + ), + spenderAccountId: null, + ownerAccountId: + allowance.owner != null + ? AccountId_AccountId._fromProtobuf( + /**@type {HashgraphProto.proto.IAccountID}*/ ( + allowance.owner + ), + ) + : null, + serialNumbers: + allowance.serialNumbers != null + ? allowance.serialNumbers.map((serialNumber) => + src_long.fromValue(serialNumber), + ) + : [], + allSerials: null, + delegatingSpender: null, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.INftAllowance} + */ + _toProtobuf() { + return { + tokenId: this.tokenId._toProtobuf(), + spender: + this.spenderAccountId != null + ? this.spenderAccountId._toProtobuf() + : null, + owner: + this.ownerAccountId != null + ? this.ownerAccountId._toProtobuf() + : null, + approvedForAll: + this.serialNumbers == null ? { value: this.allSerials } : null, + serialNumbers: this.serialNumbers, + delegatingSpender: + this.delegatingSpender != null + ? this.delegatingSpender._toProtobuf() + : null, + }; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + this.tokenId.validateChecksum(client); + + if (this.ownerAccountId != null) { + this.ownerAccountId.validateChecksum(client); + } + + if (this.spenderAccountId != null) { + this.spenderAccountId.validateChecksum(client); + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountAllowanceAdjustTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../long.js").LongObject} LongObject + */ + +/** + * @deprecated - No longer supported via Hedera Protobufs + * Change properties for the given account. + */ +class AccountAllowanceAdjustTransaction extends (/* unused pure expression or super */ null && (Transaction)) { + /** + * @param {object} [props] + * @param {HbarAllowance[]} [props.hbarAllowances] + * @param {TokenAllowance[]} [props.tokenAllowances] + * @param {TokenNftAllowance[]} [props.nftAllowances] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {HbarAllowance[]} + */ + this._hbarAllowances = + props.hbarAllowances != null ? props.hbarAllowances : []; + + /** + * @private + * @type {TokenAllowance[]} + */ + this._tokenAllowances = + props.tokenAllowances != null ? props.tokenAllowances : []; + + /** + * @private + * @type {TokenNftAllowance[]} + */ + this._nftAllowances = + props.nftAllowances != null ? props.nftAllowances : []; + } + + /** + * @returns {HbarAllowance[]} + */ + get hbarAllowances() { + return this._hbarAllowances; + } + + /** + * @deprecated + * @param {AccountId | string} spenderAccountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + addHbarAllowance(spenderAccountId, amount) { + const value = amount instanceof Hbar ? amount : new Hbar(amount); + return this._adjustHbarAllowance( + null, + spenderAccountId, + util.requireNotNegative(value), + ); + } + + /** + * @param {AccountId | string | null} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {Hbar} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + _adjustHbarAllowance(ownerAccountId, spenderAccountId, amount) { + this._requireNotFrozen(); + + this._hbarAllowances.push( + new HbarAllowance({ + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId, + ownerAccountId: + typeof ownerAccountId === "string" + ? AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId, + amount: amount, + }), + ); + + return this; + } + + /** + * @deprecated + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + grantHbarAllowance(ownerAccountId, spenderAccountId, amount) { + const value = amount instanceof Hbar ? amount : new Hbar(amount); + return this._adjustHbarAllowance( + ownerAccountId, + spenderAccountId, + util.requireNotNegative(value), + ); + } + + /** + * @deprecated + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + revokeHbarAllowance(ownerAccountId, spenderAccountId, amount) { + const value = amount instanceof Hbar ? amount : new Hbar(amount); + return this._adjustHbarAllowance( + ownerAccountId, + spenderAccountId, + util.requireNotNegative(value).negated(), + ); + } + + /** + * @returns {TokenAllowance[]} + */ + get tokenAllowances() { + return this._tokenAllowances; + } + + /** + * @deprecated + * @param {TokenId | string} tokenId + * @param {AccountId | string} spenderAccountId + * @param {Long | number} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + addTokenAllowance(tokenId, spenderAccountId, amount) { + return this._adjustTokenAllowance( + tokenId, + null, + spenderAccountId, + util.requireNotNegative(Long.fromValue(amount)), + ); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string | null} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {Long | number} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + _adjustTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) { + this._requireNotFrozen(); + + this._tokenAllowances.push( + new TokenAllowance({ + tokenId: + typeof tokenId === "string" + ? TokenId.fromString(tokenId) + : tokenId, + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId, + ownerAccountId: + typeof ownerAccountId === "string" + ? AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId, + amount: + typeof amount === "number" + ? Long.fromNumber(amount) + : amount, + }), + ); + + return this; + } + + /** + * @deprecated + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @param {Long | number} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + grantTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) { + return this._adjustTokenAllowance( + tokenId, + ownerAccountId, + spenderAccountId, + util.requireNotNegative(Long.fromValue(amount)), + ); + } + + /** + * @deprecated + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @param {Long | number} amount + * @returns {AccountAllowanceAdjustTransaction} + */ + revokeTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) { + return this._adjustTokenAllowance( + tokenId, + ownerAccountId, + spenderAccountId, + util.requireNotNegative(Long.fromValue(amount)), + ); + } + + /** + * @deprecated + * @param {NftId | string} nftId + * @param {AccountId | string} spenderAccountId + * @returns {AccountAllowanceAdjustTransaction} + */ + addTokenNftAllowance(nftId, spenderAccountId) { + const id = typeof nftId === "string" ? NftId.fromString(nftId) : nftId; + return this._adjustTokenNftAllowance(id, null, spenderAccountId); + } + + /** + * @param {NftId} nftId + * @param {AccountId | string | null} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @returns {AccountAllowanceAdjustTransaction} + */ + _adjustTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) { + this._requireNotFrozen(); + + const spender = + typeof spenderAccountId === "string" + ? AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId; + const owner = + typeof ownerAccountId === "string" + ? AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId; + let found = false; + + for (const allowance of this._nftAllowances) { + if ( + allowance.tokenId.compare(nftId.tokenId) === 0 && + allowance.spenderAccountId != null && + allowance.spenderAccountId.compare(spender) === 0 + ) { + if (allowance.serialNumbers != null) { + allowance.serialNumbers.push(nftId.serial); + } + found = true; + break; + } + } + + if (!found) { + this._nftAllowances.push( + new TokenNftAllowance({ + tokenId: nftId.tokenId, + spenderAccountId: spender, + serialNumbers: [nftId.serial], + ownerAccountId: owner, + allSerials: false, + delegatingSpender: null, + }), + ); + } + + return this; + } + + /** + * @deprecated + * @param {NftId | string} nftId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @returns {AccountAllowanceAdjustTransaction} + */ + grantTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) { + const id = typeof nftId === "string" ? NftId.fromString(nftId) : nftId; + + util.requireNotNegative(id.serial); + + return this._adjustTokenNftAllowance( + id, + ownerAccountId, + spenderAccountId, + ); + } + + /** + * @deprecated + * @param {NftId | string} nftId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @returns {AccountAllowanceAdjustTransaction} + */ + revokeTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) { + const id = typeof nftId === "string" ? NftId.fromString(nftId) : nftId; + + util.requireNotNegative(id.serial); + return this._adjustTokenNftAllowance( + new NftId(id.tokenId, id.serial.negate()), + ownerAccountId, + spenderAccountId, + ); + } + + /** + * @deprecated - use `grantTokenNftAllowanceAllSerials()` instead + * @param {TokenId | string} tokenId + * @param {AccountId | string} spenderAccountId + * @returns {AccountAllowanceAdjustTransaction} + */ + addAllTokenNftAllowance(tokenId, spenderAccountId) { + return this._adjustTokenNftAllowanceAllSerials( + tokenId, + null, + spenderAccountId, + true, + ); + } + + /** + * @deprecated + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @returns {AccountAllowanceAdjustTransaction} + */ + grantTokenNftAllowanceAllSerials( + tokenId, + ownerAccountId, + spenderAccountId, + ) { + return this._adjustTokenNftAllowanceAllSerials( + tokenId, + ownerAccountId, + spenderAccountId, + true, + ); + } + + /** + * @deprecated + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @returns {AccountAllowanceAdjustTransaction} + */ + revokeTokenNftAllowanceAllSerials( + tokenId, + ownerAccountId, + spenderAccountId, + ) { + return this._adjustTokenNftAllowanceAllSerials( + tokenId, + ownerAccountId, + spenderAccountId, + false, + ); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string | null} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {boolean} allSerials + * @returns {AccountAllowanceAdjustTransaction} + */ + _adjustTokenNftAllowanceAllSerials( + tokenId, + ownerAccountId, + spenderAccountId, + allSerials, + ) { + this._requireNotFrozen(); + + this._nftAllowances.push( + new TokenNftAllowance({ + tokenId: + typeof tokenId === "string" + ? TokenId.fromString(tokenId) + : tokenId, + ownerAccountId: + ownerAccountId != null + ? typeof ownerAccountId === "string" + ? AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId + : null, + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId + ? AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId, + serialNumbers: null, + allSerials, + delegatingSpender: null, + }), + ); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + this._hbarAllowances.map((allowance) => + allowance._validateChecksums(client), + ); + this._tokenAllowances.map((allowance) => + allowance._validateChecksums(client), + ); + this._nftAllowances.map((allowance) => + allowance._validateChecksums(client), + ); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _execute(channel, request) { + return Promise.reject( + new Error("This feature has been deprecated for this class."), + ); + } + + // eslint-disable-next-line jsdoc/require-returns-check + /** + * @deprecated + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + throw new Error("This feature has been deprecated for this class."); + } + + // eslint-disable-next-line jsdoc/require-returns-check + /** + * @override + * @protected + * @returns {object} + */ + _makeTransactionData() { + throw new Error("This feature has been deprecated."); + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `AccountAllowanceAdjustTransaction:${timestamp.toString()}`; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountAllowanceApproveTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ICryptoApproveAllowanceTransactionBody} HashgraphProto.proto.ICryptoApproveAllowanceTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../long.js").LongObject} LongObject + */ + +/** + * Change properties for the given account. + */ +class AccountAllowanceApproveTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {HbarAllowance[]} [props.hbarApprovals] + * @param {TokenAllowance[]} [props.tokenApprovals] + * @param {TokenNftAllowance[]} [props.nftApprovals] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {HbarAllowance[]} + */ + this._hbarApprovals = + props.hbarApprovals != null ? props.hbarApprovals : []; + + /** + * @private + * @type {TokenAllowance[]} + */ + this._tokenApprovals = + props.tokenApprovals != null ? props.tokenApprovals : []; + + /** + * @private + * @type {TokenNftAllowance[]} + */ + this._nftApprovals = + props.nftApprovals != null ? props.nftApprovals : []; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {AccountAllowanceApproveTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const allowanceApproval = + /** @type {HashgraphProto.proto.ICryptoApproveAllowanceTransactionBody} */ ( + body.cryptoApproveAllowance + ); + + return Transaction_Transaction._fromProtobufTransactions( + new AccountAllowanceApproveTransaction({ + hbarApprovals: (allowanceApproval.cryptoAllowances != null + ? allowanceApproval.cryptoAllowances + : [] + ).map((approval) => HbarAllowance_HbarAllowance._fromProtobuf(approval)), + tokenApprovals: (allowanceApproval.tokenAllowances != null + ? allowanceApproval.tokenAllowances + : [] + ).map((approval) => TokenAllowance_TokenAllowance._fromProtobuf(approval)), + nftApprovals: (allowanceApproval.nftAllowances != null + ? allowanceApproval.nftAllowances + : [] + ).map((approval) => TokenNftAllowance_TokenNftAllowance._fromProtobuf(approval)), + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {HbarAllowance[]} + */ + get hbarApprovals() { + return this._hbarApprovals; + } + + /** + * @param {AccountId | string} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @returns {AccountAllowanceApproveTransaction} + */ + approveHbarAllowance(ownerAccountId, spenderAccountId, amount) { + this._requireNotFrozen(); + + this._hbarApprovals.push( + new HbarAllowance_HbarAllowance({ + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId_AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId, + ownerAccountId: + typeof ownerAccountId === "string" + ? AccountId_AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId, + amount: amount instanceof Hbar_Hbar ? amount : new Hbar_Hbar(amount), + }), + ); + + return this; + } + + /** + * @deprecated - Use `approveHbarAllowance()` instead + * @param {AccountId | string} spenderAccountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @returns {AccountAllowanceApproveTransaction} + */ + addHbarAllowance(spenderAccountId, amount) { + this._requireNotFrozen(); + + this._hbarApprovals.push( + new HbarAllowance_HbarAllowance({ + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId_AccountId.fromString(spenderAccountId) + : spenderAccountId, + amount: amount instanceof Hbar_Hbar ? amount : new Hbar_Hbar(amount), + ownerAccountId: null, + }), + ); + + return this; + } + + /** + * @returns {TokenAllowance[]} + */ + get tokenApprovals() { + return this._tokenApprovals; + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {Long | number} amount + * @returns {AccountAllowanceApproveTransaction} + */ + approveTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) { + this._requireNotFrozen(); + + this._tokenApprovals.push( + new TokenAllowance_TokenAllowance({ + tokenId: + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId, + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId_AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId, + ownerAccountId: + typeof ownerAccountId === "string" + ? AccountId_AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId, + amount: + typeof amount === "number" + ? src_long.fromNumber(amount) + : amount, + }), + ); + + return this; + } + + /** + * @deprecated - Use `approveTokenAllowance()` instead + * @param {TokenId | string} tokenId + * @param {AccountId | string} spenderAccountId + * @param {Long | number} amount + * @returns {AccountAllowanceApproveTransaction} + */ + addTokenAllowance(tokenId, spenderAccountId, amount) { + this._requireNotFrozen(); + + this._tokenApprovals.push( + new TokenAllowance_TokenAllowance({ + tokenId: + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId, + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId_AccountId.fromString(spenderAccountId) + : spenderAccountId, + amount: + typeof amount === "number" + ? src_long.fromNumber(amount) + : amount, + ownerAccountId: null, + }), + ); + + return this; + } + + /** + * @deprecated - Use `approveTokenNftAllowance()` instead + * @param {NftId | string} nftId + * @param {AccountId | ContractId | string} spenderAccountId + * @returns {AccountAllowanceApproveTransaction} + */ + addTokenNftAllowance(nftId, spenderAccountId) { + return this._approveTokenNftAllowance( + nftId, + null, + spenderAccountId, + null, + ); + } + + /** + * @returns {TokenNftAllowance[]} + */ + get tokenNftApprovals() { + return this._nftApprovals; + } + + /** + * @param {NftId | string} nftId + * @param {AccountId | string | null} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {AccountId | string | null} delegatingSpender + * @returns {AccountAllowanceApproveTransaction} + */ + _approveTokenNftAllowance( + nftId, + ownerAccountId, + spenderAccountId, + delegatingSpender, + ) { + this._requireNotFrozen(); + + const id = typeof nftId === "string" ? NftId_NftId.fromString(nftId) : nftId; + const spender = + typeof spenderAccountId === "string" + ? AccountId_AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId; + let found = false; + + for (const allowance of this._nftApprovals) { + if ( + allowance.tokenId.compare(id.tokenId) === 0 && + allowance.spenderAccountId != null && + allowance.spenderAccountId.compare(spender) === 0 + ) { + if (allowance.serialNumbers != null) { + allowance.serialNumbers.push(id.serial); + } + found = true; + break; + } + } + + if (!found) { + this._nftApprovals.push( + new TokenNftAllowance_TokenNftAllowance({ + tokenId: id.tokenId, + spenderAccountId: spender, + ownerAccountId: + typeof ownerAccountId === "string" + ? AccountId_AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId, + serialNumbers: [id.serial], + allSerials: false, + delegatingSpender: + typeof delegatingSpender === "string" + ? AccountId_AccountId.fromString(delegatingSpender) + : delegatingSpender, + }), + ); + } + + return this; + } + + /** + * @param {NftId | string} nftId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @returns {AccountAllowanceApproveTransaction} + */ + approveTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) { + return this._approveTokenNftAllowance( + nftId, + ownerAccountId, + spenderAccountId, + null, + ); + } + + /** + * @param {NftId | string} nftId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {AccountId | string} delegatingSpender + * @returns {AccountAllowanceApproveTransaction} + */ + approveTokenNftAllowanceWithDelegatingSpender( + nftId, + ownerAccountId, + spenderAccountId, + delegatingSpender, + ) { + return this._approveTokenNftAllowance( + nftId, + ownerAccountId, + spenderAccountId, + delegatingSpender, + ); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string | null} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @param {boolean} allSerials + * @returns {AccountAllowanceApproveTransaction} + */ + _approveAllTokenNftAllowance( + tokenId, + ownerAccountId, + spenderAccountId, + allSerials, + ) { + this._requireNotFrozen(); + + this._nftApprovals.push( + new TokenNftAllowance_TokenNftAllowance({ + tokenId: + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId, + spenderAccountId: + typeof spenderAccountId === "string" + ? AccountId_AccountId.fromString(spenderAccountId) + : spenderAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + spenderAccountId.toSolidityAddress(), + ) + : spenderAccountId, + ownerAccountId: + typeof ownerAccountId === "string" + ? AccountId_AccountId.fromString(ownerAccountId) + : ownerAccountId instanceof ContractId_ContractId + ? AccountId_AccountId.fromEvmAddress( + 0, + 0, + ownerAccountId.toSolidityAddress(), + ) + : ownerAccountId, + serialNumbers: null, + allSerials, + delegatingSpender: null, + }), + ); + + return this; + } + + /** + * @deprecated - Use `approveTokenNftAllowanceAllSerials()` instead + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | string} spenderAccountId + * @returns {AccountAllowanceApproveTransaction} + */ + addAllTokenNftAllowance(tokenId, ownerAccountId, spenderAccountId) { + return this._approveAllTokenNftAllowance( + tokenId, + ownerAccountId, + spenderAccountId, + true, + ); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @returns {AccountAllowanceApproveTransaction} + */ + approveTokenNftAllowanceAllSerials( + tokenId, + ownerAccountId, + spenderAccountId, + ) { + return this._approveAllTokenNftAllowance( + tokenId, + ownerAccountId, + spenderAccountId, + true, + ); + } + + /** + * @param {TokenId | string} tokenId + * @param {AccountId | string} ownerAccountId + * @param {AccountId | ContractId | string} spenderAccountId + * @returns {AccountAllowanceApproveTransaction} + */ + deleteTokenNftAllowanceAllSerials( + tokenId, + ownerAccountId, + spenderAccountId, + ) { + return this._approveAllTokenNftAllowance( + tokenId, + ownerAccountId, + spenderAccountId, + false, + ); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + this._hbarApprovals.map((approval) => + approval._validateChecksums(client), + ); + this._tokenApprovals.map((approval) => + approval._validateChecksums(client), + ); + this._nftApprovals.map((approval) => + approval._validateChecksums(client), + ); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.approveAllowances(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoApproveAllowance"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoApproveAllowanceTransactionBody} + */ + _makeTransactionData() { + return { + cryptoAllowances: this._hbarApprovals.map((approval) => + approval._toProtobuf(), + ), + tokenAllowances: this._tokenApprovals.map((approval) => + approval._toProtobuf(), + ), + nftAllowances: this._nftApprovals.map((approval) => + approval._toProtobuf(), + ), + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `AccountAllowanceApproveTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoApproveAllowance", + // eslint-disable-next-line @typescript-eslint/unbound-method + AccountAllowanceApproveTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountAllowanceDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ICryptoDeleteAllowanceTransactionBody} HashgraphProto.proto.ICryptoDeleteAllowanceTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("./HbarAllowance.js").default} HbarAllowance + * @typedef {import("./TokenAllowance.js").default} TokenAllowance + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../long.js").LongObject} LongObject + */ + +/** + * Change properties for the given account. + */ +class AccountAllowanceDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {HbarAllowance[]} [props.hbarAllowances] + * @param {TokenAllowance[]} [props.tokenAllowances] + * @param {TokenNftAllowance[]} [props.nftAllowances] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {TokenNftAllowance[]} + */ + this._nftAllowances = + props.nftAllowances != null ? props.nftAllowances : []; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {AccountAllowanceDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const allowance = + /** @type {HashgraphProto.proto.ICryptoDeleteAllowanceTransactionBody} */ ( + body.cryptoDeleteAllowance + ); + + return Transaction_Transaction._fromProtobufTransactions( + new AccountAllowanceDeleteTransaction({ + nftAllowances: (allowance.nftAllowances != null + ? allowance.nftAllowances + : [] + ).map((allowance) => + TokenNftAllowance_TokenNftAllowance._fromProtobuf(allowance), + ), + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {TokenNftAllowance[]} + */ + get tokenNftAllowanceDeletions() { + return this._nftAllowances; + } + + /** + * @description If you want to remove allowance for all serials of a NFT + * - use AccountAllowanceApproveTransaction().deleteTokenNftAllowanceAllSerials() + * @param {NftId | string} nftId + * @param {AccountId | string} ownerAccountId + * @returns {AccountAllowanceDeleteTransaction} + */ + deleteAllTokenNftAllowances(nftId, ownerAccountId) { + this._requireNotFrozen(); + + const id = typeof nftId === "string" ? NftId_NftId.fromString(nftId) : nftId; + + const owner = + typeof ownerAccountId === "string" + ? AccountId_AccountId.fromString(ownerAccountId) + : ownerAccountId; + let found = false; + + for (const allowance of this._nftAllowances) { + if (allowance.tokenId.compare(id.tokenId) === 0) { + if (allowance.serialNumbers != null) { + allowance.serialNumbers.push(id.serial); + } + found = true; + break; + } + } + + if (!found) { + this._nftAllowances.push( + new TokenNftAllowance_TokenNftAllowance({ + tokenId: id.tokenId, + spenderAccountId: null, + serialNumbers: [id.serial], + ownerAccountId: owner, + allSerials: false, + delegatingSpender: null, + }), + ); + } + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + this._nftAllowances.map((allowance) => + allowance._validateChecksums(client), + ); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.deleteAllowances(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoDeleteAllowance"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoDeleteAllowanceTransactionBody} + */ + _makeTransactionData() { + return { + nftAllowances: this._nftAllowances.map((allowance) => + allowance._toProtobuf(), + ), + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `AccountAllowanceDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoDeleteAllowance", + // eslint-disable-next-line @typescript-eslint/unbound-method + AccountAllowanceDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenBalanceMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenBalance} HashgraphProto.proto.ITokenBalance + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ + +/** + * @typedef {import("long")} Long + */ + +/** + * @augments {ObjectMap} + */ +class TokenBalanceMap extends ObjectMap { + constructor() { + super((s) => TokenId_TokenId.fromString(s)); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenDecimalMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenBalance} HashgraphProto.proto.ITokenBalance + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ + +/** + * @augments {ObjectMap} + */ +class TokenDecimalMap extends ObjectMap { + constructor() { + super((s) => TokenId_TokenId.fromString(s)); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountBalance.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + +/** + * @typedef {object} TokenBalanceJson + * @property {string} tokenId + * @property {string} balance + * @property {number} decimals + */ + +/** + * @typedef {object} AccountBalanceJson + * @property {string} hbars + * @property {TokenBalanceJson[]} tokens + */ + +class AccountBalance { + /** + * @private + * @param {object} props + * @param {Hbar} props.hbars + * @param {?TokenBalanceMap} props.tokens + * @param {?TokenDecimalMap} props.tokenDecimals + */ + constructor(props) { + /** + * The Hbar balance of the account + * + * @readonly + */ + this.hbars = props.hbars; + + this.tokens = props.tokens; + + this.tokenDecimals = props.tokenDecimals; + + Object.freeze(this); + } + + /** + * @param {Uint8Array} bytes + * @returns {AccountBalance} + */ + static fromBytes(bytes) { + return AccountBalance._fromProtobuf( + lib.proto.CryptoGetAccountBalanceResponse.decode(bytes), + ); + } + + /** + * @internal + * @param {HashgraphProto.proto.ICryptoGetAccountBalanceResponse} accountBalance + * @returns {AccountBalance} + */ + static _fromProtobuf(accountBalance) { + const tokenBalances = new TokenBalanceMap(); + const tokenDecimals = new TokenDecimalMap(); + + if (accountBalance.tokenBalances != null) { + for (const balance of accountBalance.tokenBalances) { + const tokenId = TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + balance.tokenId + ), + ); + + tokenDecimals._set( + tokenId, + balance.decimals != null ? balance.decimals : 0, + ); + tokenBalances._set( + tokenId, + src_long.fromValue(/** @type {Long} */ (balance.balance)), + ); + } + } + + return new AccountBalance({ + hbars: Hbar_Hbar.fromTinybars( + /** @type {Long} */ (accountBalance.balance), + ), + tokens: tokenBalances, + tokenDecimals, + }); + } + + /** + * @returns {HashgraphProto.proto.ICryptoGetAccountBalanceResponse} + */ + _toProtobuf() { + /** @type {HashgraphProto.proto.ITokenBalance[]} */ + const list = []; + + // eslint-disable-next-line deprecation/deprecation + for (const [key, value] of this.tokens != null ? this.tokens : []) { + list.push({ + tokenId: key._toProtobuf(), + balance: value, + decimals: + // eslint-disable-next-line deprecation/deprecation + this.tokenDecimals != null + ? // eslint-disable-next-line deprecation/deprecation + this.tokenDecimals.get(key) + : null, + }); + } + + return { + balance: this.hbars.toTinybars(), + tokenBalances: list, + }; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.CryptoGetAccountBalanceResponse.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * @returns {AccountBalanceJson} + */ + toJSON() { + const tokens = []; + // eslint-disable-next-line deprecation/deprecation + for (const [key, value] of this.tokens != null ? this.tokens : []) { + const decimals = + // eslint-disable-next-line deprecation/deprecation + this.tokenDecimals != null ? this.tokenDecimals.get(key) : null; + + tokens.push({ + tokenId: key.toString(), + balance: value.toString(), + decimals: decimals != null ? decimals : 0, + }); + } + + return { + hbars: this.hbars.toString(), + tokens, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountBalanceQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.ICryptoGetAccountBalanceQuery} HashgraphProto.proto.ICryptoGetAccountBalanceQuery + * @typedef {import("@hashgraph/proto").proto.ICryptoGetAccountBalanceResponse} HashgraphProto.proto.ICryptoGetAccountBalanceResponse + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * Get the balance of a Hedera™ crypto-currency account. + * + * This returns only the balance, so its a smaller and faster reply + * than AccountInfoQuery. + * + * This query is free. + * + * @augments {Query} + */ +class AccountBalanceQuery_AccountBalanceQuery extends Query_Query { + /** + * @param {object} [props] + * @param {AccountId | string} [props.accountId] + * @param {ContractId | string} [props.contractId] + */ + constructor(props = {}) { + super(); + + /** + * @type {?AccountId} + * @private + */ + this._accountId = null; + + /** + * @type {?ContractId} + * @private + */ + this._contractId = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + + if (props.contractId != null) { + this.setContractId(props.contractId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {AccountBalanceQuery} + */ + static _fromProtobuf(query) { + const balance = + /** @type {HashgraphProto.proto.ICryptoGetAccountBalanceQuery} */ ( + query.cryptogetAccountBalance + ); + + return new AccountBalanceQuery_AccountBalanceQuery({ + accountId: + balance.accountID != null + ? AccountId_AccountId._fromProtobuf(balance.accountID) + : undefined, + contractId: + balance.contractID != null + ? ContractId_ContractId._fromProtobuf(balance.contractID) + : undefined, + }); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * Set the account ID for which the balance is being requested. + * + * This is mutually exclusive with `setContractId`. + * + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * Set the contract ID for which the balance is being requested. + * + * This is mutually exclusive with `setAccountId`. + * + * @param {ContractId | string} contractId + * @returns {this} + */ + setContractId(contractId) { + this._contractId = + typeof contractId === "string" + ? ContractId_ContractId.fromString(contractId) + : contractId.clone(); + + return this; + } + + /** + * @protected + * @override + * @returns {boolean} + */ + _isPaymentRequired() { + return false; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + + if (this._contractId != null) { + this._contractId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.cryptoGetBalance(request); + } + + /** + * @override + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const cryptogetAccountBalance = + /** @type {HashgraphProto.proto.ICryptoGetAccountBalanceResponse} */ ( + response.cryptogetAccountBalance + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + cryptogetAccountBalance.header + ); + } + + /** + * @override + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const cryptogetAccountBalance = + /** @type {HashgraphProto.proto.ICryptoGetAccountBalanceResponse} */ ( + response.cryptogetAccountBalance + ); + return Promise.resolve( + AccountBalance._fromProtobuf(cryptogetAccountBalance), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + cryptogetAccountBalance: { + header, + accountID: + this._accountId != null + ? this._accountId._toProtobuf() + : null, + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + return `AccountBalanceQuery:${this._timestamp.toString()}`; + } +} + +QUERY_REGISTRY.set( + "cryptogetAccountBalance", + // eslint-disable-next-line @typescript-eslint/unbound-method + AccountBalanceQuery_AccountBalanceQuery._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Duration.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IDuration} HashgraphProto.proto.IDuration + */ + +/** + * A duration type. + * + * The main point of this tyope is for encapsulating the `[to|from]Protobuf()` implementations + */ +class Duration_Duration { + /** + * @param {Long | number} seconds + */ + constructor(seconds) { + /** + * @readonly + * @type {Long} + */ + this.seconds = + seconds instanceof src_long ? seconds : src_long.fromNumber(seconds); + + Object.freeze(this); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IDuration} + */ + _toProtobuf() { + return { + seconds: this.seconds, + }; + } + + /** + * @internal + * @param {HashgraphProto.proto.IDuration} duration + * @returns {Duration} + */ + static _fromProtobuf(duration) { + return new Duration_Duration(/** @type {Long} */ (duration.seconds)); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountCreateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars + + + + + + + + + +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../Timestamp.js").default} Timestamp + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +/** + * Create a new Hedera™ crypto-currency account. + */ +class AccountCreateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Key} [props.key] + * @param {number | string | Long | BigNumber | Hbar} [props.initialBalance] + * @param {boolean} [props.receiverSignatureRequired] + * @param {AccountId} [props.proxyAccountId] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {string} [props.accountMemo] + * @param {Long | number} [props.maxAutomaticTokenAssociations] + * @param {AccountId | string} [props.stakedAccountId] + * @param {Long | number} [props.stakedNodeId] + * @param {boolean} [props.declineStakingReward] + * @param {EvmAddress} [props.alias] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?Key} + */ + this._key = null; + + /** + * @private + * @type {?Hbar} + */ + this._initialBalance = null; + + /** + * @private + * @type {Hbar} + */ + this._sendRecordThreshold = DEFAULT_RECORD_THRESHOLD; + + /** + * @private + * @type {Hbar} + */ + this._receiveRecordThreshold = DEFAULT_RECORD_THRESHOLD; + + /** + * @private + * @type {boolean} + */ + this._receiverSignatureRequired = false; + + /** + * @private + * @type {?AccountId} + */ + this._proxyAccountId = null; + + /** + * @private + * @type {Duration} + */ + this._autoRenewPeriod = new Duration_Duration(DEFAULT_AUTO_RENEW_PERIOD); + + /** + * @private + * @type {?string} + */ + this._accountMemo = null; + + /** + * @private + * @type {?Long} + */ + this._maxAutomaticTokenAssociations = null; + + /** + * @private + * @type {?AccountId} + */ + this._stakedAccountId = null; + + /** + * @private + * @type {?Long} + */ + this._stakedNodeId = null; + + /** + * @private + * @type {boolean} + */ + this._declineStakingReward = false; + + /** + * @private + * @type {?EvmAddress} + */ + this._alias = null; + + if (props.key != null) { + this.setKey(props.key); + } + + if (props.receiverSignatureRequired != null) { + this.setReceiverSignatureRequired(props.receiverSignatureRequired); + } + + if (props.initialBalance != null) { + this.setInitialBalance(props.initialBalance); + } + + if (props.proxyAccountId != null) { + // eslint-disable-next-line deprecation/deprecation + this.setProxyAccountId(props.proxyAccountId); + } + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + if (props.accountMemo != null) { + this.setAccountMemo(props.accountMemo); + } + + if (props.maxAutomaticTokenAssociations != null) { + this.setMaxAutomaticTokenAssociations( + props.maxAutomaticTokenAssociations, + ); + } + + if (props.stakedAccountId != null) { + this.setStakedAccountId(props.stakedAccountId); + } + + if (props.stakedNodeId != null) { + this.setStakedNodeId(props.stakedNodeId); + } + + if (props.declineStakingReward != null) { + this.setDeclineStakingReward(props.declineStakingReward); + } + + if (props.alias != null) { + this.setAlias(props.alias); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {AccountCreateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const create = + /** @type {HashgraphProto.proto.ICryptoCreateTransactionBody} */ ( + body.cryptoCreateAccount + ); + + let alias = undefined; + if (create.alias != null && create.alias.length > 0) { + if (create.alias.length === 20) { + alias = EvmAddress.fromBytes(create.alias); + } + } + + return Transaction_Transaction._fromProtobufTransactions( + new AccountCreateTransaction({ + key: + create.key != null + ? src_Key_Key._fromProtobufKey(create.key) + : undefined, + initialBalance: + create.initialBalance != null + ? Hbar_Hbar.fromTinybars(create.initialBalance) + : undefined, + receiverSignatureRequired: + create.receiverSigRequired != null + ? create.receiverSigRequired + : undefined, + proxyAccountId: + create.proxyAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + create.proxyAccountID + ), + ) + : undefined, + autoRenewPeriod: + create.autoRenewPeriod != null + ? create.autoRenewPeriod.seconds != null + ? create.autoRenewPeriod.seconds + : undefined + : undefined, + accountMemo: create.memo != null ? create.memo : undefined, + maxAutomaticTokenAssociations: + create.maxAutomaticTokenAssociations != null + ? create.maxAutomaticTokenAssociations + : undefined, + stakedAccountId: + create.stakedAccountId != null + ? AccountId_AccountId._fromProtobuf(create.stakedAccountId) + : undefined, + stakedNodeId: + create.stakedNodeId != null + ? create.stakedNodeId + : undefined, + declineStakingReward: create.declineReward == true, + alias, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?Key} + */ + get key() { + return this._key; + } + + /** + * Set the key for this account. + * + * This is the key that must sign each transfer out of the account. + * + * If `receiverSignatureRequired` is true, then the key must also sign + * any transfer into the account. + * + * @param {Key} key + * @returns {this} + */ + setKey(key) { + this._requireNotFrozen(); + this._key = key; + + return this; + } + + /** + * @returns {?Hbar} + */ + get initialBalance() { + return this._initialBalance; + } + + /** + * Set the initial amount to transfer into this account. + * + * @param {number | string | Long | BigNumber | Hbar} initialBalance + * @returns {this} + */ + setInitialBalance(initialBalance) { + this._requireNotFrozen(); + this._initialBalance = + initialBalance instanceof Hbar_Hbar + ? initialBalance + : new Hbar_Hbar(initialBalance); + + return this; + } + + /** + * @returns {boolean} + */ + get receiverSignatureRequired() { + return this._receiverSignatureRequired; + } + + /** + * Set to true to require the key for this account to sign any transfer of + * hbars to this account. + * + * @param {boolean} receiverSignatureRequired + * @returns {this} + */ + setReceiverSignatureRequired(receiverSignatureRequired) { + this._requireNotFrozen(); + this._receiverSignatureRequired = receiverSignatureRequired; + + return this; + } + + /** + * @deprecated + * @returns {?AccountId} + */ + get proxyAccountId() { + return this._proxyAccountId; + } + + /** + * @deprecated + * + * Set the ID of the account to which this account is proxy staked. + * @param {AccountId} proxyAccountId + * @returns {this} + */ + setProxyAccountId(proxyAccountId) { + this._requireNotFrozen(); + this._proxyAccountId = proxyAccountId; + + return this; + } + + /** + * @returns {Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * Set the auto renew period for this account. + * + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @returns {?string} + */ + get accountMemo() { + return this._accountMemo; + } + + /** + * @param {string} memo + * @returns {this} + */ + setAccountMemo(memo) { + this._requireNotFrozen(); + this._accountMemo = memo; + + return this; + } + + /** + * @returns {?Long} + */ + get maxAutomaticTokenAssociations() { + return this._maxAutomaticTokenAssociations; + } + + /** + * @param {Long | number} maxAutomaticTokenAssociations + * @returns {this} + */ + setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) { + this._requireNotFrozen(); + this._maxAutomaticTokenAssociations = + typeof maxAutomaticTokenAssociations === "number" + ? src_long.fromNumber(maxAutomaticTokenAssociations) + : maxAutomaticTokenAssociations; + + return this; + } + + /** + * @returns {?AccountId} + */ + get stakedAccountId() { + return this._stakedAccountId; + } + + /** + * @param {AccountId | string} stakedAccountId + * @returns {this} + */ + setStakedAccountId(stakedAccountId) { + this._requireNotFrozen(); + this._stakedAccountId = + typeof stakedAccountId === "string" + ? AccountId_AccountId.fromString(stakedAccountId) + : stakedAccountId; + + return this; + } + + /** + * @returns {?Long} + */ + get stakedNodeId() { + return this._stakedNodeId; + } + + /** + * @param {Long | number} stakedNodeId + * @returns {this} + */ + setStakedNodeId(stakedNodeId) { + this._requireNotFrozen(); + this._stakedNodeId = src_long.fromValue(stakedNodeId); + + return this; + } + + /** + * @returns {boolean} + */ + get declineStakingRewards() { + return this._declineStakingReward; + } + + /** + * @param {boolean} declineStakingReward + * @returns {this} + */ + setDeclineStakingReward(declineStakingReward) { + this._requireNotFrozen(); + this._declineStakingReward = declineStakingReward; + + return this; + } + + /** + * The bytes to be used as the account's alias. + * + * The bytes must be formatted as the calcluated last 20 bytes of the + * keccak-256 of the ECDSA primitive key. + * + * All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and + * delegatable_contract_id, are not supported. + * + * At most only one account can ever have a given alias on the network. + * + * @returns {?EvmAddress} + */ + get alias() { + return this._alias; + } + + /** + * The bytes to be used as the account's alias. + * + * The bytes must be formatted as the calcluated last 20 bytes of the + * keccak-256 of the ECDSA primitive key. + * + * All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and + * delegatable_contract_id, are not supported. + * + * At most only one account can ever have a given alias on the network. + * + * @param {string | EvmAddress} alias + * @returns {this} + */ + setAlias(alias) { + if (typeof alias === "string") { + if ( + (alias.startsWith("0x") && alias.length == 42) || + alias.length == 40 + ) { + this._alias = EvmAddress.fromString(alias); + } else { + throw new Error( + 'evmAddress must be a valid EVM address with or without "0x" prefix', + ); + } + } else { + this._alias = alias; + } + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._proxyAccountId != null) { + this._proxyAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.createAccount(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoCreateAccount"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoCreateTransactionBody} + */ + _makeTransactionData() { + let alias = null; + if (this._alias != null) { + alias = this._alias.toBytes(); + } + + return { + key: this._key != null ? this._key._toProtobufKey() : null, + initialBalance: + this._initialBalance != null + ? this._initialBalance.toTinybars() + : null, + autoRenewPeriod: this._autoRenewPeriod._toProtobuf(), + proxyAccountID: + this._proxyAccountId != null + ? this._proxyAccountId._toProtobuf() + : null, + receiveRecordThreshold: this._receiveRecordThreshold.toTinybars(), + sendRecordThreshold: this._sendRecordThreshold.toTinybars(), + receiverSigRequired: this._receiverSignatureRequired, + memo: this._accountMemo, + maxAutomaticTokenAssociations: + this._maxAutomaticTokenAssociations != null + ? this._maxAutomaticTokenAssociations.toInt() + : null, + stakedAccountId: + this.stakedAccountId != null + ? this.stakedAccountId._toProtobuf() + : null, + stakedNodeId: this.stakedNodeId, + declineReward: this.declineStakingRewards, + alias, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `AccountCreateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoCreateAccount", + // eslint-disable-next-line @typescript-eslint/unbound-method + AccountCreateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ICryptoDeleteTransactionBody} HashgraphProto.proto.ICryptoDeleteTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +/** + * Marks an account as deleted, moving all its current hbars to another account. + * + * It will remain in the ledger, marked as deleted, until it expires. + * Transfers into it a deleted account fail. But a deleted account can still have its + * expiration extended in the normal way. + */ +class AccountDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {AccountId} [props.accountId] + * @param {AccountId} [props.transferAccountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + /** + * @private + * @type {?AccountId} + */ + this._transferAccountId = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + + if (props.transferAccountId != null) { + this.setTransferAccountId(props.transferAccountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {AccountDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const accountDelete = + /** @type {HashgraphProto.proto.ICryptoDeleteTransactionBody} */ ( + body.cryptoDelete + ); + + return Transaction_Transaction._fromProtobufTransactions( + new AccountDeleteTransaction({ + accountId: + accountDelete.deleteAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + accountDelete.deleteAccountID + ), + ) + : undefined, + transferAccountId: + accountDelete.transferAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + accountDelete.transferAccountID + ), + ) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * Set the account ID which is being deleted in this transaction. + * + * @param {AccountId | string} accountId + * @returns {AccountDeleteTransaction} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @returns {?AccountId} + */ + get transferAccountId() { + return this._transferAccountId; + } + + /** + * Set the account ID which will receive all remaining hbars. + * + * @param {AccountId | string} transferAccountId + * @returns {AccountDeleteTransaction} + */ + setTransferAccountId(transferAccountId) { + this._requireNotFrozen(); + this._transferAccountId = + typeof transferAccountId === "string" + ? AccountId_AccountId.fromString(transferAccountId) + : transferAccountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + + if (this._transferAccountId != null) { + this._transferAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.cryptoDelete(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoDelete"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoDeleteTransactionBody} + */ + _makeTransactionData() { + return { + deleteAccountID: + this._accountId != null ? this._accountId._toProtobuf() : null, + transferAccountID: + this._transferAccountId != null + ? this._transferAccountId._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `AccountDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoDelete", + // eslint-disable-next-line @typescript-eslint/unbound-method + AccountDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/StakingInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @typedef {import("long").Long} Long + */ + +/** + * @typedef {object} StakingInfoJson + * @property {boolean} declineStakingReward + * @property {?string} stakePeriodStart + * @property {?string} pendingReward + * @property {?string} stakedToMe + * @property {?string} stakedAccountId + * @property {?string} stakedNodeId + */ + +/** + * Staking metadata for an account or a contract returned in CryptoGetInfo or ContractGetInfo queries + */ +class StakingInfo { + /** + * @private + * @param {object} props + * @param {boolean} props.declineStakingReward + * @param {?Timestamp} props.stakePeriodStart + * @param {?Hbar} props.pendingReward + * @param {?Hbar} props.stakedToMe + * @param {?AccountId} props.stakedAccountId + * @param {?Long} props.stakedNodeId + */ + constructor(props) { + /** + * If true, this account or contract declined to receive a staking reward. + * + * @readonly + */ + this.declineStakingReward = props.declineStakingReward; + + /** + * The staking period during which either the staking settings for this + * account or contract changed (such as starting staking or changing + * staked_node_id) or the most recent reward was earned, whichever is + * later. If this account or contract is not currently staked to a + * node, then this field is not set. + * + * @readonly + */ + this.stakePeriodStart = props.stakePeriodStart; + + /** + * The amount in tinybars that will be received in the next reward + * situation. + * + * @readonly + */ + this.pendingReward = props.pendingReward; + + /** + * The total of balance of all accounts staked to this account or contract. + * + * @readonly + */ + this.stakedToMe = props.stakedToMe; + + /** + * The account to which this account or contract is staking. + * + * @readonly + */ + this.stakedAccountId = props.stakedAccountId; + + /** + * The ID of the node this account or contract is staked to. + * + * @readonly + */ + this.stakedNodeId = props.stakedNodeId; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.IStakingInfo} info + * @returns {StakingInfo} + */ + static _fromProtobuf(info) { + return new StakingInfo({ + declineStakingReward: info.declineReward == true, + stakePeriodStart: + info.stakePeriodStart != null + ? Timestamp_Timestamp._fromProtobuf(info.stakePeriodStart) + : null, + pendingReward: + info.pendingReward != null + ? Hbar_Hbar.fromTinybars(info.pendingReward) + : null, + stakedToMe: + info.stakedToMe != null + ? Hbar_Hbar.fromTinybars(info.stakedToMe) + : null, + stakedAccountId: + info.stakedAccountId != null + ? AccountId_AccountId._fromProtobuf(info.stakedAccountId) + : null, + stakedNodeId: info.stakedNodeId != null ? info.stakedNodeId : null, + }); + } + + /** + * @returns {HashgraphProto.proto.IStakingInfo} + */ + _toProtobuf() { + return { + declineReward: this.declineStakingReward, + stakePeriodStart: + this.stakePeriodStart != null + ? this.stakePeriodStart._toProtobuf() + : null, + pendingReward: + this.pendingReward != null + ? this.pendingReward.toTinybars() + : null, + stakedToMe: + this.stakedToMe != null ? this.stakedToMe.toTinybars() : null, + stakedAccountId: + this.stakedAccountId != null + ? this.stakedAccountId._toProtobuf() + : null, + stakedNodeId: this.stakedNodeId, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {StakingInfo} + */ + static fromBytes(bytes) { + return StakingInfo._fromProtobuf( + lib.proto.StakingInfo.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.StakingInfo.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * @returns {StakingInfoJson} + */ + toJSON() { + return { + declineStakingReward: this.declineStakingReward, + stakePeriodStart: + this.stakePeriodStart != null + ? this.stakePeriodStart.toString() + : null, + pendingReward: + this.pendingReward != null + ? this.pendingReward.toString() + : null, + stakedToMe: + this.stakedToMe != null ? this.stakedToMe.toString() : null, + stakedAccountId: + this.stakedAccountId != null + ? this.stakedAccountId.toString() + : null, + stakedNodeId: + this.stakedNodeId != null ? this.stakedNodeId.toString() : null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/LiveHash.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.ILiveHash} HashgraphProto.proto.ILiveHash + * @typedef {import("@hashgraph/proto").proto.IDuration} HashgraphProto.proto.IDuration + */ + +/** + * Response when the client sends the node CryptoGetInfoQuery. + */ +class LiveHash { + /** + * @private + * @param {object} props + * @param {AccountId} props.accountId + * @param {Uint8Array} props.hash + * @param {KeyList} props.keys + * @param {Duration} props.duration + */ + constructor(props) { + /** @readonly */ + this.accountId = props.accountId; + + /** @readonly */ + this.hash = props.hash; + + /** @readonly */ + this.keys = props.keys; + + /** @readonly */ + this.duration = props.duration; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.ILiveHash} liveHash + * @returns {LiveHash} + */ + static _fromProtobuf(liveHash) { + const liveHash_ = /** @type {HashgraphProto.proto.ILiveHash} */ ( + liveHash + ); + + return new LiveHash({ + accountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + liveHash_.accountId + ), + ), + hash: liveHash_.hash != null ? liveHash_.hash : new Uint8Array(), + keys: + liveHash_.keys != null + ? src_KeyList_KeyList.__fromProtobufKeyList(liveHash_.keys) + : new src_KeyList_KeyList(), + duration: Duration_Duration._fromProtobuf( + /** @type {HashgraphProto.proto.IDuration} */ ( + liveHash_.duration + ), + ), + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ILiveHash} + */ + _toProtobuf() { + return { + accountId: this.accountId._toProtobuf(), + hash: this.hash, + keys: this.keys._toProtobufKey().keyList, + duration: this.duration._toProtobuf(), + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenRelationship.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenRelationship} HashgraphProto.proto.ITokenRelationship + * @typedef {import("@hashgraph/proto").proto.TokenKycStatus} HashgraphProto.proto.TokenKycStatus + * @typedef {import("@hashgraph/proto").proto.TokenFreezeStatus} HashgraphProto.proto.TokenFreezeStatus + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ + +/** + * Token's information related to the given Account + */ +class TokenRelationship { + /** + * @param {object} props + * @param {TokenId} props.tokenId + * @param {string} props.symbol + * @param {Long} props.balance + * @param {boolean | null} props.isKycGranted + * @param {boolean | null} props.isFrozen + * @param {boolean | null} props.automaticAssociation + */ + constructor(props) { + /** + * The ID of the token + * + * @readonly + */ + this.tokenId = props.tokenId; + + /** + * The Symbol of the token + * + * @readonly + */ + this.symbol = props.symbol; + + /** + * The balance that the Account holds in the smallest denomination + * + * @readonly + */ + this.balance = props.balance; + + /** + * The KYC status of the account (KycNotApplicable, Granted or Revoked). If the token does + * not have KYC key, KycNotApplicable is returned + * + * @readonly + */ + this.isKycGranted = props.isKycGranted; + + /** + * The Freeze status of the account (FreezeNotApplicable, Frozen or Unfrozen). If the token + * does not have Freeze key, FreezeNotApplicable is returned + * + * @readonly + */ + this.isFrozen = props.isFrozen; + + /** + * Specifies if the relationship is created implicitly. False : explicitly associated, True : + * implicitly associated. + * + * @readonly + */ + this.automaticAssociation = props.automaticAssociation; + + Object.freeze(this); + } + + /** + * @param {HashgraphProto.proto.ITokenRelationship} relationship + * @returns {TokenRelationship} + */ + static _fromProtobuf(relationship) { + const tokenId = TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ (relationship.tokenId), + ); + const isKycGranted = + relationship.kycStatus == null || relationship.kycStatus === 0 + ? null + : relationship.kycStatus === 1; + const isFrozen = + relationship.freezeStatus == null || relationship.freezeStatus === 0 + ? null + : relationship.freezeStatus === 1; + + return new TokenRelationship({ + tokenId, + symbol: /** @type {string} */ (relationship.symbol), + balance: + relationship.balance != null + ? relationship.balance instanceof src_long + ? relationship.balance + : src_long.fromValue(relationship.balance) + : src_long.ZERO, + isKycGranted, + isFrozen, + automaticAssociation: + relationship.automaticAssociation != null + ? relationship.automaticAssociation + : null, + }); + } + + /** + * @returns {HashgraphProto.proto.ITokenRelationship} + */ + _toProtobuf() { + return { + tokenId: this.tokenId._toProtobuf(), + symbol: this.symbol, + balance: this.balance, + kycStatus: + this.isKycGranted == null ? 0 : this.isKycGranted ? 1 : 2, + freezeStatus: this.isFrozen == null ? 0 : this.isFrozen ? 1 : 2, + automaticAssociation: this.automaticAssociation, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TokenRelationshipMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITokenRelationship} HashgraphProto.proto.ITokenRelationship + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ + +/** + * @typedef {import("long")} Long + */ + +/** + * @augments {ObjectMap} + */ +class TokenRelationshipMap extends ObjectMap { + constructor() { + super((s) => TokenId_TokenId.fromString(s)); + } + + /** + * @param {HashgraphProto.proto.ITokenRelationship[]} relationships + * @returns {TokenRelationshipMap} + */ + static _fromProtobuf(relationships) { + const tokenRelationships = new TokenRelationshipMap(); + + for (const relationship of relationships) { + const tokenId = TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ ( + relationship.tokenId + ), + ); + + tokenRelationships._set( + tokenId, + TokenRelationship._fromProtobuf(relationship), + ); + } + + return tokenRelationships; + } + + /** + * @returns {HashgraphProto.proto.ITokenRelationship[]} + */ + _toProtobuf() { + const list = []; + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const [_, relationship] of this) { + list.push(relationship._toProtobuf()); + } + + return list; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/LedgerId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * Represents the ID of a network. + */ +class LedgerId { + /** + * @hideconstructor + * @internal + * @param {Uint8Array} ledgerId + */ + constructor(ledgerId) { + /** + * @readonly + * @type {Uint8Array} + */ + this._ledgerId = ledgerId; + + Object.freeze(this); + } + + /** + * @param {string} ledgerId + * @returns {LedgerId} + */ + static fromString(ledgerId) { + switch (ledgerId) { + case NETNAMES[0]: + case "0": + return LedgerId.MAINNET; + case NETNAMES[1]: + case "1": + return LedgerId.TESTNET; + case NETNAMES[2]: + case "2": + return LedgerId.PREVIEWNET; + case NETNAMES[3]: + case "3": + return LedgerId.LOCAL_NODE; + default: { + let ledgerIdDecoded = decode(ledgerId); + if (ledgerIdDecoded.length == 0 && ledgerId.length != 0) { + throw new Error("Default reached for fromString"); + } else { + return new LedgerId(ledgerIdDecoded); + } + } + } + } + + /** + * If the ledger ID is a known value such as `[0]`, `[1]`, `[2]` this method + * will instead return "mainnet", "testnet", or "previewnet", otherwise it will + * hex encode the bytes. + * + * @returns {string} + */ + toString() { + if (this._ledgerId.length == 1) { + switch (this._ledgerId[0]) { + case 0: + return NETNAMES[0]; + case 1: + return NETNAMES[1]; + case 2: + return NETNAMES[2]; + case 3: + return NETNAMES[3]; + default: + return hex_browser_encode(this._ledgerId); + } + } else { + return hex_browser_encode(this._ledgerId); + } + } + + /** + * Using the UTF-8 byte representation of "mainnet", "testnet", + * or "previewnet" is NOT supported. + * + * @param {Uint8Array} bytes + * @returns {LedgerId} + */ + static fromBytes(bytes) { + return new LedgerId(bytes); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return this._ledgerId; + } + + /** + * @returns {boolean} + */ + isMainnet() { + return this.toString() == NETNAMES[0]; + } + + /** + * @returns {boolean} + */ + isTestnet() { + return this.toString() == NETNAMES[1]; + } + + /** + * @returns {boolean} + */ + isPreviewnet() { + return this.toString() == NETNAMES[2]; + } + + /** + * @returns {boolean} + */ + isLocalNode() { + return this.toString() == NETNAMES[3]; + } +} + +const NETNAMES = ["mainnet", "testnet", "previewnet", "local-node"]; + +LedgerId.MAINNET = new LedgerId(new Uint8Array([0])); + +LedgerId.TESTNET = new LedgerId(new Uint8Array([1])); + +LedgerId.PREVIEWNET = new LedgerId(new Uint8Array([2])); + +LedgerId.LOCAL_NODE = new LedgerId(new Uint8Array([3])); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + + + +/** + * @typedef {import("./HbarAllowance.js").default} HbarAllowance + * @typedef {import("./TokenAllowance.js").default} TokenAllowance + * @typedef {import("./TokenNftAllowance.js").default} TokenNftAllowance + * @typedef {import("../StakingInfo.js").StakingInfoJson} StakingInfoJson + */ + +/** + * @typedef {object} AccountInfoJson + * @property {string} accountId + * @property {?string} contractAccountId + * @property {boolean} isDeleted + * @property {?string} proxyAccountId + * @property {string} proxyReceived + * @property {?string} key + * @property {string} balance + * @property {string} sendRecordThreshold + * @property {string} receiveRecordThreshold + * @property {boolean} isReceiverSignatureRequired + * @property {string} expirationTime + * @property {string} autoRenewPeriod + * @property {string} accountMemo + * @property {string} ownedNfts + * @property {string} maxAutomaticTokenAssociations + * @property {?string} aliasKey + * @property {?string} ledgerId + * @property {?string} ethereumNonce + * @property {?StakingInfoJson} stakingInfo + */ + +/** + * Current information about an account, including the balance. + */ +class AccountInfo { + /** + * @private + * @param {object} props + * @param {AccountId} props.accountId + * @param {?string} props.contractAccountId + * @param {boolean} props.isDeleted + * @param {?AccountId} props.proxyAccountId + * @param {Hbar} props.proxyReceived + * @param {Key} props.key + * @param {Hbar} props.balance + * @param {Hbar} props.sendRecordThreshold + * @param {Hbar} props.receiveRecordThreshold + * @param {boolean} props.isReceiverSignatureRequired + * @param {Timestamp} props.expirationTime + * @param {Duration} props.autoRenewPeriod + * @param {LiveHash[]} props.liveHashes + * @param {TokenRelationshipMap} props.tokenRelationships + * @param {string} props.accountMemo + * @param {Long} props.ownedNfts + * @param {Long} props.maxAutomaticTokenAssociations + * @param {PublicKey | null} props.aliasKey + * @param {LedgerId | null} props.ledgerId + * @param {HbarAllowance[]} props.hbarAllowances + * @param {TokenAllowance[]} props.tokenAllowances + * @param {TokenNftAllowance[]} props.nftAllowances + * @param {?Long} props.ethereumNonce + * @param {?StakingInfo} props.stakingInfo + */ + constructor(props) { + /** + * The account ID for which this information applies. + * + * @readonly + */ + this.accountId = props.accountId; + + /** + * The Contract Account ID comprising of both the contract instance and the cryptocurrency + * account owned by the contract instance, in the format used by Solidity. + * + * @readonly + */ + this.contractAccountId = props.contractAccountId; + + /** + * If true, then this account has been deleted, it will disappear when it expires, and + * all transactions for it will fail except the transaction to extend its expiration date. + * + * @readonly + */ + this.isDeleted = props.isDeleted; + + /** + * @deprecated + * + * The Account ID of the account to which this is proxy staked. If proxyAccountID is null, + * or is an invalid account, or is an account that isn't a node, then this account is + * automatically proxy staked to a node chosen by the network, but without earning payments. + * If the proxyAccountID account refuses to accept proxy staking , or if it is not currently + * running a node, then it will behave as if proxyAccountID was null. + * @readonly + */ + // eslint-disable-next-line deprecation/deprecation + this.proxyAccountId = props.proxyAccountId; + + /** + * The total number of tinybars proxy staked to this account. + * + * @readonly + */ + this.proxyReceived = props.proxyReceived; + + /** + * The key for the account, which must sign in order to transfer out, or to modify the account + * in any way other than extending its expiration date. + * + * @readonly + */ + this.key = props.key; + + /** + * The current balance of account. + * + * @readonly + */ + this.balance = props.balance; + + /** + * The threshold amount (in tinybars) for which an account record is created (and this account + * charged for them) for any send/withdraw transaction. + * + * @readonly + */ + this.sendRecordThreshold = props.sendRecordThreshold; + + /** + * The threshold amount (in tinybars) for which an account record is created + * (and this account charged for them) for any transaction above this amount. + * + * @readonly + */ + this.receiveRecordThreshold = props.receiveRecordThreshold; + + /** + * If true, no transaction can transfer to this account unless signed by this account's key. + * + * @readonly + */ + this.isReceiverSignatureRequired = props.isReceiverSignatureRequired; + + /** + * The TimeStamp time at which this account is set to expire. + * + * @readonly + */ + this.expirationTime = props.expirationTime; + + /** + * The duration for expiration time will extend every this many seconds. If there are + * insufficient funds, then it extends as long as possible. If it is empty when it + * expires, then it is deleted. + * + * @readonly + */ + this.autoRenewPeriod = props.autoRenewPeriod; + + /** @readonly */ + this.liveHashes = props.liveHashes; + + /** @readonly */ + this.tokenRelationships = props.tokenRelationships; + + /** @readonly */ + this.accountMemo = props.accountMemo; + + /** @readonly */ + this.ownedNfts = props.ownedNfts; + + /** @readonly */ + this.maxAutomaticTokenAssociations = + props.maxAutomaticTokenAssociations; + + this.aliasKey = props.aliasKey; + + this.ledgerId = props.ledgerId; + /* + * @deprecated - no longer supported + */ + this.hbarAllowances = props.hbarAllowances; + /* + * @deprecated - no longer supported + */ + this.tokenAllowances = props.tokenAllowances; + /* + * @deprecated - no longer supported + */ + this.nftAllowances = props.nftAllowances; + + /** + * The ethereum transaction nonce associated with this account. + */ + this.ethereumNonce = props.ethereumNonce; + + /** + * Staking metadata for this account. + */ + this.stakingInfo = props.stakingInfo; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo} info + * @returns {AccountInfo} + */ + static _fromProtobuf(info) { + let aliasKey = + info.alias != null && info.alias.length > 0 + ? src_Key_Key._fromProtobufKey( + lib.proto.Key.decode(info.alias), + ) + : null; + + if (!(aliasKey instanceof src_PublicKey_PublicKey)) { + aliasKey = null; + } + + const accountId = AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ (info.accountID), + ); + + return new AccountInfo({ + accountId, + contractAccountId: + info.contractAccountID != null ? info.contractAccountID : null, + isDeleted: info.deleted != null ? info.deleted : false, + key: src_Key_Key._fromProtobufKey( + /** @type {HashgraphProto.proto.IKey} */ (info.key), + ), + balance: Hbar_Hbar.fromTinybars(info.balance != null ? info.balance : 0), + sendRecordThreshold: Hbar_Hbar.fromTinybars( + info.generateSendRecordThreshold != null + ? info.generateSendRecordThreshold + : 0, + ), + receiveRecordThreshold: Hbar_Hbar.fromTinybars( + info.generateReceiveRecordThreshold != null + ? info.generateReceiveRecordThreshold + : 0, + ), + isReceiverSignatureRequired: + info.receiverSigRequired != null + ? info.receiverSigRequired + : false, + expirationTime: Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.expirationTime + ), + ), + autoRenewPeriod: + info.autoRenewPeriod != null + ? new Duration_Duration( + /** @type {Long} */ (info.autoRenewPeriod.seconds), + ) + : new Duration_Duration(0), + proxyAccountId: + info.proxyAccountID != null && + src_long.fromValue( + /** @type {Long | number} */ (info.proxyAccountID.shardNum), + ).toInt() !== 0 && + src_long.fromValue( + /** @type {Long | number} */ (info.proxyAccountID.realmNum), + ).toInt() !== 0 && + src_long.fromValue( + /** @type {Long | number} */ ( + info.proxyAccountID.accountNum + ), + ).toInt() !== 0 + ? AccountId_AccountId._fromProtobuf(info.proxyAccountID) + : null, + proxyReceived: Hbar_Hbar.fromTinybars( + info.proxyReceived != null ? info.proxyReceived : 0, + ), + liveHashes: (info.liveHashes != null ? info.liveHashes : []).map( + (hash) => LiveHash._fromProtobuf(hash), + ), + tokenRelationships: TokenRelationshipMap._fromProtobuf( + info.tokenRelationships != null ? info.tokenRelationships : [], + ), + accountMemo: info.memo != null ? info.memo : "", + ownedNfts: info.ownedNfts ? info.ownedNfts : src_long.ZERO, + maxAutomaticTokenAssociations: info.maxAutomaticTokenAssociations + ? src_long.fromNumber(info.maxAutomaticTokenAssociations) + : src_long.ZERO, + aliasKey, + ledgerId: + info.ledgerId != null + ? LedgerId.fromBytes(info.ledgerId) + : null, + hbarAllowances: [], + tokenAllowances: [], + nftAllowances: [], + ethereumNonce: + info.ethereumNonce != null ? info.ethereumNonce : null, + stakingInfo: + info.stakingInfo != null + ? StakingInfo._fromProtobuf(info.stakingInfo) + : null, + }); + } + + /** + * @returns {HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo} + */ + _toProtobuf() { + return { + accountID: this.accountId._toProtobuf(), + contractAccountID: this.contractAccountId, + deleted: this.isDeleted, + proxyAccountID: + // eslint-disable-next-line deprecation/deprecation + this.proxyAccountId != null + ? // eslint-disable-next-line deprecation/deprecation + this.proxyAccountId._toProtobuf() + : null, + proxyReceived: this.proxyReceived.toTinybars(), + key: this.key._toProtobufKey(), + balance: this.balance.toTinybars(), + generateSendRecordThreshold: this.sendRecordThreshold.toTinybars(), + generateReceiveRecordThreshold: + this.receiveRecordThreshold.toTinybars(), + receiverSigRequired: this.isReceiverSignatureRequired, + expirationTime: this.expirationTime._toProtobuf(), + autoRenewPeriod: this.autoRenewPeriod._toProtobuf(), + liveHashes: this.liveHashes.map((hash) => hash._toProtobuf()), + tokenRelationships: + this.tokenRelationships != null + ? this.tokenRelationships._toProtobuf() + : null, + memo: this.accountMemo, + ownedNfts: this.ownedNfts, + maxAutomaticTokenAssociations: + this.maxAutomaticTokenAssociations.toInt(), + alias: + this.aliasKey != null + ? lib.proto.Key.encode( + this.aliasKey._toProtobufKey(), + ).finish() + : null, + ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null, + ethereumNonce: this.ethereumNonce, + stakingInfo: + this.stakingInfo != null + ? this.stakingInfo._toProtobuf() + : null, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {AccountInfo} + */ + static fromBytes(bytes) { + return AccountInfo._fromProtobuf( + lib.proto.CryptoGetInfoResponse.AccountInfo.decode( + bytes, + ), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.CryptoGetInfoResponse.AccountInfo.encode( + this._toProtobuf(), + ).finish(); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * @returns {AccountInfoJson} + */ + toJSON() { + return { + balance: this.balance.toString(), + accountId: this.accountId.toString(), + contractAccountId: this.contractAccountId, + isDeleted: this.isDeleted, + proxyAccountId: + // eslint-disable-next-line deprecation/deprecation + this.proxyAccountId != null + ? // eslint-disable-next-line deprecation/deprecation + this.proxyAccountId.toString() + : null, + proxyReceived: this.proxyReceived.toString(), + key: this.key != null ? this.key.toString() : null, + sendRecordThreshold: this.sendRecordThreshold.toString(), + receiveRecordThreshold: this.receiveRecordThreshold.toString(), + isReceiverSignatureRequired: this.isReceiverSignatureRequired, + expirationTime: this.expirationTime.toString(), + autoRenewPeriod: this.autoRenewPeriod.toString(), + accountMemo: this.accountMemo, + ownedNfts: this.ownedNfts.toString(), + maxAutomaticTokenAssociations: + this.maxAutomaticTokenAssociations.toString(), + aliasKey: this.aliasKey != null ? this.aliasKey.toString() : null, + ledgerId: this.ledgerId != null ? this.ledgerId.toString() : null, + ethereumNonce: + this.ethereumNonce != null + ? this.ethereumNonce.toString() + : null, + stakingInfo: + this.stakingInfo != null ? this.stakingInfo.toJSON() : null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +// eslint-disable-next-line @typescript-eslint/no-unused-vars + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.CryptoGetInfoResponse.IAccountInfo} HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo + * @typedef {import("@hashgraph/proto").proto.ICryptoGetInfoQuery} HashgraphProto.proto.ICryptoGetInfoQuery + * @typedef {import("@hashgraph/proto").proto.ICryptoGetInfoResponse} HashgraphProto.proto.ICryptoGetInfoResponse + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * @augments {Query} + */ +class AccountInfoQuery_AccountInfoQuery extends Query_Query { + /** + * @param {object} props + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {AccountInfoQuery} + */ + static _fromProtobuf(query) { + const info = /** @type {HashgraphProto.proto.ICryptoGetInfoQuery} */ ( + query.cryptoGetInfo + ); + + return new AccountInfoQuery_AccountInfoQuery({ + accountId: + info.accountID != null + ? AccountId_AccountId._fromProtobuf(info.accountID) + : undefined, + }); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * Set the account ID for which the info is being requested. + * + * @param {AccountId | string} accountId + * @returns {AccountInfoQuery} + */ + setAccountId(accountId) { + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.getAccountInfo(request); + } + + /** + * @override + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + return super.getCost(client); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const cryptoGetInfo = + /** @type {HashgraphProto.proto.ICryptoGetInfoResponse} */ ( + response.cryptoGetInfo + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + cryptoGetInfo.header + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const info = + /** @type {HashgraphProto.proto.ICryptoGetInfoResponse} */ ( + response.cryptoGetInfo + ); + + return Promise.resolve( + AccountInfo._fromProtobuf( + /** @type {HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo} */ ( + info.accountInfo + ), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + cryptoGetInfo: { + header, + accountID: + this._accountId != null + ? this._accountId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + return `AccountInfoQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("cryptoGetInfo", AccountInfoQuery_AccountInfoQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountInfoFlow.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/Transaction.js").default} Transaction + * @typedef {import("../PublicKey.js").default} PublicKey + * @typedef {import("./AccountId.js").default} AccountId + * @typedef {import("../Signer.js").Signer} Signer + */ + +class AccountInfoFlow { + /** + * @param {Client} client + * @param {AccountId | string} accountId + * @param {Uint8Array} message + * @param {Uint8Array} signature + * @returns {Promise} + */ + static async verifySignature(client, accountId, message, signature) { + const info = await new AccountInfoQuery() + .setAccountId(accountId) + .execute(client); + + if (info.key instanceof KeyList) { + return false; + } + + return /** @type {PublicKey} */ (info.key).verify(message, signature); + } + + /** + * @param {Client} client + * @param {AccountId | string} accountId + * @param {Transaction} transaction + * @returns {Promise} + */ + static async verifyTransaction(client, accountId, transaction) { + const info = await new AccountInfoQuery() + .setAccountId(accountId) + .execute(client); + + if (info.key instanceof KeyList) { + return false; + } + + return /** @type {PublicKey} */ (info.key).verifyTransaction( + transaction, + ); + } + + /** + * @param {Signer} signer + * @param {AccountId | string} accountId + * @param {Uint8Array} message + * @param {Uint8Array} signature + * @returns {Promise} + */ + static async verifySignatureWithSigner( + signer, + accountId, + message, + signature, + ) { + const info = await new AccountInfoQuery() + .setAccountId(accountId) + .executeWithSigner(signer); + + if (info.key instanceof KeyList) { + return false; + } + + return /** @type {PublicKey} */ (info.key).verify(message, signature); + } + + /** + * @param {Signer} signer + * @param {AccountId | string} accountId + * @param {Transaction} transaction + * @returns {Promise} + */ + static async verifyTransactionWithSigner(signer, accountId, transaction) { + const info = await new AccountInfoQuery() + .setAccountId(accountId) + .executeWithSigner(signer); + + if (info.key instanceof KeyList) { + return false; + } + + return /** @type {PublicKey} */ (info.key).verifyTransaction( + transaction, + ); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountRecordsQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.ICryptoGetAccountRecordsQuery} HashgraphProto.proto.ICryptoGetAccountRecordsQuery + * @typedef {import("@hashgraph/proto").proto.ICryptoGetAccountRecordsResponse} HashgraphProto.proto.ICryptoGetAccountRecordsResponse + * @typedef {import("@hashgraph/proto").proto.ITransactionRecord} HashgraphProto.proto.ITransactionRecord + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * Get all the records for an account for any transfers into it and out of it, + * that were above the threshold, during the last 25 hours. + * + * @augments {Query} + */ +class AccountRecordsQuery_AccountRecordsQuery extends Query_Query { + /** + * @param {object} [props] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @type {?AccountId} + * @private + */ + this._accountId = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {AccountRecordsQuery} + */ + static _fromProtobuf(query) { + const records = + /** @type {HashgraphProto.proto.ICryptoGetAccountRecordsQuery} */ ( + query.cryptoGetAccountRecords + ); + + return new AccountRecordsQuery_AccountRecordsQuery({ + accountId: + records.accountID != null + ? AccountId_AccountId._fromProtobuf(records.accountID) + : undefined, + }); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * Set the account ID for which the records are being requested. + * + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.getAccountRecords(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const cryptoGetAccountRecords = + /** @type {HashgraphProto.proto.ICryptoGetAccountRecordsResponse} */ ( + response.cryptoGetAccountRecords + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + cryptoGetAccountRecords.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const cryptoGetAccountRecords = + /** @type {HashgraphProto.proto.ICryptoGetAccountRecordsResponse} */ ( + response.cryptoGetAccountRecords + ); + const records = + /** @type {HashgraphProto.proto.ITransactionRecord[]} */ ( + cryptoGetAccountRecords.records + ); + + return Promise.resolve( + records.map((record) => + TransactionRecord._fromProtobuf({ transactionRecord: record }), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + cryptoGetAccountRecords: { + header, + accountID: + this._accountId != null + ? this._accountId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `AccountRecordsQuery:${timestamp.toString()}`; + } +} + +QUERY_REGISTRY.set( + "cryptoGetAccountRecords", + // eslint-disable-next-line @typescript-eslint/unbound-method + AccountRecordsQuery_AccountRecordsQuery._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/ProxyStaker.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IProxyStaker} HashgraphProto.proto.IProxyStaker + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + */ + +/** + * An account, and the amount that it sends or receives during a cryptocurrency transfer. + */ +class ProxyStaker { + /** + * @private + * @param {object} props + * @param {AccountId} props.accountId + * @param {number | string | Long | BigNumber | Hbar} props.amount + */ + constructor(props) { + /** + * The Account ID that sends or receives cryptocurrency. + * + * @readonly + */ + this.accountId = props.accountId; + + /** + * The amount of tinybars that the account sends(negative) + * or receives(positive). + * + * @readonly + */ + this.amount = + props.amount instanceof Hbar_Hbar + ? props.amount + : new Hbar_Hbar(props.amount); + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.IProxyStaker} transfer + * @returns {ProxyStaker} + */ + static _fromProtobuf(transfer) { + return new ProxyStaker({ + accountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + transfer.accountID + ), + ), + amount: Hbar_Hbar.fromTinybars( + transfer.amount != null ? transfer.amount : 0, + ), + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IProxyStaker} + */ + _toProtobuf() { + return { + accountID: this.accountId._toProtobuf(), + amount: this.amount.toTinybars(), + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountStakersQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.ICryptoGetStakersQuery} HashgraphProto.proto.ICryptoGetStakersQuery + * @typedef {import("@hashgraph/proto").proto.ICryptoGetStakersResponse} HashgraphProto.proto.ICryptoGetStakersResponse + * @typedef {import("@hashgraph/proto").proto.IAllProxyStakers} HashgraphProto.proto.IAllProxyStakers + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * Get all the accounts that are proxy staking to this account. + * For each of them, give the amount currently staked. + * + * This is not yet implemented, but will be in a future version of the API. + * + * @augments {Query} + */ +class AccountStakersQuery extends Query_Query { + /** + * @param {object} [props] + * @param {(AccountId | string)=} props.accountId + */ + constructor(props = {}) { + super(); + + /** + * @type {?AccountId} + * @private + */ + this._accountId = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {AccountStakersQuery} + */ + static _fromProtobuf(query) { + const stakers = + /** @type {HashgraphProto.proto.ICryptoGetStakersQuery} */ ( + query.cryptoGetProxyStakers + ); + + return new AccountStakersQuery({ + accountId: + stakers.accountID != null + ? AccountId_AccountId._fromProtobuf(stakers.accountID) + : undefined, + }); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * Set the account ID for which the stakers are being requested. + * + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.getStakersByAccountID(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const cryptoGetProxyStakers = + /** @type {HashgraphProto.proto.ICryptoGetStakersResponse} */ ( + response.cryptoGetProxyStakers + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + cryptoGetProxyStakers.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @returns {Promise} + */ + _mapResponse(response) { + const cryptoGetProxyStakers = + /** @type {HashgraphProto.proto.ICryptoGetStakersResponse} */ ( + response.cryptoGetProxyStakers + ); + const stakers = /** @type {HashgraphProto.proto.IAllProxyStakers} */ ( + cryptoGetProxyStakers.stakers + ); + + return Promise.resolve( + (stakers.proxyStaker != null ? stakers.proxyStaker : []).map( + (staker) => ProxyStaker._fromProtobuf(staker), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + cryptoGetProxyStakers: { + header, + accountID: + this._accountId != null + ? this._accountId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `AccountStakersQuery:${timestamp.toString()}`; + } +} + +// @ts-ignore +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("cryptoGetProxyStakers", AccountStakersQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/AccountUpdateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ICryptoUpdateTransactionBody} HashgraphProto.proto.ICryptoUpdateTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +/** + * Change properties for the given account. + */ +class AccountUpdateTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {AccountId} [props.accountId] + * @param {Key} [props.key] + * @param {boolean} [props.receiverSignatureRequired] + * @param {AccountId} [props.proxyAccountId] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {Timestamp | Date} [props.expirationTime] + * @param {string} [props.accountMemo] + * @param {Long | number} [props.maxAutomaticTokenAssociations] + * @param {Key} [props.aliasKey] + * @param {AccountId | string} [props.stakedAccountId] + * @param {Long | number} [props.stakedNodeId] + * @param {boolean} [props.declineStakingReward] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + /** + * @private + * @type {?Key} + */ + this._key = null; + + /** + * @private + * @type {?boolean} + */ + this._receiverSignatureRequired = null; + + /** + * @private + * @type {?AccountId} + */ + this._proxyAccountId = null; + + /** + * @private + * @type {?Duration} + */ + this._autoRenewPeriod = null; + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = null; + + /** + * @private + * @type {?string} + */ + this._accountMemo = null; + + /** + * @private + * @type {?Long} + */ + this._maxAutomaticTokenAssociations = null; + + /** + * @private + * @type {?Key} + */ + this._aliasKey = null; + + /** + * @private + * @type {?AccountId} + */ + this._stakedAccountId = null; + + /** + * @private + * @type {?Long} + */ + this._stakedNodeId = null; + + /** + * @private + * @type {?boolean} + */ + this._declineStakingReward = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + + if (props.key != null) { + this.setKey(props.key); + } + + if (props.receiverSignatureRequired != null) { + this.setReceiverSignatureRequired(props.receiverSignatureRequired); + } + + if (props.proxyAccountId != null) { + // eslint-disable-next-line deprecation/deprecation + this.setProxyAccountId(props.proxyAccountId); + } + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + + if (props.accountMemo != null) { + this.setAccountMemo(props.accountMemo); + } + + if (props.maxAutomaticTokenAssociations != null) { + this.setMaxAutomaticTokenAssociations( + props.maxAutomaticTokenAssociations, + ); + } + + if (props.stakedAccountId != null) { + this.setStakedAccountId(props.stakedAccountId); + } + + if (props.stakedNodeId != null) { + this.setStakedNodeId(props.stakedNodeId); + } + + if (props.declineStakingReward != null) { + this.setDeclineStakingReward(props.declineStakingReward); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {AccountUpdateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const update = + /** @type {HashgraphProto.proto.ICryptoUpdateTransactionBody} */ ( + body.cryptoUpdateAccount + ); + + return Transaction_Transaction._fromProtobufTransactions( + new AccountUpdateTransaction({ + accountId: + update.accountIDToUpdate != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + update.accountIDToUpdate + ), + ) + : undefined, + key: + update.key != null + ? src_Key_Key._fromProtobufKey(update.key) + : undefined, + receiverSignatureRequired: + update.receiverSigRequiredWrapper != null + ? update.receiverSigRequiredWrapper.value != null + ? update.receiverSigRequiredWrapper.value + : undefined + : undefined, + proxyAccountId: + update.proxyAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + update.proxyAccountID + ), + ) + : undefined, + autoRenewPeriod: + update.autoRenewPeriod != null + ? update.autoRenewPeriod.seconds != null + ? update.autoRenewPeriod.seconds + : undefined + : undefined, + expirationTime: + update.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(update.expirationTime) + : undefined, + accountMemo: + update.memo != null + ? update.memo.value != null + ? update.memo.value + : undefined + : undefined, + maxAutomaticTokenAssociations: + update.maxAutomaticTokenAssociations != null && + update.maxAutomaticTokenAssociations.value != null + ? src_long.fromNumber( + update.maxAutomaticTokenAssociations.value, + ) + : undefined, + stakedAccountId: + update.stakedAccountId != null + ? AccountId_AccountId._fromProtobuf(update.stakedAccountId) + : undefined, + stakedNodeId: + update.stakedNodeId != null + ? update.stakedNodeId + : undefined, + declineStakingReward: + update.declineReward != null + ? update.declineReward.value != null + ? update.declineReward.value + : undefined + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * Sets the account ID which is being updated in this transaction. + * + * @param {AccountId | string} accountId + * @returns {AccountUpdateTransaction} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @returns {?Key} + */ + get key() { + return this._key; + } + + /** + * @param {Key} key + * @returns {this} + */ + setKey(key) { + this._requireNotFrozen(); + this._key = key; + + return this; + } + + /** + * @returns {?boolean} + */ + get receiverSignatureRequired() { + return this._receiverSignatureRequired; + } + + /** + * @param {boolean} receiverSignatureRequired + * @returns {this} + */ + setReceiverSignatureRequired(receiverSignatureRequired) { + this._requireNotFrozen(); + this._receiverSignatureRequired = receiverSignatureRequired; + + return this; + } + + /** + * @deprecated + * @returns {?AccountId} + */ + get proxyAccountId() { + return this._proxyAccountId; + } + + /** + * @deprecated + * @param {AccountId} proxyAccountId + * @returns {this} + */ + setProxyAccountId(proxyAccountId) { + this._requireNotFrozen(); + this._proxyAccountId = proxyAccountId; + + return this; + } + + /** + * @returns {?Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * @param {Timestamp | Date} expirationTime + * @returns {this} + */ + setExpirationTime(expirationTime) { + this._requireNotFrozen(); + this._expirationTime = + expirationTime instanceof Date + ? Timestamp_Timestamp.fromDate(expirationTime) + : expirationTime; + + return this; + } + + /** + * @returns {?string} + */ + get accountMemo() { + return this._accountMemo; + } + + /** + * @param {string} memo + * @returns {this} + */ + setAccountMemo(memo) { + this._requireNotFrozen(); + this._accountMemo = memo; + + return this; + } + + /** + * @returns {this} + */ + clearAccountMemo() { + this._requireNotFrozen(); + this._accountMemo = null; + + return this; + } + + /** + * @returns {?Long} + */ + get maxAutomaticTokenAssociations() { + return this._maxAutomaticTokenAssociations; + } + + /** + * @param {Long | number} maxAutomaticTokenAssociations + * @returns {this} + */ + setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) { + this._requireNotFrozen(); + this._maxAutomaticTokenAssociations = + typeof maxAutomaticTokenAssociations === "number" + ? src_long.fromNumber(maxAutomaticTokenAssociations) + : maxAutomaticTokenAssociations; + + return this; + } + + /** + * @deprecated - no longer supported + * @returns {?Key} + */ + get aliasKey() { + return null; + } + + /** + * @deprecated - no longer supported + * @param {Key} _ + * @returns {this} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setAliasKey(_) { + return this; + } + + /** + * @returns {?AccountId} + */ + get stakedAccountId() { + return this._stakedAccountId; + } + + /** + * @param {AccountId | string} stakedAccountId + * @returns {this} + */ + setStakedAccountId(stakedAccountId) { + this._requireNotFrozen(); + this._stakedAccountId = + typeof stakedAccountId === "string" + ? AccountId_AccountId.fromString(stakedAccountId) + : stakedAccountId; + + return this; + } + + /** + * @returns {this} + */ + clearStakedAccountId() { + this._requireNotFrozen(); + this._stakedAccountId = new AccountId_AccountId(0, 0, 0); + + return this; + } + + /** + * @returns {?Long} + */ + get stakedNodeId() { + return this._stakedNodeId; + } + + /** + * @param {Long | number} stakedNodeId + * @returns {this} + */ + setStakedNodeId(stakedNodeId) { + this._requireNotFrozen(); + this._stakedNodeId = src_long.fromValue(stakedNodeId); + + return this; + } + + /** + * @returns {this} + */ + clearStakedNodeId() { + this._requireNotFrozen(); + this._stakedNodeId = src_long.fromNumber(-1); + + return this; + } + + /** + * @returns {?boolean} + */ + get declineStakingRewards() { + return this._declineStakingReward; + } + + /** + * @param {boolean} declineStakingReward + * @returns {this} + */ + setDeclineStakingReward(declineStakingReward) { + this._requireNotFrozen(); + this._declineStakingReward = declineStakingReward; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + + if (this._proxyAccountId != null) { + this._proxyAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.updateAccount(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoUpdateAccount"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoUpdateTransactionBody} + */ + _makeTransactionData() { + return { + accountIDToUpdate: + this._accountId != null ? this._accountId._toProtobuf() : null, + key: this._key != null ? this._key._toProtobufKey() : null, + expirationTime: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + proxyAccountID: + this._proxyAccountId != null + ? this._proxyAccountId._toProtobuf() + : null, + autoRenewPeriod: + this._autoRenewPeriod != null + ? this._autoRenewPeriod._toProtobuf() + : null, + receiverSigRequiredWrapper: + this._receiverSignatureRequired == null + ? null + : { + value: this._receiverSignatureRequired, + }, + memo: + this._accountMemo != null + ? { + value: this._accountMemo, + } + : null, + maxAutomaticTokenAssociations: + this._maxAutomaticTokenAssociations != null + ? { value: this._maxAutomaticTokenAssociations.toInt() } + : null, + stakedAccountId: + this.stakedAccountId != null + ? this.stakedAccountId._toProtobuf() + : null, + stakedNodeId: this.stakedNodeId, + declineReward: + this.declineStakingRewards != null + ? { value: this.declineStakingRewards } + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `AccountUpdateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoUpdateAccount", + // eslint-disable-next-line @typescript-eslint/unbound-method + AccountUpdateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/address_book/IPv4AddressPart.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +class IPv4AddressPart { + /** + * @param {object} props + * @param {number} [props.left] + * @param {number} [props.right] + */ + constructor(props = {}) { + /** + * @type {number | null} + */ + this._left = null; + + if (props.left != null) { + this.setLeft(props.left); + } + + /** + * @type {number | null} + */ + this._right = null; + + if (props.right != null) { + this.setRight(props.right); + } + } + + /** + * @returns {?number} + */ + get left() { + return this._left; + } + + /** + * @param {number} part + * @returns {this} + */ + setLeft(part) { + this._left = part; + return this; + } + + /** + * @returns {?number} + */ + get right() { + return this._right; + } + + /** + * @param {number} part + * @returns {this} + */ + setRight(part) { + this._right = part; + return this; + } + + /** + * @returns {string} + */ + toString() { + if (this._left != null && this._right != null) { + return `${this._left.toString()}.${this._right.toString()}`; + } else { + return ""; + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/address_book/IPv4Address.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +class IPv4Address { + /** + * @param {object} props + * @param {IPv4AddressPart} [props.network] + * @param {IPv4AddressPart} [props.host] + */ + constructor(props = {}) { + /** + * @type {IPv4AddressPart | null} + */ + this._network = null; + + if (props.network != null) { + this.setNetwork(props.network); + } + + /** + * @type {IPv4AddressPart | null} + */ + this._host = null; + + if (props.host != null) { + this.setHost(props.host); + } + } + + /** + * @returns {?IPv4AddressPart} + */ + get newtork() { + return this._network; + } + + /** + * @param {IPv4AddressPart} part + * @returns {this} + */ + setNetwork(part) { + this._network = part; + return this; + } + + /** + * @returns {?IPv4AddressPart} + */ + get host() { + return this._host; + } + + /** + * @param {IPv4AddressPart} part + * @returns {this} + */ + setHost(part) { + this._host = part; + return this; + } + + /** + * @internal + * @param {Uint8Array} bytes + * @returns {IPv4Address} + */ + static _fromProtobuf(bytes) { + return new IPv4Address({ + network: new IPv4AddressPart().setLeft(bytes[0]).setRight(bytes[1]), + host: new IPv4AddressPart().setLeft(bytes[2]).setRight(bytes[3]), + }); + } + + /** + * @returns {Uint8Array} + */ + _toProtobuf() { + return Uint8Array.of( + this._network != null && this._network._left != null + ? this._network._left + : 0, + this._network != null && this._network.right != null + ? this._network.right + : 0, + this._host != null && this._host.left != null ? this._host.left : 0, + this._host != null && this._host.right != null + ? this._host.right + : 0, + ); + } + + /** + * @returns {string} + */ + toString() { + if (this._network != null && this._host != null) { + return `${this._network.toString()}.${this._host.toString()}`; + } else { + return ""; + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/address_book/Endpoint.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IServiceEndpoint} HashgraphProto.proto.IServiceEndpoint + */ + +/** + * @typedef {object} EndPointJson + * @property {string | null} address + * @property {string | null} port + */ + +class EndPoint { + /** + * @param {object} props + * @param {IPv4Address} [props.address] + * @param {number} [props.port] + */ + constructor(props = {}) { + /** + * @type {IPv4Address | null} + */ + this._address = null; + + if (props.address != null) { + this.setAddress(props.address); + } + + /** + * @type {number | null} + */ + this._port = null; + + if (props.port != null) { + this.setPort(props.port); + } + } + + /** + * @returns {?IPv4Address} + */ + get address() { + return this.address; + } + + /** + * @param {IPv4Address} address + * @returns {this} + */ + setAddress(address) { + this._address = address; + return this; + } + + /** + * @returns {?number} + */ + get port() { + return this._port; + } + + /** + * @param {number} port + * @returns {this} + */ + setPort(port) { + this._port = port; + return this; + } + + /** + * @internal + * @param {HashgraphProto.proto.IServiceEndpoint} endpoint + * @returns {EndPoint} + */ + static _fromProtobuf(endpoint) { + return new EndPoint({ + address: + endpoint.ipAddressV4 != null + ? IPv4Address._fromProtobuf(endpoint.ipAddressV4) + : undefined, + port: endpoint.port != null ? endpoint.port : undefined, + }); + } + + /** + * @returns {HashgraphProto.proto.IServiceEndpoint} + */ + _toProtobuf() { + return { + ipAddressV4: + this._address != null ? this._address._toProtobuf() : null, + port: this._port, + }; + } + + /** + * @returns {string} + */ + toString() { + return `${this._address != null ? this._address.toString() : ""}:${ + this._port != null ? this._port.toString() : "" + }`; + } + + /** + * @returns {EndPointJson} + */ + toJSON() { + return { + address: this._address != null ? this._address.toString() : null, + port: this._port != null ? this._port.toString() : null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/address_book/NodeAddress.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.INodeAddress} HashgraphProto.proto.INodeAddress + */ + +/** + * @typedef {import("./Endpoint.js").EndPointJson} EndpointJson + * @typedef {import("long").Long} Long + */ + +/** + * @typedef {object} NodeAddressJson + * @property {string | null} publicKey + * @property {string | null} nodeId + * @property {string | null} accountId + * @property {string | null} certHash + * @property {EndpointJson[] | null} addresses + * @property {string | null} description + * @property {string | null} stake + */ + +class NodeAddress { + /** + * @param {object} props + * @param {string} [props.publicKey] + * @param {Long} [props.nodeId] + * @param {AccountId | string} [props.accountId] + * @param {Uint8Array} [props.certHash] + * @param {Endpoint[]} [props.addresses] + * @param {string} [props.description] + * @param {Long} [props.stake] + */ + constructor(props = {}) { + /** + * @type {string | null} + */ + this._publicKey = null; + + if (props.publicKey != null) { + this.setPublicKey(props.publicKey); + } + + /** + * @type {Long |null} + */ + this._nodeId = null; + + if (props.nodeId != null) { + this.setNodeId(props.nodeId); + } + + /** + * @type {AccountId | null} + */ + this._accountId = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + + /** + * @type {Uint8Array | null} + */ + this._certHash = null; + + if (props.certHash != null) { + this.setCertHash(props.certHash); + } + + /** + * @type {Endpoint[]} + */ + this._addresses = []; + + if (props.addresses != null) { + this.setAddresses(props.addresses); + } + + /** + * @type {string | null} + */ + this._description = null; + + if (props.description != null) { + this.setDescription(props.description); + } + + /** + * @type {Long | null} + */ + this._stake = null; + + if (props.stake != null) { + this.setStake(props.stake); + } + } + + /** + * @returns {?string} + */ + get publicKey() { + return this._publicKey; + } + + /** + * @param {string} publicKey + * @returns {this} + */ + setPublicKey(publicKey) { + this._publicKey = publicKey; + return this; + } + + /** + * @returns {?Long} + */ + get nodeId() { + return this._nodeId; + } + + /** + * @param {Long} nodeId + * @returns {this} + */ + setNodeId(nodeId) { + this._nodeId = nodeId; + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + return this; + } + + /** + * @returns {?Uint8Array} + */ + get certHash() { + return this._certHash; + } + + /** + * @param {Uint8Array} certHash + * @returns {this} + */ + setCertHash(certHash) { + this._certHash = certHash; + return this; + } + + /** + * @returns {Endpoint[]} + */ + get addresses() { + return this._addresses; + } + + /** + * @param {Endpoint[]} addresses + * @returns {this} + */ + setAddresses(addresses) { + this._addresses = addresses; + return this; + } + + /** + * @returns {?string} + */ + get description() { + return this._description; + } + + /** + * @param {string} description + * @returns {this} + */ + setDescription(description) { + this._description = description; + return this; + } + + /** + * @returns {?Long} + */ + get stake() { + return this._stake; + } + + /** + * @param {Long} stake + * @returns {this} + */ + setStake(stake) { + this._stake = stake; + return this; + } + + /** + * @internal + * @param {HashgraphProto.proto.INodeAddress} nodeAddress + * @returns {NodeAddress} + */ + static _fromProtobuf(nodeAddress) { + return new NodeAddress({ + publicKey: + nodeAddress.RSA_PubKey != null + ? nodeAddress.RSA_PubKey + : undefined, + nodeId: nodeAddress.nodeId != null ? nodeAddress.nodeId : undefined, + accountId: + nodeAddress.nodeAccountId != null + ? AccountId_AccountId._fromProtobuf(nodeAddress.nodeAccountId) + : undefined, + certHash: + nodeAddress.nodeCertHash != null + ? nodeAddress.nodeCertHash + : undefined, + addresses: + nodeAddress.serviceEndpoint != null + ? nodeAddress.serviceEndpoint.map((address) => + EndPoint._fromProtobuf(address), + ) + : undefined, + description: + nodeAddress.description != null + ? nodeAddress.description + : undefined, + stake: nodeAddress.stake != null ? nodeAddress.stake : undefined, + }); + } + + /** + * @returns {HashgraphProto.proto.INodeAddress} + */ + _toProtobuf() { + return { + RSA_PubKey: this._publicKey, + nodeId: this._nodeId, + nodeAccountId: + this._accountId != null ? this._accountId._toProtobuf() : null, + nodeCertHash: this._certHash, + serviceEndpoint: this._addresses.map((address) => + address._toProtobuf(), + ), + description: this._description, + stake: this._stake, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * @returns {NodeAddressJson} + */ + toJSON() { + return { + publicKey: this._publicKey, + nodeId: this._nodeId != null ? this._nodeId.toString() : null, + accountId: + this._accountId != null ? this._accountId.toString() : null, + certHash: + this._certHash != null ? encoding_utf8_browser_decode(this._certHash) : null, + addresses: this._addresses.map((address) => address.toJSON()), + description: this._description, + stake: this._stake != null ? this._stake.toString() : null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/address_book/NodeAddressBook.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @typedef {import("./NodeAddress.js").NodeAddressJson} NodeAddressJson + */ + +/** + * @typedef {object} NodeAddressBookJson + * @property {NodeAddressJson[]} nodeAddresses + */ + +class NodeAddressBook { + /** + * @param {object} props + * @param {NodeAddress[]} [props.nodeAddresses] + */ + constructor(props = {}) { + /** + * @type {NodeAddress[]} + */ + this._nodeAddresses = []; + + if (props.nodeAddresses != null) { + this.setNodeAddresses(props.nodeAddresses); + } + } + + /** + * @returns {NodeAddress[]} + */ + get nodeAddresses() { + return this._nodeAddresses; + } + + /** + * @param {NodeAddress[]} nodeAddresses + * @returns {this} + */ + setNodeAddresses(nodeAddresses) { + this._nodeAddresses = nodeAddresses; + return this; + } + + /** + * @param {Uint8Array} bytes + * @returns {NodeAddressBook} + */ + static fromBytes(bytes) { + return NodeAddressBook._fromProtobuf( + lib.proto.NodeAddressBook.decode(bytes), + ); + } + + /** + * @internal + * @param {HashgraphProto.proto.INodeAddressBook} nodeAddressBook + * @returns {NodeAddressBook} + */ + static _fromProtobuf(nodeAddressBook) { + return new NodeAddressBook({ + nodeAddresses: + nodeAddressBook.nodeAddress != null + ? nodeAddressBook.nodeAddress.map((nodeAddress) => + NodeAddress._fromProtobuf(nodeAddress), + ) + : undefined, + }); + } + + /** + * @returns {HashgraphProto.proto.INodeAddressBook} + */ + _toProtobuf() { + return { + nodeAddress: this._nodeAddresses.map((nodeAddress) => + nodeAddress._toProtobuf(), + ), + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON()); + } + + /** + * @returns {NodeAddressBookJson} + */ + toJSON() { + return { + nodeAddresses: this._nodeAddresses.map((nodeAddress) => + nodeAddress.toJSON(), + ), + }; + } + + toBytes() { + return lib.proto.NodeAddressBook.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/network/AddressBookQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("../channel/MirrorChannel.js").MirrorError} MirrorError + */ + +/** + * @template {Channel} ChannelT + * @typedef {import("../client/Client.js").default} Client + */ + +/** + * @augments {Query} + */ +class AddressBookQuery extends Query_Query { + /** + * @param {object} props + * @param {FileId | string} [props.fileId] + * @param {number} [props.limit] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?FileId} + */ + this._fileId = null; + if (props.fileId != null) { + this.setFileId(props.fileId); + } + + /** + * @private + * @type {?number} + */ + this._limit = null; + if (props.limit != null) { + this.setLimit(props.limit); + } + + /** + * @private + * @type {(error: MirrorError | Error | null) => boolean} + */ + this._retryHandler = (error) => { + if (error != null) { + if (error instanceof Error) { + // Retry on all errors which are not `MirrorError` because they're + // likely lower level HTTP/2 errors + return true; + } else { + // Retry on `NOT_FOUND`, `RESOURCE_EXHAUSTED`, `UNAVAILABLE`, and conditionally on `INTERNAL` + // if the message matches the right regex. + switch (error.code) { + // INTERNAL + // eslint-disable-next-line no-fallthrough + case 13: + return Executable_RST_STREAM.test(error.details.toString()); + // NOT_FOUND + // eslint-disable-next-line no-fallthrough + case 5: + // RESOURCE_EXHAUSTED + // eslint-disable-next-line no-fallthrough + case 8: + // UNAVAILABLE + // eslint-disable-next-line no-fallthrough + case 14: + case 17: + return true; + default: + return false; + } + } + } + + return false; + }; + + /** @type {NodeAddress[]} */ + this._addresses = []; + + /** + * @private + * @type {number} + */ + this._attempt = 0; + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * @param {FileId | string} fileId + * @returns {AddressBookQuery} + */ + setFileId(fileId) { + this._fileId = + typeof fileId === "string" + ? FileId.fromString(fileId) + : fileId.clone(); + + return this; + } + + /** + * @returns {?number} + */ + get limit() { + return this._limit; + } + + /** + * @param {number} limit + * @returns {AddressBookQuery} + */ + setLimit(limit) { + this._limit = limit; + + return this; + } + + /** + * @param {number} attempts + * @returns {this} + */ + setMaxAttempts(attempts) { + this._maxAttempts = attempts; + return this; + } + + /** + * @param {number} backoff + * @returns {this} + */ + setMaxBackoff(backoff) { + this._maxBackoff = backoff; + return this; + } + + /** + * @param {Client} client + * @param {number=} requestTimeout + * @returns {Promise} + */ + execute(client, requestTimeout) { + return new Promise((resolve, reject) => { + this._makeServerStreamRequest( + client, + /** @type {(value: NodeAddressBook) => void} */ (resolve), + reject, + requestTimeout, + ); + }); + } + + /** + * @private + * @param {Client} client + * @param {(value: NodeAddressBook) => void} resolve + * @param {(error: Error) => void} reject + * @param {number=} requestTimeout + */ + _makeServerStreamRequest(client, resolve, reject, requestTimeout) { + const request = + lib.com.hedera.mirror.api.proto.AddressBookQuery.encode({ + fileId: + this._fileId != null ? this._fileId._toProtobuf() : null, + limit: this._limit, + }).finish(); + + client._mirrorNetwork + .getNextMirrorNode() + .getChannel() + .makeServerStreamRequest( + "NetworkService", + "getNodes", + request, + (data) => { + this._addresses.push( + NodeAddress._fromProtobuf( + lib.proto.NodeAddress.decode(data), + ), + ); + + if (this._limit != null && this._limit > 0) { + this._limit = this._limit - 1; + } + }, + (error) => { + const message = + error instanceof Error ? error.message : error.details; + if ( + this._attempt < this._maxAttempts && + !client.isClientShutDown && + this._retryHandler(error) + ) { + const delay = Math.min( + 250 * 2 ** this._attempt, + this._maxBackoff, + ); + if (this._attempt >= this._maxAttempts) { + console.warn( + `Error getting nodes from mirror for file ${ + this._fileId != null + ? this._fileId.toString() + : "UNKNOWN" + } during attempt ${ + this._attempt + }. Waiting ${delay} ms before next attempt: ${message}`, + ); + } + if (this._logger) { + this._logger.debug( + `Error getting nodes from mirror for file ${ + this._fileId != null + ? this._fileId.toString() + : "UNKNOWN" + } during attempt ${ + this._attempt + }. Waiting ${delay} ms before next attempt: ${message}`, + ); + } + + this._attempt += 1; + + setTimeout(() => { + this._makeServerStreamRequest( + client, + resolve, + reject, + requestTimeout, + ); + }, delay); + } else { + reject(new Error("failed to query address book")); + } + }, + () => { + resolve( + new NodeAddressBook({ nodeAddresses: this._addresses }), + ); + }, + ); + } +} + +src_Cache.setAddressBookQueryConstructor(() => new AddressBookQuery()); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractByteCodeQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.IContractGetBytecodeQuery} HashgraphProto.proto.IContractGetBytecodeQuery + * @typedef {import("@hashgraph/proto").proto.IContractGetBytecodeResponse} HashgraphProto.proto.IContractGetBytecodeResponse + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ + +/** + * @augments {Query} + */ +class ContractByteCodeQuery extends Query_Query { + /** + * @param {object} props + * @param {ContractId | string} [props.contractId] + */ + constructor(props = {}) { + super(); + + /** + * @type {?ContractId} + * @private + */ + this._contractId = null; + if (props.contractId != null) { + this.setContractId(props.contractId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {ContractByteCodeQuery} + */ + static _fromProtobuf(query) { + const bytecode = + /** @type {HashgraphProto.proto.IContractGetBytecodeQuery} */ ( + query.contractGetBytecode + ); + + return new ContractByteCodeQuery({ + contractId: + bytecode.contractID != null + ? ContractId_ContractId._fromProtobuf(bytecode.contractID) + : undefined, + }); + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * Set the contract ID for which the info is being requested. + * + * @param {ContractId | string} contractId + * @returns {ContractByteCodeQuery} + */ + setContractId(contractId) { + this._contractId = + typeof contractId === "string" + ? ContractId_ContractId.fromString(contractId) + : contractId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._contractId != null) { + this._contractId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.contractGetBytecode(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const contractGetBytecodeResponse = + /** @type {HashgraphProto.proto.IContractGetBytecodeResponse} */ ( + response.contractGetBytecodeResponse + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + contractGetBytecodeResponse.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @returns {Promise} + */ + _mapResponse(response) { + const contractGetBytecodeResponse = + /** @type {HashgraphProto.proto.IContractGetBytecodeResponse} */ ( + response.contractGetBytecodeResponse + ); + + return Promise.resolve( + contractGetBytecodeResponse.bytecode != null + ? contractGetBytecodeResponse.bytecode + : new Uint8Array(), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + contractGetBytecode: { + header, + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `ContractByteCodeQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("contractGetBytecode", ContractByteCodeQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/cryptography/keccak.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +// Originally sourced from: +// https://github.com/MaiaVictor/eth-lib/blob/da0971f5b09964d9c8449975fa87933f0c9fef35/src/hash.js +// - added type declarations +// - switched to es6 module syntax +// +// Disable linting for entire file because it's nearly all pure JS +// eslint-disable + +const keccak_HEX_CHARS = "0123456789abcdef".split(""); +const keccak_KECCAK_PADDING = [1, 256, 65536, 16777216]; +const keccak_SHIFT = [0, 8, 16, 24]; +const keccak_RC = [ + 1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, + 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, + 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, + 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, + 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, + 2147483649, 0, 2147516424, 2147483648, +]; + +/** + * @typedef {object} KeccakT + * @property {number[]} blocks + * @property {number} blockCount + * @property {number} outputBlocks + * @property {number[]} s + * @property {number} start + * @property {number} block + * @property {boolean} reset + * @property {number=} lastByteIndex + */ + +/** @type {(bits: number) => KeccakT} */ +const keccak_Keccak = (bits) => ({ + blocks: [], + reset: true, + block: 0, + start: 0, + blockCount: (1600 - (bits << 1)) >> 5, + outputBlocks: bits >> 5, + // @ts-ignore + s: ((s) => [].concat(s, s, s, s, s))([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), +}); + +/** @type {(state: KeccakT, message: string | number[]) => string} */ +//NOSONAR +const keccak_update = (state, /** @type {string | number[]} */ message) => { + var length = message.length, + blocks = state.blocks, + byteCount = state.blockCount << 2, + blockCount = state.blockCount, + outputBlocks = state.outputBlocks, + s = state.s, + index = 0, + i, + code; + + // update + while (index < length) { + if (state.reset) { + state.reset = false; + blocks[0] = state.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (typeof message !== "string") { + for (i = state.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << keccak_SHIFT[i++ & 3]; + } + } else { + for (i = state.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << keccak_SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << keccak_SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << keccak_SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << keccak_SHIFT[i++ & 3]; + blocks[i >> 2] |= + (0x80 | ((code >> 6) & 0x3f)) << keccak_SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << keccak_SHIFT[i++ & 3]; + } else { + code = + 0x10000 + + (((code & 0x3ff) << 10) | + (message.charCodeAt(++index) & 0x3ff)); //NOSONAR + blocks[i >> 2] |= (0xf0 | (code >> 18)) << keccak_SHIFT[i++ & 3]; + blocks[i >> 2] |= + (0x80 | ((code >> 12) & 0x3f)) << keccak_SHIFT[i++ & 3]; + blocks[i >> 2] |= + (0x80 | ((code >> 6) & 0x3f)) << keccak_SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << keccak_SHIFT[i++ & 3]; + } + } + } + state.lastByteIndex = i; + if (i >= byteCount) { + state.start = i - byteCount; + state.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + keccak_f(s); + state.reset = true; + } else { + state.start = i; + } + } + + // finalize + i = state.lastByteIndex; + // @ts-ignore + blocks[i >> 2] |= keccak_KECCAK_PADDING[i & 3]; + if (state.lastByteIndex === byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + keccak_f(s); + + // toString + var hex = ""; + var block; + var j = 0; + i = 0; //NOSONAR + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += + keccak_HEX_CHARS[(block >> 4) & 0x0f] + + keccak_HEX_CHARS[block & 0x0f] + + keccak_HEX_CHARS[(block >> 12) & 0x0f] + + keccak_HEX_CHARS[(block >> 8) & 0x0f] + + keccak_HEX_CHARS[(block >> 20) & 0x0f] + + keccak_HEX_CHARS[(block >> 16) & 0x0f] + + keccak_HEX_CHARS[(block >> 28) & 0x0f] + + keccak_HEX_CHARS[(block >> 24) & 0x0f]; + } + if (j % blockCount === 0) { + keccak_f(s); + i = 0; //NOSONAR + } + } + // @ts-ignore + return "0x" + hex; +}; + +/** @type {(s: number[]) => void} */ +const keccak_f = (s) => { + var h, + l, + n, + c0, + c1, + c2, + c3, + c4, + c5, + c6, + c7, + c8, + c9, + b0, + b1, + b2, + b3, + b4, + b5, + b6, + b7, + b8, + b9, + b10, + b11, + b12, + b13, + b14, + b15, + b16, + b17, + b18, + b19, + b20, + b21, + b22, + b23, + b24, + b25, + b26, + b27, + b28, + b29, + b30, + b31, + b32, + b33, + b34, + b35, + b36, + b37, + b38, + b39, + b40, + b41, + b42, + b43, + b44, + b45, + b46, + b47, + b48, + b49; + + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= keccak_RC[n]; + s[1] ^= keccak_RC[n + 1]; + } +}; + +const keccak_keccak = (/** @type {number} */ bits) => (/** @type {string} */ str) => { + var msg; + if (str.slice(0, 2) === "0x") { + msg = []; + for (var i = 2, l = str.length; i < l; i += 2) + msg.push(parseInt(str.slice(i, i + 2), 16)); + } else { + msg = str; + } + // @ts-ignore + return keccak_update(keccak_Keccak(bits), msg); +}; + +/** + * @type {(message: string) => string} + */ +const cryptography_keccak_keccak256 = keccak_keccak(256); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractFunctionSelector.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @enum {number} + */ +const ArgumentType = { + uint8: 0, + int8: 1, + uint16: 2, + int16: 3, + uint24: 4, + int24: 5, + uint32: 6, + int32: 7, + uint40: 8, + int40: 9, + uint48: 10, + int48: 11, + uint56: 12, + int56: 13, + uint64: 14, + int64: 15, + uint72: 16, + int72: 17, + uint80: 18, + int80: 19, + uint88: 20, + int88: 21, + uint96: 22, + int96: 23, + uint104: 24, + int104: 25, + uint112: 26, + int112: 27, + uint120: 28, + int120: 29, + uint128: 30, + int128: 31, + uint136: 32, + int136: 33, + uint144: 34, + int144: 35, + uint152: 36, + int152: 37, + uint160: 38, + int160: 39, + uint168: 40, + int168: 41, + uint176: 42, + int176: 43, + uint184: 44, + int184: 45, + uint192: 46, + int192: 47, + uint200: 48, + int200: 49, + uint208: 50, + int208: 51, + uint216: 52, + int216: 53, + uint224: 54, + int224: 55, + uint232: 56, + int232: 57, + uint240: 58, + int240: 59, + uint248: 60, + int248: 61, + uint256: 62, + int256: 63, + string: 64, + bool: 65, + bytes: 66, + bytes32: 67, + address: 68, + func: 69, +}; + +/** + * @typedef {object} Argument + * @property {boolean} dynamic + * @property {Uint8Array} value + */ + +/** + * @typedef {object} SolidityType + * @property {ArgumentType} ty + * @property {boolean} array + */ + +class ContractFunctionSelector { + /** + * @param {string} [name] + */ + constructor(name) { + /** + * @type {?string} + */ + this.name = null; + + /** + * @type {string} + */ + this._params = ""; + + /** + * @type {SolidityType[]} + */ + this._paramTypes = []; + + if (name != null) { + this._name = name; + } + } + + /** + * @returns {ContractFunctionSelector} + */ + addString() { + return this._addParam({ ty: ArgumentType.string, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addStringArray() { + return this._addParam({ ty: ArgumentType.string, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addBytes() { + return this._addParam({ ty: ArgumentType.bytes, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addBytes32() { + return this._addParam({ ty: ArgumentType.bytes32, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addBytesArray() { + return this._addParam({ ty: ArgumentType.bytes, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addBytes32Array() { + return this._addParam({ ty: ArgumentType.bytes32, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt8() { + return this._addParam({ ty: ArgumentType.int8, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint8() { + return this._addParam({ ty: ArgumentType.uint8, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt16() { + return this._addParam({ ty: ArgumentType.int16, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint16() { + return this._addParam({ ty: ArgumentType.uint16, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt24() { + return this._addParam({ ty: ArgumentType.int24, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint24() { + return this._addParam({ ty: ArgumentType.uint24, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt32() { + return this._addParam({ ty: ArgumentType.int32, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint32() { + return this._addParam({ ty: ArgumentType.uint32, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt40() { + return this._addParam({ ty: ArgumentType.int40, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint40() { + return this._addParam({ ty: ArgumentType.uint40, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt48() { + return this._addParam({ ty: ArgumentType.int48, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint48() { + return this._addParam({ ty: ArgumentType.uint48, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt56() { + return this._addParam({ ty: ArgumentType.int56, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint56() { + return this._addParam({ ty: ArgumentType.uint56, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt64() { + return this._addParam({ ty: ArgumentType.int64, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint64() { + return this._addParam({ ty: ArgumentType.uint64, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt72() { + return this._addParam({ ty: ArgumentType.int72, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint72() { + return this._addParam({ ty: ArgumentType.uint72, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt80() { + return this._addParam({ ty: ArgumentType.int80, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint80() { + return this._addParam({ ty: ArgumentType.uint80, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt88() { + return this._addParam({ ty: ArgumentType.int88, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint88() { + return this._addParam({ ty: ArgumentType.uint88, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt96() { + return this._addParam({ ty: ArgumentType.int96, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint96() { + return this._addParam({ ty: ArgumentType.uint96, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt104() { + return this._addParam({ ty: ArgumentType.int104, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint104() { + return this._addParam({ ty: ArgumentType.uint104, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt112() { + return this._addParam({ ty: ArgumentType.int112, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint112() { + return this._addParam({ ty: ArgumentType.uint112, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt120() { + return this._addParam({ ty: ArgumentType.int120, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint120() { + return this._addParam({ ty: ArgumentType.uint120, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt128() { + return this._addParam({ ty: ArgumentType.int128, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint128() { + return this._addParam({ ty: ArgumentType.uint128, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt136() { + return this._addParam({ ty: ArgumentType.int136, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint136() { + return this._addParam({ ty: ArgumentType.uint136, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt144() { + return this._addParam({ ty: ArgumentType.int144, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint144() { + return this._addParam({ ty: ArgumentType.uint144, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt152() { + return this._addParam({ ty: ArgumentType.int152, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint152() { + return this._addParam({ ty: ArgumentType.uint152, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt160() { + return this._addParam({ ty: ArgumentType.int160, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint160() { + return this._addParam({ ty: ArgumentType.uint160, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt168() { + return this._addParam({ ty: ArgumentType.int168, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint168() { + return this._addParam({ ty: ArgumentType.uint168, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt176() { + return this._addParam({ ty: ArgumentType.int176, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint176() { + return this._addParam({ ty: ArgumentType.uint176, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt184() { + return this._addParam({ ty: ArgumentType.int184, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint184() { + return this._addParam({ ty: ArgumentType.uint184, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt192() { + return this._addParam({ ty: ArgumentType.int192, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint192() { + return this._addParam({ ty: ArgumentType.uint192, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt200() { + return this._addParam({ ty: ArgumentType.int200, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint200() { + return this._addParam({ ty: ArgumentType.uint200, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt208() { + return this._addParam({ ty: ArgumentType.int208, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint208() { + return this._addParam({ ty: ArgumentType.uint208, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt216() { + return this._addParam({ ty: ArgumentType.int216, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint216() { + return this._addParam({ ty: ArgumentType.uint216, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt224() { + return this._addParam({ ty: ArgumentType.int224, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint224() { + return this._addParam({ ty: ArgumentType.uint224, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt232() { + return this._addParam({ ty: ArgumentType.int232, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint232() { + return this._addParam({ ty: ArgumentType.uint232, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt240() { + return this._addParam({ ty: ArgumentType.int240, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint240() { + return this._addParam({ ty: ArgumentType.uint240, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt248() { + return this._addParam({ ty: ArgumentType.int248, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint248() { + return this._addParam({ ty: ArgumentType.uint248, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt256() { + return this._addParam({ ty: ArgumentType.int256, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint256() { + return this._addParam({ ty: ArgumentType.uint256, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt8Array() { + return this._addParam({ ty: ArgumentType.int8, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint8Array() { + return this._addParam({ ty: ArgumentType.uint8, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt16Array() { + return this._addParam({ ty: ArgumentType.int16, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint16Array() { + return this._addParam({ ty: ArgumentType.uint16, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt24Array() { + return this._addParam({ ty: ArgumentType.int24, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint24Array() { + return this._addParam({ ty: ArgumentType.uint24, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt32Array() { + return this._addParam({ ty: ArgumentType.int32, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint32Array() { + return this._addParam({ ty: ArgumentType.uint32, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt40Array() { + return this._addParam({ ty: ArgumentType.int40, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint40Array() { + return this._addParam({ ty: ArgumentType.uint40, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt48Array() { + return this._addParam({ ty: ArgumentType.int48, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint48Array() { + return this._addParam({ ty: ArgumentType.uint48, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt56Array() { + return this._addParam({ ty: ArgumentType.int56, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint56Array() { + return this._addParam({ ty: ArgumentType.uint56, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt64Array() { + return this._addParam({ ty: ArgumentType.int64, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint64Array() { + return this._addParam({ ty: ArgumentType.uint64, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt72Array() { + return this._addParam({ ty: ArgumentType.int72, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint72Array() { + return this._addParam({ ty: ArgumentType.uint72, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt80Array() { + return this._addParam({ ty: ArgumentType.int80, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint80Array() { + return this._addParam({ ty: ArgumentType.uint80, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt88Array() { + return this._addParam({ ty: ArgumentType.int88, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint88Array() { + return this._addParam({ ty: ArgumentType.uint88, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt96Array() { + return this._addParam({ ty: ArgumentType.int96, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint96Array() { + return this._addParam({ ty: ArgumentType.uint96, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt104Array() { + return this._addParam({ ty: ArgumentType.int104, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint104Array() { + return this._addParam({ ty: ArgumentType.uint104, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt112Array() { + return this._addParam({ ty: ArgumentType.int112, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint112Array() { + return this._addParam({ ty: ArgumentType.uint112, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt120Array() { + return this._addParam({ ty: ArgumentType.int120, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint120Array() { + return this._addParam({ ty: ArgumentType.uint120, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt128Array() { + return this._addParam({ ty: ArgumentType.int128, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint128Array() { + return this._addParam({ ty: ArgumentType.uint128, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt136Array() { + return this._addParam({ ty: ArgumentType.int136, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint136Array() { + return this._addParam({ ty: ArgumentType.uint136, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt144Array() { + return this._addParam({ ty: ArgumentType.int144, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint144Array() { + return this._addParam({ ty: ArgumentType.uint144, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt152Array() { + return this._addParam({ ty: ArgumentType.int152, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint152Array() { + return this._addParam({ ty: ArgumentType.uint152, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt160Array() { + return this._addParam({ ty: ArgumentType.int160, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint160Array() { + return this._addParam({ ty: ArgumentType.uint160, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt168Array() { + return this._addParam({ ty: ArgumentType.int168, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint168Array() { + return this._addParam({ ty: ArgumentType.uint168, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt176Array() { + return this._addParam({ ty: ArgumentType.int176, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint176Array() { + return this._addParam({ ty: ArgumentType.uint176, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt184Array() { + return this._addParam({ ty: ArgumentType.int184, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint184Array() { + return this._addParam({ ty: ArgumentType.uint184, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt192Array() { + return this._addParam({ ty: ArgumentType.int192, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint192Array() { + return this._addParam({ ty: ArgumentType.uint192, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt200Array() { + return this._addParam({ ty: ArgumentType.int200, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint200Array() { + return this._addParam({ ty: ArgumentType.uint200, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt208Array() { + return this._addParam({ ty: ArgumentType.int208, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint208Array() { + return this._addParam({ ty: ArgumentType.uint208, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt216Array() { + return this._addParam({ ty: ArgumentType.int216, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint216Array() { + return this._addParam({ ty: ArgumentType.uint216, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt224Array() { + return this._addParam({ ty: ArgumentType.int224, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint224Array() { + return this._addParam({ ty: ArgumentType.uint224, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt232Array() { + return this._addParam({ ty: ArgumentType.int232, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint232Array() { + return this._addParam({ ty: ArgumentType.uint232, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt240Array() { + return this._addParam({ ty: ArgumentType.int240, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint240Array() { + return this._addParam({ ty: ArgumentType.uint240, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt248Array() { + return this._addParam({ ty: ArgumentType.int248, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint248Array() { + return this._addParam({ ty: ArgumentType.uint248, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addInt256Array() { + return this._addParam({ ty: ArgumentType.int256, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addUint256Array() { + return this._addParam({ ty: ArgumentType.uint256, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addBool() { + return this._addParam({ ty: ArgumentType.bool, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addAddress() { + return this._addParam({ ty: ArgumentType.address, array: false }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addAddressArray() { + return this._addParam({ ty: ArgumentType.address, array: true }); + } + + /** + * @returns {ContractFunctionSelector} + */ + addFunction() { + return this._addParam({ ty: ArgumentType.func, array: false }); + } + + /** + * @param {SolidityType} ty + * @returns {ContractFunctionSelector} + */ + _addParam(ty) { + if (this._paramTypes.length > 0) { + this._params += ","; + } + + this._params += solidityTypeToString(ty); + this._paramTypes.push(ty); + + return this; + } + + /** + * @param {string} [name] + * @returns {Uint8Array} + */ + _build(name) { + if (name != null) { + this._name = name; + } else if (this._name == null) { + throw new Error("`name` required for ContractFunctionSelector"); + } + + const func = hex_browser_encode(encoding_utf8_browser_encode(this.toString())); + return decode(cryptography_keccak_keccak256(`0x${func}`)).slice(0, 4); + } + + /** + * @returns {string} + */ + toString() { + return `${this._name != null ? this._name.toString() : ""}(${ + this._params + })`; + } +} + +/** + * @param {SolidityType} ty + * @returns {string} + */ +function solidityTypeToString(ty) { + let s = ""; + switch (ty.ty) { + case ArgumentType.uint8: + s = "uint8"; + break; + case ArgumentType.int8: + s = "int8"; + break; + case ArgumentType.uint16: + s = "uint16"; + break; + case ArgumentType.int16: + s = "int16"; + break; + case ArgumentType.uint24: + s = "uint24"; + break; + case ArgumentType.int24: + s = "int24"; + break; + case ArgumentType.uint32: + s = "uint32"; + break; + case ArgumentType.int32: + s = "int32"; + break; + case ArgumentType.uint40: + s = "uint40"; + break; + case ArgumentType.int40: + s = "int40"; + break; + case ArgumentType.uint48: + s = "uint48"; + break; + case ArgumentType.int48: + s = "int48"; + break; + case ArgumentType.uint56: + s = "uint56"; + break; + case ArgumentType.int56: + s = "int56"; + break; + case ArgumentType.uint64: + s = "uint64"; + break; + case ArgumentType.int64: + s = "int64"; + break; + case ArgumentType.uint72: + s = "uint72"; + break; + case ArgumentType.int72: + s = "int72"; + break; + case ArgumentType.uint80: + s = "uint80"; + break; + case ArgumentType.int80: + s = "int80"; + break; + case ArgumentType.uint88: + s = "uint88"; + break; + case ArgumentType.int88: + s = "int88"; + break; + case ArgumentType.uint96: + s = "uint96"; + break; + case ArgumentType.int96: + s = "int96"; + break; + case ArgumentType.uint104: + s = "uint104"; + break; + case ArgumentType.int104: + s = "int104"; + break; + case ArgumentType.uint112: + s = "uint112"; + break; + case ArgumentType.int112: + s = "int112"; + break; + case ArgumentType.uint120: + s = "uint120"; + break; + case ArgumentType.int120: + s = "int120"; + break; + case ArgumentType.uint128: + s = "uint128"; + break; + case ArgumentType.int128: + s = "int128"; + break; + case ArgumentType.uint136: + s = "uint136"; + break; + case ArgumentType.int136: + s = "int136"; + break; + case ArgumentType.uint144: + s = "uint144"; + break; + case ArgumentType.int144: + s = "int144"; + break; + case ArgumentType.uint152: + s = "uint152"; + break; + case ArgumentType.int152: + s = "int152"; + break; + case ArgumentType.uint160: + s = "uint160"; + break; + case ArgumentType.int160: + s = "int160"; + break; + case ArgumentType.uint168: + s = "uint168"; + break; + case ArgumentType.int168: + s = "int168"; + break; + case ArgumentType.uint176: + s = "uint176"; + break; + case ArgumentType.int176: + s = "int176"; + break; + case ArgumentType.uint184: + s = "uint184"; + break; + case ArgumentType.int184: + s = "int184"; + break; + case ArgumentType.uint192: + s = "uint192"; + break; + case ArgumentType.int192: + s = "int192"; + break; + case ArgumentType.uint200: + s = "uint200"; + break; + case ArgumentType.int200: + s = "int200"; + break; + case ArgumentType.uint208: + s = "uint208"; + break; + case ArgumentType.int208: + s = "int208"; + break; + case ArgumentType.uint216: + s = "uint216"; + break; + case ArgumentType.int216: + s = "int216"; + break; + case ArgumentType.uint224: + s = "uint224"; + break; + case ArgumentType.int224: + s = "int224"; + break; + case ArgumentType.uint232: + s = "uint232"; + break; + case ArgumentType.int232: + s = "int232"; + break; + case ArgumentType.uint240: + s = "uint240"; + break; + case ArgumentType.int240: + s = "int240"; + break; + case ArgumentType.uint248: + s = "uint248"; + break; + case ArgumentType.int248: + s = "int248"; + break; + case ArgumentType.uint256: + s = "uint256"; + break; + case ArgumentType.int256: + s = "int256"; + break; + case ArgumentType.string: + s = "string"; + break; + case ArgumentType.bool: + s = "bool"; + break; + case ArgumentType.bytes: + s = "bytes"; + break; + case ArgumentType.bytes32: + s = "bytes32"; + break; + case ArgumentType.address: + s = "address"; + break; + case ArgumentType.func: + s = "function"; + break; + default: + s = ""; + break; + } + + if (ty.array) { + s += "[]"; + } + + return s; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +// eslint-disable-next-line @typescript-eslint/no-unused-vars + + + + +// eslint-disable-next-line @typescript-eslint/no-unused-vars + + +class ContractFunctionParameters { + constructor() { + /** + * @type {ContractFunctionSelector} + */ + this._selector = new ContractFunctionSelector(); + + /** + * @type {import("./ContractFunctionSelector.js").Argument[]} + */ + this._arguments = []; + } + + /** + * @param {string} value + * @returns {ContractFunctionParameters} + */ + addString(value) { + this._selector.addString(); + return this._addParam(value, true); + } + + /** + * @param {string[]} value + * @returns {ContractFunctionParameters} + */ + addStringArray(value) { + this._selector.addStringArray(); + return this._addParam(value, true); + } + + /** + * @param {Uint8Array} value + * @returns {ContractFunctionParameters} + */ + addBytes(value) { + this._selector.addBytes(); + return this._addParam(value, true); + } + + /** + * @param {Uint8Array} value + * @returns {ContractFunctionParameters} + */ + addBytes32(value) { + if (value.length !== 32) { + throw new Error( + `addBytes32 expected array to be of length 32, but received ${value.length}`, + ); + } + + this._selector.addBytes32(); + return this._addParam(value, false); + } + + /** + * @param {Uint8Array[]} value + * @returns {ContractFunctionParameters} + */ + addBytesArray(value) { + this._selector.addBytesArray(); + return this._addParam(value, true); + } + + /** + * @param {Uint8Array[]} value + * @returns {ContractFunctionParameters} + */ + addBytes32Array(value) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const [_, entry] of value.entries()) { + if (entry.length !== 32) { + throw new Error( + `addBytes32 expected array to be of length 32, but received ${entry.length}`, + ); + } + } + + this._selector.addBytes32Array(); + return this._addParam(value, true); + } + + /** + * @param {boolean} value + * @returns {ContractFunctionParameters} + */ + addBool(value) { + this._selector.addBool(); + return this._addParam(value, false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt8(value) { + this._selector.addInt8(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint8(value) { + this._selector.addUint8(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt16(value) { + this._selector.addInt16(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint16(value) { + this._selector.addUint16(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt24(value) { + this._selector.addInt24(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint24(value) { + this._selector.addUint24(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt32(value) { + this._selector.addInt32(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint32(value) { + this._selector.addUint32(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt40(value) { + this._selector.addInt40(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint40(value) { + this._selector.addUint40(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt48(value) { + this._selector.addInt48(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint48(value) { + this._selector.addUint48(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt56(value) { + this._selector.addInt56(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint56(value) { + this._selector.addUint56(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt64(value) { + this._selector.addInt64(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint64(value) { + this._selector.addUint64(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt72(value) { + this._selector.addInt72(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint72(value) { + this._selector.addUint72(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt80(value) { + this._selector.addInt80(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint80(value) { + this._selector.addUint80(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt88(value) { + this._selector.addInt88(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint88(value) { + this._selector.addUint88(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt96(value) { + this._selector.addInt96(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint96(value) { + this._selector.addUint96(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt104(value) { + this._selector.addInt104(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint104(value) { + this._selector.addUint104(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt112(value) { + this._selector.addInt112(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint112(value) { + this._selector.addUint112(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt120(value) { + this._selector.addInt120(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint120(value) { + this._selector.addUint120(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt128(value) { + this._selector.addInt128(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint128(value) { + this._selector.addUint128(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt136(value) { + this._selector.addInt136(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint136(value) { + this._selector.addUint136(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt144(value) { + this._selector.addInt144(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint144(value) { + this._selector.addUint144(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt152(value) { + this._selector.addInt152(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint152(value) { + this._selector.addUint152(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt160(value) { + this._selector.addInt160(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint160(value) { + this._selector.addUint160(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt168(value) { + this._selector.addInt168(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint168(value) { + this._selector.addUint168(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt176(value) { + this._selector.addInt176(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint176(value) { + this._selector.addUint176(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt184(value) { + this._selector.addInt184(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint184(value) { + this._selector.addUint184(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt192(value) { + this._selector.addInt192(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint192(value) { + this._selector.addUint192(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt200(value) { + this._selector.addInt200(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint200(value) { + this._selector.addUint200(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt208(value) { + this._selector.addInt208(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint208(value) { + this._selector.addUint208(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt216(value) { + this._selector.addInt216(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint216(value) { + this._selector.addUint216(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt224(value) { + this._selector.addInt224(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint224(value) { + this._selector.addUint224(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt232(value) { + this._selector.addInt232(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint232(value) { + this._selector.addUint232(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt240(value) { + this._selector.addInt240(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint240(value) { + this._selector.addUint240(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt248(value) { + this._selector.addInt248(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint248(value) { + this._selector.addUint248(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addInt256(value) { + this._selector.addInt256(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number | BigNumber | Long} value + * @returns {ContractFunctionParameters} + */ + addUint256(value) { + this._selector.addUint256(); + return this._addParam(convertToBigNumber(value), false); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt8Array(value) { + this._selector.addInt8Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint8Array(value) { + this._selector.addUint8Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt16Array(value) { + this._selector.addInt16Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint16Array(value) { + this._selector.addUint16Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt24Array(value) { + this._selector.addInt24Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint24Array(value) { + this._selector.addUint24Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt32Array(value) { + this._selector.addInt32Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint32Array(value) { + this._selector.addUint32Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt40Array(value) { + this._selector.addInt40Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint40Array(value) { + this._selector.addUint40Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt48Array(value) { + this._selector.addInt48Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint48Array(value) { + this._selector.addUint48Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt56Array(value) { + this._selector.addInt56Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint56Array(value) { + this._selector.addUint56Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt64Array(value) { + this._selector.addInt64Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint64Array(value) { + this._selector.addUint64Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt72Array(value) { + this._selector.addInt72Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint72Array(value) { + this._selector.addUint72Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt80Array(value) { + this._selector.addInt80Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint80Array(value) { + this._selector.addUint80Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt88Array(value) { + this._selector.addInt88Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint88Array(value) { + this._selector.addUint88Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt96Array(value) { + this._selector.addInt96Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint96Array(value) { + this._selector.addUint96Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt104Array(value) { + this._selector.addInt104Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint104Array(value) { + this._selector.addUint104Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt112Array(value) { + this._selector.addInt112Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint112Array(value) { + this._selector.addUint112Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt120Array(value) { + this._selector.addInt120Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint120Array(value) { + this._selector.addUint120Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt128Array(value) { + this._selector.addInt128Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint128Array(value) { + this._selector.addUint128Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt136Array(value) { + this._selector.addInt136Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint136Array(value) { + this._selector.addUint136Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt144Array(value) { + this._selector.addInt144Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint144Array(value) { + this._selector.addUint144Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt152Array(value) { + this._selector.addInt152Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint152Array(value) { + this._selector.addUint152Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt160Array(value) { + this._selector.addInt160Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint160Array(value) { + this._selector.addUint160Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt168Array(value) { + this._selector.addInt168Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint168Array(value) { + this._selector.addUint168Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt176Array(value) { + this._selector.addInt176Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint176Array(value) { + this._selector.addUint176Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt184Array(value) { + this._selector.addInt184Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint184Array(value) { + this._selector.addUint184Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt192Array(value) { + this._selector.addInt192Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint192Array(value) { + this._selector.addUint192Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt200Array(value) { + this._selector.addInt200Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint200Array(value) { + this._selector.addUint200Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt208Array(value) { + this._selector.addInt208Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint208Array(value) { + this._selector.addUint208Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt216Array(value) { + this._selector.addInt216Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint216Array(value) { + this._selector.addUint216Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt224Array(value) { + this._selector.addInt224Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint224Array(value) { + this._selector.addUint224Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt232Array(value) { + this._selector.addInt232Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint232Array(value) { + this._selector.addUint232Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt240Array(value) { + this._selector.addInt240Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint240Array(value) { + this._selector.addUint240Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt248Array(value) { + this._selector.addInt248Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint248Array(value) { + this._selector.addUint248Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addInt256Array(value) { + this._selector.addInt256Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {number[] | BigNumber[] | Long[]} value + * @returns {ContractFunctionParameters} + */ + addUint256Array(value) { + this._selector.addUint256Array(); + return this._addParam(convertToBigNumberArray(value), true); + } + + /** + * @param {string | EvmAddress} value + * @returns {ContractFunctionParameters} + */ + addAddress(value) { + let address; + if (typeof value === "string") { + // Allow `0x` prefix + if (value.length !== 40 && value.length !== 42) { + throw new Error( + "`address` type requires parameter to be 40 or 42 characters", + ); + } + address = value; + } else { + address = value.toString(); + } + + const par = + address.length === 40 + ? decode(address) + : decode(address.substring(2)); + + this._selector.addAddress(); + + return this._addParam(par, false); + } + + /** + * @param {string[] | EvmAddress[]} value + * @returns {ContractFunctionParameters} + */ + addAddressArray(value) { + /** + * @type {Uint8Array[]} + */ + const par = []; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const [_, entry] of value.entries()) { + let address; + if (typeof entry === "string") { + if (entry.length !== 40 && entry.length !== 42) { + throw new Error( + "`address` type requires parameter to be 40 or 42 characters", + ); + } + address = entry; + } else { + address = entry.toString(); + } + + const buf = + address.length === 40 + ? decode(address) + : decode(address.substring(2)); + + par.push(buf); + } + + this._selector.addAddressArray(); + + return this._addParam(par, true); + } + + /** + * @param {string} address + * @param {ContractFunctionSelector} selector + * @returns {ContractFunctionParameters} + */ + addFunction(address, selector) { + const addressParam = decode(address); + const functionSelector = selector._build(); + + if (addressParam.length !== 20) { + throw new Error( + "`function` type requires parameter `address` to be exactly 20 bytes", + ); + } + + this._selector.addFunction(); + + const proto = new Uint8Array(24); + proto.set(addressParam, 0); + proto.set(functionSelector, 20); + + return this._addParam(proto, false); + } + + /** + * @internal + * @param {string | boolean | number | Uint8Array | BigNumber | string[] | boolean[] | number[] | Uint8Array[] | BigNumber[]} param + * @param {boolean} dynamic + * @returns {ContractFunctionParameters} + */ + _addParam(param, dynamic) { + const index = this._selector._paramTypes.length - 1; + const value = argumentToBytes(param, this._selector._paramTypes[index]); + + this._arguments.push({ dynamic, value }); + return this; + } + + /** + * @internal + * @param {string=} name + * @returns {Uint8Array} + */ + _build(name) { + const includeId = name != null; + const nameOffset = includeId ? 4 : 0; + + const length = + this._arguments.length === 0 + ? nameOffset + : this._arguments.length * 32 + + this._arguments + .map((arg) => (arg.dynamic ? arg.value.length : 0)) + .reduce((sum, value) => sum + value) + + nameOffset; + + const func = new Uint8Array(length); + + if (includeId) { + func.set(this._selector._build(name), 0); + } + + let offset = 32 * this._arguments.length; + + for (const [i, { dynamic, value }] of this._arguments.entries()) { + if (dynamic) { + const view = safeView(func, nameOffset + i * 32 + 28); + view.setUint32(0, offset); + func.set(value, view.getUint32(0) + nameOffset); + offset += value.length; + } else { + func.set(value, nameOffset + i * 32); + } + } + + return func; + } +} + +/** + * @param {string | boolean | number | Uint8Array | BigNumber | string[] | boolean[] | number[] | Uint8Array[] | BigNumber[]} param + * @param {import("./ContractFunctionSelector.js").SolidityType} ty + * @returns {Uint8Array} + */ +function argumentToBytes(param, ty) { + let value = new Uint8Array(32); + let valueView = safeView(value); + /** @type {Uint8Array} */ + let par; + + if (ty.array) { + if (!Array.isArray(param)) { + throw new TypeError( + "SolidityType indicates type is array, but parameter is not an array", + ); + } + + /** + * @type {Uint8Array[]} + */ + const values = []; + + // Generic over any type of array + // Destructuring required so the first variable must be assigned + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const [_, p] of param.entries()) { + const arg = argumentToBytes(p, { ty: ty.ty, array: false }); + values.push(arg); + } + + const totalLengthOfValues = values + .map((a) => a.length) + .reduce((total, current) => total + current, 0); + + switch (ty.ty) { + case ArgumentType.uint8: + case ArgumentType.int8: + case ArgumentType.uint16: + case ArgumentType.int16: + case ArgumentType.uint24: + case ArgumentType.int24: + case ArgumentType.uint32: + case ArgumentType.int32: + case ArgumentType.uint40: + case ArgumentType.int40: + case ArgumentType.uint48: + case ArgumentType.int48: + case ArgumentType.uint56: + case ArgumentType.int56: + case ArgumentType.uint64: + case ArgumentType.int64: + case ArgumentType.uint72: + case ArgumentType.int72: + case ArgumentType.uint80: + case ArgumentType.int80: + case ArgumentType.uint88: + case ArgumentType.int88: + case ArgumentType.uint96: + case ArgumentType.int96: + case ArgumentType.uint104: + case ArgumentType.int104: + case ArgumentType.uint112: + case ArgumentType.int112: + case ArgumentType.uint120: + case ArgumentType.int120: + case ArgumentType.uint128: + case ArgumentType.int128: + case ArgumentType.uint136: + case ArgumentType.int136: + case ArgumentType.uint144: + case ArgumentType.int144: + case ArgumentType.uint152: + case ArgumentType.int152: + case ArgumentType.uint160: + case ArgumentType.int160: + case ArgumentType.uint168: + case ArgumentType.int168: + case ArgumentType.uint176: + case ArgumentType.int176: + case ArgumentType.uint184: + case ArgumentType.int184: + case ArgumentType.uint192: + case ArgumentType.int192: + case ArgumentType.uint200: + case ArgumentType.int200: + case ArgumentType.uint208: + case ArgumentType.int208: + case ArgumentType.uint216: + case ArgumentType.int216: + case ArgumentType.uint224: + case ArgumentType.int224: + case ArgumentType.uint232: + case ArgumentType.int232: + case ArgumentType.uint240: + case ArgumentType.int240: + case ArgumentType.uint248: + case ArgumentType.int248: + case ArgumentType.uint256: + case ArgumentType.int256: + case ArgumentType.bool: + case ArgumentType.bytes32: + case ArgumentType.address: + case ArgumentType.func: + value = new Uint8Array(totalLengthOfValues + 32); + break; + case ArgumentType.bytes: + case ArgumentType.string: + value = new Uint8Array( + values.length * 32 + totalLengthOfValues + 32, + ); + break; + default: + throw new TypeError( + `Expected param type to be ArgumentType, but received ${ty.ty}`, + ); + } + + valueView = safeView(value, 28); + valueView.setUint32(0, values.length); + + let offset = 32 * values.length; + + for (const [i, e] of values.entries()) { + switch (ty.ty) { + case ArgumentType.uint8: + case ArgumentType.int8: + case ArgumentType.uint16: + case ArgumentType.int16: + case ArgumentType.uint24: + case ArgumentType.int24: + case ArgumentType.uint32: + case ArgumentType.int32: + case ArgumentType.uint40: + case ArgumentType.int40: + case ArgumentType.uint48: + case ArgumentType.int48: + case ArgumentType.uint56: + case ArgumentType.int56: + case ArgumentType.uint64: + case ArgumentType.int64: + case ArgumentType.uint72: + case ArgumentType.int72: + case ArgumentType.uint80: + case ArgumentType.int80: + case ArgumentType.uint88: + case ArgumentType.int88: + case ArgumentType.uint96: + case ArgumentType.int96: + case ArgumentType.uint104: + case ArgumentType.int104: + case ArgumentType.uint112: + case ArgumentType.int112: + case ArgumentType.uint120: + case ArgumentType.int120: + case ArgumentType.uint128: + case ArgumentType.int128: + case ArgumentType.uint136: + case ArgumentType.int136: + case ArgumentType.uint144: + case ArgumentType.int144: + case ArgumentType.uint152: + case ArgumentType.int152: + case ArgumentType.uint160: + case ArgumentType.int160: + case ArgumentType.uint168: + case ArgumentType.int168: + case ArgumentType.uint176: + case ArgumentType.int176: + case ArgumentType.uint184: + case ArgumentType.int184: + case ArgumentType.uint192: + case ArgumentType.int192: + case ArgumentType.uint200: + case ArgumentType.int200: + case ArgumentType.uint208: + case ArgumentType.int208: + case ArgumentType.uint216: + case ArgumentType.int216: + case ArgumentType.uint224: + case ArgumentType.int224: + case ArgumentType.uint232: + case ArgumentType.int232: + case ArgumentType.uint240: + case ArgumentType.int240: + case ArgumentType.uint248: + case ArgumentType.int248: + case ArgumentType.uint256: + case ArgumentType.int256: + case ArgumentType.bool: + case ArgumentType.bytes32: + case ArgumentType.address: + case ArgumentType.func: + value.set(e, i * 32 + 32); + break; + case ArgumentType.bytes: + case ArgumentType.string: + // eslint-disable-next-line no-case-declarations + const view = safeView(value, (i + 1) * 32 + 28); + view.setUint32(0, offset); + value.set(e, view.getUint32(0) + 32); + offset += e.length; + break; + default: + throw new TypeError( + `Expected param type to be ArgumentType, but received ${ty.ty}`, + ); + } + } + + return value; + } + + switch (ty.ty) { + case ArgumentType.uint8: + case ArgumentType.int8: + case ArgumentType.uint16: + case ArgumentType.int16: + case ArgumentType.uint24: + case ArgumentType.int24: + case ArgumentType.uint32: + case ArgumentType.int32: + case ArgumentType.uint40: + case ArgumentType.int40: + case ArgumentType.uint48: + case ArgumentType.int48: + case ArgumentType.uint56: + case ArgumentType.int56: + case ArgumentType.uint64: + case ArgumentType.int64: + case ArgumentType.uint72: + case ArgumentType.int72: + case ArgumentType.uint80: + case ArgumentType.int80: + case ArgumentType.uint88: + case ArgumentType.int88: + case ArgumentType.uint96: + case ArgumentType.int96: + case ArgumentType.uint104: + case ArgumentType.int104: + case ArgumentType.uint112: + case ArgumentType.int112: + case ArgumentType.uint120: + case ArgumentType.int120: + case ArgumentType.uint128: + case ArgumentType.int128: + case ArgumentType.uint136: + case ArgumentType.int136: + case ArgumentType.uint144: + case ArgumentType.int144: + case ArgumentType.uint152: + case ArgumentType.int152: + case ArgumentType.uint160: + case ArgumentType.int160: + case ArgumentType.uint168: + case ArgumentType.int168: + case ArgumentType.uint176: + case ArgumentType.int176: + case ArgumentType.uint184: + case ArgumentType.int184: + case ArgumentType.uint192: + case ArgumentType.int192: + case ArgumentType.uint200: + case ArgumentType.int200: + case ArgumentType.uint208: + case ArgumentType.int208: + case ArgumentType.uint216: + case ArgumentType.int216: + case ArgumentType.uint224: + case ArgumentType.int224: + case ArgumentType.uint232: + case ArgumentType.int232: + case ArgumentType.uint240: + case ArgumentType.int240: + case ArgumentType.uint248: + case ArgumentType.int248: + case ArgumentType.int256: + case ArgumentType.uint256: { + let paramToHex = param.toString(16); + + // @ts-ignore + if (param > 0 || param == 0) { + paramToHex = "0x" + paramToHex; + } else { + paramToHex = + paramToHex.slice(0, 1) + "0x" + paramToHex.slice(1); + } + + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call + const encodedData = defaultAbiCoder.encode( + [solidityTypeToString(ty)], + [paramToHex], + ); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const dataToArrayify = lib_esm_arrayify(encodedData); + return dataToArrayify; + } + case ArgumentType.address: + value.set(/** @type {Uint8Array} */ (param), 32 - 20); + return value; + case ArgumentType.bool: + value[31] = /** @type {boolean} */ (param) ? 1 : 0; + return value; + case ArgumentType.func: + value.set(/** @type {Uint8Array} */ (param), 32 - 24); + return value; + case ArgumentType.bytes32: + value.set(/** @type {Uint8Array} */ (param), 0); + return value; + // Bytes should have not the length already encoded + // JS String type is encoded as UTF-16 whilst Solidity `string` type is UTF-8 encoded. + // So if will assume is already correctly updated to being a Uint8Array of UTF-8 string + case ArgumentType.bytes: + case ArgumentType.string: { + // If value is of type string, encode it in UTF-8 format and conver it to Uint8Array + // Required because JS Strings are UTF-16 + // eslint-disable-next-line no-case-declarations + par = + param instanceof Uint8Array + ? param + : encoding_utf8_browser_encode(/** @type {string} */ (param)); + + // Resize value to a 32 byte boundary if needed + if (Math.floor(par.length / 32) >= 0) { + if (Math.floor(par.length % 32) !== 0) { + value = new Uint8Array( + (Math.floor(par.length / 32) + 1) * 32 + 32, + ); + } else { + value = new Uint8Array( + Math.floor(par.length / 32) * 32 + 32, + ); + } + } else { + value = new Uint8Array(64); + } + + value.set(par, 32); + + valueView = safeView(value, 28); + valueView.setUint32(0, par.length); + return value; + } + default: + throw new Error(`Unsupported argument type: ${ty.toString()}`); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractCallQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +/** + * @typedef {object} FunctionParameters + * @property {ContractFunctionParameters} parameters + * @property {string} name + */ + +/** + * @augments {Query} + */ +class ContractCallQuery extends Query_Query { + /** + * @param {object} [props] + * @param {ContractId | string} [props.contractId] + * @param {number | Long} [props.gas] + * @param {FunctionParameters | Uint8Array} [props.functionParameters] + * @param {number | Long} [props.maxResultSize] + * @param {AccountId | string} [props.senderAccountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?ContractId} + */ + this._contractId = null; + if (props.contractId != null) { + this.setContractId(props.contractId); + } + + /** + * @private + * @type {?Long} + */ + this._gas = null; + if (props.gas != null) { + this.setGas(props.gas); + } + + /** + * @private + * @type {?Uint8Array} + */ + this._functionParameters = null; + if (props.functionParameters != null) { + if (props.functionParameters instanceof Uint8Array) { + this.setFunctionParameters(props.functionParameters); + } else { + this.setFunction( + props.functionParameters.name, + props.functionParameters.parameters, + ); + } + } + + /** + * @private + * @type {?Long} + */ + this._maxResultSize = null; + if (props.maxResultSize != null) { + this.setMaxResultSize(props.maxResultSize); + } + + /** + * @private + * @type {?AccountId} + */ + this._senderAccountId = null; + if (props.senderAccountId != null) { + this.setSenderAccountId(props.senderAccountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {ContractCallQuery} + */ + static _fromProtobuf(query) { + const call = + /** @type {HashgraphProto.proto.IContractCallLocalQuery} */ ( + query.contractCallLocal + ); + + return new ContractCallQuery({ + contractId: + call.contractID != null + ? ContractId_ContractId._fromProtobuf(call.contractID) + : undefined, + gas: call.gas != null ? call.gas : undefined, + functionParameters: + call.functionParameters != null + ? call.functionParameters + : undefined, + maxResultSize: + call.maxResultSize != null ? call.maxResultSize : undefined, + }); + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * Set the contract ID for which the call is being requested. + * + * @param {ContractId | string} contractId + * @returns {ContractCallQuery} + */ + setContractId(contractId) { + this._contractId = + typeof contractId === "string" + ? ContractId_ContractId.fromString(contractId) + : contractId.clone(); + + return this; + } + + /** + * @returns {?Long} + */ + get gas() { + return this._gas; + } + + /** + * @param {number | Long} gas + * @returns {ContractCallQuery} + */ + setGas(gas) { + this._gas = gas instanceof src_long ? gas : src_long.fromValue(gas); + return this; + } + + /** + * @returns {?AccountId} + */ + get senderAccountId() { + return this._senderAccountId; + } + + /** + * @param {AccountId | string} senderAccountId + * @returns {ContractCallQuery} + */ + setSenderAccountId(senderAccountId) { + this._senderAccountId = + typeof senderAccountId === "string" + ? AccountId_AccountId.fromString(senderAccountId) + : senderAccountId; + return this; + } + + /** + * @returns {?Uint8Array} + */ + get functionParameters() { + return this._functionParameters; + } + + /** + * @param {Uint8Array} params + * @returns {ContractCallQuery} + */ + setFunctionParameters(params) { + this._functionParameters = params; + return this; + } + + /** + * @param {string} name + * @param {?ContractFunctionParameters} [params] + * @returns {ContractCallQuery} + */ + setFunction(name, params) { + this._functionParameters = ( + params != null ? params : new ContractFunctionParameters() + )._build(name); + + return this; + } + + /** + * @param {number | Long} size + * @returns {ContractCallQuery} + */ + setMaxResultSize(size) { + this._maxResultSize = + size instanceof src_long ? size : src_long.fromValue(size); + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._contractId != null) { + this._contractId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeId + * @returns {Error} + */ + _mapStatusError(request, response, nodeId) { + const { nodeTransactionPrecheckCode } = + this._mapResponseHeader(response); + + const status = Status._fromCode( + nodeTransactionPrecheckCode != null + ? nodeTransactionPrecheckCode + : lib.proto.ResponseCodeEnum.OK, + ); + + const call = + /** + *@type {HashgraphProto.proto.IContractCallLocalResponse} + */ + (response.contractCallLocal); + if (!call.functionResult) { + return new PrecheckStatusError({ + nodeId, + status, + transactionId: this._getTransactionId(), + contractFunctionResult: null, + }); + } + + const contractFunctionResult = this._mapResponseSync(response); + + return new PrecheckStatusError({ + nodeId, + status, + transactionId: this._getTransactionId(), + contractFunctionResult, + }); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.contractCallLocalMethod(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const contractCallLocal = + /** @type {HashgraphProto.proto.IContractCallLocalResponse} */ ( + response.contractCallLocal + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + contractCallLocal.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @returns {Promise} + */ + _mapResponse(response) { + const call = + /** + *@type {HashgraphProto.proto.IContractCallLocalResponse} + */ + (response.contractCallLocal); + + return Promise.resolve( + ContractFunctionResult._fromProtobuf( + /** + * @type {HashgraphProto.proto.IContractFunctionResult} + */ + (call.functionResult), + false, + ), + ); + } + + /** + * @private + * @param {HashgraphProto.proto.IResponse} response + * @returns {ContractFunctionResult} + */ + _mapResponseSync(response) { + const call = + /** + *@type {HashgraphProto.proto.IContractCallLocalResponse} + */ + (response.contractCallLocal); + + return ContractFunctionResult._fromProtobuf( + /** + * @type {HashgraphProto.proto.IContractFunctionResult} + */ + (call.functionResult), + false, + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + contractCallLocal: { + header, + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + gas: this._gas, + maxResultSize: this._maxResultSize, + functionParameters: this._functionParameters, + senderId: + this._senderAccountId != null + ? this._senderAccountId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `ContractCallQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("contractCallLocal", ContractCallQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileCreateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IFileCreateTransactionBody} HashgraphProto.proto.IFileCreateTransactionBody + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +/** + * Create a new Hedera™ crypto-currency file. + */ +class FileCreateTransaction_FileCreateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Key[] | KeyList} [props.keys] + * @param {Timestamp | Date} [props.expirationTime] + * @param {Uint8Array | string} [props.contents] + * @param {string} [props.fileMemo] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?Key[]} + */ + this._keys = null; + + /** + * @private + * @type {Timestamp} + */ + this._expirationTime = new Timestamp_Timestamp(0, 0).plusNanos( + src_long.fromNumber(Date.now()) + .mul(1000000) + .add(DEFAULT_AUTO_RENEW_PERIOD.mul(1000000000)), + ); + + /** + * @private + * @type {?Uint8Array} + */ + this._contents = null; + + /** + * @private + * @type {?string} + */ + this._fileMemo = null; + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + + if (props.keys != null) { + this.setKeys(props.keys); + } + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + + if (props.contents != null) { + this.setContents(props.contents); + } + + if (props.fileMemo && props.fileMemo != null) { + this.setFileMemo(props.fileMemo); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {FileCreateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const create = + /** @type {HashgraphProto.proto.IFileCreateTransactionBody} */ ( + body.fileCreate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new FileCreateTransaction_FileCreateTransaction({ + keys: + create.keys != null + ? create.keys.keys != null + ? create.keys.keys.map((key) => + src_Key_Key._fromProtobufKey(key), + ) + : undefined + : undefined, + expirationTime: + create.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(create.expirationTime) + : undefined, + contents: create.contents != null ? create.contents : undefined, + fileMemo: create.memo != null ? create.memo : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?Key[]} + */ + get keys() { + return this._keys; + } + + /** + * Set the keys which must sign any transactions modifying this file. Required. + * + * All keys must sign to modify the file's contents or keys. No key is required + * to sign for extending the expiration time (except the one for the operator account + * paying for the transaction). Only one key must sign to delete the file, however. + * + * To require more than one key to sign to delete a file, add them to a + * KeyList and pass that here. + * + * The network currently requires a file to have at least one key (or key list or threshold key) + * but this requirement may be lifted in the future. + * + * @param {Key[] | KeyList} keys + * @returns {this} + */ + setKeys(keys) { + this._requireNotFrozen(); + if (keys instanceof src_KeyList_KeyList && keys.threshold != null) { + throw new Error("Cannot set threshold key as file key"); + } + + this._keys = keys instanceof src_KeyList_KeyList ? keys.toArray() : keys; + + return this; + } + + /** + * @returns {Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * Set the instant at which this file will expire, after which its contents will no longer be + * available. + * + * Defaults to 1/4 of a Julian year from the instant FileCreateTransaction + * was invoked. + * + * May be extended using FileUpdateTransaction#setExpirationTime(Timestamp). + * + * @param {Timestamp | Date} expirationTime + * @returns {this} + */ + setExpirationTime(expirationTime) { + this._requireNotFrozen(); + this._expirationTime = + expirationTime instanceof Timestamp_Timestamp + ? expirationTime + : Timestamp_Timestamp.fromDate(expirationTime); + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get contents() { + return this._contents; + } + + /** + * Set the given byte array as the file's contents. + * + * This may be omitted to create an empty file. + * + * Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the + * network; if you exceed this you may receive a HederaPreCheckStatusException + * with Status#TransactionOversize. + * + * In this case, you will need to break the data into chunks of less than ~6KiB and execute this + * transaction with the first chunk and then use FileAppendTransaction with + * FileAppendTransaction#setContents(Uint8Array) for the remaining chunks. + * + * @param {Uint8Array | string} contents + * @returns {this} + */ + setContents(contents) { + this._requireNotFrozen(); + this._contents = + contents instanceof Uint8Array ? contents : encoding_utf8_browser_encode(contents); + + return this; + } + + /** + * @returns {?string} + */ + get fileMemo() { + return this._fileMemo; + } + + /** + * @param {string} memo + * @returns {this} + */ + setFileMemo(memo) { + this._requireNotFrozen(); + this._fileMemo = memo; + + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.file.createFile(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "fileCreate"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IFileCreateTransactionBody} + */ + _makeTransactionData() { + return { + keys: + this._keys != null + ? { + keys: this._keys.map((key) => key._toProtobufKey()), + } + : null, + expirationTime: this._expirationTime._toProtobuf(), + contents: this._contents, + memo: this._fileMemo, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `FileCreateTransaction:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +TRANSACTION_REGISTRY.set("fileCreate", FileCreateTransaction_FileCreateTransaction._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileAppendTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IFileAppendTransactionBody} HashgraphProto.proto.IFileAppendTransactionBody + * @typedef {import("@hashgraph/proto").proto.IFileID} HashgraphProto.proto.IFileID + */ + +/** + * @typedef {import("../PublicKey.js").default} PublicKey + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default} Client + * @typedef {import("../transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("../schedule/ScheduleCreateTransaction.js").default} ScheduleCreateTransaction + */ + +/** + * A transaction specifically to append data to a file on the network. + * + * If a file has multiple keys, all keys must sign to modify its contents. + */ +class FileAppendTransaction_FileAppendTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {FileId | string} [props.fileId] + * @param {Uint8Array | string} [props.contents] + * @param {number} [props.maxChunks] + * @param {number} [props.chunkSize] + * @param {number} [props.chunkInterval] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?FileId} + */ + this._fileId = null; + + /** + * @private + * @type {?Uint8Array} + */ + this._contents = null; + + /** + * @private + * @type {number} + */ + this._maxChunks = 20; + + /** + * @private + * @type {number} + */ + this._chunkSize = 4096; + + /** + * @private + * @type {number} + */ + this._chunkInterval = 10; + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + + if (props.fileId != null) { + this.setFileId(props.fileId); + } + + if (props.contents != null) { + this.setContents(props.contents); + } + + if (props.maxChunks != null) { + this.setMaxChunks(props.maxChunks); + } + + if (props.chunkSize != null) { + this.setChunkSize(props.chunkSize); + } + + if (props.chunkInterval != null) { + this.setChunkInterval(props.chunkInterval); + } + + /** @type {List} */ + this._transactionIds = new List(); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {FileAppendTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const append = + /** @type {HashgraphProto.proto.IFileAppendTransactionBody} */ ( + body.fileAppend + ); + + let contents; + + // The increment value depends on whether the node IDs list is empty or not. + // The node IDs list is not empty if the transaction has been frozen + // before serialization and deserialization, otherwise, it's empty. + const incrementValue = nodeIds.length > 0 ? nodeIds.length : 1; + + for (let i = 0; i < bodies.length; i += incrementValue) { + const fileAppend = + /** @type {HashgraphProto.proto.IFileAppendTransactionBody} */ ( + bodies[i].fileAppend + ); + if (fileAppend.contents == null) { + break; + } + + if (contents == null) { + contents = new Uint8Array( + /** @type {Uint8Array} */ (fileAppend.contents), + ); + continue; + } + + /** @type {Uint8Array} */ + const concat = new Uint8Array( + contents.length + + /** @type {Uint8Array} */ (fileAppend.contents).length, + ); + concat.set(contents, 0); + concat.set( + /** @type {Uint8Array} */ (fileAppend.contents), + contents.length, + ); + contents = concat; + } + + const chunkSize = append.contents?.length || undefined; + const maxChunks = bodies.length || undefined; + let chunkInterval; + if (transactionIds.length > 1) { + const firstValidStart = transactionIds[0].validStart; + const secondValidStart = transactionIds[1].validStart; + if (firstValidStart && secondValidStart) { + chunkInterval = secondValidStart.nanos + .sub(firstValidStart.nanos) + .toNumber(); + } + } + + return Transaction_Transaction._fromProtobufTransactions( + new FileAppendTransaction_FileAppendTransaction({ + fileId: + append.fileID != null + ? FileId._fromProtobuf( + /** @type {HashgraphProto.proto.IFileID} */ ( + append.fileID + ), + ) + : undefined, + contents, + chunkSize, + maxChunks, + chunkInterval, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * Set the keys which must sign any transactions modifying this file. Required. + * + * All keys must sign to modify the file's contents or keys. No key is required + * to sign for extending the expiration time (except the one for the operator account + * paying for the transaction). Only one key must sign to delete the file, however. + * + * To require more than one key to sign to delete a file, add them to a + * KeyList and pass that here. + * + * The network currently requires a file to have at least one key (or key list or threshold key) + * but this requirement may be lifted in the future. + * + * @param {FileId | string} fileId + * @returns {this} + */ + setFileId(fileId) { + this._requireNotFrozen(); + this._fileId = + typeof fileId === "string" + ? FileId.fromString(fileId) + : fileId.clone(); + + return this; + } + + /** + * @override + * @returns {number} + */ + getRequiredChunks() { + if (this._contents == null) { + return 0; + } + + const result = Math.floor( + (this._contents.length + (this._chunkSize - 1)) / this._chunkSize, + ); + return result; + } + + /** + * @returns {?Uint8Array} + */ + get contents() { + return this._contents; + } + + /** + * Set the given byte array as the file's contents. + * + * This may be omitted to append an empty file. + * + * Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the + * network; if you exceed this you may receive a HederaPreCheckStatusException + * with Status#TransactionOversize. + * + * In this case, you will need to break the data into chunks of less than ~6KiB and execute this + * transaction with the first chunk and then use FileAppendTransaction with + * FileAppendTransaction#setContents(Uint8Array) for the remaining chunks. + * + * @param {Uint8Array | string} contents + * @returns {this} + */ + setContents(contents) { + this._requireNotFrozen(); + this._contents = + contents instanceof Uint8Array ? contents : encoding_utf8_browser_encode(contents); + + return this; + } + + /** + * @returns {?number} + */ + get maxChunks() { + return this._maxChunks; + } + + /** + * @param {number} maxChunks + * @returns {this} + */ + setMaxChunks(maxChunks) { + this._requireNotFrozen(); + this._maxChunks = maxChunks; + return this; + } + + /** + * @returns {?number} + */ + get chunkSize() { + return this._chunkSize; + } + + /** + * @param {number} chunkSize + * @returns {this} + */ + setChunkSize(chunkSize) { + this._chunkSize = chunkSize; + return this; + } + + /** + * @returns {number} + */ + get chunkInterval() { + return this._chunkInterval; + } + + /** + * @param {number} chunkInterval The valid start interval between chunks in nanoseconds + * @returns {this} + */ + setChunkInterval(chunkInterval) { + this._chunkInterval = chunkInterval; + return this; + } + + /** + * Freeze this transaction from further modification to prepare for + * signing or serialization. + * + * Will use the `Client`, if available, to generate a default Transaction ID and select 1/3 + * nodes to prepare this transaction for. + * + * @param {?import("../client/Client.js").default} client + * @returns {this} + */ + freezeWith(client) { + super.freezeWith(client); + + if (this._contents == null) { + return this; + } + + let nextTransactionId = this._getTransactionId(); + + // Hack around the locked list. Should refactor a bit to remove such code + this._transactionIds.locked = false; + + this._transactions.clear(); + this._transactionIds.clear(); + this._signedTransactions.clear(); + + for (let chunk = 0; chunk < this.getRequiredChunks(); chunk++) { + this._transactionIds.push(nextTransactionId); + this._transactionIds.advance(); + + for (const nodeAccountId of this._nodeAccountIds.list) { + this._signedTransactions.push( + this._makeSignedTransaction(nodeAccountId), + ); + } + + nextTransactionId = new TransactionId_TransactionId( + /** @type {AccountId} */ (nextTransactionId.accountId), + new Timestamp_Timestamp( + /** @type {Timestamp} */ ( + nextTransactionId.validStart + ).seconds, + /** @type {Timestamp} */ ( + nextTransactionId.validStart + ).nanos.add(this._chunkInterval), + ), + ); + } + + this._transactionIds.advance(); + this._transactionIds.setLocked(); + + return this; + } + + /** + * @returns {ScheduleCreateTransaction} + */ + schedule() { + this._requireNotFrozen(); + + if (this._contents != null && this._contents.length > this._chunkSize) { + throw new Error( + `cannot schedule \`FileAppendTransaction\` with message over ${this._chunkSize} bytes`, + ); + } + + return super.schedule(); + } + + /** + * @param {import("../client/Client.js").default} client + * @param {number=} requestTimeout + * @returns {Promise} + */ + async execute(client, requestTimeout) { + return (await this.executeAll(client, requestTimeout))[0]; + } + + /** + * @param {import("../client/Client.js").default} client + * @param {number=} requestTimeout + * @returns {Promise} + */ + async executeAll(client, requestTimeout) { + if (this.maxChunks && this.getRequiredChunks() > this.maxChunks) { + throw new Error( + `cannot execute \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`, + ); + } + + if (!super._isFrozen()) { + this.freezeWith(client); + } + + // on execute, sign each transaction with the operator, if present + // and we are signing a transaction that used the default transaction ID + + const transactionId = this._getTransactionId(); + const operatorAccountId = client.operatorAccountId; + + if ( + operatorAccountId != null && + operatorAccountId.equals( + /** @type {AccountId} */ (transactionId.accountId), + ) + ) { + await super.signWithOperator(client); + } + + const responses = []; + let remainingTimeout = requestTimeout; + + for (let i = 0; i < this._transactionIds.length; i++) { + const startTimestamp = Date.now(); + const response = await super.execute(client, remainingTimeout); + + if (remainingTimeout != null) { + remainingTimeout = Date.now() - startTimestamp; + } + + await response.getReceipt(client); + responses.push(response); + } + + return responses; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._fileId != null) { + this._fileId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.file.appendContent(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "fileAppend"; + } + + /** + * Build all the transactions + * when transactions are not complete. + * @override + * @internal + */ + _buildIncompleteTransactions() { + const dummyAccountId = AccountId_AccountId.fromString("0.0.0"); + const accountId = this.transactionId?.accountId || dummyAccountId; + const validStart = + this.transactionId?.validStart || Timestamp_Timestamp.fromDate(new Date()); + + if (this._contents == null) { + throw new Error("contents is not set"); + } + + if (this.maxChunks && this.getRequiredChunks() > this.maxChunks) { + throw new Error( + `cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`, + ); + } + + // Hack around the locked list. Should refactor a bit to remove such code + this._transactionIds.locked = false; + + this._transactions.clear(); + this._transactionIds.clear(); + this._signedTransactions.clear(); + + for (let chunk = 0; chunk < this.getRequiredChunks(); chunk++) { + let nextTransactionId = TransactionId_TransactionId.withValidStart( + accountId, + validStart.plusNanos(this._chunkInterval * chunk), + ); + this._transactionIds.push(nextTransactionId); + this._transactionIds.advance(); + + if (this._nodeAccountIds.list.length === 0) { + this._transactions.push(this._makeSignedTransaction(null)); + } else { + for (const nodeAccountId of this._nodeAccountIds.list) { + this._signedTransactions.push( + this._makeSignedTransaction(nodeAccountId), + ); + } + } + } + + this._transactionIds.advance(); + this._transactionIds.setLocked(); + } + + /** + * Build all the signed transactions + * @override + * @internal + */ + _buildAllTransactions() { + if (this.maxChunks && this.getRequiredChunks() > this.maxChunks) { + throw new Error( + `cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`, + ); + } + for (let i = 0; i < this._signedTransactions.length; i++) { + this._buildTransaction(i); + } + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `FileAppendTransaction:${timestamp.toString()}`; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IFileAppendTransactionBody} + */ + _makeTransactionData() { + const length = this._contents != null ? this._contents.length : 0; + const startIndex = this._transactionIds.index * this._chunkSize; + const endIndex = Math.min(startIndex + this._chunkSize, length); + + return { + fileID: this._fileId != null ? this._fileId._toProtobuf() : null, + contents: + this._contents != null + ? this._contents.slice(startIndex, endIndex) + : null, + }; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +TRANSACTION_REGISTRY.set("fileAppend", FileAppendTransaction_FileAppendTransaction._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IFileDeleteTransactionBody} HashgraphProto.proto.IFileDeleteTransactionBody + */ + +/** + * @typedef {import("@hashgraph/cryptography").Key} Key + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +/** + * A transaction to delete a file on the Hedera network. + * + * When deleted, a file's contents are truncated to zero length and it can no longer be updated + * or appended to, or its expiration time extended. FileContentsQuery and FileInfoQuery + * will throw HederaPreCheckStatusException with a status of Status#FileDeleted. + * + * Only one of the file's keys needs to sign to delete the file, unless the key you have is part + * of a KeyList. + */ +class FileDeleteTransaction_FileDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {FileId | string} [props.fileId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?FileId} + */ + this._fileId = null; + + if (props.fileId != null) { + this.setFileId(props.fileId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {FileDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const fileDelete = + /** @type {HashgraphProto.proto.IFileDeleteTransactionBody} */ ( + body.fileDelete + ); + + return Transaction_Transaction._fromProtobufTransactions( + new FileDeleteTransaction_FileDeleteTransaction({ + fileId: + fileDelete.fileID != null + ? FileId._fromProtobuf(fileDelete.fileID) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * Set the file ID which is being deleted in this transaction. + * + * @param {FileId | string} fileId + * @returns {FileDeleteTransaction} + */ + setFileId(fileId) { + this._requireNotFrozen(); + this._fileId = + typeof fileId === "string" + ? FileId.fromString(fileId) + : fileId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._fileId != null) { + this._fileId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.file.deleteFile(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "fileDelete"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IFileDeleteTransactionBody} + */ + _makeTransactionData() { + return { + fileID: this._fileId != null ? this._fileId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `FileDeleteTransaction:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +TRANSACTION_REGISTRY.set("fileDelete", FileDeleteTransaction_FileDeleteTransaction._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractCreateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IContractCreateTransactionBody} HashgraphProto.proto.IContractCreateTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.IFileID} HashgraphProto.proto.IFileID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +class ContractCreateTransaction_ContractCreateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {FileId | string} [props.bytecodeFileId] + * @param {Uint8Array} [props.bytecode] + * @param {Key} [props.adminKey] + * @param {number | Long} [props.gas] + * @param {number | string | Long | BigNumber | Hbar} [props.initialBalance] + * @param {AccountId | string} [props.proxyAccountId] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {Uint8Array} [props.constructorParameters] + * @param {string} [props.contractMemo] + * @param {number} [props.maxAutomaticTokenAssociations] + * @param {AccountId | string} [props.stakedAccountId] + * @param {Long | number} [props.stakedNodeId] + * @param {boolean} [props.declineStakingReward] + * @param {AccountId} [props.autoRenewAccountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?FileId} + */ + this._bytecodeFileId = null; + + /** + * @private + * @type {?Uint8Array} + */ + this._bytecode = null; + + /** + * @private + * @type {?Key} + */ + this._adminKey = null; + + /** + * @private + * @type {?Long} + */ + this._gas = null; + + /** + * @private + * @type {?Hbar} + */ + this._initialBalance = null; + + /** + * @private + * @type {?AccountId} + */ + this._proxyAccountId = null; + + /** + * @private + * @type {Duration} + */ + this._autoRenewPeriod = new Duration_Duration(DEFAULT_AUTO_RENEW_PERIOD); + + /** + * @private + * @type {?Uint8Array} + */ + this._constructorParameters = null; + + /** + * @private + * @type {?string} + */ + this._contractMemo = null; + + /** + * @private + * @type {?number} + */ + this._maxAutomaticTokenAssociations = null; + + this._defaultMaxTransactionFee = new Hbar_Hbar(20); + + /** + * @private + * @type {?AccountId} + */ + this._stakedAccountId = null; + + /** + * @private + * @type {?Long} + */ + this._stakedNodeId = null; + + /** + * @private + * @type {boolean} + */ + this._declineStakingReward = false; + + /** + * @type {?AccountId} + */ + this._autoRenewAccountId = null; + + if (props.bytecodeFileId != null) { + this.setBytecodeFileId(props.bytecodeFileId); + } + + if (props.bytecode != null) { + this.setBytecode(props.bytecode); + } + + if (props.adminKey != null) { + this.setAdminKey(props.adminKey); + } + + if (props.gas != null) { + this.setGas(props.gas); + } + + if (props.initialBalance != null) { + this.setInitialBalance(props.initialBalance); + } + + if (props.proxyAccountId != null) { + // eslint-disable-next-line deprecation/deprecation + this.setProxyAccountId(props.proxyAccountId); + } + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + if (props.constructorParameters != null) { + this.setConstructorParameters(props.constructorParameters); + } + + if (props.contractMemo != null) { + this.setContractMemo(props.contractMemo); + } + + if (props.maxAutomaticTokenAssociations != null) { + this.setMaxAutomaticTokenAssociations( + props.maxAutomaticTokenAssociations, + ); + } + + if (props.stakedAccountId != null) { + this.setStakedAccountId(props.stakedAccountId); + } + + if (props.stakedNodeId != null) { + this.setStakedNodeId(props.stakedNodeId); + } + + if (props.declineStakingReward != null) { + this.setDeclineStakingReward(props.declineStakingReward); + } + + if (props.autoRenewAccountId != null) { + this.setAutoRenewAccountId(props.autoRenewAccountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {ContractCreateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const create = + /** @type {HashgraphProto.proto.IContractCreateTransactionBody} */ ( + body.contractCreateInstance + ); + + return Transaction_Transaction._fromProtobufTransactions( + new ContractCreateTransaction_ContractCreateTransaction({ + bytecodeFileId: + create.fileID != null + ? FileId._fromProtobuf( + /** @type {HashgraphProto.proto.IFileID} */ ( + create.fileID + ), + ) + : undefined, + adminKey: + create.adminKey != null + ? src_Key_Key._fromProtobufKey(create.adminKey) + : undefined, + gas: create.gas != null ? create.gas : undefined, + initialBalance: + create.initialBalance != null + ? Hbar_Hbar.fromTinybars(create.initialBalance) + : undefined, + proxyAccountId: + create.proxyAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + create.proxyAccountID + ), + ) + : undefined, + autoRenewPeriod: + create.autoRenewPeriod != null + ? create.autoRenewPeriod.seconds != null + ? create.autoRenewPeriod.seconds + : undefined + : undefined, + constructorParameters: + create.constructorParameters != null + ? create.constructorParameters + : undefined, + contractMemo: create.memo != null ? create.memo : undefined, + maxAutomaticTokenAssociations: + create.maxAutomaticTokenAssociations != null + ? create.maxAutomaticTokenAssociations + : undefined, + stakedAccountId: + create.stakedAccountId != null + ? AccountId_AccountId._fromProtobuf(create.stakedAccountId) + : undefined, + stakedNodeId: + create.stakedNodeId != null + ? create.stakedNodeId + : undefined, + declineStakingReward: create.declineReward == true, + autoRenewAccountId: + create.autoRenewAccountId != null + ? AccountId_AccountId._fromProtobuf(create.autoRenewAccountId) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?FileId} + */ + get bytecodeFileId() { + return this._bytecodeFileId; + } + + /** + * @param {FileId | string} bytecodeFileId + * @returns {this} + */ + setBytecodeFileId(bytecodeFileId) { + this._requireNotFrozen(); + this._bytecodeFileId = + typeof bytecodeFileId === "string" + ? FileId.fromString(bytecodeFileId) + : bytecodeFileId.clone(); + this._bytecode = null; + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get bytecode() { + return this._bytecode; + } + + /** + * @param {Uint8Array} bytecode + * @returns {this} + */ + setBytecode(bytecode) { + this._requireNotFrozen(); + this._bytecode = bytecode; + this._bytecodeFileId = null; + + return this; + } + + /** + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @param {Key} adminKey + * @returns {this} + */ + setAdminKey(adminKey) { + this._requireNotFrozen(); + this._adminKey = adminKey; + + return this; + } + + /** + * @returns {?Long} + */ + get gas() { + return this._gas; + } + + /** + * @param {number | Long} gas + * @returns {this} + */ + setGas(gas) { + this._requireNotFrozen(); + this._gas = gas instanceof src_long ? gas : src_long.fromValue(gas); + + return this; + } + + /** + * @returns {?Hbar} + */ + get initialBalance() { + return this._initialBalance; + } + + /** + * Set the initial amount to transfer into this contract. + * + * @param {number | string | Long | BigNumber | Hbar} initialBalance + * @returns {this} + */ + setInitialBalance(initialBalance) { + this._requireNotFrozen(); + this._initialBalance = + initialBalance instanceof Hbar_Hbar + ? initialBalance + : new Hbar_Hbar(initialBalance); + + return this; + } + + /** + * @deprecated + * @returns {?AccountId} + */ + get proxyAccountId() { + return this._proxyAccountId; + } + + /** + * @deprecated + * @param {AccountId | string} proxyAccountId + * @returns {this} + */ + setProxyAccountId(proxyAccountId) { + this._requireNotFrozen(); + this._proxyAccountId = + proxyAccountId instanceof AccountId_AccountId + ? proxyAccountId + : AccountId_AccountId.fromString(proxyAccountId); + + return this; + } + + /** + * @returns {Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * An account to charge for auto-renewal of this contract. If not set, or set to an + * account with zero hbar balance, the contract's own hbar balance will be used to + * cover auto-renewal fees. + * + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get constructorParameters() { + return this._constructorParameters; + } + + /** + * @param {Uint8Array | ContractFunctionParameters} constructorParameters + * @returns {this} + */ + setConstructorParameters(constructorParameters) { + this._requireNotFrozen(); + this._constructorParameters = + constructorParameters instanceof ContractFunctionParameters + ? constructorParameters._build() + : constructorParameters; + + return this; + } + + /** + * @returns {?string} + */ + get contractMemo() { + return this._contractMemo; + } + + /** + * @param {string} contractMemo + * @returns {this} + */ + setContractMemo(contractMemo) { + this._requireNotFrozen(); + this._contractMemo = contractMemo; + + return this; + } + + /** + * @returns {?number} + */ + get maxAutomaticTokenAssociations() { + return this._maxAutomaticTokenAssociations; + } + + /** + * @param {number} maxAutomaticTokenAssociations + * @returns {this} + */ + setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) { + this._maxAutomaticTokenAssociations = maxAutomaticTokenAssociations; + + return this; + } + + /** + * @returns {?AccountId} + */ + get stakedAccountId() { + return this._stakedAccountId; + } + + /** + * @param {AccountId | string} stakedAccountId + * @returns {this} + */ + setStakedAccountId(stakedAccountId) { + this._requireNotFrozen(); + this._stakedAccountId = + typeof stakedAccountId === "string" + ? AccountId_AccountId.fromString(stakedAccountId) + : stakedAccountId; + + return this; + } + + /** + * @returns {?Long} + */ + get stakedNodeId() { + return this._stakedNodeId; + } + + /** + * @param {Long | number} stakedNodeId + * @returns {this} + */ + setStakedNodeId(stakedNodeId) { + this._requireNotFrozen(); + this._stakedNodeId = src_long.fromValue(stakedNodeId); + + return this; + } + + /** + * @returns {boolean} + */ + get declineStakingRewards() { + return this._declineStakingReward; + } + + /** + * @param {boolean} declineStakingReward + * @returns {this} + */ + setDeclineStakingReward(declineStakingReward) { + this._requireNotFrozen(); + this._declineStakingReward = declineStakingReward; + + return this; + } + + /** + * @returns {?AccountId} + */ + get autoRenewAccountId() { + return this._autoRenewAccountId; + } + + /** + * @param {string | AccountId} autoRenewAccountId + * @returns {this} + */ + setAutoRenewAccountId(autoRenewAccountId) { + this._requireNotFrozen(); + this._autoRenewAccountId = + typeof autoRenewAccountId === "string" + ? AccountId_AccountId.fromString(autoRenewAccountId) + : autoRenewAccountId; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._bytecodeFileId != null) { + this._bytecodeFileId.validateChecksum(client); + } + + if (this._proxyAccountId != null) { + this._proxyAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.createContract(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "contractCreateInstance"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IContractCreateTransactionBody} + */ + _makeTransactionData() { + return { + fileID: + this._bytecodeFileId != null + ? this._bytecodeFileId._toProtobuf() + : null, + initcode: this._bytecode, + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + gas: this._gas, + initialBalance: + this._initialBalance != null + ? this._initialBalance.toTinybars() + : null, + proxyAccountID: + this._proxyAccountId != null + ? this._proxyAccountId._toProtobuf() + : null, + autoRenewPeriod: this._autoRenewPeriod._toProtobuf(), + constructorParameters: this._constructorParameters, + memo: this._contractMemo, + maxAutomaticTokenAssociations: this._maxAutomaticTokenAssociations, + stakedAccountId: + this.stakedAccountId != null + ? this.stakedAccountId._toProtobuf() + : null, + stakedNodeId: this.stakedNodeId, + declineReward: this.declineStakingRewards, + autoRenewAccountId: + this._autoRenewAccountId != null + ? this._autoRenewAccountId._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `ContractCreateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "contractCreateInstance", + // eslint-disable-next-line @typescript-eslint/unbound-method + ContractCreateTransaction_ContractCreateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractCreateFlow.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + +/** + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../file/FileId.js").default} FileId + * @typedef {import("../Key.js").default} Key + * @typedef {import("./ContractFunctionParameters.js").default} ContractFunctionParameters + * @typedef {import("../Hbar.js").default} Hbar + * @typedef {import("../Duration.js").default} Duration + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("../transaction/TransactionReceipt.js").default} TransactionReceipt + * @typedef {import("../client/Client.js").ClientOperator} ClientOperator + * @typedef {import("../Signer.js").Signer} Signer + * @typedef {import("../PrivateKey.js").default} PrivateKey + * @typedef {import("../transaction/Transaction.js").default} Transaction + */ + +/** + * @typedef {import("bignumber.js").BigNumber} BigNumber + * @typedef {import("long").Long} Long + */ + +class ContractCreateFlow { + constructor() { + /** @type {Uint8Array | null} */ + this._bytecode = null; + this._contractCreate = new ContractCreateTransaction(); + + /** + * Read `Transaction._signerPublicKeys` + * + * @internal + * @type {Set} + */ + this._signerPublicKeys = new Set(); + + /** + * Read `Transaction._publicKeys` + * + * @private + * @type {PublicKey[]} + */ + this._publicKeys = []; + + /** + * Read `Transaction._transactionSigners` + * + * @private + * @type {((message: Uint8Array) => Promise)[]} + */ + this._transactionSigners = []; + + this._maxChunks = null; + } + + /** + * @returns {number | null} + */ + get maxChunks() { + return this._maxChunks; + } + + /** + * @param {number} maxChunks + * @returns {this} + */ + setMaxChunks(maxChunks) { + this._maxChunks = maxChunks; + return this; + } + + /** + * @returns {?Uint8Array} + */ + get bytecode() { + return this._bytecode; + } + + /** + * @param {string | Uint8Array} bytecode + * @returns {this} + */ + setBytecode(bytecode) { + this._bytecode = + bytecode instanceof Uint8Array ? bytecode : utf8.encode(bytecode); + + return this; + } + + /** + * @returns {?Key} + */ + get adminKey() { + return this._contractCreate.adminKey; + } + + /** + * @param {Key} adminKey + * @returns {this} + */ + setAdminKey(adminKey) { + this._contractCreate.setAdminKey(adminKey); + return this; + } + + /** + * @returns {?Long} + */ + get gas() { + return this._contractCreate.gas; + } + + /** + * @param {number | Long} gas + * @returns {this} + */ + setGas(gas) { + this._contractCreate.setGas(gas); + return this; + } + + /** + * @returns {?Hbar} + */ + get initialBalance() { + return this._contractCreate.initialBalance; + } + + /** + * Set the initial amount to transfer into this contract. + * + * @param {number | string | Long | BigNumber | Hbar} initialBalance + * @returns {this} + */ + setInitialBalance(initialBalance) { + this._contractCreate.setInitialBalance(initialBalance); + return this; + } + + /** + * @deprecated + * @returns {?AccountId} + */ + get proxyAccountId() { + // eslint-disable-next-line deprecation/deprecation + return this._contractCreate.proxyAccountId; + } + + /** + * @deprecated + * @param {AccountId | string} proxyAccountId + * @returns {this} + */ + setProxyAccountId(proxyAccountId) { + // eslint-disable-next-line deprecation/deprecation + this._contractCreate.setProxyAccountId(proxyAccountId); + return this; + } + + /** + * @returns {Duration} + */ + get autoRenewPeriod() { + return this._contractCreate.autoRenewPeriod; + } + + /** + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._contractCreate.setAutoRenewPeriod(autoRenewPeriod); + return this; + } + + /** + * @returns {?Uint8Array} + */ + get constructorParameters() { + return this._contractCreate.constructorParameters; + } + + /** + * @param {Uint8Array | ContractFunctionParameters} constructorParameters + * @returns {this} + */ + setConstructorParameters(constructorParameters) { + this._contractCreate.setConstructorParameters(constructorParameters); + return this; + } + + /** + * @returns {?string} + */ + get contractMemo() { + return this._contractCreate.contractMemo; + } + + /** + * @param {string} contractMemo + * @returns {this} + */ + setContractMemo(contractMemo) { + this._contractCreate.setContractMemo(contractMemo); + return this; + } + + /** + * @returns {?number} + */ + get maxAutomaticTokenAssociation() { + return this._contractCreate.maxAutomaticTokenAssociations; + } + + /** + * @param {number} maxAutomaticTokenAssociation + * @returns {this} + */ + setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociation) { + this._contractCreate.setMaxAutomaticTokenAssociations( + maxAutomaticTokenAssociation, + ); + + return this; + } + + /** + * @returns {?AccountId} + */ + get stakedAccountId() { + return this._contractCreate.stakedAccountId; + } + + /** + * @param {AccountId | string} stakedAccountId + * @returns {this} + */ + setStakedAccountId(stakedAccountId) { + this._contractCreate.setStakedAccountId(stakedAccountId); + return this; + } + + /** + * @returns {?Long} + */ + get stakedNodeId() { + return this._contractCreate.stakedNodeId; + } + + /** + * @param {Long | number} stakedNodeId + * @returns {this} + */ + setStakedNodeId(stakedNodeId) { + this._contractCreate.setStakedNodeId(stakedNodeId); + return this; + } + + /** + * @returns {boolean} + */ + get declineStakingRewards() { + return this._contractCreate.declineStakingRewards; + } + + /** + * @param {boolean} declineStakingReward + * @returns {this} + */ + setDeclineStakingReward(declineStakingReward) { + this._contractCreate.setDeclineStakingReward(declineStakingReward); + return this; + } + + /** + * @returns {?AccountId} + */ + get autoRenewAccountId() { + return this._contractCreate.autoRenewAccountId; + } + + /** + * @param {string | AccountId} autoRenewAccountId + * @returns {this} + */ + setAutoRenewAccountId(autoRenewAccountId) { + this._contractCreate.setAutoRenewAccountId(autoRenewAccountId); + return this; + } + + /** + * Sign the transaction with the private key + * **NOTE**: This is a thin wrapper around `.signWith()` + * + * @param {PrivateKey} privateKey + * @returns {this} + */ + sign(privateKey) { + return this.signWith(privateKey.publicKey, (message) => + Promise.resolve(privateKey.sign(message)), + ); + } + + /** + * Sign the transaction with the public key and signer function + * + * If sign on demand is enabled no signing will be done immediately, instead + * the private key signing function and public key are saved to be used when + * a user calls an exit condition method (not sure what a better name for this is) + * such as `toBytes[Async]()`, `getTransactionHash[PerNode]()` or `execute()`. + * + * @param {PublicKey} publicKey + * @param {(message: Uint8Array) => Promise} transactionSigner + * @returns {this} + */ + signWith(publicKey, transactionSigner) { + const publicKeyData = publicKey.toBytesRaw(); + const publicKeyHex = hex.encode(publicKeyData); + + if (this._signerPublicKeys.has(publicKeyHex)) { + // this public key has already signed this transaction + return this; + } + + this._publicKeys.push(publicKey); + this._transactionSigners.push(transactionSigner); + + return this; + } + + /** + * @template {Channel} ChannelT + * @template {MirrorChannel} MirrorChannelT + * @param {import("../client/Client.js").default} client + * @param {number=} requestTimeout + * @returns {Promise} + */ + async execute(client, requestTimeout) { + if (this._bytecode == null) { + throw new Error("cannot create contract with no bytecode"); + } + + const key = client.operatorPublicKey; + + const fileCreateTransaction = new FileCreateTransaction() + .setKeys(key != null ? [key] : []) + .setContents( + this._bytecode.subarray( + 0, + Math.min(this._bytecode.length, 2048), + ), + ) + .freezeWith(client); + await addSignersToTransaction( + fileCreateTransaction, + this._publicKeys, + this._transactionSigners, + ); + + let response = await fileCreateTransaction.execute( + client, + requestTimeout, + ); + const receipt = await response.getReceipt(client); + + const fileId = /** @type {FileId} */ (receipt.fileId); + + if (this._bytecode.length > 2048) { + const fileAppendTransaction = new FileAppendTransaction() + .setFileId(fileId) + .setContents(this._bytecode.subarray(2048)) + .freezeWith(client); + await addSignersToTransaction( + fileAppendTransaction, + this._publicKeys, + this._transactionSigners, + ); + await fileAppendTransaction.execute(client, requestTimeout); + } + + this._contractCreate.setBytecodeFileId(fileId).freezeWith(client); + + await addSignersToTransaction( + this._contractCreate, + this._publicKeys, + this._transactionSigners, + ); + + response = await this._contractCreate.execute(client, requestTimeout); + await response.getReceipt(client); + + if (key != null) { + const fileDeleteTransaction = new FileDeleteTransaction() + .setFileId(fileId) + .freezeWith(client); + await addSignersToTransaction( + fileDeleteTransaction, + this._publicKeys, + this._transactionSigners, + ); + await ( + await fileDeleteTransaction.execute(client, requestTimeout) + ).getReceipt(client); + } + + return response; + } + + /** + * @param {Signer} signer + * @returns {Promise} + */ + async executeWithSigner(signer) { + if (this._bytecode == null) { + throw new Error("cannot create contract with no bytecode"); + } + + if (signer.getAccountKey == null) { + throw new Error( + "`Signer.getAccountKey()` is not implemented, but is required for `ContractCreateFlow`", + ); + } + // eslint-disable-next-line @typescript-eslint/await-thenable + const key = await signer.getAccountKey(); + let formattedPublicKey; + + if (key instanceof PublicKey) { + formattedPublicKey = key; + } else { + const propertyValues = Object.values( + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access + key._key._key._keyData, + ); + const keyArray = new Uint8Array(propertyValues); + + formattedPublicKey = PublicKey.fromBytes(keyArray); + } + + const fileCreateTransaction = await new FileCreateTransaction() + .setKeys(formattedPublicKey != null ? [formattedPublicKey] : []) + .setContents( + this._bytecode.subarray( + 0, + Math.min(this._bytecode.length, 2048), + ), + ) + .freezeWithSigner(signer); + await fileCreateTransaction.signWithSigner(signer); + await addSignersToTransaction( + fileCreateTransaction, + this._publicKeys, + this._transactionSigners, + ); + + let response = await fileCreateTransaction.executeWithSigner(signer); + const receipt = await response.getReceiptWithSigner(signer); + + const fileId = /** @type {FileId} */ (receipt.fileId); + + if (this._bytecode.length > 2048) { + let fileAppendTransaction = new FileAppendTransaction() + .setFileId(fileId) + .setContents(this._bytecode.subarray(2048)); + if (this._maxChunks != null) { + fileAppendTransaction.setMaxChunks(this._maxChunks); + } + fileAppendTransaction = + await fileAppendTransaction.freezeWithSigner(signer); + await fileAppendTransaction.signWithSigner(signer); + await addSignersToTransaction( + fileAppendTransaction, + this._publicKeys, + this._transactionSigners, + ); + await fileAppendTransaction.executeWithSigner(signer); + } + + this._contractCreate = await this._contractCreate + .setBytecodeFileId(fileId) + .freezeWithSigner(signer); + this._contractCreate = + await this._contractCreate.signWithSigner(signer); + await addSignersToTransaction( + this._contractCreate, + this._publicKeys, + this._transactionSigners, + ); + + response = await this._contractCreate.executeWithSigner(signer); + + await response.getReceiptWithSigner(signer); + + if (key != null) { + const fileDeleteTransaction = await new FileDeleteTransaction() + .setFileId(fileId) + .freezeWithSigner(signer); + await fileDeleteTransaction.signWithSigner(signer); + await addSignersToTransaction( + fileDeleteTransaction, + this._publicKeys, + this._transactionSigners, + ); + await ( + await fileDeleteTransaction.executeWithSigner(signer) + ).getReceiptWithSigner(signer); + } + + return response; + } +} + +/** + * @template {Transaction} T + * @param {T} transaction + * @param {PublicKey[]} publicKeys + * @param {((message: Uint8Array) => Promise)[]} transactionSigners + * @returns {Promise} + */ +async function addSignersToTransaction( + transaction, + publicKeys, + transactionSigners, +) { + for (let i = 0; i < publicKeys.length; i++) { + await transaction.signWith(publicKeys[i], transactionSigners[i]); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IContractDeleteTransactionBody} HashgraphProto.proto.IContractDeleteTransactionBody + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +class ContractDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {ContractId | string} [props.contractId] + * @param {ContractId | string} [props.transferContractId] + * @param {AccountId | string} [props.transferAccountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?ContractId} + */ + this._contractId = null; + + /** + * @private + * @type {?AccountId} + */ + this._transferAccountId = null; + + /** + * @private + * @type {?ContractId} + */ + this._transferContractId = null; + + if (props.contractId != null) { + this.setContractId(props.contractId); + } + + if (props.transferAccountId != null) { + this.setTransferAccountId(props.transferAccountId); + } + + if (props.transferContractId != null) { + this.setTransferContractId(props.transferContractId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {ContractDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const contractDelete = + /** @type {HashgraphProto.proto.IContractDeleteTransactionBody} */ ( + body.contractDeleteInstance + ); + + return Transaction_Transaction._fromProtobufTransactions( + new ContractDeleteTransaction({ + contractId: + contractDelete.contractID != null + ? ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + contractDelete.contractID + ), + ) + : undefined, + transferAccountId: + contractDelete.transferAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + contractDelete.transferAccountID + ), + ) + : undefined, + transferContractId: + contractDelete.transferContractID != null + ? ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + contractDelete.transferContractID + ), + ) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * Sets the contract ID which is being deleted in this transaction. + * + * @param {ContractId | string} contractId + * @returns {ContractDeleteTransaction} + */ + setContractId(contractId) { + this._requireNotFrozen(); + this._contractId = + typeof contractId === "string" + ? ContractId_ContractId.fromString(contractId) + : contractId.clone(); + + return this; + } + + /** + * @returns {?ContractId} + */ + get transferContractId() { + return this._transferContractId; + } + + /** + * Sets the contract ID which will receive all remaining hbars. + * + * @param {ContractId | string} transferContractId + * @returns {ContractDeleteTransaction} + */ + setTransferContractId(transferContractId) { + this._requireNotFrozen(); + this._transferContractId = + transferContractId instanceof ContractId_ContractId + ? transferContractId + : ContractId_ContractId.fromString(transferContractId); + + return this; + } + + /** + * @returns {?AccountId} + */ + get transferAccountId() { + return this._transferAccountId; + } + + /** + * Sets the account ID which will receive all remaining hbars. + * + * @param {AccountId | string} transferAccountId + * @returns {ContractDeleteTransaction} + */ + setTransferAccountId(transferAccountId) { + this._requireNotFrozen(); + this._transferAccountId = + transferAccountId instanceof AccountId_AccountId + ? transferAccountId + : AccountId_AccountId.fromString(transferAccountId); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._contractId != null) { + this._contractId.validateChecksum(client); + } + + if (this._transferAccountId != null) { + this._transferAccountId.validateChecksum(client); + } + + if (this._transferContractId != null) { + this._transferContractId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.deleteContract(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "contractDeleteInstance"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IContractDeleteTransactionBody} + */ + _makeTransactionData() { + return { + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + transferAccountID: this._transferAccountId + ? this._transferAccountId._toProtobuf() + : null, + transferContractID: + this._transferContractId != null + ? this._transferContractId._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `ContractDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "contractDeleteInstance", + // eslint-disable-next-line @typescript-eslint/unbound-method + ContractDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractExecuteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IContractCallTransactionBody} HashgraphProto.proto.IContractCallTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + * @typedef {import("@hashgraph/proto").proto.IFileID} HashgraphProto.proto.IFileID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +/** + * @typedef {object} FunctionParameters + * @property {string} name + * @property {ContractFunctionParameters} parameters + */ + +class ContractExecuteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {ContractId | string} [props.contractId] + * @param {number | Long} [props.gas] + * @param {number | string | Long | BigNumber | Hbar} [props.amount] + * @param {Uint8Array} [props.functionParameters] + * @param {FunctionParameters} [props.function] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?ContractId} + */ + this._contractId = null; + + /** + * @private + * @type {?Long} + */ + this._gas = null; + + /** + * @private + * @type {?Hbar} + */ + this._amount = null; + + /** + * @private + * @type {?Uint8Array} + */ + this._functionParameters = null; + + if (props.contractId != null) { + this.setContractId(props.contractId); + } + + if (props.gas != null) { + this.setGas(props.gas); + } + + if (props.amount != null) { + this.setPayableAmount(props.amount); + } + + if (props.functionParameters != null) { + this.setFunctionParameters(props.functionParameters); + } else if (props.function != null) { + this.setFunction(props.function.name, props.function.parameters); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {ContractExecuteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const call = + /** @type {HashgraphProto.proto.IContractCallTransactionBody} */ ( + body.contractCall + ); + + return Transaction_Transaction._fromProtobufTransactions( + new ContractExecuteTransaction({ + contractId: + call.contractID != null + ? ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + call.contractID + ), + ) + : undefined, + gas: call.gas != null ? call.gas : undefined, + amount: + call.amount != null + ? Hbar_Hbar.fromTinybars(call.amount) + : undefined, + functionParameters: + call.functionParameters != null + ? call.functionParameters + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * Sets the contract ID which is being executed in this transaction. + * + * @param {ContractId | string} contractId + * @returns {ContractExecuteTransaction} + */ + setContractId(contractId) { + this._requireNotFrozen(); + this._contractId = + typeof contractId === "string" + ? ContractId_ContractId.fromString(contractId) + : contractId.clone(); + + return this; + } + + /** + * @returns {?Long} + */ + get gas() { + return this._gas; + } + + /** + * Sets the amount of gas to use for the call. + * + * @param {number | Long} gas + * @returns {ContractExecuteTransaction} + */ + setGas(gas) { + this._requireNotFrozen(); + this._gas = gas instanceof src_long ? gas : src_long.fromValue(gas); + + return this; + } + + /** + * @returns {?Hbar} + */ + get payableAmount() { + return this._amount; + } + + /** + * Sets the number of hbars to be sent with this function call. + * + * @param {number | string | Long | BigNumber | Hbar} amount + * @returns {ContractExecuteTransaction} + */ + setPayableAmount(amount) { + this._requireNotFrozen(); + this._amount = amount instanceof Hbar_Hbar ? amount : new Hbar_Hbar(amount); + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get functionParameters() { + return this._functionParameters; + } + + /** + * @param {Uint8Array} functionParameters + * @returns {this} + */ + setFunctionParameters(functionParameters) { + this._requireNotFrozen(); + this._functionParameters = functionParameters; + + return this; + } + + /** + * @param {string} name + * @param {ContractFunctionParameters} [functionParameters] + * @returns {this} + */ + setFunction(name, functionParameters) { + this._requireNotFrozen(); + this._functionParameters = + functionParameters != null + ? functionParameters._build(name) + : new ContractFunctionParameters()._build(name); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._contractId != null) { + this._contractId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.contractCallMethod(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "contractCall"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IContractCallTransactionBody} + */ + _makeTransactionData() { + return { + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + gas: this._gas, + amount: this._amount != null ? this._amount.toTinybars() : null, + functionParameters: this._functionParameters, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `ContractExecuteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "contractCall", + // eslint-disable-next-line @typescript-eslint/unbound-method + ContractExecuteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + + + + +const { proto: ContractInfo_proto } = lib_namespaceObject; + +/** + * @typedef {import("../StakingInfo.js").StakingInfoJson} StakingInfoJson + */ + +/** + * Response when the client sends the node CryptoGetInfoQuery. + */ +class ContractInfo { + /** + * @private + * @param {object} props + * @param {ContractId} props.contractId + * @param {AccountId} props.accountId + * @param {string} props.contractAccountId + * @param {?Key} props.adminKey + * @param {Timestamp} props.expirationTime + * @param {Duration} props.autoRenewPeriod + * @param {?AccountId} props.autoRenewAccountId + * @param {Long} props.storage + * @param {string} props.contractMemo + * @param {Hbar} props.balance + * @param {boolean} props.isDeleted + * @param {TokenRelationshipMap} props.tokenRelationships + * @param {LedgerId|null} props.ledgerId + * @param {?StakingInfo} props.stakingInfo + */ + constructor(props) { + /** + * ID of the contract instance, in the format used in transactions. + * + * @readonly + */ + this.contractId = props.contractId; + + /** + * ID of the cryptocurrency account owned by the contract instance, + * in the format used in transactions. + * + * @readonly + */ + this.accountId = props.accountId; + + /** + * ID of both the contract instance and the cryptocurrency account owned by the contract + * instance, in the format used by Solidity. + * + * @readonly + */ + this.contractAccountId = props.contractAccountId; + + /** + * The state of the instance and its fields can be modified arbitrarily if this key signs a + * transaction to modify it. If this is null, then such modifications are not possible, + * and there is no administrator that can override the normal operation of this smart + * contract instance. Note that if it is created with no admin keys, then there is no + * administrator to authorize changing the admin keys, so there can never be any admin keys + * for that instance. + * + * @readonly + */ + this.adminKey = props.adminKey != null ? props.adminKey : null; + + /** + * The current time at which this contract instance (and its account) is set to expire. + * + * @readonly + */ + this.expirationTime = props.expirationTime; + + /** + * The expiration time will extend every this many seconds. If there are insufficient funds, + * then it extends as long as possible. If the account is empty when it expires, + * then it is deleted. + * + * @readonly + */ + this.autoRenewPeriod = props.autoRenewPeriod; + + /** + * ID of the an account to charge for auto-renewal of this contract. If not set, or set + * to an account with zero hbar balance, the contract's own hbar balance will be used + * to cover auto-renewal fees. + * + * @readonly + */ + this.autoRenewAccountId = props.autoRenewAccountId; + + /** + * Number of bytes of storage being used by this instance (which affects the cost to + * extend the expiration time). + * + * @readonly + */ + this.storage = props.storage; + + /** + * The memo associated with the contract (max 100 bytes). + * + * @readonly + */ + this.contractMemo = props.contractMemo; + + /** + * The current balance of the contract. + * + * @readonly + */ + this.balance = props.balance; + + /** + * Whether the contract has been deleted + * + * @readonly + */ + this.isDeleted = props.isDeleted; + + /** + * The tokens associated to the contract + * + * @readonly + */ + this.tokenRelationships = props.tokenRelationships; + + /** + * The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + */ + this.ledgerId = props.ledgerId; + + /** + * Staking metadata for this account. + */ + this.stakingInfo = props.stakingInfo; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.ContractGetInfoResponse.IContractInfo} info + * @returns {ContractInfo} + */ + static _fromProtobuf(info) { + const autoRenewPeriod = /** @type {Long | number} */ ( + /** @type {HashgraphProto.proto.IDuration} */ (info.autoRenewPeriod) + .seconds + ); + + return new ContractInfo({ + contractId: ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + info.contractID + ), + ), + accountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ (info.accountID), + ), + contractAccountId: + info.contractAccountID != null ? info.contractAccountID : "", + adminKey: + info.adminKey != null + ? src_Key_Key._fromProtobufKey(info.adminKey) + : null, + expirationTime: Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.expirationTime + ), + ), + autoRenewPeriod: new Duration_Duration(autoRenewPeriod), + autoRenewAccountId: + info.autoRenewAccountId != null + ? AccountId_AccountId._fromProtobuf(info.autoRenewAccountId) + : null, + storage: + info.storage != null + ? info.storage instanceof src_long + ? info.storage + : src_long.fromValue(info.storage) + : src_long.ZERO, + contractMemo: info.memo != null ? info.memo : "", + balance: Hbar_Hbar.fromTinybars(info.balance != null ? info.balance : 0), + isDeleted: /** @type {boolean} */ (info.deleted), + tokenRelationships: TokenRelationshipMap._fromProtobuf( + info.tokenRelationships != null ? info.tokenRelationships : [], + ), + ledgerId: + info.ledgerId != null + ? LedgerId.fromBytes(info.ledgerId) + : null, + stakingInfo: + info.stakingInfo != null + ? StakingInfo._fromProtobuf(info.stakingInfo) + : null, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ContractGetInfoResponse.IContractInfo} + */ + _toProtobuf() { + return { + contractID: this.contractId._toProtobuf(), + accountID: this.accountId._toProtobuf(), + contractAccountID: this.contractAccountId, + adminKey: + this.adminKey != null ? this.adminKey._toProtobufKey() : null, + expirationTime: this.expirationTime._toProtobuf(), + autoRenewPeriod: + this.autoRenewPeriod != null + ? this.autoRenewPeriod._toProtobuf() + : null, + autoRenewAccountId: + this.autoRenewAccountId != null + ? this.autoRenewAccountId._toProtobuf() + : null, + storage: this.storage, + memo: this.contractMemo, + balance: this.balance.toTinybars(), + deleted: this.isDeleted, + tokenRelationships: + this.tokenRelationships != null + ? this.tokenRelationships._toProtobuf() + : null, + ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null, + stakingInfo: + this.stakingInfo != null + ? this.stakingInfo._toProtobuf() + : null, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {ContractInfo} + */ + static fromBytes(bytes) { + return ContractInfo._fromProtobuf( + ContractInfo_proto.ContractGetInfoResponse.ContractInfo.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return ContractInfo_proto.ContractGetInfoResponse.ContractInfo.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +// eslint-disable-next-line @typescript-eslint/no-unused-vars + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.IContractGetInfoQuery} HashgraphProto.proto.IContractGetInfoQuery + * @typedef {import("@hashgraph/proto").proto.IContractGetInfoResponse} HashgraphProto.proto.IContractGetInfoResponse + * @typedef {import("@hashgraph/proto").proto.ContractGetInfoResponse.IContractInfo} HashgraphProto.proto.ContractGetInfoResponse.IContractInfo + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ + +/** + * @augments {Query} + */ +class ContractInfoQuery extends Query_Query { + /** + * @param {object} [props] + * @param {ContractId | string} [props.contractId] + */ + constructor(props = {}) { + super(); + + /** + * @type {?ContractId} + * @private + */ + this._contractId = null; + if (props.contractId != null) { + this.setContractId(props.contractId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {ContractInfoQuery} + */ + static _fromProtobuf(query) { + const info = /** @type {HashgraphProto.proto.IContractGetInfoQuery} */ ( + query.contractGetInfo + ); + + return new ContractInfoQuery({ + contractId: + info.contractID != null + ? ContractId_ContractId._fromProtobuf(info.contractID) + : undefined, + }); + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * Set the contract ID for which the info is being requested. + * + * @param {ContractId | string} contractId + * @returns {ContractInfoQuery} + */ + setContractId(contractId) { + this._contractId = + typeof contractId === "string" + ? ContractId_ContractId.fromString(contractId) + : contractId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._contractId != null) { + this._contractId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.getContractInfo(request); + } + + /** + * @override + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + return super.getCost(client); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const contractGetInfo = + /** @type {HashgraphProto.proto.IContractGetInfoResponse} */ ( + response.contractGetInfo + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + contractGetInfo.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const info = + /** @type {HashgraphProto.proto.IContractGetInfoResponse} */ ( + response.contractGetInfo + ); + + return Promise.resolve( + ContractInfo._fromProtobuf( + /** @type {HashgraphProto.proto.ContractGetInfoResponse.IContractInfo} */ ( + info.contractInfo + ), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + contractGetInfo: { + header, + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `ContractInfoQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("contractGetInfo", ContractInfoQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/ContractUpdateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IContractUpdateTransactionBody} HashgraphProto.proto.IContractUpdateTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + * @typedef {import("@hashgraph/proto").proto.IFileID} HashgraphProto.proto.IFileID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +class ContractUpdateTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {ContractId | string} [props.contractId] + * @param {FileId | string} [props.bytecodeFileId] + * @param {Timestamp | Date} [props.expirationTime] + * @param {Key} [props.adminKey] + * @param {AccountId | string} [props.proxyAccountId] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {string} [props.contractMemo] + * @param {number} [props.maxAutomaticTokenAssociations] + * @param {AccountId | string} [props.stakedAccountId] + * @param {Long | number} [props.stakedNodeId] + * @param {boolean} [props.declineStakingReward] + * @param {AccountId} [props.autoRenewAccountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?ContractId} + */ + this._contractId = null; + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = null; + + /** + * @private + * @type {?Key} + */ + this._adminKey = null; + + /** + * @private + * @type {?AccountId} + */ + this._proxyAccountId = null; + + /** + * @private + * @type {?Duration} + */ + this._autoRenewPeriod = null; + + /** + * @private + * @type {?FileId} + */ + this._bytecodeFileId = null; + + /** + * @private + * @type {?string} + */ + this._contractMemo = null; + + /** + * @private + * @type {?number} + */ + this._maxAutomaticTokenAssociations = null; + + /** + * @private + * @type {?AccountId} + */ + this._stakedAccountId = null; + + /** + * @private + * @type {?Long} + */ + this._stakedNodeId = null; + + /** + * @private + * @type {?boolean} + */ + this._declineStakingReward = null; + + /** + * @type {?AccountId} + */ + this._autoRenewAccountId = null; + + if (props.contractId != null) { + this.setContractId(props.contractId); + } + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + + if (props.adminKey != null) { + this.setAdminKey(props.adminKey); + } + + if (props.proxyAccountId != null) { + // eslint-disable-next-line deprecation/deprecation + this.setProxyAccountId(props.proxyAccountId); + } + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + if (props.bytecodeFileId != null) { + this.setBytecodeFileId(props.bytecodeFileId); + } + + if (props.contractMemo != null) { + this.setContractMemo(props.contractMemo); + } + + if (props.maxAutomaticTokenAssociations != null) { + this.setMaxAutomaticTokenAssociations( + props.maxAutomaticTokenAssociations, + ); + } + + if (props.stakedAccountId != null) { + this.setStakedAccountId(props.stakedAccountId); + } + + if (props.stakedNodeId != null) { + this.setStakedNodeId(props.stakedNodeId); + } + + if (props.declineStakingReward != null) { + this.setDeclineStakingReward(props.declineStakingReward); + } + + if (props.autoRenewAccountId != null) { + this.setAutoRenewAccountId(props.autoRenewAccountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {ContractUpdateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const update = + /** @type {HashgraphProto.proto.IContractUpdateTransactionBody} */ ( + body.contractUpdateInstance + ); + + let autoRenewPeriod = undefined; + if ( + update.autoRenewPeriod != null && + update.autoRenewPeriod.seconds != null + ) { + autoRenewPeriod = update.autoRenewPeriod.seconds; + } + + let contractMemo = undefined; + if (update.memoWrapper != null && update.memoWrapper.value != null) { + contractMemo = update.memoWrapper.value; + } + + let maxAutomaticTokenAssociations = undefined; + if ( + update.maxAutomaticTokenAssociations != null && + update.maxAutomaticTokenAssociations.value != null + ) { + maxAutomaticTokenAssociations = + update.maxAutomaticTokenAssociations.value; + } + + return Transaction_Transaction._fromProtobufTransactions( + new ContractUpdateTransaction({ + contractId: + update.contractID != null + ? ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + update.contractID + ), + ) + : undefined, + bytecodeFileId: + update.fileID != null + ? FileId._fromProtobuf( + /** @type {HashgraphProto.proto.IFileID} */ ( + update.fileID + ), + ) + : undefined, + expirationTime: + update.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(update.expirationTime) + : undefined, + adminKey: + update.adminKey != null + ? src_Key_Key._fromProtobufKey(update.adminKey) + : undefined, + proxyAccountId: + update.proxyAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + update.proxyAccountID + ), + ) + : undefined, + autoRenewPeriod, + contractMemo, + maxAutomaticTokenAssociations, + stakedAccountId: + update.stakedAccountId != null + ? AccountId_AccountId._fromProtobuf(update.stakedAccountId) + : undefined, + stakedNodeId: + update.stakedNodeId != null + ? update.stakedNodeId + : undefined, + declineStakingReward: + update.declineReward != null && + Boolean(update.declineReward) == true, + autoRenewAccountId: + update.autoRenewAccountId != null + ? AccountId_AccountId._fromProtobuf(update.autoRenewAccountId) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * Sets the contract ID which is being deleted in this transaction. + * + * @param {ContractId | string} contractId + * @returns {ContractUpdateTransaction} + */ + setContractId(contractId) { + this._requireNotFrozen(); + this._contractId = + typeof contractId === "string" + ? ContractId_ContractId.fromString(contractId) + : contractId.clone(); + + return this; + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * Sets the contract ID which is being deleted in this transaction. + * + * @param {Timestamp | Date} expirationTime + * @returns {ContractUpdateTransaction} + */ + setExpirationTime(expirationTime) { + this._requireNotFrozen(); + this._expirationTime = + expirationTime instanceof Timestamp_Timestamp + ? expirationTime + : Timestamp_Timestamp.fromDate(expirationTime); + + return this; + } + + /** + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @param {Key} adminKey + * @returns {this} + */ + setAdminKey(adminKey) { + this._requireNotFrozen(); + this._adminKey = adminKey; + + return this; + } + + /** + * @deprecated + * @returns {?AccountId} + */ + get proxyAccountId() { + return this._proxyAccountId; + } + + /** + * @deprecated + * @param {AccountId | string} proxyAccountId + * @returns {this} + */ + setProxyAccountId(proxyAccountId) { + this._requireNotFrozen(); + this._proxyAccountId = + typeof proxyAccountId === "string" + ? AccountId_AccountId.fromString(proxyAccountId) + : proxyAccountId.clone(); + + return this; + } + + /** + * @returns {?Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @returns {?FileId} + */ + get bytecodeFileId() { + return this._bytecodeFileId; + } + + /** + * @param {FileId | string} bytecodeFileId + * @returns {this} + */ + setBytecodeFileId(bytecodeFileId) { + console.warn("Deprecated: there is no replacement"); + this._requireNotFrozen(); + this._bytecodeFileId = + typeof bytecodeFileId === "string" + ? FileId.fromString(bytecodeFileId) + : bytecodeFileId.clone(); + + return this; + } + + /** + * @returns {?string} + */ + get contractMemo() { + return this._contractMemo; + } + + /** + * @param {string} contractMemo + * @returns {this} + */ + setContractMemo(contractMemo) { + this._requireNotFrozen(); + this._contractMemo = contractMemo; + + return this; + } + + /** + * @returns {this} + */ + clearContractMemo() { + this._requireNotFrozen(); + this._contractMemo = null; + + return this; + } + + /** + * @returns {number | null} + */ + get maxAutomaticTokenAssociations() { + return this._maxAutomaticTokenAssociations; + } + + /** + * @param {number} maxAutomaticTokenAssociations + * @returns {this} + */ + setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) { + this._requireNotFrozen(); + this._maxAutomaticTokenAssociations = maxAutomaticTokenAssociations; + + return this; + } + + /** + * @returns {?AccountId} + */ + get stakedAccountId() { + return this._stakedAccountId; + } + + /** + * @param {AccountId | string} stakedAccountId + * @returns {this} + */ + setStakedAccountId(stakedAccountId) { + this._requireNotFrozen(); + this._stakedAccountId = + typeof stakedAccountId === "string" + ? AccountId_AccountId.fromString(stakedAccountId) + : stakedAccountId; + + return this; + } + + /** + * @returns {?Long} + */ + get stakedNodeId() { + return this._stakedNodeId; + } + + /** + * @param {Long | number} stakedNodeId + * @returns {this} + */ + setStakedNodeId(stakedNodeId) { + this._requireNotFrozen(); + this._stakedNodeId = src_long.fromValue(stakedNodeId); + + return this; + } + + /** + * @returns {?boolean} + */ + get declineStakingRewards() { + return this._declineStakingReward; + } + + /** + * @param {boolean} declineStakingReward + * @returns {this} + */ + setDeclineStakingReward(declineStakingReward) { + this._requireNotFrozen(); + this._declineStakingReward = declineStakingReward; + + return this; + } + + /** + * @returns {?AccountId} + */ + get autoRenewAccountId() { + return this._autoRenewAccountId; + } + + /** + * If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew + * account. Otherwise it updates the contract's auto-renew account to the referenced account. + * + * @param {string | AccountId} autoRenewAccountId + * @returns {this} + */ + setAutoRenewAccountId(autoRenewAccountId) { + this._requireNotFrozen(); + this._autoRenewAccountId = + typeof autoRenewAccountId === "string" + ? AccountId_AccountId.fromString(autoRenewAccountId) + : autoRenewAccountId; + + return this; + } + + /** + * @returns {this} + */ + clearAutoRenewAccountId() { + this._autoRenewAccountId = new AccountId_AccountId(0); + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._contractId != null) { + this._contractId.validateChecksum(client); + } + + if (this._bytecodeFileId != null) { + this._bytecodeFileId.validateChecksum(client); + } + + if (this._proxyAccountId != null) { + this._proxyAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.updateContract(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "contractUpdateInstance"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IContractUpdateTransactionBody} + */ + _makeTransactionData() { + return { + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + expirationTime: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + proxyAccountID: + this._proxyAccountId != null + ? this._proxyAccountId._toProtobuf() + : null, + autoRenewPeriod: + this._autoRenewPeriod != null + ? this._autoRenewPeriod._toProtobuf() + : null, + fileID: this._bytecodeFileId + ? this._bytecodeFileId._toProtobuf() + : null, + memoWrapper: + this._contractMemo != null + ? { + value: this._contractMemo, + } + : null, + maxAutomaticTokenAssociations: + this._maxAutomaticTokenAssociations != null + ? { + value: this._maxAutomaticTokenAssociations, + } + : null, + stakedAccountId: + this.stakedAccountId != null + ? this.stakedAccountId._toProtobuf() + : null, + stakedNodeId: this.stakedNodeId, + declineReward: + this.declineStakingRewards != null + ? { value: this.declineStakingRewards } + : null, + autoRenewAccountId: + this._autoRenewAccountId != null + ? this._autoRenewAccountId._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `ContractUpdateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "contractUpdateInstance", + // eslint-disable-next-line @typescript-eslint/unbound-method + ContractUpdateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/CustomFee.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ICustomFee} HashgraphProto.proto.ICustomFee + */ + +class CustomFee { + /** + * @param {object} props + * @param {AccountId | string} [props.feeCollectorAccountId] + * @param {boolean} [props.allCollectorsAreExempt] + */ + constructor(props = {}) { + /** + * @type {?AccountId} + */ + this._feeCollectorAccountId = null; + + this._allCollectorsAreExempt = false; + + if (props.feeCollectorAccountId != null) { + this.setFeeCollectorAccountId(props.feeCollectorAccountId); + } + + if (props.allCollectorsAreExempt != null) { + this.setAllCollectorsAreExempt(props.allCollectorsAreExempt); + } + } + + /** + * @returns {?AccountId} + */ + get feeCollectorAccountId() { + return this._feeCollectorAccountId; + } + + /** + * @param {AccountId | string} feeCollectorAccountId + * @returns {this} + */ + setFeeCollectorAccountId(feeCollectorAccountId) { + this._feeCollectorAccountId = + typeof feeCollectorAccountId === "string" + ? AccountId_AccountId.fromString(feeCollectorAccountId) + : feeCollectorAccountId; + return this; + } + + /** + * @returns {boolean} + */ + get allCollectorsAreExempt() { + return this._allCollectorsAreExempt; + } + + /** + * @param {boolean} allCollectorsAreExempt + * @returns {this} + */ + setAllCollectorsAreExempt(allCollectorsAreExempt) { + this._allCollectorsAreExempt = allCollectorsAreExempt; + return this; + } + + /** + * @internal + * @abstract + * @param {HashgraphProto.proto.ICustomFee} info + * @returns {CustomFee} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static _fromProtobuf(info) { + throw new Error("not implemented"); + } + + /** + * @internal + * @abstract + * @returns {HashgraphProto.proto.ICustomFee} + */ + _toProtobuf() { + throw new Error("not implemented"); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ICustomFee} HashgraphProto.proto.ICustomFee + * @typedef {import("@hashgraph/proto").proto.IFixedFee} HashgraphProto.proto.IFixedFee + */ + +class CustomFixedFee extends CustomFee { + /** + * @param {object} props + * @param {AccountId | string} [props.feeCollectorAccountId] + * @param {boolean} [props.allCollectorsAreExempt] + * @param {TokenId | string} [props.denominatingTokenId] + * @param {Long | number} [props.amount] + */ + constructor(props = {}) { + super(props); + + /** + * @type {?TokenId} + */ + this._denominatingTokenId = null; + + if (props.denominatingTokenId != null) { + this.setDenominatingTokenId(props.denominatingTokenId); + } + + /** + * @type {?Long} + */ + this._amount = null; + + if (props.amount != null) { + this.setAmount(props.amount); + } + } + + /** + * @param {Hbar} amount + * @returns {CustomFixedFee} + */ + setHbarAmount(amount) { + this._amount = amount.toTinybars(); + this._denominatingTokenId = null; + return this; + } + + /** + * @returns {TokenId | Hbar | null} + */ + get hbarAmount() { + return this._denominatingTokenId != null + ? null + : Hbar_Hbar.fromTinybars(this._amount != null ? this._amount : 0); + } + + /** + * @returns {CustomFixedFee} + */ + setDenominatingTokenToSameToken() { + this._denominatingTokenId = new TokenId_TokenId(0, 0, 0); + return this; + } + + /** + * @returns {?TokenId} + */ + get denominatingTokenId() { + return this._denominatingTokenId; + } + + /** + * @param {TokenId | string} denominatingTokenId + * @returns {CustomFixedFee} + */ + setDenominatingTokenId(denominatingTokenId) { + this._denominatingTokenId = + typeof denominatingTokenId === "string" + ? TokenId_TokenId.fromString(denominatingTokenId) + : denominatingTokenId; + return this; + } + + /** + * @returns {?Long} + */ + get amount() { + return this._amount; + } + + /** + * @param {Long | number} amount + * @returns {CustomFixedFee} + */ + setAmount(amount) { + this._amount = + typeof amount === "number" ? src_long.fromNumber(amount) : amount; + return this; + } + + /** + * @internal + * @override + * @param {HashgraphProto.proto.ICustomFee} info + * @returns {CustomFee} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static _fromProtobuf(info) { + const fee = /** @type {HashgraphProto.proto.IFixedFee} */ ( + info.fixedFee + ); + + return new CustomFixedFee({ + feeCollectorAccountId: + info.feeCollectorAccountId != null + ? AccountId_AccountId._fromProtobuf(info.feeCollectorAccountId) + : undefined, + allCollectorsAreExempt: + info.allCollectorsAreExempt != null + ? info.allCollectorsAreExempt + : undefined, + denominatingTokenId: + fee.denominatingTokenId != null + ? TokenId_TokenId._fromProtobuf(fee.denominatingTokenId) + : undefined, + amount: fee.amount != null ? fee.amount : undefined, + }); + } + + /** + * @internal + * @abstract + * @returns {HashgraphProto.proto.ICustomFee} + */ + _toProtobuf() { + return { + feeCollectorAccountId: + this.feeCollectorAccountId != null + ? this.feeCollectorAccountId._toProtobuf() + : null, + allCollectorsAreExempt: this.allCollectorsAreExempt, + fixedFee: { + denominatingTokenId: + this._denominatingTokenId != null + ? this._denominatingTokenId._toProtobuf() + : null, + amount: this._amount, + }, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/FeeAssessmentMethod.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +class FeeAssessmentMethod { + /** + * @hideconstructor + * @internal + * @param {boolean} value + */ + constructor(value) { + /** @readonly */ + this._value = value; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case FeeAssessmentMethod.Inclusive: + return "INCLUSIVE"; + case FeeAssessmentMethod.Exclusive: + return "EXCLUSIVE"; + default: + return `UNKNOWN (${this._value.toString()})`; + } + } + + /** + * @internal + * @param {boolean} value + * @returns {FeeAssessmentMethod} + */ + static _fromValue(value) { + switch (value) { + case false: + return FeeAssessmentMethod.Inclusive; + case true: + return FeeAssessmentMethod.Exclusive; + } + } + + /** + * @returns {boolean} + */ + valueOf() { + return this._value; + } +} + +FeeAssessmentMethod.Inclusive = new FeeAssessmentMethod(false); +FeeAssessmentMethod.Exclusive = new FeeAssessmentMethod(true); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ICustomFee} HashgraphProto.proto.ICustomFee + * @typedef {import("@hashgraph/proto").proto.IFractionalFee} HashgraphProto.proto.IFractionalFee + * @typedef {import("@hashgraph/proto").proto.IFraction} HashgraphProto.proto.IFraction + */ + +class CustomFractionalFee extends CustomFee { + /** + * @param {object} props + * @param {AccountId | string} [props.feeCollectorAccountId] + * @param {boolean} [props.allCollectorsAreExempt] + * @param {Long | number} [props.numerator] + * @param {Long | number} [props.denominator] + * @param {Long | number} [props.min] + * @param {Long | number} [props.max] + * @param {FeeAssessmentMethod} [props.assessmentMethod] + */ + constructor(props = {}) { + super(props); + + /** + * @type {?Long} + */ + this._numerator = null; + + if (props.numerator != null) { + this.setNumerator(props.numerator); + } + + /** + * @type {?Long} + */ + this._denominator = null; + + if (props.denominator != null) { + this.setDenominator(props.denominator); + } + + /** + * @type {?Long} + */ + this._min = null; + + if (props.min != null) { + this.setMin(props.min); + } + + /** + * @type {?Long} + */ + this._max; + + if (props.max != null) { + this.setMax(props.max); + } + + /** + * @type {?FeeAssessmentMethod} + */ + this._assessmentMethod; + + if (props.assessmentMethod != null) { + this.setAssessmentMethod(props.assessmentMethod); + } + } + + /** + * @returns {?Long} + */ + get numerator() { + return this._numerator; + } + + /** + * @param {Long | number} numerator + * @returns {CustomFractionalFee} + */ + setNumerator(numerator) { + this._numerator = + typeof numerator === "number" + ? src_long.fromNumber(numerator) + : numerator; + return this; + } + + /** + * @returns {?Long} + */ + get denominator() { + return this._denominator; + } + + /** + * @param {Long | number} denominator + * @returns {CustomFractionalFee} + */ + setDenominator(denominator) { + this._denominator = + typeof denominator === "number" + ? src_long.fromNumber(denominator) + : denominator; + return this; + } + + /** + * @returns {?Long} + */ + get min() { + return this._min; + } + + /** + * @param {Long | number} min + * @returns {CustomFractionalFee} + */ + setMin(min) { + this._min = typeof min === "number" ? src_long.fromNumber(min) : min; + return this; + } + + /** + * @returns {?Long} + */ + get max() { + return this._max; + } + + /** + * @param {Long | number} max + * @returns {CustomFractionalFee} + */ + setMax(max) { + this._max = typeof max === "number" ? src_long.fromNumber(max) : max; + return this; + } + + /** + * @returns {?FeeAssessmentMethod} + */ + get assessmentMethod() { + return this._assessmentMethod; + } + + /** + * @param {FeeAssessmentMethod} assessmentMethod + * @returns {CustomFractionalFee} + */ + setAssessmentMethod(assessmentMethod) { + this._assessmentMethod = assessmentMethod; + return this; + } + + /** + * @internal + * @override + * @param {HashgraphProto.proto.ICustomFee} info + * @returns {CustomFee} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static _fromProtobuf(info) { + const fee = /** @type {HashgraphProto.proto.IFractionalFee} */ ( + info.fractionalFee + ); + const fractional = /** @type {HashgraphProto.proto.IFraction} */ ( + fee.fractionalAmount + ); + + return new CustomFractionalFee({ + feeCollectorAccountId: + info.feeCollectorAccountId != null + ? AccountId_AccountId._fromProtobuf(info.feeCollectorAccountId) + : undefined, + allCollectorsAreExempt: + info.allCollectorsAreExempt != null + ? info.allCollectorsAreExempt + : undefined, + numerator: + fractional.numerator != null ? fractional.numerator : undefined, + denominator: + fractional.denominator != null + ? fractional.denominator + : undefined, + min: fee.minimumAmount != null ? fee.minimumAmount : undefined, + max: fee.maximumAmount != null ? fee.maximumAmount : undefined, + assessmentMethod: + fee.netOfTransfers != null + ? new FeeAssessmentMethod(fee.netOfTransfers) + : undefined, + }); + } + + /** + * @internal + * @abstract + * @returns {HashgraphProto.proto.ICustomFee} + */ + _toProtobuf() { + return { + feeCollectorAccountId: + this.feeCollectorAccountId != null + ? this.feeCollectorAccountId._toProtobuf() + : null, + allCollectorsAreExempt: this.allCollectorsAreExempt, + fractionalFee: { + fractionalAmount: { + numerator: this._numerator, + denominator: this._denominator, + }, + minimumAmount: this._min, + maximumAmount: this._max, + netOfTransfers: + this._assessmentMethod != null + ? this._assessmentMethod.valueOf() + : false, + }, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IFraction} HashgraphProto.proto.IFraction + * @typedef {import("@hashgraph/proto").proto.IRoyaltyFee} HashgraphProto.proto.IRoyaltyFee + * @typedef {import("@hashgraph/proto").proto.ICustomFee} HashgraphProto.proto.ICustomFee + * @typedef {import("@hashgraph/proto").proto.IFixedFee} HashgraphProto.proto.IFixedFee + */ + +class CustomRoyalyFee extends CustomFee { + /** + * @param {object} props + * @param {AccountId | string} [props.feeCollectorAccountId] + * @param {boolean} [props.allCollectorsAreExempt] + * @param {Long | number} [props.numerator] + * @param {Long | number} [props.denominator] + * @param {CustomFixedFee} [props.fallbackFee] + */ + constructor(props = {}) { + super(props); + + /** + * @type {?CustomFixedFee} + */ + this._fallbackFee = null; + + if (props.fallbackFee != null) { + this.setFallbackFee(props.fallbackFee); + } + + /** + * @type {?Long} + */ + this._numerator = null; + + if (props.numerator != null) { + this.setNumerator(props.numerator); + } + + /** + * @type {?Long} + */ + this._denominator = null; + + if (props.denominator != null) { + this.setDenominator(props.denominator); + } + } + + /** + * @returns {?CustomFixedFee} + */ + get fallbackFee() { + return this._fallbackFee; + } + + /** + * @param {CustomFixedFee} fallbackFee + * @returns {CustomRoyalyFee} + */ + setFallbackFee(fallbackFee) { + this._fallbackFee = fallbackFee; + return this; + } + + /** + * @returns {?Long} + */ + get numerator() { + return this._numerator; + } + + /** + * @param {Long | number} numerator + * @returns {CustomRoyalyFee} + */ + setNumerator(numerator) { + this._numerator = + typeof numerator === "number" + ? src_long.fromNumber(numerator) + : numerator; + return this; + } + + /** + * @returns {?Long} + */ + get denominator() { + return this._denominator; + } + + /** + * @param {Long | number} denominator + * @returns {CustomRoyalyFee} + */ + setDenominator(denominator) { + this._denominator = + typeof denominator === "number" + ? src_long.fromNumber(denominator) + : denominator; + return this; + } + + /** + * @internal + * @override + * @param {HashgraphProto.proto.ICustomFee} info + * @returns {CustomFee} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static _fromProtobuf(info) { + const fee = /** @type {HashgraphProto.proto.IRoyaltyFee} */ ( + info.royaltyFee + ); + const fraction = /** @type {HashgraphProto.proto.IFraction} */ ( + fee.exchangeValueFraction + ); + + return new CustomRoyalyFee({ + feeCollectorAccountId: + info.feeCollectorAccountId != null + ? AccountId_AccountId._fromProtobuf(info.feeCollectorAccountId) + : undefined, + allCollectorsAreExempt: + info.allCollectorsAreExempt != null + ? info.allCollectorsAreExempt + : undefined, + fallbackFee: + fee.fallbackFee != null + ? /** @type {CustomFixedFee} */ ( + CustomFixedFee._fromProtobuf({ + fixedFee: fee.fallbackFee, + }) + ) + : undefined, + numerator: + fraction.numerator != null ? fraction.numerator : undefined, + denominator: + fraction.denominator != null ? fraction.denominator : undefined, + }); + } + + /** + * @internal + * @abstract + * @returns {HashgraphProto.proto.ICustomFee} + */ + _toProtobuf() { + return { + feeCollectorAccountId: + this.feeCollectorAccountId != null + ? this.feeCollectorAccountId._toProtobuf() + : null, + allCollectorsAreExempt: this.allCollectorsAreExempt, + royaltyFee: { + exchangeValueFraction: { + numerator: this._numerator, + denominator: this._denominator, + }, + fallbackFee: + this._fallbackFee != null + ? this._fallbackFee._toProtobuf().fixedFee + : null, + }, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/contract/DelegateContractId.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace {proto} + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + */ + +/** + * @typedef {import("long").Long} Long + * @typedef {import("../client/Client.js").default<*, *>} Client + */ + +class DelegateContractId extends ContractId_ContractId { + /** + * @param {number | Long | import("../EntityIdHelper").IEntityId} props + * @param {(number | Long)=} realm + * @param {(number | Long)=} num + * @param {Uint8Array=} evmAddress + */ + constructor(props, realm, num, evmAddress) { + super(props, realm, num, evmAddress); + } + + /** + * @param {Long | number} shard + * @param {Long | number} realm + * @param {string} evmAddress + * @returns {ContractId} + */ + static fromEvmAddress(shard, realm, evmAddress) { + return new DelegateContractId(shard, realm, 0, decode(evmAddress)); + } + + /** + * @param {string} text + * @returns {DelegateContractId} + */ + static fromString(text) { + return new DelegateContractId(ContractId_ContractId.fromString(text)); + } + + /** + * @internal + * @param {HashgraphProto.proto.IContractID} id + * @returns {DelegateContractId} + */ + static _fromProtobuf(id) { + return new DelegateContractId(ContractId_ContractId._fromProtobuf(id)); + } + + /** + * @param {Uint8Array} bytes + * @returns {DelegateContractId} + */ + static fromBytes(bytes) { + return new DelegateContractId(ContractId_ContractId.fromBytes(bytes)); + } + + /** + * @param {string} address + * @returns {DelegateContractId} + */ + static fromSolidityAddress(address) { + // eslint-disable-next-line deprecation/deprecation + return new DelegateContractId(ContractId_ContractId.fromSolidityAddress(address)); + } + + /** + * @returns {DelegateContractId} + */ + clone() { + const id = new DelegateContractId(this); + id._checksum = this._checksum; + return id; + } + + /** + * @returns {HashgraphProto.proto.IKey} + */ + _toProtobufKey() { + return { + delegatableContractId: this._toProtobuf(), + }; + } + + /** + * @param {HashgraphProto.proto.IContractID} key + * @returns {DelegateContractId} + */ + static __fromProtobufKey(key) { + return DelegateContractId._fromProtobuf(key); + } +} + +src_Cache.setDelegateContractId((key) => DelegateContractId.__fromProtobufKey(key)); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EthereumTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IEthereumTransactionBody} HashgraphProto.proto.IEthereumTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./channel/Channel.js").default} Channel + * @typedef {import("./client/Client.js").default<*, *>} Client + * @typedef {import("./Timestamp.js").default} Timestamp + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("long").Long} Long + */ + +/** + * Create a new Hedera™ transaction wrapped ethereum transaction. + */ +class EthereumTransaction_EthereumTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Uint8Array} [props.ethereumData] + * @param {FileId} [props.callData] + * @param {FileId} [props.callDataFileId] + * @param {number | string | Long | BigNumber | Hbar} [props.maxGasAllowance] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?Uint8Array} + */ + this._ethereumData = null; + + /** + * @private + * @type {?FileId} + */ + this._callDataFileId = null; + + /** + * @private + * @type {?Hbar} + */ + this._maxGasAllowance = null; + + if (props.ethereumData != null) { + this.setEthereumData(props.ethereumData); + } + + if (props.callData != null) { + this.setCallDataFileId(props.callData); + } + + if (props.callDataFileId != null) { + this.setCallDataFileId(props.callDataFileId); + } + + if (props.maxGasAllowance != null) { + this.setMaxGasAllowanceHbar(props.maxGasAllowance); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {EthereumTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const transaction = + /** @type {HashgraphProto.proto.IEthereumTransactionBody} */ ( + body.ethereumTransaction + ); + + return Transaction_Transaction._fromProtobufTransactions( + new EthereumTransaction_EthereumTransaction({ + ethereumData: + transaction.ethereumData != null + ? transaction.ethereumData + : undefined, + callData: + transaction.callData != null + ? FileId._fromProtobuf(transaction.callData) + : undefined, + maxGasAllowance: + transaction.maxGasAllowance != null + ? Hbar_Hbar.fromTinybars(transaction.maxGasAllowance) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?(Uint8Array | FileId)} + */ + get ethereumData() { + return this._ethereumData; + } + + /** + * The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete + * unless the callData field is set. + * + * @param {Uint8Array} ethereumData + * @returns {this} + */ + setEthereumData(ethereumData) { + this._requireNotFrozen(); + this._ethereumData = ethereumData; + return this; + } + + /** + * @deprecated - Use `callDataFileId` instead + * @returns {?FileId} + */ + get callData() { + return this.callDataFileId; + } + + /** + * @deprecated - Use `setCallDataFileId()` instead + * + * For large transactions (for example contract create) this is the callData + * of the callData. The data in the callData will be re-written with + * the callData element as a zero length string with the original contents in + * the referenced file at time of execution. The callData will need to be + * "rehydrated" with the callData for signature validation to pass. + * @param {FileId} callDataFileId + * @returns {this} + */ + setCallData(callDataFileId) { + return this.setCallDataFileId(callDataFileId); + } + + /** + * @returns {?FileId} + */ + get callDataFileId() { + return this._callDataFileId; + } + + /** + * For large transactions (for example contract create) this is the callData + * of the callData. The data in the callData will be re-written with + * the callData element as a zero length string with the original contents in + * the referenced file at time of execution. The callData will need to be + * "rehydrated" with the callData for signature validation to pass. + * + * @param {FileId} callDataFileId + * @returns {this} + */ + setCallDataFileId(callDataFileId) { + this._requireNotFrozen(); + this._callDataFileId = callDataFileId; + return this; + } + + /** + * @returns {?Hbar} + */ + get maxGasAllowance() { + return this._maxGasAllowance; + } + + /** + * @deprecated -- use setMaxGasAllowanceHbar instead + * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance + * @returns {this} + */ + setMaxGasAllowance(maxGasAllowance) { + return this.setMaxGasAllowanceHbar(maxGasAllowance); + } + + /** + * The maximum amount, in tinybars, that the payer of the hedera transaction + * is willing to pay to complete the transaction. + * + * Ordinarily the account with the ECDSA alias corresponding to the public + * key that is extracted from the ethereum_data signature is responsible for + * fees that result from the execution of the transaction. If that amount of + * authorized fees is not sufficient then the payer of the transaction can be + * charged, up to but not exceeding this amount. If the ethereum_data + * transaction authorized an amount that was insufficient then the payer will + * only be charged the amount needed to make up the difference. If the gas + * price in the transaction was set to zero then the payer will be assessed + * the entire fee. + * + * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance + * @returns {this} + */ + setMaxGasAllowanceHbar(maxGasAllowance) { + this._requireNotFrozen(); + this._maxGasAllowance = + maxGasAllowance instanceof Hbar_Hbar + ? maxGasAllowance + : new Hbar_Hbar(maxGasAllowance); + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if ( + this._ethereumData != null && + this._ethereumData instanceof FileId + ) { + this._ethereumData.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.smartContract.callEthereum(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "ethereumTransaction"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IEthereumTransactionBody} + */ + _makeTransactionData() { + return { + ethereumData: this._ethereumData, + callData: + this._callDataFileId != null + ? this._callDataFileId._toProtobuf() + : null, + maxGasAllowance: + this._maxGasAllowance != null + ? this._maxGasAllowance.toTinybars() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("./Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `EthereumTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "ethereumTransaction", + // eslint-disable-next-line @typescript-eslint/unbound-method + EthereumTransaction_EthereumTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@ethersproject/rlp/lib.esm/_version.js +const rlp_lib_esm_version_version = "rlp/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/rlp/lib.esm/index.js + +//See: https://github.com/ethereum/wiki/wiki/RLP + + + +const rlp_lib_esm_logger = new lib_esm_Logger(rlp_lib_esm_version_version); +function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} +function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; +} +function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + if (!isBytesLike(object)) { + rlp_lib_esm_logger.throwArgumentError("RLP object must be BytesLike", "object", object); + } + const data = Array.prototype.slice.call(lib_esm_arrayify(object)); + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } + else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); +} +function lib_esm_encode(object) { + return lib_esm_hexlify(_encode(object)); +} +function _decodeChildren(data, offset, childOffset, length) { + const result = []; + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + result.push(decoded.result); + childOffset += decoded.consumed; + if (childOffset > offset + 1 + length) { + rlp_lib_esm_logger.throwError("child data too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + } + return { consumed: (1 + length), result: result }; +} +// returns { consumed: number, result: Object } +function _decode(data, offset) { + if (data.length === 0) { + rlp_lib_esm_logger.throwError("data too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + if (offset + 1 + lengthLength > data.length) { + rlp_lib_esm_logger.throwError("data short segment too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + const length = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length > data.length) { + rlp_lib_esm_logger.throwError("data long segment too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } + else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + if (offset + 1 + length > data.length) { + rlp_lib_esm_logger.throwError("data array too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1, length); + } + else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + if (offset + 1 + lengthLength > data.length) { + rlp_lib_esm_logger.throwError("data array too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + const length = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length > data.length) { + rlp_lib_esm_logger.throwError("data array too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + const result = lib_esm_hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: (1 + lengthLength + length), result: result }; + } + else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + if (offset + 1 + length > data.length) { + rlp_lib_esm_logger.throwError("data too short", lib_esm_Logger.errors.BUFFER_OVERRUN, {}); + } + const result = lib_esm_hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: (1 + length), result: result }; + } + return { consumed: 1, result: lib_esm_hexlify(data[offset]) }; +} +function lib_esm_decode(data) { + const bytes = lib_esm_arrayify(data); + const decoded = _decode(bytes, 0); + if (decoded.consumed !== bytes.length) { + rlp_lib_esm_logger.throwArgumentError("invalid rlp data", "data", data); + } + return decoded.result; +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js + + +class EthereumTransactionData_EthereumTransactionData { + /** + * @protected + * @param {object} props + * @param {Uint8Array} props.callData + */ + constructor(props) { + this.callData = props.callData; + } + + /** + * @param {Uint8Array} bytes + * @returns {EthereumTransactionData} + */ + static fromBytes(bytes) { + if (bytes.length === 0) { + throw new Error("empty bytes"); + } + + switch (bytes[0]) { + case 1: + return src_Cache.ethereumTransactionDataEip2930FromBytes(bytes); + case 2: + return src_Cache.ethereumTransactionDataEip1559FromBytes(bytes); + default: + return src_Cache.ethereumTransactionDataLegacyFromBytes(bytes); + } + } + + // eslint-disable-next-line jsdoc/require-returns-check + /** + * @returns {Uint8Array} + */ + toBytes() { + throw new Error("not implemented"); + } + + // eslint-disable-next-line jsdoc/require-returns-check + /** + * @returns {string} + */ + toString() { + throw new Error("not implemented"); + } + + // eslint-disable-next-line jsdoc/require-returns-check + /** + * @returns {{[key: string]: any}} + */ + toJSON() { + throw new Error("not implemented"); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EthereumTransactionDataLegacy.js + + + + + +/** + * @typedef {object} EthereumTransactionDataLegacyJSON + * @property {string} nonce + * @property {string} gasPrice + * @property {string} gasLimit + * @property {string} to + * @property {string} value + * @property {string} callData + * @property {string} v + * @property {string} r + * @property {string} s + */ + +class EthereumTransactionDataLegacy extends EthereumTransactionData_EthereumTransactionData { + /** + * @private + * @param {object} props + * @param {Uint8Array} props.nonce + * @param {Uint8Array} props.gasPrice + * @param {Uint8Array} props.gasLimit + * @param {Uint8Array} props.to + * @param {Uint8Array} props.value + * @param {Uint8Array} props.callData + * @param {Uint8Array} props.v + * @param {Uint8Array} props.r + * @param {Uint8Array} props.s + */ + constructor(props) { + super(props); + + this.nonce = props.nonce; + this.gasPrice = props.gasPrice; + this.gasLimit = props.gasLimit; + this.to = props.to; + this.value = props.value; + this.v = props.v; + this.r = props.r; + this.s = props.s; + } + + /** + * @param {Uint8Array} bytes + * @returns {EthereumTransactionData} + */ + static fromBytes(bytes) { + if (bytes.length === 0) { + throw new Error("empty bytes"); + } + + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const decoded = /** @type {string[]} */ (lib_esm_decode(bytes)); + + if (decoded.length != 9) { + throw new Error("invalid ethereum transaction data"); + } + + return new EthereumTransactionDataLegacy({ + nonce: decode(/** @type {string} */ (decoded[0])), + gasPrice: decode(/** @type {string} */ (decoded[1])), + gasLimit: decode(/** @type {string} */ (decoded[2])), + to: decode(/** @type {string} */ (decoded[3])), + value: decode(/** @type {string} */ (decoded[4])), + callData: decode(/** @type {string} */ (decoded[5])), + v: decode(/** @type {string} */ (decoded[6])), + r: decode(/** @type {string} */ (decoded[7])), + s: decode(/** @type {string} */ (decoded[8])), + }); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return decode( + lib_esm_encode([ + this.nonce, + this.gasPrice, + this.gasLimit, + this.to, + this.value, + this.callData, + this.v, + this.r, + this.s, + ]), + ); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON(), null, 2); + } + + /** + * @returns {EthereumTransactionDataLegacyJSON} + */ + toJSON() { + return { + nonce: hex_browser_encode(this.nonce), + gasPrice: hex_browser_encode(this.gasPrice), + gasLimit: hex_browser_encode(this.gasLimit), + to: hex_browser_encode(this.to), + value: hex_browser_encode(this.value), + callData: hex_browser_encode(this.callData), + v: hex_browser_encode(this.v), + r: hex_browser_encode(this.r), + s: hex_browser_encode(this.s), + }; + } +} + +src_Cache.setEthereumTransactionDataLegacyFromBytes((bytes) => + EthereumTransactionDataLegacy.fromBytes(bytes), +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EthereumTransactionDataEip1559.js + + + + + +/** + * @typedef {object} EthereumTransactionDataEip1559JSON + * @property {string} chainId + * @property {string} nonce + * @property {string} maxPriorityGas + * @property {string} maxGas + * @property {string} gasLimit + * @property {string} to + * @property {string} value + * @property {string} callData + * @property {string[]} accessList + * @property {string} recId + * @property {string} r + * @property {string} s + */ + +class EthereumTransactionDataEip1559 extends EthereumTransactionData_EthereumTransactionData { + /** + * @private + * @param {object} props + * @param {Uint8Array} props.chainId + * @param {Uint8Array} props.nonce + * @param {Uint8Array} props.maxPriorityGas + * @param {Uint8Array} props.maxGas + * @param {Uint8Array} props.gasLimit + * @param {Uint8Array} props.to + * @param {Uint8Array} props.value + * @param {Uint8Array} props.callData + * @param {Uint8Array[]} props.accessList + * @param {Uint8Array} props.recId + * @param {Uint8Array} props.r + * @param {Uint8Array} props.s + */ + constructor(props) { + super(props); + + this.chainId = props.chainId; + this.nonce = props.nonce; + this.maxPriorityGas = props.maxPriorityGas; + this.maxGas = props.maxGas; + this.gasLimit = props.gasLimit; + this.to = props.to; + this.value = props.value; + this.accessList = props.accessList; + this.recId = props.recId; + this.r = props.r; + this.s = props.s; + } + + /** + * @param {Uint8Array} bytes + * @returns {EthereumTransactionData} + */ + static fromBytes(bytes) { + if (bytes.length === 0) { + throw new Error("empty bytes"); + } + + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const decoded = /** @type {string[]} */ (lib_esm_decode(bytes.subarray(1))); + + if (!Array.isArray(decoded)) { + throw new Error("ethereum data is not a list"); + } + + if (decoded.length != 12) { + throw new Error("invalid ethereum transaction data"); + } + + // TODO + return new EthereumTransactionDataEip1559({ + chainId: decode(/** @type {string} */ (decoded[0])), + nonce: decode(/** @type {string} */ (decoded[1])), + maxPriorityGas: decode(/** @type {string} */ (decoded[2])), + maxGas: decode(/** @type {string} */ (decoded[3])), + gasLimit: decode(/** @type {string} */ (decoded[4])), + to: decode(/** @type {string} */ (decoded[5])), + value: decode(/** @type {string} */ (decoded[6])), + callData: decode(/** @type {string} */ (decoded[7])), + // @ts-ignore + accessList: /** @type {string[]} */ (decoded[8]).map((v) => + decode(v), + ), + recId: decode(/** @type {string} */ (decoded[9])), + r: decode(/** @type {string} */ (decoded[10])), + s: decode(/** @type {string} */ (decoded[11])), + }); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + const encoded = lib_esm_encode([ + this.chainId, + this.nonce, + this.maxPriorityGas, + this.maxGas, + this.gasLimit, + this.to, + this.value, + this.callData, + this.accessList, + this.recId, + this.r, + this.s, + ]); + return decode("02" + encoded.substring(2)); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON(), null, 2); + } + + /** + * @returns {EthereumTransactionDataEip1559JSON} + */ + toJSON() { + return { + chainId: hex_browser_encode(this.chainId), + nonce: hex_browser_encode(this.nonce), + maxPriorityGas: hex_browser_encode(this.maxPriorityGas), + maxGas: hex_browser_encode(this.maxGas), + gasLimit: hex_browser_encode(this.gasLimit), + to: hex_browser_encode(this.to), + value: hex_browser_encode(this.value), + callData: hex_browser_encode(this.callData), + accessList: this.accessList.map((v) => hex_browser_encode(v)), + recId: hex_browser_encode(this.recId), + r: hex_browser_encode(this.r), + s: hex_browser_encode(this.s), + }; + } +} + +src_Cache.setEthereumTransactionDataEip1559FromBytes((bytes) => + EthereumTransactionDataEip1559.fromBytes(bytes), +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EthereumTransactionDataEip2930.js + + + + + +/** + * @typedef {object} EthereumTransactionDataEip2930JSON + * @property {string} chainId + * @property {string} nonce + * @property {string} gasPrice + * @property {string} gasLimit + * @property {string} to + * @property {string} value + * @property {string} callData + * @property {string[]} accessList + * @property {string} recId + * @property {string} r + * @property {string} s + */ + +class EthereumTransactionDataEip2930 extends EthereumTransactionData_EthereumTransactionData { + /** + * @private + * @param {object} props + * @param {Uint8Array} props.chainId + * @param {Uint8Array} props.nonce + * @param {Uint8Array} props.gasPrice + * @param {Uint8Array} props.gasLimit + * @param {Uint8Array} props.to + * @param {Uint8Array} props.value + * @param {Uint8Array} props.callData + * @param {Uint8Array[]} props.accessList + * @param {Uint8Array} props.recId + * @param {Uint8Array} props.r + * @param {Uint8Array} props.s + */ + constructor(props) { + super(props); + + this.chainId = props.chainId; + this.nonce = props.nonce; + this.gasPrice = props.gasPrice; + this.gasLimit = props.gasLimit; + this.to = props.to; + this.value = props.value; + this.accessList = props.accessList; + this.recId = props.recId; + this.r = props.r; + this.s = props.s; + } + + /** + * @param {Uint8Array} bytes + * @returns {EthereumTransactionData} + */ + static fromBytes(bytes) { + if (bytes.length === 0) { + throw new Error("empty bytes"); + } + + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const decoded = /** @type {string[]} */ (lib_esm_decode(bytes.subarray(1))); + + if (!Array.isArray(decoded)) { + throw new Error("ethereum data is not a list"); + } + + if (decoded.length !== 11) { + throw new Error("invalid ethereum transaction data"); + } + + // TODO + return new EthereumTransactionDataEip2930({ + chainId: decode(/** @type {string} */ (decoded[0])), + nonce: decode(/** @type {string} */ (decoded[1])), + gasPrice: decode(/** @type {string} */ (decoded[2])), + gasLimit: decode(/** @type {string} */ (decoded[3])), + to: decode(/** @type {string} */ (decoded[4])), + value: decode(/** @type {string} */ (decoded[5])), + callData: decode(/** @type {string} */ (decoded[6])), + // @ts-ignore + accessList: /** @type {string[]} */ (decoded[7]).map((v) => + decode(v), + ), + recId: decode(/** @type {string} */ (decoded[8])), + r: decode(/** @type {string} */ (decoded[9])), + s: decode(/** @type {string} */ (decoded[10])), + }); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + const encoded = lib_esm_encode([ + this.chainId, + this.nonce, + this.gasPrice, + this.gasLimit, + this.to, + this.value, + this.callData, + this.accessList, + this.recId, + this.r, + this.s, + ]); + return decode("01" + encoded.substring(2)); + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJSON(), null, 2); + } + + /** + * @returns {EthereumTransactionDataEip2930JSON} + */ + toJSON() { + return { + chainId: hex_browser_encode(this.chainId), + nonce: hex_browser_encode(this.nonce), + gasPrice: hex_browser_encode(this.gasPrice), + gasLimit: hex_browser_encode(this.gasLimit), + to: hex_browser_encode(this.to), + value: hex_browser_encode(this.value), + callData: hex_browser_encode(this.callData), + accessList: this.accessList.map((v) => hex_browser_encode(v)), + recId: hex_browser_encode(this.recId), + r: hex_browser_encode(this.r), + s: hex_browser_encode(this.s), + }; + } +} + +src_Cache.setEthereumTransactionDataEip2930FromBytes((bytes) => + EthereumTransactionDataEip2930.fromBytes(bytes), +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/EthereumFlow.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IEthereumTransactionBody} HashgraphProto.proto.IEthereumTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./file/FileId.js").default} FileId + * @typedef {import("./channel/Channel.js").default} Channel + * @typedef {import("./channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("./client/Client.js").default<*, *>} Client + * @typedef {import("./Timestamp.js").default} Timestamp + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("./transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("long").Long} Long + */ + +/** + * Create a new Hedera™ transaction wrapped ethereum transaction. + */ +class EthereumFlow { + /** + * @param {object} [props] + * @param {Uint8Array} [props.ethereumData] + * @param {FileId} [props.callData] + * @param {number | string | Long | BigNumber | Hbar} [props.maxGasAllowance] + */ + constructor(props = {}) { + /** + * @private + * @type {?EthereumTransactionData} + */ + this._ethereumData = null; + + /** + * @private + * @type {?FileId} + */ + this._callDataFileId = null; + + /** + * @private + * @type {?Hbar} + */ + this._maxGasAllowance = null; + + if (props.ethereumData != null) { + this.setEthereumData(props.ethereumData); + } + + if (props.maxGasAllowance != null) { + this.setMaxGasAllowanceHbar(props.maxGasAllowance); + } + + this._maxChunks = null; + } + + /** + * @returns {number | null} + */ + get maxChunks() { + return this._maxChunks; + } + + /** + * @param {number} maxChunks + * @returns {this} + */ + setMaxChunks(maxChunks) { + this._maxChunks = maxChunks; + return this; + } + + /** + * @returns {?EthereumTransactionData} + */ + get ethereumData() { + return this._ethereumData; + } + + /** + * The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete + * unless the callData field is set. + * + * @param {EthereumTransactionData | Uint8Array} ethereumData + * @returns {this} + */ + setEthereumData(ethereumData) { + this._ethereumData = + ethereumData instanceof Uint8Array + ? EthereumTransactionData.fromBytes(ethereumData) + : ethereumData; + return this; + } + + /** + * @returns {?Hbar} + */ + get maxGasAllowance() { + return this._maxGasAllowance; + } + + /** + * @deprecated - use masGasAllowanceHbar instead. + * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance + * @returns {this} + */ + setMaxGasAllowance(maxGasAllowance) { + return this.setMaxGasAllowanceHbar(maxGasAllowance); + } + + /** + * The maximum amount, in tinybars, that the payer of the hedera transaction + * is willing to pay to complete the transaction. + * + * Ordinarily the account with the ECDSA alias corresponding to the public + * key that is extracted from the ethereum_data signature is responsible for + * fees that result from the execution of the transaction. If that amount of + * authorized fees is not sufficient then the payer of the transaction can be + * charged, up to but not exceeding this amount. If the ethereum_data + * transaction authorized an amount that was insufficient then the payer will + * only be charged the amount needed to make up the difference. If the gas + * price in the transaction was set to zero then the payer will be assessed + * the entire fee. + * + * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance + * @returns {this} + */ + setMaxGasAllowanceHbar(maxGasAllowance) { + this._maxGasAllowance = + maxGasAllowance instanceof Hbar + ? maxGasAllowance + : new Hbar(maxGasAllowance); + return this; + } + + /** + * @template {Channel} ChannelT + * @template {MirrorChannel} MirrorChannelT + * @param {import("./client/Client.js").default} client + * @returns {Promise} + */ + async execute(client) { + if (this._ethereumData == null) { + throw new Error( + "cannot submit ethereum transaction with no ethereum data", + ); + } + + const ethereumTransaction = new EthereumTransaction(); + const ethereumTransactionDataBytes = this._ethereumData.toBytes(); + + if (this._maxGasAllowance != null) { + ethereumTransaction.setMaxGasAllowanceHbar(this._maxGasAllowance); + } + + if (this._callDataFileId != null) { + if (this._ethereumData.callData.length === 0) { + throw new Error( + "call data file ID provided, but ethereum data already contains call data", + ); + } + + ethereumTransaction + .setEthereumData(ethereumTransactionDataBytes) + .setCallDataFileId(this._callDataFileId); + } else if (ethereumTransactionDataBytes.length <= 5120) { + ethereumTransaction.setEthereumData(ethereumTransactionDataBytes); + } else { + const fileId = await createFile( + this._ethereumData.callData, + client, + this._maxChunks, + ); + + this._ethereumData.callData = new Uint8Array(); + + ethereumTransaction + .setEthereumData(this._ethereumData.toBytes()) + .setCallDataFileId(fileId); + } + + return ethereumTransaction.execute(client); + } +} + +/** + * @template {Channel} ChannelT + * @template {MirrorChannel} MirrorChannelT + * @param {Uint8Array} callData + * @param {import("./client/Client.js").default} client + * @param {?number} maxChunks + * @returns {Promise} + */ +async function createFile(callData, client, maxChunks) { + const hexedCallData = hex.encode(callData); + + const fileId = /** @type {FileId} */ ( + ( + await ( + await new FileCreateTransaction() + .setContents(hexedCallData.substring(0, 4096)) + .setKeys( + client.operatorPublicKey + ? [client.operatorPublicKey] + : [], + ) + .execute(client) + ).getReceipt(client) + ).fileId + ); + + if (callData.length > 4096) { + let fileAppendTransaction = new FileAppendTransaction() + .setFileId(fileId) + .setContents(hexedCallData.substring(4096, hexedCallData.length)); + if (maxChunks != null) { + fileAppendTransaction.setMaxChunks(maxChunks); + } + + await (await fileAppendTransaction.execute(client)).getReceipt(client); + } + + return fileId; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/ExchangeRates.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + +const { proto: ExchangeRates_proto } = lib_namespaceObject; + +class ExchangeRates { + /** + * @private + * @param {object} props + * @param {ExchangeRate} props.currentRate + * @param {ExchangeRate} props.nextRate + */ + constructor(props) { + /** + * @readonly + */ + this.currentRate = props.currentRate; + + /** + * @readonly + */ + this.nextRate = props.nextRate; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.IExchangeRateSet} rateSet + * @returns {ExchangeRates} + */ + static _fromProtobuf(rateSet) { + return new ExchangeRates({ + currentRate: ExchangeRate._fromProtobuf( + /** @type {HashgraphProto.proto.IExchangeRate} */ ( + rateSet.currentRate + ), + ), + nextRate: ExchangeRate._fromProtobuf( + /** @type {HashgraphProto.proto.IExchangeRate} */ ( + rateSet.nextRate + ), + ), + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IExchangeRateSet} + */ + _toProtobuf() { + return { + currentRate: this.currentRate._toProtobuf(), + nextRate: this.nextRate._toProtobuf(), + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {ExchangeRates} + */ + static fromBytes(bytes) { + return ExchangeRates._fromProtobuf(ExchangeRates_proto.ExchangeRateSet.decode(bytes)); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/FeeComponents.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + +class FeeComponents_FeeComponents { + /** + * @param {object} [props] + * @param {Long} [props.min] + * @param {Long} [props.max] + * @param {Long} [props.constant] + * @param {Long} [props.transactionBandwidthByte] + * @param {Long} [props.transactionVerification] + * @param {Long} [props.transactionRamByteHour] + * @param {Long} [props.transactionStorageByteHour] + * @param {Long} [props.contractTransactionGas] + * @param {Long} [props.transferVolumeHbar] + * @param {Long} [props.responseMemoryByte] + * @param {Long} [props.responseDiskByte] + */ + constructor(props = {}) { + /* + * A minimum, the calculated fee must be greater than this value + * + * @type {Long} + */ + this.min = props.min; + + /* + * A maximum, the calculated fee must be less than this value + * + * @type {Long} + */ + this.max = props.max; + + /* + * A constant contribution to the fee + * + * @type {Long} + */ + this.constant = props.constant; + + /* + * The price of bandwidth consumed by a transaction, measured in bytes + * + * @type {Long} + */ + this.transactionBandwidthByte = props.transactionBandwidthByte; + + /* + * The price per signature verification for a transaction + * + * @type {Long} + */ + this.transactionVerification = props.transactionVerification; + + /* + * The price of RAM consumed by a transaction, measured in byte-hours + * + * @type {Long} + */ + this.transactionRamByteHour = props.transactionRamByteHour; + + /* + * The price of storage consumed by a transaction, measured in byte-hours + * + * @type {Long} + */ + this.transactionStorageByteHour = props.transactionStorageByteHour; + + /* + * The price of computation for a smart contract transaction, measured in gas + * + * @type {Long} + */ + this.contractTransactionGas = props.contractTransactionGas; + + /* + * The price per hbar transferred for a transfer + * + * @type {Long} + */ + this.transferVolumeHbar = props.transferVolumeHbar; + + /* + * The price of bandwidth for data retrieved from memory for a response, measured in bytes + * + * @type {Long} + */ + this.responseMemoryByte = props.responseMemoryByte; + + /* + * The price of bandwidth for data retrieved from disk for a response, measured in bytes + * + * @type {Long} + */ + this.responseDiskByte = props.responseDiskByte; + } + + /** + * @param {Uint8Array} bytes + * @returns {FeeComponents} + */ + static fromBytes(bytes) { + return FeeComponents_FeeComponents._fromProtobuf( + HashgraphProto.proto.FeeComponents.decode(bytes), + ); + } + + /** + * @internal + * @param {HashgraphProto.proto.IFeeComponents} feeComponents + * @returns {FeeComponents} + */ + static _fromProtobuf(feeComponents) { + return new FeeComponents_FeeComponents({ + min: feeComponents.min != null ? feeComponents.min : undefined, + max: feeComponents.max != null ? feeComponents.max : undefined, + constant: + feeComponents.constant != null + ? feeComponents.constant + : undefined, + transactionBandwidthByte: + feeComponents.bpt != null ? feeComponents.bpt : undefined, + transactionVerification: + feeComponents.vpt != null ? feeComponents.vpt : undefined, + transactionRamByteHour: + feeComponents.rbh != null ? feeComponents.rbh : undefined, + transactionStorageByteHour: + feeComponents.sbh != null ? feeComponents.sbh : undefined, + contractTransactionGas: + feeComponents.gas != null ? feeComponents.gas : undefined, + transferVolumeHbar: + feeComponents.tv != null ? feeComponents.tv : undefined, + responseMemoryByte: + feeComponents.bpr != null ? feeComponents.bpr : undefined, + responseDiskByte: + feeComponents.sbpr != null ? feeComponents.sbpr : undefined, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IFeeComponents} + */ + _toProtobuf() { + return { + min: this.min != null ? this.min : undefined, + max: this.max != null ? this.max : undefined, + constant: this.constant != null ? this.constant : undefined, + bpt: + this.transactionBandwidthByte != null + ? this.transactionBandwidthByte + : undefined, + vpt: + this.transactionVerification != null + ? this.transactionVerification + : undefined, + rbh: + this.transactionRamByteHour != null + ? this.transactionRamByteHour + : undefined, + sbh: + this.transactionStorageByteHour != null + ? this.transactionStorageByteHour + : undefined, + gas: + this.contractTransactionGas != null + ? this.contractTransactionGas + : undefined, + tv: + this.transferVolumeHbar != null + ? this.transferVolumeHbar + : undefined, + bpr: + this.responseMemoryByte != null + ? this.responseMemoryByte + : undefined, + sbpr: + this.responseDiskByte != null + ? this.responseDiskByte + : undefined, + }; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return HashgraphProto.proto.FeeComponents.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/FeeDataType.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.SubType} HashgraphProto.proto.SubType + */ + +class FeeDataType_FeeDataType { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case FeeDataType_FeeDataType.Default: + return "DEFAULT"; + case FeeDataType_FeeDataType.TokenFungibleCommon: + return "TOKEN_FUNGIBLE_COMMON"; + case FeeDataType_FeeDataType.TokenNonFungibleUnique: + return "TOKEN_NON_FUNGIBLE_UNIQUE"; + case FeeDataType_FeeDataType.TokenFungibleCommonWithCustomFees: + return "TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES"; + case FeeDataType_FeeDataType.TokenNonFungibleUniqueWithCustomFees: + return "TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES"; + case FeeDataType_FeeDataType.ScheduleCreateContractCall: + return "SCHEDULE_CREATE_CONTRACT_CALL"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @internal + * @param {number} code + * @returns {FeeDataType} + */ + static _fromCode(code) { + switch (code) { + case 0: + return FeeDataType_FeeDataType.Default; + case 1: + return FeeDataType_FeeDataType.TokenFungibleCommon; + case 2: + return FeeDataType_FeeDataType.TokenNonFungibleUnique; + case 3: + return FeeDataType_FeeDataType.TokenFungibleCommonWithCustomFees; + case 4: + return FeeDataType_FeeDataType.TokenNonFungibleUniqueWithCustomFees; + case 5: + return FeeDataType_FeeDataType.ScheduleCreateContractCall; + } + + throw new Error( + `(BUG) SubType.fromCode() does not handle code: ${code}`, + ); + } + + /** + * @returns {HashgraphProto.proto.SubType} + */ + valueOf() { + return this._code; + } +} + +/** + * The resource prices have no special scope + */ +FeeDataType_FeeDataType.Default = new FeeDataType_FeeDataType(0); + +/** + * The resource prices are scoped to an operation on a fungible common token + */ +FeeDataType_FeeDataType.TokenFungibleCommon = new FeeDataType_FeeDataType(1); + +/** + * The resource prices are scoped to an operation on a non-fungible unique token + */ +FeeDataType_FeeDataType.TokenNonFungibleUnique = new FeeDataType_FeeDataType(2); + +/** + * The resource prices are scoped to an operation on a fungible common token with a custom fee schedule + */ +FeeDataType_FeeDataType.TokenFungibleCommonWithCustomFees = new FeeDataType_FeeDataType(3); + +/** + * The resource prices are scoped to an operation on a non-fungible unique token with a custom fee schedule + */ +FeeDataType_FeeDataType.TokenNonFungibleUniqueWithCustomFees = new FeeDataType_FeeDataType(4); + +/** + * The resource prices are scoped to a ScheduleCreate containing a ContractCall. + */ +FeeDataType_FeeDataType.ScheduleCreateContractCall = new FeeDataType_FeeDataType(5); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/FeeData.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +class FeeData_FeeData { + /** + * @param {object} [props] + * @param {FeeComponents} [props.nodedata] + * @param {FeeComponents} [props.networkdata] + * @param {FeeComponents} [props.servicedata] + * @param {FeeDataType} [props.feeDataType] + */ + constructor(props = {}) { + /* + * Fee paid to the submitting node + * + * @type {FeeComponents} + */ + this.nodedata = props.nodedata; + + /* + * Fee paid to the network for processing a transaction into consensus + * + * @type {FeeComponents} + */ + this.networkdata = props.networkdata; + + /* + * Fee paid to the network for providing the service associated with the transaction; for instance, storing a file + * + * @type {FeeComponents} + */ + this.servicedata = props.servicedata; + + /* + * SubType distinguishing between different types of FeeData, correlating to the same HederaFunctionality + * + * @type {SubType} + */ + this.feeDataType = props.feeDataType; + } + + /** + * @param {Uint8Array} bytes + * @returns {FeeData} + */ + static fromBytes(bytes) { + return FeeData_FeeData._fromProtobuf( + HashgraphProto.proto.FeeData.decode(bytes), + ); + } + + /** + * @internal + * @param {HashgraphProto.proto.IFeeData} feeData + * @returns {FeeData} + */ + static _fromProtobuf(feeData) { + return new FeeData_FeeData({ + nodedata: + feeData.nodedata != null + ? FeeComponents._fromProtobuf(feeData.nodedata) + : undefined, + networkdata: + feeData.networkdata != null + ? FeeComponents._fromProtobuf(feeData.networkdata) + : undefined, + servicedata: + feeData.servicedata != null + ? FeeComponents._fromProtobuf(feeData.servicedata) + : undefined, + feeDataType: + feeData.subType != null + ? FeeDataType._fromCode(feeData.subType) + : undefined, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IFeeData} + */ + _toProtobuf() { + return { + nodedata: + this.nodedata != null ? this.nodedata._toProtobuf() : undefined, + + networkdata: + this.networkdata != null + ? this.networkdata._toProtobuf() + : undefined, + + servicedata: + this.servicedata != null + ? this.servicedata._toProtobuf() + : undefined, + + subType: + this.feeDataType != null + ? this.feeDataType.valueOf() + : undefined, + }; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return HashgraphProto.proto.FeeData.encode(this._toProtobuf()).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/RequestType.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.HederaFunctionality} HashgraphProto.proto.HederaFunctionality + */ + +class RequestType_RequestType { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case RequestType_RequestType.None: + return "NONE"; + case RequestType_RequestType.CryptoTransfer: + return "CryptoTransfer"; + case RequestType_RequestType.CryptoUpdate: + return "CryptoUpdate"; + case RequestType_RequestType.CryptoDelete: + return "CryptoDelete"; + case RequestType_RequestType.CryptoAddLiveHash: + return "CryptoAddLiveHash"; + case RequestType_RequestType.CryptoDeleteLiveHash: + return "CryptoDeleteLiveHash"; + case RequestType_RequestType.ContractCall: + return "ContractCall"; + case RequestType_RequestType.ContractCreate: + return "ContractCreate"; + case RequestType_RequestType.ContractUpdate: + return "ContractUpdate"; + case RequestType_RequestType.FileCreate: + return "FileCreate"; + case RequestType_RequestType.FileAppend: + return "FileAppend"; + case RequestType_RequestType.FileUpdate: + return "FileUpdate"; + case RequestType_RequestType.FileDelete: + return "FileDelete"; + case RequestType_RequestType.CryptoGetAccountBalance: + return "CryptoGetAccountBalance"; + case RequestType_RequestType.CryptoGetAccountRecords: + return "CryptoGetAccountRecords"; + case RequestType_RequestType.CryptoGetInfo: + return "CryptoGetInfo"; + case RequestType_RequestType.ContractCallLocal: + return "ContractCallLocal"; + case RequestType_RequestType.ContractGetInfo: + return "ContractGetInfo"; + case RequestType_RequestType.ContractGetBytecode: + return "ContractGetBytecode"; + case RequestType_RequestType.GetBySolidityID: + return "GetBySolidityID"; + case RequestType_RequestType.GetByKey: + return "GetByKey"; + case RequestType_RequestType.CryptoGetLiveHash: + return "CryptoGetLiveHash"; + case RequestType_RequestType.CryptoGetStakers: + return "CryptoGetStakers"; + case RequestType_RequestType.FileGetContents: + return "FileGetContents"; + case RequestType_RequestType.FileGetInfo: + return "FileGetInfo"; + case RequestType_RequestType.TransactionGetRecord: + return "TransactionGetRecord"; + case RequestType_RequestType.ContractGetRecords: + return "ContractGetRecords"; + case RequestType_RequestType.CryptoCreate: + return "CryptoCreate"; + case RequestType_RequestType.SystemDelete: + return "SystemDelete"; + case RequestType_RequestType.SystemUndelete: + return "SystemUndelete"; + case RequestType_RequestType.ContractDelete: + return "ContractDelete"; + case RequestType_RequestType.Freeze: + return "Freeze"; + case RequestType_RequestType.CreateTransactionRecord: + return "CreateTransactionRecord"; + case RequestType_RequestType.CryptoAccountAutoRenew: + return "CryptoAccountAutoRenew"; + case RequestType_RequestType.ContractAutoRenew: + return "ContractAutoRenew"; + case RequestType_RequestType.GetVersionInfo: + return "GetVersionInfo"; + case RequestType_RequestType.TransactionGetReceipt: + return "TransactionGetReceipt"; + case RequestType_RequestType.ConsensusCreateTopic: + return "ConsensusCreateTopic"; + case RequestType_RequestType.ConsensusUpdateTopic: + return "ConsensusUpdateTopic"; + case RequestType_RequestType.ConsensusDeleteTopic: + return "ConsensusDeleteTopic"; + case RequestType_RequestType.ConsensusGetTopicInfo: + return "ConsensusGetTopicInfo"; + case RequestType_RequestType.ConsensusSubmitMessage: + return "ConsensusSubmitMessage"; + case RequestType_RequestType.UncheckedSubmit: + return "UncheckedSubmit"; + case RequestType_RequestType.TokenCreate: + return "TokenCreate"; + case RequestType_RequestType.TokenGetInfo: + return "TokenGetInfo"; + case RequestType_RequestType.TokenFreezeAccount: + return "TokenFreezeAccount"; + case RequestType_RequestType.TokenUnfreezeAccount: + return "TokenUnfreezeAccount"; + case RequestType_RequestType.TokenGrantKycToAccount: + return "TokenGrantKycToAccount"; + case RequestType_RequestType.TokenRevokeKycFromAccount: + return "TokenRevokeKycFromAccount"; + case RequestType_RequestType.TokenDelete: + return "TokenDelete"; + case RequestType_RequestType.TokenUpdate: + return "TokenUpdate"; + case RequestType_RequestType.TokenMint: + return "TokenMint"; + case RequestType_RequestType.TokenBurn: + return "TokenBurn"; + case RequestType_RequestType.TokenAccountWipe: + return "TokenAccountWipe"; + case RequestType_RequestType.TokenAssociateToAccount: + return "TokenAssociateToAccount"; + case RequestType_RequestType.TokenDissociateFromAccount: + return "TokenDissociateFromAccount"; + case RequestType_RequestType.ScheduleCreate: + return "ScheduleCreate"; + case RequestType_RequestType.ScheduleDelete: + return "ScheduleDelete"; + case RequestType_RequestType.ScheduleSign: + return "ScheduleSign"; + case RequestType_RequestType.ScheduleGetInfo: + return "ScheduleGetInfo"; + case RequestType_RequestType.TokenGetAccountNftInfos: + return "TokenGetAccountNftInfos"; + case RequestType_RequestType.TokenGetNftInfo: + return "TokenGetNftInfo"; + case RequestType_RequestType.TokenGetNftInfos: + return "TokenGetNftInfos"; + case RequestType_RequestType.TokenFeeScheduleUpdate: + return "TokenFeeScheduleUpdate"; + case RequestType_RequestType.NetworkGetExecutionTime: + return "NetworkGetExecutionTime"; + case RequestType_RequestType.TokenPause: + return "TokenPause"; + case RequestType_RequestType.TokenUnpause: + return "TokenUnpause"; + case RequestType_RequestType.CryptoApproveAllowance: + return "CryptoApproveAllowance"; + case RequestType_RequestType.CryptoDeleteAllowance: + return "CryptoDeleteAllowance"; + case RequestType_RequestType.GetAccountDetails: + return "GetAccountDetails"; + case RequestType_RequestType.EthereumTransaction: + return "EthereumTransaction"; + case RequestType_RequestType.NodeStakeUpdate: + return "NodeStakeUpdate"; + case RequestType_RequestType.Prng: + return "UtilPrng"; + case RequestType_RequestType.TransactionGetFastRecord: + return "TransactionGetFastRecord"; + case RequestType_RequestType.TokenUpdateNfts: + return "TokenUpdateNfts"; + case RequestType_RequestType.NodeCreate: + return "NodeCreate"; + case RequestType_RequestType.NodeUpdate: + return "NodeUpdate"; + case RequestType_RequestType.NodeDelete: + return "NodeDelete"; + case RequestType_RequestType.TokenReject: + return "TokenReject"; + case RequestType_RequestType.TokenAirdrop: + return "TokenAirdrop"; + case RequestType_RequestType.TokenCancelAirdrop: + return "TokenCancelAirdrop"; + case RequestType_RequestType.TokenClaimAirdrop: + return "TokenClaimAirdrop"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @internal + * @param {number} code + * @returns {RequestType} + */ + static _fromCode(code) { + switch (code) { + case 0: + return RequestType_RequestType.None; + case 1: + return RequestType_RequestType.CryptoTransfer; + case 2: + return RequestType_RequestType.CryptoUpdate; + case 3: + return RequestType_RequestType.CryptoDelete; + case 4: + return RequestType_RequestType.CryptoAddLiveHash; + case 5: + return RequestType_RequestType.CryptoDeleteLiveHash; + case 6: + return RequestType_RequestType.ContractCall; + case 7: + return RequestType_RequestType.ContractCreate; + case 8: + return RequestType_RequestType.ContractUpdate; + case 9: + return RequestType_RequestType.FileCreate; + case 10: + return RequestType_RequestType.FileAppend; + case 11: + return RequestType_RequestType.FileUpdate; + case 12: + return RequestType_RequestType.FileDelete; + case 13: + return RequestType_RequestType.CryptoGetAccountBalance; + case 14: + return RequestType_RequestType.CryptoGetAccountRecords; + case 15: + return RequestType_RequestType.CryptoGetInfo; + case 16: + return RequestType_RequestType.ContractCallLocal; + case 17: + return RequestType_RequestType.ContractGetInfo; + case 18: + return RequestType_RequestType.ContractGetBytecode; + case 19: + return RequestType_RequestType.GetBySolidityID; + case 20: + return RequestType_RequestType.GetByKey; + case 21: + return RequestType_RequestType.CryptoGetLiveHash; + case 22: + return RequestType_RequestType.CryptoGetStakers; + case 23: + return RequestType_RequestType.FileGetContents; + case 24: + return RequestType_RequestType.FileGetInfo; + case 25: + return RequestType_RequestType.TransactionGetRecord; + case 26: + return RequestType_RequestType.ContractGetRecords; + case 27: + return RequestType_RequestType.CryptoCreate; + case 28: + return RequestType_RequestType.SystemDelete; + case 29: + return RequestType_RequestType.SystemUndelete; + case 30: + return RequestType_RequestType.ContractDelete; + case 31: + return RequestType_RequestType.Freeze; + case 32: + return RequestType_RequestType.CreateTransactionRecord; + case 33: + return RequestType_RequestType.CryptoAccountAutoRenew; + case 34: + return RequestType_RequestType.ContractAutoRenew; + case 35: + return RequestType_RequestType.GetVersionInfo; + case 36: + return RequestType_RequestType.TransactionGetReceipt; + case 50: + return RequestType_RequestType.ConsensusCreateTopic; + case 51: + return RequestType_RequestType.ConsensusUpdateTopic; + case 52: + return RequestType_RequestType.ConsensusDeleteTopic; + case 53: + return RequestType_RequestType.ConsensusGetTopicInfo; + case 54: + return RequestType_RequestType.ConsensusSubmitMessage; + case 55: + return RequestType_RequestType.UncheckedSubmit; + case 56: + return RequestType_RequestType.TokenCreate; + case 58: + return RequestType_RequestType.TokenGetInfo; + case 59: + return RequestType_RequestType.TokenFreezeAccount; + case 60: + return RequestType_RequestType.TokenUnfreezeAccount; + case 61: + return RequestType_RequestType.TokenGrantKycToAccount; + case 62: + return RequestType_RequestType.TokenRevokeKycFromAccount; + case 63: + return RequestType_RequestType.TokenDelete; + case 64: + return RequestType_RequestType.TokenUpdate; + case 65: + return RequestType_RequestType.TokenMint; + case 66: + return RequestType_RequestType.TokenBurn; + case 67: + return RequestType_RequestType.TokenAccountWipe; + case 68: + return RequestType_RequestType.TokenAssociateToAccount; + case 69: + return RequestType_RequestType.TokenDissociateFromAccount; + case 70: + return RequestType_RequestType.ScheduleCreate; + case 71: + return RequestType_RequestType.ScheduleDelete; + case 72: + return RequestType_RequestType.ScheduleSign; + case 73: + return RequestType_RequestType.ScheduleGetInfo; + case 74: + return RequestType_RequestType.TokenGetAccountNftInfos; + case 75: + return RequestType_RequestType.TokenGetNftInfo; + case 76: + return RequestType_RequestType.TokenGetNftInfos; + case 77: + return RequestType_RequestType.TokenFeeScheduleUpdate; + case 78: + return RequestType_RequestType.NetworkGetExecutionTime; + case 79: + return RequestType_RequestType.TokenPause; + case 80: + return RequestType_RequestType.TokenUnpause; + case 81: + return RequestType_RequestType.CryptoApproveAllowance; + case 82: + return RequestType_RequestType.CryptoDeleteAllowance; + case 83: + return RequestType_RequestType.GetAccountDetails; + case 84: + return RequestType_RequestType.EthereumTransaction; + case 85: + return RequestType_RequestType.NodeStakeUpdate; + case 86: + return RequestType_RequestType.Prng; + case 87: + return RequestType_RequestType.TransactionGetFastRecord; + case 88: + return RequestType_RequestType.TokenUpdateNfts; + case 89: + return RequestType_RequestType.NodeCreate; + case 90: + return RequestType_RequestType.NodeUpdate; + case 91: + return RequestType_RequestType.NodeDelete; + case 92: + return RequestType_RequestType.TokenReject; + case 93: + return RequestType_RequestType.TokenAirdrop; + case 94: + return RequestType_RequestType.TokenCancelAirdrop; + case 95: + return RequestType_RequestType.TokenClaimAirdrop; + } + + throw new Error( + `(BUG) RequestType.fromCode() does not handle code: ${code}`, + ); + } + + /** + * @returns {HashgraphProto.proto.HederaFunctionality} + */ + valueOf() { + return this._code; + } +} + +/** + * UNSPECIFIED - Need to keep first value as unspecified because first element is ignored and + * not parsed (0 is ignored by parser) + */ +RequestType_RequestType.None = new RequestType_RequestType(0); + +/** + * crypto transfer + */ +RequestType_RequestType.CryptoTransfer = new RequestType_RequestType(1); + +/** + * crypto update account + */ +RequestType_RequestType.CryptoUpdate = new RequestType_RequestType(2); + +/** + * crypto delete account + */ +RequestType_RequestType.CryptoDelete = new RequestType_RequestType(3); + +/** + * Add a livehash to a crypto account + */ +RequestType_RequestType.CryptoAddLiveHash = new RequestType_RequestType(4); + +/** + * Delete a livehash from a crypto account + */ +RequestType_RequestType.CryptoDeleteLiveHash = new RequestType_RequestType(5); + +/** + * Smart Contract Call + */ +RequestType_RequestType.ContractCall = new RequestType_RequestType(6); + +/** + * Smart Contract Create Contract + */ +RequestType_RequestType.ContractCreate = new RequestType_RequestType(7); + +/** + * Smart Contract update contract + */ +RequestType_RequestType.ContractUpdate = new RequestType_RequestType(8); + +/** + * File Operation create file + */ +RequestType_RequestType.FileCreate = new RequestType_RequestType(9); + +/** + * File Operation append file + */ +RequestType_RequestType.FileAppend = new RequestType_RequestType(10); + +/** + * File Operation update file + */ +RequestType_RequestType.FileUpdate = new RequestType_RequestType(11); + +/** + * File Operation delete file + */ +RequestType_RequestType.FileDelete = new RequestType_RequestType(12); + +/** + * crypto get account balance + */ +RequestType_RequestType.CryptoGetAccountBalance = new RequestType_RequestType(13); + +/** + * crypto get account record + */ +RequestType_RequestType.CryptoGetAccountRecords = new RequestType_RequestType(14); + +/** + * Crypto get info + */ +RequestType_RequestType.CryptoGetInfo = new RequestType_RequestType(15); + +/** + * Smart Contract Call + */ +RequestType_RequestType.ContractCallLocal = new RequestType_RequestType(16); + +/** + * Smart Contract get info + */ +RequestType_RequestType.ContractGetInfo = new RequestType_RequestType(17); + +/** + * Smart Contract, get the runtime code + */ +RequestType_RequestType.ContractGetBytecode = new RequestType_RequestType(18); + +/** + * Smart Contract, get by solidity ID + */ +RequestType_RequestType.GetBySolidityID = new RequestType_RequestType(19); + +/** + * Smart Contract, get by key + */ +RequestType_RequestType.GetByKey = new RequestType_RequestType(20); + +/** + * Get a live hash from a crypto account + */ +RequestType_RequestType.CryptoGetLiveHash = new RequestType_RequestType(21); + +/** + * Crypto, get the stakers for the node + */ +RequestType_RequestType.CryptoGetStakers = new RequestType_RequestType(22); + +/** + * File Operations get file contents + */ +RequestType_RequestType.FileGetContents = new RequestType_RequestType(23); + +/** + * File Operations get the info of the file + */ +RequestType_RequestType.FileGetInfo = new RequestType_RequestType(24); + +/** + * Crypto get the transaction records + */ +RequestType_RequestType.TransactionGetRecord = new RequestType_RequestType(25); + +/** + * Contract get the transaction records + */ +RequestType_RequestType.ContractGetRecords = new RequestType_RequestType(26); + +/** + * crypto create account + */ +RequestType_RequestType.CryptoCreate = new RequestType_RequestType(27); + +/** + * system delete file + */ +RequestType_RequestType.SystemDelete = new RequestType_RequestType(28); + +/** + * system undelete file + */ +RequestType_RequestType.SystemUndelete = new RequestType_RequestType(29); + +/** + * delete contract + */ +RequestType_RequestType.ContractDelete = new RequestType_RequestType(30); + +/** + * freeze + */ +RequestType_RequestType.Freeze = new RequestType_RequestType(31); + +/** + * Create Tx Record + */ +RequestType_RequestType.CreateTransactionRecord = new RequestType_RequestType(32); + +/** + * Crypto Auto Renew + */ +RequestType_RequestType.CryptoAccountAutoRenew = new RequestType_RequestType(33); + +/** + * Contract Auto Renew + */ +RequestType_RequestType.ContractAutoRenew = new RequestType_RequestType(34); + +/** + * Get Version + */ +RequestType_RequestType.GetVersionInfo = new RequestType_RequestType(35); + +/** + * Transaction Get Receipt + */ +RequestType_RequestType.TransactionGetReceipt = new RequestType_RequestType(36); + +/** + * Create Topic + */ +RequestType_RequestType.ConsensusCreateTopic = new RequestType_RequestType(50); + +/** + * Update Topic + */ +RequestType_RequestType.ConsensusUpdateTopic = new RequestType_RequestType(51); + +/** + * Delete Topic + */ +RequestType_RequestType.ConsensusDeleteTopic = new RequestType_RequestType(52); + +/** + * Get Topic information + */ +RequestType_RequestType.ConsensusGetTopicInfo = new RequestType_RequestType(53); + +/** + * Submit message to topic + */ +RequestType_RequestType.ConsensusSubmitMessage = new RequestType_RequestType(54); + +RequestType_RequestType.UncheckedSubmit = new RequestType_RequestType(55); +/** + * Create Token + */ +RequestType_RequestType.TokenCreate = new RequestType_RequestType(56); + +/** + * Get Token information + */ +RequestType_RequestType.TokenGetInfo = new RequestType_RequestType(58); + +/** + * Freeze Account + */ +RequestType_RequestType.TokenFreezeAccount = new RequestType_RequestType(59); + +/** + * Unfreeze Account + */ +RequestType_RequestType.TokenUnfreezeAccount = new RequestType_RequestType(60); + +/** + * Grant KYC to Account + */ +RequestType_RequestType.TokenGrantKycToAccount = new RequestType_RequestType(61); + +/** + * Revoke KYC from Account + */ +RequestType_RequestType.TokenRevokeKycFromAccount = new RequestType_RequestType(62); + +/** + * Delete Token + */ +RequestType_RequestType.TokenDelete = new RequestType_RequestType(63); + +/** + * Update Token + */ +RequestType_RequestType.TokenUpdate = new RequestType_RequestType(64); + +/** + * Mint tokens to treasury + */ +RequestType_RequestType.TokenMint = new RequestType_RequestType(65); + +/** + * Burn tokens from treasury + */ +RequestType_RequestType.TokenBurn = new RequestType_RequestType(66); + +/** + * Wipe token amount from Account holder + */ +RequestType_RequestType.TokenAccountWipe = new RequestType_RequestType(67); + +/** + * Associate tokens to an account + */ +RequestType_RequestType.TokenAssociateToAccount = new RequestType_RequestType(68); -/***/ }), +/** + * Dissociate tokens from an account + */ +RequestType_RequestType.TokenDissociateFromAccount = new RequestType_RequestType(69); -/***/ "./node_modules/text-encoding/lib/encoding-indexes.js": -/*!************************************************************!*\ - !*** ./node_modules/text-encoding/lib/encoding-indexes.js ***! - \************************************************************/ -/***/ (function(module) { +/** + * Create Scheduled Transaction + */ +RequestType_RequestType.ScheduleCreate = new RequestType_RequestType(70); -eval("(function(global) {\n 'use strict';\n\n if ( true && module.exports) {\n module.exports = global;\n }\n\n global[\"encoding-indexes\"] =\n{\n \"big5\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,17392,19506,17923,17830,17784,160359,19831,17843,162993,19682,163013,15253,18230,18244,19527,19520,148159,144919,160594,159371,159954,19543,172881,18255,17882,19589,162924,19719,19108,18081,158499,29221,154196,137827,146950,147297,26189,22267,null,32149,22813,166841,15860,38708,162799,23515,138590,23204,13861,171696,23249,23479,23804,26478,34195,170309,29793,29853,14453,138579,145054,155681,16108,153822,15093,31484,40855,147809,166157,143850,133770,143966,17162,33924,40854,37935,18736,34323,22678,38730,37400,31184,31282,26208,27177,34973,29772,31685,26498,31276,21071,36934,13542,29636,155065,29894,40903,22451,18735,21580,16689,145038,22552,31346,162661,35727,18094,159368,16769,155033,31662,140476,40904,140481,140489,140492,40905,34052,144827,16564,40906,17633,175615,25281,28782,40907,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,12736,12737,12738,12739,12740,131340,12741,131281,131277,12742,12743,131275,139240,12744,131274,12745,12746,12747,12748,131342,12749,12750,256,193,461,192,274,201,282,200,332,211,465,210,null,7870,null,7872,202,257,225,462,224,593,275,233,283,232,299,237,464,236,333,243,466,242,363,250,468,249,470,472,474,476,252,null,7871,null,7873,234,609,9178,9179,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,172969,135493,null,25866,null,null,20029,28381,40270,37343,null,null,161589,25745,20250,20264,20392,20822,20852,20892,20964,21153,21160,21307,21326,21457,21464,22242,22768,22788,22791,22834,22836,23398,23454,23455,23706,24198,24635,25993,26622,26628,26725,27982,28860,30005,32420,32428,32442,32455,32463,32479,32518,32567,33402,33487,33647,35270,35774,35810,36710,36711,36718,29713,31996,32205,26950,31433,21031,null,null,null,null,37260,30904,37214,32956,null,36107,33014,133607,null,null,32927,40647,19661,40393,40460,19518,171510,159758,40458,172339,13761,null,28314,33342,29977,null,18705,39532,39567,40857,31111,164972,138698,132560,142054,20004,20097,20096,20103,20159,20203,20279,13388,20413,15944,20483,20616,13437,13459,13477,20870,22789,20955,20988,20997,20105,21113,21136,21287,13767,21417,13649,21424,13651,21442,21539,13677,13682,13953,21651,21667,21684,21689,21712,21743,21784,21795,21800,13720,21823,13733,13759,21975,13765,163204,21797,null,134210,134421,151851,21904,142534,14828,131905,36422,150968,169189,16467,164030,30586,142392,14900,18389,164189,158194,151018,25821,134524,135092,134357,135412,25741,36478,134806,134155,135012,142505,164438,148691,null,134470,170573,164073,18420,151207,142530,39602,14951,169460,16365,13574,152263,169940,161992,142660,40302,38933,null,17369,155813,25780,21731,142668,142282,135287,14843,135279,157402,157462,162208,25834,151634,134211,36456,139681,166732,132913,null,18443,131497,16378,22643,142733,null,148936,132348,155799,134988,134550,21881,16571,17338,null,19124,141926,135325,33194,39157,134556,25465,14846,141173,36288,22177,25724,15939,null,173569,134665,142031,142537,null,135368,145858,14738,14854,164507,13688,155209,139463,22098,134961,142514,169760,13500,27709,151099,null,null,161140,142987,139784,173659,167117,134778,134196,157724,32659,135375,141315,141625,13819,152035,134796,135053,134826,16275,134960,134471,135503,134732,null,134827,134057,134472,135360,135485,16377,140950,25650,135085,144372,161337,142286,134526,134527,142417,142421,14872,134808,135367,134958,173618,158544,167122,167321,167114,38314,21708,33476,21945,null,171715,39974,39606,161630,142830,28992,33133,33004,23580,157042,33076,14231,21343,164029,37302,134906,134671,134775,134907,13789,151019,13833,134358,22191,141237,135369,134672,134776,135288,135496,164359,136277,134777,151120,142756,23124,135197,135198,135413,135414,22428,134673,161428,164557,135093,134779,151934,14083,135094,135552,152280,172733,149978,137274,147831,164476,22681,21096,13850,153405,31666,23400,18432,19244,40743,18919,39967,39821,154484,143677,22011,13810,22153,20008,22786,138177,194680,38737,131206,20059,20155,13630,23587,24401,24516,14586,25164,25909,27514,27701,27706,28780,29227,20012,29357,149737,32594,31035,31993,32595,156266,13505,null,156491,32770,32896,157202,158033,21341,34916,35265,161970,35744,36125,38021,38264,38271,38376,167439,38886,39029,39118,39134,39267,170000,40060,40479,40644,27503,63751,20023,131207,38429,25143,38050,null,20539,28158,171123,40870,15817,34959,147790,28791,23797,19232,152013,13657,154928,24866,166450,36775,37366,29073,26393,29626,144001,172295,15499,137600,19216,30948,29698,20910,165647,16393,27235,172730,16931,34319,133743,31274,170311,166634,38741,28749,21284,139390,37876,30425,166371,40871,30685,20131,20464,20668,20015,20247,40872,21556,32139,22674,22736,138678,24210,24217,24514,141074,25995,144377,26905,27203,146531,27903,null,29184,148741,29580,16091,150035,23317,29881,35715,154788,153237,31379,31724,31939,32364,33528,34199,40873,34960,40874,36537,40875,36815,34143,39392,37409,40876,167353,136255,16497,17058,23066,null,null,null,39016,26475,17014,22333,null,34262,149883,33471,160013,19585,159092,23931,158485,159678,40877,40878,23446,40879,26343,32347,28247,31178,15752,17603,143958,141206,17306,17718,null,23765,146202,35577,23672,15634,144721,23928,40882,29015,17752,147692,138787,19575,14712,13386,131492,158785,35532,20404,131641,22975,33132,38998,170234,24379,134047,null,139713,166253,16642,18107,168057,16135,40883,172469,16632,14294,18167,158790,16764,165554,160767,17773,14548,152730,17761,17691,19849,19579,19830,17898,16328,150287,13921,17630,17597,16877,23870,23880,23894,15868,14351,23972,23993,14368,14392,24130,24253,24357,24451,14600,14612,14655,14669,24791,24893,23781,14729,25015,25017,25039,14776,25132,25232,25317,25368,14840,22193,14851,25570,25595,25607,25690,14923,25792,23829,22049,40863,14999,25990,15037,26111,26195,15090,26258,15138,26390,15170,26532,26624,15192,26698,26756,15218,15217,15227,26889,26947,29276,26980,27039,27013,15292,27094,15325,27237,27252,27249,27266,15340,27289,15346,27307,27317,27348,27382,27521,27585,27626,27765,27818,15563,27906,27910,27942,28033,15599,28068,28081,28181,28184,28201,28294,166336,28347,28386,28378,40831,28392,28393,28452,28468,15686,147265,28545,28606,15722,15733,29111,23705,15754,28716,15761,28752,28756,28783,28799,28809,131877,17345,13809,134872,147159,22462,159443,28990,153568,13902,27042,166889,23412,31305,153825,169177,31333,31357,154028,31419,31408,31426,31427,29137,156813,16842,31450,31453,31466,16879,21682,154625,31499,31573,31529,152334,154878,31650,31599,33692,154548,158847,31696,33825,31634,31672,154912,15789,154725,33938,31738,31750,31797,154817,31812,31875,149634,31910,26237,148856,31945,31943,31974,31860,31987,31989,31950,32359,17693,159300,32093,159446,29837,32137,32171,28981,32179,32210,147543,155689,32228,15635,32245,137209,32229,164717,32285,155937,155994,32366,32402,17195,37996,32295,32576,32577,32583,31030,156368,39393,32663,156497,32675,136801,131176,17756,145254,17667,164666,32762,156809,32773,32776,32797,32808,32815,172167,158915,32827,32828,32865,141076,18825,157222,146915,157416,26405,32935,166472,33031,33050,22704,141046,27775,156824,151480,25831,136330,33304,137310,27219,150117,150165,17530,33321,133901,158290,146814,20473,136445,34018,33634,158474,149927,144688,137075,146936,33450,26907,194964,16859,34123,33488,33562,134678,137140,14017,143741,144730,33403,33506,33560,147083,159139,158469,158615,144846,15807,33565,21996,33669,17675,159141,33708,33729,33747,13438,159444,27223,34138,13462,159298,143087,33880,154596,33905,15827,17636,27303,33866,146613,31064,33960,158614,159351,159299,34014,33807,33681,17568,33939,34020,154769,16960,154816,17731,34100,23282,159385,17703,34163,17686,26559,34326,165413,165435,34241,159880,34306,136578,159949,194994,17770,34344,13896,137378,21495,160666,34430,34673,172280,34798,142375,34737,34778,34831,22113,34412,26710,17935,34885,34886,161248,146873,161252,34910,34972,18011,34996,34997,25537,35013,30583,161551,35207,35210,35238,35241,35239,35260,166437,35303,162084,162493,35484,30611,37374,35472,162393,31465,162618,147343,18195,162616,29052,35596,35615,152624,152933,35647,35660,35661,35497,150138,35728,35739,35503,136927,17941,34895,35995,163156,163215,195028,14117,163155,36054,163224,163261,36114,36099,137488,36059,28764,36113,150729,16080,36215,36265,163842,135188,149898,15228,164284,160012,31463,36525,36534,36547,37588,36633,36653,164709,164882,36773,37635,172703,133712,36787,18730,166366,165181,146875,24312,143970,36857,172052,165564,165121,140069,14720,159447,36919,165180,162494,36961,165228,165387,37032,165651,37060,165606,37038,37117,37223,15088,37289,37316,31916,166195,138889,37390,27807,37441,37474,153017,37561,166598,146587,166668,153051,134449,37676,37739,166625,166891,28815,23235,166626,166629,18789,37444,166892,166969,166911,37747,37979,36540,38277,38310,37926,38304,28662,17081,140922,165592,135804,146990,18911,27676,38523,38550,16748,38563,159445,25050,38582,30965,166624,38589,21452,18849,158904,131700,156688,168111,168165,150225,137493,144138,38705,34370,38710,18959,17725,17797,150249,28789,23361,38683,38748,168405,38743,23370,168427,38751,37925,20688,143543,143548,38793,38815,38833,38846,38848,38866,38880,152684,38894,29724,169011,38911,38901,168989,162170,19153,38964,38963,38987,39014,15118,160117,15697,132656,147804,153350,39114,39095,39112,39111,19199,159015,136915,21936,39137,39142,39148,37752,39225,150057,19314,170071,170245,39413,39436,39483,39440,39512,153381,14020,168113,170965,39648,39650,170757,39668,19470,39700,39725,165376,20532,39732,158120,14531,143485,39760,39744,171326,23109,137315,39822,148043,39938,39935,39948,171624,40404,171959,172434,172459,172257,172323,172511,40318,40323,172340,40462,26760,40388,139611,172435,172576,137531,172595,40249,172217,172724,40592,40597,40606,40610,19764,40618,40623,148324,40641,15200,14821,15645,20274,14270,166955,40706,40712,19350,37924,159138,40727,40726,40761,22175,22154,40773,39352,168075,38898,33919,40802,40809,31452,40846,29206,19390,149877,149947,29047,150008,148296,150097,29598,166874,137466,31135,166270,167478,37737,37875,166468,37612,37761,37835,166252,148665,29207,16107,30578,31299,28880,148595,148472,29054,137199,28835,137406,144793,16071,137349,152623,137208,14114,136955,137273,14049,137076,137425,155467,14115,136896,22363,150053,136190,135848,136134,136374,34051,145062,34051,33877,149908,160101,146993,152924,147195,159826,17652,145134,170397,159526,26617,14131,15381,15847,22636,137506,26640,16471,145215,147681,147595,147727,158753,21707,22174,157361,22162,135135,134056,134669,37830,166675,37788,20216,20779,14361,148534,20156,132197,131967,20299,20362,153169,23144,131499,132043,14745,131850,132116,13365,20265,131776,167603,131701,35546,131596,20120,20685,20749,20386,20227,150030,147082,20290,20526,20588,20609,20428,20453,20568,20732,20825,20827,20829,20830,28278,144789,147001,147135,28018,137348,147081,20904,20931,132576,17629,132259,132242,132241,36218,166556,132878,21081,21156,133235,21217,37742,18042,29068,148364,134176,149932,135396,27089,134685,29817,16094,29849,29716,29782,29592,19342,150204,147597,21456,13700,29199,147657,21940,131909,21709,134086,22301,37469,38644,37734,22493,22413,22399,13886,22731,23193,166470,136954,137071,136976,23084,22968,37519,23166,23247,23058,153926,137715,137313,148117,14069,27909,29763,23073,155267,23169,166871,132115,37856,29836,135939,28933,18802,37896,166395,37821,14240,23582,23710,24158,24136,137622,137596,146158,24269,23375,137475,137476,14081,137376,14045,136958,14035,33066,166471,138682,144498,166312,24332,24334,137511,137131,23147,137019,23364,34324,161277,34912,24702,141408,140843,24539,16056,140719,140734,168072,159603,25024,131134,131142,140827,24985,24984,24693,142491,142599,149204,168269,25713,149093,142186,14889,142114,144464,170218,142968,25399,173147,25782,25393,25553,149987,142695,25252,142497,25659,25963,26994,15348,143502,144045,149897,144043,21773,144096,137433,169023,26318,144009,143795,15072,16784,152964,166690,152975,136956,152923,152613,30958,143619,137258,143924,13412,143887,143746,148169,26254,159012,26219,19347,26160,161904,138731,26211,144082,144097,26142,153714,14545,145466,145340,15257,145314,144382,29904,15254,26511,149034,26806,26654,15300,27326,14435,145365,148615,27187,27218,27337,27397,137490,25873,26776,27212,15319,27258,27479,147392,146586,37792,37618,166890,166603,37513,163870,166364,37991,28069,28427,149996,28007,147327,15759,28164,147516,23101,28170,22599,27940,30786,28987,148250,148086,28913,29264,29319,29332,149391,149285,20857,150180,132587,29818,147192,144991,150090,149783,155617,16134,16049,150239,166947,147253,24743,16115,29900,29756,37767,29751,17567,159210,17745,30083,16227,150745,150790,16216,30037,30323,173510,15129,29800,166604,149931,149902,15099,15821,150094,16127,149957,149747,37370,22322,37698,166627,137316,20703,152097,152039,30584,143922,30478,30479,30587,149143,145281,14942,149744,29752,29851,16063,150202,150215,16584,150166,156078,37639,152961,30750,30861,30856,30930,29648,31065,161601,153315,16654,31131,33942,31141,27181,147194,31290,31220,16750,136934,16690,37429,31217,134476,149900,131737,146874,137070,13719,21867,13680,13994,131540,134157,31458,23129,141045,154287,154268,23053,131675,30960,23082,154566,31486,16889,31837,31853,16913,154547,155324,155302,31949,150009,137136,31886,31868,31918,27314,32220,32263,32211,32590,156257,155996,162632,32151,155266,17002,158581,133398,26582,131150,144847,22468,156690,156664,149858,32733,31527,133164,154345,154947,31500,155150,39398,34373,39523,27164,144447,14818,150007,157101,39455,157088,33920,160039,158929,17642,33079,17410,32966,33033,33090,157620,39107,158274,33378,33381,158289,33875,159143,34320,160283,23174,16767,137280,23339,137377,23268,137432,34464,195004,146831,34861,160802,23042,34926,20293,34951,35007,35046,35173,35149,153219,35156,161669,161668,166901,166873,166812,166393,16045,33955,18165,18127,14322,35389,35356,169032,24397,37419,148100,26068,28969,28868,137285,40301,35999,36073,163292,22938,30659,23024,17262,14036,36394,36519,150537,36656,36682,17140,27736,28603,140065,18587,28537,28299,137178,39913,14005,149807,37051,37015,21873,18694,37307,37892,166475,16482,166652,37927,166941,166971,34021,35371,38297,38311,38295,38294,167220,29765,16066,149759,150082,148458,16103,143909,38543,167655,167526,167525,16076,149997,150136,147438,29714,29803,16124,38721,168112,26695,18973,168083,153567,38749,37736,166281,166950,166703,156606,37562,23313,35689,18748,29689,147995,38811,38769,39224,134950,24001,166853,150194,38943,169178,37622,169431,37349,17600,166736,150119,166756,39132,166469,16128,37418,18725,33812,39227,39245,162566,15869,39323,19311,39338,39516,166757,153800,27279,39457,23294,39471,170225,19344,170312,39356,19389,19351,37757,22642,135938,22562,149944,136424,30788,141087,146872,26821,15741,37976,14631,24912,141185,141675,24839,40015,40019,40059,39989,39952,39807,39887,171565,39839,172533,172286,40225,19630,147716,40472,19632,40204,172468,172269,172275,170287,40357,33981,159250,159711,158594,34300,17715,159140,159364,159216,33824,34286,159232,145367,155748,31202,144796,144960,18733,149982,15714,37851,37566,37704,131775,30905,37495,37965,20452,13376,36964,152925,30781,30804,30902,30795,137047,143817,149825,13978,20338,28634,28633,28702,28702,21524,147893,22459,22771,22410,40214,22487,28980,13487,147884,29163,158784,151447,23336,137141,166473,24844,23246,23051,17084,148616,14124,19323,166396,37819,37816,137430,134941,33906,158912,136211,148218,142374,148417,22932,146871,157505,32168,155995,155812,149945,149899,166394,37605,29666,16105,29876,166755,137375,16097,150195,27352,29683,29691,16086,150078,150164,137177,150118,132007,136228,149989,29768,149782,28837,149878,37508,29670,37727,132350,37681,166606,166422,37766,166887,153045,18741,166530,29035,149827,134399,22180,132634,134123,134328,21762,31172,137210,32254,136898,150096,137298,17710,37889,14090,166592,149933,22960,137407,137347,160900,23201,14050,146779,14000,37471,23161,166529,137314,37748,15565,133812,19094,14730,20724,15721,15692,136092,29045,17147,164376,28175,168164,17643,27991,163407,28775,27823,15574,147437,146989,28162,28428,15727,132085,30033,14012,13512,18048,16090,18545,22980,37486,18750,36673,166940,158656,22546,22472,14038,136274,28926,148322,150129,143331,135856,140221,26809,26983,136088,144613,162804,145119,166531,145366,144378,150687,27162,145069,158903,33854,17631,17614,159014,159057,158850,159710,28439,160009,33597,137018,33773,158848,159827,137179,22921,23170,137139,23137,23153,137477,147964,14125,23023,137020,14023,29070,37776,26266,148133,23150,23083,148115,27179,147193,161590,148571,148170,28957,148057,166369,20400,159016,23746,148686,163405,148413,27148,148054,135940,28838,28979,148457,15781,27871,194597,150095,32357,23019,23855,15859,24412,150109,137183,32164,33830,21637,146170,144128,131604,22398,133333,132633,16357,139166,172726,28675,168283,23920,29583,31955,166489,168992,20424,32743,29389,29456,162548,29496,29497,153334,29505,29512,16041,162584,36972,29173,149746,29665,33270,16074,30476,16081,27810,22269,29721,29726,29727,16098,16112,16116,16122,29907,16142,16211,30018,30061,30066,30093,16252,30152,30172,16320,30285,16343,30324,16348,30330,151388,29064,22051,35200,22633,16413,30531,16441,26465,16453,13787,30616,16490,16495,23646,30654,30667,22770,30744,28857,30748,16552,30777,30791,30801,30822,33864,152885,31027,26627,31026,16643,16649,31121,31129,36795,31238,36796,16743,31377,16818,31420,33401,16836,31439,31451,16847,20001,31586,31596,31611,31762,31771,16992,17018,31867,31900,17036,31928,17044,31981,36755,28864,134351,32207,32212,32208,32253,32686,32692,29343,17303,32800,32805,31545,32814,32817,32852,15820,22452,28832,32951,33001,17389,33036,29482,33038,33042,30048,33044,17409,15161,33110,33113,33114,17427,22586,33148,33156,17445,33171,17453,33189,22511,33217,33252,33364,17551,33446,33398,33482,33496,33535,17584,33623,38505,27018,33797,28917,33892,24803,33928,17668,33982,34017,34040,34064,34104,34130,17723,34159,34160,34272,17783,34418,34450,34482,34543,38469,34699,17926,17943,34990,35071,35108,35143,35217,162151,35369,35384,35476,35508,35921,36052,36082,36124,18328,22623,36291,18413,20206,36410,21976,22356,36465,22005,36528,18487,36558,36578,36580,36589,36594,36791,36801,36810,36812,36915,39364,18605,39136,37395,18718,37416,37464,37483,37553,37550,37567,37603,37611,37619,37620,37629,37699,37764,37805,18757,18769,40639,37911,21249,37917,37933,37950,18794,37972,38009,38189,38306,18855,38388,38451,18917,26528,18980,38720,18997,38834,38850,22100,19172,24808,39097,19225,39153,22596,39182,39193,20916,39196,39223,39234,39261,39266,19312,39365,19357,39484,39695,31363,39785,39809,39901,39921,39924,19565,39968,14191,138178,40265,39994,40702,22096,40339,40381,40384,40444,38134,36790,40571,40620,40625,40637,40646,38108,40674,40689,40696,31432,40772,131220,131767,132000,26906,38083,22956,132311,22592,38081,14265,132565,132629,132726,136890,22359,29043,133826,133837,134079,21610,194619,134091,21662,134139,134203,134227,134245,134268,24807,134285,22138,134325,134365,134381,134511,134578,134600,26965,39983,34725,134660,134670,134871,135056,134957,134771,23584,135100,24075,135260,135247,135286,26398,135291,135304,135318,13895,135359,135379,135471,135483,21348,33965,135907,136053,135990,35713,136567,136729,137155,137159,20088,28859,137261,137578,137773,137797,138282,138352,138412,138952,25283,138965,139029,29080,26709,139333,27113,14024,139900,140247,140282,141098,141425,141647,33533,141671,141715,142037,35237,142056,36768,142094,38840,142143,38983,39613,142412,null,142472,142519,154600,142600,142610,142775,142741,142914,143220,143308,143411,143462,144159,144350,24497,26184,26303,162425,144743,144883,29185,149946,30679,144922,145174,32391,131910,22709,26382,26904,146087,161367,155618,146961,147129,161278,139418,18640,19128,147737,166554,148206,148237,147515,148276,148374,150085,132554,20946,132625,22943,138920,15294,146687,148484,148694,22408,149108,14747,149295,165352,170441,14178,139715,35678,166734,39382,149522,149755,150037,29193,150208,134264,22885,151205,151430,132985,36570,151596,21135,22335,29041,152217,152601,147274,150183,21948,152646,152686,158546,37332,13427,152895,161330,152926,18200,152930,152934,153543,149823,153693,20582,13563,144332,24798,153859,18300,166216,154286,154505,154630,138640,22433,29009,28598,155906,162834,36950,156082,151450,35682,156674,156746,23899,158711,36662,156804,137500,35562,150006,156808,147439,156946,19392,157119,157365,141083,37989,153569,24981,23079,194765,20411,22201,148769,157436,20074,149812,38486,28047,158909,13848,35191,157593,157806,156689,157790,29151,157895,31554,168128,133649,157990,37124,158009,31301,40432,158202,39462,158253,13919,156777,131105,31107,158260,158555,23852,144665,33743,158621,18128,158884,30011,34917,159150,22710,14108,140685,159819,160205,15444,160384,160389,37505,139642,160395,37680,160486,149968,27705,38047,160848,134904,34855,35061,141606,164979,137137,28344,150058,137248,14756,14009,23568,31203,17727,26294,171181,170148,35139,161740,161880,22230,16607,136714,14753,145199,164072,136133,29101,33638,162269,168360,23143,19639,159919,166315,162301,162314,162571,163174,147834,31555,31102,163849,28597,172767,27139,164632,21410,159239,37823,26678,38749,164207,163875,158133,136173,143919,163912,23941,166960,163971,22293,38947,166217,23979,149896,26046,27093,21458,150181,147329,15377,26422,163984,164084,164142,139169,164175,164233,164271,164378,164614,164655,164746,13770,164968,165546,18682,25574,166230,30728,37461,166328,17394,166375,17375,166376,166726,166868,23032,166921,36619,167877,168172,31569,168208,168252,15863,168286,150218,36816,29327,22155,169191,169449,169392,169400,169778,170193,170313,170346,170435,170536,170766,171354,171419,32415,171768,171811,19620,38215,172691,29090,172799,19857,36882,173515,19868,134300,36798,21953,36794,140464,36793,150163,17673,32383,28502,27313,20202,13540,166700,161949,14138,36480,137205,163876,166764,166809,162366,157359,15851,161365,146615,153141,153942,20122,155265,156248,22207,134765,36366,23405,147080,150686,25566,25296,137206,137339,25904,22061,154698,21530,152337,15814,171416,19581,22050,22046,32585,155352,22901,146752,34672,19996,135146,134473,145082,33047,40286,36120,30267,40005,30286,30649,37701,21554,33096,33527,22053,33074,33816,32957,21994,31074,22083,21526,134813,13774,22021,22001,26353,164578,13869,30004,22000,21946,21655,21874,134209,134294,24272,151880,134774,142434,134818,40619,32090,21982,135285,25245,38765,21652,36045,29174,37238,25596,25529,25598,21865,142147,40050,143027,20890,13535,134567,20903,21581,21790,21779,30310,36397,157834,30129,32950,34820,34694,35015,33206,33820,135361,17644,29444,149254,23440,33547,157843,22139,141044,163119,147875,163187,159440,160438,37232,135641,37384,146684,173737,134828,134905,29286,138402,18254,151490,163833,135147,16634,40029,25887,142752,18675,149472,171388,135148,134666,24674,161187,135149,null,155720,135559,29091,32398,40272,19994,19972,13687,23309,27826,21351,13996,14812,21373,13989,149016,22682,150382,33325,21579,22442,154261,133497,null,14930,140389,29556,171692,19721,39917,146686,171824,19547,151465,169374,171998,33884,146870,160434,157619,145184,25390,32037,147191,146988,14890,36872,21196,15988,13946,17897,132238,30272,23280,134838,30842,163630,22695,16575,22140,39819,23924,30292,173108,40581,19681,30201,14331,24857,143578,148466,null,22109,135849,22439,149859,171526,21044,159918,13741,27722,40316,31830,39737,22494,137068,23635,25811,169168,156469,160100,34477,134440,159010,150242,134513,null,20990,139023,23950,38659,138705,40577,36940,31519,39682,23761,31651,25192,25397,39679,31695,39722,31870,39726,31810,31878,39957,31740,39689,40727,39963,149822,40794,21875,23491,20477,40600,20466,21088,15878,21201,22375,20566,22967,24082,38856,40363,36700,21609,38836,39232,38842,21292,24880,26924,21466,39946,40194,19515,38465,27008,20646,30022,137069,39386,21107,null,37209,38529,37212,null,37201,167575,25471,159011,27338,22033,37262,30074,25221,132092,29519,31856,154657,146685,null,149785,30422,39837,20010,134356,33726,34882,null,23626,27072,20717,22394,21023,24053,20174,27697,131570,20281,21660,21722,21146,36226,13822,24332,13811,null,27474,37244,40869,39831,38958,39092,39610,40616,40580,29050,31508,null,27642,34840,32632,null,22048,173642,36471,40787,null,36308,36431,40476,36353,25218,164733,36392,36469,31443,150135,31294,30936,27882,35431,30215,166490,40742,27854,34774,30147,172722,30803,194624,36108,29410,29553,35629,29442,29937,36075,150203,34351,24506,34976,17591,null,137275,159237,null,35454,140571,null,24829,30311,39639,40260,37742,39823,34805,null,34831,36087,29484,38689,39856,13782,29362,19463,31825,39242,155993,24921,19460,40598,24957,null,22367,24943,25254,25145,25294,14940,25058,21418,144373,25444,26626,13778,23895,166850,36826,167481,null,20697,138566,30982,21298,38456,134971,16485,null,30718,null,31938,155418,31962,31277,32870,32867,32077,29957,29938,35220,33306,26380,32866,160902,32859,29936,33027,30500,35209,157644,30035,159441,34729,34766,33224,34700,35401,36013,35651,30507,29944,34010,13877,27058,36262,null,35241,29800,28089,34753,147473,29927,15835,29046,24740,24988,15569,29026,24695,null,32625,166701,29264,24809,19326,21024,15384,146631,155351,161366,152881,137540,135934,170243,159196,159917,23745,156077,166415,145015,131310,157766,151310,17762,23327,156492,40784,40614,156267,12288,65292,12289,12290,65294,8231,65307,65306,65311,65281,65072,8230,8229,65104,65105,65106,183,65108,65109,65110,65111,65372,8211,65073,8212,65075,9588,65076,65103,65288,65289,65077,65078,65371,65373,65079,65080,12308,12309,65081,65082,12304,12305,65083,65084,12298,12299,65085,65086,12296,12297,65087,65088,12300,12301,65089,65090,12302,12303,65091,65092,65113,65114,65115,65116,65117,65118,8216,8217,8220,8221,12317,12318,8245,8242,65283,65286,65290,8251,167,12291,9675,9679,9651,9650,9678,9734,9733,9671,9670,9633,9632,9661,9660,12963,8453,175,65507,65343,717,65097,65098,65101,65102,65099,65100,65119,65120,65121,65291,65293,215,247,177,8730,65308,65310,65309,8806,8807,8800,8734,8786,8801,65122,65123,65124,65125,65126,65374,8745,8746,8869,8736,8735,8895,13266,13265,8747,8750,8757,8756,9792,9794,8853,8857,8593,8595,8592,8594,8598,8599,8601,8600,8741,8739,65295,65340,8725,65128,65284,65509,12306,65504,65505,65285,65312,8451,8457,65129,65130,65131,13269,13212,13213,13214,13262,13217,13198,13199,13252,176,20825,20827,20830,20829,20833,20835,21991,29929,31950,9601,9602,9603,9604,9605,9606,9607,9608,9615,9614,9613,9612,9611,9610,9609,9532,9524,9516,9508,9500,9620,9472,9474,9621,9484,9488,9492,9496,9581,9582,9584,9583,9552,9566,9578,9569,9698,9699,9701,9700,9585,9586,9587,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,12321,12322,12323,12324,12325,12326,12327,12328,12329,21313,21316,21317,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,12549,12550,12551,12552,12553,12554,12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570,12571,12572,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582,12583,12584,12585,729,713,714,711,715,9216,9217,9218,9219,9220,9221,9222,9223,9224,9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240,9241,9242,9243,9244,9245,9246,9247,9249,8364,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,19968,20057,19969,19971,20035,20061,20102,20108,20154,20799,20837,20843,20960,20992,20993,21147,21269,21313,21340,21448,19977,19979,19976,19978,20011,20024,20961,20037,20040,20063,20062,20110,20129,20800,20995,21242,21315,21449,21475,22303,22763,22805,22823,22899,23376,23377,23379,23544,23567,23586,23608,23665,24029,24037,24049,24050,24051,24062,24178,24318,24331,24339,25165,19985,19984,19981,20013,20016,20025,20043,23609,20104,20113,20117,20114,20116,20130,20161,20160,20163,20166,20167,20173,20170,20171,20164,20803,20801,20839,20845,20846,20844,20887,20982,20998,20999,21000,21243,21246,21247,21270,21305,21320,21319,21317,21342,21380,21451,21450,21453,22764,22825,22827,22826,22829,23380,23569,23588,23610,23663,24052,24187,24319,24340,24341,24515,25096,25142,25163,25166,25903,25991,26007,26020,26041,26085,26352,26376,26408,27424,27490,27513,27595,27604,27611,27663,27700,28779,29226,29238,29243,29255,29273,29275,29356,29579,19993,19990,19989,19988,19992,20027,20045,20047,20046,20197,20184,20180,20181,20182,20183,20195,20196,20185,20190,20805,20804,20873,20874,20908,20985,20986,20984,21002,21152,21151,21253,21254,21271,21277,20191,21322,21321,21345,21344,21359,21358,21435,21487,21476,21491,21484,21486,21481,21480,21500,21496,21493,21483,21478,21482,21490,21489,21488,21477,21485,21499,22235,22234,22806,22830,22833,22900,22902,23381,23427,23612,24040,24039,24038,24066,24067,24179,24188,24321,24344,24343,24517,25098,25171,25172,25170,25169,26021,26086,26414,26412,26410,26411,26413,27491,27597,27665,27664,27704,27713,27712,27710,29359,29572,29577,29916,29926,29976,29983,29992,29993,30000,30001,30002,30003,30091,30333,30382,30399,30446,30683,30690,30707,31034,31166,31348,31435,19998,19999,20050,20051,20073,20121,20132,20134,20133,20223,20233,20249,20234,20245,20237,20240,20241,20239,20210,20214,20219,20208,20211,20221,20225,20235,20809,20807,20806,20808,20840,20849,20877,20912,21015,21009,21010,21006,21014,21155,21256,21281,21280,21360,21361,21513,21519,21516,21514,21520,21505,21515,21508,21521,21517,21512,21507,21518,21510,21522,22240,22238,22237,22323,22320,22312,22317,22316,22319,22313,22809,22810,22839,22840,22916,22904,22915,22909,22905,22914,22913,23383,23384,23431,23432,23429,23433,23546,23574,23673,24030,24070,24182,24180,24335,24347,24537,24534,25102,25100,25101,25104,25187,25179,25176,25910,26089,26088,26092,26093,26354,26355,26377,26429,26420,26417,26421,27425,27492,27515,27670,27741,27735,27737,27743,27744,27728,27733,27745,27739,27725,27726,28784,29279,29277,30334,31481,31859,31992,32566,32650,32701,32769,32771,32780,32786,32819,32895,32905,32907,32908,33251,33258,33267,33276,33292,33307,33311,33390,33394,33406,34411,34880,34892,34915,35199,38433,20018,20136,20301,20303,20295,20311,20318,20276,20315,20309,20272,20304,20305,20285,20282,20280,20291,20308,20284,20294,20323,20316,20320,20271,20302,20278,20313,20317,20296,20314,20812,20811,20813,20853,20918,20919,21029,21028,21033,21034,21032,21163,21161,21162,21164,21283,21363,21365,21533,21549,21534,21566,21542,21582,21543,21574,21571,21555,21576,21570,21531,21545,21578,21561,21563,21560,21550,21557,21558,21536,21564,21568,21553,21547,21535,21548,22250,22256,22244,22251,22346,22353,22336,22349,22343,22350,22334,22352,22351,22331,22767,22846,22941,22930,22952,22942,22947,22937,22934,22925,22948,22931,22922,22949,23389,23388,23386,23387,23436,23435,23439,23596,23616,23617,23615,23614,23696,23697,23700,23692,24043,24076,24207,24199,24202,24311,24324,24351,24420,24418,24439,24441,24536,24524,24535,24525,24561,24555,24568,24554,25106,25105,25220,25239,25238,25216,25206,25225,25197,25226,25212,25214,25209,25203,25234,25199,25240,25198,25237,25235,25233,25222,25913,25915,25912,26097,26356,26463,26446,26447,26448,26449,26460,26454,26462,26441,26438,26464,26451,26455,27493,27599,27714,27742,27801,27777,27784,27785,27781,27803,27754,27770,27792,27760,27788,27752,27798,27794,27773,27779,27762,27774,27764,27782,27766,27789,27796,27800,27778,28790,28796,28797,28792,29282,29281,29280,29380,29378,29590,29996,29995,30007,30008,30338,30447,30691,31169,31168,31167,31350,31995,32597,32918,32915,32925,32920,32923,32922,32946,33391,33426,33419,33421,35211,35282,35328,35895,35910,35925,35997,36196,36208,36275,36523,36554,36763,36784,36802,36806,36805,36804,24033,37009,37026,37034,37030,37027,37193,37318,37324,38450,38446,38449,38442,38444,20006,20054,20083,20107,20123,20126,20139,20140,20335,20381,20365,20339,20351,20332,20379,20363,20358,20355,20336,20341,20360,20329,20347,20374,20350,20367,20369,20346,20820,20818,20821,20841,20855,20854,20856,20925,20989,21051,21048,21047,21050,21040,21038,21046,21057,21182,21179,21330,21332,21331,21329,21350,21367,21368,21369,21462,21460,21463,21619,21621,21654,21624,21653,21632,21627,21623,21636,21650,21638,21628,21648,21617,21622,21644,21658,21602,21608,21643,21629,21646,22266,22403,22391,22378,22377,22369,22374,22372,22396,22812,22857,22855,22856,22852,22868,22974,22971,22996,22969,22958,22993,22982,22992,22989,22987,22995,22986,22959,22963,22994,22981,23391,23396,23395,23447,23450,23448,23452,23449,23451,23578,23624,23621,23622,23735,23713,23736,23721,23723,23729,23731,24088,24090,24086,24085,24091,24081,24184,24218,24215,24220,24213,24214,24310,24358,24359,24361,24448,24449,24447,24444,24541,24544,24573,24565,24575,24591,24596,24623,24629,24598,24618,24597,24609,24615,24617,24619,24603,25110,25109,25151,25150,25152,25215,25289,25292,25284,25279,25282,25273,25298,25307,25259,25299,25300,25291,25288,25256,25277,25276,25296,25305,25287,25293,25269,25306,25265,25304,25302,25303,25286,25260,25294,25918,26023,26044,26106,26132,26131,26124,26118,26114,26126,26112,26127,26133,26122,26119,26381,26379,26477,26507,26517,26481,26524,26483,26487,26503,26525,26519,26479,26480,26495,26505,26494,26512,26485,26522,26515,26492,26474,26482,27427,27494,27495,27519,27667,27675,27875,27880,27891,27825,27852,27877,27827,27837,27838,27836,27874,27819,27861,27859,27832,27844,27833,27841,27822,27863,27845,27889,27839,27835,27873,27867,27850,27820,27887,27868,27862,27872,28821,28814,28818,28810,28825,29228,29229,29240,29256,29287,29289,29376,29390,29401,29399,29392,29609,29608,29599,29611,29605,30013,30109,30105,30106,30340,30402,30450,30452,30693,30717,31038,31040,31041,31177,31176,31354,31353,31482,31998,32596,32652,32651,32773,32954,32933,32930,32945,32929,32939,32937,32948,32938,32943,33253,33278,33293,33459,33437,33433,33453,33469,33439,33465,33457,33452,33445,33455,33464,33443,33456,33470,33463,34382,34417,21021,34920,36555,36814,36820,36817,37045,37048,37041,37046,37319,37329,38263,38272,38428,38464,38463,38459,38468,38466,38585,38632,38738,38750,20127,20141,20142,20449,20405,20399,20415,20448,20433,20431,20445,20419,20406,20440,20447,20426,20439,20398,20432,20420,20418,20442,20430,20446,20407,20823,20882,20881,20896,21070,21059,21066,21069,21068,21067,21063,21191,21193,21187,21185,21261,21335,21371,21402,21467,21676,21696,21672,21710,21705,21688,21670,21683,21703,21698,21693,21674,21697,21700,21704,21679,21675,21681,21691,21673,21671,21695,22271,22402,22411,22432,22435,22434,22478,22446,22419,22869,22865,22863,22862,22864,23004,23000,23039,23011,23016,23043,23013,23018,23002,23014,23041,23035,23401,23459,23462,23460,23458,23461,23553,23630,23631,23629,23627,23769,23762,24055,24093,24101,24095,24189,24224,24230,24314,24328,24365,24421,24456,24453,24458,24459,24455,24460,24457,24594,24605,24608,24613,24590,24616,24653,24688,24680,24674,24646,24643,24684,24683,24682,24676,25153,25308,25366,25353,25340,25325,25345,25326,25341,25351,25329,25335,25327,25324,25342,25332,25361,25346,25919,25925,26027,26045,26082,26149,26157,26144,26151,26159,26143,26152,26161,26148,26359,26623,26579,26609,26580,26576,26604,26550,26543,26613,26601,26607,26564,26577,26548,26586,26597,26552,26575,26590,26611,26544,26585,26594,26589,26578,27498,27523,27526,27573,27602,27607,27679,27849,27915,27954,27946,27969,27941,27916,27953,27934,27927,27963,27965,27966,27958,27931,27893,27961,27943,27960,27945,27950,27957,27918,27947,28843,28858,28851,28844,28847,28845,28856,28846,28836,29232,29298,29295,29300,29417,29408,29409,29623,29642,29627,29618,29645,29632,29619,29978,29997,30031,30028,30030,30027,30123,30116,30117,30114,30115,30328,30342,30343,30344,30408,30406,30403,30405,30465,30457,30456,30473,30475,30462,30460,30471,30684,30722,30740,30732,30733,31046,31049,31048,31047,31161,31162,31185,31186,31179,31359,31361,31487,31485,31869,32002,32005,32000,32009,32007,32004,32006,32568,32654,32703,32772,32784,32781,32785,32822,32982,32997,32986,32963,32964,32972,32993,32987,32974,32990,32996,32989,33268,33314,33511,33539,33541,33507,33499,33510,33540,33509,33538,33545,33490,33495,33521,33537,33500,33492,33489,33502,33491,33503,33519,33542,34384,34425,34427,34426,34893,34923,35201,35284,35336,35330,35331,35998,36000,36212,36211,36276,36557,36556,36848,36838,36834,36842,36837,36845,36843,36836,36840,37066,37070,37057,37059,37195,37194,37325,38274,38480,38475,38476,38477,38754,38761,38859,38893,38899,38913,39080,39131,39135,39318,39321,20056,20147,20492,20493,20515,20463,20518,20517,20472,20521,20502,20486,20540,20511,20506,20498,20497,20474,20480,20500,20520,20465,20513,20491,20505,20504,20467,20462,20525,20522,20478,20523,20489,20860,20900,20901,20898,20941,20940,20934,20939,21078,21084,21076,21083,21085,21290,21375,21407,21405,21471,21736,21776,21761,21815,21756,21733,21746,21766,21754,21780,21737,21741,21729,21769,21742,21738,21734,21799,21767,21757,21775,22275,22276,22466,22484,22475,22467,22537,22799,22871,22872,22874,23057,23064,23068,23071,23067,23059,23020,23072,23075,23081,23077,23052,23049,23403,23640,23472,23475,23478,23476,23470,23477,23481,23480,23556,23633,23637,23632,23789,23805,23803,23786,23784,23792,23798,23809,23796,24046,24109,24107,24235,24237,24231,24369,24466,24465,24464,24665,24675,24677,24656,24661,24685,24681,24687,24708,24735,24730,24717,24724,24716,24709,24726,25159,25331,25352,25343,25422,25406,25391,25429,25410,25414,25423,25417,25402,25424,25405,25386,25387,25384,25421,25420,25928,25929,26009,26049,26053,26178,26185,26191,26179,26194,26188,26181,26177,26360,26388,26389,26391,26657,26680,26696,26694,26707,26681,26690,26708,26665,26803,26647,26700,26705,26685,26612,26704,26688,26684,26691,26666,26693,26643,26648,26689,27530,27529,27575,27683,27687,27688,27686,27684,27888,28010,28053,28040,28039,28006,28024,28023,27993,28051,28012,28041,28014,27994,28020,28009,28044,28042,28025,28037,28005,28052,28874,28888,28900,28889,28872,28879,29241,29305,29436,29433,29437,29432,29431,29574,29677,29705,29678,29664,29674,29662,30036,30045,30044,30042,30041,30142,30149,30151,30130,30131,30141,30140,30137,30146,30136,30347,30384,30410,30413,30414,30505,30495,30496,30504,30697,30768,30759,30776,30749,30772,30775,30757,30765,30752,30751,30770,31061,31056,31072,31071,31062,31070,31069,31063,31066,31204,31203,31207,31199,31206,31209,31192,31364,31368,31449,31494,31505,31881,32033,32023,32011,32010,32032,32034,32020,32016,32021,32026,32028,32013,32025,32027,32570,32607,32660,32709,32705,32774,32792,32789,32793,32791,32829,32831,33009,33026,33008,33029,33005,33012,33030,33016,33011,33032,33021,33034,33020,33007,33261,33260,33280,33296,33322,33323,33320,33324,33467,33579,33618,33620,33610,33592,33616,33609,33589,33588,33615,33586,33593,33590,33559,33600,33585,33576,33603,34388,34442,34474,34451,34468,34473,34444,34467,34460,34928,34935,34945,34946,34941,34937,35352,35344,35342,35340,35349,35338,35351,35347,35350,35343,35345,35912,35962,35961,36001,36002,36215,36524,36562,36564,36559,36785,36865,36870,36855,36864,36858,36852,36867,36861,36869,36856,37013,37089,37085,37090,37202,37197,37196,37336,37341,37335,37340,37337,38275,38498,38499,38497,38491,38493,38500,38488,38494,38587,39138,39340,39592,39640,39717,39730,39740,20094,20602,20605,20572,20551,20547,20556,20570,20553,20581,20598,20558,20565,20597,20596,20599,20559,20495,20591,20589,20828,20885,20976,21098,21103,21202,21209,21208,21205,21264,21263,21273,21311,21312,21310,21443,26364,21830,21866,21862,21828,21854,21857,21827,21834,21809,21846,21839,21845,21807,21860,21816,21806,21852,21804,21859,21811,21825,21847,22280,22283,22281,22495,22533,22538,22534,22496,22500,22522,22530,22581,22519,22521,22816,22882,23094,23105,23113,23142,23146,23104,23100,23138,23130,23110,23114,23408,23495,23493,23492,23490,23487,23494,23561,23560,23559,23648,23644,23645,23815,23814,23822,23835,23830,23842,23825,23849,23828,23833,23844,23847,23831,24034,24120,24118,24115,24119,24247,24248,24246,24245,24254,24373,24375,24407,24428,24425,24427,24471,24473,24478,24472,24481,24480,24476,24703,24739,24713,24736,24744,24779,24756,24806,24765,24773,24763,24757,24796,24764,24792,24789,24774,24799,24760,24794,24775,25114,25115,25160,25504,25511,25458,25494,25506,25509,25463,25447,25496,25514,25457,25513,25481,25475,25499,25451,25512,25476,25480,25497,25505,25516,25490,25487,25472,25467,25449,25448,25466,25949,25942,25937,25945,25943,21855,25935,25944,25941,25940,26012,26011,26028,26063,26059,26060,26062,26205,26202,26212,26216,26214,26206,26361,21207,26395,26753,26799,26786,26771,26805,26751,26742,26801,26791,26775,26800,26755,26820,26797,26758,26757,26772,26781,26792,26783,26785,26754,27442,27578,27627,27628,27691,28046,28092,28147,28121,28082,28129,28108,28132,28155,28154,28165,28103,28107,28079,28113,28078,28126,28153,28088,28151,28149,28101,28114,28186,28085,28122,28139,28120,28138,28145,28142,28136,28102,28100,28074,28140,28095,28134,28921,28937,28938,28925,28911,29245,29309,29313,29468,29467,29462,29459,29465,29575,29701,29706,29699,29702,29694,29709,29920,29942,29943,29980,29986,30053,30054,30050,30064,30095,30164,30165,30133,30154,30157,30350,30420,30418,30427,30519,30526,30524,30518,30520,30522,30827,30787,30798,31077,31080,31085,31227,31378,31381,31520,31528,31515,31532,31526,31513,31518,31534,31890,31895,31893,32070,32067,32113,32046,32057,32060,32064,32048,32051,32068,32047,32066,32050,32049,32573,32670,32666,32716,32718,32722,32796,32842,32838,33071,33046,33059,33067,33065,33072,33060,33282,33333,33335,33334,33337,33678,33694,33688,33656,33698,33686,33725,33707,33682,33674,33683,33673,33696,33655,33659,33660,33670,33703,34389,24426,34503,34496,34486,34500,34485,34502,34507,34481,34479,34505,34899,34974,34952,34987,34962,34966,34957,34955,35219,35215,35370,35357,35363,35365,35377,35373,35359,35355,35362,35913,35930,36009,36012,36011,36008,36010,36007,36199,36198,36286,36282,36571,36575,36889,36877,36890,36887,36899,36895,36893,36880,36885,36894,36896,36879,36898,36886,36891,36884,37096,37101,37117,37207,37326,37365,37350,37347,37351,37357,37353,38281,38506,38517,38515,38520,38512,38516,38518,38519,38508,38592,38634,38633,31456,31455,38914,38915,39770,40165,40565,40575,40613,40635,20642,20621,20613,20633,20625,20608,20630,20632,20634,26368,20977,21106,21108,21109,21097,21214,21213,21211,21338,21413,21883,21888,21927,21884,21898,21917,21912,21890,21916,21930,21908,21895,21899,21891,21939,21934,21919,21822,21938,21914,21947,21932,21937,21886,21897,21931,21913,22285,22575,22570,22580,22564,22576,22577,22561,22557,22560,22777,22778,22880,23159,23194,23167,23186,23195,23207,23411,23409,23506,23500,23507,23504,23562,23563,23601,23884,23888,23860,23879,24061,24133,24125,24128,24131,24190,24266,24257,24258,24260,24380,24429,24489,24490,24488,24785,24801,24754,24758,24800,24860,24867,24826,24853,24816,24827,24820,24936,24817,24846,24822,24841,24832,24850,25119,25161,25507,25484,25551,25536,25577,25545,25542,25549,25554,25571,25552,25569,25558,25581,25582,25462,25588,25578,25563,25682,25562,25593,25950,25958,25954,25955,26001,26000,26031,26222,26224,26228,26230,26223,26257,26234,26238,26231,26366,26367,26399,26397,26874,26837,26848,26840,26839,26885,26847,26869,26862,26855,26873,26834,26866,26851,26827,26829,26893,26898,26894,26825,26842,26990,26875,27454,27450,27453,27544,27542,27580,27631,27694,27695,27692,28207,28216,28244,28193,28210,28263,28234,28192,28197,28195,28187,28251,28248,28196,28246,28270,28205,28198,28271,28212,28237,28218,28204,28227,28189,28222,28363,28297,28185,28238,28259,28228,28274,28265,28255,28953,28954,28966,28976,28961,28982,29038,28956,29260,29316,29312,29494,29477,29492,29481,29754,29738,29747,29730,29733,29749,29750,29748,29743,29723,29734,29736,29989,29990,30059,30058,30178,30171,30179,30169,30168,30174,30176,30331,30332,30358,30355,30388,30428,30543,30701,30813,30828,30831,31245,31240,31243,31237,31232,31384,31383,31382,31461,31459,31561,31574,31558,31568,31570,31572,31565,31563,31567,31569,31903,31909,32094,32080,32104,32085,32043,32110,32114,32097,32102,32098,32112,32115,21892,32724,32725,32779,32850,32901,33109,33108,33099,33105,33102,33081,33094,33086,33100,33107,33140,33298,33308,33769,33795,33784,33805,33760,33733,33803,33729,33775,33777,33780,33879,33802,33776,33804,33740,33789,33778,33738,33848,33806,33796,33756,33799,33748,33759,34395,34527,34521,34541,34516,34523,34532,34512,34526,34903,35009,35010,34993,35203,35222,35387,35424,35413,35422,35388,35393,35412,35419,35408,35398,35380,35386,35382,35414,35937,35970,36015,36028,36019,36029,36033,36027,36032,36020,36023,36022,36031,36024,36234,36229,36225,36302,36317,36299,36314,36305,36300,36315,36294,36603,36600,36604,36764,36910,36917,36913,36920,36914,36918,37122,37109,37129,37118,37219,37221,37327,37396,37397,37411,37385,37406,37389,37392,37383,37393,38292,38287,38283,38289,38291,38290,38286,38538,38542,38539,38525,38533,38534,38541,38514,38532,38593,38597,38596,38598,38599,38639,38642,38860,38917,38918,38920,39143,39146,39151,39145,39154,39149,39342,39341,40643,40653,40657,20098,20653,20661,20658,20659,20677,20670,20652,20663,20667,20655,20679,21119,21111,21117,21215,21222,21220,21218,21219,21295,21983,21992,21971,21990,21966,21980,21959,21969,21987,21988,21999,21978,21985,21957,21958,21989,21961,22290,22291,22622,22609,22616,22615,22618,22612,22635,22604,22637,22602,22626,22610,22603,22887,23233,23241,23244,23230,23229,23228,23219,23234,23218,23913,23919,24140,24185,24265,24264,24338,24409,24492,24494,24858,24847,24904,24863,24819,24859,24825,24833,24840,24910,24908,24900,24909,24894,24884,24871,24845,24838,24887,25121,25122,25619,25662,25630,25642,25645,25661,25644,25615,25628,25620,25613,25654,25622,25623,25606,25964,26015,26032,26263,26249,26247,26248,26262,26244,26264,26253,26371,27028,26989,26970,26999,26976,26964,26997,26928,27010,26954,26984,26987,26974,26963,27001,27014,26973,26979,26971,27463,27506,27584,27583,27603,27645,28322,28335,28371,28342,28354,28304,28317,28359,28357,28325,28312,28348,28346,28331,28369,28310,28316,28356,28372,28330,28327,28340,29006,29017,29033,29028,29001,29031,29020,29036,29030,29004,29029,29022,28998,29032,29014,29242,29266,29495,29509,29503,29502,29807,29786,29781,29791,29790,29761,29759,29785,29787,29788,30070,30072,30208,30192,30209,30194,30193,30202,30207,30196,30195,30430,30431,30555,30571,30566,30558,30563,30585,30570,30572,30556,30565,30568,30562,30702,30862,30896,30871,30872,30860,30857,30844,30865,30867,30847,31098,31103,31105,33836,31165,31260,31258,31264,31252,31263,31262,31391,31392,31607,31680,31584,31598,31591,31921,31923,31925,32147,32121,32145,32129,32143,32091,32622,32617,32618,32626,32681,32680,32676,32854,32856,32902,32900,33137,33136,33144,33125,33134,33139,33131,33145,33146,33126,33285,33351,33922,33911,33853,33841,33909,33894,33899,33865,33900,33883,33852,33845,33889,33891,33897,33901,33862,34398,34396,34399,34553,34579,34568,34567,34560,34558,34555,34562,34563,34566,34570,34905,35039,35028,35033,35036,35032,35037,35041,35018,35029,35026,35228,35299,35435,35442,35443,35430,35433,35440,35463,35452,35427,35488,35441,35461,35437,35426,35438,35436,35449,35451,35390,35432,35938,35978,35977,36042,36039,36040,36036,36018,36035,36034,36037,36321,36319,36328,36335,36339,36346,36330,36324,36326,36530,36611,36617,36606,36618,36767,36786,36939,36938,36947,36930,36948,36924,36949,36944,36935,36943,36942,36941,36945,36926,36929,37138,37143,37228,37226,37225,37321,37431,37463,37432,37437,37440,37438,37467,37451,37476,37457,37428,37449,37453,37445,37433,37439,37466,38296,38552,38548,38549,38605,38603,38601,38602,38647,38651,38649,38646,38742,38772,38774,38928,38929,38931,38922,38930,38924,39164,39156,39165,39166,39347,39345,39348,39649,40169,40578,40718,40723,40736,20711,20718,20709,20694,20717,20698,20693,20687,20689,20721,20686,20713,20834,20979,21123,21122,21297,21421,22014,22016,22043,22039,22013,22036,22022,22025,22029,22030,22007,22038,22047,22024,22032,22006,22296,22294,22645,22654,22659,22675,22666,22649,22661,22653,22781,22821,22818,22820,22890,22889,23265,23270,23273,23255,23254,23256,23267,23413,23518,23527,23521,23525,23526,23528,23522,23524,23519,23565,23650,23940,23943,24155,24163,24149,24151,24148,24275,24278,24330,24390,24432,24505,24903,24895,24907,24951,24930,24931,24927,24922,24920,24949,25130,25735,25688,25684,25764,25720,25695,25722,25681,25703,25652,25709,25723,25970,26017,26071,26070,26274,26280,26269,27036,27048,27029,27073,27054,27091,27083,27035,27063,27067,27051,27060,27088,27085,27053,27084,27046,27075,27043,27465,27468,27699,28467,28436,28414,28435,28404,28457,28478,28448,28460,28431,28418,28450,28415,28399,28422,28465,28472,28466,28451,28437,28459,28463,28552,28458,28396,28417,28402,28364,28407,29076,29081,29053,29066,29060,29074,29246,29330,29334,29508,29520,29796,29795,29802,29808,29805,29956,30097,30247,30221,30219,30217,30227,30433,30435,30596,30589,30591,30561,30913,30879,30887,30899,30889,30883,31118,31119,31117,31278,31281,31402,31401,31469,31471,31649,31637,31627,31605,31639,31645,31636,31631,31672,31623,31620,31929,31933,31934,32187,32176,32156,32189,32190,32160,32202,32180,32178,32177,32186,32162,32191,32181,32184,32173,32210,32199,32172,32624,32736,32737,32735,32862,32858,32903,33104,33152,33167,33160,33162,33151,33154,33255,33274,33287,33300,33310,33355,33993,33983,33990,33988,33945,33950,33970,33948,33995,33976,33984,34003,33936,33980,34001,33994,34623,34588,34619,34594,34597,34612,34584,34645,34615,34601,35059,35074,35060,35065,35064,35069,35048,35098,35055,35494,35468,35486,35491,35469,35489,35475,35492,35498,35493,35496,35480,35473,35482,35495,35946,35981,35980,36051,36049,36050,36203,36249,36245,36348,36628,36626,36629,36627,36771,36960,36952,36956,36963,36953,36958,36962,36957,36955,37145,37144,37150,37237,37240,37239,37236,37496,37504,37509,37528,37526,37499,37523,37532,37544,37500,37521,38305,38312,38313,38307,38309,38308,38553,38556,38555,38604,38610,38656,38780,38789,38902,38935,38936,39087,39089,39171,39173,39180,39177,39361,39599,39600,39654,39745,39746,40180,40182,40179,40636,40763,40778,20740,20736,20731,20725,20729,20738,20744,20745,20741,20956,21127,21128,21129,21133,21130,21232,21426,22062,22075,22073,22066,22079,22068,22057,22099,22094,22103,22132,22070,22063,22064,22656,22687,22686,22707,22684,22702,22697,22694,22893,23305,23291,23307,23285,23308,23304,23534,23532,23529,23531,23652,23653,23965,23956,24162,24159,24161,24290,24282,24287,24285,24291,24288,24392,24433,24503,24501,24950,24935,24942,24925,24917,24962,24956,24944,24939,24958,24999,24976,25003,24974,25004,24986,24996,24980,25006,25134,25705,25711,25721,25758,25778,25736,25744,25776,25765,25747,25749,25769,25746,25774,25773,25771,25754,25772,25753,25762,25779,25973,25975,25976,26286,26283,26292,26289,27171,27167,27112,27137,27166,27161,27133,27169,27155,27146,27123,27138,27141,27117,27153,27472,27470,27556,27589,27590,28479,28540,28548,28497,28518,28500,28550,28525,28507,28536,28526,28558,28538,28528,28516,28567,28504,28373,28527,28512,28511,29087,29100,29105,29096,29270,29339,29518,29527,29801,29835,29827,29822,29824,30079,30240,30249,30239,30244,30246,30241,30242,30362,30394,30436,30606,30599,30604,30609,30603,30923,30917,30906,30922,30910,30933,30908,30928,31295,31292,31296,31293,31287,31291,31407,31406,31661,31665,31684,31668,31686,31687,31681,31648,31692,31946,32224,32244,32239,32251,32216,32236,32221,32232,32227,32218,32222,32233,32158,32217,32242,32249,32629,32631,32687,32745,32806,33179,33180,33181,33184,33178,33176,34071,34109,34074,34030,34092,34093,34067,34065,34083,34081,34068,34028,34085,34047,34054,34690,34676,34678,34656,34662,34680,34664,34649,34647,34636,34643,34907,34909,35088,35079,35090,35091,35093,35082,35516,35538,35527,35524,35477,35531,35576,35506,35529,35522,35519,35504,35542,35533,35510,35513,35547,35916,35918,35948,36064,36062,36070,36068,36076,36077,36066,36067,36060,36074,36065,36205,36255,36259,36395,36368,36381,36386,36367,36393,36383,36385,36382,36538,36637,36635,36639,36649,36646,36650,36636,36638,36645,36969,36974,36968,36973,36983,37168,37165,37159,37169,37255,37257,37259,37251,37573,37563,37559,37610,37548,37604,37569,37555,37564,37586,37575,37616,37554,38317,38321,38660,38662,38663,38665,38752,38797,38795,38799,38945,38955,38940,39091,39178,39187,39186,39192,39389,39376,39391,39387,39377,39381,39378,39385,39607,39662,39663,39719,39749,39748,39799,39791,40198,40201,40195,40617,40638,40654,22696,40786,20754,20760,20756,20752,20757,20864,20906,20957,21137,21139,21235,22105,22123,22137,22121,22116,22136,22122,22120,22117,22129,22127,22124,22114,22134,22721,22718,22727,22725,22894,23325,23348,23416,23536,23566,24394,25010,24977,25001,24970,25037,25014,25022,25034,25032,25136,25797,25793,25803,25787,25788,25818,25796,25799,25794,25805,25791,25810,25812,25790,25972,26310,26313,26297,26308,26311,26296,27197,27192,27194,27225,27243,27224,27193,27204,27234,27233,27211,27207,27189,27231,27208,27481,27511,27653,28610,28593,28577,28611,28580,28609,28583,28595,28608,28601,28598,28582,28576,28596,29118,29129,29136,29138,29128,29141,29113,29134,29145,29148,29123,29124,29544,29852,29859,29848,29855,29854,29922,29964,29965,30260,30264,30266,30439,30437,30624,30622,30623,30629,30952,30938,30956,30951,31142,31309,31310,31302,31308,31307,31418,31705,31761,31689,31716,31707,31713,31721,31718,31957,31958,32266,32273,32264,32283,32291,32286,32285,32265,32272,32633,32690,32752,32753,32750,32808,33203,33193,33192,33275,33288,33368,33369,34122,34137,34120,34152,34153,34115,34121,34157,34154,34142,34691,34719,34718,34722,34701,34913,35114,35122,35109,35115,35105,35242,35238,35558,35578,35563,35569,35584,35548,35559,35566,35582,35585,35586,35575,35565,35571,35574,35580,35947,35949,35987,36084,36420,36401,36404,36418,36409,36405,36667,36655,36664,36659,36776,36774,36981,36980,36984,36978,36988,36986,37172,37266,37664,37686,37624,37683,37679,37666,37628,37675,37636,37658,37648,37670,37665,37653,37678,37657,38331,38567,38568,38570,38613,38670,38673,38678,38669,38675,38671,38747,38748,38758,38808,38960,38968,38971,38967,38957,38969,38948,39184,39208,39198,39195,39201,39194,39405,39394,39409,39608,39612,39675,39661,39720,39825,40213,40227,40230,40232,40210,40219,40664,40660,40845,40860,20778,20767,20769,20786,21237,22158,22144,22160,22149,22151,22159,22741,22739,22737,22734,23344,23338,23332,23418,23607,23656,23996,23994,23997,23992,24171,24396,24509,25033,25026,25031,25062,25035,25138,25140,25806,25802,25816,25824,25840,25830,25836,25841,25826,25837,25986,25987,26329,26326,27264,27284,27268,27298,27292,27355,27299,27262,27287,27280,27296,27484,27566,27610,27656,28632,28657,28639,28640,28635,28644,28651,28655,28544,28652,28641,28649,28629,28654,28656,29159,29151,29166,29158,29157,29165,29164,29172,29152,29237,29254,29552,29554,29865,29872,29862,29864,30278,30274,30284,30442,30643,30634,30640,30636,30631,30637,30703,30967,30970,30964,30959,30977,31143,31146,31319,31423,31751,31757,31742,31735,31756,31712,31968,31964,31966,31970,31967,31961,31965,32302,32318,32326,32311,32306,32323,32299,32317,32305,32325,32321,32308,32313,32328,32309,32319,32303,32580,32755,32764,32881,32882,32880,32879,32883,33222,33219,33210,33218,33216,33215,33213,33225,33214,33256,33289,33393,34218,34180,34174,34204,34193,34196,34223,34203,34183,34216,34186,34407,34752,34769,34739,34770,34758,34731,34747,34746,34760,34763,35131,35126,35140,35128,35133,35244,35598,35607,35609,35611,35594,35616,35613,35588,35600,35905,35903,35955,36090,36093,36092,36088,36091,36264,36425,36427,36424,36426,36676,36670,36674,36677,36671,36991,36989,36996,36993,36994,36992,37177,37283,37278,37276,37709,37762,37672,37749,37706,37733,37707,37656,37758,37740,37723,37744,37722,37716,38346,38347,38348,38344,38342,38577,38584,38614,38684,38686,38816,38867,38982,39094,39221,39425,39423,39854,39851,39850,39853,40251,40255,40587,40655,40670,40668,40669,40667,40766,40779,21474,22165,22190,22745,22744,23352,24413,25059,25139,25844,25842,25854,25862,25850,25851,25847,26039,26332,26406,27315,27308,27331,27323,27320,27330,27310,27311,27487,27512,27567,28681,28683,28670,28678,28666,28689,28687,29179,29180,29182,29176,29559,29557,29863,29887,29973,30294,30296,30290,30653,30655,30651,30652,30990,31150,31329,31330,31328,31428,31429,31787,31783,31786,31774,31779,31777,31975,32340,32341,32350,32346,32353,32338,32345,32584,32761,32763,32887,32886,33229,33231,33290,34255,34217,34253,34256,34249,34224,34234,34233,34214,34799,34796,34802,34784,35206,35250,35316,35624,35641,35628,35627,35920,36101,36441,36451,36454,36452,36447,36437,36544,36681,36685,36999,36995,37000,37291,37292,37328,37780,37770,37782,37794,37811,37806,37804,37808,37784,37786,37783,38356,38358,38352,38357,38626,38620,38617,38619,38622,38692,38819,38822,38829,38905,38989,38991,38988,38990,38995,39098,39230,39231,39229,39214,39333,39438,39617,39683,39686,39759,39758,39757,39882,39881,39933,39880,39872,40273,40285,40288,40672,40725,40748,20787,22181,22750,22751,22754,23541,40848,24300,25074,25079,25078,25077,25856,25871,26336,26333,27365,27357,27354,27347,28699,28703,28712,28698,28701,28693,28696,29190,29197,29272,29346,29560,29562,29885,29898,29923,30087,30086,30303,30305,30663,31001,31153,31339,31337,31806,31807,31800,31805,31799,31808,32363,32365,32377,32361,32362,32645,32371,32694,32697,32696,33240,34281,34269,34282,34261,34276,34277,34295,34811,34821,34829,34809,34814,35168,35167,35158,35166,35649,35676,35672,35657,35674,35662,35663,35654,35673,36104,36106,36476,36466,36487,36470,36460,36474,36468,36692,36686,36781,37002,37003,37297,37294,37857,37841,37855,37827,37832,37852,37853,37846,37858,37837,37848,37860,37847,37864,38364,38580,38627,38698,38695,38753,38876,38907,39006,39000,39003,39100,39237,39241,39446,39449,39693,39912,39911,39894,39899,40329,40289,40306,40298,40300,40594,40599,40595,40628,21240,22184,22199,22198,22196,22204,22756,23360,23363,23421,23542,24009,25080,25082,25880,25876,25881,26342,26407,27372,28734,28720,28722,29200,29563,29903,30306,30309,31014,31018,31020,31019,31431,31478,31820,31811,31821,31983,31984,36782,32381,32380,32386,32588,32768,33242,33382,34299,34297,34321,34298,34310,34315,34311,34314,34836,34837,35172,35258,35320,35696,35692,35686,35695,35679,35691,36111,36109,36489,36481,36485,36482,37300,37323,37912,37891,37885,38369,38704,39108,39250,39249,39336,39467,39472,39479,39477,39955,39949,40569,40629,40680,40751,40799,40803,40801,20791,20792,22209,22208,22210,22804,23660,24013,25084,25086,25885,25884,26005,26345,27387,27396,27386,27570,28748,29211,29351,29910,29908,30313,30675,31824,32399,32396,32700,34327,34349,34330,34851,34850,34849,34847,35178,35180,35261,35700,35703,35709,36115,36490,36493,36491,36703,36783,37306,37934,37939,37941,37946,37944,37938,37931,38370,38712,38713,38706,38911,39015,39013,39255,39493,39491,39488,39486,39631,39764,39761,39981,39973,40367,40372,40386,40376,40605,40687,40729,40796,40806,40807,20796,20795,22216,22218,22217,23423,24020,24018,24398,25087,25892,27402,27489,28753,28760,29568,29924,30090,30318,30316,31155,31840,31839,32894,32893,33247,35186,35183,35324,35712,36118,36119,36497,36499,36705,37192,37956,37969,37970,38717,38718,38851,38849,39019,39253,39509,39501,39634,39706,40009,39985,39998,39995,40403,40407,40756,40812,40810,40852,22220,24022,25088,25891,25899,25898,26348,27408,29914,31434,31844,31843,31845,32403,32406,32404,33250,34360,34367,34865,35722,37008,37007,37987,37984,37988,38760,39023,39260,39514,39515,39511,39635,39636,39633,40020,40023,40022,40421,40607,40692,22225,22761,25900,28766,30321,30322,30679,32592,32648,34870,34873,34914,35731,35730,35734,33399,36123,37312,37994,38722,38728,38724,38854,39024,39519,39714,39768,40031,40441,40442,40572,40573,40711,40823,40818,24307,27414,28771,31852,31854,34875,35264,36513,37313,38002,38000,39025,39262,39638,39715,40652,28772,30682,35738,38007,38857,39522,39525,32412,35740,36522,37317,38013,38014,38012,40055,40056,40695,35924,38015,40474,29224,39530,39729,40475,40478,31858,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,20022,20031,20101,20128,20866,20886,20907,21241,21304,21353,21430,22794,23424,24027,12083,24191,24308,24400,24417,25908,26080,30098,30326,36789,38582,168,710,12541,12542,12445,12446,12291,20189,12293,12294,12295,12540,65339,65341,10045,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8679,8632,8633,12751,131276,20058,131210,20994,17553,40880,20872,40881,161287,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,65506,65508,65287,65282,12849,8470,8481,12443,12444,11904,11908,11910,11911,11912,11914,11916,11917,11925,11932,11933,11941,11943,11946,11948,11950,11958,11964,11966,11974,11978,11980,11981,11983,11990,11991,11998,12003,null,null,null,643,592,603,596,629,339,248,331,650,618,20034,20060,20981,21274,21378,19975,19980,20039,20109,22231,64012,23662,24435,19983,20871,19982,20014,20115,20162,20169,20168,20888,21244,21356,21433,22304,22787,22828,23568,24063,26081,27571,27596,27668,29247,20017,20028,20200,20188,20201,20193,20189,20186,21004,21276,21324,22306,22307,22807,22831,23425,23428,23570,23611,23668,23667,24068,24192,24194,24521,25097,25168,27669,27702,27715,27711,27707,29358,29360,29578,31160,32906,38430,20238,20248,20268,20213,20244,20209,20224,20215,20232,20253,20226,20229,20258,20243,20228,20212,20242,20913,21011,21001,21008,21158,21282,21279,21325,21386,21511,22241,22239,22318,22314,22324,22844,22912,22908,22917,22907,22910,22903,22911,23382,23573,23589,23676,23674,23675,23678,24031,24181,24196,24322,24346,24436,24533,24532,24527,25180,25182,25188,25185,25190,25186,25177,25184,25178,25189,26095,26094,26430,26425,26424,26427,26426,26431,26428,26419,27672,27718,27730,27740,27727,27722,27732,27723,27724,28785,29278,29364,29365,29582,29994,30335,31349,32593,33400,33404,33408,33405,33407,34381,35198,37017,37015,37016,37019,37012,38434,38436,38432,38435,20310,20283,20322,20297,20307,20324,20286,20327,20306,20319,20289,20312,20269,20275,20287,20321,20879,20921,21020,21022,21025,21165,21166,21257,21347,21362,21390,21391,21552,21559,21546,21588,21573,21529,21532,21541,21528,21565,21583,21569,21544,21540,21575,22254,22247,22245,22337,22341,22348,22345,22347,22354,22790,22848,22950,22936,22944,22935,22926,22946,22928,22927,22951,22945,23438,23442,23592,23594,23693,23695,23688,23691,23689,23698,23690,23686,23699,23701,24032,24074,24078,24203,24201,24204,24200,24205,24325,24349,24440,24438,24530,24529,24528,24557,24552,24558,24563,24545,24548,24547,24570,24559,24567,24571,24576,24564,25146,25219,25228,25230,25231,25236,25223,25201,25211,25210,25200,25217,25224,25207,25213,25202,25204,25911,26096,26100,26099,26098,26101,26437,26439,26457,26453,26444,26440,26461,26445,26458,26443,27600,27673,27674,27768,27751,27755,27780,27787,27791,27761,27759,27753,27802,27757,27783,27797,27804,27750,27763,27749,27771,27790,28788,28794,29283,29375,29373,29379,29382,29377,29370,29381,29589,29591,29587,29588,29586,30010,30009,30100,30101,30337,31037,32820,32917,32921,32912,32914,32924,33424,33423,33413,33422,33425,33427,33418,33411,33412,35960,36809,36799,37023,37025,37029,37022,37031,37024,38448,38440,38447,38445,20019,20376,20348,20357,20349,20352,20359,20342,20340,20361,20356,20343,20300,20375,20330,20378,20345,20353,20344,20368,20380,20372,20382,20370,20354,20373,20331,20334,20894,20924,20926,21045,21042,21043,21062,21041,21180,21258,21259,21308,21394,21396,21639,21631,21633,21649,21634,21640,21611,21626,21630,21605,21612,21620,21606,21645,21615,21601,21600,21656,21603,21607,21604,22263,22265,22383,22386,22381,22379,22385,22384,22390,22400,22389,22395,22387,22388,22370,22376,22397,22796,22853,22965,22970,22991,22990,22962,22988,22977,22966,22972,22979,22998,22961,22973,22976,22984,22964,22983,23394,23397,23443,23445,23620,23623,23726,23716,23712,23733,23727,23720,23724,23711,23715,23725,23714,23722,23719,23709,23717,23734,23728,23718,24087,24084,24089,24360,24354,24355,24356,24404,24450,24446,24445,24542,24549,24621,24614,24601,24626,24587,24628,24586,24599,24627,24602,24606,24620,24610,24589,24592,24622,24595,24593,24588,24585,24604,25108,25149,25261,25268,25297,25278,25258,25270,25290,25262,25267,25263,25275,25257,25264,25272,25917,26024,26043,26121,26108,26116,26130,26120,26107,26115,26123,26125,26117,26109,26129,26128,26358,26378,26501,26476,26510,26514,26486,26491,26520,26502,26500,26484,26509,26508,26490,26527,26513,26521,26499,26493,26497,26488,26489,26516,27429,27520,27518,27614,27677,27795,27884,27883,27886,27865,27830,27860,27821,27879,27831,27856,27842,27834,27843,27846,27885,27890,27858,27869,27828,27786,27805,27776,27870,27840,27952,27853,27847,27824,27897,27855,27881,27857,28820,28824,28805,28819,28806,28804,28817,28822,28802,28826,28803,29290,29398,29387,29400,29385,29404,29394,29396,29402,29388,29393,29604,29601,29613,29606,29602,29600,29612,29597,29917,29928,30015,30016,30014,30092,30104,30383,30451,30449,30448,30453,30712,30716,30713,30715,30714,30711,31042,31039,31173,31352,31355,31483,31861,31997,32821,32911,32942,32931,32952,32949,32941,33312,33440,33472,33451,33434,33432,33435,33461,33447,33454,33468,33438,33466,33460,33448,33441,33449,33474,33444,33475,33462,33442,34416,34415,34413,34414,35926,36818,36811,36819,36813,36822,36821,36823,37042,37044,37039,37043,37040,38457,38461,38460,38458,38467,20429,20421,20435,20402,20425,20427,20417,20436,20444,20441,20411,20403,20443,20423,20438,20410,20416,20409,20460,21060,21065,21184,21186,21309,21372,21399,21398,21401,21400,21690,21665,21677,21669,21711,21699,33549,21687,21678,21718,21686,21701,21702,21664,21616,21692,21666,21694,21618,21726,21680,22453,22430,22431,22436,22412,22423,22429,22427,22420,22424,22415,22425,22437,22426,22421,22772,22797,22867,23009,23006,23022,23040,23025,23005,23034,23037,23036,23030,23012,23026,23031,23003,23017,23027,23029,23008,23038,23028,23021,23464,23628,23760,23768,23756,23767,23755,23771,23774,23770,23753,23751,23754,23766,23763,23764,23759,23752,23750,23758,23775,23800,24057,24097,24098,24099,24096,24100,24240,24228,24226,24219,24227,24229,24327,24366,24406,24454,24631,24633,24660,24690,24670,24645,24659,24647,24649,24667,24652,24640,24642,24671,24612,24644,24664,24678,24686,25154,25155,25295,25357,25355,25333,25358,25347,25323,25337,25359,25356,25336,25334,25344,25363,25364,25338,25365,25339,25328,25921,25923,26026,26047,26166,26145,26162,26165,26140,26150,26146,26163,26155,26170,26141,26164,26169,26158,26383,26384,26561,26610,26568,26554,26588,26555,26616,26584,26560,26551,26565,26603,26596,26591,26549,26573,26547,26615,26614,26606,26595,26562,26553,26574,26599,26608,26546,26620,26566,26605,26572,26542,26598,26587,26618,26569,26570,26563,26602,26571,27432,27522,27524,27574,27606,27608,27616,27680,27681,27944,27956,27949,27935,27964,27967,27922,27914,27866,27955,27908,27929,27962,27930,27921,27904,27933,27970,27905,27928,27959,27907,27919,27968,27911,27936,27948,27912,27938,27913,27920,28855,28831,28862,28849,28848,28833,28852,28853,28841,29249,29257,29258,29292,29296,29299,29294,29386,29412,29416,29419,29407,29418,29414,29411,29573,29644,29634,29640,29637,29625,29622,29621,29620,29675,29631,29639,29630,29635,29638,29624,29643,29932,29934,29998,30023,30024,30119,30122,30329,30404,30472,30467,30468,30469,30474,30455,30459,30458,30695,30696,30726,30737,30738,30725,30736,30735,30734,30729,30723,30739,31050,31052,31051,31045,31044,31189,31181,31183,31190,31182,31360,31358,31441,31488,31489,31866,31864,31865,31871,31872,31873,32003,32008,32001,32600,32657,32653,32702,32775,32782,32783,32788,32823,32984,32967,32992,32977,32968,32962,32976,32965,32995,32985,32988,32970,32981,32969,32975,32983,32998,32973,33279,33313,33428,33497,33534,33529,33543,33512,33536,33493,33594,33515,33494,33524,33516,33505,33522,33525,33548,33531,33526,33520,33514,33508,33504,33530,33523,33517,34423,34420,34428,34419,34881,34894,34919,34922,34921,35283,35332,35335,36210,36835,36833,36846,36832,37105,37053,37055,37077,37061,37054,37063,37067,37064,37332,37331,38484,38479,38481,38483,38474,38478,20510,20485,20487,20499,20514,20528,20507,20469,20468,20531,20535,20524,20470,20471,20503,20508,20512,20519,20533,20527,20529,20494,20826,20884,20883,20938,20932,20933,20936,20942,21089,21082,21074,21086,21087,21077,21090,21197,21262,21406,21798,21730,21783,21778,21735,21747,21732,21786,21759,21764,21768,21739,21777,21765,21745,21770,21755,21751,21752,21728,21774,21763,21771,22273,22274,22476,22578,22485,22482,22458,22470,22461,22460,22456,22454,22463,22471,22480,22457,22465,22798,22858,23065,23062,23085,23086,23061,23055,23063,23050,23070,23091,23404,23463,23469,23468,23555,23638,23636,23788,23807,23790,23793,23799,23808,23801,24105,24104,24232,24238,24234,24236,24371,24368,24423,24669,24666,24679,24641,24738,24712,24704,24722,24705,24733,24707,24725,24731,24727,24711,24732,24718,25113,25158,25330,25360,25430,25388,25412,25413,25398,25411,25572,25401,25419,25418,25404,25385,25409,25396,25432,25428,25433,25389,25415,25395,25434,25425,25400,25431,25408,25416,25930,25926,26054,26051,26052,26050,26186,26207,26183,26193,26386,26387,26655,26650,26697,26674,26675,26683,26699,26703,26646,26673,26652,26677,26667,26669,26671,26702,26692,26676,26653,26642,26644,26662,26664,26670,26701,26682,26661,26656,27436,27439,27437,27441,27444,27501,32898,27528,27622,27620,27624,27619,27618,27623,27685,28026,28003,28004,28022,27917,28001,28050,27992,28002,28013,28015,28049,28045,28143,28031,28038,27998,28007,28000,28055,28016,28028,27999,28034,28056,27951,28008,28043,28030,28032,28036,27926,28035,28027,28029,28021,28048,28892,28883,28881,28893,28875,32569,28898,28887,28882,28894,28896,28884,28877,28869,28870,28871,28890,28878,28897,29250,29304,29303,29302,29440,29434,29428,29438,29430,29427,29435,29441,29651,29657,29669,29654,29628,29671,29667,29673,29660,29650,29659,29652,29661,29658,29655,29656,29672,29918,29919,29940,29941,29985,30043,30047,30128,30145,30139,30148,30144,30143,30134,30138,30346,30409,30493,30491,30480,30483,30482,30499,30481,30485,30489,30490,30498,30503,30755,30764,30754,30773,30767,30760,30766,30763,30753,30761,30771,30762,30769,31060,31067,31055,31068,31059,31058,31057,31211,31212,31200,31214,31213,31210,31196,31198,31197,31366,31369,31365,31371,31372,31370,31367,31448,31504,31492,31507,31493,31503,31496,31498,31502,31497,31506,31876,31889,31882,31884,31880,31885,31877,32030,32029,32017,32014,32024,32022,32019,32031,32018,32015,32012,32604,32609,32606,32608,32605,32603,32662,32658,32707,32706,32704,32790,32830,32825,33018,33010,33017,33013,33025,33019,33024,33281,33327,33317,33587,33581,33604,33561,33617,33573,33622,33599,33601,33574,33564,33570,33602,33614,33563,33578,33544,33596,33613,33558,33572,33568,33591,33583,33577,33607,33605,33612,33619,33566,33580,33611,33575,33608,34387,34386,34466,34472,34454,34445,34449,34462,34439,34455,34438,34443,34458,34437,34469,34457,34465,34471,34453,34456,34446,34461,34448,34452,34883,34884,34925,34933,34934,34930,34944,34929,34943,34927,34947,34942,34932,34940,35346,35911,35927,35963,36004,36003,36214,36216,36277,36279,36278,36561,36563,36862,36853,36866,36863,36859,36868,36860,36854,37078,37088,37081,37082,37091,37087,37093,37080,37083,37079,37084,37092,37200,37198,37199,37333,37346,37338,38492,38495,38588,39139,39647,39727,20095,20592,20586,20577,20574,20576,20563,20555,20573,20594,20552,20557,20545,20571,20554,20578,20501,20549,20575,20585,20587,20579,20580,20550,20544,20590,20595,20567,20561,20944,21099,21101,21100,21102,21206,21203,21293,21404,21877,21878,21820,21837,21840,21812,21802,21841,21858,21814,21813,21808,21842,21829,21772,21810,21861,21838,21817,21832,21805,21819,21824,21835,22282,22279,22523,22548,22498,22518,22492,22516,22528,22509,22525,22536,22520,22539,22515,22479,22535,22510,22499,22514,22501,22508,22497,22542,22524,22544,22503,22529,22540,22513,22505,22512,22541,22532,22876,23136,23128,23125,23143,23134,23096,23093,23149,23120,23135,23141,23148,23123,23140,23127,23107,23133,23122,23108,23131,23112,23182,23102,23117,23097,23116,23152,23145,23111,23121,23126,23106,23132,23410,23406,23489,23488,23641,23838,23819,23837,23834,23840,23820,23848,23821,23846,23845,23823,23856,23826,23843,23839,23854,24126,24116,24241,24244,24249,24242,24243,24374,24376,24475,24470,24479,24714,24720,24710,24766,24752,24762,24787,24788,24783,24804,24793,24797,24776,24753,24795,24759,24778,24767,24771,24781,24768,25394,25445,25482,25474,25469,25533,25502,25517,25501,25495,25515,25486,25455,25479,25488,25454,25519,25461,25500,25453,25518,25468,25508,25403,25503,25464,25477,25473,25489,25485,25456,25939,26061,26213,26209,26203,26201,26204,26210,26392,26745,26759,26768,26780,26733,26734,26798,26795,26966,26735,26787,26796,26793,26741,26740,26802,26767,26743,26770,26748,26731,26738,26794,26752,26737,26750,26779,26774,26763,26784,26761,26788,26744,26747,26769,26764,26762,26749,27446,27443,27447,27448,27537,27535,27533,27534,27532,27690,28096,28075,28084,28083,28276,28076,28137,28130,28087,28150,28116,28160,28104,28128,28127,28118,28094,28133,28124,28125,28123,28148,28106,28093,28141,28144,28090,28117,28098,28111,28105,28112,28146,28115,28157,28119,28109,28131,28091,28922,28941,28919,28951,28916,28940,28912,28932,28915,28944,28924,28927,28934,28947,28928,28920,28918,28939,28930,28942,29310,29307,29308,29311,29469,29463,29447,29457,29464,29450,29448,29439,29455,29470,29576,29686,29688,29685,29700,29697,29693,29703,29696,29690,29692,29695,29708,29707,29684,29704,30052,30051,30158,30162,30159,30155,30156,30161,30160,30351,30345,30419,30521,30511,30509,30513,30514,30516,30515,30525,30501,30523,30517,30792,30802,30793,30797,30794,30796,30758,30789,30800,31076,31079,31081,31082,31075,31083,31073,31163,31226,31224,31222,31223,31375,31380,31376,31541,31559,31540,31525,31536,31522,31524,31539,31512,31530,31517,31537,31531,31533,31535,31538,31544,31514,31523,31892,31896,31894,31907,32053,32061,32056,32054,32058,32069,32044,32041,32065,32071,32062,32063,32074,32059,32040,32611,32661,32668,32669,32667,32714,32715,32717,32720,32721,32711,32719,32713,32799,32798,32795,32839,32835,32840,33048,33061,33049,33051,33069,33055,33068,33054,33057,33045,33063,33053,33058,33297,33336,33331,33338,33332,33330,33396,33680,33699,33704,33677,33658,33651,33700,33652,33679,33665,33685,33689,33653,33684,33705,33661,33667,33676,33693,33691,33706,33675,33662,33701,33711,33672,33687,33712,33663,33702,33671,33710,33654,33690,34393,34390,34495,34487,34498,34497,34501,34490,34480,34504,34489,34483,34488,34508,34484,34491,34492,34499,34493,34494,34898,34953,34965,34984,34978,34986,34970,34961,34977,34975,34968,34983,34969,34971,34967,34980,34988,34956,34963,34958,35202,35286,35289,35285,35376,35367,35372,35358,35897,35899,35932,35933,35965,36005,36221,36219,36217,36284,36290,36281,36287,36289,36568,36574,36573,36572,36567,36576,36577,36900,36875,36881,36892,36876,36897,37103,37098,37104,37108,37106,37107,37076,37099,37100,37097,37206,37208,37210,37203,37205,37356,37364,37361,37363,37368,37348,37369,37354,37355,37367,37352,37358,38266,38278,38280,38524,38509,38507,38513,38511,38591,38762,38916,39141,39319,20635,20629,20628,20638,20619,20643,20611,20620,20622,20637,20584,20636,20626,20610,20615,20831,20948,21266,21265,21412,21415,21905,21928,21925,21933,21879,22085,21922,21907,21896,21903,21941,21889,21923,21906,21924,21885,21900,21926,21887,21909,21921,21902,22284,22569,22583,22553,22558,22567,22563,22568,22517,22600,22565,22556,22555,22579,22591,22582,22574,22585,22584,22573,22572,22587,22881,23215,23188,23199,23162,23202,23198,23160,23206,23164,23205,23212,23189,23214,23095,23172,23178,23191,23171,23179,23209,23163,23165,23180,23196,23183,23187,23197,23530,23501,23499,23508,23505,23498,23502,23564,23600,23863,23875,23915,23873,23883,23871,23861,23889,23886,23893,23859,23866,23890,23869,23857,23897,23874,23865,23881,23864,23868,23858,23862,23872,23877,24132,24129,24408,24486,24485,24491,24777,24761,24780,24802,24782,24772,24852,24818,24842,24854,24837,24821,24851,24824,24828,24830,24769,24835,24856,24861,24848,24831,24836,24843,25162,25492,25521,25520,25550,25573,25576,25583,25539,25757,25587,25546,25568,25590,25557,25586,25589,25697,25567,25534,25565,25564,25540,25560,25555,25538,25543,25548,25547,25544,25584,25559,25561,25906,25959,25962,25956,25948,25960,25957,25996,26013,26014,26030,26064,26066,26236,26220,26235,26240,26225,26233,26218,26226,26369,26892,26835,26884,26844,26922,26860,26858,26865,26895,26838,26871,26859,26852,26870,26899,26896,26867,26849,26887,26828,26888,26992,26804,26897,26863,26822,26900,26872,26832,26877,26876,26856,26891,26890,26903,26830,26824,26845,26846,26854,26868,26833,26886,26836,26857,26901,26917,26823,27449,27451,27455,27452,27540,27543,27545,27541,27581,27632,27634,27635,27696,28156,28230,28231,28191,28233,28296,28220,28221,28229,28258,28203,28223,28225,28253,28275,28188,28211,28235,28224,28241,28219,28163,28206,28254,28264,28252,28257,28209,28200,28256,28273,28267,28217,28194,28208,28243,28261,28199,28280,28260,28279,28245,28281,28242,28262,28213,28214,28250,28960,28958,28975,28923,28974,28977,28963,28965,28962,28978,28959,28968,28986,28955,29259,29274,29320,29321,29318,29317,29323,29458,29451,29488,29474,29489,29491,29479,29490,29485,29478,29475,29493,29452,29742,29740,29744,29739,29718,29722,29729,29741,29745,29732,29731,29725,29737,29728,29746,29947,29999,30063,30060,30183,30170,30177,30182,30173,30175,30180,30167,30357,30354,30426,30534,30535,30532,30541,30533,30538,30542,30539,30540,30686,30700,30816,30820,30821,30812,30829,30833,30826,30830,30832,30825,30824,30814,30818,31092,31091,31090,31088,31234,31242,31235,31244,31236,31385,31462,31460,31562,31547,31556,31560,31564,31566,31552,31576,31557,31906,31902,31912,31905,32088,32111,32099,32083,32086,32103,32106,32079,32109,32092,32107,32082,32084,32105,32081,32095,32078,32574,32575,32613,32614,32674,32672,32673,32727,32849,32847,32848,33022,32980,33091,33098,33106,33103,33095,33085,33101,33082,33254,33262,33271,33272,33273,33284,33340,33341,33343,33397,33595,33743,33785,33827,33728,33768,33810,33767,33764,33788,33782,33808,33734,33736,33771,33763,33727,33793,33757,33765,33752,33791,33761,33739,33742,33750,33781,33737,33801,33807,33758,33809,33798,33730,33779,33749,33786,33735,33745,33770,33811,33731,33772,33774,33732,33787,33751,33762,33819,33755,33790,34520,34530,34534,34515,34531,34522,34538,34525,34539,34524,34540,34537,34519,34536,34513,34888,34902,34901,35002,35031,35001,35000,35008,35006,34998,35004,34999,35005,34994,35073,35017,35221,35224,35223,35293,35290,35291,35406,35405,35385,35417,35392,35415,35416,35396,35397,35410,35400,35409,35402,35404,35407,35935,35969,35968,36026,36030,36016,36025,36021,36228,36224,36233,36312,36307,36301,36295,36310,36316,36303,36309,36313,36296,36311,36293,36591,36599,36602,36601,36582,36590,36581,36597,36583,36584,36598,36587,36593,36588,36596,36585,36909,36916,36911,37126,37164,37124,37119,37116,37128,37113,37115,37121,37120,37127,37125,37123,37217,37220,37215,37218,37216,37377,37386,37413,37379,37402,37414,37391,37388,37376,37394,37375,37373,37382,37380,37415,37378,37404,37412,37401,37399,37381,37398,38267,38285,38284,38288,38535,38526,38536,38537,38531,38528,38594,38600,38595,38641,38640,38764,38768,38766,38919,39081,39147,40166,40697,20099,20100,20150,20669,20671,20678,20654,20676,20682,20660,20680,20674,20656,20673,20666,20657,20683,20681,20662,20664,20951,21114,21112,21115,21116,21955,21979,21964,21968,21963,21962,21981,21952,21972,21956,21993,21951,21970,21901,21967,21973,21986,21974,21960,22002,21965,21977,21954,22292,22611,22632,22628,22607,22605,22601,22639,22613,22606,22621,22617,22629,22619,22589,22627,22641,22780,23239,23236,23243,23226,23224,23217,23221,23216,23231,23240,23227,23238,23223,23232,23242,23220,23222,23245,23225,23184,23510,23512,23513,23583,23603,23921,23907,23882,23909,23922,23916,23902,23912,23911,23906,24048,24143,24142,24138,24141,24139,24261,24268,24262,24267,24263,24384,24495,24493,24823,24905,24906,24875,24901,24886,24882,24878,24902,24879,24911,24873,24896,25120,37224,25123,25125,25124,25541,25585,25579,25616,25618,25609,25632,25636,25651,25667,25631,25621,25624,25657,25655,25634,25635,25612,25638,25648,25640,25665,25653,25647,25610,25626,25664,25637,25639,25611,25575,25627,25646,25633,25614,25967,26002,26067,26246,26252,26261,26256,26251,26250,26265,26260,26232,26400,26982,26975,26936,26958,26978,26993,26943,26949,26986,26937,26946,26967,26969,27002,26952,26953,26933,26988,26931,26941,26981,26864,27000,26932,26985,26944,26991,26948,26998,26968,26945,26996,26956,26939,26955,26935,26972,26959,26961,26930,26962,26927,27003,26940,27462,27461,27459,27458,27464,27457,27547,64013,27643,27644,27641,27639,27640,28315,28374,28360,28303,28352,28319,28307,28308,28320,28337,28345,28358,28370,28349,28353,28318,28361,28343,28336,28365,28326,28367,28338,28350,28355,28380,28376,28313,28306,28302,28301,28324,28321,28351,28339,28368,28362,28311,28334,28323,28999,29012,29010,29027,29024,28993,29021,29026,29042,29048,29034,29025,28994,29016,28995,29003,29040,29023,29008,29011,28996,29005,29018,29263,29325,29324,29329,29328,29326,29500,29506,29499,29498,29504,29514,29513,29764,29770,29771,29778,29777,29783,29760,29775,29776,29774,29762,29766,29773,29780,29921,29951,29950,29949,29981,30073,30071,27011,30191,30223,30211,30199,30206,30204,30201,30200,30224,30203,30198,30189,30197,30205,30361,30389,30429,30549,30559,30560,30546,30550,30554,30569,30567,30548,30553,30573,30688,30855,30874,30868,30863,30852,30869,30853,30854,30881,30851,30841,30873,30848,30870,30843,31100,31106,31101,31097,31249,31256,31257,31250,31255,31253,31266,31251,31259,31248,31395,31394,31390,31467,31590,31588,31597,31604,31593,31602,31589,31603,31601,31600,31585,31608,31606,31587,31922,31924,31919,32136,32134,32128,32141,32127,32133,32122,32142,32123,32131,32124,32140,32148,32132,32125,32146,32621,32619,32615,32616,32620,32678,32677,32679,32731,32732,32801,33124,33120,33143,33116,33129,33115,33122,33138,26401,33118,33142,33127,33135,33092,33121,33309,33353,33348,33344,33346,33349,34033,33855,33878,33910,33913,33935,33933,33893,33873,33856,33926,33895,33840,33869,33917,33882,33881,33908,33907,33885,34055,33886,33847,33850,33844,33914,33859,33912,33842,33861,33833,33753,33867,33839,33858,33837,33887,33904,33849,33870,33868,33874,33903,33989,33934,33851,33863,33846,33843,33896,33918,33860,33835,33888,33876,33902,33872,34571,34564,34551,34572,34554,34518,34549,34637,34552,34574,34569,34561,34550,34573,34565,35030,35019,35021,35022,35038,35035,35034,35020,35024,35205,35227,35295,35301,35300,35297,35296,35298,35292,35302,35446,35462,35455,35425,35391,35447,35458,35460,35445,35459,35457,35444,35450,35900,35915,35914,35941,35940,35942,35974,35972,35973,36044,36200,36201,36241,36236,36238,36239,36237,36243,36244,36240,36242,36336,36320,36332,36337,36334,36304,36329,36323,36322,36327,36338,36331,36340,36614,36607,36609,36608,36613,36615,36616,36610,36619,36946,36927,36932,36937,36925,37136,37133,37135,37137,37142,37140,37131,37134,37230,37231,37448,37458,37424,37434,37478,37427,37477,37470,37507,37422,37450,37446,37485,37484,37455,37472,37479,37487,37430,37473,37488,37425,37460,37475,37456,37490,37454,37459,37452,37462,37426,38303,38300,38302,38299,38546,38547,38545,38551,38606,38650,38653,38648,38645,38771,38775,38776,38770,38927,38925,38926,39084,39158,39161,39343,39346,39344,39349,39597,39595,39771,40170,40173,40167,40576,40701,20710,20692,20695,20712,20723,20699,20714,20701,20708,20691,20716,20720,20719,20707,20704,20952,21120,21121,21225,21227,21296,21420,22055,22037,22028,22034,22012,22031,22044,22017,22035,22018,22010,22045,22020,22015,22009,22665,22652,22672,22680,22662,22657,22655,22644,22667,22650,22663,22673,22670,22646,22658,22664,22651,22676,22671,22782,22891,23260,23278,23269,23253,23274,23258,23277,23275,23283,23266,23264,23259,23276,23262,23261,23257,23272,23263,23415,23520,23523,23651,23938,23936,23933,23942,23930,23937,23927,23946,23945,23944,23934,23932,23949,23929,23935,24152,24153,24147,24280,24273,24279,24270,24284,24277,24281,24274,24276,24388,24387,24431,24502,24876,24872,24897,24926,24945,24947,24914,24915,24946,24940,24960,24948,24916,24954,24923,24933,24891,24938,24929,24918,25129,25127,25131,25643,25677,25691,25693,25716,25718,25714,25715,25725,25717,25702,25766,25678,25730,25694,25692,25675,25683,25696,25680,25727,25663,25708,25707,25689,25701,25719,25971,26016,26273,26272,26271,26373,26372,26402,27057,27062,27081,27040,27086,27030,27056,27052,27068,27025,27033,27022,27047,27021,27049,27070,27055,27071,27076,27069,27044,27092,27065,27082,27034,27087,27059,27027,27050,27041,27038,27097,27031,27024,27074,27061,27045,27078,27466,27469,27467,27550,27551,27552,27587,27588,27646,28366,28405,28401,28419,28453,28408,28471,28411,28462,28425,28494,28441,28442,28455,28440,28475,28434,28397,28426,28470,28531,28409,28398,28461,28480,28464,28476,28469,28395,28423,28430,28483,28421,28413,28406,28473,28444,28412,28474,28447,28429,28446,28424,28449,29063,29072,29065,29056,29061,29058,29071,29051,29062,29057,29079,29252,29267,29335,29333,29331,29507,29517,29521,29516,29794,29811,29809,29813,29810,29799,29806,29952,29954,29955,30077,30096,30230,30216,30220,30229,30225,30218,30228,30392,30593,30588,30597,30594,30574,30592,30575,30590,30595,30898,30890,30900,30893,30888,30846,30891,30878,30885,30880,30892,30882,30884,31128,31114,31115,31126,31125,31124,31123,31127,31112,31122,31120,31275,31306,31280,31279,31272,31270,31400,31403,31404,31470,31624,31644,31626,31633,31632,31638,31629,31628,31643,31630,31621,31640,21124,31641,31652,31618,31931,31935,31932,31930,32167,32183,32194,32163,32170,32193,32192,32197,32157,32206,32196,32198,32203,32204,32175,32185,32150,32188,32159,32166,32174,32169,32161,32201,32627,32738,32739,32741,32734,32804,32861,32860,33161,33158,33155,33159,33165,33164,33163,33301,33943,33956,33953,33951,33978,33998,33986,33964,33966,33963,33977,33972,33985,33997,33962,33946,33969,34000,33949,33959,33979,33954,33940,33991,33996,33947,33961,33967,33960,34006,33944,33974,33999,33952,34007,34004,34002,34011,33968,33937,34401,34611,34595,34600,34667,34624,34606,34590,34593,34585,34587,34627,34604,34625,34622,34630,34592,34610,34602,34605,34620,34578,34618,34609,34613,34626,34598,34599,34616,34596,34586,34608,34577,35063,35047,35057,35058,35066,35070,35054,35068,35062,35067,35056,35052,35051,35229,35233,35231,35230,35305,35307,35304,35499,35481,35467,35474,35471,35478,35901,35944,35945,36053,36047,36055,36246,36361,36354,36351,36365,36349,36362,36355,36359,36358,36357,36350,36352,36356,36624,36625,36622,36621,37155,37148,37152,37154,37151,37149,37146,37156,37153,37147,37242,37234,37241,37235,37541,37540,37494,37531,37498,37536,37524,37546,37517,37542,37530,37547,37497,37527,37503,37539,37614,37518,37506,37525,37538,37501,37512,37537,37514,37510,37516,37529,37543,37502,37511,37545,37533,37515,37421,38558,38561,38655,38744,38781,38778,38782,38787,38784,38786,38779,38788,38785,38783,38862,38861,38934,39085,39086,39170,39168,39175,39325,39324,39363,39353,39355,39354,39362,39357,39367,39601,39651,39655,39742,39743,39776,39777,39775,40177,40178,40181,40615,20735,20739,20784,20728,20742,20743,20726,20734,20747,20748,20733,20746,21131,21132,21233,21231,22088,22082,22092,22069,22081,22090,22089,22086,22104,22106,22080,22067,22077,22060,22078,22072,22058,22074,22298,22699,22685,22705,22688,22691,22703,22700,22693,22689,22783,23295,23284,23293,23287,23286,23299,23288,23298,23289,23297,23303,23301,23311,23655,23961,23959,23967,23954,23970,23955,23957,23968,23964,23969,23962,23966,24169,24157,24160,24156,32243,24283,24286,24289,24393,24498,24971,24963,24953,25009,25008,24994,24969,24987,24979,25007,25005,24991,24978,25002,24993,24973,24934,25011,25133,25710,25712,25750,25760,25733,25751,25756,25743,25739,25738,25740,25763,25759,25704,25777,25752,25974,25978,25977,25979,26034,26035,26293,26288,26281,26290,26295,26282,26287,27136,27142,27159,27109,27128,27157,27121,27108,27168,27135,27116,27106,27163,27165,27134,27175,27122,27118,27156,27127,27111,27200,27144,27110,27131,27149,27132,27115,27145,27140,27160,27173,27151,27126,27174,27143,27124,27158,27473,27557,27555,27554,27558,27649,27648,27647,27650,28481,28454,28542,28551,28614,28562,28557,28553,28556,28514,28495,28549,28506,28566,28534,28524,28546,28501,28530,28498,28496,28503,28564,28563,28509,28416,28513,28523,28541,28519,28560,28499,28555,28521,28543,28565,28515,28535,28522,28539,29106,29103,29083,29104,29088,29082,29097,29109,29085,29093,29086,29092,29089,29098,29084,29095,29107,29336,29338,29528,29522,29534,29535,29536,29533,29531,29537,29530,29529,29538,29831,29833,29834,29830,29825,29821,29829,29832,29820,29817,29960,29959,30078,30245,30238,30233,30237,30236,30243,30234,30248,30235,30364,30365,30366,30363,30605,30607,30601,30600,30925,30907,30927,30924,30929,30926,30932,30920,30915,30916,30921,31130,31137,31136,31132,31138,31131,27510,31289,31410,31412,31411,31671,31691,31678,31660,31694,31663,31673,31690,31669,31941,31944,31948,31947,32247,32219,32234,32231,32215,32225,32259,32250,32230,32246,32241,32240,32238,32223,32630,32684,32688,32685,32749,32747,32746,32748,32742,32744,32868,32871,33187,33183,33182,33173,33186,33177,33175,33302,33359,33363,33362,33360,33358,33361,34084,34107,34063,34048,34089,34062,34057,34061,34079,34058,34087,34076,34043,34091,34042,34056,34060,34036,34090,34034,34069,34039,34027,34035,34044,34066,34026,34025,34070,34046,34088,34077,34094,34050,34045,34078,34038,34097,34086,34023,34024,34032,34031,34041,34072,34080,34096,34059,34073,34095,34402,34646,34659,34660,34679,34785,34675,34648,34644,34651,34642,34657,34650,34641,34654,34669,34666,34640,34638,34655,34653,34671,34668,34682,34670,34652,34661,34639,34683,34677,34658,34663,34665,34906,35077,35084,35092,35083,35095,35096,35097,35078,35094,35089,35086,35081,35234,35236,35235,35309,35312,35308,35535,35526,35512,35539,35537,35540,35541,35515,35543,35518,35520,35525,35544,35523,35514,35517,35545,35902,35917,35983,36069,36063,36057,36072,36058,36061,36071,36256,36252,36257,36251,36384,36387,36389,36388,36398,36373,36379,36374,36369,36377,36390,36391,36372,36370,36376,36371,36380,36375,36378,36652,36644,36632,36634,36640,36643,36630,36631,36979,36976,36975,36967,36971,37167,37163,37161,37162,37170,37158,37166,37253,37254,37258,37249,37250,37252,37248,37584,37571,37572,37568,37593,37558,37583,37617,37599,37592,37609,37591,37597,37580,37615,37570,37608,37578,37576,37582,37606,37581,37589,37577,37600,37598,37607,37585,37587,37557,37601,37574,37556,38268,38316,38315,38318,38320,38564,38562,38611,38661,38664,38658,38746,38794,38798,38792,38864,38863,38942,38941,38950,38953,38952,38944,38939,38951,39090,39176,39162,39185,39188,39190,39191,39189,39388,39373,39375,39379,39380,39374,39369,39382,39384,39371,39383,39372,39603,39660,39659,39667,39666,39665,39750,39747,39783,39796,39793,39782,39798,39797,39792,39784,39780,39788,40188,40186,40189,40191,40183,40199,40192,40185,40187,40200,40197,40196,40579,40659,40719,40720,20764,20755,20759,20762,20753,20958,21300,21473,22128,22112,22126,22131,22118,22115,22125,22130,22110,22135,22300,22299,22728,22717,22729,22719,22714,22722,22716,22726,23319,23321,23323,23329,23316,23315,23312,23318,23336,23322,23328,23326,23535,23980,23985,23977,23975,23989,23984,23982,23978,23976,23986,23981,23983,23988,24167,24168,24166,24175,24297,24295,24294,24296,24293,24395,24508,24989,25000,24982,25029,25012,25030,25025,25036,25018,25023,25016,24972,25815,25814,25808,25807,25801,25789,25737,25795,25819,25843,25817,25907,25983,25980,26018,26312,26302,26304,26314,26315,26319,26301,26299,26298,26316,26403,27188,27238,27209,27239,27186,27240,27198,27229,27245,27254,27227,27217,27176,27226,27195,27199,27201,27242,27236,27216,27215,27220,27247,27241,27232,27196,27230,27222,27221,27213,27214,27206,27477,27476,27478,27559,27562,27563,27592,27591,27652,27651,27654,28589,28619,28579,28615,28604,28622,28616,28510,28612,28605,28574,28618,28584,28676,28581,28590,28602,28588,28586,28623,28607,28600,28578,28617,28587,28621,28591,28594,28592,29125,29122,29119,29112,29142,29120,29121,29131,29140,29130,29127,29135,29117,29144,29116,29126,29146,29147,29341,29342,29545,29542,29543,29548,29541,29547,29546,29823,29850,29856,29844,29842,29845,29857,29963,30080,30255,30253,30257,30269,30259,30268,30261,30258,30256,30395,30438,30618,30621,30625,30620,30619,30626,30627,30613,30617,30615,30941,30953,30949,30954,30942,30947,30939,30945,30946,30957,30943,30944,31140,31300,31304,31303,31414,31416,31413,31409,31415,31710,31715,31719,31709,31701,31717,31706,31720,31737,31700,31722,31714,31708,31723,31704,31711,31954,31956,31959,31952,31953,32274,32289,32279,32268,32287,32288,32275,32270,32284,32277,32282,32290,32267,32271,32278,32269,32276,32293,32292,32579,32635,32636,32634,32689,32751,32810,32809,32876,33201,33190,33198,33209,33205,33195,33200,33196,33204,33202,33207,33191,33266,33365,33366,33367,34134,34117,34155,34125,34131,34145,34136,34112,34118,34148,34113,34146,34116,34129,34119,34147,34110,34139,34161,34126,34158,34165,34133,34151,34144,34188,34150,34141,34132,34149,34156,34403,34405,34404,34715,34703,34711,34707,34706,34696,34689,34710,34712,34681,34695,34723,34693,34704,34705,34717,34692,34708,34716,34714,34697,35102,35110,35120,35117,35118,35111,35121,35106,35113,35107,35119,35116,35103,35313,35552,35554,35570,35572,35573,35549,35604,35556,35551,35568,35528,35550,35553,35560,35583,35567,35579,35985,35986,35984,36085,36078,36081,36080,36083,36204,36206,36261,36263,36403,36414,36408,36416,36421,36406,36412,36413,36417,36400,36415,36541,36662,36654,36661,36658,36665,36663,36660,36982,36985,36987,36998,37114,37171,37173,37174,37267,37264,37265,37261,37263,37671,37662,37640,37663,37638,37647,37754,37688,37692,37659,37667,37650,37633,37702,37677,37646,37645,37579,37661,37626,37669,37651,37625,37623,37684,37634,37668,37631,37673,37689,37685,37674,37652,37644,37643,37630,37641,37632,37627,37654,38332,38349,38334,38329,38330,38326,38335,38325,38333,38569,38612,38667,38674,38672,38809,38807,38804,38896,38904,38965,38959,38962,39204,39199,39207,39209,39326,39406,39404,39397,39396,39408,39395,39402,39401,39399,39609,39615,39604,39611,39670,39674,39673,39671,39731,39808,39813,39815,39804,39806,39803,39810,39827,39826,39824,39802,39829,39805,39816,40229,40215,40224,40222,40212,40233,40221,40216,40226,40208,40217,40223,40584,40582,40583,40622,40621,40661,40662,40698,40722,40765,20774,20773,20770,20772,20768,20777,21236,22163,22156,22157,22150,22148,22147,22142,22146,22143,22145,22742,22740,22735,22738,23341,23333,23346,23331,23340,23335,23334,23343,23342,23419,23537,23538,23991,24172,24170,24510,24507,25027,25013,25020,25063,25056,25061,25060,25064,25054,25839,25833,25827,25835,25828,25832,25985,25984,26038,26074,26322,27277,27286,27265,27301,27273,27295,27291,27297,27294,27271,27283,27278,27285,27267,27304,27300,27281,27263,27302,27290,27269,27276,27282,27483,27565,27657,28620,28585,28660,28628,28643,28636,28653,28647,28646,28638,28658,28637,28642,28648,29153,29169,29160,29170,29156,29168,29154,29555,29550,29551,29847,29874,29867,29840,29866,29869,29873,29861,29871,29968,29969,29970,29967,30084,30275,30280,30281,30279,30372,30441,30645,30635,30642,30647,30646,30644,30641,30632,30704,30963,30973,30978,30971,30972,30962,30981,30969,30974,30980,31147,31144,31324,31323,31318,31320,31316,31322,31422,31424,31425,31749,31759,31730,31744,31743,31739,31758,31732,31755,31731,31746,31753,31747,31745,31736,31741,31750,31728,31729,31760,31754,31976,32301,32316,32322,32307,38984,32312,32298,32329,32320,32327,32297,32332,32304,32315,32310,32324,32314,32581,32639,32638,32637,32756,32754,32812,33211,33220,33228,33226,33221,33223,33212,33257,33371,33370,33372,34179,34176,34191,34215,34197,34208,34187,34211,34171,34212,34202,34206,34167,34172,34185,34209,34170,34168,34135,34190,34198,34182,34189,34201,34205,34177,34210,34178,34184,34181,34169,34166,34200,34192,34207,34408,34750,34730,34733,34757,34736,34732,34745,34741,34748,34734,34761,34755,34754,34764,34743,34735,34756,34762,34740,34742,34751,34744,34749,34782,34738,35125,35123,35132,35134,35137,35154,35127,35138,35245,35247,35246,35314,35315,35614,35608,35606,35601,35589,35595,35618,35599,35602,35605,35591,35597,35592,35590,35612,35603,35610,35919,35952,35954,35953,35951,35989,35988,36089,36207,36430,36429,36435,36432,36428,36423,36675,36672,36997,36990,37176,37274,37282,37275,37273,37279,37281,37277,37280,37793,37763,37807,37732,37718,37703,37756,37720,37724,37750,37705,37712,37713,37728,37741,37775,37708,37738,37753,37719,37717,37714,37711,37745,37751,37755,37729,37726,37731,37735,37760,37710,37721,38343,38336,38345,38339,38341,38327,38574,38576,38572,38688,38687,38680,38685,38681,38810,38817,38812,38814,38813,38869,38868,38897,38977,38980,38986,38985,38981,38979,39205,39211,39212,39210,39219,39218,39215,39213,39217,39216,39320,39331,39329,39426,39418,39412,39415,39417,39416,39414,39419,39421,39422,39420,39427,39614,39678,39677,39681,39676,39752,39834,39848,39838,39835,39846,39841,39845,39844,39814,39842,39840,39855,40243,40257,40295,40246,40238,40239,40241,40248,40240,40261,40258,40259,40254,40247,40256,40253,32757,40237,40586,40585,40589,40624,40648,40666,40699,40703,40740,40739,40738,40788,40864,20785,20781,20782,22168,22172,22167,22170,22173,22169,22896,23356,23657,23658,24000,24173,24174,25048,25055,25069,25070,25073,25066,25072,25067,25046,25065,25855,25860,25853,25848,25857,25859,25852,26004,26075,26330,26331,26328,27333,27321,27325,27361,27334,27322,27318,27319,27335,27316,27309,27486,27593,27659,28679,28684,28685,28673,28677,28692,28686,28671,28672,28667,28710,28668,28663,28682,29185,29183,29177,29187,29181,29558,29880,29888,29877,29889,29886,29878,29883,29890,29972,29971,30300,30308,30297,30288,30291,30295,30298,30374,30397,30444,30658,30650,30975,30988,30995,30996,30985,30992,30994,30993,31149,31148,31327,31772,31785,31769,31776,31775,31789,31773,31782,31784,31778,31781,31792,32348,32336,32342,32355,32344,32354,32351,32337,32352,32343,32339,32693,32691,32759,32760,32885,33233,33234,33232,33375,33374,34228,34246,34240,34243,34242,34227,34229,34237,34247,34244,34239,34251,34254,34248,34245,34225,34230,34258,34340,34232,34231,34238,34409,34791,34790,34786,34779,34795,34794,34789,34783,34803,34788,34772,34780,34771,34797,34776,34787,34724,34775,34777,34817,34804,34792,34781,35155,35147,35151,35148,35142,35152,35153,35145,35626,35623,35619,35635,35632,35637,35655,35631,35644,35646,35633,35621,35639,35622,35638,35630,35620,35643,35645,35642,35906,35957,35993,35992,35991,36094,36100,36098,36096,36444,36450,36448,36439,36438,36446,36453,36455,36443,36442,36449,36445,36457,36436,36678,36679,36680,36683,37160,37178,37179,37182,37288,37285,37287,37295,37290,37813,37772,37778,37815,37787,37789,37769,37799,37774,37802,37790,37798,37781,37768,37785,37791,37773,37809,37777,37810,37796,37800,37812,37795,37797,38354,38355,38353,38579,38615,38618,24002,38623,38616,38621,38691,38690,38693,38828,38830,38824,38827,38820,38826,38818,38821,38871,38873,38870,38872,38906,38992,38993,38994,39096,39233,39228,39226,39439,39435,39433,39437,39428,39441,39434,39429,39431,39430,39616,39644,39688,39684,39685,39721,39733,39754,39756,39755,39879,39878,39875,39871,39873,39861,39864,39891,39862,39876,39865,39869,40284,40275,40271,40266,40283,40267,40281,40278,40268,40279,40274,40276,40287,40280,40282,40590,40588,40671,40705,40704,40726,40741,40747,40746,40745,40744,40780,40789,20788,20789,21142,21239,21428,22187,22189,22182,22183,22186,22188,22746,22749,22747,22802,23357,23358,23359,24003,24176,24511,25083,25863,25872,25869,25865,25868,25870,25988,26078,26077,26334,27367,27360,27340,27345,27353,27339,27359,27356,27344,27371,27343,27341,27358,27488,27568,27660,28697,28711,28704,28694,28715,28705,28706,28707,28713,28695,28708,28700,28714,29196,29194,29191,29186,29189,29349,29350,29348,29347,29345,29899,29893,29879,29891,29974,30304,30665,30666,30660,30705,31005,31003,31009,31004,30999,31006,31152,31335,31336,31795,31804,31801,31788,31803,31980,31978,32374,32373,32376,32368,32375,32367,32378,32370,32372,32360,32587,32586,32643,32646,32695,32765,32766,32888,33239,33237,33380,33377,33379,34283,34289,34285,34265,34273,34280,34266,34263,34284,34290,34296,34264,34271,34275,34268,34257,34288,34278,34287,34270,34274,34816,34810,34819,34806,34807,34825,34828,34827,34822,34812,34824,34815,34826,34818,35170,35162,35163,35159,35169,35164,35160,35165,35161,35208,35255,35254,35318,35664,35656,35658,35648,35667,35670,35668,35659,35669,35665,35650,35666,35671,35907,35959,35958,35994,36102,36103,36105,36268,36266,36269,36267,36461,36472,36467,36458,36463,36475,36546,36690,36689,36687,36688,36691,36788,37184,37183,37296,37293,37854,37831,37839,37826,37850,37840,37881,37868,37836,37849,37801,37862,37834,37844,37870,37859,37845,37828,37838,37824,37842,37863,38269,38362,38363,38625,38697,38699,38700,38696,38694,38835,38839,38838,38877,38878,38879,39004,39001,39005,38999,39103,39101,39099,39102,39240,39239,39235,39334,39335,39450,39445,39461,39453,39460,39451,39458,39456,39463,39459,39454,39452,39444,39618,39691,39690,39694,39692,39735,39914,39915,39904,39902,39908,39910,39906,39920,39892,39895,39916,39900,39897,39909,39893,39905,39898,40311,40321,40330,40324,40328,40305,40320,40312,40326,40331,40332,40317,40299,40308,40309,40304,40297,40325,40307,40315,40322,40303,40313,40319,40327,40296,40596,40593,40640,40700,40749,40768,40769,40781,40790,40791,40792,21303,22194,22197,22195,22755,23365,24006,24007,24302,24303,24512,24513,25081,25879,25878,25877,25875,26079,26344,26339,26340,27379,27376,27370,27368,27385,27377,27374,27375,28732,28725,28719,28727,28724,28721,28738,28728,28735,28730,28729,28736,28731,28723,28737,29203,29204,29352,29565,29564,29882,30379,30378,30398,30445,30668,30670,30671,30669,30706,31013,31011,31015,31016,31012,31017,31154,31342,31340,31341,31479,31817,31816,31818,31815,31813,31982,32379,32382,32385,32384,32698,32767,32889,33243,33241,33291,33384,33385,34338,34303,34305,34302,34331,34304,34294,34308,34313,34309,34316,34301,34841,34832,34833,34839,34835,34838,35171,35174,35257,35319,35680,35690,35677,35688,35683,35685,35687,35693,36270,36486,36488,36484,36697,36694,36695,36693,36696,36698,37005,37187,37185,37303,37301,37298,37299,37899,37907,37883,37920,37903,37908,37886,37909,37904,37928,37913,37901,37877,37888,37879,37895,37902,37910,37906,37882,37897,37880,37898,37887,37884,37900,37878,37905,37894,38366,38368,38367,38702,38703,38841,38843,38909,38910,39008,39010,39011,39007,39105,39106,39248,39246,39257,39244,39243,39251,39474,39476,39473,39468,39466,39478,39465,39470,39480,39469,39623,39626,39622,39696,39698,39697,39947,39944,39927,39941,39954,39928,40000,39943,39950,39942,39959,39956,39945,40351,40345,40356,40349,40338,40344,40336,40347,40352,40340,40348,40362,40343,40353,40346,40354,40360,40350,40355,40383,40361,40342,40358,40359,40601,40603,40602,40677,40676,40679,40678,40752,40750,40795,40800,40798,40797,40793,40849,20794,20793,21144,21143,22211,22205,22206,23368,23367,24011,24015,24305,25085,25883,27394,27388,27395,27384,27392,28739,28740,28746,28744,28745,28741,28742,29213,29210,29209,29566,29975,30314,30672,31021,31025,31023,31828,31827,31986,32394,32391,32392,32395,32390,32397,32589,32699,32816,33245,34328,34346,34342,34335,34339,34332,34329,34343,34350,34337,34336,34345,34334,34341,34857,34845,34843,34848,34852,34844,34859,34890,35181,35177,35182,35179,35322,35705,35704,35653,35706,35707,36112,36116,36271,36494,36492,36702,36699,36701,37190,37188,37189,37305,37951,37947,37942,37929,37949,37948,37936,37945,37930,37943,37932,37952,37937,38373,38372,38371,38709,38714,38847,38881,39012,39113,39110,39104,39256,39254,39481,39485,39494,39492,39490,39489,39482,39487,39629,39701,39703,39704,39702,39738,39762,39979,39965,39964,39980,39971,39976,39977,39972,39969,40375,40374,40380,40385,40391,40394,40399,40382,40389,40387,40379,40373,40398,40377,40378,40364,40392,40369,40365,40396,40371,40397,40370,40570,40604,40683,40686,40685,40731,40728,40730,40753,40782,40805,40804,40850,20153,22214,22213,22219,22897,23371,23372,24021,24017,24306,25889,25888,25894,25890,27403,27400,27401,27661,28757,28758,28759,28754,29214,29215,29353,29567,29912,29909,29913,29911,30317,30381,31029,31156,31344,31345,31831,31836,31833,31835,31834,31988,31985,32401,32591,32647,33246,33387,34356,34357,34355,34348,34354,34358,34860,34856,34854,34858,34853,35185,35263,35262,35323,35710,35716,35714,35718,35717,35711,36117,36501,36500,36506,36498,36496,36502,36503,36704,36706,37191,37964,37968,37962,37963,37967,37959,37957,37960,37961,37958,38719,38883,39018,39017,39115,39252,39259,39502,39507,39508,39500,39503,39496,39498,39497,39506,39504,39632,39705,39723,39739,39766,39765,40006,40008,39999,40004,39993,39987,40001,39996,39991,39988,39986,39997,39990,40411,40402,40414,40410,40395,40400,40412,40401,40415,40425,40409,40408,40406,40437,40405,40413,40630,40688,40757,40755,40754,40770,40811,40853,40866,20797,21145,22760,22759,22898,23373,24024,34863,24399,25089,25091,25092,25897,25893,26006,26347,27409,27410,27407,27594,28763,28762,29218,29570,29569,29571,30320,30676,31847,31846,32405,33388,34362,34368,34361,34364,34353,34363,34366,34864,34866,34862,34867,35190,35188,35187,35326,35724,35726,35723,35720,35909,36121,36504,36708,36707,37308,37986,37973,37981,37975,37982,38852,38853,38912,39510,39513,39710,39711,39712,40018,40024,40016,40010,40013,40011,40021,40025,40012,40014,40443,40439,40431,40419,40427,40440,40420,40438,40417,40430,40422,40434,40432,40418,40428,40436,40435,40424,40429,40642,40656,40690,40691,40710,40732,40760,40759,40758,40771,40783,40817,40816,40814,40815,22227,22221,23374,23661,25901,26349,26350,27411,28767,28769,28765,28768,29219,29915,29925,30677,31032,31159,31158,31850,32407,32649,33389,34371,34872,34871,34869,34891,35732,35733,36510,36511,36512,36509,37310,37309,37314,37995,37992,37993,38629,38726,38723,38727,38855,38885,39518,39637,39769,40035,40039,40038,40034,40030,40032,40450,40446,40455,40451,40454,40453,40448,40449,40457,40447,40445,40452,40608,40734,40774,40820,40821,40822,22228,25902,26040,27416,27417,27415,27418,28770,29222,29354,30680,30681,31033,31849,31851,31990,32410,32408,32411,32409,33248,33249,34374,34375,34376,35193,35194,35196,35195,35327,35736,35737,36517,36516,36515,37998,37997,37999,38001,38003,38729,39026,39263,40040,40046,40045,40459,40461,40464,40463,40466,40465,40609,40693,40713,40775,40824,40827,40826,40825,22302,28774,31855,34876,36274,36518,37315,38004,38008,38006,38005,39520,40052,40051,40049,40053,40468,40467,40694,40714,40868,28776,28773,31991,34410,34878,34877,34879,35742,35996,36521,36553,38731,39027,39028,39116,39265,39339,39524,39526,39527,39716,40469,40471,40776,25095,27422,29223,34380,36520,38018,38016,38017,39529,39528,39726,40473,29225,34379,35743,38019,40057,40631,30325,39531,40058,40477,28777,28778,40612,40830,40777,40856,30849,37561,35023,22715,24658,31911,23290,9556,9574,9559,9568,9580,9571,9562,9577,9565,9554,9572,9557,9566,9578,9569,9560,9575,9563,9555,9573,9558,9567,9579,9570,9561,9576,9564,9553,9552,9581,9582,9584,9583,65517,132423,37595,132575,147397,34124,17077,29679,20917,13897,149826,166372,37700,137691,33518,146632,30780,26436,25311,149811,166314,131744,158643,135941,20395,140525,20488,159017,162436,144896,150193,140563,20521,131966,24484,131968,131911,28379,132127,20605,20737,13434,20750,39020,14147,33814,149924,132231,20832,144308,20842,134143,139516,131813,140592,132494,143923,137603,23426,34685,132531,146585,20914,20920,40244,20937,20943,20945,15580,20947,150182,20915,20962,21314,20973,33741,26942,145197,24443,21003,21030,21052,21173,21079,21140,21177,21189,31765,34114,21216,34317,158483,21253,166622,21833,28377,147328,133460,147436,21299,21316,134114,27851,136998,26651,29653,24650,16042,14540,136936,29149,17570,21357,21364,165547,21374,21375,136598,136723,30694,21395,166555,21408,21419,21422,29607,153458,16217,29596,21441,21445,27721,20041,22526,21465,15019,134031,21472,147435,142755,21494,134263,21523,28793,21803,26199,27995,21613,158547,134516,21853,21647,21668,18342,136973,134877,15796,134477,166332,140952,21831,19693,21551,29719,21894,21929,22021,137431,147514,17746,148533,26291,135348,22071,26317,144010,26276,26285,22093,22095,30961,22257,38791,21502,22272,22255,22253,166758,13859,135759,22342,147877,27758,28811,22338,14001,158846,22502,136214,22531,136276,148323,22566,150517,22620,22698,13665,22752,22748,135740,22779,23551,22339,172368,148088,37843,13729,22815,26790,14019,28249,136766,23076,21843,136850,34053,22985,134478,158849,159018,137180,23001,137211,137138,159142,28017,137256,136917,23033,159301,23211,23139,14054,149929,23159,14088,23190,29797,23251,159649,140628,15749,137489,14130,136888,24195,21200,23414,25992,23420,162318,16388,18525,131588,23509,24928,137780,154060,132517,23539,23453,19728,23557,138052,23571,29646,23572,138405,158504,23625,18653,23685,23785,23791,23947,138745,138807,23824,23832,23878,138916,23738,24023,33532,14381,149761,139337,139635,33415,14390,15298,24110,27274,24181,24186,148668,134355,21414,20151,24272,21416,137073,24073,24308,164994,24313,24315,14496,24316,26686,37915,24333,131521,194708,15070,18606,135994,24378,157832,140240,24408,140401,24419,38845,159342,24434,37696,166454,24487,23990,15711,152144,139114,159992,140904,37334,131742,166441,24625,26245,137335,14691,15815,13881,22416,141236,31089,15936,24734,24740,24755,149890,149903,162387,29860,20705,23200,24932,33828,24898,194726,159442,24961,20980,132694,24967,23466,147383,141407,25043,166813,170333,25040,14642,141696,141505,24611,24924,25886,25483,131352,25285,137072,25301,142861,25452,149983,14871,25656,25592,136078,137212,25744,28554,142902,38932,147596,153373,25825,25829,38011,14950,25658,14935,25933,28438,150056,150051,25989,25965,25951,143486,26037,149824,19255,26065,16600,137257,26080,26083,24543,144384,26136,143863,143864,26180,143780,143781,26187,134773,26215,152038,26227,26228,138813,143921,165364,143816,152339,30661,141559,39332,26370,148380,150049,15147,27130,145346,26462,26471,26466,147917,168173,26583,17641,26658,28240,37436,26625,144358,159136,26717,144495,27105,27147,166623,26995,26819,144845,26881,26880,15666,14849,144956,15232,26540,26977,166474,17148,26934,27032,15265,132041,33635,20624,27129,144985,139562,27205,145155,27293,15347,26545,27336,168348,15373,27421,133411,24798,27445,27508,141261,28341,146139,132021,137560,14144,21537,146266,27617,147196,27612,27703,140427,149745,158545,27738,33318,27769,146876,17605,146877,147876,149772,149760,146633,14053,15595,134450,39811,143865,140433,32655,26679,159013,159137,159211,28054,27996,28284,28420,149887,147589,159346,34099,159604,20935,27804,28189,33838,166689,28207,146991,29779,147330,31180,28239,23185,143435,28664,14093,28573,146992,28410,136343,147517,17749,37872,28484,28508,15694,28532,168304,15675,28575,147780,28627,147601,147797,147513,147440,147380,147775,20959,147798,147799,147776,156125,28747,28798,28839,28801,28876,28885,28886,28895,16644,15848,29108,29078,148087,28971,28997,23176,29002,29038,23708,148325,29007,37730,148161,28972,148570,150055,150050,29114,166888,28861,29198,37954,29205,22801,37955,29220,37697,153093,29230,29248,149876,26813,29269,29271,15957,143428,26637,28477,29314,29482,29483,149539,165931,18669,165892,29480,29486,29647,29610,134202,158254,29641,29769,147938,136935,150052,26147,14021,149943,149901,150011,29687,29717,26883,150054,29753,132547,16087,29788,141485,29792,167602,29767,29668,29814,33721,29804,14128,29812,37873,27180,29826,18771,150156,147807,150137,166799,23366,166915,137374,29896,137608,29966,29929,29982,167641,137803,23511,167596,37765,30029,30026,30055,30062,151426,16132,150803,30094,29789,30110,30132,30210,30252,30289,30287,30319,30326,156661,30352,33263,14328,157969,157966,30369,30373,30391,30412,159647,33890,151709,151933,138780,30494,30502,30528,25775,152096,30552,144044,30639,166244,166248,136897,30708,30729,136054,150034,26826,30895,30919,30931,38565,31022,153056,30935,31028,30897,161292,36792,34948,166699,155779,140828,31110,35072,26882,31104,153687,31133,162617,31036,31145,28202,160038,16040,31174,168205,31188],\n \"euc-kr\":[44034,44035,44037,44038,44043,44044,44045,44046,44047,44056,44062,44063,44065,44066,44067,44069,44070,44071,44072,44073,44074,44075,44078,44082,44083,44084,null,null,null,null,null,null,44085,44086,44087,44090,44091,44093,44094,44095,44097,44098,44099,44100,44101,44102,44103,44104,44105,44106,44108,44110,44111,44112,44113,44114,44115,44117,null,null,null,null,null,null,44118,44119,44121,44122,44123,44125,44126,44127,44128,44129,44130,44131,44132,44133,44134,44135,44136,44137,44138,44139,44140,44141,44142,44143,44146,44147,44149,44150,44153,44155,44156,44157,44158,44159,44162,44167,44168,44173,44174,44175,44177,44178,44179,44181,44182,44183,44184,44185,44186,44187,44190,44194,44195,44196,44197,44198,44199,44203,44205,44206,44209,44210,44211,44212,44213,44214,44215,44218,44222,44223,44224,44226,44227,44229,44230,44231,44233,44234,44235,44237,44238,44239,44240,44241,44242,44243,44244,44246,44248,44249,44250,44251,44252,44253,44254,44255,44258,44259,44261,44262,44265,44267,44269,44270,44274,44276,44279,44280,44281,44282,44283,44286,44287,44289,44290,44291,44293,44295,44296,44297,44298,44299,44302,44304,44306,44307,44308,44309,44310,44311,44313,44314,44315,44317,44318,44319,44321,44322,44323,44324,44325,44326,44327,44328,44330,44331,44334,44335,44336,44337,44338,44339,null,null,null,null,null,null,44342,44343,44345,44346,44347,44349,44350,44351,44352,44353,44354,44355,44358,44360,44362,44363,44364,44365,44366,44367,44369,44370,44371,44373,44374,44375,null,null,null,null,null,null,44377,44378,44379,44380,44381,44382,44383,44384,44386,44388,44389,44390,44391,44392,44393,44394,44395,44398,44399,44401,44402,44407,44408,44409,44410,44414,44416,44419,44420,44421,44422,44423,44426,44427,44429,44430,44431,44433,44434,44435,44436,44437,44438,44439,44440,44441,44442,44443,44446,44447,44448,44449,44450,44451,44453,44454,44455,44456,44457,44458,44459,44460,44461,44462,44463,44464,44465,44466,44467,44468,44469,44470,44472,44473,44474,44475,44476,44477,44478,44479,44482,44483,44485,44486,44487,44489,44490,44491,44492,44493,44494,44495,44498,44500,44501,44502,44503,44504,44505,44506,44507,44509,44510,44511,44513,44514,44515,44517,44518,44519,44520,44521,44522,44523,44524,44525,44526,44527,44528,44529,44530,44531,44532,44533,44534,44535,44538,44539,44541,44542,44546,44547,44548,44549,44550,44551,44554,44556,44558,44559,44560,44561,44562,44563,44565,44566,44567,44568,44569,44570,44571,44572,null,null,null,null,null,null,44573,44574,44575,44576,44577,44578,44579,44580,44581,44582,44583,44584,44585,44586,44587,44588,44589,44590,44591,44594,44595,44597,44598,44601,44603,44604,null,null,null,null,null,null,44605,44606,44607,44610,44612,44615,44616,44617,44619,44623,44625,44626,44627,44629,44631,44632,44633,44634,44635,44638,44642,44643,44644,44646,44647,44650,44651,44653,44654,44655,44657,44658,44659,44660,44661,44662,44663,44666,44670,44671,44672,44673,44674,44675,44678,44679,44680,44681,44682,44683,44685,44686,44687,44688,44689,44690,44691,44692,44693,44694,44695,44696,44697,44698,44699,44700,44701,44702,44703,44704,44705,44706,44707,44708,44709,44710,44711,44712,44713,44714,44715,44716,44717,44718,44719,44720,44721,44722,44723,44724,44725,44726,44727,44728,44729,44730,44731,44735,44737,44738,44739,44741,44742,44743,44744,44745,44746,44747,44750,44754,44755,44756,44757,44758,44759,44762,44763,44765,44766,44767,44768,44769,44770,44771,44772,44773,44774,44775,44777,44778,44780,44782,44783,44784,44785,44786,44787,44789,44790,44791,44793,44794,44795,44797,44798,44799,44800,44801,44802,44803,44804,44805,null,null,null,null,null,null,44806,44809,44810,44811,44812,44814,44815,44817,44818,44819,44820,44821,44822,44823,44824,44825,44826,44827,44828,44829,44830,44831,44832,44833,44834,44835,null,null,null,null,null,null,44836,44837,44838,44839,44840,44841,44842,44843,44846,44847,44849,44851,44853,44854,44855,44856,44857,44858,44859,44862,44864,44868,44869,44870,44871,44874,44875,44876,44877,44878,44879,44881,44882,44883,44884,44885,44886,44887,44888,44889,44890,44891,44894,44895,44896,44897,44898,44899,44902,44903,44904,44905,44906,44907,44908,44909,44910,44911,44912,44913,44914,44915,44916,44917,44918,44919,44920,44922,44923,44924,44925,44926,44927,44929,44930,44931,44933,44934,44935,44937,44938,44939,44940,44941,44942,44943,44946,44947,44948,44950,44951,44952,44953,44954,44955,44957,44958,44959,44960,44961,44962,44963,44964,44965,44966,44967,44968,44969,44970,44971,44972,44973,44974,44975,44976,44977,44978,44979,44980,44981,44982,44983,44986,44987,44989,44990,44991,44993,44994,44995,44996,44997,44998,45002,45004,45007,45008,45009,45010,45011,45013,45014,45015,45016,45017,45018,45019,45021,45022,45023,45024,45025,null,null,null,null,null,null,45026,45027,45028,45029,45030,45031,45034,45035,45036,45037,45038,45039,45042,45043,45045,45046,45047,45049,45050,45051,45052,45053,45054,45055,45058,45059,null,null,null,null,null,null,45061,45062,45063,45064,45065,45066,45067,45069,45070,45071,45073,45074,45075,45077,45078,45079,45080,45081,45082,45083,45086,45087,45088,45089,45090,45091,45092,45093,45094,45095,45097,45098,45099,45100,45101,45102,45103,45104,45105,45106,45107,45108,45109,45110,45111,45112,45113,45114,45115,45116,45117,45118,45119,45120,45121,45122,45123,45126,45127,45129,45131,45133,45135,45136,45137,45138,45142,45144,45146,45147,45148,45150,45151,45152,45153,45154,45155,45156,45157,45158,45159,45160,45161,45162,45163,45164,45165,45166,45167,45168,45169,45170,45171,45172,45173,45174,45175,45176,45177,45178,45179,45182,45183,45185,45186,45187,45189,45190,45191,45192,45193,45194,45195,45198,45200,45202,45203,45204,45205,45206,45207,45211,45213,45214,45219,45220,45221,45222,45223,45226,45232,45234,45238,45239,45241,45242,45243,45245,45246,45247,45248,45249,45250,45251,45254,45258,45259,45260,45261,45262,45263,45266,null,null,null,null,null,null,45267,45269,45270,45271,45273,45274,45275,45276,45277,45278,45279,45281,45282,45283,45284,45286,45287,45288,45289,45290,45291,45292,45293,45294,45295,45296,null,null,null,null,null,null,45297,45298,45299,45300,45301,45302,45303,45304,45305,45306,45307,45308,45309,45310,45311,45312,45313,45314,45315,45316,45317,45318,45319,45322,45325,45326,45327,45329,45332,45333,45334,45335,45338,45342,45343,45344,45345,45346,45350,45351,45353,45354,45355,45357,45358,45359,45360,45361,45362,45363,45366,45370,45371,45372,45373,45374,45375,45378,45379,45381,45382,45383,45385,45386,45387,45388,45389,45390,45391,45394,45395,45398,45399,45401,45402,45403,45405,45406,45407,45409,45410,45411,45412,45413,45414,45415,45416,45417,45418,45419,45420,45421,45422,45423,45424,45425,45426,45427,45428,45429,45430,45431,45434,45435,45437,45438,45439,45441,45443,45444,45445,45446,45447,45450,45452,45454,45455,45456,45457,45461,45462,45463,45465,45466,45467,45469,45470,45471,45472,45473,45474,45475,45476,45477,45478,45479,45481,45482,45483,45484,45485,45486,45487,45488,45489,45490,45491,45492,45493,45494,45495,45496,null,null,null,null,null,null,45497,45498,45499,45500,45501,45502,45503,45504,45505,45506,45507,45508,45509,45510,45511,45512,45513,45514,45515,45517,45518,45519,45521,45522,45523,45525,null,null,null,null,null,null,45526,45527,45528,45529,45530,45531,45534,45536,45537,45538,45539,45540,45541,45542,45543,45546,45547,45549,45550,45551,45553,45554,45555,45556,45557,45558,45559,45560,45562,45564,45566,45567,45568,45569,45570,45571,45574,45575,45577,45578,45581,45582,45583,45584,45585,45586,45587,45590,45592,45594,45595,45596,45597,45598,45599,45601,45602,45603,45604,45605,45606,45607,45608,45609,45610,45611,45612,45613,45614,45615,45616,45617,45618,45619,45621,45622,45623,45624,45625,45626,45627,45629,45630,45631,45632,45633,45634,45635,45636,45637,45638,45639,45640,45641,45642,45643,45644,45645,45646,45647,45648,45649,45650,45651,45652,45653,45654,45655,45657,45658,45659,45661,45662,45663,45665,45666,45667,45668,45669,45670,45671,45674,45675,45676,45677,45678,45679,45680,45681,45682,45683,45686,45687,45688,45689,45690,45691,45693,45694,45695,45696,45697,45698,45699,45702,45703,45704,45706,45707,45708,45709,45710,null,null,null,null,null,null,45711,45714,45715,45717,45718,45719,45723,45724,45725,45726,45727,45730,45732,45735,45736,45737,45739,45741,45742,45743,45745,45746,45747,45749,45750,45751,null,null,null,null,null,null,45752,45753,45754,45755,45756,45757,45758,45759,45760,45761,45762,45763,45764,45765,45766,45767,45770,45771,45773,45774,45775,45777,45779,45780,45781,45782,45783,45786,45788,45790,45791,45792,45793,45795,45799,45801,45802,45808,45809,45810,45814,45820,45821,45822,45826,45827,45829,45830,45831,45833,45834,45835,45836,45837,45838,45839,45842,45846,45847,45848,45849,45850,45851,45853,45854,45855,45856,45857,45858,45859,45860,45861,45862,45863,45864,45865,45866,45867,45868,45869,45870,45871,45872,45873,45874,45875,45876,45877,45878,45879,45880,45881,45882,45883,45884,45885,45886,45887,45888,45889,45890,45891,45892,45893,45894,45895,45896,45897,45898,45899,45900,45901,45902,45903,45904,45905,45906,45907,45911,45913,45914,45917,45920,45921,45922,45923,45926,45928,45930,45932,45933,45935,45938,45939,45941,45942,45943,45945,45946,45947,45948,45949,45950,45951,45954,45958,45959,45960,45961,45962,45963,45965,null,null,null,null,null,null,45966,45967,45969,45970,45971,45973,45974,45975,45976,45977,45978,45979,45980,45981,45982,45983,45986,45987,45988,45989,45990,45991,45993,45994,45995,45997,null,null,null,null,null,null,45998,45999,46000,46001,46002,46003,46004,46005,46006,46007,46008,46009,46010,46011,46012,46013,46014,46015,46016,46017,46018,46019,46022,46023,46025,46026,46029,46031,46033,46034,46035,46038,46040,46042,46044,46046,46047,46049,46050,46051,46053,46054,46055,46057,46058,46059,46060,46061,46062,46063,46064,46065,46066,46067,46068,46069,46070,46071,46072,46073,46074,46075,46077,46078,46079,46080,46081,46082,46083,46084,46085,46086,46087,46088,46089,46090,46091,46092,46093,46094,46095,46097,46098,46099,46100,46101,46102,46103,46105,46106,46107,46109,46110,46111,46113,46114,46115,46116,46117,46118,46119,46122,46124,46125,46126,46127,46128,46129,46130,46131,46133,46134,46135,46136,46137,46138,46139,46140,46141,46142,46143,46144,46145,46146,46147,46148,46149,46150,46151,46152,46153,46154,46155,46156,46157,46158,46159,46162,46163,46165,46166,46167,46169,46170,46171,46172,46173,46174,46175,46178,46180,46182,null,null,null,null,null,null,46183,46184,46185,46186,46187,46189,46190,46191,46192,46193,46194,46195,46196,46197,46198,46199,46200,46201,46202,46203,46204,46205,46206,46207,46209,46210,null,null,null,null,null,null,46211,46212,46213,46214,46215,46217,46218,46219,46220,46221,46222,46223,46224,46225,46226,46227,46228,46229,46230,46231,46232,46233,46234,46235,46236,46238,46239,46240,46241,46242,46243,46245,46246,46247,46249,46250,46251,46253,46254,46255,46256,46257,46258,46259,46260,46262,46264,46266,46267,46268,46269,46270,46271,46273,46274,46275,46277,46278,46279,46281,46282,46283,46284,46285,46286,46287,46289,46290,46291,46292,46294,46295,46296,46297,46298,46299,46302,46303,46305,46306,46309,46311,46312,46313,46314,46315,46318,46320,46322,46323,46324,46325,46326,46327,46329,46330,46331,46332,46333,46334,46335,46336,46337,46338,46339,46340,46341,46342,46343,46344,46345,46346,46347,46348,46349,46350,46351,46352,46353,46354,46355,46358,46359,46361,46362,46365,46366,46367,46368,46369,46370,46371,46374,46379,46380,46381,46382,46383,46386,46387,46389,46390,46391,46393,46394,46395,46396,46397,46398,46399,46402,46406,null,null,null,null,null,null,46407,46408,46409,46410,46414,46415,46417,46418,46419,46421,46422,46423,46424,46425,46426,46427,46430,46434,46435,46436,46437,46438,46439,46440,46441,46442,null,null,null,null,null,null,46443,46444,46445,46446,46447,46448,46449,46450,46451,46452,46453,46454,46455,46456,46457,46458,46459,46460,46461,46462,46463,46464,46465,46466,46467,46468,46469,46470,46471,46472,46473,46474,46475,46476,46477,46478,46479,46480,46481,46482,46483,46484,46485,46486,46487,46488,46489,46490,46491,46492,46493,46494,46495,46498,46499,46501,46502,46503,46505,46508,46509,46510,46511,46514,46518,46519,46520,46521,46522,46526,46527,46529,46530,46531,46533,46534,46535,46536,46537,46538,46539,46542,46546,46547,46548,46549,46550,46551,46553,46554,46555,46556,46557,46558,46559,46560,46561,46562,46563,46564,46565,46566,46567,46568,46569,46570,46571,46573,46574,46575,46576,46577,46578,46579,46580,46581,46582,46583,46584,46585,46586,46587,46588,46589,46590,46591,46592,46593,46594,46595,46596,46597,46598,46599,46600,46601,46602,46603,46604,46605,46606,46607,46610,46611,46613,46614,46615,46617,46618,46619,46620,46621,null,null,null,null,null,null,46622,46623,46624,46625,46626,46627,46628,46630,46631,46632,46633,46634,46635,46637,46638,46639,46640,46641,46642,46643,46645,46646,46647,46648,46649,46650,null,null,null,null,null,null,46651,46652,46653,46654,46655,46656,46657,46658,46659,46660,46661,46662,46663,46665,46666,46667,46668,46669,46670,46671,46672,46673,46674,46675,46676,46677,46678,46679,46680,46681,46682,46683,46684,46685,46686,46687,46688,46689,46690,46691,46693,46694,46695,46697,46698,46699,46700,46701,46702,46703,46704,46705,46706,46707,46708,46709,46710,46711,46712,46713,46714,46715,46716,46717,46718,46719,46720,46721,46722,46723,46724,46725,46726,46727,46728,46729,46730,46731,46732,46733,46734,46735,46736,46737,46738,46739,46740,46741,46742,46743,46744,46745,46746,46747,46750,46751,46753,46754,46755,46757,46758,46759,46760,46761,46762,46765,46766,46767,46768,46770,46771,46772,46773,46774,46775,46776,46777,46778,46779,46780,46781,46782,46783,46784,46785,46786,46787,46788,46789,46790,46791,46792,46793,46794,46795,46796,46797,46798,46799,46800,46801,46802,46803,46805,46806,46807,46808,46809,46810,46811,46812,46813,null,null,null,null,null,null,46814,46815,46816,46817,46818,46819,46820,46821,46822,46823,46824,46825,46826,46827,46828,46829,46830,46831,46833,46834,46835,46837,46838,46839,46841,46842,null,null,null,null,null,null,46843,46844,46845,46846,46847,46850,46851,46852,46854,46855,46856,46857,46858,46859,46860,46861,46862,46863,46864,46865,46866,46867,46868,46869,46870,46871,46872,46873,46874,46875,46876,46877,46878,46879,46880,46881,46882,46883,46884,46885,46886,46887,46890,46891,46893,46894,46897,46898,46899,46900,46901,46902,46903,46906,46908,46909,46910,46911,46912,46913,46914,46915,46917,46918,46919,46921,46922,46923,46925,46926,46927,46928,46929,46930,46931,46934,46935,46936,46937,46938,46939,46940,46941,46942,46943,46945,46946,46947,46949,46950,46951,46953,46954,46955,46956,46957,46958,46959,46962,46964,46966,46967,46968,46969,46970,46971,46974,46975,46977,46978,46979,46981,46982,46983,46984,46985,46986,46987,46990,46995,46996,46997,47002,47003,47005,47006,47007,47009,47010,47011,47012,47013,47014,47015,47018,47022,47023,47024,47025,47026,47027,47030,47031,47033,47034,47035,47036,47037,47038,47039,47040,47041,null,null,null,null,null,null,47042,47043,47044,47045,47046,47048,47050,47051,47052,47053,47054,47055,47056,47057,47058,47059,47060,47061,47062,47063,47064,47065,47066,47067,47068,47069,null,null,null,null,null,null,47070,47071,47072,47073,47074,47075,47076,47077,47078,47079,47080,47081,47082,47083,47086,47087,47089,47090,47091,47093,47094,47095,47096,47097,47098,47099,47102,47106,47107,47108,47109,47110,47114,47115,47117,47118,47119,47121,47122,47123,47124,47125,47126,47127,47130,47132,47134,47135,47136,47137,47138,47139,47142,47143,47145,47146,47147,47149,47150,47151,47152,47153,47154,47155,47158,47162,47163,47164,47165,47166,47167,47169,47170,47171,47173,47174,47175,47176,47177,47178,47179,47180,47181,47182,47183,47184,47186,47188,47189,47190,47191,47192,47193,47194,47195,47198,47199,47201,47202,47203,47205,47206,47207,47208,47209,47210,47211,47214,47216,47218,47219,47220,47221,47222,47223,47225,47226,47227,47229,47230,47231,47232,47233,47234,47235,47236,47237,47238,47239,47240,47241,47242,47243,47244,47246,47247,47248,47249,47250,47251,47252,47253,47254,47255,47256,47257,47258,47259,47260,47261,47262,47263,null,null,null,null,null,null,47264,47265,47266,47267,47268,47269,47270,47271,47273,47274,47275,47276,47277,47278,47279,47281,47282,47283,47285,47286,47287,47289,47290,47291,47292,47293,null,null,null,null,null,null,47294,47295,47298,47300,47302,47303,47304,47305,47306,47307,47309,47310,47311,47313,47314,47315,47317,47318,47319,47320,47321,47322,47323,47324,47326,47328,47330,47331,47332,47333,47334,47335,47338,47339,47341,47342,47343,47345,47346,47347,47348,47349,47350,47351,47354,47356,47358,47359,47360,47361,47362,47363,47365,47366,47367,47368,47369,47370,47371,47372,47373,47374,47375,47376,47377,47378,47379,47380,47381,47382,47383,47385,47386,47387,47388,47389,47390,47391,47393,47394,47395,47396,47397,47398,47399,47400,47401,47402,47403,47404,47405,47406,47407,47408,47409,47410,47411,47412,47413,47414,47415,47416,47417,47418,47419,47422,47423,47425,47426,47427,47429,47430,47431,47432,47433,47434,47435,47437,47438,47440,47442,47443,47444,47445,47446,47447,47450,47451,47453,47454,47455,47457,47458,47459,47460,47461,47462,47463,47466,47468,47470,47471,47472,47473,47474,47475,47478,47479,47481,47482,47483,47485,null,null,null,null,null,null,47486,47487,47488,47489,47490,47491,47494,47496,47499,47500,47503,47504,47505,47506,47507,47508,47509,47510,47511,47512,47513,47514,47515,47516,47517,47518,null,null,null,null,null,null,47519,47520,47521,47522,47523,47524,47525,47526,47527,47528,47529,47530,47531,47534,47535,47537,47538,47539,47541,47542,47543,47544,47545,47546,47547,47550,47552,47554,47555,47556,47557,47558,47559,47562,47563,47565,47571,47572,47573,47574,47575,47578,47580,47583,47584,47586,47590,47591,47593,47594,47595,47597,47598,47599,47600,47601,47602,47603,47606,47611,47612,47613,47614,47615,47618,47619,47620,47621,47622,47623,47625,47626,47627,47628,47629,47630,47631,47632,47633,47634,47635,47636,47638,47639,47640,47641,47642,47643,47644,47645,47646,47647,47648,47649,47650,47651,47652,47653,47654,47655,47656,47657,47658,47659,47660,47661,47662,47663,47664,47665,47666,47667,47668,47669,47670,47671,47674,47675,47677,47678,47679,47681,47683,47684,47685,47686,47687,47690,47692,47695,47696,47697,47698,47702,47703,47705,47706,47707,47709,47710,47711,47712,47713,47714,47715,47718,47722,47723,47724,47725,47726,47727,null,null,null,null,null,null,47730,47731,47733,47734,47735,47737,47738,47739,47740,47741,47742,47743,47744,47745,47746,47750,47752,47753,47754,47755,47757,47758,47759,47760,47761,47762,null,null,null,null,null,null,47763,47764,47765,47766,47767,47768,47769,47770,47771,47772,47773,47774,47775,47776,47777,47778,47779,47780,47781,47782,47783,47786,47789,47790,47791,47793,47795,47796,47797,47798,47799,47802,47804,47806,47807,47808,47809,47810,47811,47813,47814,47815,47817,47818,47819,47820,47821,47822,47823,47824,47825,47826,47827,47828,47829,47830,47831,47834,47835,47836,47837,47838,47839,47840,47841,47842,47843,47844,47845,47846,47847,47848,47849,47850,47851,47852,47853,47854,47855,47856,47857,47858,47859,47860,47861,47862,47863,47864,47865,47866,47867,47869,47870,47871,47873,47874,47875,47877,47878,47879,47880,47881,47882,47883,47884,47886,47888,47890,47891,47892,47893,47894,47895,47897,47898,47899,47901,47902,47903,47905,47906,47907,47908,47909,47910,47911,47912,47914,47916,47917,47918,47919,47920,47921,47922,47923,47927,47929,47930,47935,47936,47937,47938,47939,47942,47944,47946,47947,47948,47950,47953,47954,null,null,null,null,null,null,47955,47957,47958,47959,47961,47962,47963,47964,47965,47966,47967,47968,47970,47972,47973,47974,47975,47976,47977,47978,47979,47981,47982,47983,47984,47985,null,null,null,null,null,null,47986,47987,47988,47989,47990,47991,47992,47993,47994,47995,47996,47997,47998,47999,48000,48001,48002,48003,48004,48005,48006,48007,48009,48010,48011,48013,48014,48015,48017,48018,48019,48020,48021,48022,48023,48024,48025,48026,48027,48028,48029,48030,48031,48032,48033,48034,48035,48037,48038,48039,48041,48042,48043,48045,48046,48047,48048,48049,48050,48051,48053,48054,48056,48057,48058,48059,48060,48061,48062,48063,48065,48066,48067,48069,48070,48071,48073,48074,48075,48076,48077,48078,48079,48081,48082,48084,48085,48086,48087,48088,48089,48090,48091,48092,48093,48094,48095,48096,48097,48098,48099,48100,48101,48102,48103,48104,48105,48106,48107,48108,48109,48110,48111,48112,48113,48114,48115,48116,48117,48118,48119,48122,48123,48125,48126,48129,48131,48132,48133,48134,48135,48138,48142,48144,48146,48147,48153,48154,48160,48161,48162,48163,48166,48168,48170,48171,48172,48174,48175,48178,48179,48181,null,null,null,null,null,null,48182,48183,48185,48186,48187,48188,48189,48190,48191,48194,48198,48199,48200,48202,48203,48206,48207,48209,48210,48211,48212,48213,48214,48215,48216,48217,null,null,null,null,null,null,48218,48219,48220,48222,48223,48224,48225,48226,48227,48228,48229,48230,48231,48232,48233,48234,48235,48236,48237,48238,48239,48240,48241,48242,48243,48244,48245,48246,48247,48248,48249,48250,48251,48252,48253,48254,48255,48256,48257,48258,48259,48262,48263,48265,48266,48269,48271,48272,48273,48274,48275,48278,48280,48283,48284,48285,48286,48287,48290,48291,48293,48294,48297,48298,48299,48300,48301,48302,48303,48306,48310,48311,48312,48313,48314,48315,48318,48319,48321,48322,48323,48325,48326,48327,48328,48329,48330,48331,48332,48334,48338,48339,48340,48342,48343,48345,48346,48347,48349,48350,48351,48352,48353,48354,48355,48356,48357,48358,48359,48360,48361,48362,48363,48364,48365,48366,48367,48368,48369,48370,48371,48375,48377,48378,48379,48381,48382,48383,48384,48385,48386,48387,48390,48392,48394,48395,48396,48397,48398,48399,48401,48402,48403,48405,48406,48407,48408,48409,48410,48411,48412,48413,null,null,null,null,null,null,48414,48415,48416,48417,48418,48419,48421,48422,48423,48424,48425,48426,48427,48429,48430,48431,48432,48433,48434,48435,48436,48437,48438,48439,48440,48441,null,null,null,null,null,null,48442,48443,48444,48445,48446,48447,48449,48450,48451,48452,48453,48454,48455,48458,48459,48461,48462,48463,48465,48466,48467,48468,48469,48470,48471,48474,48475,48476,48477,48478,48479,48480,48481,48482,48483,48485,48486,48487,48489,48490,48491,48492,48493,48494,48495,48496,48497,48498,48499,48500,48501,48502,48503,48504,48505,48506,48507,48508,48509,48510,48511,48514,48515,48517,48518,48523,48524,48525,48526,48527,48530,48532,48534,48535,48536,48539,48541,48542,48543,48544,48545,48546,48547,48549,48550,48551,48552,48553,48554,48555,48556,48557,48558,48559,48561,48562,48563,48564,48565,48566,48567,48569,48570,48571,48572,48573,48574,48575,48576,48577,48578,48579,48580,48581,48582,48583,48584,48585,48586,48587,48588,48589,48590,48591,48592,48593,48594,48595,48598,48599,48601,48602,48603,48605,48606,48607,48608,48609,48610,48611,48612,48613,48614,48615,48616,48618,48619,48620,48621,48622,48623,48625,null,null,null,null,null,null,48626,48627,48629,48630,48631,48633,48634,48635,48636,48637,48638,48639,48641,48642,48644,48646,48647,48648,48649,48650,48651,48654,48655,48657,48658,48659,null,null,null,null,null,null,48661,48662,48663,48664,48665,48666,48667,48670,48672,48673,48674,48675,48676,48677,48678,48679,48680,48681,48682,48683,48684,48685,48686,48687,48688,48689,48690,48691,48692,48693,48694,48695,48696,48697,48698,48699,48700,48701,48702,48703,48704,48705,48706,48707,48710,48711,48713,48714,48715,48717,48719,48720,48721,48722,48723,48726,48728,48732,48733,48734,48735,48738,48739,48741,48742,48743,48745,48747,48748,48749,48750,48751,48754,48758,48759,48760,48761,48762,48766,48767,48769,48770,48771,48773,48774,48775,48776,48777,48778,48779,48782,48786,48787,48788,48789,48790,48791,48794,48795,48796,48797,48798,48799,48800,48801,48802,48803,48804,48805,48806,48807,48809,48810,48811,48812,48813,48814,48815,48816,48817,48818,48819,48820,48821,48822,48823,48824,48825,48826,48827,48828,48829,48830,48831,48832,48833,48834,48835,48836,48837,48838,48839,48840,48841,48842,48843,48844,48845,48846,48847,48850,48851,null,null,null,null,null,null,48853,48854,48857,48858,48859,48860,48861,48862,48863,48865,48866,48870,48871,48872,48873,48874,48875,48877,48878,48879,48880,48881,48882,48883,48884,48885,null,null,null,null,null,null,48886,48887,48888,48889,48890,48891,48892,48893,48894,48895,48896,48898,48899,48900,48901,48902,48903,48906,48907,48908,48909,48910,48911,48912,48913,48914,48915,48916,48917,48918,48919,48922,48926,48927,48928,48929,48930,48931,48932,48933,48934,48935,48936,48937,48938,48939,48940,48941,48942,48943,48944,48945,48946,48947,48948,48949,48950,48951,48952,48953,48954,48955,48956,48957,48958,48959,48962,48963,48965,48966,48967,48969,48970,48971,48972,48973,48974,48975,48978,48979,48980,48982,48983,48984,48985,48986,48987,48988,48989,48990,48991,48992,48993,48994,48995,48996,48997,48998,48999,49000,49001,49002,49003,49004,49005,49006,49007,49008,49009,49010,49011,49012,49013,49014,49015,49016,49017,49018,49019,49020,49021,49022,49023,49024,49025,49026,49027,49028,49029,49030,49031,49032,49033,49034,49035,49036,49037,49038,49039,49040,49041,49042,49043,49045,49046,49047,49048,49049,49050,49051,49052,49053,null,null,null,null,null,null,49054,49055,49056,49057,49058,49059,49060,49061,49062,49063,49064,49065,49066,49067,49068,49069,49070,49071,49073,49074,49075,49076,49077,49078,49079,49080,null,null,null,null,null,null,49081,49082,49083,49084,49085,49086,49087,49088,49089,49090,49091,49092,49094,49095,49096,49097,49098,49099,49102,49103,49105,49106,49107,49109,49110,49111,49112,49113,49114,49115,49117,49118,49120,49122,49123,49124,49125,49126,49127,49128,49129,49130,49131,49132,49133,49134,49135,49136,49137,49138,49139,49140,49141,49142,49143,49144,49145,49146,49147,49148,49149,49150,49151,49152,49153,49154,49155,49156,49157,49158,49159,49160,49161,49162,49163,49164,49165,49166,49167,49168,49169,49170,49171,49172,49173,49174,49175,49176,49177,49178,49179,49180,49181,49182,49183,49184,49185,49186,49187,49188,49189,49190,49191,49192,49193,49194,49195,49196,49197,49198,49199,49200,49201,49202,49203,49204,49205,49206,49207,49208,49209,49210,49211,49213,49214,49215,49216,49217,49218,49219,49220,49221,49222,49223,49224,49225,49226,49227,49228,49229,49230,49231,49232,49234,49235,49236,49237,49238,49239,49241,49242,49243,null,null,null,null,null,null,49245,49246,49247,49249,49250,49251,49252,49253,49254,49255,49258,49259,49260,49261,49262,49263,49264,49265,49266,49267,49268,49269,49270,49271,49272,49273,null,null,null,null,null,null,49274,49275,49276,49277,49278,49279,49280,49281,49282,49283,49284,49285,49286,49287,49288,49289,49290,49291,49292,49293,49294,49295,49298,49299,49301,49302,49303,49305,49306,49307,49308,49309,49310,49311,49314,49316,49318,49319,49320,49321,49322,49323,49326,49329,49330,49335,49336,49337,49338,49339,49342,49346,49347,49348,49350,49351,49354,49355,49357,49358,49359,49361,49362,49363,49364,49365,49366,49367,49370,49374,49375,49376,49377,49378,49379,49382,49383,49385,49386,49387,49389,49390,49391,49392,49393,49394,49395,49398,49400,49402,49403,49404,49405,49406,49407,49409,49410,49411,49413,49414,49415,49417,49418,49419,49420,49421,49422,49423,49425,49426,49427,49428,49430,49431,49432,49433,49434,49435,49441,49442,49445,49448,49449,49450,49451,49454,49458,49459,49460,49461,49463,49466,49467,49469,49470,49471,49473,49474,49475,49476,49477,49478,49479,49482,49486,49487,49488,49489,49490,49491,49494,49495,null,null,null,null,null,null,49497,49498,49499,49501,49502,49503,49504,49505,49506,49507,49510,49514,49515,49516,49517,49518,49519,49521,49522,49523,49525,49526,49527,49529,49530,49531,null,null,null,null,null,null,49532,49533,49534,49535,49536,49537,49538,49539,49540,49542,49543,49544,49545,49546,49547,49551,49553,49554,49555,49557,49559,49560,49561,49562,49563,49566,49568,49570,49571,49572,49574,49575,49578,49579,49581,49582,49583,49585,49586,49587,49588,49589,49590,49591,49592,49593,49594,49595,49596,49598,49599,49600,49601,49602,49603,49605,49606,49607,49609,49610,49611,49613,49614,49615,49616,49617,49618,49619,49621,49622,49625,49626,49627,49628,49629,49630,49631,49633,49634,49635,49637,49638,49639,49641,49642,49643,49644,49645,49646,49647,49650,49652,49653,49654,49655,49656,49657,49658,49659,49662,49663,49665,49666,49667,49669,49670,49671,49672,49673,49674,49675,49678,49680,49682,49683,49684,49685,49686,49687,49690,49691,49693,49694,49697,49698,49699,49700,49701,49702,49703,49706,49708,49710,49712,49715,49717,49718,49719,49720,49721,49722,49723,49724,49725,49726,49727,49728,49729,49730,49731,49732,49733,null,null,null,null,null,null,49734,49735,49737,49738,49739,49740,49741,49742,49743,49746,49747,49749,49750,49751,49753,49754,49755,49756,49757,49758,49759,49761,49762,49763,49764,49766,null,null,null,null,null,null,49767,49768,49769,49770,49771,49774,49775,49777,49778,49779,49781,49782,49783,49784,49785,49786,49787,49790,49792,49794,49795,49796,49797,49798,49799,49802,49803,49804,49805,49806,49807,49809,49810,49811,49812,49813,49814,49815,49817,49818,49820,49822,49823,49824,49825,49826,49827,49830,49831,49833,49834,49835,49838,49839,49840,49841,49842,49843,49846,49848,49850,49851,49852,49853,49854,49855,49856,49857,49858,49859,49860,49861,49862,49863,49864,49865,49866,49867,49868,49869,49870,49871,49872,49873,49874,49875,49876,49877,49878,49879,49880,49881,49882,49883,49886,49887,49889,49890,49893,49894,49895,49896,49897,49898,49902,49904,49906,49907,49908,49909,49911,49914,49917,49918,49919,49921,49922,49923,49924,49925,49926,49927,49930,49931,49934,49935,49936,49937,49938,49942,49943,49945,49946,49947,49949,49950,49951,49952,49953,49954,49955,49958,49959,49962,49963,49964,49965,49966,49967,49968,49969,49970,null,null,null,null,null,null,49971,49972,49973,49974,49975,49976,49977,49978,49979,49980,49981,49982,49983,49984,49985,49986,49987,49988,49990,49991,49992,49993,49994,49995,49996,49997,null,null,null,null,null,null,49998,49999,50000,50001,50002,50003,50004,50005,50006,50007,50008,50009,50010,50011,50012,50013,50014,50015,50016,50017,50018,50019,50020,50021,50022,50023,50026,50027,50029,50030,50031,50033,50035,50036,50037,50038,50039,50042,50043,50046,50047,50048,50049,50050,50051,50053,50054,50055,50057,50058,50059,50061,50062,50063,50064,50065,50066,50067,50068,50069,50070,50071,50072,50073,50074,50075,50076,50077,50078,50079,50080,50081,50082,50083,50084,50085,50086,50087,50088,50089,50090,50091,50092,50093,50094,50095,50096,50097,50098,50099,50100,50101,50102,50103,50104,50105,50106,50107,50108,50109,50110,50111,50113,50114,50115,50116,50117,50118,50119,50120,50121,50122,50123,50124,50125,50126,50127,50128,50129,50130,50131,50132,50133,50134,50135,50138,50139,50141,50142,50145,50147,50148,50149,50150,50151,50154,50155,50156,50158,50159,50160,50161,50162,50163,50166,50167,50169,50170,50171,50172,50173,50174,null,null,null,null,null,null,50175,50176,50177,50178,50179,50180,50181,50182,50183,50185,50186,50187,50188,50189,50190,50191,50193,50194,50195,50196,50197,50198,50199,50200,50201,50202,null,null,null,null,null,null,50203,50204,50205,50206,50207,50208,50209,50210,50211,50213,50214,50215,50216,50217,50218,50219,50221,50222,50223,50225,50226,50227,50229,50230,50231,50232,50233,50234,50235,50238,50239,50240,50241,50242,50243,50244,50245,50246,50247,50249,50250,50251,50252,50253,50254,50255,50256,50257,50258,50259,50260,50261,50262,50263,50264,50265,50266,50267,50268,50269,50270,50271,50272,50273,50274,50275,50278,50279,50281,50282,50283,50285,50286,50287,50288,50289,50290,50291,50294,50295,50296,50298,50299,50300,50301,50302,50303,50305,50306,50307,50308,50309,50310,50311,50312,50313,50314,50315,50316,50317,50318,50319,50320,50321,50322,50323,50325,50326,50327,50328,50329,50330,50331,50333,50334,50335,50336,50337,50338,50339,50340,50341,50342,50343,50344,50345,50346,50347,50348,50349,50350,50351,50352,50353,50354,50355,50356,50357,50358,50359,50361,50362,50363,50365,50366,50367,50368,50369,50370,50371,50372,50373,null,null,null,null,null,null,50374,50375,50376,50377,50378,50379,50380,50381,50382,50383,50384,50385,50386,50387,50388,50389,50390,50391,50392,50393,50394,50395,50396,50397,50398,50399,null,null,null,null,null,null,50400,50401,50402,50403,50404,50405,50406,50407,50408,50410,50411,50412,50413,50414,50415,50418,50419,50421,50422,50423,50425,50427,50428,50429,50430,50434,50435,50436,50437,50438,50439,50440,50441,50442,50443,50445,50446,50447,50449,50450,50451,50453,50454,50455,50456,50457,50458,50459,50461,50462,50463,50464,50465,50466,50467,50468,50469,50470,50471,50474,50475,50477,50478,50479,50481,50482,50483,50484,50485,50486,50487,50490,50492,50494,50495,50496,50497,50498,50499,50502,50503,50507,50511,50512,50513,50514,50518,50522,50523,50524,50527,50530,50531,50533,50534,50535,50537,50538,50539,50540,50541,50542,50543,50546,50550,50551,50552,50553,50554,50555,50558,50559,50561,50562,50563,50565,50566,50568,50569,50570,50571,50574,50576,50578,50579,50580,50582,50585,50586,50587,50589,50590,50591,50593,50594,50595,50596,50597,50598,50599,50600,50602,50603,50604,50605,50606,50607,50608,50609,50610,50611,50614,null,null,null,null,null,null,50615,50618,50623,50624,50625,50626,50627,50635,50637,50639,50642,50643,50645,50646,50647,50649,50650,50651,50652,50653,50654,50655,50658,50660,50662,50663,null,null,null,null,null,null,50664,50665,50666,50667,50671,50673,50674,50675,50677,50680,50681,50682,50683,50690,50691,50692,50697,50698,50699,50701,50702,50703,50705,50706,50707,50708,50709,50710,50711,50714,50717,50718,50719,50720,50721,50722,50723,50726,50727,50729,50730,50731,50735,50737,50738,50742,50744,50746,50748,50749,50750,50751,50754,50755,50757,50758,50759,50761,50762,50763,50764,50765,50766,50767,50770,50774,50775,50776,50777,50778,50779,50782,50783,50785,50786,50787,50788,50789,50790,50791,50792,50793,50794,50795,50797,50798,50800,50802,50803,50804,50805,50806,50807,50810,50811,50813,50814,50815,50817,50818,50819,50820,50821,50822,50823,50826,50828,50830,50831,50832,50833,50834,50835,50838,50839,50841,50842,50843,50845,50846,50847,50848,50849,50850,50851,50854,50856,50858,50859,50860,50861,50862,50863,50866,50867,50869,50870,50871,50875,50876,50877,50878,50879,50882,50884,50886,50887,50888,50889,50890,50891,50894,null,null,null,null,null,null,50895,50897,50898,50899,50901,50902,50903,50904,50905,50906,50907,50910,50911,50914,50915,50916,50917,50918,50919,50922,50923,50925,50926,50927,50929,50930,null,null,null,null,null,null,50931,50932,50933,50934,50935,50938,50939,50940,50942,50943,50944,50945,50946,50947,50950,50951,50953,50954,50955,50957,50958,50959,50960,50961,50962,50963,50966,50968,50970,50971,50972,50973,50974,50975,50978,50979,50981,50982,50983,50985,50986,50987,50988,50989,50990,50991,50994,50996,50998,51000,51001,51002,51003,51006,51007,51009,51010,51011,51013,51014,51015,51016,51017,51019,51022,51024,51033,51034,51035,51037,51038,51039,51041,51042,51043,51044,51045,51046,51047,51049,51050,51052,51053,51054,51055,51056,51057,51058,51059,51062,51063,51065,51066,51067,51071,51072,51073,51074,51078,51083,51084,51085,51087,51090,51091,51093,51097,51099,51100,51101,51102,51103,51106,51111,51112,51113,51114,51115,51118,51119,51121,51122,51123,51125,51126,51127,51128,51129,51130,51131,51134,51138,51139,51140,51141,51142,51143,51146,51147,51149,51151,51153,51154,51155,51156,51157,51158,51159,51161,51162,51163,51164,null,null,null,null,null,null,51166,51167,51168,51169,51170,51171,51173,51174,51175,51177,51178,51179,51181,51182,51183,51184,51185,51186,51187,51188,51189,51190,51191,51192,51193,51194,null,null,null,null,null,null,51195,51196,51197,51198,51199,51202,51203,51205,51206,51207,51209,51211,51212,51213,51214,51215,51218,51220,51223,51224,51225,51226,51227,51230,51231,51233,51234,51235,51237,51238,51239,51240,51241,51242,51243,51246,51248,51250,51251,51252,51253,51254,51255,51257,51258,51259,51261,51262,51263,51265,51266,51267,51268,51269,51270,51271,51274,51275,51278,51279,51280,51281,51282,51283,51285,51286,51287,51288,51289,51290,51291,51292,51293,51294,51295,51296,51297,51298,51299,51300,51301,51302,51303,51304,51305,51306,51307,51308,51309,51310,51311,51314,51315,51317,51318,51319,51321,51323,51324,51325,51326,51327,51330,51332,51336,51337,51338,51342,51343,51344,51345,51346,51347,51349,51350,51351,51352,51353,51354,51355,51356,51358,51360,51362,51363,51364,51365,51366,51367,51369,51370,51371,51372,51373,51374,51375,51376,51377,51378,51379,51380,51381,51382,51383,51384,51385,51386,51387,51390,51391,51392,51393,null,null,null,null,null,null,51394,51395,51397,51398,51399,51401,51402,51403,51405,51406,51407,51408,51409,51410,51411,51414,51416,51418,51419,51420,51421,51422,51423,51426,51427,51429,null,null,null,null,null,null,51430,51431,51432,51433,51434,51435,51436,51437,51438,51439,51440,51441,51442,51443,51444,51446,51447,51448,51449,51450,51451,51454,51455,51457,51458,51459,51463,51464,51465,51466,51467,51470,12288,12289,12290,183,8229,8230,168,12291,173,8213,8741,65340,8764,8216,8217,8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,12304,12305,177,215,247,8800,8804,8805,8734,8756,176,8242,8243,8451,8491,65504,65505,65509,9794,9792,8736,8869,8978,8706,8711,8801,8786,167,8251,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660,8594,8592,8593,8595,8596,12307,8810,8811,8730,8765,8733,8757,8747,8748,8712,8715,8838,8839,8834,8835,8746,8745,8743,8744,65506,51472,51474,51475,51476,51477,51478,51479,51481,51482,51483,51484,51485,51486,51487,51488,51489,51490,51491,51492,51493,51494,51495,51496,51497,51498,51499,null,null,null,null,null,null,51501,51502,51503,51504,51505,51506,51507,51509,51510,51511,51512,51513,51514,51515,51516,51517,51518,51519,51520,51521,51522,51523,51524,51525,51526,51527,null,null,null,null,null,null,51528,51529,51530,51531,51532,51533,51534,51535,51538,51539,51541,51542,51543,51545,51546,51547,51548,51549,51550,51551,51554,51556,51557,51558,51559,51560,51561,51562,51563,51565,51566,51567,8658,8660,8704,8707,180,65374,711,728,733,730,729,184,731,161,191,720,8750,8721,8719,164,8457,8240,9665,9664,9655,9654,9828,9824,9825,9829,9831,9827,8857,9672,9635,9680,9681,9618,9636,9637,9640,9639,9638,9641,9832,9743,9742,9756,9758,182,8224,8225,8597,8599,8601,8598,8600,9837,9833,9834,9836,12927,12828,8470,13255,8482,13250,13272,8481,8364,174,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,51569,51570,51571,51573,51574,51575,51576,51577,51578,51579,51581,51582,51583,51584,51585,51586,51587,51588,51589,51590,51591,51594,51595,51597,51598,51599,null,null,null,null,null,null,51601,51602,51603,51604,51605,51606,51607,51610,51612,51614,51615,51616,51617,51618,51619,51620,51621,51622,51623,51624,51625,51626,51627,51628,51629,51630,null,null,null,null,null,null,51631,51632,51633,51634,51635,51636,51637,51638,51639,51640,51641,51642,51643,51644,51645,51646,51647,51650,51651,51653,51654,51657,51659,51660,51661,51662,51663,51666,51668,51671,51672,51675,65281,65282,65283,65284,65285,65286,65287,65288,65289,65290,65291,65292,65293,65294,65295,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,65306,65307,65308,65309,65310,65311,65312,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65339,65510,65341,65342,65343,65344,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,65371,65372,65373,65507,51678,51679,51681,51683,51685,51686,51688,51689,51690,51691,51694,51698,51699,51700,51701,51702,51703,51706,51707,51709,51710,51711,51713,51714,51715,51716,null,null,null,null,null,null,51717,51718,51719,51722,51726,51727,51728,51729,51730,51731,51733,51734,51735,51737,51738,51739,51740,51741,51742,51743,51744,51745,51746,51747,51748,51749,null,null,null,null,null,null,51750,51751,51752,51754,51755,51756,51757,51758,51759,51760,51761,51762,51763,51764,51765,51766,51767,51768,51769,51770,51771,51772,51773,51774,51775,51776,51777,51778,51779,51780,51781,51782,12593,12594,12595,12596,12597,12598,12599,12600,12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616,12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,12647,12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663,12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679,12680,12681,12682,12683,12684,12685,12686,51783,51784,51785,51786,51787,51790,51791,51793,51794,51795,51797,51798,51799,51800,51801,51802,51803,51806,51810,51811,51812,51813,51814,51815,51817,51818,null,null,null,null,null,null,51819,51820,51821,51822,51823,51824,51825,51826,51827,51828,51829,51830,51831,51832,51833,51834,51835,51836,51838,51839,51840,51841,51842,51843,51845,51846,null,null,null,null,null,null,51847,51848,51849,51850,51851,51852,51853,51854,51855,51856,51857,51858,51859,51860,51861,51862,51863,51865,51866,51867,51868,51869,51870,51871,51872,51873,51874,51875,51876,51877,51878,51879,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,null,null,null,null,null,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,null,null,null,null,null,null,null,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,null,null,null,null,null,null,null,null,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,null,null,null,null,null,null,51880,51881,51882,51883,51884,51885,51886,51887,51888,51889,51890,51891,51892,51893,51894,51895,51896,51897,51898,51899,51902,51903,51905,51906,51907,51909,null,null,null,null,null,null,51910,51911,51912,51913,51914,51915,51918,51920,51922,51924,51925,51926,51927,51930,51931,51932,51933,51934,51935,51937,51938,51939,51940,51941,51942,51943,null,null,null,null,null,null,51944,51945,51946,51947,51949,51950,51951,51952,51953,51954,51955,51957,51958,51959,51960,51961,51962,51963,51964,51965,51966,51967,51968,51969,51970,51971,51972,51973,51974,51975,51977,51978,9472,9474,9484,9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487,9491,9499,9495,9507,9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520,9509,9528,9538,9490,9489,9498,9497,9494,9493,9486,9485,9502,9503,9505,9506,9510,9511,9513,9514,9517,9518,9521,9522,9525,9526,9529,9530,9533,9534,9536,9537,9539,9540,9541,9542,9543,9544,9545,9546,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,51979,51980,51981,51982,51983,51985,51986,51987,51989,51990,51991,51993,51994,51995,51996,51997,51998,51999,52002,52003,52004,52005,52006,52007,52008,52009,null,null,null,null,null,null,52010,52011,52012,52013,52014,52015,52016,52017,52018,52019,52020,52021,52022,52023,52024,52025,52026,52027,52028,52029,52030,52031,52032,52034,52035,52036,null,null,null,null,null,null,52037,52038,52039,52042,52043,52045,52046,52047,52049,52050,52051,52052,52053,52054,52055,52058,52059,52060,52062,52063,52064,52065,52066,52067,52069,52070,52071,52072,52073,52074,52075,52076,13205,13206,13207,8467,13208,13252,13219,13220,13221,13222,13209,13210,13211,13212,13213,13214,13215,13216,13217,13218,13258,13197,13198,13199,13263,13192,13193,13256,13223,13224,13232,13233,13234,13235,13236,13237,13238,13239,13240,13241,13184,13185,13186,13187,13188,13242,13243,13244,13245,13246,13247,13200,13201,13202,13203,13204,8486,13248,13249,13194,13195,13196,13270,13253,13229,13230,13231,13275,13225,13226,13227,13228,13277,13264,13267,13251,13257,13276,13254,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52077,52078,52079,52080,52081,52082,52083,52084,52085,52086,52087,52090,52091,52092,52093,52094,52095,52096,52097,52098,52099,52100,52101,52102,52103,52104,null,null,null,null,null,null,52105,52106,52107,52108,52109,52110,52111,52112,52113,52114,52115,52116,52117,52118,52119,52120,52121,52122,52123,52125,52126,52127,52128,52129,52130,52131,null,null,null,null,null,null,52132,52133,52134,52135,52136,52137,52138,52139,52140,52141,52142,52143,52144,52145,52146,52147,52148,52149,52150,52151,52153,52154,52155,52156,52157,52158,52159,52160,52161,52162,52163,52164,198,208,170,294,null,306,null,319,321,216,338,186,222,358,330,null,12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911,12912,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,9424,9425,9426,9427,9428,9429,9430,9431,9432,9433,9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446,9447,9448,9449,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,189,8531,8532,188,190,8539,8540,8541,8542,52165,52166,52167,52168,52169,52170,52171,52172,52173,52174,52175,52176,52177,52178,52179,52181,52182,52183,52184,52185,52186,52187,52188,52189,52190,52191,null,null,null,null,null,null,52192,52193,52194,52195,52197,52198,52200,52202,52203,52204,52205,52206,52207,52208,52209,52210,52211,52212,52213,52214,52215,52216,52217,52218,52219,52220,null,null,null,null,null,null,52221,52222,52223,52224,52225,52226,52227,52228,52229,52230,52231,52232,52233,52234,52235,52238,52239,52241,52242,52243,52245,52246,52247,52248,52249,52250,52251,52254,52255,52256,52259,52260,230,273,240,295,305,307,312,320,322,248,339,223,254,359,331,329,12800,12801,12802,12803,12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819,12820,12821,12822,12823,12824,12825,12826,12827,9372,9373,9374,9375,9376,9377,9378,9379,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,185,178,179,8308,8319,8321,8322,8323,8324,52261,52262,52266,52267,52269,52271,52273,52274,52275,52276,52277,52278,52279,52282,52287,52288,52289,52290,52291,52294,52295,52297,52298,52299,52301,52302,null,null,null,null,null,null,52303,52304,52305,52306,52307,52310,52314,52315,52316,52317,52318,52319,52321,52322,52323,52325,52327,52329,52330,52331,52332,52333,52334,52335,52337,52338,null,null,null,null,null,null,52339,52340,52342,52343,52344,52345,52346,52347,52348,52349,52350,52351,52352,52353,52354,52355,52356,52357,52358,52359,52360,52361,52362,52363,52364,52365,52366,52367,52368,52369,52370,52371,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,null,null,null,null,null,null,null,null,null,null,null,52372,52373,52374,52375,52378,52379,52381,52382,52383,52385,52386,52387,52388,52389,52390,52391,52394,52398,52399,52400,52401,52402,52403,52406,52407,52409,null,null,null,null,null,null,52410,52411,52413,52414,52415,52416,52417,52418,52419,52422,52424,52426,52427,52428,52429,52430,52431,52433,52434,52435,52437,52438,52439,52440,52441,52442,null,null,null,null,null,null,52443,52444,52445,52446,52447,52448,52449,52450,52451,52453,52454,52455,52456,52457,52458,52459,52461,52462,52463,52465,52466,52467,52468,52469,52470,52471,52472,52473,52474,52475,52476,52477,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,null,null,null,null,null,null,null,null,52478,52479,52480,52482,52483,52484,52485,52486,52487,52490,52491,52493,52494,52495,52497,52498,52499,52500,52501,52502,52503,52506,52508,52510,52511,52512,null,null,null,null,null,null,52513,52514,52515,52517,52518,52519,52521,52522,52523,52525,52526,52527,52528,52529,52530,52531,52532,52533,52534,52535,52536,52538,52539,52540,52541,52542,null,null,null,null,null,null,52543,52544,52545,52546,52547,52548,52549,52550,52551,52552,52553,52554,52555,52556,52557,52558,52559,52560,52561,52562,52563,52564,52565,52566,52567,52568,52569,52570,52571,52573,52574,52575,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,null,null,null,null,null,null,null,null,null,null,null,null,null,52577,52578,52579,52581,52582,52583,52584,52585,52586,52587,52590,52592,52594,52595,52596,52597,52598,52599,52601,52602,52603,52604,52605,52606,52607,52608,null,null,null,null,null,null,52609,52610,52611,52612,52613,52614,52615,52617,52618,52619,52620,52621,52622,52623,52624,52625,52626,52627,52630,52631,52633,52634,52635,52637,52638,52639,null,null,null,null,null,null,52640,52641,52642,52643,52646,52648,52650,52651,52652,52653,52654,52655,52657,52658,52659,52660,52661,52662,52663,52664,52665,52666,52667,52668,52669,52670,52671,52672,52673,52674,52675,52677,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52678,52679,52680,52681,52682,52683,52685,52686,52687,52689,52690,52691,52692,52693,52694,52695,52696,52697,52698,52699,52700,52701,52702,52703,52704,52705,null,null,null,null,null,null,52706,52707,52708,52709,52710,52711,52713,52714,52715,52717,52718,52719,52721,52722,52723,52724,52725,52726,52727,52730,52732,52734,52735,52736,52737,52738,null,null,null,null,null,null,52739,52741,52742,52743,52745,52746,52747,52749,52750,52751,52752,52753,52754,52755,52757,52758,52759,52760,52762,52763,52764,52765,52766,52767,52770,52771,52773,52774,52775,52777,52778,52779,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52780,52781,52782,52783,52786,52788,52790,52791,52792,52793,52794,52795,52796,52797,52798,52799,52800,52801,52802,52803,52804,52805,52806,52807,52808,52809,null,null,null,null,null,null,52810,52811,52812,52813,52814,52815,52816,52817,52818,52819,52820,52821,52822,52823,52826,52827,52829,52830,52834,52835,52836,52837,52838,52839,52842,52844,null,null,null,null,null,null,52846,52847,52848,52849,52850,52851,52854,52855,52857,52858,52859,52861,52862,52863,52864,52865,52866,52867,52870,52872,52874,52875,52876,52877,52878,52879,52882,52883,52885,52886,52887,52889,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,52890,52891,52892,52893,52894,52895,52898,52902,52903,52904,52905,52906,52907,52910,52911,52912,52913,52914,52915,52916,52917,52918,52919,52920,52921,52922,null,null,null,null,null,null,52923,52924,52925,52926,52927,52928,52930,52931,52932,52933,52934,52935,52936,52937,52938,52939,52940,52941,52942,52943,52944,52945,52946,52947,52948,52949,null,null,null,null,null,null,52950,52951,52952,52953,52954,52955,52956,52957,52958,52959,52960,52961,52962,52963,52966,52967,52969,52970,52973,52974,52975,52976,52977,52978,52979,52982,52986,52987,52988,52989,52990,52991,44032,44033,44036,44039,44040,44041,44042,44048,44049,44050,44051,44052,44053,44054,44055,44057,44058,44059,44060,44061,44064,44068,44076,44077,44079,44080,44081,44088,44089,44092,44096,44107,44109,44116,44120,44124,44144,44145,44148,44151,44152,44154,44160,44161,44163,44164,44165,44166,44169,44170,44171,44172,44176,44180,44188,44189,44191,44192,44193,44200,44201,44202,44204,44207,44208,44216,44217,44219,44220,44221,44225,44228,44232,44236,44245,44247,44256,44257,44260,44263,44264,44266,44268,44271,44272,44273,44275,44277,44278,44284,44285,44288,44292,44294,52994,52995,52997,52998,52999,53001,53002,53003,53004,53005,53006,53007,53010,53012,53014,53015,53016,53017,53018,53019,53021,53022,53023,53025,53026,53027,null,null,null,null,null,null,53029,53030,53031,53032,53033,53034,53035,53038,53042,53043,53044,53045,53046,53047,53049,53050,53051,53052,53053,53054,53055,53056,53057,53058,53059,53060,null,null,null,null,null,null,53061,53062,53063,53064,53065,53066,53067,53068,53069,53070,53071,53072,53073,53074,53075,53078,53079,53081,53082,53083,53085,53086,53087,53088,53089,53090,53091,53094,53096,53098,53099,53100,44300,44301,44303,44305,44312,44316,44320,44329,44332,44333,44340,44341,44344,44348,44356,44357,44359,44361,44368,44372,44376,44385,44387,44396,44397,44400,44403,44404,44405,44406,44411,44412,44413,44415,44417,44418,44424,44425,44428,44432,44444,44445,44452,44471,44480,44481,44484,44488,44496,44497,44499,44508,44512,44516,44536,44537,44540,44543,44544,44545,44552,44553,44555,44557,44564,44592,44593,44596,44599,44600,44602,44608,44609,44611,44613,44614,44618,44620,44621,44622,44624,44628,44630,44636,44637,44639,44640,44641,44645,44648,44649,44652,44656,44664,53101,53102,53103,53106,53107,53109,53110,53111,53113,53114,53115,53116,53117,53118,53119,53121,53122,53123,53124,53126,53127,53128,53129,53130,53131,53133,null,null,null,null,null,null,53134,53135,53136,53137,53138,53139,53140,53141,53142,53143,53144,53145,53146,53147,53148,53149,53150,53151,53152,53154,53155,53156,53157,53158,53159,53161,null,null,null,null,null,null,53162,53163,53164,53165,53166,53167,53169,53170,53171,53172,53173,53174,53175,53176,53177,53178,53179,53180,53181,53182,53183,53184,53185,53186,53187,53189,53190,53191,53192,53193,53194,53195,44665,44667,44668,44669,44676,44677,44684,44732,44733,44734,44736,44740,44748,44749,44751,44752,44753,44760,44761,44764,44776,44779,44781,44788,44792,44796,44807,44808,44813,44816,44844,44845,44848,44850,44852,44860,44861,44863,44865,44866,44867,44872,44873,44880,44892,44893,44900,44901,44921,44928,44932,44936,44944,44945,44949,44956,44984,44985,44988,44992,44999,45000,45001,45003,45005,45006,45012,45020,45032,45033,45040,45041,45044,45048,45056,45057,45060,45068,45072,45076,45084,45085,45096,45124,45125,45128,45130,45132,45134,45139,45140,45141,45143,45145,53196,53197,53198,53199,53200,53201,53202,53203,53204,53205,53206,53207,53208,53209,53210,53211,53212,53213,53214,53215,53218,53219,53221,53222,53223,53225,null,null,null,null,null,null,53226,53227,53228,53229,53230,53231,53234,53236,53238,53239,53240,53241,53242,53243,53245,53246,53247,53249,53250,53251,53253,53254,53255,53256,53257,53258,null,null,null,null,null,null,53259,53260,53261,53262,53263,53264,53266,53267,53268,53269,53270,53271,53273,53274,53275,53276,53277,53278,53279,53280,53281,53282,53283,53284,53285,53286,53287,53288,53289,53290,53291,53292,45149,45180,45181,45184,45188,45196,45197,45199,45201,45208,45209,45210,45212,45215,45216,45217,45218,45224,45225,45227,45228,45229,45230,45231,45233,45235,45236,45237,45240,45244,45252,45253,45255,45256,45257,45264,45265,45268,45272,45280,45285,45320,45321,45323,45324,45328,45330,45331,45336,45337,45339,45340,45341,45347,45348,45349,45352,45356,45364,45365,45367,45368,45369,45376,45377,45380,45384,45392,45393,45396,45397,45400,45404,45408,45432,45433,45436,45440,45442,45448,45449,45451,45453,45458,45459,45460,45464,45468,45480,45516,45520,45524,45532,45533,53294,53295,53296,53297,53298,53299,53302,53303,53305,53306,53307,53309,53310,53311,53312,53313,53314,53315,53318,53320,53322,53323,53324,53325,53326,53327,null,null,null,null,null,null,53329,53330,53331,53333,53334,53335,53337,53338,53339,53340,53341,53342,53343,53345,53346,53347,53348,53349,53350,53351,53352,53353,53354,53355,53358,53359,null,null,null,null,null,null,53361,53362,53363,53365,53366,53367,53368,53369,53370,53371,53374,53375,53376,53378,53379,53380,53381,53382,53383,53384,53385,53386,53387,53388,53389,53390,53391,53392,53393,53394,53395,53396,45535,45544,45545,45548,45552,45561,45563,45565,45572,45573,45576,45579,45580,45588,45589,45591,45593,45600,45620,45628,45656,45660,45664,45672,45673,45684,45685,45692,45700,45701,45705,45712,45713,45716,45720,45721,45722,45728,45729,45731,45733,45734,45738,45740,45744,45748,45768,45769,45772,45776,45778,45784,45785,45787,45789,45794,45796,45797,45798,45800,45803,45804,45805,45806,45807,45811,45812,45813,45815,45816,45817,45818,45819,45823,45824,45825,45828,45832,45840,45841,45843,45844,45845,45852,45908,45909,45910,45912,45915,45916,45918,45919,45924,45925,53397,53398,53399,53400,53401,53402,53403,53404,53405,53406,53407,53408,53409,53410,53411,53414,53415,53417,53418,53419,53421,53422,53423,53424,53425,53426,null,null,null,null,null,null,53427,53430,53432,53434,53435,53436,53437,53438,53439,53442,53443,53445,53446,53447,53450,53451,53452,53453,53454,53455,53458,53462,53463,53464,53465,53466,null,null,null,null,null,null,53467,53470,53471,53473,53474,53475,53477,53478,53479,53480,53481,53482,53483,53486,53490,53491,53492,53493,53494,53495,53497,53498,53499,53500,53501,53502,53503,53504,53505,53506,53507,53508,45927,45929,45931,45934,45936,45937,45940,45944,45952,45953,45955,45956,45957,45964,45968,45972,45984,45985,45992,45996,46020,46021,46024,46027,46028,46030,46032,46036,46037,46039,46041,46043,46045,46048,46052,46056,46076,46096,46104,46108,46112,46120,46121,46123,46132,46160,46161,46164,46168,46176,46177,46179,46181,46188,46208,46216,46237,46244,46248,46252,46261,46263,46265,46272,46276,46280,46288,46293,46300,46301,46304,46307,46308,46310,46316,46317,46319,46321,46328,46356,46357,46360,46363,46364,46372,46373,46375,46376,46377,46378,46384,46385,46388,46392,53509,53510,53511,53512,53513,53514,53515,53516,53518,53519,53520,53521,53522,53523,53524,53525,53526,53527,53528,53529,53530,53531,53532,53533,53534,53535,null,null,null,null,null,null,53536,53537,53538,53539,53540,53541,53542,53543,53544,53545,53546,53547,53548,53549,53550,53551,53554,53555,53557,53558,53559,53561,53563,53564,53565,53566,null,null,null,null,null,null,53567,53570,53574,53575,53576,53577,53578,53579,53582,53583,53585,53586,53587,53589,53590,53591,53592,53593,53594,53595,53598,53600,53602,53603,53604,53605,53606,53607,53609,53610,53611,53613,46400,46401,46403,46404,46405,46411,46412,46413,46416,46420,46428,46429,46431,46432,46433,46496,46497,46500,46504,46506,46507,46512,46513,46515,46516,46517,46523,46524,46525,46528,46532,46540,46541,46543,46544,46545,46552,46572,46608,46609,46612,46616,46629,46636,46644,46664,46692,46696,46748,46749,46752,46756,46763,46764,46769,46804,46832,46836,46840,46848,46849,46853,46888,46889,46892,46895,46896,46904,46905,46907,46916,46920,46924,46932,46933,46944,46948,46952,46960,46961,46963,46965,46972,46973,46976,46980,46988,46989,46991,46992,46993,46994,46998,46999,53614,53615,53616,53617,53618,53619,53620,53621,53622,53623,53624,53625,53626,53627,53629,53630,53631,53632,53633,53634,53635,53637,53638,53639,53641,53642,null,null,null,null,null,null,53643,53644,53645,53646,53647,53648,53649,53650,53651,53652,53653,53654,53655,53656,53657,53658,53659,53660,53661,53662,53663,53666,53667,53669,53670,53671,null,null,null,null,null,null,53673,53674,53675,53676,53677,53678,53679,53682,53684,53686,53687,53688,53689,53691,53693,53694,53695,53697,53698,53699,53700,53701,53702,53703,53704,53705,53706,53707,53708,53709,53710,53711,47000,47001,47004,47008,47016,47017,47019,47020,47021,47028,47029,47032,47047,47049,47084,47085,47088,47092,47100,47101,47103,47104,47105,47111,47112,47113,47116,47120,47128,47129,47131,47133,47140,47141,47144,47148,47156,47157,47159,47160,47161,47168,47172,47185,47187,47196,47197,47200,47204,47212,47213,47215,47217,47224,47228,47245,47272,47280,47284,47288,47296,47297,47299,47301,47308,47312,47316,47325,47327,47329,47336,47337,47340,47344,47352,47353,47355,47357,47364,47384,47392,47420,47421,47424,47428,47436,47439,47441,47448,47449,47452,47456,47464,47465,53712,53713,53714,53715,53716,53717,53718,53719,53721,53722,53723,53724,53725,53726,53727,53728,53729,53730,53731,53732,53733,53734,53735,53736,53737,53738,null,null,null,null,null,null,53739,53740,53741,53742,53743,53744,53745,53746,53747,53749,53750,53751,53753,53754,53755,53756,53757,53758,53759,53760,53761,53762,53763,53764,53765,53766,null,null,null,null,null,null,53768,53770,53771,53772,53773,53774,53775,53777,53778,53779,53780,53781,53782,53783,53784,53785,53786,53787,53788,53789,53790,53791,53792,53793,53794,53795,53796,53797,53798,53799,53800,53801,47467,47469,47476,47477,47480,47484,47492,47493,47495,47497,47498,47501,47502,47532,47533,47536,47540,47548,47549,47551,47553,47560,47561,47564,47566,47567,47568,47569,47570,47576,47577,47579,47581,47582,47585,47587,47588,47589,47592,47596,47604,47605,47607,47608,47609,47610,47616,47617,47624,47637,47672,47673,47676,47680,47682,47688,47689,47691,47693,47694,47699,47700,47701,47704,47708,47716,47717,47719,47720,47721,47728,47729,47732,47736,47747,47748,47749,47751,47756,47784,47785,47787,47788,47792,47794,47800,47801,47803,47805,47812,47816,47832,47833,47868,53802,53803,53806,53807,53809,53810,53811,53813,53814,53815,53816,53817,53818,53819,53822,53824,53826,53827,53828,53829,53830,53831,53833,53834,53835,53836,null,null,null,null,null,null,53837,53838,53839,53840,53841,53842,53843,53844,53845,53846,53847,53848,53849,53850,53851,53853,53854,53855,53856,53857,53858,53859,53861,53862,53863,53864,null,null,null,null,null,null,53865,53866,53867,53868,53869,53870,53871,53872,53873,53874,53875,53876,53877,53878,53879,53880,53881,53882,53883,53884,53885,53886,53887,53890,53891,53893,53894,53895,53897,53898,53899,53900,47872,47876,47885,47887,47889,47896,47900,47904,47913,47915,47924,47925,47926,47928,47931,47932,47933,47934,47940,47941,47943,47945,47949,47951,47952,47956,47960,47969,47971,47980,48008,48012,48016,48036,48040,48044,48052,48055,48064,48068,48072,48080,48083,48120,48121,48124,48127,48128,48130,48136,48137,48139,48140,48141,48143,48145,48148,48149,48150,48151,48152,48155,48156,48157,48158,48159,48164,48165,48167,48169,48173,48176,48177,48180,48184,48192,48193,48195,48196,48197,48201,48204,48205,48208,48221,48260,48261,48264,48267,48268,48270,48276,48277,48279,53901,53902,53903,53906,53907,53908,53910,53911,53912,53913,53914,53915,53917,53918,53919,53921,53922,53923,53925,53926,53927,53928,53929,53930,53931,53933,null,null,null,null,null,null,53934,53935,53936,53938,53939,53940,53941,53942,53943,53946,53947,53949,53950,53953,53955,53956,53957,53958,53959,53962,53964,53965,53966,53967,53968,53969,null,null,null,null,null,null,53970,53971,53973,53974,53975,53977,53978,53979,53981,53982,53983,53984,53985,53986,53987,53990,53991,53992,53993,53994,53995,53996,53997,53998,53999,54002,54003,54005,54006,54007,54009,54010,48281,48282,48288,48289,48292,48295,48296,48304,48305,48307,48308,48309,48316,48317,48320,48324,48333,48335,48336,48337,48341,48344,48348,48372,48373,48374,48376,48380,48388,48389,48391,48393,48400,48404,48420,48428,48448,48456,48457,48460,48464,48472,48473,48484,48488,48512,48513,48516,48519,48520,48521,48522,48528,48529,48531,48533,48537,48538,48540,48548,48560,48568,48596,48597,48600,48604,48617,48624,48628,48632,48640,48643,48645,48652,48653,48656,48660,48668,48669,48671,48708,48709,48712,48716,48718,48724,48725,48727,48729,48730,48731,48736,48737,48740,54011,54012,54013,54014,54015,54018,54020,54022,54023,54024,54025,54026,54027,54031,54033,54034,54035,54037,54039,54040,54041,54042,54043,54046,54050,54051,null,null,null,null,null,null,54052,54054,54055,54058,54059,54061,54062,54063,54065,54066,54067,54068,54069,54070,54071,54074,54078,54079,54080,54081,54082,54083,54086,54087,54088,54089,null,null,null,null,null,null,54090,54091,54092,54093,54094,54095,54096,54097,54098,54099,54100,54101,54102,54103,54104,54105,54106,54107,54108,54109,54110,54111,54112,54113,54114,54115,54116,54117,54118,54119,54120,54121,48744,48746,48752,48753,48755,48756,48757,48763,48764,48765,48768,48772,48780,48781,48783,48784,48785,48792,48793,48808,48848,48849,48852,48855,48856,48864,48867,48868,48869,48876,48897,48904,48905,48920,48921,48923,48924,48925,48960,48961,48964,48968,48976,48977,48981,49044,49072,49093,49100,49101,49104,49108,49116,49119,49121,49212,49233,49240,49244,49248,49256,49257,49296,49297,49300,49304,49312,49313,49315,49317,49324,49325,49327,49328,49331,49332,49333,49334,49340,49341,49343,49344,49345,49349,49352,49353,49356,49360,49368,49369,49371,49372,49373,49380,54122,54123,54124,54125,54126,54127,54128,54129,54130,54131,54132,54133,54134,54135,54136,54137,54138,54139,54142,54143,54145,54146,54147,54149,54150,54151,null,null,null,null,null,null,54152,54153,54154,54155,54158,54162,54163,54164,54165,54166,54167,54170,54171,54173,54174,54175,54177,54178,54179,54180,54181,54182,54183,54186,54188,54190,null,null,null,null,null,null,54191,54192,54193,54194,54195,54197,54198,54199,54201,54202,54203,54205,54206,54207,54208,54209,54210,54211,54214,54215,54218,54219,54220,54221,54222,54223,54225,54226,54227,54228,54229,54230,49381,49384,49388,49396,49397,49399,49401,49408,49412,49416,49424,49429,49436,49437,49438,49439,49440,49443,49444,49446,49447,49452,49453,49455,49456,49457,49462,49464,49465,49468,49472,49480,49481,49483,49484,49485,49492,49493,49496,49500,49508,49509,49511,49512,49513,49520,49524,49528,49541,49548,49549,49550,49552,49556,49558,49564,49565,49567,49569,49573,49576,49577,49580,49584,49597,49604,49608,49612,49620,49623,49624,49632,49636,49640,49648,49649,49651,49660,49661,49664,49668,49676,49677,49679,49681,49688,49689,49692,49695,49696,49704,49705,49707,49709,54231,54233,54234,54235,54236,54237,54238,54239,54240,54242,54244,54245,54246,54247,54248,54249,54250,54251,54254,54255,54257,54258,54259,54261,54262,54263,null,null,null,null,null,null,54264,54265,54266,54267,54270,54272,54274,54275,54276,54277,54278,54279,54281,54282,54283,54284,54285,54286,54287,54288,54289,54290,54291,54292,54293,54294,null,null,null,null,null,null,54295,54296,54297,54298,54299,54300,54302,54303,54304,54305,54306,54307,54308,54309,54310,54311,54312,54313,54314,54315,54316,54317,54318,54319,54320,54321,54322,54323,54324,54325,54326,54327,49711,49713,49714,49716,49736,49744,49745,49748,49752,49760,49765,49772,49773,49776,49780,49788,49789,49791,49793,49800,49801,49808,49816,49819,49821,49828,49829,49832,49836,49837,49844,49845,49847,49849,49884,49885,49888,49891,49892,49899,49900,49901,49903,49905,49910,49912,49913,49915,49916,49920,49928,49929,49932,49933,49939,49940,49941,49944,49948,49956,49957,49960,49961,49989,50024,50025,50028,50032,50034,50040,50041,50044,50045,50052,50056,50060,50112,50136,50137,50140,50143,50144,50146,50152,50153,50157,50164,50165,50168,50184,50192,50212,50220,50224,54328,54329,54330,54331,54332,54333,54334,54335,54337,54338,54339,54341,54342,54343,54344,54345,54346,54347,54348,54349,54350,54351,54352,54353,54354,54355,null,null,null,null,null,null,54356,54357,54358,54359,54360,54361,54362,54363,54365,54366,54367,54369,54370,54371,54373,54374,54375,54376,54377,54378,54379,54380,54382,54384,54385,54386,null,null,null,null,null,null,54387,54388,54389,54390,54391,54394,54395,54397,54398,54401,54403,54404,54405,54406,54407,54410,54412,54414,54415,54416,54417,54418,54419,54421,54422,54423,54424,54425,54426,54427,54428,54429,50228,50236,50237,50248,50276,50277,50280,50284,50292,50293,50297,50304,50324,50332,50360,50364,50409,50416,50417,50420,50424,50426,50431,50432,50433,50444,50448,50452,50460,50472,50473,50476,50480,50488,50489,50491,50493,50500,50501,50504,50505,50506,50508,50509,50510,50515,50516,50517,50519,50520,50521,50525,50526,50528,50529,50532,50536,50544,50545,50547,50548,50549,50556,50557,50560,50564,50567,50572,50573,50575,50577,50581,50583,50584,50588,50592,50601,50612,50613,50616,50617,50619,50620,50621,50622,50628,50629,50630,50631,50632,50633,50634,50636,50638,54430,54431,54432,54433,54434,54435,54436,54437,54438,54439,54440,54442,54443,54444,54445,54446,54447,54448,54449,54450,54451,54452,54453,54454,54455,54456,null,null,null,null,null,null,54457,54458,54459,54460,54461,54462,54463,54464,54465,54466,54467,54468,54469,54470,54471,54472,54473,54474,54475,54477,54478,54479,54481,54482,54483,54485,null,null,null,null,null,null,54486,54487,54488,54489,54490,54491,54493,54494,54496,54497,54498,54499,54500,54501,54502,54503,54505,54506,54507,54509,54510,54511,54513,54514,54515,54516,54517,54518,54519,54521,54522,54524,50640,50641,50644,50648,50656,50657,50659,50661,50668,50669,50670,50672,50676,50678,50679,50684,50685,50686,50687,50688,50689,50693,50694,50695,50696,50700,50704,50712,50713,50715,50716,50724,50725,50728,50732,50733,50734,50736,50739,50740,50741,50743,50745,50747,50752,50753,50756,50760,50768,50769,50771,50772,50773,50780,50781,50784,50796,50799,50801,50808,50809,50812,50816,50824,50825,50827,50829,50836,50837,50840,50844,50852,50853,50855,50857,50864,50865,50868,50872,50873,50874,50880,50881,50883,50885,50892,50893,50896,50900,50908,50909,50912,50913,50920,54526,54527,54528,54529,54530,54531,54533,54534,54535,54537,54538,54539,54541,54542,54543,54544,54545,54546,54547,54550,54552,54553,54554,54555,54556,54557,null,null,null,null,null,null,54558,54559,54560,54561,54562,54563,54564,54565,54566,54567,54568,54569,54570,54571,54572,54573,54574,54575,54576,54577,54578,54579,54580,54581,54582,54583,null,null,null,null,null,null,54584,54585,54586,54587,54590,54591,54593,54594,54595,54597,54598,54599,54600,54601,54602,54603,54606,54608,54610,54611,54612,54613,54614,54615,54618,54619,54621,54622,54623,54625,54626,54627,50921,50924,50928,50936,50937,50941,50948,50949,50952,50956,50964,50965,50967,50969,50976,50977,50980,50984,50992,50993,50995,50997,50999,51004,51005,51008,51012,51018,51020,51021,51023,51025,51026,51027,51028,51029,51030,51031,51032,51036,51040,51048,51051,51060,51061,51064,51068,51069,51070,51075,51076,51077,51079,51080,51081,51082,51086,51088,51089,51092,51094,51095,51096,51098,51104,51105,51107,51108,51109,51110,51116,51117,51120,51124,51132,51133,51135,51136,51137,51144,51145,51148,51150,51152,51160,51165,51172,51176,51180,51200,51201,51204,51208,51210,54628,54630,54631,54634,54636,54638,54639,54640,54641,54642,54643,54646,54647,54649,54650,54651,54653,54654,54655,54656,54657,54658,54659,54662,54666,54667,null,null,null,null,null,null,54668,54669,54670,54671,54673,54674,54675,54676,54677,54678,54679,54680,54681,54682,54683,54684,54685,54686,54687,54688,54689,54690,54691,54692,54694,54695,null,null,null,null,null,null,54696,54697,54698,54699,54700,54701,54702,54703,54704,54705,54706,54707,54708,54709,54710,54711,54712,54713,54714,54715,54716,54717,54718,54719,54720,54721,54722,54723,54724,54725,54726,54727,51216,51217,51219,51221,51222,51228,51229,51232,51236,51244,51245,51247,51249,51256,51260,51264,51272,51273,51276,51277,51284,51312,51313,51316,51320,51322,51328,51329,51331,51333,51334,51335,51339,51340,51341,51348,51357,51359,51361,51368,51388,51389,51396,51400,51404,51412,51413,51415,51417,51424,51425,51428,51445,51452,51453,51456,51460,51461,51462,51468,51469,51471,51473,51480,51500,51508,51536,51537,51540,51544,51552,51553,51555,51564,51568,51572,51580,51592,51593,51596,51600,51608,51609,51611,51613,51648,51649,51652,51655,51656,51658,51664,51665,51667,54730,54731,54733,54734,54735,54737,54739,54740,54741,54742,54743,54746,54748,54750,54751,54752,54753,54754,54755,54758,54759,54761,54762,54763,54765,54766,null,null,null,null,null,null,54767,54768,54769,54770,54771,54774,54776,54778,54779,54780,54781,54782,54783,54786,54787,54789,54790,54791,54793,54794,54795,54796,54797,54798,54799,54802,null,null,null,null,null,null,54806,54807,54808,54809,54810,54811,54813,54814,54815,54817,54818,54819,54821,54822,54823,54824,54825,54826,54827,54828,54830,54831,54832,54833,54834,54835,54836,54837,54838,54839,54842,54843,51669,51670,51673,51674,51676,51677,51680,51682,51684,51687,51692,51693,51695,51696,51697,51704,51705,51708,51712,51720,51721,51723,51724,51725,51732,51736,51753,51788,51789,51792,51796,51804,51805,51807,51808,51809,51816,51837,51844,51864,51900,51901,51904,51908,51916,51917,51919,51921,51923,51928,51929,51936,51948,51956,51976,51984,51988,51992,52000,52001,52033,52040,52041,52044,52048,52056,52057,52061,52068,52088,52089,52124,52152,52180,52196,52199,52201,52236,52237,52240,52244,52252,52253,52257,52258,52263,52264,52265,52268,52270,52272,52280,52281,52283,54845,54846,54847,54849,54850,54851,54852,54854,54855,54858,54860,54862,54863,54864,54866,54867,54870,54871,54873,54874,54875,54877,54878,54879,54880,54881,null,null,null,null,null,null,54882,54883,54884,54885,54886,54888,54890,54891,54892,54893,54894,54895,54898,54899,54901,54902,54903,54904,54905,54906,54907,54908,54909,54910,54911,54912,null,null,null,null,null,null,54913,54914,54916,54918,54919,54920,54921,54922,54923,54926,54927,54929,54930,54931,54933,54934,54935,54936,54937,54938,54939,54940,54942,54944,54946,54947,54948,54949,54950,54951,54953,54954,52284,52285,52286,52292,52293,52296,52300,52308,52309,52311,52312,52313,52320,52324,52326,52328,52336,52341,52376,52377,52380,52384,52392,52393,52395,52396,52397,52404,52405,52408,52412,52420,52421,52423,52425,52432,52436,52452,52460,52464,52481,52488,52489,52492,52496,52504,52505,52507,52509,52516,52520,52524,52537,52572,52576,52580,52588,52589,52591,52593,52600,52616,52628,52629,52632,52636,52644,52645,52647,52649,52656,52676,52684,52688,52712,52716,52720,52728,52729,52731,52733,52740,52744,52748,52756,52761,52768,52769,52772,52776,52784,52785,52787,52789,54955,54957,54958,54959,54961,54962,54963,54964,54965,54966,54967,54968,54970,54972,54973,54974,54975,54976,54977,54978,54979,54982,54983,54985,54986,54987,null,null,null,null,null,null,54989,54990,54991,54992,54994,54995,54997,54998,55000,55002,55003,55004,55005,55006,55007,55009,55010,55011,55013,55014,55015,55017,55018,55019,55020,55021,null,null,null,null,null,null,55022,55023,55025,55026,55027,55028,55030,55031,55032,55033,55034,55035,55038,55039,55041,55042,55043,55045,55046,55047,55048,55049,55050,55051,55052,55053,55054,55055,55056,55058,55059,55060,52824,52825,52828,52831,52832,52833,52840,52841,52843,52845,52852,52853,52856,52860,52868,52869,52871,52873,52880,52881,52884,52888,52896,52897,52899,52900,52901,52908,52909,52929,52964,52965,52968,52971,52972,52980,52981,52983,52984,52985,52992,52993,52996,53000,53008,53009,53011,53013,53020,53024,53028,53036,53037,53039,53040,53041,53048,53076,53077,53080,53084,53092,53093,53095,53097,53104,53105,53108,53112,53120,53125,53132,53153,53160,53168,53188,53216,53217,53220,53224,53232,53233,53235,53237,53244,53248,53252,53265,53272,53293,53300,53301,53304,53308,55061,55062,55063,55066,55067,55069,55070,55071,55073,55074,55075,55076,55077,55078,55079,55082,55084,55086,55087,55088,55089,55090,55091,55094,55095,55097,null,null,null,null,null,null,55098,55099,55101,55102,55103,55104,55105,55106,55107,55109,55110,55112,55114,55115,55116,55117,55118,55119,55122,55123,55125,55130,55131,55132,55133,55134,null,null,null,null,null,null,55135,55138,55140,55142,55143,55144,55146,55147,55149,55150,55151,55153,55154,55155,55157,55158,55159,55160,55161,55162,55163,55166,55167,55168,55170,55171,55172,55173,55174,55175,55178,55179,53316,53317,53319,53321,53328,53332,53336,53344,53356,53357,53360,53364,53372,53373,53377,53412,53413,53416,53420,53428,53429,53431,53433,53440,53441,53444,53448,53449,53456,53457,53459,53460,53461,53468,53469,53472,53476,53484,53485,53487,53488,53489,53496,53517,53552,53553,53556,53560,53562,53568,53569,53571,53572,53573,53580,53581,53584,53588,53596,53597,53599,53601,53608,53612,53628,53636,53640,53664,53665,53668,53672,53680,53681,53683,53685,53690,53692,53696,53720,53748,53752,53767,53769,53776,53804,53805,53808,53812,53820,53821,53823,53825,53832,53852,55181,55182,55183,55185,55186,55187,55188,55189,55190,55191,55194,55196,55198,55199,55200,55201,55202,55203,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,53860,53888,53889,53892,53896,53904,53905,53909,53916,53920,53924,53932,53937,53944,53945,53948,53951,53952,53954,53960,53961,53963,53972,53976,53980,53988,53989,54000,54001,54004,54008,54016,54017,54019,54021,54028,54029,54030,54032,54036,54038,54044,54045,54047,54048,54049,54053,54056,54057,54060,54064,54072,54073,54075,54076,54077,54084,54085,54140,54141,54144,54148,54156,54157,54159,54160,54161,54168,54169,54172,54176,54184,54185,54187,54189,54196,54200,54204,54212,54213,54216,54217,54224,54232,54241,54243,54252,54253,54256,54260,54268,54269,54271,54273,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,54280,54301,54336,54340,54364,54368,54372,54381,54383,54392,54393,54396,54399,54400,54402,54408,54409,54411,54413,54420,54441,54476,54480,54484,54492,54495,54504,54508,54512,54520,54523,54525,54532,54536,54540,54548,54549,54551,54588,54589,54592,54596,54604,54605,54607,54609,54616,54617,54620,54624,54629,54632,54633,54635,54637,54644,54645,54648,54652,54660,54661,54663,54664,54665,54672,54693,54728,54729,54732,54736,54738,54744,54745,54747,54749,54756,54757,54760,54764,54772,54773,54775,54777,54784,54785,54788,54792,54800,54801,54803,54804,54805,54812,54816,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,54820,54829,54840,54841,54844,54848,54853,54856,54857,54859,54861,54865,54868,54869,54872,54876,54887,54889,54896,54897,54900,54915,54917,54924,54925,54928,54932,54941,54943,54945,54952,54956,54960,54969,54971,54980,54981,54984,54988,54993,54996,54999,55001,55008,55012,55016,55024,55029,55036,55037,55040,55044,55057,55064,55065,55068,55072,55080,55081,55083,55085,55092,55093,55096,55100,55108,55111,55113,55120,55121,55124,55126,55127,55128,55129,55136,55137,55139,55141,55145,55148,55152,55156,55164,55165,55169,55176,55177,55180,55184,55192,55193,55195,55197,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20285,20339,20551,20729,21152,21487,21621,21733,22025,23233,23478,26247,26550,26551,26607,27468,29634,30146,31292,33499,33540,34903,34952,35382,36040,36303,36603,36838,39381,21051,21364,21508,24682,24932,27580,29647,33050,35258,35282,38307,20355,21002,22718,22904,23014,24178,24185,25031,25536,26438,26604,26751,28567,30286,30475,30965,31240,31487,31777,32925,33390,33393,35563,38291,20075,21917,26359,28212,30883,31469,33883,35088,34638,38824,21208,22350,22570,23884,24863,25022,25121,25954,26577,27204,28187,29976,30131,30435,30640,32058,37039,37969,37970,40853,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21283,23724,30002,32987,37440,38296,21083,22536,23004,23713,23831,24247,24378,24394,24951,27743,30074,30086,31968,32115,32177,32652,33108,33313,34193,35137,35611,37628,38477,40007,20171,20215,20491,20977,22607,24887,24894,24936,25913,27114,28433,30117,30342,30422,31623,33445,33995,63744,37799,38283,21888,23458,22353,63745,31923,32697,37301,20520,21435,23621,24040,25298,25454,25818,25831,28192,28844,31067,36317,36382,63746,36989,37445,37624,20094,20214,20581,24062,24314,24838,26967,33137,34388,36423,37749,39467,20062,20625,26480,26688,20745,21133,21138,27298,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,30652,37392,40660,21163,24623,36850,20552,25001,25581,25802,26684,27268,28608,33160,35233,38548,22533,29309,29356,29956,32121,32365,32937,35211,35700,36963,40273,25225,27770,28500,32080,32570,35363,20860,24906,31645,35609,37463,37772,20140,20435,20510,20670,20742,21185,21197,21375,22384,22659,24218,24465,24950,25004,25806,25964,26223,26299,26356,26775,28039,28805,28913,29855,29861,29898,30169,30828,30956,31455,31478,32069,32147,32789,32831,33051,33686,35686,36629,36885,37857,38915,38968,39514,39912,20418,21843,22586,22865,23395,23622,24760,25106,26690,26800,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26856,28330,30028,30328,30926,31293,31995,32363,32380,35336,35489,35903,38542,40388,21476,21481,21578,21617,22266,22993,23396,23611,24235,25335,25911,25925,25970,26272,26543,27073,27837,30204,30352,30590,31295,32660,32771,32929,33167,33510,33533,33776,34241,34865,34996,35493,63747,36764,37678,38599,39015,39640,40723,21741,26011,26354,26767,31296,35895,40288,22256,22372,23825,26118,26801,26829,28414,29736,34974,39908,27752,63748,39592,20379,20844,20849,21151,23380,24037,24656,24685,25329,25511,25915,29657,31354,34467,36002,38799,20018,23521,25096,26524,29916,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31185,33747,35463,35506,36328,36942,37707,38982,24275,27112,34303,37101,63749,20896,23448,23532,24931,26874,27454,28748,29743,29912,31649,32592,33733,35264,36011,38364,39208,21038,24669,25324,36866,20362,20809,21281,22745,24291,26336,27960,28826,29378,29654,31568,33009,37979,21350,25499,32619,20054,20608,22602,22750,24618,24871,25296,27088,39745,23439,32024,32945,36703,20132,20689,21676,21932,23308,23968,24039,25898,25934,26657,27211,29409,30350,30703,32094,32761,33184,34126,34527,36611,36686,37066,39171,39509,39851,19992,20037,20061,20167,20465,20855,21246,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21312,21475,21477,21646,22036,22389,22434,23495,23943,24272,25084,25304,25937,26552,26601,27083,27472,27590,27628,27714,28317,28792,29399,29590,29699,30655,30697,31350,32127,32777,33276,33285,33290,33503,34914,35635,36092,36544,36881,37041,37476,37558,39378,39493,40169,40407,40860,22283,23616,33738,38816,38827,40628,21531,31384,32676,35033,36557,37089,22528,23624,25496,31391,23470,24339,31353,31406,33422,36524,20518,21048,21240,21367,22280,25331,25458,27402,28099,30519,21413,29527,34152,36470,38357,26426,27331,28528,35437,36556,39243,63750,26231,27512,36020,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,39740,63751,21483,22317,22862,25542,27131,29674,30789,31418,31429,31998,33909,35215,36211,36917,38312,21243,22343,30023,31584,33740,37406,63752,27224,20811,21067,21127,25119,26840,26997,38553,20677,21156,21220,25027,26020,26681,27135,29822,31563,33465,33771,35250,35641,36817,39241,63753,20170,22935,25810,26129,27278,29748,31105,31165,33449,34942,34943,35167,63754,37670,20235,21450,24613,25201,27762,32026,32102,20120,20834,30684,32943,20225,20238,20854,20864,21980,22120,22331,22522,22524,22804,22855,22931,23492,23696,23822,24049,24190,24524,25216,26071,26083,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26398,26399,26462,26827,26820,27231,27450,27683,27773,27778,28103,29592,29734,29738,29826,29859,30072,30079,30849,30959,31041,31047,31048,31098,31637,32000,32186,32648,32774,32813,32908,35352,35663,35912,36215,37665,37668,39138,39249,39438,39439,39525,40594,32202,20342,21513,25326,26708,37329,21931,20794,63755,63756,23068,25062,63757,25295,25343,63758,63759,63760,63761,63762,63763,37027,63764,63765,63766,63767,63768,35582,63769,63770,63771,63772,26262,63773,29014,63774,63775,38627,63776,25423,25466,21335,63777,26511,26976,28275,63778,30007,63779,63780,63781,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32013,63782,63783,34930,22218,23064,63784,63785,63786,63787,63788,20035,63789,20839,22856,26608,32784,63790,22899,24180,25754,31178,24565,24684,25288,25467,23527,23511,21162,63791,22900,24361,24594,63792,63793,63794,29785,63795,63796,63797,63798,63799,63800,39377,63801,63802,63803,63804,63805,63806,63807,63808,63809,63810,63811,28611,63812,63813,33215,36786,24817,63814,63815,33126,63816,63817,23615,63818,63819,63820,63821,63822,63823,63824,63825,23273,35365,26491,32016,63826,63827,63828,63829,63830,63831,33021,63832,63833,23612,27877,21311,28346,22810,33590,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20025,20150,20294,21934,22296,22727,24406,26039,26086,27264,27573,28237,30701,31471,31774,32222,34507,34962,37170,37723,25787,28606,29562,30136,36948,21846,22349,25018,25812,26311,28129,28251,28525,28601,30192,32835,33213,34113,35203,35527,35674,37663,27795,30035,31572,36367,36957,21776,22530,22616,24162,25095,25758,26848,30070,31958,34739,40680,20195,22408,22382,22823,23565,23729,24118,24453,25140,25825,29619,33274,34955,36024,38538,40667,23429,24503,24755,20498,20992,21040,22294,22581,22615,23566,23648,23798,23947,24230,24466,24764,25361,25481,25623,26691,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26873,27330,28120,28193,28372,28644,29182,30428,30585,31153,31291,33796,35241,36077,36339,36424,36867,36884,36947,37117,37709,38518,38876,27602,28678,29272,29346,29544,30563,31167,31716,32411,35712,22697,24775,25958,26109,26302,27788,28958,29129,35930,38931,20077,31361,20189,20908,20941,21205,21516,24999,26481,26704,26847,27934,28540,30140,30643,31461,33012,33891,37509,20828,26007,26460,26515,30168,31431,33651,63834,35910,36887,38957,23663,33216,33434,36929,36975,37389,24471,23965,27225,29128,30331,31561,34276,35588,37159,39472,21895,25078,63835,30313,32645,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,34367,34746,35064,37007,63836,27931,28889,29662,32097,33853,63837,37226,39409,63838,20098,21365,27396,27410,28734,29211,34349,40478,21068,36771,23888,25829,25900,27414,28651,31811,32412,34253,35172,35261,25289,33240,34847,24266,26391,28010,29436,29701,29807,34690,37086,20358,23821,24480,33802,20919,25504,30053,20142,20486,20841,20937,26753,27153,31918,31921,31975,33391,35538,36635,37327,20406,20791,21237,21570,24300,24942,25150,26053,27354,28670,31018,34268,34851,38317,39522,39530,40599,40654,21147,26310,27511,28701,31019,36706,38722,24976,25088,25891,28451,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,29001,29833,32244,32879,34030,36646,36899,37706,20925,21015,21155,27916,28872,35010,24265,25986,27566,28610,31806,29557,20196,20278,22265,63839,23738,23994,24604,29618,31533,32666,32718,32838,36894,37428,38646,38728,38936,40801,20363,28583,31150,37300,38583,21214,63840,25736,25796,27347,28510,28696,29200,30439,32769,34310,34396,36335,36613,38706,39791,40442,40565,30860,31103,32160,33737,37636,40575,40595,35542,22751,24324,26407,28711,29903,31840,32894,20769,28712,29282,30922,36034,36058,36084,38647,20102,20698,23534,24278,26009,29134,30274,30637,32842,34044,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36988,39719,40845,22744,23105,23650,27155,28122,28431,30267,32047,32311,34078,35128,37860,38475,21129,26066,26611,27060,27969,28316,28687,29705,29792,30041,30244,30827,35628,39006,20845,25134,38520,20374,20523,23833,28138,32184,36650,24459,24900,26647,63841,38534,21202,32907,20956,20940,26974,31260,32190,33777,38517,20442,21033,21400,21519,21774,23653,24743,26446,26792,28012,29313,29432,29702,29827,63842,30178,31852,32633,32696,33673,35023,35041,37324,37328,38626,39881,21533,28542,29136,29848,34298,36522,38563,40023,40607,26519,28107,29747,33256,38678,30764,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31435,31520,31890,25705,29802,30194,30908,30952,39340,39764,40635,23518,24149,28448,33180,33707,37000,19975,21325,23081,24018,24398,24930,25405,26217,26364,28415,28459,28771,30622,33836,34067,34875,36627,39237,39995,21788,25273,26411,27819,33545,35178,38778,20129,22916,24536,24537,26395,32178,32596,33426,33579,33725,36638,37017,22475,22969,23186,23504,26151,26522,26757,27599,29028,32629,36023,36067,36993,39749,33032,35978,38476,39488,40613,23391,27667,29467,30450,30431,33804,20906,35219,20813,20885,21193,26825,27796,30468,30496,32191,32236,38754,40629,28357,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,34065,20901,21517,21629,26126,26269,26919,28319,30399,30609,33559,33986,34719,37225,37528,40180,34946,20398,20882,21215,22982,24125,24917,25720,25721,26286,26576,27169,27597,27611,29279,29281,29761,30520,30683,32791,33468,33541,35584,35624,35980,26408,27792,29287,30446,30566,31302,40361,27519,27794,22818,26406,33945,21359,22675,22937,24287,25551,26164,26483,28218,29483,31447,33495,37672,21209,24043,25006,25035,25098,25287,25771,26080,26969,27494,27595,28961,29687,30045,32326,33310,33538,34154,35491,36031,38695,40289,22696,40664,20497,21006,21563,21839,25991,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,27766,32010,32011,32862,34442,38272,38639,21247,27797,29289,21619,23194,23614,23883,24396,24494,26410,26806,26979,28220,28228,30473,31859,32654,34183,35598,36855,38753,40692,23735,24758,24845,25003,25935,26107,26108,27665,27887,29599,29641,32225,38292,23494,34588,35600,21085,21338,25293,25615,25778,26420,27192,27850,29632,29854,31636,31893,32283,33162,33334,34180,36843,38649,39361,20276,21322,21453,21467,25292,25644,25856,26001,27075,27886,28504,29677,30036,30242,30436,30460,30928,30971,31020,32070,33324,34784,36820,38930,39151,21187,25300,25765,28196,28497,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,30332,36299,37297,37474,39662,39747,20515,20621,22346,22952,23592,24135,24439,25151,25918,26041,26049,26121,26507,27036,28354,30917,32033,32938,33152,33323,33459,33953,34444,35370,35607,37030,38450,40848,20493,20467,63843,22521,24472,25308,25490,26479,28227,28953,30403,32972,32986,35060,35061,35097,36064,36649,37197,38506,20271,20336,24091,26575,26658,30333,30334,39748,24161,27146,29033,29140,30058,63844,32321,34115,34281,39132,20240,31567,32624,38309,20961,24070,26805,27710,27726,27867,29359,31684,33539,27861,29754,20731,21128,22721,25816,27287,29863,30294,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,30887,34327,38370,38713,63845,21342,24321,35722,36776,36783,37002,21029,30629,40009,40712,19993,20482,20853,23643,24183,26142,26170,26564,26821,28851,29953,30149,31177,31453,36647,39200,39432,20445,22561,22577,23542,26222,27493,27921,28282,28541,29668,29995,33769,35036,35091,35676,36628,20239,20693,21264,21340,23443,24489,26381,31119,33145,33583,34068,35079,35206,36665,36667,39333,39954,26412,20086,20472,22857,23553,23791,23792,25447,26834,28925,29090,29739,32299,34028,34562,36898,37586,40179,19981,20184,20463,20613,21078,21103,21542,21648,22496,22827,23142,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,23386,23413,23500,24220,63846,25206,25975,26023,28014,28325,29238,31526,31807,32566,33104,33105,33178,33344,33433,33705,35331,36000,36070,36091,36212,36282,37096,37340,38428,38468,39385,40167,21271,20998,21545,22132,22707,22868,22894,24575,24996,25198,26128,27774,28954,30406,31881,31966,32027,33452,36033,38640,63847,20315,24343,24447,25282,23849,26379,26842,30844,32323,40300,19989,20633,21269,21290,21329,22915,23138,24199,24754,24970,25161,25209,26000,26503,27047,27604,27606,27607,27608,27832,63848,29749,30202,30738,30865,31189,31192,31875,32203,32737,32933,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,33086,33218,33778,34586,35048,35513,35692,36027,37145,38750,39131,40763,22188,23338,24428,25996,27315,27567,27996,28657,28693,29277,29613,36007,36051,38971,24977,27703,32856,39425,20045,20107,20123,20181,20282,20284,20351,20447,20735,21490,21496,21766,21987,22235,22763,22882,23057,23531,23546,23556,24051,24107,24473,24605,25448,26012,26031,26614,26619,26797,27515,27801,27863,28195,28681,29509,30722,31038,31040,31072,31169,31721,32023,32114,32902,33293,33678,34001,34503,35039,35408,35422,35613,36060,36198,36781,37034,39164,39391,40605,21066,63849,26388,63850,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20632,21034,23665,25955,27733,29642,29987,30109,31639,33948,37240,38704,20087,25746,27578,29022,34217,19977,63851,26441,26862,28183,33439,34072,34923,25591,28545,37394,39087,19978,20663,20687,20767,21830,21930,22039,23360,23577,23776,24120,24202,24224,24258,24819,26705,27233,28248,29245,29248,29376,30456,31077,31665,32724,35059,35316,35443,35937,36062,38684,22622,29885,36093,21959,63852,31329,32034,33394,29298,29983,29989,63853,31513,22661,22779,23996,24207,24246,24464,24661,25234,25471,25933,26257,26329,26360,26646,26866,29312,29790,31598,32110,32214,32626,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32997,33298,34223,35199,35475,36893,37604,40653,40736,22805,22893,24109,24796,26132,26227,26512,27728,28101,28511,30707,30889,33990,37323,37675,20185,20682,20808,21892,23307,23459,25159,25982,26059,28210,29053,29697,29764,29831,29887,30316,31146,32218,32341,32680,33146,33203,33337,34330,34796,35445,36323,36984,37521,37925,39245,39854,21352,23633,26964,27844,27945,28203,33292,34203,35131,35373,35498,38634,40807,21089,26297,27570,32406,34814,36109,38275,38493,25885,28041,29166,63854,22478,22995,23468,24615,24826,25104,26143,26207,29481,29689,30427,30465,31596,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32854,32882,33125,35488,37266,19990,21218,27506,27927,31237,31545,32048,63855,36016,21484,22063,22609,23477,23567,23569,24034,25152,25475,25620,26157,26803,27836,28040,28335,28703,28836,29138,29990,30095,30094,30233,31505,31712,31787,32032,32057,34092,34157,34311,35380,36877,36961,37045,37559,38902,39479,20439,23660,26463,28049,31903,32396,35606,36118,36895,23403,24061,25613,33984,36956,39137,29575,23435,24730,26494,28126,35359,35494,36865,38924,21047,63856,28753,30862,37782,34928,37335,20462,21463,22013,22234,22402,22781,23234,23432,23723,23744,24101,24833,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,25101,25163,25480,25628,25910,25976,27193,27530,27700,27929,28465,29159,29417,29560,29703,29874,30246,30561,31168,31319,31466,31929,32143,32172,32353,32670,33065,33585,33936,34010,34282,34966,35504,35728,36664,36930,36995,37228,37526,37561,38539,38567,38568,38614,38656,38920,39318,39635,39706,21460,22654,22809,23408,23487,28113,28506,29087,29729,29881,32901,33789,24033,24455,24490,24642,26092,26642,26991,27219,27529,27957,28147,29667,30462,30636,31565,32020,33059,33308,33600,34036,34147,35426,35524,37255,37662,38918,39348,25100,34899,36848,37477,23815,23847,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,23913,29791,33181,34664,28629,25342,32722,35126,35186,19998,20056,20711,21213,21319,25215,26119,32361,34821,38494,20365,21273,22070,22987,23204,23608,23630,23629,24066,24337,24643,26045,26159,26178,26558,26612,29468,30690,31034,32709,33940,33997,35222,35430,35433,35553,35925,35962,22516,23508,24335,24687,25325,26893,27542,28252,29060,31698,34645,35672,36606,39135,39166,20280,20353,20449,21627,23072,23480,24892,26032,26216,29180,30003,31070,32051,33102,33251,33688,34218,34254,34563,35338,36523,36763,63857,36805,22833,23460,23526,24713,23529,23563,24515,27777,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63858,28145,28683,29978,33455,35574,20160,21313,63859,38617,27663,20126,20420,20818,21854,23077,23784,25105,29273,33469,33706,34558,34905,35357,38463,38597,39187,40201,40285,22538,23731,23997,24132,24801,24853,25569,27138,28197,37122,37716,38990,39952,40823,23433,23736,25353,26191,26696,30524,38593,38797,38996,39839,26017,35585,36555,38332,21813,23721,24022,24245,26263,30284,33780,38343,22739,25276,29390,40232,20208,22830,24591,26171,27523,31207,40230,21395,21696,22467,23830,24859,26326,28079,30861,33406,38552,38724,21380,25212,25494,28082,32266,33099,38989,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,27387,32588,40367,40474,20063,20539,20918,22812,24825,25590,26928,29242,32822,63860,37326,24369,63861,63862,32004,33509,33903,33979,34277,36493,63863,20335,63864,63865,22756,23363,24665,25562,25880,25965,26264,63866,26954,27171,27915,28673,29036,30162,30221,31155,31344,63867,32650,63868,35140,63869,35731,37312,38525,63870,39178,22276,24481,26044,28417,30208,31142,35486,39341,39770,40812,20740,25014,25233,27277,33222,20547,22576,24422,28937,35328,35578,23420,34326,20474,20796,22196,22852,25513,28153,23978,26989,20870,20104,20313,63871,63872,63873,22914,63874,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63875,27487,27741,63876,29877,30998,63877,33287,33349,33593,36671,36701,63878,39192,63879,63880,63881,20134,63882,22495,24441,26131,63883,63884,30123,32377,35695,63885,36870,39515,22181,22567,23032,23071,23476,63886,24310,63887,63888,25424,25403,63889,26941,27783,27839,28046,28051,28149,28436,63890,28895,28982,29017,63891,29123,29141,63892,30799,30831,63893,31605,32227,63894,32303,63895,34893,36575,63896,63897,63898,37467,63899,40182,63900,63901,63902,24709,28037,63903,29105,63904,63905,38321,21421,63906,63907,63908,26579,63909,28814,28976,29744,33398,33490,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63910,38331,39653,40573,26308,63911,29121,33865,63912,63913,22603,63914,63915,23992,24433,63916,26144,26254,27001,27054,27704,27891,28214,28481,28634,28699,28719,29008,29151,29552,63917,29787,63918,29908,30408,31310,32403,63919,63920,33521,35424,36814,63921,37704,63922,38681,63923,63924,20034,20522,63925,21000,21473,26355,27757,28618,29450,30591,31330,33454,34269,34306,63926,35028,35427,35709,35947,63927,37555,63928,38675,38928,20116,20237,20425,20658,21320,21566,21555,21978,22626,22714,22887,23067,23524,24735,63929,25034,25942,26111,26212,26791,27738,28595,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,28879,29100,29522,31613,34568,35492,39986,40711,23627,27779,29508,29577,37434,28331,29797,30239,31337,32277,34314,20800,22725,25793,29934,29973,30320,32705,37013,38605,39252,28198,29926,31401,31402,33253,34521,34680,35355,23113,23436,23451,26785,26880,28003,29609,29715,29740,30871,32233,32747,33048,33109,33694,35916,38446,38929,26352,24448,26106,26505,27754,29579,20525,23043,27498,30702,22806,23916,24013,29477,30031,63930,63931,20709,20985,22575,22829,22934,23002,23525,63932,63933,23970,25303,25622,25747,25854,63934,26332,63935,27208,63936,29183,29796,63937,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31368,31407,32327,32350,32768,33136,63938,34799,35201,35616,36953,63939,36992,39250,24958,27442,28020,32287,35109,36785,20433,20653,20887,21191,22471,22665,23481,24248,24898,27029,28044,28263,28342,29076,29794,29992,29996,32883,33592,33993,36362,37780,37854,63940,20110,20305,20598,20778,21448,21451,21491,23431,23507,23588,24858,24962,26100,29275,29591,29760,30402,31056,31121,31161,32006,32701,33419,34261,34398,36802,36935,37109,37354,38533,38632,38633,21206,24423,26093,26161,26671,29020,31286,37057,38922,20113,63941,27218,27550,28560,29065,32792,33464,34131,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36939,38549,38642,38907,34074,39729,20112,29066,38596,20803,21407,21729,22291,22290,22435,23195,23236,23491,24616,24895,25588,27781,27961,28274,28304,29232,29503,29783,33489,34945,36677,36960,63942,38498,39000,40219,26376,36234,37470,20301,20553,20702,21361,22285,22996,23041,23561,24944,26256,28205,29234,29771,32239,32963,33806,33894,34111,34655,34907,35096,35586,36949,38859,39759,20083,20369,20754,20842,63943,21807,21929,23418,23461,24188,24189,24254,24736,24799,24840,24841,25540,25912,26377,63944,26580,26586,63945,26977,26978,27833,27943,63946,28216,63947,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,28641,29494,29495,63948,29788,30001,63949,30290,63950,63951,32173,33278,33848,35029,35480,35547,35565,36400,36418,36938,36926,36986,37193,37321,37742,63952,63953,22537,63954,27603,32905,32946,63955,63956,20801,22891,23609,63957,63958,28516,29607,32996,36103,63959,37399,38287,63960,63961,63962,63963,32895,25102,28700,32104,34701,63964,22432,24681,24903,27575,35518,37504,38577,20057,21535,28139,34093,38512,38899,39150,25558,27875,37009,20957,25033,33210,40441,20381,20506,20736,23452,24847,25087,25836,26885,27589,30097,30691,32681,33380,34191,34811,34915,35516,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,35696,37291,20108,20197,20234,63965,63966,22839,23016,63967,24050,24347,24411,24609,63968,63969,63970,63971,29246,29669,63972,30064,30157,63973,31227,63974,32780,32819,32900,33505,33617,63975,63976,36029,36019,36999,63977,63978,39156,39180,63979,63980,28727,30410,32714,32716,32764,35610,20154,20161,20995,21360,63981,21693,22240,23035,23493,24341,24525,28270,63982,63983,32106,33589,63984,34451,35469,63985,38765,38775,63986,63987,19968,20314,20350,22777,26085,28322,36920,37808,39353,20219,22764,22922,23001,24641,63988,63989,31252,63990,33615,36035,20837,21316,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,63991,63992,63993,20173,21097,23381,33471,20180,21050,21672,22985,23039,23376,23383,23388,24675,24904,28363,28825,29038,29574,29943,30133,30913,32043,32773,33258,33576,34071,34249,35566,36039,38604,20316,21242,22204,26027,26152,28796,28856,29237,32189,33421,37196,38592,40306,23409,26855,27544,28538,30430,23697,26283,28507,31668,31786,34870,38620,19976,20183,21280,22580,22715,22767,22892,23559,24115,24196,24373,25484,26290,26454,27167,27299,27404,28479,29254,63994,29520,29835,31456,31911,33144,33247,33255,33674,33900,34083,34196,34255,35037,36115,37292,38263,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,38556,20877,21705,22312,23472,25165,26448,26685,26771,28221,28371,28797,32289,35009,36001,36617,40779,40782,29229,31631,35533,37658,20295,20302,20786,21632,22992,24213,25269,26485,26990,27159,27822,28186,29401,29482,30141,31672,32053,33511,33785,33879,34295,35419,36015,36487,36889,37048,38606,40799,21219,21514,23265,23490,25688,25973,28404,29380,63995,30340,31309,31515,31821,32318,32735,33659,35627,36042,36196,36321,36447,36842,36857,36969,37841,20291,20346,20659,20840,20856,21069,21098,22625,22652,22880,23560,23637,24283,24731,25136,26643,27583,27656,28593,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,29006,29728,30000,30008,30033,30322,31564,31627,31661,31686,32399,35438,36670,36681,37439,37523,37666,37931,38651,39002,39019,39198,20999,25130,25240,27993,30308,31434,31680,32118,21344,23742,24215,28472,28857,31896,38673,39822,40670,25509,25722,34678,19969,20117,20141,20572,20597,21576,22979,23450,24128,24237,24311,24449,24773,25402,25919,25972,26060,26230,26232,26622,26984,27273,27491,27712,28096,28136,28191,28254,28702,28833,29582,29693,30010,30555,30855,31118,31243,31357,31934,32142,33351,35330,35562,35998,37165,37194,37336,37478,37580,37664,38662,38742,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,38748,38914,40718,21046,21137,21884,22564,24093,24351,24716,25552,26799,28639,31085,31532,33229,34234,35069,35576,36420,37261,38500,38555,38717,38988,40778,20430,20806,20939,21161,22066,24340,24427,25514,25805,26089,26177,26362,26361,26397,26781,26839,27133,28437,28526,29031,29157,29226,29866,30522,31062,31066,31199,31264,31381,31895,31967,32068,32368,32903,34299,34468,35412,35519,36249,36481,36896,36973,37347,38459,38613,40165,26063,31751,36275,37827,23384,23562,21330,25305,29469,20519,23447,24478,24752,24939,26837,28121,29742,31278,32066,32156,32305,33131,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36394,36405,37758,37912,20304,22352,24038,24231,25387,32618,20027,20303,20367,20570,23005,32964,21610,21608,22014,22863,23449,24030,24282,26205,26417,26609,26666,27880,27954,28234,28557,28855,29664,30087,31820,32002,32044,32162,33311,34523,35387,35461,36208,36490,36659,36913,37198,37202,37956,39376,31481,31909,20426,20737,20934,22472,23535,23803,26201,27197,27994,28310,28652,28940,30063,31459,34850,36897,36981,38603,39423,33537,20013,20210,34886,37325,21373,27355,26987,27713,33914,22686,24974,26366,25327,28893,29969,30151,32338,33976,35657,36104,20043,21482,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21675,22320,22336,24535,25345,25351,25711,25903,26088,26234,26525,26547,27490,27744,27802,28460,30693,30757,31049,31063,32025,32930,33026,33267,33437,33463,34584,35468,63996,36100,36286,36978,30452,31257,31287,32340,32887,21767,21972,22645,25391,25634,26185,26187,26733,27035,27524,27941,28337,29645,29800,29857,30043,30137,30433,30494,30603,31206,32265,32285,33275,34095,34967,35386,36049,36587,36784,36914,37805,38499,38515,38663,20356,21489,23018,23241,24089,26702,29894,30142,31209,31378,33187,34541,36074,36300,36845,26015,26389,63997,22519,28503,32221,36655,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,37878,38598,24501,25074,28548,19988,20376,20511,21449,21983,23919,24046,27425,27492,30923,31642,63998,36425,36554,36974,25417,25662,30528,31364,37679,38015,40810,25776,28591,29158,29864,29914,31428,31762,32386,31922,32408,35738,36106,38013,39184,39244,21049,23519,25830,26413,32046,20717,21443,22649,24920,24921,25082,26028,31449,35730,35734,20489,20513,21109,21809,23100,24288,24432,24884,25950,26124,26166,26274,27085,28356,28466,29462,30241,31379,33081,33369,33750,33980,20661,22512,23488,23528,24425,25505,30758,32181,33756,34081,37319,37365,20874,26613,31574,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36012,20932,22971,24765,34389,20508,63999,21076,23610,24957,25114,25299,25842,26021,28364,30240,33034,36448,38495,38587,20191,21315,21912,22825,24029,25797,27849,28154,29588,31359,33307,34214,36068,36368,36983,37351,38369,38433,38854,20984,21746,21894,24505,25764,28552,32180,36639,36685,37941,20681,23574,27838,28155,29979,30651,31805,31844,35449,35522,22558,22974,24086,25463,29266,30090,30571,35548,36028,36626,24307,26228,28152,32893,33729,35531,38737,39894,64000,21059,26367,28053,28399,32224,35558,36910,36958,39636,21021,21119,21736,24980,25220,25307,26786,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,26898,26970,27189,28818,28966,30813,30977,30990,31186,31245,32918,33400,33493,33609,34121,35970,36229,37218,37259,37294,20419,22225,29165,30679,34560,35320,23544,24534,26449,37032,21474,22618,23541,24740,24961,25696,32317,32880,34085,37507,25774,20652,23828,26368,22684,25277,25512,26894,27000,27166,28267,30394,31179,33467,33833,35535,36264,36861,37138,37195,37276,37648,37656,37786,38619,39478,39949,19985,30044,31069,31482,31569,31689,32302,33988,36441,36468,36600,36880,26149,26943,29763,20986,26414,40668,20805,24544,27798,34802,34909,34935,24756,33205,33795,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,36101,21462,21561,22068,23094,23601,28810,32736,32858,33030,33261,36259,37257,39519,40434,20596,20164,21408,24827,28204,23652,20360,20516,21988,23769,24159,24677,26772,27835,28100,29118,30164,30196,30305,31258,31305,32199,32251,32622,33268,34473,36636,38601,39347,40786,21063,21189,39149,35242,19971,26578,28422,20405,23522,26517,27784,28024,29723,30759,37341,37756,34756,31204,31281,24555,20182,21668,21822,22702,22949,24816,25171,25302,26422,26965,33333,38464,39345,39389,20524,21331,21828,22396,64001,25176,64002,25826,26219,26589,28609,28655,29730,29752,35351,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,37944,21585,22022,22374,24392,24986,27470,28760,28845,32187,35477,22890,33067,25506,30472,32829,36010,22612,25645,27067,23445,24081,28271,64003,34153,20812,21488,22826,24608,24907,27526,27760,27888,31518,32974,33492,36294,37040,39089,64004,25799,28580,25745,25860,20814,21520,22303,35342,24927,26742,64005,30171,31570,32113,36890,22534,27084,33151,35114,36864,38969,20600,22871,22956,25237,36879,39722,24925,29305,38358,22369,23110,24052,25226,25773,25850,26487,27874,27966,29228,29750,30772,32631,33453,36315,38935,21028,22338,26495,29256,29923,36009,36774,37393,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,38442,20843,21485,25420,20329,21764,24726,25943,27803,28031,29260,29437,31255,35207,35997,24429,28558,28921,33192,24846,20415,20559,25153,29255,31687,32232,32745,36941,38829,39449,36022,22378,24179,26544,33805,35413,21536,23318,24163,24290,24330,25987,32954,34109,38281,38491,20296,21253,21261,21263,21638,21754,22275,24067,24598,25243,25265,25429,64006,27873,28006,30129,30770,32990,33071,33502,33889,33970,34957,35090,36875,37610,39165,39825,24133,26292,26333,28689,29190,64007,20469,21117,24426,24915,26451,27161,28418,29922,31080,34920,35961,39111,39108,39491,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,21697,31263,26963,35575,35914,39080,39342,24444,25259,30130,30382,34987,36991,38466,21305,24380,24517,27852,29644,30050,30091,31558,33534,39325,20047,36924,19979,20309,21414,22799,24264,26160,27827,29781,33655,34662,36032,36944,38686,39957,22737,23416,34384,35604,40372,23506,24680,24717,26097,27735,28450,28579,28698,32597,32752,38289,38290,38480,38867,21106,36676,20989,21547,21688,21859,21898,27323,28085,32216,33382,37532,38519,40569,21512,21704,30418,34532,38308,38356,38492,20130,20233,23022,23270,24055,24658,25239,26477,26689,27782,28207,32568,32923,33322,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,64008,64009,38917,20133,20565,21683,22419,22874,23401,23475,25032,26999,28023,28707,34809,35299,35442,35559,36994,39405,39608,21182,26680,20502,24184,26447,33607,34892,20139,21521,22190,29670,37141,38911,39177,39255,39321,22099,22687,34395,35377,25010,27382,29563,36562,27463,38570,39511,22869,29184,36203,38761,20436,23796,24358,25080,26203,27883,28843,29572,29625,29694,30505,30541,32067,32098,32291,33335,34898,64010,36066,37449,39023,23377,31348,34880,38913,23244,20448,21332,22846,23805,25406,28025,29433,33029,33031,33698,37583,38960,20136,20804,21009,22411,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,24418,27842,28366,28677,28752,28847,29074,29673,29801,33610,34722,34913,36872,37026,37795,39336,20846,24407,24800,24935,26291,34137,36426,37295,38795,20046,20114,21628,22741,22778,22909,23733,24359,25142,25160,26122,26215,27627,28009,28111,28246,28408,28564,28640,28649,28765,29392,29733,29786,29920,30355,31068,31946,32286,32993,33446,33899,33983,34382,34399,34676,35703,35946,37804,38912,39013,24785,25110,37239,23130,26127,28151,28222,29759,39746,24573,24794,31503,21700,24344,27742,27859,27946,28888,32005,34425,35340,40251,21270,21644,23301,27194,28779,30069,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,31117,31166,33457,33775,35441,35649,36008,38772,64011,25844,25899,30906,30907,31339,20024,21914,22864,23462,24187,24739,25563,27489,26213,26707,28185,29029,29872,32008,36996,39529,39973,27963,28369,29502,35905,38346,20976,24140,24488,24653,24822,24880,24908,26179,26180,27045,27841,28255,28361,28514,29004,29852,30343,31681,31783,33618,34647,36945,38541,40643,21295,22238,24315,24458,24674,24724,25079,26214,26371,27292,28142,28590,28784,29546,32362,33214,33588,34516,35496,36036,21123,29554,23446,27243,37892,21742,22150,23389,25928,25989,26313,26783,28045,28102,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,29243,32948,37237,39501,20399,20505,21402,21518,21564,21897,21957,24127,24460,26429,29030,29661,36869,21211,21235,22628,22734,28932,29071,29179,34224,35347,26248,34216,21927,26244,29002,33841,21321,21913,27585,24409,24509,25582,26249,28999,35569,36637,40638,20241,25658,28875,30054,34407,24676,35662,40440,20807,20982,21256,27958,33016,40657,26133,27427,28824,30165,21507,23673,32007,35350,27424,27453,27462,21560,24688,27965,32725,33288,20694,20958,21916,22123,22221,23020,23305,24076,24985,24984,25137,26206,26342,29081,29113,29114,29351,31143,31232,32690,35440,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\n \"gb18030\":[19970,19972,19973,19974,19983,19986,19991,19999,20000,20001,20003,20006,20009,20014,20015,20017,20019,20021,20023,20028,20032,20033,20034,20036,20038,20042,20049,20053,20055,20058,20059,20066,20067,20068,20069,20071,20072,20074,20075,20076,20077,20078,20079,20082,20084,20085,20086,20087,20088,20089,20090,20091,20092,20093,20095,20096,20097,20098,20099,20100,20101,20103,20106,20112,20118,20119,20121,20124,20125,20126,20131,20138,20143,20144,20145,20148,20150,20151,20152,20153,20156,20157,20158,20168,20172,20175,20176,20178,20186,20187,20188,20192,20194,20198,20199,20201,20205,20206,20207,20209,20212,20216,20217,20218,20220,20222,20224,20226,20227,20228,20229,20230,20231,20232,20235,20236,20242,20243,20244,20245,20246,20252,20253,20257,20259,20264,20265,20268,20269,20270,20273,20275,20277,20279,20281,20283,20286,20287,20288,20289,20290,20292,20293,20295,20296,20297,20298,20299,20300,20306,20308,20310,20321,20322,20326,20328,20330,20331,20333,20334,20337,20338,20341,20343,20344,20345,20346,20349,20352,20353,20354,20357,20358,20359,20362,20364,20366,20368,20370,20371,20373,20374,20376,20377,20378,20380,20382,20383,20385,20386,20388,20395,20397,20400,20401,20402,20403,20404,20406,20407,20408,20409,20410,20411,20412,20413,20414,20416,20417,20418,20422,20423,20424,20425,20427,20428,20429,20434,20435,20436,20437,20438,20441,20443,20448,20450,20452,20453,20455,20459,20460,20464,20466,20468,20469,20470,20471,20473,20475,20476,20477,20479,20480,20481,20482,20483,20484,20485,20486,20487,20488,20489,20490,20491,20494,20496,20497,20499,20501,20502,20503,20507,20509,20510,20512,20514,20515,20516,20519,20523,20527,20528,20529,20530,20531,20532,20533,20534,20535,20536,20537,20539,20541,20543,20544,20545,20546,20548,20549,20550,20553,20554,20555,20557,20560,20561,20562,20563,20564,20566,20567,20568,20569,20571,20573,20574,20575,20576,20577,20578,20579,20580,20582,20583,20584,20585,20586,20587,20589,20590,20591,20592,20593,20594,20595,20596,20597,20600,20601,20602,20604,20605,20609,20610,20611,20612,20614,20615,20617,20618,20619,20620,20622,20623,20624,20625,20626,20627,20628,20629,20630,20631,20632,20633,20634,20635,20636,20637,20638,20639,20640,20641,20642,20644,20646,20650,20651,20653,20654,20655,20656,20657,20659,20660,20661,20662,20663,20664,20665,20668,20669,20670,20671,20672,20673,20674,20675,20676,20677,20678,20679,20680,20681,20682,20683,20684,20685,20686,20688,20689,20690,20691,20692,20693,20695,20696,20697,20699,20700,20701,20702,20703,20704,20705,20706,20707,20708,20709,20712,20713,20714,20715,20719,20720,20721,20722,20724,20726,20727,20728,20729,20730,20732,20733,20734,20735,20736,20737,20738,20739,20740,20741,20744,20745,20746,20748,20749,20750,20751,20752,20753,20755,20756,20757,20758,20759,20760,20761,20762,20763,20764,20765,20766,20767,20768,20770,20771,20772,20773,20774,20775,20776,20777,20778,20779,20780,20781,20782,20783,20784,20785,20786,20787,20788,20789,20790,20791,20792,20793,20794,20795,20796,20797,20798,20802,20807,20810,20812,20814,20815,20816,20818,20819,20823,20824,20825,20827,20829,20830,20831,20832,20833,20835,20836,20838,20839,20841,20842,20847,20850,20858,20862,20863,20867,20868,20870,20871,20874,20875,20878,20879,20880,20881,20883,20884,20888,20890,20893,20894,20895,20897,20899,20902,20903,20904,20905,20906,20909,20910,20916,20920,20921,20922,20926,20927,20929,20930,20931,20933,20936,20938,20941,20942,20944,20946,20947,20948,20949,20950,20951,20952,20953,20954,20956,20958,20959,20962,20963,20965,20966,20967,20968,20969,20970,20972,20974,20977,20978,20980,20983,20990,20996,20997,21001,21003,21004,21007,21008,21011,21012,21013,21020,21022,21023,21025,21026,21027,21029,21030,21031,21034,21036,21039,21041,21042,21044,21045,21052,21054,21060,21061,21062,21063,21064,21065,21067,21070,21071,21074,21075,21077,21079,21080,21081,21082,21083,21085,21087,21088,21090,21091,21092,21094,21096,21099,21100,21101,21102,21104,21105,21107,21108,21109,21110,21111,21112,21113,21114,21115,21116,21118,21120,21123,21124,21125,21126,21127,21129,21130,21131,21132,21133,21134,21135,21137,21138,21140,21141,21142,21143,21144,21145,21146,21148,21156,21157,21158,21159,21166,21167,21168,21172,21173,21174,21175,21176,21177,21178,21179,21180,21181,21184,21185,21186,21188,21189,21190,21192,21194,21196,21197,21198,21199,21201,21203,21204,21205,21207,21209,21210,21211,21212,21213,21214,21216,21217,21218,21219,21221,21222,21223,21224,21225,21226,21227,21228,21229,21230,21231,21233,21234,21235,21236,21237,21238,21239,21240,21243,21244,21245,21249,21250,21251,21252,21255,21257,21258,21259,21260,21262,21265,21266,21267,21268,21272,21275,21276,21278,21279,21282,21284,21285,21287,21288,21289,21291,21292,21293,21295,21296,21297,21298,21299,21300,21301,21302,21303,21304,21308,21309,21312,21314,21316,21318,21323,21324,21325,21328,21332,21336,21337,21339,21341,21349,21352,21354,21356,21357,21362,21366,21369,21371,21372,21373,21374,21376,21377,21379,21383,21384,21386,21390,21391,21392,21393,21394,21395,21396,21398,21399,21401,21403,21404,21406,21408,21409,21412,21415,21418,21419,21420,21421,21423,21424,21425,21426,21427,21428,21429,21431,21432,21433,21434,21436,21437,21438,21440,21443,21444,21445,21446,21447,21454,21455,21456,21458,21459,21461,21466,21468,21469,21470,21473,21474,21479,21492,21498,21502,21503,21504,21506,21509,21511,21515,21524,21528,21529,21530,21532,21538,21540,21541,21546,21552,21555,21558,21559,21562,21565,21567,21569,21570,21572,21573,21575,21577,21580,21581,21582,21583,21585,21594,21597,21598,21599,21600,21601,21603,21605,21607,21609,21610,21611,21612,21613,21614,21615,21616,21620,21625,21626,21630,21631,21633,21635,21637,21639,21640,21641,21642,21645,21649,21651,21655,21656,21660,21662,21663,21664,21665,21666,21669,21678,21680,21682,21685,21686,21687,21689,21690,21692,21694,21699,21701,21706,21707,21718,21720,21723,21728,21729,21730,21731,21732,21739,21740,21743,21744,21745,21748,21749,21750,21751,21752,21753,21755,21758,21760,21762,21763,21764,21765,21768,21770,21771,21772,21773,21774,21778,21779,21781,21782,21783,21784,21785,21786,21788,21789,21790,21791,21793,21797,21798,21800,21801,21803,21805,21810,21812,21813,21814,21816,21817,21818,21819,21821,21824,21826,21829,21831,21832,21835,21836,21837,21838,21839,21841,21842,21843,21844,21847,21848,21849,21850,21851,21853,21854,21855,21856,21858,21859,21864,21865,21867,21871,21872,21873,21874,21875,21876,21881,21882,21885,21887,21893,21894,21900,21901,21902,21904,21906,21907,21909,21910,21911,21914,21915,21918,21920,21921,21922,21923,21924,21925,21926,21928,21929,21930,21931,21932,21933,21934,21935,21936,21938,21940,21942,21944,21946,21948,21951,21952,21953,21954,21955,21958,21959,21960,21962,21963,21966,21967,21968,21973,21975,21976,21977,21978,21979,21982,21984,21986,21991,21993,21997,21998,22000,22001,22004,22006,22008,22009,22010,22011,22012,22015,22018,22019,22020,22021,22022,22023,22026,22027,22029,22032,22033,22034,22035,22036,22037,22038,22039,22041,22042,22044,22045,22048,22049,22050,22053,22054,22056,22057,22058,22059,22062,22063,22064,22067,22069,22071,22072,22074,22076,22077,22078,22080,22081,22082,22083,22084,22085,22086,22087,22088,22089,22090,22091,22095,22096,22097,22098,22099,22101,22102,22106,22107,22109,22110,22111,22112,22113,22115,22117,22118,22119,22125,22126,22127,22128,22130,22131,22132,22133,22135,22136,22137,22138,22141,22142,22143,22144,22145,22146,22147,22148,22151,22152,22153,22154,22155,22156,22157,22160,22161,22162,22164,22165,22166,22167,22168,22169,22170,22171,22172,22173,22174,22175,22176,22177,22178,22180,22181,22182,22183,22184,22185,22186,22187,22188,22189,22190,22192,22193,22194,22195,22196,22197,22198,22200,22201,22202,22203,22205,22206,22207,22208,22209,22210,22211,22212,22213,22214,22215,22216,22217,22219,22220,22221,22222,22223,22224,22225,22226,22227,22229,22230,22232,22233,22236,22243,22245,22246,22247,22248,22249,22250,22252,22254,22255,22258,22259,22262,22263,22264,22267,22268,22272,22273,22274,22277,22279,22283,22284,22285,22286,22287,22288,22289,22290,22291,22292,22293,22294,22295,22296,22297,22298,22299,22301,22302,22304,22305,22306,22308,22309,22310,22311,22315,22321,22322,22324,22325,22326,22327,22328,22332,22333,22335,22337,22339,22340,22341,22342,22344,22345,22347,22354,22355,22356,22357,22358,22360,22361,22370,22371,22373,22375,22380,22382,22384,22385,22386,22388,22389,22392,22393,22394,22397,22398,22399,22400,22401,22407,22408,22409,22410,22413,22414,22415,22416,22417,22420,22421,22422,22423,22424,22425,22426,22428,22429,22430,22431,22437,22440,22442,22444,22447,22448,22449,22451,22453,22454,22455,22457,22458,22459,22460,22461,22462,22463,22464,22465,22468,22469,22470,22471,22472,22473,22474,22476,22477,22480,22481,22483,22486,22487,22491,22492,22494,22497,22498,22499,22501,22502,22503,22504,22505,22506,22507,22508,22510,22512,22513,22514,22515,22517,22518,22519,22523,22524,22526,22527,22529,22531,22532,22533,22536,22537,22538,22540,22542,22543,22544,22546,22547,22548,22550,22551,22552,22554,22555,22556,22557,22559,22562,22563,22565,22566,22567,22568,22569,22571,22572,22573,22574,22575,22577,22578,22579,22580,22582,22583,22584,22585,22586,22587,22588,22589,22590,22591,22592,22593,22594,22595,22597,22598,22599,22600,22601,22602,22603,22606,22607,22608,22610,22611,22613,22614,22615,22617,22618,22619,22620,22621,22623,22624,22625,22626,22627,22628,22630,22631,22632,22633,22634,22637,22638,22639,22640,22641,22642,22643,22644,22645,22646,22647,22648,22649,22650,22651,22652,22653,22655,22658,22660,22662,22663,22664,22666,22667,22668,22669,22670,22671,22672,22673,22676,22677,22678,22679,22680,22683,22684,22685,22688,22689,22690,22691,22692,22693,22694,22695,22698,22699,22700,22701,22702,22703,22704,22705,22706,22707,22708,22709,22710,22711,22712,22713,22714,22715,22717,22718,22719,22720,22722,22723,22724,22726,22727,22728,22729,22730,22731,22732,22733,22734,22735,22736,22738,22739,22740,22742,22743,22744,22745,22746,22747,22748,22749,22750,22751,22752,22753,22754,22755,22757,22758,22759,22760,22761,22762,22765,22767,22769,22770,22772,22773,22775,22776,22778,22779,22780,22781,22782,22783,22784,22785,22787,22789,22790,22792,22793,22794,22795,22796,22798,22800,22801,22802,22803,22807,22808,22811,22813,22814,22816,22817,22818,22819,22822,22824,22828,22832,22834,22835,22837,22838,22843,22845,22846,22847,22848,22851,22853,22854,22858,22860,22861,22864,22866,22867,22873,22875,22876,22877,22878,22879,22881,22883,22884,22886,22887,22888,22889,22890,22891,22892,22893,22894,22895,22896,22897,22898,22901,22903,22906,22907,22908,22910,22911,22912,22917,22921,22923,22924,22926,22927,22928,22929,22932,22933,22936,22938,22939,22940,22941,22943,22944,22945,22946,22950,22951,22956,22957,22960,22961,22963,22964,22965,22966,22967,22968,22970,22972,22973,22975,22976,22977,22978,22979,22980,22981,22983,22984,22985,22988,22989,22990,22991,22997,22998,23001,23003,23006,23007,23008,23009,23010,23012,23014,23015,23017,23018,23019,23021,23022,23023,23024,23025,23026,23027,23028,23029,23030,23031,23032,23034,23036,23037,23038,23040,23042,23050,23051,23053,23054,23055,23056,23058,23060,23061,23062,23063,23065,23066,23067,23069,23070,23073,23074,23076,23078,23079,23080,23082,23083,23084,23085,23086,23087,23088,23091,23093,23095,23096,23097,23098,23099,23101,23102,23103,23105,23106,23107,23108,23109,23111,23112,23115,23116,23117,23118,23119,23120,23121,23122,23123,23124,23126,23127,23128,23129,23131,23132,23133,23134,23135,23136,23137,23139,23140,23141,23142,23144,23145,23147,23148,23149,23150,23151,23152,23153,23154,23155,23160,23161,23163,23164,23165,23166,23168,23169,23170,23171,23172,23173,23174,23175,23176,23177,23178,23179,23180,23181,23182,23183,23184,23185,23187,23188,23189,23190,23191,23192,23193,23196,23197,23198,23199,23200,23201,23202,23203,23204,23205,23206,23207,23208,23209,23211,23212,23213,23214,23215,23216,23217,23220,23222,23223,23225,23226,23227,23228,23229,23231,23232,23235,23236,23237,23238,23239,23240,23242,23243,23245,23246,23247,23248,23249,23251,23253,23255,23257,23258,23259,23261,23262,23263,23266,23268,23269,23271,23272,23274,23276,23277,23278,23279,23280,23282,23283,23284,23285,23286,23287,23288,23289,23290,23291,23292,23293,23294,23295,23296,23297,23298,23299,23300,23301,23302,23303,23304,23306,23307,23308,23309,23310,23311,23312,23313,23314,23315,23316,23317,23320,23321,23322,23323,23324,23325,23326,23327,23328,23329,23330,23331,23332,23333,23334,23335,23336,23337,23338,23339,23340,23341,23342,23343,23344,23345,23347,23349,23350,23352,23353,23354,23355,23356,23357,23358,23359,23361,23362,23363,23364,23365,23366,23367,23368,23369,23370,23371,23372,23373,23374,23375,23378,23382,23390,23392,23393,23399,23400,23403,23405,23406,23407,23410,23412,23414,23415,23416,23417,23419,23420,23422,23423,23426,23430,23434,23437,23438,23440,23441,23442,23444,23446,23455,23463,23464,23465,23468,23469,23470,23471,23473,23474,23479,23482,23483,23484,23488,23489,23491,23496,23497,23498,23499,23501,23502,23503,23505,23508,23509,23510,23511,23512,23513,23514,23515,23516,23520,23522,23523,23526,23527,23529,23530,23531,23532,23533,23535,23537,23538,23539,23540,23541,23542,23543,23549,23550,23552,23554,23555,23557,23559,23560,23563,23564,23565,23566,23568,23570,23571,23575,23577,23579,23582,23583,23584,23585,23587,23590,23592,23593,23594,23595,23597,23598,23599,23600,23602,23603,23605,23606,23607,23619,23620,23622,23623,23628,23629,23634,23635,23636,23638,23639,23640,23642,23643,23644,23645,23647,23650,23652,23655,23656,23657,23658,23659,23660,23661,23664,23666,23667,23668,23669,23670,23671,23672,23675,23676,23677,23678,23680,23683,23684,23685,23686,23687,23689,23690,23691,23694,23695,23698,23699,23701,23709,23710,23711,23712,23713,23716,23717,23718,23719,23720,23722,23726,23727,23728,23730,23732,23734,23737,23738,23739,23740,23742,23744,23746,23747,23749,23750,23751,23752,23753,23754,23756,23757,23758,23759,23760,23761,23763,23764,23765,23766,23767,23768,23770,23771,23772,23773,23774,23775,23776,23778,23779,23783,23785,23787,23788,23790,23791,23793,23794,23795,23796,23797,23798,23799,23800,23801,23802,23804,23805,23806,23807,23808,23809,23812,23813,23816,23817,23818,23819,23820,23821,23823,23824,23825,23826,23827,23829,23831,23832,23833,23834,23836,23837,23839,23840,23841,23842,23843,23845,23848,23850,23851,23852,23855,23856,23857,23858,23859,23861,23862,23863,23864,23865,23866,23867,23868,23871,23872,23873,23874,23875,23876,23877,23878,23880,23881,23885,23886,23887,23888,23889,23890,23891,23892,23893,23894,23895,23897,23898,23900,23902,23903,23904,23905,23906,23907,23908,23909,23910,23911,23912,23914,23917,23918,23920,23921,23922,23923,23925,23926,23927,23928,23929,23930,23931,23932,23933,23934,23935,23936,23937,23939,23940,23941,23942,23943,23944,23945,23946,23947,23948,23949,23950,23951,23952,23953,23954,23955,23956,23957,23958,23959,23960,23962,23963,23964,23966,23967,23968,23969,23970,23971,23972,23973,23974,23975,23976,23977,23978,23979,23980,23981,23982,23983,23984,23985,23986,23987,23988,23989,23990,23992,23993,23994,23995,23996,23997,23998,23999,24000,24001,24002,24003,24004,24006,24007,24008,24009,24010,24011,24012,24014,24015,24016,24017,24018,24019,24020,24021,24022,24023,24024,24025,24026,24028,24031,24032,24035,24036,24042,24044,24045,24048,24053,24054,24056,24057,24058,24059,24060,24063,24064,24068,24071,24073,24074,24075,24077,24078,24082,24083,24087,24094,24095,24096,24097,24098,24099,24100,24101,24104,24105,24106,24107,24108,24111,24112,24114,24115,24116,24117,24118,24121,24122,24126,24127,24128,24129,24131,24134,24135,24136,24137,24138,24139,24141,24142,24143,24144,24145,24146,24147,24150,24151,24152,24153,24154,24156,24157,24159,24160,24163,24164,24165,24166,24167,24168,24169,24170,24171,24172,24173,24174,24175,24176,24177,24181,24183,24185,24190,24193,24194,24195,24197,24200,24201,24204,24205,24206,24210,24216,24219,24221,24225,24226,24227,24228,24232,24233,24234,24235,24236,24238,24239,24240,24241,24242,24244,24250,24251,24252,24253,24255,24256,24257,24258,24259,24260,24261,24262,24263,24264,24267,24268,24269,24270,24271,24272,24276,24277,24279,24280,24281,24282,24284,24285,24286,24287,24288,24289,24290,24291,24292,24293,24294,24295,24297,24299,24300,24301,24302,24303,24304,24305,24306,24307,24309,24312,24313,24315,24316,24317,24325,24326,24327,24329,24332,24333,24334,24336,24338,24340,24342,24345,24346,24348,24349,24350,24353,24354,24355,24356,24360,24363,24364,24366,24368,24370,24371,24372,24373,24374,24375,24376,24379,24381,24382,24383,24385,24386,24387,24388,24389,24390,24391,24392,24393,24394,24395,24396,24397,24398,24399,24401,24404,24409,24410,24411,24412,24414,24415,24416,24419,24421,24423,24424,24427,24430,24431,24434,24436,24437,24438,24440,24442,24445,24446,24447,24451,24454,24461,24462,24463,24465,24467,24468,24470,24474,24475,24477,24478,24479,24480,24482,24483,24484,24485,24486,24487,24489,24491,24492,24495,24496,24497,24498,24499,24500,24502,24504,24505,24506,24507,24510,24511,24512,24513,24514,24519,24520,24522,24523,24526,24531,24532,24533,24538,24539,24540,24542,24543,24546,24547,24549,24550,24552,24553,24556,24559,24560,24562,24563,24564,24566,24567,24569,24570,24572,24583,24584,24585,24587,24588,24592,24593,24595,24599,24600,24602,24606,24607,24610,24611,24612,24620,24621,24622,24624,24625,24626,24627,24628,24630,24631,24632,24633,24634,24637,24638,24640,24644,24645,24646,24647,24648,24649,24650,24652,24654,24655,24657,24659,24660,24662,24663,24664,24667,24668,24670,24671,24672,24673,24677,24678,24686,24689,24690,24692,24693,24695,24702,24704,24705,24706,24709,24710,24711,24712,24714,24715,24718,24719,24720,24721,24723,24725,24727,24728,24729,24732,24734,24737,24738,24740,24741,24743,24745,24746,24750,24752,24755,24757,24758,24759,24761,24762,24765,24766,24767,24768,24769,24770,24771,24772,24775,24776,24777,24780,24781,24782,24783,24784,24786,24787,24788,24790,24791,24793,24795,24798,24801,24802,24803,24804,24805,24810,24817,24818,24821,24823,24824,24827,24828,24829,24830,24831,24834,24835,24836,24837,24839,24842,24843,24844,24848,24849,24850,24851,24852,24854,24855,24856,24857,24859,24860,24861,24862,24865,24866,24869,24872,24873,24874,24876,24877,24878,24879,24880,24881,24882,24883,24884,24885,24886,24887,24888,24889,24890,24891,24892,24893,24894,24896,24897,24898,24899,24900,24901,24902,24903,24905,24907,24909,24911,24912,24914,24915,24916,24918,24919,24920,24921,24922,24923,24924,24926,24927,24928,24929,24931,24932,24933,24934,24937,24938,24939,24940,24941,24942,24943,24945,24946,24947,24948,24950,24952,24953,24954,24955,24956,24957,24958,24959,24960,24961,24962,24963,24964,24965,24966,24967,24968,24969,24970,24972,24973,24975,24976,24977,24978,24979,24981,24982,24983,24984,24985,24986,24987,24988,24990,24991,24992,24993,24994,24995,24996,24997,24998,25002,25003,25005,25006,25007,25008,25009,25010,25011,25012,25013,25014,25016,25017,25018,25019,25020,25021,25023,25024,25025,25027,25028,25029,25030,25031,25033,25036,25037,25038,25039,25040,25043,25045,25046,25047,25048,25049,25050,25051,25052,25053,25054,25055,25056,25057,25058,25059,25060,25061,25063,25064,25065,25066,25067,25068,25069,25070,25071,25072,25073,25074,25075,25076,25078,25079,25080,25081,25082,25083,25084,25085,25086,25088,25089,25090,25091,25092,25093,25095,25097,25107,25108,25113,25116,25117,25118,25120,25123,25126,25127,25128,25129,25131,25133,25135,25136,25137,25138,25141,25142,25144,25145,25146,25147,25148,25154,25156,25157,25158,25162,25167,25168,25173,25174,25175,25177,25178,25180,25181,25182,25183,25184,25185,25186,25188,25189,25192,25201,25202,25204,25205,25207,25208,25210,25211,25213,25217,25218,25219,25221,25222,25223,25224,25227,25228,25229,25230,25231,25232,25236,25241,25244,25245,25246,25251,25254,25255,25257,25258,25261,25262,25263,25264,25266,25267,25268,25270,25271,25272,25274,25278,25280,25281,25283,25291,25295,25297,25301,25309,25310,25312,25313,25316,25322,25323,25328,25330,25333,25336,25337,25338,25339,25344,25347,25348,25349,25350,25354,25355,25356,25357,25359,25360,25362,25363,25364,25365,25367,25368,25369,25372,25382,25383,25385,25388,25389,25390,25392,25393,25395,25396,25397,25398,25399,25400,25403,25404,25406,25407,25408,25409,25412,25415,25416,25418,25425,25426,25427,25428,25430,25431,25432,25433,25434,25435,25436,25437,25440,25444,25445,25446,25448,25450,25451,25452,25455,25456,25458,25459,25460,25461,25464,25465,25468,25469,25470,25471,25473,25475,25476,25477,25478,25483,25485,25489,25491,25492,25493,25495,25497,25498,25499,25500,25501,25502,25503,25505,25508,25510,25515,25519,25521,25522,25525,25526,25529,25531,25533,25535,25536,25537,25538,25539,25541,25543,25544,25546,25547,25548,25553,25555,25556,25557,25559,25560,25561,25562,25563,25564,25565,25567,25570,25572,25573,25574,25575,25576,25579,25580,25582,25583,25584,25585,25587,25589,25591,25593,25594,25595,25596,25598,25603,25604,25606,25607,25608,25609,25610,25613,25614,25617,25618,25621,25622,25623,25624,25625,25626,25629,25631,25634,25635,25636,25637,25639,25640,25641,25643,25646,25647,25648,25649,25650,25651,25653,25654,25655,25656,25657,25659,25660,25662,25664,25666,25667,25673,25675,25676,25677,25678,25679,25680,25681,25683,25685,25686,25687,25689,25690,25691,25692,25693,25695,25696,25697,25698,25699,25700,25701,25702,25704,25706,25707,25708,25710,25711,25712,25713,25714,25715,25716,25717,25718,25719,25723,25724,25725,25726,25727,25728,25729,25731,25734,25736,25737,25738,25739,25740,25741,25742,25743,25744,25747,25748,25751,25752,25754,25755,25756,25757,25759,25760,25761,25762,25763,25765,25766,25767,25768,25770,25771,25775,25777,25778,25779,25780,25782,25785,25787,25789,25790,25791,25793,25795,25796,25798,25799,25800,25801,25802,25803,25804,25807,25809,25811,25812,25813,25814,25817,25818,25819,25820,25821,25823,25824,25825,25827,25829,25831,25832,25833,25834,25835,25836,25837,25838,25839,25840,25841,25842,25843,25844,25845,25846,25847,25848,25849,25850,25851,25852,25853,25854,25855,25857,25858,25859,25860,25861,25862,25863,25864,25866,25867,25868,25869,25870,25871,25872,25873,25875,25876,25877,25878,25879,25881,25882,25883,25884,25885,25886,25887,25888,25889,25890,25891,25892,25894,25895,25896,25897,25898,25900,25901,25904,25905,25906,25907,25911,25914,25916,25917,25920,25921,25922,25923,25924,25926,25927,25930,25931,25933,25934,25936,25938,25939,25940,25943,25944,25946,25948,25951,25952,25953,25956,25957,25959,25960,25961,25962,25965,25966,25967,25969,25971,25973,25974,25976,25977,25978,25979,25980,25981,25982,25983,25984,25985,25986,25987,25988,25989,25990,25992,25993,25994,25997,25998,25999,26002,26004,26005,26006,26008,26010,26013,26014,26016,26018,26019,26022,26024,26026,26028,26030,26033,26034,26035,26036,26037,26038,26039,26040,26042,26043,26046,26047,26048,26050,26055,26056,26057,26058,26061,26064,26065,26067,26068,26069,26072,26073,26074,26075,26076,26077,26078,26079,26081,26083,26084,26090,26091,26098,26099,26100,26101,26104,26105,26107,26108,26109,26110,26111,26113,26116,26117,26119,26120,26121,26123,26125,26128,26129,26130,26134,26135,26136,26138,26139,26140,26142,26145,26146,26147,26148,26150,26153,26154,26155,26156,26158,26160,26162,26163,26167,26168,26169,26170,26171,26173,26175,26176,26178,26180,26181,26182,26183,26184,26185,26186,26189,26190,26192,26193,26200,26201,26203,26204,26205,26206,26208,26210,26211,26213,26215,26217,26218,26219,26220,26221,26225,26226,26227,26229,26232,26233,26235,26236,26237,26239,26240,26241,26243,26245,26246,26248,26249,26250,26251,26253,26254,26255,26256,26258,26259,26260,26261,26264,26265,26266,26267,26268,26270,26271,26272,26273,26274,26275,26276,26277,26278,26281,26282,26283,26284,26285,26287,26288,26289,26290,26291,26293,26294,26295,26296,26298,26299,26300,26301,26303,26304,26305,26306,26307,26308,26309,26310,26311,26312,26313,26314,26315,26316,26317,26318,26319,26320,26321,26322,26323,26324,26325,26326,26327,26328,26330,26334,26335,26336,26337,26338,26339,26340,26341,26343,26344,26346,26347,26348,26349,26350,26351,26353,26357,26358,26360,26362,26363,26365,26369,26370,26371,26372,26373,26374,26375,26380,26382,26383,26385,26386,26387,26390,26392,26393,26394,26396,26398,26400,26401,26402,26403,26404,26405,26407,26409,26414,26416,26418,26419,26422,26423,26424,26425,26427,26428,26430,26431,26433,26436,26437,26439,26442,26443,26445,26450,26452,26453,26455,26456,26457,26458,26459,26461,26466,26467,26468,26470,26471,26475,26476,26478,26481,26484,26486,26488,26489,26490,26491,26493,26496,26498,26499,26501,26502,26504,26506,26508,26509,26510,26511,26513,26514,26515,26516,26518,26521,26523,26527,26528,26529,26532,26534,26537,26540,26542,26545,26546,26548,26553,26554,26555,26556,26557,26558,26559,26560,26562,26565,26566,26567,26568,26569,26570,26571,26572,26573,26574,26581,26582,26583,26587,26591,26593,26595,26596,26598,26599,26600,26602,26603,26605,26606,26610,26613,26614,26615,26616,26617,26618,26619,26620,26622,26625,26626,26627,26628,26630,26637,26640,26642,26644,26645,26648,26649,26650,26651,26652,26654,26655,26656,26658,26659,26660,26661,26662,26663,26664,26667,26668,26669,26670,26671,26672,26673,26676,26677,26678,26682,26683,26687,26695,26699,26701,26703,26706,26710,26711,26712,26713,26714,26715,26716,26717,26718,26719,26730,26732,26733,26734,26735,26736,26737,26738,26739,26741,26744,26745,26746,26747,26748,26749,26750,26751,26752,26754,26756,26759,26760,26761,26762,26763,26764,26765,26766,26768,26769,26770,26772,26773,26774,26776,26777,26778,26779,26780,26781,26782,26783,26784,26785,26787,26788,26789,26793,26794,26795,26796,26798,26801,26802,26804,26806,26807,26808,26809,26810,26811,26812,26813,26814,26815,26817,26819,26820,26821,26822,26823,26824,26826,26828,26830,26831,26832,26833,26835,26836,26838,26839,26841,26843,26844,26845,26846,26847,26849,26850,26852,26853,26854,26855,26856,26857,26858,26859,26860,26861,26863,26866,26867,26868,26870,26871,26872,26875,26877,26878,26879,26880,26882,26883,26884,26886,26887,26888,26889,26890,26892,26895,26897,26899,26900,26901,26902,26903,26904,26905,26906,26907,26908,26909,26910,26913,26914,26915,26917,26918,26919,26920,26921,26922,26923,26924,26926,26927,26929,26930,26931,26933,26934,26935,26936,26938,26939,26940,26942,26944,26945,26947,26948,26949,26950,26951,26952,26953,26954,26955,26956,26957,26958,26959,26960,26961,26962,26963,26965,26966,26968,26969,26971,26972,26975,26977,26978,26980,26981,26983,26984,26985,26986,26988,26989,26991,26992,26994,26995,26996,26997,26998,27002,27003,27005,27006,27007,27009,27011,27013,27018,27019,27020,27022,27023,27024,27025,27026,27027,27030,27031,27033,27034,27037,27038,27039,27040,27041,27042,27043,27044,27045,27046,27049,27050,27052,27054,27055,27056,27058,27059,27061,27062,27064,27065,27066,27068,27069,27070,27071,27072,27074,27075,27076,27077,27078,27079,27080,27081,27083,27085,27087,27089,27090,27091,27093,27094,27095,27096,27097,27098,27100,27101,27102,27105,27106,27107,27108,27109,27110,27111,27112,27113,27114,27115,27116,27118,27119,27120,27121,27123,27124,27125,27126,27127,27128,27129,27130,27131,27132,27134,27136,27137,27138,27139,27140,27141,27142,27143,27144,27145,27147,27148,27149,27150,27151,27152,27153,27154,27155,27156,27157,27158,27161,27162,27163,27164,27165,27166,27168,27170,27171,27172,27173,27174,27175,27177,27179,27180,27181,27182,27184,27186,27187,27188,27190,27191,27192,27193,27194,27195,27196,27199,27200,27201,27202,27203,27205,27206,27208,27209,27210,27211,27212,27213,27214,27215,27217,27218,27219,27220,27221,27222,27223,27226,27228,27229,27230,27231,27232,27234,27235,27236,27238,27239,27240,27241,27242,27243,27244,27245,27246,27247,27248,27250,27251,27252,27253,27254,27255,27256,27258,27259,27261,27262,27263,27265,27266,27267,27269,27270,27271,27272,27273,27274,27275,27276,27277,27279,27282,27283,27284,27285,27286,27288,27289,27290,27291,27292,27293,27294,27295,27297,27298,27299,27300,27301,27302,27303,27304,27306,27309,27310,27311,27312,27313,27314,27315,27316,27317,27318,27319,27320,27321,27322,27323,27324,27325,27326,27327,27328,27329,27330,27331,27332,27333,27334,27335,27336,27337,27338,27339,27340,27341,27342,27343,27344,27345,27346,27347,27348,27349,27350,27351,27352,27353,27354,27355,27356,27357,27358,27359,27360,27361,27362,27363,27364,27365,27366,27367,27368,27369,27370,27371,27372,27373,27374,27375,27376,27377,27378,27379,27380,27381,27382,27383,27384,27385,27386,27387,27388,27389,27390,27391,27392,27393,27394,27395,27396,27397,27398,27399,27400,27401,27402,27403,27404,27405,27406,27407,27408,27409,27410,27411,27412,27413,27414,27415,27416,27417,27418,27419,27420,27421,27422,27423,27429,27430,27432,27433,27434,27435,27436,27437,27438,27439,27440,27441,27443,27444,27445,27446,27448,27451,27452,27453,27455,27456,27457,27458,27460,27461,27464,27466,27467,27469,27470,27471,27472,27473,27474,27475,27476,27477,27478,27479,27480,27482,27483,27484,27485,27486,27487,27488,27489,27496,27497,27499,27500,27501,27502,27503,27504,27505,27506,27507,27508,27509,27510,27511,27512,27514,27517,27518,27519,27520,27525,27528,27532,27534,27535,27536,27537,27540,27541,27543,27544,27545,27548,27549,27550,27551,27552,27554,27555,27556,27557,27558,27559,27560,27561,27563,27564,27565,27566,27567,27568,27569,27570,27574,27576,27577,27578,27579,27580,27581,27582,27584,27587,27588,27590,27591,27592,27593,27594,27596,27598,27600,27601,27608,27610,27612,27613,27614,27615,27616,27618,27619,27620,27621,27622,27623,27624,27625,27628,27629,27630,27632,27633,27634,27636,27638,27639,27640,27642,27643,27644,27646,27647,27648,27649,27650,27651,27652,27656,27657,27658,27659,27660,27662,27666,27671,27676,27677,27678,27680,27683,27685,27691,27692,27693,27697,27699,27702,27703,27705,27706,27707,27708,27710,27711,27715,27716,27717,27720,27723,27724,27725,27726,27727,27729,27730,27731,27734,27736,27737,27738,27746,27747,27749,27750,27751,27755,27756,27757,27758,27759,27761,27763,27765,27767,27768,27770,27771,27772,27775,27776,27780,27783,27786,27787,27789,27790,27793,27794,27797,27798,27799,27800,27802,27804,27805,27806,27808,27810,27816,27820,27823,27824,27828,27829,27830,27831,27834,27840,27841,27842,27843,27846,27847,27848,27851,27853,27854,27855,27857,27858,27864,27865,27866,27868,27869,27871,27876,27878,27879,27881,27884,27885,27890,27892,27897,27903,27904,27906,27907,27909,27910,27912,27913,27914,27917,27919,27920,27921,27923,27924,27925,27926,27928,27932,27933,27935,27936,27937,27938,27939,27940,27942,27944,27945,27948,27949,27951,27952,27956,27958,27959,27960,27962,27967,27968,27970,27972,27977,27980,27984,27989,27990,27991,27992,27995,27997,27999,28001,28002,28004,28005,28007,28008,28011,28012,28013,28016,28017,28018,28019,28021,28022,28025,28026,28027,28029,28030,28031,28032,28033,28035,28036,28038,28039,28042,28043,28045,28047,28048,28050,28054,28055,28056,28057,28058,28060,28066,28069,28076,28077,28080,28081,28083,28084,28086,28087,28089,28090,28091,28092,28093,28094,28097,28098,28099,28104,28105,28106,28109,28110,28111,28112,28114,28115,28116,28117,28119,28122,28123,28124,28127,28130,28131,28133,28135,28136,28137,28138,28141,28143,28144,28146,28148,28149,28150,28152,28154,28157,28158,28159,28160,28161,28162,28163,28164,28166,28167,28168,28169,28171,28175,28178,28179,28181,28184,28185,28187,28188,28190,28191,28194,28198,28199,28200,28202,28204,28206,28208,28209,28211,28213,28214,28215,28217,28219,28220,28221,28222,28223,28224,28225,28226,28229,28230,28231,28232,28233,28234,28235,28236,28239,28240,28241,28242,28245,28247,28249,28250,28252,28253,28254,28256,28257,28258,28259,28260,28261,28262,28263,28264,28265,28266,28268,28269,28271,28272,28273,28274,28275,28276,28277,28278,28279,28280,28281,28282,28283,28284,28285,28288,28289,28290,28292,28295,28296,28298,28299,28300,28301,28302,28305,28306,28307,28308,28309,28310,28311,28313,28314,28315,28317,28318,28320,28321,28323,28324,28326,28328,28329,28331,28332,28333,28334,28336,28339,28341,28344,28345,28348,28350,28351,28352,28355,28356,28357,28358,28360,28361,28362,28364,28365,28366,28368,28370,28374,28376,28377,28379,28380,28381,28387,28391,28394,28395,28396,28397,28398,28399,28400,28401,28402,28403,28405,28406,28407,28408,28410,28411,28412,28413,28414,28415,28416,28417,28419,28420,28421,28423,28424,28426,28427,28428,28429,28430,28432,28433,28434,28438,28439,28440,28441,28442,28443,28444,28445,28446,28447,28449,28450,28451,28453,28454,28455,28456,28460,28462,28464,28466,28468,28469,28471,28472,28473,28474,28475,28476,28477,28479,28480,28481,28482,28483,28484,28485,28488,28489,28490,28492,28494,28495,28496,28497,28498,28499,28500,28501,28502,28503,28505,28506,28507,28509,28511,28512,28513,28515,28516,28517,28519,28520,28521,28522,28523,28524,28527,28528,28529,28531,28533,28534,28535,28537,28539,28541,28542,28543,28544,28545,28546,28547,28549,28550,28551,28554,28555,28559,28560,28561,28562,28563,28564,28565,28566,28567,28568,28569,28570,28571,28573,28574,28575,28576,28578,28579,28580,28581,28582,28584,28585,28586,28587,28588,28589,28590,28591,28592,28593,28594,28596,28597,28599,28600,28602,28603,28604,28605,28606,28607,28609,28611,28612,28613,28614,28615,28616,28618,28619,28620,28621,28622,28623,28624,28627,28628,28629,28630,28631,28632,28633,28634,28635,28636,28637,28639,28642,28643,28644,28645,28646,28647,28648,28649,28650,28651,28652,28653,28656,28657,28658,28659,28660,28661,28662,28663,28664,28665,28666,28667,28668,28669,28670,28671,28672,28673,28674,28675,28676,28677,28678,28679,28680,28681,28682,28683,28684,28685,28686,28687,28688,28690,28691,28692,28693,28694,28695,28696,28697,28700,28701,28702,28703,28704,28705,28706,28708,28709,28710,28711,28712,28713,28714,28715,28716,28717,28718,28719,28720,28721,28722,28723,28724,28726,28727,28728,28730,28731,28732,28733,28734,28735,28736,28737,28738,28739,28740,28741,28742,28743,28744,28745,28746,28747,28749,28750,28752,28753,28754,28755,28756,28757,28758,28759,28760,28761,28762,28763,28764,28765,28767,28768,28769,28770,28771,28772,28773,28774,28775,28776,28777,28778,28782,28785,28786,28787,28788,28791,28793,28794,28795,28797,28801,28802,28803,28804,28806,28807,28808,28811,28812,28813,28815,28816,28817,28819,28823,28824,28826,28827,28830,28831,28832,28833,28834,28835,28836,28837,28838,28839,28840,28841,28842,28848,28850,28852,28853,28854,28858,28862,28863,28868,28869,28870,28871,28873,28875,28876,28877,28878,28879,28880,28881,28882,28883,28884,28885,28886,28887,28890,28892,28893,28894,28896,28897,28898,28899,28901,28906,28910,28912,28913,28914,28915,28916,28917,28918,28920,28922,28923,28924,28926,28927,28928,28929,28930,28931,28932,28933,28934,28935,28936,28939,28940,28941,28942,28943,28945,28946,28948,28951,28955,28956,28957,28958,28959,28960,28961,28962,28963,28964,28965,28967,28968,28969,28970,28971,28972,28973,28974,28978,28979,28980,28981,28983,28984,28985,28986,28987,28988,28989,28990,28991,28992,28993,28994,28995,28996,28998,28999,29000,29001,29003,29005,29007,29008,29009,29010,29011,29012,29013,29014,29015,29016,29017,29018,29019,29021,29023,29024,29025,29026,29027,29029,29033,29034,29035,29036,29037,29039,29040,29041,29044,29045,29046,29047,29049,29051,29052,29054,29055,29056,29057,29058,29059,29061,29062,29063,29064,29065,29067,29068,29069,29070,29072,29073,29074,29075,29077,29078,29079,29082,29083,29084,29085,29086,29089,29090,29091,29092,29093,29094,29095,29097,29098,29099,29101,29102,29103,29104,29105,29106,29108,29110,29111,29112,29114,29115,29116,29117,29118,29119,29120,29121,29122,29124,29125,29126,29127,29128,29129,29130,29131,29132,29133,29135,29136,29137,29138,29139,29142,29143,29144,29145,29146,29147,29148,29149,29150,29151,29153,29154,29155,29156,29158,29160,29161,29162,29163,29164,29165,29167,29168,29169,29170,29171,29172,29173,29174,29175,29176,29178,29179,29180,29181,29182,29183,29184,29185,29186,29187,29188,29189,29191,29192,29193,29194,29195,29196,29197,29198,29199,29200,29201,29202,29203,29204,29205,29206,29207,29208,29209,29210,29211,29212,29214,29215,29216,29217,29218,29219,29220,29221,29222,29223,29225,29227,29229,29230,29231,29234,29235,29236,29242,29244,29246,29248,29249,29250,29251,29252,29253,29254,29257,29258,29259,29262,29263,29264,29265,29267,29268,29269,29271,29272,29274,29276,29278,29280,29283,29284,29285,29288,29290,29291,29292,29293,29296,29297,29299,29300,29302,29303,29304,29307,29308,29309,29314,29315,29317,29318,29319,29320,29321,29324,29326,29328,29329,29331,29332,29333,29334,29335,29336,29337,29338,29339,29340,29341,29342,29344,29345,29346,29347,29348,29349,29350,29351,29352,29353,29354,29355,29358,29361,29362,29363,29365,29370,29371,29372,29373,29374,29375,29376,29381,29382,29383,29385,29386,29387,29388,29391,29393,29395,29396,29397,29398,29400,29402,29403,58566,58567,58568,58569,58570,58571,58572,58573,58574,58575,58576,58577,58578,58579,58580,58581,58582,58583,58584,58585,58586,58587,58588,58589,58590,58591,58592,58593,58594,58595,58596,58597,58598,58599,58600,58601,58602,58603,58604,58605,58606,58607,58608,58609,58610,58611,58612,58613,58614,58615,58616,58617,58618,58619,58620,58621,58622,58623,58624,58625,58626,58627,58628,58629,58630,58631,58632,58633,58634,58635,58636,58637,58638,58639,58640,58641,58642,58643,58644,58645,58646,58647,58648,58649,58650,58651,58652,58653,58654,58655,58656,58657,58658,58659,58660,58661,12288,12289,12290,183,713,711,168,12291,12293,8212,65374,8214,8230,8216,8217,8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,12310,12311,12304,12305,177,215,247,8758,8743,8744,8721,8719,8746,8745,8712,8759,8730,8869,8741,8736,8978,8857,8747,8750,8801,8780,8776,8765,8733,8800,8814,8815,8804,8805,8734,8757,8756,9794,9792,176,8242,8243,8451,65284,164,65504,65505,8240,167,8470,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,8251,8594,8592,8593,8595,12307,58662,58663,58664,58665,58666,58667,58668,58669,58670,58671,58672,58673,58674,58675,58676,58677,58678,58679,58680,58681,58682,58683,58684,58685,58686,58687,58688,58689,58690,58691,58692,58693,58694,58695,58696,58697,58698,58699,58700,58701,58702,58703,58704,58705,58706,58707,58708,58709,58710,58711,58712,58713,58714,58715,58716,58717,58718,58719,58720,58721,58722,58723,58724,58725,58726,58727,58728,58729,58730,58731,58732,58733,58734,58735,58736,58737,58738,58739,58740,58741,58742,58743,58744,58745,58746,58747,58748,58749,58750,58751,58752,58753,58754,58755,58756,58757,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,59238,59239,59240,59241,59242,59243,9352,9353,9354,9355,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,9347,9348,9349,9350,9351,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,8364,59245,12832,12833,12834,12835,12836,12837,12838,12839,12840,12841,59246,59247,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,59248,59249,58758,58759,58760,58761,58762,58763,58764,58765,58766,58767,58768,58769,58770,58771,58772,58773,58774,58775,58776,58777,58778,58779,58780,58781,58782,58783,58784,58785,58786,58787,58788,58789,58790,58791,58792,58793,58794,58795,58796,58797,58798,58799,58800,58801,58802,58803,58804,58805,58806,58807,58808,58809,58810,58811,58812,58813,58814,58815,58816,58817,58818,58819,58820,58821,58822,58823,58824,58825,58826,58827,58828,58829,58830,58831,58832,58833,58834,58835,58836,58837,58838,58839,58840,58841,58842,58843,58844,58845,58846,58847,58848,58849,58850,58851,58852,12288,65281,65282,65283,65509,65285,65286,65287,65288,65289,65290,65291,65292,65293,65294,65295,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,65306,65307,65308,65309,65310,65311,65312,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65339,65340,65341,65342,65343,65344,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,65371,65372,65373,65507,58854,58855,58856,58857,58858,58859,58860,58861,58862,58863,58864,58865,58866,58867,58868,58869,58870,58871,58872,58873,58874,58875,58876,58877,58878,58879,58880,58881,58882,58883,58884,58885,58886,58887,58888,58889,58890,58891,58892,58893,58894,58895,58896,58897,58898,58899,58900,58901,58902,58903,58904,58905,58906,58907,58908,58909,58910,58911,58912,58913,58914,58915,58916,58917,58918,58919,58920,58921,58922,58923,58924,58925,58926,58927,58928,58929,58930,58931,58932,58933,58934,58935,58936,58937,58938,58939,58940,58941,58942,58943,58944,58945,58946,58947,58948,58949,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,59250,59251,59252,59253,59254,59255,59256,59257,59258,59259,59260,58950,58951,58952,58953,58954,58955,58956,58957,58958,58959,58960,58961,58962,58963,58964,58965,58966,58967,58968,58969,58970,58971,58972,58973,58974,58975,58976,58977,58978,58979,58980,58981,58982,58983,58984,58985,58986,58987,58988,58989,58990,58991,58992,58993,58994,58995,58996,58997,58998,58999,59000,59001,59002,59003,59004,59005,59006,59007,59008,59009,59010,59011,59012,59013,59014,59015,59016,59017,59018,59019,59020,59021,59022,59023,59024,59025,59026,59027,59028,59029,59030,59031,59032,59033,59034,59035,59036,59037,59038,59039,59040,59041,59042,59043,59044,59045,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,59261,59262,59263,59264,59265,59266,59267,59268,59046,59047,59048,59049,59050,59051,59052,59053,59054,59055,59056,59057,59058,59059,59060,59061,59062,59063,59064,59065,59066,59067,59068,59069,59070,59071,59072,59073,59074,59075,59076,59077,59078,59079,59080,59081,59082,59083,59084,59085,59086,59087,59088,59089,59090,59091,59092,59093,59094,59095,59096,59097,59098,59099,59100,59101,59102,59103,59104,59105,59106,59107,59108,59109,59110,59111,59112,59113,59114,59115,59116,59117,59118,59119,59120,59121,59122,59123,59124,59125,59126,59127,59128,59129,59130,59131,59132,59133,59134,59135,59136,59137,59138,59139,59140,59141,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,59269,59270,59271,59272,59273,59274,59275,59276,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,59277,59278,59279,59280,59281,59282,59283,65077,65078,65081,65082,65087,65088,65085,65086,65089,65090,65091,65092,59284,59285,65083,65084,65079,65080,65073,59286,65075,65076,59287,59288,59289,59290,59291,59292,59293,59294,59295,59142,59143,59144,59145,59146,59147,59148,59149,59150,59151,59152,59153,59154,59155,59156,59157,59158,59159,59160,59161,59162,59163,59164,59165,59166,59167,59168,59169,59170,59171,59172,59173,59174,59175,59176,59177,59178,59179,59180,59181,59182,59183,59184,59185,59186,59187,59188,59189,59190,59191,59192,59193,59194,59195,59196,59197,59198,59199,59200,59201,59202,59203,59204,59205,59206,59207,59208,59209,59210,59211,59212,59213,59214,59215,59216,59217,59218,59219,59220,59221,59222,59223,59224,59225,59226,59227,59228,59229,59230,59231,59232,59233,59234,59235,59236,59237,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,59296,59297,59298,59299,59300,59301,59302,59303,59304,59305,59306,59307,59308,59309,59310,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,59311,59312,59313,59314,59315,59316,59317,59318,59319,59320,59321,59322,59323,714,715,729,8211,8213,8229,8245,8453,8457,8598,8599,8600,8601,8725,8735,8739,8786,8806,8807,8895,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9601,9602,9603,9604,9605,9606,9607,9608,9609,9610,9611,9612,9613,9614,9615,9619,9620,9621,9660,9661,9698,9699,9700,9701,9737,8853,12306,12317,12318,59324,59325,59326,59327,59328,59329,59330,59331,59332,59333,59334,257,225,462,224,275,233,283,232,299,237,464,236,333,243,466,242,363,250,468,249,470,472,474,476,252,234,593,7743,324,328,505,609,59337,59338,59339,59340,12549,12550,12551,12552,12553,12554,12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570,12571,12572,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582,12583,12584,12585,59341,59342,59343,59344,59345,59346,59347,59348,59349,59350,59351,59352,59353,59354,59355,59356,59357,59358,59359,59360,59361,12321,12322,12323,12324,12325,12326,12327,12328,12329,12963,13198,13199,13212,13213,13214,13217,13252,13262,13265,13266,13269,65072,65506,65508,59362,8481,12849,59363,8208,59364,59365,59366,12540,12443,12444,12541,12542,12294,12445,12446,65097,65098,65099,65100,65101,65102,65103,65104,65105,65106,65108,65109,65110,65111,65113,65114,65115,65116,65117,65118,65119,65120,65121,65122,65123,65124,65125,65126,65128,65129,65130,65131,12350,12272,12273,12274,12275,12276,12277,12278,12279,12280,12281,12282,12283,12295,59380,59381,59382,59383,59384,59385,59386,59387,59388,59389,59390,59391,59392,9472,9473,9474,9475,9476,9477,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,9489,9490,9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506,9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,9521,9522,9523,9524,9525,9526,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536,9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,59393,59394,59395,59396,59397,59398,59399,59400,59401,59402,59403,59404,59405,59406,59407,29404,29405,29407,29410,29411,29412,29413,29414,29415,29418,29419,29429,29430,29433,29437,29438,29439,29440,29442,29444,29445,29446,29447,29448,29449,29451,29452,29453,29455,29456,29457,29458,29460,29464,29465,29466,29471,29472,29475,29476,29478,29479,29480,29485,29487,29488,29490,29491,29493,29494,29498,29499,29500,29501,29504,29505,29506,29507,29508,29509,29510,29511,29512,29513,29514,29515,29516,29518,29519,29521,29523,29524,29525,29526,29528,29529,29530,29531,29532,29533,29534,29535,29537,29538,29539,29540,29541,29542,29543,29544,29545,29546,29547,29550,29552,29553,57344,57345,57346,57347,57348,57349,57350,57351,57352,57353,57354,57355,57356,57357,57358,57359,57360,57361,57362,57363,57364,57365,57366,57367,57368,57369,57370,57371,57372,57373,57374,57375,57376,57377,57378,57379,57380,57381,57382,57383,57384,57385,57386,57387,57388,57389,57390,57391,57392,57393,57394,57395,57396,57397,57398,57399,57400,57401,57402,57403,57404,57405,57406,57407,57408,57409,57410,57411,57412,57413,57414,57415,57416,57417,57418,57419,57420,57421,57422,57423,57424,57425,57426,57427,57428,57429,57430,57431,57432,57433,57434,57435,57436,57437,29554,29555,29556,29557,29558,29559,29560,29561,29562,29563,29564,29565,29567,29568,29569,29570,29571,29573,29574,29576,29578,29580,29581,29583,29584,29586,29587,29588,29589,29591,29592,29593,29594,29596,29597,29598,29600,29601,29603,29604,29605,29606,29607,29608,29610,29612,29613,29617,29620,29621,29622,29624,29625,29628,29629,29630,29631,29633,29635,29636,29637,29638,29639,29643,29644,29646,29650,29651,29652,29653,29654,29655,29656,29658,29659,29660,29661,29663,29665,29666,29667,29668,29670,29672,29674,29675,29676,29678,29679,29680,29681,29683,29684,29685,29686,29687,57438,57439,57440,57441,57442,57443,57444,57445,57446,57447,57448,57449,57450,57451,57452,57453,57454,57455,57456,57457,57458,57459,57460,57461,57462,57463,57464,57465,57466,57467,57468,57469,57470,57471,57472,57473,57474,57475,57476,57477,57478,57479,57480,57481,57482,57483,57484,57485,57486,57487,57488,57489,57490,57491,57492,57493,57494,57495,57496,57497,57498,57499,57500,57501,57502,57503,57504,57505,57506,57507,57508,57509,57510,57511,57512,57513,57514,57515,57516,57517,57518,57519,57520,57521,57522,57523,57524,57525,57526,57527,57528,57529,57530,57531,29688,29689,29690,29691,29692,29693,29694,29695,29696,29697,29698,29700,29703,29704,29707,29708,29709,29710,29713,29714,29715,29716,29717,29718,29719,29720,29721,29724,29725,29726,29727,29728,29729,29731,29732,29735,29737,29739,29741,29743,29745,29746,29751,29752,29753,29754,29755,29757,29758,29759,29760,29762,29763,29764,29765,29766,29767,29768,29769,29770,29771,29772,29773,29774,29775,29776,29777,29778,29779,29780,29782,29784,29789,29792,29793,29794,29795,29796,29797,29798,29799,29800,29801,29802,29803,29804,29806,29807,29809,29810,29811,29812,29813,29816,29817,29818,57532,57533,57534,57535,57536,57537,57538,57539,57540,57541,57542,57543,57544,57545,57546,57547,57548,57549,57550,57551,57552,57553,57554,57555,57556,57557,57558,57559,57560,57561,57562,57563,57564,57565,57566,57567,57568,57569,57570,57571,57572,57573,57574,57575,57576,57577,57578,57579,57580,57581,57582,57583,57584,57585,57586,57587,57588,57589,57590,57591,57592,57593,57594,57595,57596,57597,57598,57599,57600,57601,57602,57603,57604,57605,57606,57607,57608,57609,57610,57611,57612,57613,57614,57615,57616,57617,57618,57619,57620,57621,57622,57623,57624,57625,29819,29820,29821,29823,29826,29828,29829,29830,29832,29833,29834,29836,29837,29839,29841,29842,29843,29844,29845,29846,29847,29848,29849,29850,29851,29853,29855,29856,29857,29858,29859,29860,29861,29862,29866,29867,29868,29869,29870,29871,29872,29873,29874,29875,29876,29877,29878,29879,29880,29881,29883,29884,29885,29886,29887,29888,29889,29890,29891,29892,29893,29894,29895,29896,29897,29898,29899,29900,29901,29902,29903,29904,29905,29907,29908,29909,29910,29911,29912,29913,29914,29915,29917,29919,29921,29925,29927,29928,29929,29930,29931,29932,29933,29936,29937,29938,57626,57627,57628,57629,57630,57631,57632,57633,57634,57635,57636,57637,57638,57639,57640,57641,57642,57643,57644,57645,57646,57647,57648,57649,57650,57651,57652,57653,57654,57655,57656,57657,57658,57659,57660,57661,57662,57663,57664,57665,57666,57667,57668,57669,57670,57671,57672,57673,57674,57675,57676,57677,57678,57679,57680,57681,57682,57683,57684,57685,57686,57687,57688,57689,57690,57691,57692,57693,57694,57695,57696,57697,57698,57699,57700,57701,57702,57703,57704,57705,57706,57707,57708,57709,57710,57711,57712,57713,57714,57715,57716,57717,57718,57719,29939,29941,29944,29945,29946,29947,29948,29949,29950,29952,29953,29954,29955,29957,29958,29959,29960,29961,29962,29963,29964,29966,29968,29970,29972,29973,29974,29975,29979,29981,29982,29984,29985,29986,29987,29988,29990,29991,29994,29998,30004,30006,30009,30012,30013,30015,30017,30018,30019,30020,30022,30023,30025,30026,30029,30032,30033,30034,30035,30037,30038,30039,30040,30045,30046,30047,30048,30049,30050,30051,30052,30055,30056,30057,30059,30060,30061,30062,30063,30064,30065,30067,30069,30070,30071,30074,30075,30076,30077,30078,30080,30081,30082,30084,30085,30087,57720,57721,57722,57723,57724,57725,57726,57727,57728,57729,57730,57731,57732,57733,57734,57735,57736,57737,57738,57739,57740,57741,57742,57743,57744,57745,57746,57747,57748,57749,57750,57751,57752,57753,57754,57755,57756,57757,57758,57759,57760,57761,57762,57763,57764,57765,57766,57767,57768,57769,57770,57771,57772,57773,57774,57775,57776,57777,57778,57779,57780,57781,57782,57783,57784,57785,57786,57787,57788,57789,57790,57791,57792,57793,57794,57795,57796,57797,57798,57799,57800,57801,57802,57803,57804,57805,57806,57807,57808,57809,57810,57811,57812,57813,30088,30089,30090,30092,30093,30094,30096,30099,30101,30104,30107,30108,30110,30114,30118,30119,30120,30121,30122,30125,30134,30135,30138,30139,30143,30144,30145,30150,30155,30156,30158,30159,30160,30161,30163,30167,30169,30170,30172,30173,30175,30176,30177,30181,30185,30188,30189,30190,30191,30194,30195,30197,30198,30199,30200,30202,30203,30205,30206,30210,30212,30214,30215,30216,30217,30219,30221,30222,30223,30225,30226,30227,30228,30230,30234,30236,30237,30238,30241,30243,30247,30248,30252,30254,30255,30257,30258,30262,30263,30265,30266,30267,30269,30273,30274,30276,57814,57815,57816,57817,57818,57819,57820,57821,57822,57823,57824,57825,57826,57827,57828,57829,57830,57831,57832,57833,57834,57835,57836,57837,57838,57839,57840,57841,57842,57843,57844,57845,57846,57847,57848,57849,57850,57851,57852,57853,57854,57855,57856,57857,57858,57859,57860,57861,57862,57863,57864,57865,57866,57867,57868,57869,57870,57871,57872,57873,57874,57875,57876,57877,57878,57879,57880,57881,57882,57883,57884,57885,57886,57887,57888,57889,57890,57891,57892,57893,57894,57895,57896,57897,57898,57899,57900,57901,57902,57903,57904,57905,57906,57907,30277,30278,30279,30280,30281,30282,30283,30286,30287,30288,30289,30290,30291,30293,30295,30296,30297,30298,30299,30301,30303,30304,30305,30306,30308,30309,30310,30311,30312,30313,30314,30316,30317,30318,30320,30321,30322,30323,30324,30325,30326,30327,30329,30330,30332,30335,30336,30337,30339,30341,30345,30346,30348,30349,30351,30352,30354,30356,30357,30359,30360,30362,30363,30364,30365,30366,30367,30368,30369,30370,30371,30373,30374,30375,30376,30377,30378,30379,30380,30381,30383,30384,30387,30389,30390,30391,30392,30393,30394,30395,30396,30397,30398,30400,30401,30403,21834,38463,22467,25384,21710,21769,21696,30353,30284,34108,30702,33406,30861,29233,38552,38797,27688,23433,20474,25353,26263,23736,33018,26696,32942,26114,30414,20985,25942,29100,32753,34948,20658,22885,25034,28595,33453,25420,25170,21485,21543,31494,20843,30116,24052,25300,36299,38774,25226,32793,22365,38712,32610,29240,30333,26575,30334,25670,20336,36133,25308,31255,26001,29677,25644,25203,33324,39041,26495,29256,25198,25292,20276,29923,21322,21150,32458,37030,24110,26758,27036,33152,32465,26834,30917,34444,38225,20621,35876,33502,32990,21253,35090,21093,30404,30407,30409,30411,30412,30419,30421,30425,30426,30428,30429,30430,30432,30433,30434,30435,30436,30438,30439,30440,30441,30442,30443,30444,30445,30448,30451,30453,30454,30455,30458,30459,30461,30463,30464,30466,30467,30469,30470,30474,30476,30478,30479,30480,30481,30482,30483,30484,30485,30486,30487,30488,30491,30492,30493,30494,30497,30499,30500,30501,30503,30506,30507,30508,30510,30512,30513,30514,30515,30516,30521,30523,30525,30526,30527,30530,30532,30533,30534,30536,30537,30538,30539,30540,30541,30542,30543,30546,30547,30548,30549,30550,30551,30552,30553,30556,34180,38649,20445,22561,39281,23453,25265,25253,26292,35961,40077,29190,26479,30865,24754,21329,21271,36744,32972,36125,38049,20493,29384,22791,24811,28953,34987,22868,33519,26412,31528,23849,32503,29997,27893,36454,36856,36924,40763,27604,37145,31508,24444,30887,34006,34109,27605,27609,27606,24065,24199,30201,38381,25949,24330,24517,36767,22721,33218,36991,38491,38829,36793,32534,36140,25153,20415,21464,21342,36776,36777,36779,36941,26631,24426,33176,34920,40150,24971,21035,30250,24428,25996,28626,28392,23486,25672,20853,20912,26564,19993,31177,39292,28851,30557,30558,30559,30560,30564,30567,30569,30570,30573,30574,30575,30576,30577,30578,30579,30580,30581,30582,30583,30584,30586,30587,30588,30593,30594,30595,30598,30599,30600,30601,30602,30603,30607,30608,30611,30612,30613,30614,30615,30616,30617,30618,30619,30620,30621,30622,30625,30627,30628,30630,30632,30635,30637,30638,30639,30641,30642,30644,30646,30647,30648,30649,30650,30652,30654,30656,30657,30658,30659,30660,30661,30662,30663,30664,30665,30666,30667,30668,30670,30671,30672,30673,30674,30675,30676,30677,30678,30680,30681,30682,30685,30686,30687,30688,30689,30692,30149,24182,29627,33760,25773,25320,38069,27874,21338,21187,25615,38082,31636,20271,24091,33334,33046,33162,28196,27850,39539,25429,21340,21754,34917,22496,19981,24067,27493,31807,37096,24598,25830,29468,35009,26448,25165,36130,30572,36393,37319,24425,33756,34081,39184,21442,34453,27531,24813,24808,28799,33485,33329,20179,27815,34255,25805,31961,27133,26361,33609,21397,31574,20391,20876,27979,23618,36461,25554,21449,33580,33590,26597,30900,25661,23519,23700,24046,35815,25286,26612,35962,25600,25530,34633,39307,35863,32544,38130,20135,38416,39076,26124,29462,30694,30696,30698,30703,30704,30705,30706,30708,30709,30711,30713,30714,30715,30716,30723,30724,30725,30726,30727,30728,30730,30731,30734,30735,30736,30739,30741,30745,30747,30750,30752,30753,30754,30756,30760,30762,30763,30766,30767,30769,30770,30771,30773,30774,30781,30783,30785,30786,30787,30788,30790,30792,30793,30794,30795,30797,30799,30801,30803,30804,30808,30809,30810,30811,30812,30814,30815,30816,30817,30818,30819,30820,30821,30822,30823,30824,30825,30831,30832,30833,30834,30835,30836,30837,30838,30840,30841,30842,30843,30845,30846,30847,30848,30849,30850,30851,22330,23581,24120,38271,20607,32928,21378,25950,30021,21809,20513,36229,25220,38046,26397,22066,28526,24034,21557,28818,36710,25199,25764,25507,24443,28552,37108,33251,36784,23576,26216,24561,27785,38472,36225,34924,25745,31216,22478,27225,25104,21576,20056,31243,24809,28548,35802,25215,36894,39563,31204,21507,30196,25345,21273,27744,36831,24347,39536,32827,40831,20360,23610,36196,32709,26021,28861,20805,20914,34411,23815,23456,25277,37228,30068,36364,31264,24833,31609,20167,32504,30597,19985,33261,21021,20986,27249,21416,36487,38148,38607,28353,38500,26970,30852,30853,30854,30856,30858,30859,30863,30864,30866,30868,30869,30870,30873,30877,30878,30880,30882,30884,30886,30888,30889,30890,30891,30892,30893,30894,30895,30901,30902,30903,30904,30906,30907,30908,30909,30911,30912,30914,30915,30916,30918,30919,30920,30924,30925,30926,30927,30929,30930,30931,30934,30935,30936,30938,30939,30940,30941,30942,30943,30944,30945,30946,30947,30948,30949,30950,30951,30953,30954,30955,30957,30958,30959,30960,30961,30963,30965,30966,30968,30969,30971,30972,30973,30974,30975,30976,30978,30979,30980,30982,30983,30984,30985,30986,30987,30988,30784,20648,30679,25616,35302,22788,25571,24029,31359,26941,20256,33337,21912,20018,30126,31383,24162,24202,38383,21019,21561,28810,25462,38180,22402,26149,26943,37255,21767,28147,32431,34850,25139,32496,30133,33576,30913,38604,36766,24904,29943,35789,27492,21050,36176,27425,32874,33905,22257,21254,20174,19995,20945,31895,37259,31751,20419,36479,31713,31388,25703,23828,20652,33030,30209,31929,28140,32736,26449,23384,23544,30923,25774,25619,25514,25387,38169,25645,36798,31572,30249,25171,22823,21574,27513,20643,25140,24102,27526,20195,36151,34955,24453,36910,30989,30990,30991,30992,30993,30994,30996,30997,30998,30999,31000,31001,31002,31003,31004,31005,31007,31008,31009,31010,31011,31013,31014,31015,31016,31017,31018,31019,31020,31021,31022,31023,31024,31025,31026,31027,31029,31030,31031,31032,31033,31037,31039,31042,31043,31044,31045,31047,31050,31051,31052,31053,31054,31055,31056,31057,31058,31060,31061,31064,31065,31073,31075,31076,31078,31081,31082,31083,31084,31086,31088,31089,31090,31091,31092,31093,31094,31097,31099,31100,31101,31102,31103,31106,31107,31110,31111,31112,31113,31115,31116,31117,31118,31120,31121,31122,24608,32829,25285,20025,21333,37112,25528,32966,26086,27694,20294,24814,28129,35806,24377,34507,24403,25377,20826,33633,26723,20992,25443,36424,20498,23707,31095,23548,21040,31291,24764,36947,30423,24503,24471,30340,36460,28783,30331,31561,30634,20979,37011,22564,20302,28404,36842,25932,31515,29380,28068,32735,23265,25269,24213,22320,33922,31532,24093,24351,36882,32532,39072,25474,28359,30872,28857,20856,38747,22443,30005,20291,30008,24215,24806,22880,28096,27583,30857,21500,38613,20939,20993,25481,21514,38035,35843,36300,29241,30879,34678,36845,35853,21472,31123,31124,31125,31126,31127,31128,31129,31131,31132,31133,31134,31135,31136,31137,31138,31139,31140,31141,31142,31144,31145,31146,31147,31148,31149,31150,31151,31152,31153,31154,31156,31157,31158,31159,31160,31164,31167,31170,31172,31173,31175,31176,31178,31180,31182,31183,31184,31187,31188,31190,31191,31193,31194,31195,31196,31197,31198,31200,31201,31202,31205,31208,31210,31212,31214,31217,31218,31219,31220,31221,31222,31223,31225,31226,31228,31230,31231,31233,31236,31237,31239,31240,31241,31242,31244,31247,31248,31249,31250,31251,31253,31254,31256,31257,31259,31260,19969,30447,21486,38025,39030,40718,38189,23450,35746,20002,19996,20908,33891,25026,21160,26635,20375,24683,20923,27934,20828,25238,26007,38497,35910,36887,30168,37117,30563,27602,29322,29420,35835,22581,30585,36172,26460,38208,32922,24230,28193,22930,31471,30701,38203,27573,26029,32526,22534,20817,38431,23545,22697,21544,36466,25958,39039,22244,38045,30462,36929,25479,21702,22810,22842,22427,36530,26421,36346,33333,21057,24816,22549,34558,23784,40517,20420,39069,35769,23077,24694,21380,25212,36943,37122,39295,24681,32780,20799,32819,23572,39285,27953,20108,31261,31263,31265,31266,31268,31269,31270,31271,31272,31273,31274,31275,31276,31277,31278,31279,31280,31281,31282,31284,31285,31286,31288,31290,31294,31296,31297,31298,31299,31300,31301,31303,31304,31305,31306,31307,31308,31309,31310,31311,31312,31314,31315,31316,31317,31318,31320,31321,31322,31323,31324,31325,31326,31327,31328,31329,31330,31331,31332,31333,31334,31335,31336,31337,31338,31339,31340,31341,31342,31343,31345,31346,31347,31349,31355,31356,31357,31358,31362,31365,31367,31369,31370,31371,31372,31374,31375,31376,31379,31380,31385,31386,31387,31390,31393,31394,36144,21457,32602,31567,20240,20047,38400,27861,29648,34281,24070,30058,32763,27146,30718,38034,32321,20961,28902,21453,36820,33539,36137,29359,39277,27867,22346,33459,26041,32938,25151,38450,22952,20223,35775,32442,25918,33778,38750,21857,39134,32933,21290,35837,21536,32954,24223,27832,36153,33452,37210,21545,27675,20998,32439,22367,28954,27774,31881,22859,20221,24575,24868,31914,20016,23553,26539,34562,23792,38155,39118,30127,28925,36898,20911,32541,35773,22857,20964,20315,21542,22827,25975,32932,23413,25206,25282,36752,24133,27679,31526,20239,20440,26381,31395,31396,31399,31401,31402,31403,31406,31407,31408,31409,31410,31412,31413,31414,31415,31416,31417,31418,31419,31420,31421,31422,31424,31425,31426,31427,31428,31429,31430,31431,31432,31433,31434,31436,31437,31438,31439,31440,31441,31442,31443,31444,31445,31447,31448,31450,31451,31452,31453,31457,31458,31460,31463,31464,31465,31466,31467,31468,31470,31472,31473,31474,31475,31476,31477,31478,31479,31480,31483,31484,31486,31488,31489,31490,31493,31495,31497,31500,31501,31502,31504,31506,31507,31510,31511,31512,31514,31516,31517,31519,31521,31522,31523,31527,31529,31533,28014,28074,31119,34993,24343,29995,25242,36741,20463,37340,26023,33071,33105,24220,33104,36212,21103,35206,36171,22797,20613,20184,38428,29238,33145,36127,23500,35747,38468,22919,32538,21648,22134,22030,35813,25913,27010,38041,30422,28297,24178,29976,26438,26577,31487,32925,36214,24863,31174,25954,36195,20872,21018,38050,32568,32923,32434,23703,28207,26464,31705,30347,39640,33167,32660,31957,25630,38224,31295,21578,21733,27468,25601,25096,40509,33011,30105,21106,38761,33883,26684,34532,38401,38548,38124,20010,21508,32473,26681,36319,32789,26356,24218,32697,31535,31536,31538,31540,31541,31542,31543,31545,31547,31549,31551,31552,31553,31554,31555,31556,31558,31560,31562,31565,31566,31571,31573,31575,31577,31580,31582,31583,31585,31587,31588,31589,31590,31591,31592,31593,31594,31595,31596,31597,31599,31600,31603,31604,31606,31608,31610,31612,31613,31615,31617,31618,31619,31620,31622,31623,31624,31625,31626,31627,31628,31630,31631,31633,31634,31635,31638,31640,31641,31642,31643,31646,31647,31648,31651,31652,31653,31662,31663,31664,31666,31667,31669,31670,31671,31673,31674,31675,31676,31677,31678,31679,31680,31682,31683,31684,22466,32831,26775,24037,25915,21151,24685,40858,20379,36524,20844,23467,24339,24041,27742,25329,36129,20849,38057,21246,27807,33503,29399,22434,26500,36141,22815,36764,33735,21653,31629,20272,27837,23396,22993,40723,21476,34506,39592,35895,32929,25925,39038,22266,38599,21038,29916,21072,23521,25346,35074,20054,25296,24618,26874,20851,23448,20896,35266,31649,39302,32592,24815,28748,36143,20809,24191,36891,29808,35268,22317,30789,24402,40863,38394,36712,39740,35809,30328,26690,26588,36330,36149,21053,36746,28378,26829,38149,37101,22269,26524,35065,36807,21704,31685,31688,31689,31690,31691,31693,31694,31695,31696,31698,31700,31701,31702,31703,31704,31707,31708,31710,31711,31712,31714,31715,31716,31719,31720,31721,31723,31724,31725,31727,31728,31730,31731,31732,31733,31734,31736,31737,31738,31739,31741,31743,31744,31745,31746,31747,31748,31749,31750,31752,31753,31754,31757,31758,31760,31761,31762,31763,31764,31765,31767,31768,31769,31770,31771,31772,31773,31774,31776,31777,31778,31779,31780,31781,31784,31785,31787,31788,31789,31790,31791,31792,31793,31794,31795,31796,31797,31798,31799,31801,31802,31803,31804,31805,31806,31810,39608,23401,28023,27686,20133,23475,39559,37219,25000,37039,38889,21547,28085,23506,20989,21898,32597,32752,25788,25421,26097,25022,24717,28938,27735,27721,22831,26477,33322,22741,22158,35946,27627,37085,22909,32791,21495,28009,21621,21917,33655,33743,26680,31166,21644,20309,21512,30418,35977,38402,27827,28088,36203,35088,40548,36154,22079,40657,30165,24456,29408,24680,21756,20136,27178,34913,24658,36720,21700,28888,34425,40511,27946,23439,24344,32418,21897,20399,29492,21564,21402,20505,21518,21628,20046,24573,29786,22774,33899,32993,34676,29392,31946,28246,31811,31812,31813,31814,31815,31816,31817,31818,31819,31820,31822,31823,31824,31825,31826,31827,31828,31829,31830,31831,31832,31833,31834,31835,31836,31837,31838,31839,31840,31841,31842,31843,31844,31845,31846,31847,31848,31849,31850,31851,31852,31853,31854,31855,31856,31857,31858,31861,31862,31863,31864,31865,31866,31870,31871,31872,31873,31874,31875,31876,31877,31878,31879,31880,31882,31883,31884,31885,31886,31887,31888,31891,31892,31894,31897,31898,31899,31904,31905,31907,31910,31911,31912,31913,31915,31916,31917,31919,31920,31924,31925,31926,31927,31928,31930,31931,24359,34382,21804,25252,20114,27818,25143,33457,21719,21326,29502,28369,30011,21010,21270,35805,27088,24458,24576,28142,22351,27426,29615,26707,36824,32531,25442,24739,21796,30186,35938,28949,28067,23462,24187,33618,24908,40644,30970,34647,31783,30343,20976,24822,29004,26179,24140,24653,35854,28784,25381,36745,24509,24674,34516,22238,27585,24724,24935,21321,24800,26214,36159,31229,20250,28905,27719,35763,35826,32472,33636,26127,23130,39746,27985,28151,35905,27963,20249,28779,33719,25110,24785,38669,36135,31096,20987,22334,22522,26426,30072,31293,31215,31637,31935,31936,31938,31939,31940,31942,31945,31947,31950,31951,31952,31953,31954,31955,31956,31960,31962,31963,31965,31966,31969,31970,31971,31972,31973,31974,31975,31977,31978,31979,31980,31981,31982,31984,31985,31986,31987,31988,31989,31990,31991,31993,31994,31996,31997,31998,31999,32000,32001,32002,32003,32004,32005,32006,32007,32008,32009,32011,32012,32013,32014,32015,32016,32017,32018,32019,32020,32021,32022,32023,32024,32025,32026,32027,32028,32029,32030,32031,32033,32035,32036,32037,32038,32040,32041,32042,32044,32045,32046,32048,32049,32050,32051,32052,32053,32054,32908,39269,36857,28608,35749,40481,23020,32489,32521,21513,26497,26840,36753,31821,38598,21450,24613,30142,27762,21363,23241,32423,25380,20960,33034,24049,34015,25216,20864,23395,20238,31085,21058,24760,27982,23492,23490,35745,35760,26082,24524,38469,22931,32487,32426,22025,26551,22841,20339,23478,21152,33626,39050,36158,30002,38078,20551,31292,20215,26550,39550,23233,27516,30417,22362,23574,31546,38388,29006,20860,32937,33392,22904,32516,33575,26816,26604,30897,30839,25315,25441,31616,20461,21098,20943,33616,27099,37492,36341,36145,35265,38190,31661,20214,32055,32056,32057,32058,32059,32060,32061,32062,32063,32064,32065,32066,32067,32068,32069,32070,32071,32072,32073,32074,32075,32076,32077,32078,32079,32080,32081,32082,32083,32084,32085,32086,32087,32088,32089,32090,32091,32092,32093,32094,32095,32096,32097,32098,32099,32100,32101,32102,32103,32104,32105,32106,32107,32108,32109,32111,32112,32113,32114,32115,32116,32117,32118,32120,32121,32122,32123,32124,32125,32126,32127,32128,32129,32130,32131,32132,32133,32134,32135,32136,32137,32138,32139,32140,32141,32142,32143,32144,32145,32146,32147,32148,32149,32150,32151,32152,20581,33328,21073,39279,28176,28293,28071,24314,20725,23004,23558,27974,27743,30086,33931,26728,22870,35762,21280,37233,38477,34121,26898,30977,28966,33014,20132,37066,27975,39556,23047,22204,25605,38128,30699,20389,33050,29409,35282,39290,32564,32478,21119,25945,37237,36735,36739,21483,31382,25581,25509,30342,31224,34903,38454,25130,21163,33410,26708,26480,25463,30571,31469,27905,32467,35299,22992,25106,34249,33445,30028,20511,20171,30117,35819,23626,24062,31563,26020,37329,20170,27941,35167,32039,38182,20165,35880,36827,38771,26187,31105,36817,28908,28024,32153,32154,32155,32156,32157,32158,32159,32160,32161,32162,32163,32164,32165,32167,32168,32169,32170,32171,32172,32173,32175,32176,32177,32178,32179,32180,32181,32182,32183,32184,32185,32186,32187,32188,32189,32190,32191,32192,32193,32194,32195,32196,32197,32198,32199,32200,32201,32202,32203,32204,32205,32206,32207,32208,32209,32210,32211,32212,32213,32214,32215,32216,32217,32218,32219,32220,32221,32222,32223,32224,32225,32226,32227,32228,32229,32230,32231,32232,32233,32234,32235,32236,32237,32238,32239,32240,32241,32242,32243,32244,32245,32246,32247,32248,32249,32250,23613,21170,33606,20834,33550,30555,26230,40120,20140,24778,31934,31923,32463,20117,35686,26223,39048,38745,22659,25964,38236,24452,30153,38742,31455,31454,20928,28847,31384,25578,31350,32416,29590,38893,20037,28792,20061,37202,21417,25937,26087,33276,33285,21646,23601,30106,38816,25304,29401,30141,23621,39545,33738,23616,21632,30697,20030,27822,32858,25298,25454,24040,20855,36317,36382,38191,20465,21477,24807,28844,21095,25424,40515,23071,20518,30519,21367,32482,25733,25899,25225,25496,20500,29237,35273,20915,35776,32477,22343,33740,38055,20891,21531,23803,32251,32252,32253,32254,32255,32256,32257,32258,32259,32260,32261,32262,32263,32264,32265,32266,32267,32268,32269,32270,32271,32272,32273,32274,32275,32276,32277,32278,32279,32280,32281,32282,32283,32284,32285,32286,32287,32288,32289,32290,32291,32292,32293,32294,32295,32296,32297,32298,32299,32300,32301,32302,32303,32304,32305,32306,32307,32308,32309,32310,32311,32312,32313,32314,32316,32317,32318,32319,32320,32322,32323,32324,32325,32326,32328,32329,32330,32331,32332,32333,32334,32335,32336,32337,32338,32339,32340,32341,32342,32343,32344,32345,32346,32347,32348,32349,20426,31459,27994,37089,39567,21888,21654,21345,21679,24320,25577,26999,20975,24936,21002,22570,21208,22350,30733,30475,24247,24951,31968,25179,25239,20130,28821,32771,25335,28900,38752,22391,33499,26607,26869,30933,39063,31185,22771,21683,21487,28212,20811,21051,23458,35838,32943,21827,22438,24691,22353,21549,31354,24656,23380,25511,25248,21475,25187,23495,26543,21741,31391,33510,37239,24211,35044,22840,22446,25358,36328,33007,22359,31607,20393,24555,23485,27454,21281,31568,29378,26694,30719,30518,26103,20917,20111,30420,23743,31397,33909,22862,39745,20608,32350,32351,32352,32353,32354,32355,32356,32357,32358,32359,32360,32361,32362,32363,32364,32365,32366,32367,32368,32369,32370,32371,32372,32373,32374,32375,32376,32377,32378,32379,32380,32381,32382,32383,32384,32385,32387,32388,32389,32390,32391,32392,32393,32394,32395,32396,32397,32398,32399,32400,32401,32402,32403,32404,32405,32406,32407,32408,32409,32410,32412,32413,32414,32430,32436,32443,32444,32470,32484,32492,32505,32522,32528,32542,32567,32569,32571,32572,32573,32574,32575,32576,32577,32579,32582,32583,32584,32585,32586,32587,32588,32589,32590,32591,32594,32595,39304,24871,28291,22372,26118,25414,22256,25324,25193,24275,38420,22403,25289,21895,34593,33098,36771,21862,33713,26469,36182,34013,23146,26639,25318,31726,38417,20848,28572,35888,25597,35272,25042,32518,28866,28389,29701,27028,29436,24266,37070,26391,28010,25438,21171,29282,32769,20332,23013,37226,28889,28061,21202,20048,38647,38253,34174,30922,32047,20769,22418,25794,32907,31867,27882,26865,26974,20919,21400,26792,29313,40654,31729,29432,31163,28435,29702,26446,37324,40100,31036,33673,33620,21519,26647,20029,21385,21169,30782,21382,21033,20616,20363,20432,32598,32601,32603,32604,32605,32606,32608,32611,32612,32613,32614,32615,32619,32620,32621,32623,32624,32627,32629,32630,32631,32632,32634,32635,32636,32637,32639,32640,32642,32643,32644,32645,32646,32647,32648,32649,32651,32653,32655,32656,32657,32658,32659,32661,32662,32663,32664,32665,32667,32668,32672,32674,32675,32677,32678,32680,32681,32682,32683,32684,32685,32686,32689,32691,32692,32693,32694,32695,32698,32699,32702,32704,32706,32707,32708,32710,32711,32712,32713,32715,32717,32719,32720,32721,32722,32723,32726,32727,32729,32730,32731,32732,32733,32734,32738,32739,30178,31435,31890,27813,38582,21147,29827,21737,20457,32852,33714,36830,38256,24265,24604,28063,24088,25947,33080,38142,24651,28860,32451,31918,20937,26753,31921,33391,20004,36742,37327,26238,20142,35845,25769,32842,20698,30103,29134,23525,36797,28518,20102,25730,38243,24278,26009,21015,35010,28872,21155,29454,29747,26519,30967,38678,20020,37051,40158,28107,20955,36161,21533,25294,29618,33777,38646,40836,38083,20278,32666,20940,28789,38517,23725,39046,21478,20196,28316,29705,27060,30827,39311,30041,21016,30244,27969,26611,20845,40857,32843,21657,31548,31423,32740,32743,32744,32746,32747,32748,32749,32751,32754,32756,32757,32758,32759,32760,32761,32762,32765,32766,32767,32770,32775,32776,32777,32778,32782,32783,32785,32787,32794,32795,32797,32798,32799,32801,32803,32804,32811,32812,32813,32814,32815,32816,32818,32820,32825,32826,32828,32830,32832,32833,32836,32837,32839,32840,32841,32846,32847,32848,32849,32851,32853,32854,32855,32857,32859,32860,32861,32862,32863,32864,32865,32866,32867,32868,32869,32870,32871,32872,32875,32876,32877,32878,32879,32880,32882,32883,32884,32885,32886,32887,32888,32889,32890,32891,32892,32893,38534,22404,25314,38471,27004,23044,25602,31699,28431,38475,33446,21346,39045,24208,28809,25523,21348,34383,40065,40595,30860,38706,36335,36162,40575,28510,31108,24405,38470,25134,39540,21525,38109,20387,26053,23653,23649,32533,34385,27695,24459,29575,28388,32511,23782,25371,23402,28390,21365,20081,25504,30053,25249,36718,20262,20177,27814,32438,35770,33821,34746,32599,36923,38179,31657,39585,35064,33853,27931,39558,32476,22920,40635,29595,30721,34434,39532,39554,22043,21527,22475,20080,40614,21334,36808,33033,30610,39314,34542,28385,34067,26364,24930,28459,32894,32897,32898,32901,32904,32906,32909,32910,32911,32912,32913,32914,32916,32917,32919,32921,32926,32931,32934,32935,32936,32940,32944,32947,32949,32950,32952,32953,32955,32965,32967,32968,32969,32970,32971,32975,32976,32977,32978,32979,32980,32981,32984,32991,32992,32994,32995,32998,33006,33013,33015,33017,33019,33022,33023,33024,33025,33027,33028,33029,33031,33032,33035,33036,33045,33047,33049,33051,33052,33053,33055,33056,33057,33058,33059,33060,33061,33062,33063,33064,33065,33066,33067,33069,33070,33072,33075,33076,33077,33079,33081,33082,33083,33084,33085,33087,35881,33426,33579,30450,27667,24537,33725,29483,33541,38170,27611,30683,38086,21359,33538,20882,24125,35980,36152,20040,29611,26522,26757,37238,38665,29028,27809,30473,23186,38209,27599,32654,26151,23504,22969,23194,38376,38391,20204,33804,33945,27308,30431,38192,29467,26790,23391,30511,37274,38753,31964,36855,35868,24357,31859,31192,35269,27852,34588,23494,24130,26825,30496,32501,20885,20813,21193,23081,32517,38754,33495,25551,30596,34256,31186,28218,24217,22937,34065,28781,27665,25279,30399,25935,24751,38397,26126,34719,40483,38125,21517,21629,35884,25720,33088,33089,33090,33091,33092,33093,33095,33097,33101,33102,33103,33106,33110,33111,33112,33115,33116,33117,33118,33119,33121,33122,33123,33124,33126,33128,33130,33131,33132,33135,33138,33139,33141,33142,33143,33144,33153,33155,33156,33157,33158,33159,33161,33163,33164,33165,33166,33168,33170,33171,33172,33173,33174,33175,33177,33178,33182,33183,33184,33185,33186,33188,33189,33191,33193,33195,33196,33197,33198,33199,33200,33201,33202,33204,33205,33206,33207,33208,33209,33212,33213,33214,33215,33220,33221,33223,33224,33225,33227,33229,33230,33231,33232,33233,33234,33235,25721,34321,27169,33180,30952,25705,39764,25273,26411,33707,22696,40664,27819,28448,23518,38476,35851,29279,26576,25287,29281,20137,22982,27597,22675,26286,24149,21215,24917,26408,30446,30566,29287,31302,25343,21738,21584,38048,37027,23068,32435,27670,20035,22902,32784,22856,21335,30007,38590,22218,25376,33041,24700,38393,28118,21602,39297,20869,23273,33021,22958,38675,20522,27877,23612,25311,20320,21311,33147,36870,28346,34091,25288,24180,30910,25781,25467,24565,23064,37247,40479,23615,25423,32834,23421,21870,38218,38221,28037,24744,26592,29406,20957,23425,33236,33237,33238,33239,33240,33241,33242,33243,33244,33245,33246,33247,33248,33249,33250,33252,33253,33254,33256,33257,33259,33262,33263,33264,33265,33266,33269,33270,33271,33272,33273,33274,33277,33279,33283,33287,33288,33289,33290,33291,33294,33295,33297,33299,33301,33302,33303,33304,33305,33306,33309,33312,33316,33317,33318,33319,33321,33326,33330,33338,33340,33341,33343,33344,33345,33346,33347,33349,33350,33352,33354,33356,33357,33358,33360,33361,33362,33363,33364,33365,33366,33367,33369,33371,33372,33373,33374,33376,33377,33378,33379,33380,33381,33382,33383,33385,25319,27870,29275,25197,38062,32445,33043,27987,20892,24324,22900,21162,24594,22899,26262,34384,30111,25386,25062,31983,35834,21734,27431,40485,27572,34261,21589,20598,27812,21866,36276,29228,24085,24597,29750,25293,25490,29260,24472,28227,27966,25856,28504,30424,30928,30460,30036,21028,21467,20051,24222,26049,32810,32982,25243,21638,21032,28846,34957,36305,27873,21624,32986,22521,35060,36180,38506,37197,20329,27803,21943,30406,30768,25256,28921,28558,24429,34028,26842,30844,31735,33192,26379,40527,25447,30896,22383,30738,38713,25209,25259,21128,29749,27607,33386,33387,33388,33389,33393,33397,33398,33399,33400,33403,33404,33408,33409,33411,33413,33414,33415,33417,33420,33424,33427,33428,33429,33430,33434,33435,33438,33440,33442,33443,33447,33458,33461,33462,33466,33467,33468,33471,33472,33474,33475,33477,33478,33481,33488,33494,33497,33498,33501,33506,33511,33512,33513,33514,33516,33517,33518,33520,33522,33523,33525,33526,33528,33530,33532,33533,33534,33535,33536,33546,33547,33549,33552,33554,33555,33558,33560,33561,33565,33566,33567,33568,33569,33570,33571,33572,33573,33574,33577,33578,33582,33584,33586,33591,33595,33597,21860,33086,30130,30382,21305,30174,20731,23617,35692,31687,20559,29255,39575,39128,28418,29922,31080,25735,30629,25340,39057,36139,21697,32856,20050,22378,33529,33805,24179,20973,29942,35780,23631,22369,27900,39047,23110,30772,39748,36843,31893,21078,25169,38138,20166,33670,33889,33769,33970,22484,26420,22275,26222,28006,35889,26333,28689,26399,27450,26646,25114,22971,19971,20932,28422,26578,27791,20854,26827,22855,27495,30054,23822,33040,40784,26071,31048,31041,39569,36215,23682,20062,20225,21551,22865,30732,22120,27668,36804,24323,27773,27875,35755,25488,33598,33599,33601,33602,33604,33605,33608,33610,33611,33612,33613,33614,33619,33621,33622,33623,33624,33625,33629,33634,33648,33649,33650,33651,33652,33653,33654,33657,33658,33662,33663,33664,33665,33666,33667,33668,33671,33672,33674,33675,33676,33677,33679,33680,33681,33684,33685,33686,33687,33689,33690,33693,33695,33697,33698,33699,33700,33701,33702,33703,33708,33709,33710,33711,33717,33723,33726,33727,33730,33731,33732,33734,33736,33737,33739,33741,33742,33744,33745,33746,33747,33749,33751,33753,33754,33755,33758,33762,33763,33764,33766,33767,33768,33771,33772,33773,24688,27965,29301,25190,38030,38085,21315,36801,31614,20191,35878,20094,40660,38065,38067,21069,28508,36963,27973,35892,22545,23884,27424,27465,26538,21595,33108,32652,22681,34103,24378,25250,27207,38201,25970,24708,26725,30631,20052,20392,24039,38808,25772,32728,23789,20431,31373,20999,33540,19988,24623,31363,38054,20405,20146,31206,29748,21220,33465,25810,31165,23517,27777,38738,36731,27682,20542,21375,28165,25806,26228,27696,24773,39031,35831,24198,29756,31351,31179,19992,37041,29699,27714,22234,37195,27845,36235,21306,34502,26354,36527,23624,39537,28192,33774,33775,33779,33780,33781,33782,33783,33786,33787,33788,33790,33791,33792,33794,33797,33799,33800,33801,33802,33808,33810,33811,33812,33813,33814,33815,33817,33818,33819,33822,33823,33824,33825,33826,33827,33833,33834,33835,33836,33837,33838,33839,33840,33842,33843,33844,33845,33846,33847,33849,33850,33851,33854,33855,33856,33857,33858,33859,33860,33861,33863,33864,33865,33866,33867,33868,33869,33870,33871,33872,33874,33875,33876,33877,33878,33880,33885,33886,33887,33888,33890,33892,33893,33894,33895,33896,33898,33902,33903,33904,33906,33908,33911,33913,33915,33916,21462,23094,40843,36259,21435,22280,39079,26435,37275,27849,20840,30154,25331,29356,21048,21149,32570,28820,30264,21364,40522,27063,30830,38592,35033,32676,28982,29123,20873,26579,29924,22756,25880,22199,35753,39286,25200,32469,24825,28909,22764,20161,20154,24525,38887,20219,35748,20995,22922,32427,25172,20173,26085,25102,33592,33993,33635,34701,29076,28342,23481,32466,20887,25545,26580,32905,33593,34837,20754,23418,22914,36785,20083,27741,20837,35109,36719,38446,34122,29790,38160,38384,28070,33509,24369,25746,27922,33832,33134,40131,22622,36187,19977,21441,33917,33918,33919,33920,33921,33923,33924,33925,33926,33930,33933,33935,33936,33937,33938,33939,33940,33941,33942,33944,33946,33947,33949,33950,33951,33952,33954,33955,33956,33957,33958,33959,33960,33961,33962,33963,33964,33965,33966,33968,33969,33971,33973,33974,33975,33979,33980,33982,33984,33986,33987,33989,33990,33991,33992,33995,33996,33998,33999,34002,34004,34005,34007,34008,34009,34010,34011,34012,34014,34017,34018,34020,34023,34024,34025,34026,34027,34029,34030,34031,34033,34034,34035,34036,34037,34038,34039,34040,34041,34042,34043,34045,34046,34048,34049,34050,20254,25955,26705,21971,20007,25620,39578,25195,23234,29791,33394,28073,26862,20711,33678,30722,26432,21049,27801,32433,20667,21861,29022,31579,26194,29642,33515,26441,23665,21024,29053,34923,38378,38485,25797,36193,33203,21892,27733,25159,32558,22674,20260,21830,36175,26188,19978,23578,35059,26786,25422,31245,28903,33421,21242,38902,23569,21736,37045,32461,22882,36170,34503,33292,33293,36198,25668,23556,24913,28041,31038,35774,30775,30003,21627,20280,36523,28145,23072,32453,31070,27784,23457,23158,29978,32958,24910,28183,22768,29983,29989,29298,21319,32499,34051,34052,34053,34054,34055,34056,34057,34058,34059,34061,34062,34063,34064,34066,34068,34069,34070,34072,34073,34075,34076,34077,34078,34080,34082,34083,34084,34085,34086,34087,34088,34089,34090,34093,34094,34095,34096,34097,34098,34099,34100,34101,34102,34110,34111,34112,34113,34114,34116,34117,34118,34119,34123,34124,34125,34126,34127,34128,34129,34130,34131,34132,34133,34135,34136,34138,34139,34140,34141,34143,34144,34145,34146,34147,34149,34150,34151,34153,34154,34155,34156,34157,34158,34159,34160,34161,34163,34165,34166,34167,34168,34172,34173,34175,34176,34177,30465,30427,21097,32988,22307,24072,22833,29422,26045,28287,35799,23608,34417,21313,30707,25342,26102,20160,39135,34432,23454,35782,21490,30690,20351,23630,39542,22987,24335,31034,22763,19990,26623,20107,25325,35475,36893,21183,26159,21980,22124,36866,20181,20365,37322,39280,27663,24066,24643,23460,35270,35797,25910,25163,39318,23432,23551,25480,21806,21463,30246,20861,34092,26530,26803,27530,25234,36755,21460,33298,28113,30095,20070,36174,23408,29087,34223,26257,26329,32626,34560,40653,40736,23646,26415,36848,26641,26463,25101,31446,22661,24246,25968,28465,34178,34179,34182,34184,34185,34186,34187,34188,34189,34190,34192,34193,34194,34195,34196,34197,34198,34199,34200,34201,34202,34205,34206,34207,34208,34209,34210,34211,34213,34214,34215,34217,34219,34220,34221,34225,34226,34227,34228,34229,34230,34232,34234,34235,34236,34237,34238,34239,34240,34242,34243,34244,34245,34246,34247,34248,34250,34251,34252,34253,34254,34257,34258,34260,34262,34263,34264,34265,34266,34267,34269,34270,34271,34272,34273,34274,34275,34277,34278,34279,34280,34282,34283,34284,34285,34286,34287,34288,34289,34290,34291,34292,34293,34294,34295,34296,24661,21047,32781,25684,34928,29993,24069,26643,25332,38684,21452,29245,35841,27700,30561,31246,21550,30636,39034,33308,35828,30805,26388,28865,26031,25749,22070,24605,31169,21496,19997,27515,32902,23546,21987,22235,20282,20284,39282,24051,26494,32824,24578,39042,36865,23435,35772,35829,25628,33368,25822,22013,33487,37221,20439,32032,36895,31903,20723,22609,28335,23487,35785,32899,37240,33948,31639,34429,38539,38543,32485,39635,30862,23681,31319,36930,38567,31071,23385,25439,31499,34001,26797,21766,32553,29712,32034,38145,25152,22604,20182,23427,22905,22612,34297,34298,34300,34301,34302,34304,34305,34306,34307,34308,34310,34311,34312,34313,34314,34315,34316,34317,34318,34319,34320,34322,34323,34324,34325,34327,34328,34329,34330,34331,34332,34333,34334,34335,34336,34337,34338,34339,34340,34341,34342,34344,34346,34347,34348,34349,34350,34351,34352,34353,34354,34355,34356,34357,34358,34359,34361,34362,34363,34365,34366,34367,34368,34369,34370,34371,34372,34373,34374,34375,34376,34377,34378,34379,34380,34386,34387,34389,34390,34391,34392,34393,34395,34396,34397,34399,34400,34401,34403,34404,34405,34406,34407,34408,34409,34410,29549,25374,36427,36367,32974,33492,25260,21488,27888,37214,22826,24577,27760,22349,25674,36138,30251,28393,22363,27264,30192,28525,35885,35848,22374,27631,34962,30899,25506,21497,28845,27748,22616,25642,22530,26848,33179,21776,31958,20504,36538,28108,36255,28907,25487,28059,28372,32486,33796,26691,36867,28120,38518,35752,22871,29305,34276,33150,30140,35466,26799,21076,36386,38161,25552,39064,36420,21884,20307,26367,22159,24789,28053,21059,23625,22825,28155,22635,30000,29980,24684,33300,33094,25361,26465,36834,30522,36339,36148,38081,24086,21381,21548,28867,34413,34415,34416,34418,34419,34420,34421,34422,34423,34424,34435,34436,34437,34438,34439,34440,34441,34446,34447,34448,34449,34450,34452,34454,34455,34456,34457,34458,34459,34462,34463,34464,34465,34466,34469,34470,34475,34477,34478,34482,34483,34487,34488,34489,34491,34492,34493,34494,34495,34497,34498,34499,34501,34504,34508,34509,34514,34515,34517,34518,34519,34522,34524,34525,34528,34529,34530,34531,34533,34534,34535,34536,34538,34539,34540,34543,34549,34550,34551,34554,34555,34556,34557,34559,34561,34564,34565,34566,34571,34572,34574,34575,34576,34577,34580,34582,27712,24311,20572,20141,24237,25402,33351,36890,26704,37230,30643,21516,38108,24420,31461,26742,25413,31570,32479,30171,20599,25237,22836,36879,20984,31171,31361,22270,24466,36884,28034,23648,22303,21520,20820,28237,22242,25512,39059,33151,34581,35114,36864,21534,23663,33216,25302,25176,33073,40501,38464,39534,39548,26925,22949,25299,21822,25366,21703,34521,27964,23043,29926,34972,27498,22806,35916,24367,28286,29609,39037,20024,28919,23436,30871,25405,26202,30358,24779,23451,23113,19975,33109,27754,29579,20129,26505,32593,24448,26106,26395,24536,22916,23041,34585,34587,34589,34591,34592,34596,34598,34599,34600,34602,34603,34604,34605,34607,34608,34610,34611,34613,34614,34616,34617,34618,34620,34621,34624,34625,34626,34627,34628,34629,34630,34634,34635,34637,34639,34640,34641,34642,34644,34645,34646,34648,34650,34651,34652,34653,34654,34655,34657,34658,34662,34663,34664,34665,34666,34667,34668,34669,34671,34673,34674,34675,34677,34679,34680,34681,34682,34687,34688,34689,34692,34694,34695,34697,34698,34700,34702,34703,34704,34705,34706,34708,34709,34710,34712,34713,34714,34715,34716,34717,34718,34720,34721,34722,34723,34724,24013,24494,21361,38886,36829,26693,22260,21807,24799,20026,28493,32500,33479,33806,22996,20255,20266,23614,32428,26410,34074,21619,30031,32963,21890,39759,20301,28205,35859,23561,24944,21355,30239,28201,34442,25991,38395,32441,21563,31283,32010,38382,21985,32705,29934,25373,34583,28065,31389,25105,26017,21351,25569,27779,24043,21596,38056,20044,27745,35820,23627,26080,33436,26791,21566,21556,27595,27494,20116,25410,21320,33310,20237,20398,22366,25098,38654,26212,29289,21247,21153,24735,35823,26132,29081,26512,35199,30802,30717,26224,22075,21560,38177,29306,34725,34726,34727,34729,34730,34734,34736,34737,34738,34740,34742,34743,34744,34745,34747,34748,34750,34751,34753,34754,34755,34756,34757,34759,34760,34761,34764,34765,34766,34767,34768,34772,34773,34774,34775,34776,34777,34778,34780,34781,34782,34783,34785,34786,34787,34788,34790,34791,34792,34793,34795,34796,34797,34799,34800,34801,34802,34803,34804,34805,34806,34807,34808,34810,34811,34812,34813,34815,34816,34817,34818,34820,34821,34822,34823,34824,34825,34827,34828,34829,34830,34831,34832,34833,34834,34836,34839,34840,34841,34842,34844,34845,34846,34847,34848,34851,31232,24687,24076,24713,33181,22805,24796,29060,28911,28330,27728,29312,27268,34989,24109,20064,23219,21916,38115,27927,31995,38553,25103,32454,30606,34430,21283,38686,36758,26247,23777,20384,29421,19979,21414,22799,21523,25472,38184,20808,20185,40092,32420,21688,36132,34900,33335,38386,28046,24358,23244,26174,38505,29616,29486,21439,33146,39301,32673,23466,38519,38480,32447,30456,21410,38262,39321,31665,35140,28248,20065,32724,31077,35814,24819,21709,20139,39033,24055,27233,20687,21521,35937,33831,30813,38660,21066,21742,22179,38144,28040,23477,28102,26195,34852,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34867,34868,34869,34870,34871,34872,34874,34875,34877,34878,34879,34881,34882,34883,34886,34887,34888,34889,34890,34891,34894,34895,34896,34897,34898,34899,34901,34902,34904,34906,34907,34908,34909,34910,34911,34912,34918,34919,34922,34925,34927,34929,34931,34932,34933,34934,34936,34937,34938,34939,34940,34944,34947,34950,34951,34953,34954,34956,34958,34959,34960,34961,34963,34964,34965,34967,34968,34969,34970,34971,34973,34974,34975,34976,34977,34979,34981,34982,34983,34984,34985,34986,23567,23389,26657,32918,21880,31505,25928,26964,20123,27463,34638,38795,21327,25375,25658,37034,26012,32961,35856,20889,26800,21368,34809,25032,27844,27899,35874,23633,34218,33455,38156,27427,36763,26032,24571,24515,20449,34885,26143,33125,29481,24826,20852,21009,22411,24418,37026,34892,37266,24184,26447,24615,22995,20804,20982,33016,21256,27769,38596,29066,20241,20462,32670,26429,21957,38152,31168,34966,32483,22687,25100,38656,34394,22040,39035,24464,35768,33988,37207,21465,26093,24207,30044,24676,32110,23167,32490,32493,36713,21927,23459,24748,26059,29572,34988,34990,34991,34992,34994,34995,34996,34997,34998,35000,35001,35002,35003,35005,35006,35007,35008,35011,35012,35015,35016,35018,35019,35020,35021,35023,35024,35025,35027,35030,35031,35034,35035,35036,35037,35038,35040,35041,35046,35047,35049,35050,35051,35052,35053,35054,35055,35058,35061,35062,35063,35066,35067,35069,35071,35072,35073,35075,35076,35077,35078,35079,35080,35081,35083,35084,35085,35086,35087,35089,35092,35093,35094,35095,35096,35100,35101,35102,35103,35104,35106,35107,35108,35110,35111,35112,35113,35116,35117,35118,35119,35121,35122,35123,35125,35127,36873,30307,30505,32474,38772,34203,23398,31348,38634,34880,21195,29071,24490,26092,35810,23547,39535,24033,27529,27739,35757,35759,36874,36805,21387,25276,40486,40493,21568,20011,33469,29273,34460,23830,34905,28079,38597,21713,20122,35766,28937,21693,38409,28895,28153,30416,20005,30740,34578,23721,24310,35328,39068,38414,28814,27839,22852,25513,30524,34893,28436,33395,22576,29141,21388,30746,38593,21761,24422,28976,23476,35866,39564,27523,22830,40495,31207,26472,25196,20335,30113,32650,27915,38451,27687,20208,30162,20859,26679,28478,36992,33136,22934,29814,35128,35129,35130,35131,35132,35133,35134,35135,35136,35138,35139,35141,35142,35143,35144,35145,35146,35147,35148,35149,35150,35151,35152,35153,35154,35155,35156,35157,35158,35159,35160,35161,35162,35163,35164,35165,35168,35169,35170,35171,35172,35173,35175,35176,35177,35178,35179,35180,35181,35182,35183,35184,35185,35186,35187,35188,35189,35190,35191,35192,35193,35194,35196,35197,35198,35200,35202,35204,35205,35207,35208,35209,35210,35211,35212,35213,35214,35215,35216,35217,35218,35219,35220,35221,35222,35223,35224,35225,35226,35227,35228,35229,35230,35231,35232,35233,25671,23591,36965,31377,35875,23002,21676,33280,33647,35201,32768,26928,22094,32822,29239,37326,20918,20063,39029,25494,19994,21494,26355,33099,22812,28082,19968,22777,21307,25558,38129,20381,20234,34915,39056,22839,36951,31227,20202,33008,30097,27778,23452,23016,24413,26885,34433,20506,24050,20057,30691,20197,33402,25233,26131,37009,23673,20159,24441,33222,36920,32900,30123,20134,35028,24847,27589,24518,20041,30410,28322,35811,35758,35850,35793,24322,32764,32716,32462,33589,33643,22240,27575,38899,38452,23035,21535,38134,28139,23493,39278,23609,24341,38544,35234,35235,35236,35237,35238,35239,35240,35241,35242,35243,35244,35245,35246,35247,35248,35249,35250,35251,35252,35253,35254,35255,35256,35257,35258,35259,35260,35261,35262,35263,35264,35267,35277,35283,35284,35285,35287,35288,35289,35291,35293,35295,35296,35297,35298,35300,35303,35304,35305,35306,35308,35309,35310,35312,35313,35314,35316,35317,35318,35319,35320,35321,35322,35323,35324,35325,35326,35327,35329,35330,35331,35332,35333,35334,35336,35337,35338,35339,35340,35341,35342,35343,35344,35345,35346,35347,35348,35349,35350,35351,35352,35353,35354,35355,35356,35357,21360,33521,27185,23156,40560,24212,32552,33721,33828,33829,33639,34631,36814,36194,30408,24433,39062,30828,26144,21727,25317,20323,33219,30152,24248,38605,36362,34553,21647,27891,28044,27704,24703,21191,29992,24189,20248,24736,24551,23588,30001,37038,38080,29369,27833,28216,37193,26377,21451,21491,20305,37321,35825,21448,24188,36802,28132,20110,30402,27014,34398,24858,33286,20313,20446,36926,40060,24841,28189,28180,38533,20104,23089,38632,19982,23679,31161,23431,35821,32701,29577,22495,33419,37057,21505,36935,21947,23786,24481,24840,27442,29425,32946,35465,35358,35359,35360,35361,35362,35363,35364,35365,35366,35367,35368,35369,35370,35371,35372,35373,35374,35375,35376,35377,35378,35379,35380,35381,35382,35383,35384,35385,35386,35387,35388,35389,35391,35392,35393,35394,35395,35396,35397,35398,35399,35401,35402,35403,35404,35405,35406,35407,35408,35409,35410,35411,35412,35413,35414,35415,35416,35417,35418,35419,35420,35421,35422,35423,35424,35425,35426,35427,35428,35429,35430,35431,35432,35433,35434,35435,35436,35437,35438,35439,35440,35441,35442,35443,35444,35445,35446,35447,35448,35450,35451,35452,35453,35454,35455,35456,28020,23507,35029,39044,35947,39533,40499,28170,20900,20803,22435,34945,21407,25588,36757,22253,21592,22278,29503,28304,32536,36828,33489,24895,24616,38498,26352,32422,36234,36291,38053,23731,31908,26376,24742,38405,32792,20113,37095,21248,38504,20801,36816,34164,37213,26197,38901,23381,21277,30776,26434,26685,21705,28798,23472,36733,20877,22312,21681,25874,26242,36190,36163,33039,33900,36973,31967,20991,34299,26531,26089,28577,34468,36481,22122,36896,30338,28790,29157,36131,25321,21017,27901,36156,24590,22686,24974,26366,36192,25166,21939,28195,26413,36711,35457,35458,35459,35460,35461,35462,35463,35464,35467,35468,35469,35470,35471,35472,35473,35474,35476,35477,35478,35479,35480,35481,35482,35483,35484,35485,35486,35487,35488,35489,35490,35491,35492,35493,35494,35495,35496,35497,35498,35499,35500,35501,35502,35503,35504,35505,35506,35507,35508,35509,35510,35511,35512,35513,35514,35515,35516,35517,35518,35519,35520,35521,35522,35523,35524,35525,35526,35527,35528,35529,35530,35531,35532,35533,35534,35535,35536,35537,35538,35539,35540,35541,35542,35543,35544,35545,35546,35547,35548,35549,35550,35551,35552,35553,35554,35555,38113,38392,30504,26629,27048,21643,20045,28856,35784,25688,25995,23429,31364,20538,23528,30651,27617,35449,31896,27838,30415,26025,36759,23853,23637,34360,26632,21344,25112,31449,28251,32509,27167,31456,24432,28467,24352,25484,28072,26454,19976,24080,36134,20183,32960,30260,38556,25307,26157,25214,27836,36213,29031,32617,20806,32903,21484,36974,25240,21746,34544,36761,32773,38167,34071,36825,27993,29645,26015,30495,29956,30759,33275,36126,38024,20390,26517,30137,35786,38663,25391,38215,38453,33976,25379,30529,24449,29424,20105,24596,25972,25327,27491,25919,35556,35557,35558,35559,35560,35561,35562,35563,35564,35565,35566,35567,35568,35569,35570,35571,35572,35573,35574,35575,35576,35577,35578,35579,35580,35581,35582,35583,35584,35585,35586,35587,35588,35589,35590,35592,35593,35594,35595,35596,35597,35598,35599,35600,35601,35602,35603,35604,35605,35606,35607,35608,35609,35610,35611,35612,35613,35614,35615,35616,35617,35618,35619,35620,35621,35623,35624,35625,35626,35627,35628,35629,35630,35631,35632,35633,35634,35635,35636,35637,35638,35639,35640,35641,35642,35643,35644,35645,35646,35647,35648,35649,35650,35651,35652,35653,24103,30151,37073,35777,33437,26525,25903,21553,34584,30693,32930,33026,27713,20043,32455,32844,30452,26893,27542,25191,20540,20356,22336,25351,27490,36286,21482,26088,32440,24535,25370,25527,33267,33268,32622,24092,23769,21046,26234,31209,31258,36136,28825,30164,28382,27835,31378,20013,30405,24544,38047,34935,32456,31181,32959,37325,20210,20247,33311,21608,24030,27954,35788,31909,36724,32920,24090,21650,30385,23449,26172,39588,29664,26666,34523,26417,29482,35832,35803,36880,31481,28891,29038,25284,30633,22065,20027,33879,26609,21161,34496,36142,38136,31569,35654,35655,35656,35657,35658,35659,35660,35661,35662,35663,35664,35665,35666,35667,35668,35669,35670,35671,35672,35673,35674,35675,35676,35677,35678,35679,35680,35681,35682,35683,35684,35685,35687,35688,35689,35690,35691,35693,35694,35695,35696,35697,35698,35699,35700,35701,35702,35703,35704,35705,35706,35707,35708,35709,35710,35711,35712,35713,35714,35715,35716,35717,35718,35719,35720,35721,35722,35723,35724,35725,35726,35727,35728,35729,35730,35731,35732,35733,35734,35735,35736,35737,35738,35739,35740,35741,35742,35743,35756,35761,35771,35783,35792,35818,35849,35870,20303,27880,31069,39547,25235,29226,25341,19987,30742,36716,25776,36186,31686,26729,24196,35013,22918,25758,22766,29366,26894,38181,36861,36184,22368,32512,35846,20934,25417,25305,21331,26700,29730,33537,37196,21828,30528,28796,27978,20857,21672,36164,23039,28363,28100,23388,32043,20180,31869,28371,23376,33258,28173,23383,39683,26837,36394,23447,32508,24635,32437,37049,36208,22863,25549,31199,36275,21330,26063,31062,35781,38459,32452,38075,32386,22068,37257,26368,32618,23562,36981,26152,24038,20304,26590,20570,20316,22352,24231,59408,59409,59410,59411,59412,35896,35897,35898,35899,35900,35901,35902,35903,35904,35906,35907,35908,35909,35912,35914,35915,35917,35918,35919,35920,35921,35922,35923,35924,35926,35927,35928,35929,35931,35932,35933,35934,35935,35936,35939,35940,35941,35942,35943,35944,35945,35948,35949,35950,35951,35952,35953,35954,35956,35957,35958,35959,35963,35964,35965,35966,35967,35968,35969,35971,35972,35974,35975,35976,35979,35981,35982,35983,35984,35985,35986,35987,35989,35990,35991,35993,35994,35995,35996,35997,35998,35999,36000,36001,36002,36003,36004,36005,36006,36007,36008,36009,36010,36011,36012,36013,20109,19980,20800,19984,24319,21317,19989,20120,19998,39730,23404,22121,20008,31162,20031,21269,20039,22829,29243,21358,27664,22239,32996,39319,27603,30590,40727,20022,20127,40720,20060,20073,20115,33416,23387,21868,22031,20164,21389,21405,21411,21413,21422,38757,36189,21274,21493,21286,21294,21310,36188,21350,21347,20994,21000,21006,21037,21043,21055,21056,21068,21086,21089,21084,33967,21117,21122,21121,21136,21139,20866,32596,20155,20163,20169,20162,20200,20193,20203,20190,20251,20211,20258,20324,20213,20261,20263,20233,20267,20318,20327,25912,20314,20317,36014,36015,36016,36017,36018,36019,36020,36021,36022,36023,36024,36025,36026,36027,36028,36029,36030,36031,36032,36033,36034,36035,36036,36037,36038,36039,36040,36041,36042,36043,36044,36045,36046,36047,36048,36049,36050,36051,36052,36053,36054,36055,36056,36057,36058,36059,36060,36061,36062,36063,36064,36065,36066,36067,36068,36069,36070,36071,36072,36073,36074,36075,36076,36077,36078,36079,36080,36081,36082,36083,36084,36085,36086,36087,36088,36089,36090,36091,36092,36093,36094,36095,36096,36097,36098,36099,36100,36101,36102,36103,36104,36105,36106,36107,36108,36109,20319,20311,20274,20285,20342,20340,20369,20361,20355,20367,20350,20347,20394,20348,20396,20372,20454,20456,20458,20421,20442,20451,20444,20433,20447,20472,20521,20556,20467,20524,20495,20526,20525,20478,20508,20492,20517,20520,20606,20547,20565,20552,20558,20588,20603,20645,20647,20649,20666,20694,20742,20717,20716,20710,20718,20743,20747,20189,27709,20312,20325,20430,40864,27718,31860,20846,24061,40649,39320,20865,22804,21241,21261,35335,21264,20971,22809,20821,20128,20822,20147,34926,34980,20149,33044,35026,31104,23348,34819,32696,20907,20913,20925,20924,36110,36111,36112,36113,36114,36115,36116,36117,36118,36119,36120,36121,36122,36123,36124,36128,36177,36178,36183,36191,36197,36200,36201,36202,36204,36206,36207,36209,36210,36216,36217,36218,36219,36220,36221,36222,36223,36224,36226,36227,36230,36231,36232,36233,36236,36237,36238,36239,36240,36242,36243,36245,36246,36247,36248,36249,36250,36251,36252,36253,36254,36256,36257,36258,36260,36261,36262,36263,36264,36265,36266,36267,36268,36269,36270,36271,36272,36274,36278,36279,36281,36283,36285,36288,36289,36290,36293,36295,36296,36297,36298,36301,36304,36306,36307,36308,20935,20886,20898,20901,35744,35750,35751,35754,35764,35765,35767,35778,35779,35787,35791,35790,35794,35795,35796,35798,35800,35801,35804,35807,35808,35812,35816,35817,35822,35824,35827,35830,35833,35836,35839,35840,35842,35844,35847,35852,35855,35857,35858,35860,35861,35862,35865,35867,35864,35869,35871,35872,35873,35877,35879,35882,35883,35886,35887,35890,35891,35893,35894,21353,21370,38429,38434,38433,38449,38442,38461,38460,38466,38473,38484,38495,38503,38508,38514,38516,38536,38541,38551,38576,37015,37019,37021,37017,37036,37025,37044,37043,37046,37050,36309,36312,36313,36316,36320,36321,36322,36325,36326,36327,36329,36333,36334,36336,36337,36338,36340,36342,36348,36350,36351,36352,36353,36354,36355,36356,36358,36359,36360,36363,36365,36366,36368,36369,36370,36371,36373,36374,36375,36376,36377,36378,36379,36380,36384,36385,36388,36389,36390,36391,36392,36395,36397,36400,36402,36403,36404,36406,36407,36408,36411,36412,36414,36415,36419,36421,36422,36428,36429,36430,36431,36432,36435,36436,36437,36438,36439,36440,36442,36443,36444,36445,36446,36447,36448,36449,36450,36451,36452,36453,36455,36456,36458,36459,36462,36465,37048,37040,37071,37061,37054,37072,37060,37063,37075,37094,37090,37084,37079,37083,37099,37103,37118,37124,37154,37150,37155,37169,37167,37177,37187,37190,21005,22850,21154,21164,21165,21182,21759,21200,21206,21232,21471,29166,30669,24308,20981,20988,39727,21430,24321,30042,24047,22348,22441,22433,22654,22716,22725,22737,22313,22316,22314,22323,22329,22318,22319,22364,22331,22338,22377,22405,22379,22406,22396,22395,22376,22381,22390,22387,22445,22436,22412,22450,22479,22439,22452,22419,22432,22485,22488,22490,22489,22482,22456,22516,22511,22520,22500,22493,36467,36469,36471,36472,36473,36474,36475,36477,36478,36480,36482,36483,36484,36486,36488,36489,36490,36491,36492,36493,36494,36497,36498,36499,36501,36502,36503,36504,36505,36506,36507,36509,36511,36512,36513,36514,36515,36516,36517,36518,36519,36520,36521,36522,36525,36526,36528,36529,36531,36532,36533,36534,36535,36536,36537,36539,36540,36541,36542,36543,36544,36545,36546,36547,36548,36549,36550,36551,36552,36553,36554,36555,36556,36557,36559,36560,36561,36562,36563,36564,36565,36566,36567,36568,36569,36570,36571,36572,36573,36574,36575,36576,36577,36578,36579,36580,22539,22541,22525,22509,22528,22558,22553,22596,22560,22629,22636,22657,22665,22682,22656,39336,40729,25087,33401,33405,33407,33423,33418,33448,33412,33422,33425,33431,33433,33451,33464,33470,33456,33480,33482,33507,33432,33463,33454,33483,33484,33473,33449,33460,33441,33450,33439,33476,33486,33444,33505,33545,33527,33508,33551,33543,33500,33524,33490,33496,33548,33531,33491,33553,33562,33542,33556,33557,33504,33493,33564,33617,33627,33628,33544,33682,33596,33588,33585,33691,33630,33583,33615,33607,33603,33631,33600,33559,33632,33581,33594,33587,33638,33637,36581,36582,36583,36584,36585,36586,36587,36588,36589,36590,36591,36592,36593,36594,36595,36596,36597,36598,36599,36600,36601,36602,36603,36604,36605,36606,36607,36608,36609,36610,36611,36612,36613,36614,36615,36616,36617,36618,36619,36620,36621,36622,36623,36624,36625,36626,36627,36628,36629,36630,36631,36632,36633,36634,36635,36636,36637,36638,36639,36640,36641,36642,36643,36644,36645,36646,36647,36648,36649,36650,36651,36652,36653,36654,36655,36656,36657,36658,36659,36660,36661,36662,36663,36664,36665,36666,36667,36668,36669,36670,36671,36672,36673,36674,36675,36676,33640,33563,33641,33644,33642,33645,33646,33712,33656,33715,33716,33696,33706,33683,33692,33669,33660,33718,33705,33661,33720,33659,33688,33694,33704,33722,33724,33729,33793,33765,33752,22535,33816,33803,33757,33789,33750,33820,33848,33809,33798,33748,33759,33807,33795,33784,33785,33770,33733,33728,33830,33776,33761,33884,33873,33882,33881,33907,33927,33928,33914,33929,33912,33852,33862,33897,33910,33932,33934,33841,33901,33985,33997,34000,34022,33981,34003,33994,33983,33978,34016,33953,33977,33972,33943,34021,34019,34060,29965,34104,34032,34105,34079,34106,36677,36678,36679,36680,36681,36682,36683,36684,36685,36686,36687,36688,36689,36690,36691,36692,36693,36694,36695,36696,36697,36698,36699,36700,36701,36702,36703,36704,36705,36706,36707,36708,36709,36714,36736,36748,36754,36765,36768,36769,36770,36772,36773,36774,36775,36778,36780,36781,36782,36783,36786,36787,36788,36789,36791,36792,36794,36795,36796,36799,36800,36803,36806,36809,36810,36811,36812,36813,36815,36818,36822,36823,36826,36832,36833,36835,36839,36844,36847,36849,36850,36852,36853,36854,36858,36859,36860,36862,36863,36871,36872,36876,36878,36883,36885,36888,34134,34107,34047,34044,34137,34120,34152,34148,34142,34170,30626,34115,34162,34171,34212,34216,34183,34191,34169,34222,34204,34181,34233,34231,34224,34259,34241,34268,34303,34343,34309,34345,34326,34364,24318,24328,22844,22849,32823,22869,22874,22872,21263,23586,23589,23596,23604,25164,25194,25247,25275,25290,25306,25303,25326,25378,25334,25401,25419,25411,25517,25590,25457,25466,25486,25524,25453,25516,25482,25449,25518,25532,25586,25592,25568,25599,25540,25566,25550,25682,25542,25534,25669,25665,25611,25627,25632,25612,25638,25633,25694,25732,25709,25750,36889,36892,36899,36900,36901,36903,36904,36905,36906,36907,36908,36912,36913,36914,36915,36916,36919,36921,36922,36925,36927,36928,36931,36933,36934,36936,36937,36938,36939,36940,36942,36948,36949,36950,36953,36954,36956,36957,36958,36959,36960,36961,36964,36966,36967,36969,36970,36971,36972,36975,36976,36977,36978,36979,36982,36983,36984,36985,36986,36987,36988,36990,36993,36996,36997,36998,36999,37001,37002,37004,37005,37006,37007,37008,37010,37012,37014,37016,37018,37020,37022,37023,37024,37028,37029,37031,37032,37033,37035,37037,37042,37047,37052,37053,37055,37056,25722,25783,25784,25753,25786,25792,25808,25815,25828,25826,25865,25893,25902,24331,24530,29977,24337,21343,21489,21501,21481,21480,21499,21522,21526,21510,21579,21586,21587,21588,21590,21571,21537,21591,21593,21539,21554,21634,21652,21623,21617,21604,21658,21659,21636,21622,21606,21661,21712,21677,21698,21684,21714,21671,21670,21715,21716,21618,21667,21717,21691,21695,21708,21721,21722,21724,21673,21674,21668,21725,21711,21726,21787,21735,21792,21757,21780,21747,21794,21795,21775,21777,21799,21802,21863,21903,21941,21833,21869,21825,21845,21823,21840,21820,37058,37059,37062,37064,37065,37067,37068,37069,37074,37076,37077,37078,37080,37081,37082,37086,37087,37088,37091,37092,37093,37097,37098,37100,37102,37104,37105,37106,37107,37109,37110,37111,37113,37114,37115,37116,37119,37120,37121,37123,37125,37126,37127,37128,37129,37130,37131,37132,37133,37134,37135,37136,37137,37138,37139,37140,37141,37142,37143,37144,37146,37147,37148,37149,37151,37152,37153,37156,37157,37158,37159,37160,37161,37162,37163,37164,37165,37166,37168,37170,37171,37172,37173,37174,37175,37176,37178,37179,37180,37181,37182,37183,37184,37185,37186,37188,21815,21846,21877,21878,21879,21811,21808,21852,21899,21970,21891,21937,21945,21896,21889,21919,21886,21974,21905,21883,21983,21949,21950,21908,21913,21994,22007,21961,22047,21969,21995,21996,21972,21990,21981,21956,21999,21989,22002,22003,21964,21965,21992,22005,21988,36756,22046,22024,22028,22017,22052,22051,22014,22016,22055,22061,22104,22073,22103,22060,22093,22114,22105,22108,22092,22100,22150,22116,22129,22123,22139,22140,22149,22163,22191,22228,22231,22237,22241,22261,22251,22265,22271,22276,22282,22281,22300,24079,24089,24084,24081,24113,24123,24124,37189,37191,37192,37201,37203,37204,37205,37206,37208,37209,37211,37212,37215,37216,37222,37223,37224,37227,37229,37235,37242,37243,37244,37248,37249,37250,37251,37252,37254,37256,37258,37262,37263,37267,37268,37269,37270,37271,37272,37273,37276,37277,37278,37279,37280,37281,37284,37285,37286,37287,37288,37289,37291,37292,37296,37297,37298,37299,37302,37303,37304,37305,37307,37308,37309,37310,37311,37312,37313,37314,37315,37316,37317,37318,37320,37323,37328,37330,37331,37332,37333,37334,37335,37336,37337,37338,37339,37341,37342,37343,37344,37345,37346,37347,37348,37349,24119,24132,24148,24155,24158,24161,23692,23674,23693,23696,23702,23688,23704,23705,23697,23706,23708,23733,23714,23741,23724,23723,23729,23715,23745,23735,23748,23762,23780,23755,23781,23810,23811,23847,23846,23854,23844,23838,23814,23835,23896,23870,23860,23869,23916,23899,23919,23901,23915,23883,23882,23913,23924,23938,23961,23965,35955,23991,24005,24435,24439,24450,24455,24457,24460,24469,24473,24476,24488,24493,24501,24508,34914,24417,29357,29360,29364,29367,29368,29379,29377,29390,29389,29394,29416,29423,29417,29426,29428,29431,29441,29427,29443,29434,37350,37351,37352,37353,37354,37355,37356,37357,37358,37359,37360,37361,37362,37363,37364,37365,37366,37367,37368,37369,37370,37371,37372,37373,37374,37375,37376,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37387,37388,37389,37390,37391,37392,37393,37394,37395,37396,37397,37398,37399,37400,37401,37402,37403,37404,37405,37406,37407,37408,37409,37410,37411,37412,37413,37414,37415,37416,37417,37418,37419,37420,37421,37422,37423,37424,37425,37426,37427,37428,37429,37430,37431,37432,37433,37434,37435,37436,37437,37438,37439,37440,37441,37442,37443,37444,37445,29435,29463,29459,29473,29450,29470,29469,29461,29474,29497,29477,29484,29496,29489,29520,29517,29527,29536,29548,29551,29566,33307,22821,39143,22820,22786,39267,39271,39272,39273,39274,39275,39276,39284,39287,39293,39296,39300,39303,39306,39309,39312,39313,39315,39316,39317,24192,24209,24203,24214,24229,24224,24249,24245,24254,24243,36179,24274,24273,24283,24296,24298,33210,24516,24521,24534,24527,24579,24558,24580,24545,24548,24574,24581,24582,24554,24557,24568,24601,24629,24614,24603,24591,24589,24617,24619,24586,24639,24609,24696,24697,24699,24698,24642,37446,37447,37448,37449,37450,37451,37452,37453,37454,37455,37456,37457,37458,37459,37460,37461,37462,37463,37464,37465,37466,37467,37468,37469,37470,37471,37472,37473,37474,37475,37476,37477,37478,37479,37480,37481,37482,37483,37484,37485,37486,37487,37488,37489,37490,37491,37493,37494,37495,37496,37497,37498,37499,37500,37501,37502,37503,37504,37505,37506,37507,37508,37509,37510,37511,37512,37513,37514,37515,37516,37517,37519,37520,37521,37522,37523,37524,37525,37526,37527,37528,37529,37530,37531,37532,37533,37534,37535,37536,37537,37538,37539,37540,37541,37542,37543,24682,24701,24726,24730,24749,24733,24707,24722,24716,24731,24812,24763,24753,24797,24792,24774,24794,24756,24864,24870,24853,24867,24820,24832,24846,24875,24906,24949,25004,24980,24999,25015,25044,25077,24541,38579,38377,38379,38385,38387,38389,38390,38396,38398,38403,38404,38406,38408,38410,38411,38412,38413,38415,38418,38421,38422,38423,38425,38426,20012,29247,25109,27701,27732,27740,27722,27811,27781,27792,27796,27788,27752,27753,27764,27766,27782,27817,27856,27860,27821,27895,27896,27889,27863,27826,27872,27862,27898,27883,27886,27825,27859,27887,27902,37544,37545,37546,37547,37548,37549,37551,37552,37553,37554,37555,37556,37557,37558,37559,37560,37561,37562,37563,37564,37565,37566,37567,37568,37569,37570,37571,37572,37573,37574,37575,37577,37578,37579,37580,37581,37582,37583,37584,37585,37586,37587,37588,37589,37590,37591,37592,37593,37594,37595,37596,37597,37598,37599,37600,37601,37602,37603,37604,37605,37606,37607,37608,37609,37610,37611,37612,37613,37614,37615,37616,37617,37618,37619,37620,37621,37622,37623,37624,37625,37626,37627,37628,37629,37630,37631,37632,37633,37634,37635,37636,37637,37638,37639,37640,37641,27961,27943,27916,27971,27976,27911,27908,27929,27918,27947,27981,27950,27957,27930,27983,27986,27988,27955,28049,28015,28062,28064,27998,28051,28052,27996,28000,28028,28003,28186,28103,28101,28126,28174,28095,28128,28177,28134,28125,28121,28182,28075,28172,28078,28203,28270,28238,28267,28338,28255,28294,28243,28244,28210,28197,28228,28383,28337,28312,28384,28461,28386,28325,28327,28349,28347,28343,28375,28340,28367,28303,28354,28319,28514,28486,28487,28452,28437,28409,28463,28470,28491,28532,28458,28425,28457,28553,28557,28556,28536,28530,28540,28538,28625,37642,37643,37644,37645,37646,37647,37648,37649,37650,37651,37652,37653,37654,37655,37656,37657,37658,37659,37660,37661,37662,37663,37664,37665,37666,37667,37668,37669,37670,37671,37672,37673,37674,37675,37676,37677,37678,37679,37680,37681,37682,37683,37684,37685,37686,37687,37688,37689,37690,37691,37692,37693,37695,37696,37697,37698,37699,37700,37701,37702,37703,37704,37705,37706,37707,37708,37709,37710,37711,37712,37713,37714,37715,37716,37717,37718,37719,37720,37721,37722,37723,37724,37725,37726,37727,37728,37729,37730,37731,37732,37733,37734,37735,37736,37737,37739,28617,28583,28601,28598,28610,28641,28654,28638,28640,28655,28698,28707,28699,28729,28725,28751,28766,23424,23428,23445,23443,23461,23480,29999,39582,25652,23524,23534,35120,23536,36423,35591,36790,36819,36821,36837,36846,36836,36841,36838,36851,36840,36869,36868,36875,36902,36881,36877,36886,36897,36917,36918,36909,36911,36932,36945,36946,36944,36968,36952,36962,36955,26297,36980,36989,36994,37000,36995,37003,24400,24407,24406,24408,23611,21675,23632,23641,23409,23651,23654,32700,24362,24361,24365,33396,24380,39739,23662,22913,22915,22925,22953,22954,22947,37740,37741,37742,37743,37744,37745,37746,37747,37748,37749,37750,37751,37752,37753,37754,37755,37756,37757,37758,37759,37760,37761,37762,37763,37764,37765,37766,37767,37768,37769,37770,37771,37772,37773,37774,37776,37777,37778,37779,37780,37781,37782,37783,37784,37785,37786,37787,37788,37789,37790,37791,37792,37793,37794,37795,37796,37797,37798,37799,37800,37801,37802,37803,37804,37805,37806,37807,37808,37809,37810,37811,37812,37813,37814,37815,37816,37817,37818,37819,37820,37821,37822,37823,37824,37825,37826,37827,37828,37829,37830,37831,37832,37833,37835,37836,37837,22935,22986,22955,22942,22948,22994,22962,22959,22999,22974,23045,23046,23005,23048,23011,23000,23033,23052,23049,23090,23092,23057,23075,23059,23104,23143,23114,23125,23100,23138,23157,33004,23210,23195,23159,23162,23230,23275,23218,23250,23252,23224,23264,23267,23281,23254,23270,23256,23260,23305,23319,23318,23346,23351,23360,23573,23580,23386,23397,23411,23377,23379,23394,39541,39543,39544,39546,39551,39549,39552,39553,39557,39560,39562,39568,39570,39571,39574,39576,39579,39580,39581,39583,39584,39586,39587,39589,39591,32415,32417,32419,32421,32424,32425,37838,37839,37840,37841,37842,37843,37844,37845,37847,37848,37849,37850,37851,37852,37853,37854,37855,37856,37857,37858,37859,37860,37861,37862,37863,37864,37865,37866,37867,37868,37869,37870,37871,37872,37873,37874,37875,37876,37877,37878,37879,37880,37881,37882,37883,37884,37885,37886,37887,37888,37889,37890,37891,37892,37893,37894,37895,37896,37897,37898,37899,37900,37901,37902,37903,37904,37905,37906,37907,37908,37909,37910,37911,37912,37913,37914,37915,37916,37917,37918,37919,37920,37921,37922,37923,37924,37925,37926,37927,37928,37929,37930,37931,37932,37933,37934,32429,32432,32446,32448,32449,32450,32457,32459,32460,32464,32468,32471,32475,32480,32481,32488,32491,32494,32495,32497,32498,32525,32502,32506,32507,32510,32513,32514,32515,32519,32520,32523,32524,32527,32529,32530,32535,32537,32540,32539,32543,32545,32546,32547,32548,32549,32550,32551,32554,32555,32556,32557,32559,32560,32561,32562,32563,32565,24186,30079,24027,30014,37013,29582,29585,29614,29602,29599,29647,29634,29649,29623,29619,29632,29641,29640,29669,29657,39036,29706,29673,29671,29662,29626,29682,29711,29738,29787,29734,29733,29736,29744,29742,29740,37935,37936,37937,37938,37939,37940,37941,37942,37943,37944,37945,37946,37947,37948,37949,37951,37952,37953,37954,37955,37956,37957,37958,37959,37960,37961,37962,37963,37964,37965,37966,37967,37968,37969,37970,37971,37972,37973,37974,37975,37976,37977,37978,37979,37980,37981,37982,37983,37984,37985,37986,37987,37988,37989,37990,37991,37992,37993,37994,37996,37997,37998,37999,38000,38001,38002,38003,38004,38005,38006,38007,38008,38009,38010,38011,38012,38013,38014,38015,38016,38017,38018,38019,38020,38033,38038,38040,38087,38095,38099,38100,38106,38118,38139,38172,38176,29723,29722,29761,29788,29783,29781,29785,29815,29805,29822,29852,29838,29824,29825,29831,29835,29854,29864,29865,29840,29863,29906,29882,38890,38891,38892,26444,26451,26462,26440,26473,26533,26503,26474,26483,26520,26535,26485,26536,26526,26541,26507,26487,26492,26608,26633,26584,26634,26601,26544,26636,26585,26549,26586,26547,26589,26624,26563,26552,26594,26638,26561,26621,26674,26675,26720,26721,26702,26722,26692,26724,26755,26653,26709,26726,26689,26727,26688,26686,26698,26697,26665,26805,26767,26740,26743,26771,26731,26818,26990,26876,26911,26912,26873,38183,38195,38205,38211,38216,38219,38229,38234,38240,38254,38260,38261,38263,38264,38265,38266,38267,38268,38269,38270,38272,38273,38274,38275,38276,38277,38278,38279,38280,38281,38282,38283,38284,38285,38286,38287,38288,38289,38290,38291,38292,38293,38294,38295,38296,38297,38298,38299,38300,38301,38302,38303,38304,38305,38306,38307,38308,38309,38310,38311,38312,38313,38314,38315,38316,38317,38318,38319,38320,38321,38322,38323,38324,38325,38326,38327,38328,38329,38330,38331,38332,38333,38334,38335,38336,38337,38338,38339,38340,38341,38342,38343,38344,38345,38346,38347,26916,26864,26891,26881,26967,26851,26896,26993,26937,26976,26946,26973,27012,26987,27008,27032,27000,26932,27084,27015,27016,27086,27017,26982,26979,27001,27035,27047,27067,27051,27053,27092,27057,27073,27082,27103,27029,27104,27021,27135,27183,27117,27159,27160,27237,27122,27204,27198,27296,27216,27227,27189,27278,27257,27197,27176,27224,27260,27281,27280,27305,27287,27307,29495,29522,27521,27522,27527,27524,27538,27539,27533,27546,27547,27553,27562,36715,36717,36721,36722,36723,36725,36726,36728,36727,36729,36730,36732,36734,36737,36738,36740,36743,36747,38348,38349,38350,38351,38352,38353,38354,38355,38356,38357,38358,38359,38360,38361,38362,38363,38364,38365,38366,38367,38368,38369,38370,38371,38372,38373,38374,38375,38380,38399,38407,38419,38424,38427,38430,38432,38435,38436,38437,38438,38439,38440,38441,38443,38444,38445,38447,38448,38455,38456,38457,38458,38462,38465,38467,38474,38478,38479,38481,38482,38483,38486,38487,38488,38489,38490,38492,38493,38494,38496,38499,38501,38502,38507,38509,38510,38511,38512,38513,38515,38520,38521,38522,38523,38524,38525,38526,38527,38528,38529,38530,38531,38532,38535,38537,38538,36749,36750,36751,36760,36762,36558,25099,25111,25115,25119,25122,25121,25125,25124,25132,33255,29935,29940,29951,29967,29969,29971,25908,26094,26095,26096,26122,26137,26482,26115,26133,26112,28805,26359,26141,26164,26161,26166,26165,32774,26207,26196,26177,26191,26198,26209,26199,26231,26244,26252,26279,26269,26302,26331,26332,26342,26345,36146,36147,36150,36155,36157,36160,36165,36166,36168,36169,36167,36173,36181,36185,35271,35274,35275,35276,35278,35279,35280,35281,29294,29343,29277,29286,29295,29310,29311,29316,29323,29325,29327,29330,25352,25394,25520,38540,38542,38545,38546,38547,38549,38550,38554,38555,38557,38558,38559,38560,38561,38562,38563,38564,38565,38566,38568,38569,38570,38571,38572,38573,38574,38575,38577,38578,38580,38581,38583,38584,38586,38587,38591,38594,38595,38600,38602,38603,38608,38609,38611,38612,38614,38615,38616,38617,38618,38619,38620,38621,38622,38623,38625,38626,38627,38628,38629,38630,38631,38635,38636,38637,38638,38640,38641,38642,38644,38645,38648,38650,38651,38652,38653,38655,38658,38659,38661,38666,38667,38668,38672,38673,38674,38676,38677,38679,38680,38681,38682,38683,38685,38687,38688,25663,25816,32772,27626,27635,27645,27637,27641,27653,27655,27654,27661,27669,27672,27673,27674,27681,27689,27684,27690,27698,25909,25941,25963,29261,29266,29270,29232,34402,21014,32927,32924,32915,32956,26378,32957,32945,32939,32941,32948,32951,32999,33000,33001,33002,32987,32962,32964,32985,32973,32983,26384,32989,33003,33009,33012,33005,33037,33038,33010,33020,26389,33042,35930,33078,33054,33068,33048,33074,33096,33100,33107,33140,33113,33114,33137,33120,33129,33148,33149,33133,33127,22605,23221,33160,33154,33169,28373,33187,33194,33228,26406,33226,33211,38689,38690,38691,38692,38693,38694,38695,38696,38697,38699,38700,38702,38703,38705,38707,38708,38709,38710,38711,38714,38715,38716,38717,38719,38720,38721,38722,38723,38724,38725,38726,38727,38728,38729,38730,38731,38732,38733,38734,38735,38736,38737,38740,38741,38743,38744,38746,38748,38749,38751,38755,38756,38758,38759,38760,38762,38763,38764,38765,38766,38767,38768,38769,38770,38773,38775,38776,38777,38778,38779,38781,38782,38783,38784,38785,38786,38787,38788,38790,38791,38792,38793,38794,38796,38798,38799,38800,38803,38805,38806,38807,38809,38810,38811,38812,38813,33217,33190,27428,27447,27449,27459,27462,27481,39121,39122,39123,39125,39129,39130,27571,24384,27586,35315,26000,40785,26003,26044,26054,26052,26051,26060,26062,26066,26070,28800,28828,28822,28829,28859,28864,28855,28843,28849,28904,28874,28944,28947,28950,28975,28977,29043,29020,29032,28997,29042,29002,29048,29050,29080,29107,29109,29096,29088,29152,29140,29159,29177,29213,29224,28780,28952,29030,29113,25150,25149,25155,25160,25161,31035,31040,31046,31049,31067,31068,31059,31066,31074,31063,31072,31087,31079,31098,31109,31114,31130,31143,31155,24529,24528,38814,38815,38817,38818,38820,38821,38822,38823,38824,38825,38826,38828,38830,38832,38833,38835,38837,38838,38839,38840,38841,38842,38843,38844,38845,38846,38847,38848,38849,38850,38851,38852,38853,38854,38855,38856,38857,38858,38859,38860,38861,38862,38863,38864,38865,38866,38867,38868,38869,38870,38871,38872,38873,38874,38875,38876,38877,38878,38879,38880,38881,38882,38883,38884,38885,38888,38894,38895,38896,38897,38898,38900,38903,38904,38905,38906,38907,38908,38909,38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920,38921,38922,38923,38924,38925,38926,24636,24669,24666,24679,24641,24665,24675,24747,24838,24845,24925,25001,24989,25035,25041,25094,32896,32895,27795,27894,28156,30710,30712,30720,30729,30743,30744,30737,26027,30765,30748,30749,30777,30778,30779,30751,30780,30757,30764,30755,30761,30798,30829,30806,30807,30758,30800,30791,30796,30826,30875,30867,30874,30855,30876,30881,30883,30898,30905,30885,30932,30937,30921,30956,30962,30981,30964,30995,31012,31006,31028,40859,40697,40699,40700,30449,30468,30477,30457,30471,30472,30490,30498,30489,30509,30502,30517,30520,30544,30545,30535,30531,30554,30568,38927,38928,38929,38930,38931,38932,38933,38934,38935,38936,38937,38938,38939,38940,38941,38942,38943,38944,38945,38946,38947,38948,38949,38950,38951,38952,38953,38954,38955,38956,38957,38958,38959,38960,38961,38962,38963,38964,38965,38966,38967,38968,38969,38970,38971,38972,38973,38974,38975,38976,38977,38978,38979,38980,38981,38982,38983,38984,38985,38986,38987,38988,38989,38990,38991,38992,38993,38994,38995,38996,38997,38998,38999,39000,39001,39002,39003,39004,39005,39006,39007,39008,39009,39010,39011,39012,39013,39014,39015,39016,39017,39018,39019,39020,39021,39022,30562,30565,30591,30605,30589,30592,30604,30609,30623,30624,30640,30645,30653,30010,30016,30030,30027,30024,30043,30066,30073,30083,32600,32609,32607,35400,32616,32628,32625,32633,32641,32638,30413,30437,34866,38021,38022,38023,38027,38026,38028,38029,38031,38032,38036,38039,38037,38042,38043,38044,38051,38052,38059,38058,38061,38060,38063,38064,38066,38068,38070,38071,38072,38073,38074,38076,38077,38079,38084,38088,38089,38090,38091,38092,38093,38094,38096,38097,38098,38101,38102,38103,38105,38104,38107,38110,38111,38112,38114,38116,38117,38119,38120,38122,39023,39024,39025,39026,39027,39028,39051,39054,39058,39061,39065,39075,39080,39081,39082,39083,39084,39085,39086,39087,39088,39089,39090,39091,39092,39093,39094,39095,39096,39097,39098,39099,39100,39101,39102,39103,39104,39105,39106,39107,39108,39109,39110,39111,39112,39113,39114,39115,39116,39117,39119,39120,39124,39126,39127,39131,39132,39133,39136,39137,39138,39139,39140,39141,39142,39145,39146,39147,39148,39149,39150,39151,39152,39153,39154,39155,39156,39157,39158,39159,39160,39161,39162,39163,39164,39165,39166,39167,39168,39169,39170,39171,39172,39173,39174,39175,38121,38123,38126,38127,38131,38132,38133,38135,38137,38140,38141,38143,38147,38146,38150,38151,38153,38154,38157,38158,38159,38162,38163,38164,38165,38166,38168,38171,38173,38174,38175,38178,38186,38187,38185,38188,38193,38194,38196,38198,38199,38200,38204,38206,38207,38210,38197,38212,38213,38214,38217,38220,38222,38223,38226,38227,38228,38230,38231,38232,38233,38235,38238,38239,38237,38241,38242,38244,38245,38246,38247,38248,38249,38250,38251,38252,38255,38257,38258,38259,38202,30695,30700,38601,31189,31213,31203,31211,31238,23879,31235,31234,31262,31252,39176,39177,39178,39179,39180,39182,39183,39185,39186,39187,39188,39189,39190,39191,39192,39193,39194,39195,39196,39197,39198,39199,39200,39201,39202,39203,39204,39205,39206,39207,39208,39209,39210,39211,39212,39213,39215,39216,39217,39218,39219,39220,39221,39222,39223,39224,39225,39226,39227,39228,39229,39230,39231,39232,39233,39234,39235,39236,39237,39238,39239,39240,39241,39242,39243,39244,39245,39246,39247,39248,39249,39250,39251,39254,39255,39256,39257,39258,39259,39260,39261,39262,39263,39264,39265,39266,39268,39270,39283,39288,39289,39291,39294,39298,39299,39305,31289,31287,31313,40655,39333,31344,30344,30350,30355,30361,30372,29918,29920,29996,40480,40482,40488,40489,40490,40491,40492,40498,40497,40502,40504,40503,40505,40506,40510,40513,40514,40516,40518,40519,40520,40521,40523,40524,40526,40529,40533,40535,40538,40539,40540,40542,40547,40550,40551,40552,40553,40554,40555,40556,40561,40557,40563,30098,30100,30102,30112,30109,30124,30115,30131,30132,30136,30148,30129,30128,30147,30146,30166,30157,30179,30184,30182,30180,30187,30183,30211,30193,30204,30207,30224,30208,30213,30220,30231,30218,30245,30232,30229,30233,39308,39310,39322,39323,39324,39325,39326,39327,39328,39329,39330,39331,39332,39334,39335,39337,39338,39339,39340,39341,39342,39343,39344,39345,39346,39347,39348,39349,39350,39351,39352,39353,39354,39355,39356,39357,39358,39359,39360,39361,39362,39363,39364,39365,39366,39367,39368,39369,39370,39371,39372,39373,39374,39375,39376,39377,39378,39379,39380,39381,39382,39383,39384,39385,39386,39387,39388,39389,39390,39391,39392,39393,39394,39395,39396,39397,39398,39399,39400,39401,39402,39403,39404,39405,39406,39407,39408,39409,39410,39411,39412,39413,39414,39415,39416,39417,30235,30268,30242,30240,30272,30253,30256,30271,30261,30275,30270,30259,30285,30302,30292,30300,30294,30315,30319,32714,31462,31352,31353,31360,31366,31368,31381,31398,31392,31404,31400,31405,31411,34916,34921,34930,34941,34943,34946,34978,35014,34999,35004,35017,35042,35022,35043,35045,35057,35098,35068,35048,35070,35056,35105,35097,35091,35099,35082,35124,35115,35126,35137,35174,35195,30091,32997,30386,30388,30684,32786,32788,32790,32796,32800,32802,32805,32806,32807,32809,32808,32817,32779,32821,32835,32838,32845,32850,32873,32881,35203,39032,39040,39043,39418,39419,39420,39421,39422,39423,39424,39425,39426,39427,39428,39429,39430,39431,39432,39433,39434,39435,39436,39437,39438,39439,39440,39441,39442,39443,39444,39445,39446,39447,39448,39449,39450,39451,39452,39453,39454,39455,39456,39457,39458,39459,39460,39461,39462,39463,39464,39465,39466,39467,39468,39469,39470,39471,39472,39473,39474,39475,39476,39477,39478,39479,39480,39481,39482,39483,39484,39485,39486,39487,39488,39489,39490,39491,39492,39493,39494,39495,39496,39497,39498,39499,39500,39501,39502,39503,39504,39505,39506,39507,39508,39509,39510,39511,39512,39513,39049,39052,39053,39055,39060,39066,39067,39070,39071,39073,39074,39077,39078,34381,34388,34412,34414,34431,34426,34428,34427,34472,34445,34443,34476,34461,34471,34467,34474,34451,34473,34486,34500,34485,34510,34480,34490,34481,34479,34505,34511,34484,34537,34545,34546,34541,34547,34512,34579,34526,34548,34527,34520,34513,34563,34567,34552,34568,34570,34573,34569,34595,34619,34590,34597,34606,34586,34622,34632,34612,34609,34601,34615,34623,34690,34594,34685,34686,34683,34656,34672,34636,34670,34699,34643,34659,34684,34660,34649,34661,34707,34735,34728,34770,39514,39515,39516,39517,39518,39519,39520,39521,39522,39523,39524,39525,39526,39527,39528,39529,39530,39531,39538,39555,39561,39565,39566,39572,39573,39577,39590,39593,39594,39595,39596,39597,39598,39599,39602,39603,39604,39605,39609,39611,39613,39614,39615,39619,39620,39622,39623,39624,39625,39626,39629,39630,39631,39632,39634,39636,39637,39638,39639,39641,39642,39643,39644,39645,39646,39648,39650,39651,39652,39653,39655,39656,39657,39658,39660,39662,39664,39665,39666,39667,39668,39669,39670,39671,39672,39674,39676,39677,39678,39679,39680,39681,39682,39684,39685,39686,34758,34696,34693,34733,34711,34691,34731,34789,34732,34741,34739,34763,34771,34749,34769,34752,34762,34779,34794,34784,34798,34838,34835,34814,34826,34843,34849,34873,34876,32566,32578,32580,32581,33296,31482,31485,31496,31491,31492,31509,31498,31531,31503,31559,31544,31530,31513,31534,31537,31520,31525,31524,31539,31550,31518,31576,31578,31557,31605,31564,31581,31584,31598,31611,31586,31602,31601,31632,31654,31655,31672,31660,31645,31656,31621,31658,31644,31650,31659,31668,31697,31681,31692,31709,31706,31717,31718,31722,31756,31742,31740,31759,31766,31755,39687,39689,39690,39691,39692,39693,39694,39696,39697,39698,39700,39701,39702,39703,39704,39705,39706,39707,39708,39709,39710,39712,39713,39714,39716,39717,39718,39719,39720,39721,39722,39723,39724,39725,39726,39728,39729,39731,39732,39733,39734,39735,39736,39737,39738,39741,39742,39743,39744,39750,39754,39755,39756,39758,39760,39762,39763,39765,39766,39767,39768,39769,39770,39771,39772,39773,39774,39775,39776,39777,39778,39779,39780,39781,39782,39783,39784,39785,39786,39787,39788,39789,39790,39791,39792,39793,39794,39795,39796,39797,39798,39799,39800,39801,39802,39803,31775,31786,31782,31800,31809,31808,33278,33281,33282,33284,33260,34884,33313,33314,33315,33325,33327,33320,33323,33336,33339,33331,33332,33342,33348,33353,33355,33359,33370,33375,33384,34942,34949,34952,35032,35039,35166,32669,32671,32679,32687,32688,32690,31868,25929,31889,31901,31900,31902,31906,31922,31932,31933,31937,31943,31948,31949,31944,31941,31959,31976,33390,26280,32703,32718,32725,32741,32737,32742,32745,32750,32755,31992,32119,32166,32174,32327,32411,40632,40628,36211,36228,36244,36241,36273,36199,36205,35911,35913,37194,37200,37198,37199,37220,39804,39805,39806,39807,39808,39809,39810,39811,39812,39813,39814,39815,39816,39817,39818,39819,39820,39821,39822,39823,39824,39825,39826,39827,39828,39829,39830,39831,39832,39833,39834,39835,39836,39837,39838,39839,39840,39841,39842,39843,39844,39845,39846,39847,39848,39849,39850,39851,39852,39853,39854,39855,39856,39857,39858,39859,39860,39861,39862,39863,39864,39865,39866,39867,39868,39869,39870,39871,39872,39873,39874,39875,39876,39877,39878,39879,39880,39881,39882,39883,39884,39885,39886,39887,39888,39889,39890,39891,39892,39893,39894,39895,39896,39897,39898,39899,37218,37217,37232,37225,37231,37245,37246,37234,37236,37241,37260,37253,37264,37261,37265,37282,37283,37290,37293,37294,37295,37301,37300,37306,35925,40574,36280,36331,36357,36441,36457,36277,36287,36284,36282,36292,36310,36311,36314,36318,36302,36303,36315,36294,36332,36343,36344,36323,36345,36347,36324,36361,36349,36372,36381,36383,36396,36398,36387,36399,36410,36416,36409,36405,36413,36401,36425,36417,36418,36433,36434,36426,36464,36470,36476,36463,36468,36485,36495,36500,36496,36508,36510,35960,35970,35978,35973,35992,35988,26011,35286,35294,35290,35292,39900,39901,39902,39903,39904,39905,39906,39907,39908,39909,39910,39911,39912,39913,39914,39915,39916,39917,39918,39919,39920,39921,39922,39923,39924,39925,39926,39927,39928,39929,39930,39931,39932,39933,39934,39935,39936,39937,39938,39939,39940,39941,39942,39943,39944,39945,39946,39947,39948,39949,39950,39951,39952,39953,39954,39955,39956,39957,39958,39959,39960,39961,39962,39963,39964,39965,39966,39967,39968,39969,39970,39971,39972,39973,39974,39975,39976,39977,39978,39979,39980,39981,39982,39983,39984,39985,39986,39987,39988,39989,39990,39991,39992,39993,39994,39995,35301,35307,35311,35390,35622,38739,38633,38643,38639,38662,38657,38664,38671,38670,38698,38701,38704,38718,40832,40835,40837,40838,40839,40840,40841,40842,40844,40702,40715,40717,38585,38588,38589,38606,38610,30655,38624,37518,37550,37576,37694,37738,37834,37775,37950,37995,40063,40066,40069,40070,40071,40072,31267,40075,40078,40080,40081,40082,40084,40085,40090,40091,40094,40095,40096,40097,40098,40099,40101,40102,40103,40104,40105,40107,40109,40110,40112,40113,40114,40115,40116,40117,40118,40119,40122,40123,40124,40125,40132,40133,40134,40135,40138,40139,39996,39997,39998,39999,40000,40001,40002,40003,40004,40005,40006,40007,40008,40009,40010,40011,40012,40013,40014,40015,40016,40017,40018,40019,40020,40021,40022,40023,40024,40025,40026,40027,40028,40029,40030,40031,40032,40033,40034,40035,40036,40037,40038,40039,40040,40041,40042,40043,40044,40045,40046,40047,40048,40049,40050,40051,40052,40053,40054,40055,40056,40057,40058,40059,40061,40062,40064,40067,40068,40073,40074,40076,40079,40083,40086,40087,40088,40089,40093,40106,40108,40111,40121,40126,40127,40128,40129,40130,40136,40137,40145,40146,40154,40155,40160,40161,40140,40141,40142,40143,40144,40147,40148,40149,40151,40152,40153,40156,40157,40159,40162,38780,38789,38801,38802,38804,38831,38827,38819,38834,38836,39601,39600,39607,40536,39606,39610,39612,39617,39616,39621,39618,39627,39628,39633,39749,39747,39751,39753,39752,39757,39761,39144,39181,39214,39253,39252,39647,39649,39654,39663,39659,39675,39661,39673,39688,39695,39699,39711,39715,40637,40638,32315,40578,40583,40584,40587,40594,37846,40605,40607,40667,40668,40669,40672,40671,40674,40681,40679,40677,40682,40687,40738,40748,40751,40761,40759,40765,40766,40772,40163,40164,40165,40166,40167,40168,40169,40170,40171,40172,40173,40174,40175,40176,40177,40178,40179,40180,40181,40182,40183,40184,40185,40186,40187,40188,40189,40190,40191,40192,40193,40194,40195,40196,40197,40198,40199,40200,40201,40202,40203,40204,40205,40206,40207,40208,40209,40210,40211,40212,40213,40214,40215,40216,40217,40218,40219,40220,40221,40222,40223,40224,40225,40226,40227,40228,40229,40230,40231,40232,40233,40234,40235,40236,40237,40238,40239,40240,40241,40242,40243,40244,40245,40246,40247,40248,40249,40250,40251,40252,40253,40254,40255,40256,40257,40258,57908,57909,57910,57911,57912,57913,57914,57915,57916,57917,57918,57919,57920,57921,57922,57923,57924,57925,57926,57927,57928,57929,57930,57931,57932,57933,57934,57935,57936,57937,57938,57939,57940,57941,57942,57943,57944,57945,57946,57947,57948,57949,57950,57951,57952,57953,57954,57955,57956,57957,57958,57959,57960,57961,57962,57963,57964,57965,57966,57967,57968,57969,57970,57971,57972,57973,57974,57975,57976,57977,57978,57979,57980,57981,57982,57983,57984,57985,57986,57987,57988,57989,57990,57991,57992,57993,57994,57995,57996,57997,57998,57999,58000,58001,40259,40260,40261,40262,40263,40264,40265,40266,40267,40268,40269,40270,40271,40272,40273,40274,40275,40276,40277,40278,40279,40280,40281,40282,40283,40284,40285,40286,40287,40288,40289,40290,40291,40292,40293,40294,40295,40296,40297,40298,40299,40300,40301,40302,40303,40304,40305,40306,40307,40308,40309,40310,40311,40312,40313,40314,40315,40316,40317,40318,40319,40320,40321,40322,40323,40324,40325,40326,40327,40328,40329,40330,40331,40332,40333,40334,40335,40336,40337,40338,40339,40340,40341,40342,40343,40344,40345,40346,40347,40348,40349,40350,40351,40352,40353,40354,58002,58003,58004,58005,58006,58007,58008,58009,58010,58011,58012,58013,58014,58015,58016,58017,58018,58019,58020,58021,58022,58023,58024,58025,58026,58027,58028,58029,58030,58031,58032,58033,58034,58035,58036,58037,58038,58039,58040,58041,58042,58043,58044,58045,58046,58047,58048,58049,58050,58051,58052,58053,58054,58055,58056,58057,58058,58059,58060,58061,58062,58063,58064,58065,58066,58067,58068,58069,58070,58071,58072,58073,58074,58075,58076,58077,58078,58079,58080,58081,58082,58083,58084,58085,58086,58087,58088,58089,58090,58091,58092,58093,58094,58095,40355,40356,40357,40358,40359,40360,40361,40362,40363,40364,40365,40366,40367,40368,40369,40370,40371,40372,40373,40374,40375,40376,40377,40378,40379,40380,40381,40382,40383,40384,40385,40386,40387,40388,40389,40390,40391,40392,40393,40394,40395,40396,40397,40398,40399,40400,40401,40402,40403,40404,40405,40406,40407,40408,40409,40410,40411,40412,40413,40414,40415,40416,40417,40418,40419,40420,40421,40422,40423,40424,40425,40426,40427,40428,40429,40430,40431,40432,40433,40434,40435,40436,40437,40438,40439,40440,40441,40442,40443,40444,40445,40446,40447,40448,40449,40450,58096,58097,58098,58099,58100,58101,58102,58103,58104,58105,58106,58107,58108,58109,58110,58111,58112,58113,58114,58115,58116,58117,58118,58119,58120,58121,58122,58123,58124,58125,58126,58127,58128,58129,58130,58131,58132,58133,58134,58135,58136,58137,58138,58139,58140,58141,58142,58143,58144,58145,58146,58147,58148,58149,58150,58151,58152,58153,58154,58155,58156,58157,58158,58159,58160,58161,58162,58163,58164,58165,58166,58167,58168,58169,58170,58171,58172,58173,58174,58175,58176,58177,58178,58179,58180,58181,58182,58183,58184,58185,58186,58187,58188,58189,40451,40452,40453,40454,40455,40456,40457,40458,40459,40460,40461,40462,40463,40464,40465,40466,40467,40468,40469,40470,40471,40472,40473,40474,40475,40476,40477,40478,40484,40487,40494,40496,40500,40507,40508,40512,40525,40528,40530,40531,40532,40534,40537,40541,40543,40544,40545,40546,40549,40558,40559,40562,40564,40565,40566,40567,40568,40569,40570,40571,40572,40573,40576,40577,40579,40580,40581,40582,40585,40586,40588,40589,40590,40591,40592,40593,40596,40597,40598,40599,40600,40601,40602,40603,40604,40606,40608,40609,40610,40611,40612,40613,40615,40616,40617,40618,58190,58191,58192,58193,58194,58195,58196,58197,58198,58199,58200,58201,58202,58203,58204,58205,58206,58207,58208,58209,58210,58211,58212,58213,58214,58215,58216,58217,58218,58219,58220,58221,58222,58223,58224,58225,58226,58227,58228,58229,58230,58231,58232,58233,58234,58235,58236,58237,58238,58239,58240,58241,58242,58243,58244,58245,58246,58247,58248,58249,58250,58251,58252,58253,58254,58255,58256,58257,58258,58259,58260,58261,58262,58263,58264,58265,58266,58267,58268,58269,58270,58271,58272,58273,58274,58275,58276,58277,58278,58279,58280,58281,58282,58283,40619,40620,40621,40622,40623,40624,40625,40626,40627,40629,40630,40631,40633,40634,40636,40639,40640,40641,40642,40643,40645,40646,40647,40648,40650,40651,40652,40656,40658,40659,40661,40662,40663,40665,40666,40670,40673,40675,40676,40678,40680,40683,40684,40685,40686,40688,40689,40690,40691,40692,40693,40694,40695,40696,40698,40701,40703,40704,40705,40706,40707,40708,40709,40710,40711,40712,40713,40714,40716,40719,40721,40722,40724,40725,40726,40728,40730,40731,40732,40733,40734,40735,40737,40739,40740,40741,40742,40743,40744,40745,40746,40747,40749,40750,40752,40753,58284,58285,58286,58287,58288,58289,58290,58291,58292,58293,58294,58295,58296,58297,58298,58299,58300,58301,58302,58303,58304,58305,58306,58307,58308,58309,58310,58311,58312,58313,58314,58315,58316,58317,58318,58319,58320,58321,58322,58323,58324,58325,58326,58327,58328,58329,58330,58331,58332,58333,58334,58335,58336,58337,58338,58339,58340,58341,58342,58343,58344,58345,58346,58347,58348,58349,58350,58351,58352,58353,58354,58355,58356,58357,58358,58359,58360,58361,58362,58363,58364,58365,58366,58367,58368,58369,58370,58371,58372,58373,58374,58375,58376,58377,40754,40755,40756,40757,40758,40760,40762,40764,40767,40768,40769,40770,40771,40773,40774,40775,40776,40777,40778,40779,40780,40781,40782,40783,40786,40787,40788,40789,40790,40791,40792,40793,40794,40795,40796,40797,40798,40799,40800,40801,40802,40803,40804,40805,40806,40807,40808,40809,40810,40811,40812,40813,40814,40815,40816,40817,40818,40819,40820,40821,40822,40823,40824,40825,40826,40827,40828,40829,40830,40833,40834,40845,40846,40847,40848,40849,40850,40851,40852,40853,40854,40855,40856,40860,40861,40862,40865,40866,40867,40868,40869,63788,63865,63893,63975,63985,58378,58379,58380,58381,58382,58383,58384,58385,58386,58387,58388,58389,58390,58391,58392,58393,58394,58395,58396,58397,58398,58399,58400,58401,58402,58403,58404,58405,58406,58407,58408,58409,58410,58411,58412,58413,58414,58415,58416,58417,58418,58419,58420,58421,58422,58423,58424,58425,58426,58427,58428,58429,58430,58431,58432,58433,58434,58435,58436,58437,58438,58439,58440,58441,58442,58443,58444,58445,58446,58447,58448,58449,58450,58451,58452,58453,58454,58455,58456,58457,58458,58459,58460,58461,58462,58463,58464,58465,58466,58467,58468,58469,58470,58471,64012,64013,64014,64015,64017,64019,64020,64024,64031,64032,64033,64035,64036,64039,64040,64041,11905,59414,59415,59416,11908,13427,13383,11912,11915,59422,13726,13850,13838,11916,11927,14702,14616,59430,14799,14815,14963,14800,59435,59436,15182,15470,15584,11943,59441,59442,11946,16470,16735,11950,17207,11955,11958,11959,59451,17329,17324,11963,17373,17622,18017,17996,59459,18211,18217,18300,18317,11978,18759,18810,18813,18818,18819,18821,18822,18847,18843,18871,18870,59476,59477,19619,19615,19616,19617,19575,19618,19731,19732,19733,19734,19735,19736,19737,19886,59492,58472,58473,58474,58475,58476,58477,58478,58479,58480,58481,58482,58483,58484,58485,58486,58487,58488,58489,58490,58491,58492,58493,58494,58495,58496,58497,58498,58499,58500,58501,58502,58503,58504,58505,58506,58507,58508,58509,58510,58511,58512,58513,58514,58515,58516,58517,58518,58519,58520,58521,58522,58523,58524,58525,58526,58527,58528,58529,58530,58531,58532,58533,58534,58535,58536,58537,58538,58539,58540,58541,58542,58543,58544,58545,58546,58547,58548,58549,58550,58551,58552,58553,58554,58555,58556,58557,58558,58559,58560,58561,58562,58563,58564,58565],\n \"gb18030-ranges\":[[0,128],[36,165],[38,169],[45,178],[50,184],[81,216],[89,226],[95,235],[96,238],[100,244],[103,248],[104,251],[105,253],[109,258],[126,276],[133,284],[148,300],[172,325],[175,329],[179,334],[208,364],[306,463],[307,465],[308,467],[309,469],[310,471],[311,473],[312,475],[313,477],[341,506],[428,594],[443,610],[544,712],[545,716],[558,730],[741,930],[742,938],[749,962],[750,970],[805,1026],[819,1104],[820,1106],[7922,8209],[7924,8215],[7925,8218],[7927,8222],[7934,8231],[7943,8241],[7944,8244],[7945,8246],[7950,8252],[8062,8365],[8148,8452],[8149,8454],[8152,8458],[8164,8471],[8174,8482],[8236,8556],[8240,8570],[8262,8596],[8264,8602],[8374,8713],[8380,8720],[8381,8722],[8384,8726],[8388,8731],[8390,8737],[8392,8740],[8393,8742],[8394,8748],[8396,8751],[8401,8760],[8406,8766],[8416,8777],[8419,8781],[8424,8787],[8437,8802],[8439,8808],[8445,8816],[8482,8854],[8485,8858],[8496,8870],[8521,8896],[8603,8979],[8936,9322],[8946,9372],[9046,9548],[9050,9588],[9063,9616],[9066,9622],[9076,9634],[9092,9652],[9100,9662],[9108,9672],[9111,9676],[9113,9680],[9131,9702],[9162,9735],[9164,9738],[9218,9793],[9219,9795],[11329,11906],[11331,11909],[11334,11913],[11336,11917],[11346,11928],[11361,11944],[11363,11947],[11366,11951],[11370,11956],[11372,11960],[11375,11964],[11389,11979],[11682,12284],[11686,12292],[11687,12312],[11692,12319],[11694,12330],[11714,12351],[11716,12436],[11723,12447],[11725,12535],[11730,12543],[11736,12586],[11982,12842],[11989,12850],[12102,12964],[12336,13200],[12348,13215],[12350,13218],[12384,13253],[12393,13263],[12395,13267],[12397,13270],[12510,13384],[12553,13428],[12851,13727],[12962,13839],[12973,13851],[13738,14617],[13823,14703],[13919,14801],[13933,14816],[14080,14964],[14298,15183],[14585,15471],[14698,15585],[15583,16471],[15847,16736],[16318,17208],[16434,17325],[16438,17330],[16481,17374],[16729,17623],[17102,17997],[17122,18018],[17315,18212],[17320,18218],[17402,18301],[17418,18318],[17859,18760],[17909,18811],[17911,18814],[17915,18820],[17916,18823],[17936,18844],[17939,18848],[17961,18872],[18664,19576],[18703,19620],[18814,19738],[18962,19887],[19043,40870],[33469,59244],[33470,59336],[33471,59367],[33484,59413],[33485,59417],[33490,59423],[33497,59431],[33501,59437],[33505,59443],[33513,59452],[33520,59460],[33536,59478],[33550,59493],[37845,63789],[37921,63866],[37948,63894],[38029,63976],[38038,63986],[38064,64016],[38065,64018],[38066,64021],[38069,64025],[38075,64034],[38076,64037],[38078,64042],[39108,65074],[39109,65093],[39113,65107],[39114,65112],[39115,65127],[39116,65132],[39265,65375],[39394,65510],[189000,65536]],\n \"jis0208\":[12288,12289,12290,65292,65294,12539,65306,65307,65311,65281,12443,12444,180,65344,168,65342,65507,65343,12541,12542,12445,12446,12291,20189,12293,12294,12295,12540,8213,8208,65295,65340,65374,8741,65372,8230,8229,8216,8217,8220,8221,65288,65289,12308,12309,65339,65341,65371,65373,12296,12297,12298,12299,12300,12301,12302,12303,12304,12305,65291,65293,177,215,247,65309,8800,65308,65310,8806,8807,8734,8756,9794,9792,176,8242,8243,8451,65509,65284,65504,65505,65285,65283,65286,65290,65312,167,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660,8251,12306,8594,8592,8593,8595,12307,null,null,null,null,null,null,null,null,null,null,null,8712,8715,8838,8839,8834,8835,8746,8745,null,null,null,null,null,null,null,null,8743,8744,65506,8658,8660,8704,8707,null,null,null,null,null,null,null,null,null,null,null,8736,8869,8978,8706,8711,8801,8786,8810,8811,8730,8765,8733,8757,8747,8748,null,null,null,null,null,null,null,8491,8240,9839,9837,9834,8224,8225,182,null,null,null,null,9711,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,null,null,null,null,null,null,null,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,null,null,null,null,null,null,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,null,null,null,null,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,null,null,null,null,null,null,null,null,null,null,null,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,null,null,null,null,null,null,null,null,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,null,null,null,null,null,null,null,null,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,null,null,null,null,null,null,null,null,null,null,null,null,null,9472,9474,9484,9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487,9491,9499,9495,9507,9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520,9509,9528,9538,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,null,13129,13076,13090,13133,13080,13095,13059,13110,13137,13143,13069,13094,13091,13099,13130,13115,13212,13213,13214,13198,13199,13252,13217,null,null,null,null,null,null,null,null,13179,12317,12319,8470,13261,8481,12964,12965,12966,12967,12968,12849,12850,12857,13182,13181,13180,8786,8801,8747,8750,8721,8730,8869,8736,8735,8895,8757,8745,8746,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,20124,21782,23043,38463,21696,24859,25384,23030,36898,33909,33564,31312,24746,25569,28197,26093,33894,33446,39925,26771,22311,26017,25201,23451,22992,34427,39156,32098,32190,39822,25110,31903,34999,23433,24245,25353,26263,26696,38343,38797,26447,20197,20234,20301,20381,20553,22258,22839,22996,23041,23561,24799,24847,24944,26131,26885,28858,30031,30064,31227,32173,32239,32963,33806,34915,35586,36949,36986,21307,20117,20133,22495,32946,37057,30959,19968,22769,28322,36920,31282,33576,33419,39983,20801,21360,21693,21729,22240,23035,24341,39154,28139,32996,34093,38498,38512,38560,38907,21515,21491,23431,28879,32701,36802,38632,21359,40284,31418,19985,30867,33276,28198,22040,21764,27421,34074,39995,23013,21417,28006,29916,38287,22082,20113,36939,38642,33615,39180,21473,21942,23344,24433,26144,26355,26628,27704,27891,27945,29787,30408,31310,38964,33521,34907,35424,37613,28082,30123,30410,39365,24742,35585,36234,38322,27022,21421,20870,22290,22576,22852,23476,24310,24616,25513,25588,27839,28436,28814,28948,29017,29141,29503,32257,33398,33489,34199,36960,37467,40219,22633,26044,27738,29989,20985,22830,22885,24448,24540,25276,26106,27178,27431,27572,29579,32705,35158,40236,40206,40644,23713,27798,33659,20740,23627,25014,33222,26742,29281,20057,20474,21368,24681,28201,31311,38899,19979,21270,20206,20309,20285,20385,20339,21152,21487,22025,22799,23233,23478,23521,31185,26247,26524,26550,27468,27827,28779,29634,31117,31166,31292,31623,33457,33499,33540,33655,33775,33747,34662,35506,22057,36008,36838,36942,38686,34442,20420,23784,25105,29273,30011,33253,33469,34558,36032,38597,39187,39381,20171,20250,35299,22238,22602,22730,24315,24555,24618,24724,24674,25040,25106,25296,25913,39745,26214,26800,28023,28784,30028,30342,32117,33445,34809,38283,38542,35997,20977,21182,22806,21683,23475,23830,24936,27010,28079,30861,33995,34903,35442,37799,39608,28012,39336,34521,22435,26623,34510,37390,21123,22151,21508,24275,25313,25785,26684,26680,27579,29554,30906,31339,35226,35282,36203,36611,37101,38307,38548,38761,23398,23731,27005,38989,38990,25499,31520,27179,27263,26806,39949,28511,21106,21917,24688,25324,27963,28167,28369,33883,35088,36676,19988,39993,21494,26907,27194,38788,26666,20828,31427,33970,37340,37772,22107,40232,26658,33541,33841,31909,21000,33477,29926,20094,20355,20896,23506,21002,21208,21223,24059,21914,22570,23014,23436,23448,23515,24178,24185,24739,24863,24931,25022,25563,25954,26577,26707,26874,27454,27475,27735,28450,28567,28485,29872,29976,30435,30475,31487,31649,31777,32233,32566,32752,32925,33382,33694,35251,35532,36011,36996,37969,38291,38289,38306,38501,38867,39208,33304,20024,21547,23736,24012,29609,30284,30524,23721,32747,36107,38593,38929,38996,39000,20225,20238,21361,21916,22120,22522,22855,23305,23492,23696,24076,24190,24524,25582,26426,26071,26082,26399,26827,26820,27231,24112,27589,27671,27773,30079,31048,23395,31232,32000,24509,35215,35352,36020,36215,36556,36637,39138,39438,39740,20096,20605,20736,22931,23452,25135,25216,25836,27450,29344,30097,31047,32681,34811,35516,35696,25516,33738,38816,21513,21507,21931,26708,27224,35440,30759,26485,40653,21364,23458,33050,34384,36870,19992,20037,20167,20241,21450,21560,23470,24339,24613,25937,26429,27714,27762,27875,28792,29699,31350,31406,31496,32026,31998,32102,26087,29275,21435,23621,24040,25298,25312,25369,28192,34394,35377,36317,37624,28417,31142,39770,20136,20139,20140,20379,20384,20689,20807,31478,20849,20982,21332,21281,21375,21483,21932,22659,23777,24375,24394,24623,24656,24685,25375,25945,27211,27841,29378,29421,30703,33016,33029,33288,34126,37111,37857,38911,39255,39514,20208,20957,23597,26241,26989,23616,26354,26997,29577,26704,31873,20677,21220,22343,24062,37670,26020,27427,27453,29748,31105,31165,31563,32202,33465,33740,34943,35167,35641,36817,37329,21535,37504,20061,20534,21477,21306,29399,29590,30697,33510,36527,39366,39368,39378,20855,24858,34398,21936,31354,20598,23507,36935,38533,20018,27355,37351,23633,23624,25496,31391,27795,38772,36705,31402,29066,38536,31874,26647,32368,26705,37740,21234,21531,34219,35347,32676,36557,37089,21350,34952,31041,20418,20670,21009,20804,21843,22317,29674,22411,22865,24418,24452,24693,24950,24935,25001,25522,25658,25964,26223,26690,28179,30054,31293,31995,32076,32153,32331,32619,33550,33610,34509,35336,35427,35686,36605,38938,40335,33464,36814,39912,21127,25119,25731,28608,38553,26689,20625,27424,27770,28500,31348,32080,34880,35363,26376,20214,20537,20518,20581,20860,21048,21091,21927,22287,22533,23244,24314,25010,25080,25331,25458,26908,27177,29309,29356,29486,30740,30831,32121,30476,32937,35211,35609,36066,36562,36963,37749,38522,38997,39443,40568,20803,21407,21427,24187,24358,28187,28304,29572,29694,32067,33335,35328,35578,38480,20046,20491,21476,21628,22266,22993,23396,24049,24235,24359,25144,25925,26543,28246,29392,31946,34996,32929,32993,33776,34382,35463,36328,37431,38599,39015,40723,20116,20114,20237,21320,21577,21566,23087,24460,24481,24735,26791,27278,29786,30849,35486,35492,35703,37264,20062,39881,20132,20348,20399,20505,20502,20809,20844,21151,21177,21246,21402,21475,21521,21518,21897,22353,22434,22909,23380,23389,23439,24037,24039,24055,24184,24195,24218,24247,24344,24658,24908,25239,25304,25511,25915,26114,26179,26356,26477,26657,26775,27083,27743,27946,28009,28207,28317,30002,30343,30828,31295,31968,32005,32024,32094,32177,32789,32771,32943,32945,33108,33167,33322,33618,34892,34913,35611,36002,36092,37066,37237,37489,30783,37628,38308,38477,38917,39321,39640,40251,21083,21163,21495,21512,22741,25335,28640,35946,36703,40633,20811,21051,21578,22269,31296,37239,40288,40658,29508,28425,33136,29969,24573,24794,39592,29403,36796,27492,38915,20170,22256,22372,22718,23130,24680,25031,26127,26118,26681,26801,28151,30165,32058,33390,39746,20123,20304,21449,21766,23919,24038,24046,26619,27801,29811,30722,35408,37782,35039,22352,24231,25387,20661,20652,20877,26368,21705,22622,22971,23472,24425,25165,25505,26685,27507,28168,28797,37319,29312,30741,30758,31085,25998,32048,33756,35009,36617,38555,21092,22312,26448,32618,36001,20916,22338,38442,22586,27018,32948,21682,23822,22524,30869,40442,20316,21066,21643,25662,26152,26388,26613,31364,31574,32034,37679,26716,39853,31545,21273,20874,21047,23519,25334,25774,25830,26413,27578,34217,38609,30352,39894,25420,37638,39851,30399,26194,19977,20632,21442,23665,24808,25746,25955,26719,29158,29642,29987,31639,32386,34453,35715,36059,37240,39184,26028,26283,27531,20181,20180,20282,20351,21050,21496,21490,21987,22235,22763,22987,22985,23039,23376,23629,24066,24107,24535,24605,25351,25903,23388,26031,26045,26088,26525,27490,27515,27663,29509,31049,31169,31992,32025,32043,32930,33026,33267,35222,35422,35433,35430,35468,35566,36039,36060,38604,39164,27503,20107,20284,20365,20816,23383,23546,24904,25345,26178,27425,28363,27835,29246,29885,30164,30913,31034,32780,32819,33258,33940,36766,27728,40575,24335,35672,40235,31482,36600,23437,38635,19971,21489,22519,22833,23241,23460,24713,28287,28422,30142,36074,23455,34048,31712,20594,26612,33437,23649,34122,32286,33294,20889,23556,25448,36198,26012,29038,31038,32023,32773,35613,36554,36974,34503,37034,20511,21242,23610,26451,28796,29237,37196,37320,37675,33509,23490,24369,24825,20027,21462,23432,25163,26417,27530,29417,29664,31278,33131,36259,37202,39318,20754,21463,21610,23551,25480,27193,32172,38656,22234,21454,21608,23447,23601,24030,20462,24833,25342,27954,31168,31179,32066,32333,32722,33261,33311,33936,34886,35186,35728,36468,36655,36913,37195,37228,38598,37276,20160,20303,20805,21313,24467,25102,26580,27713,28171,29539,32294,37325,37507,21460,22809,23487,28113,31069,32302,31899,22654,29087,20986,34899,36848,20426,23803,26149,30636,31459,33308,39423,20934,24490,26092,26991,27529,28147,28310,28516,30462,32020,24033,36981,37255,38918,20966,21021,25152,26257,26329,28186,24246,32210,32626,26360,34223,34295,35576,21161,21465,22899,24207,24464,24661,37604,38500,20663,20767,21213,21280,21319,21484,21736,21830,21809,22039,22888,22974,23100,23477,23558,23567,23569,23578,24196,24202,24288,24432,25215,25220,25307,25484,25463,26119,26124,26157,26230,26494,26786,27167,27189,27836,28040,28169,28248,28988,28966,29031,30151,30465,30813,30977,31077,31216,31456,31505,31911,32057,32918,33750,33931,34121,34909,35059,35359,35388,35412,35443,35937,36062,37284,37478,37758,37912,38556,38808,19978,19976,19998,20055,20887,21104,22478,22580,22732,23330,24120,24773,25854,26465,26454,27972,29366,30067,31331,33976,35698,37304,37664,22065,22516,39166,25325,26893,27542,29165,32340,32887,33394,35302,39135,34645,36785,23611,20280,20449,20405,21767,23072,23517,23529,24515,24910,25391,26032,26187,26862,27035,28024,28145,30003,30137,30495,31070,31206,32051,33251,33455,34218,35242,35386,36523,36763,36914,37341,38663,20154,20161,20995,22645,22764,23563,29978,23613,33102,35338,36805,38499,38765,31525,35535,38920,37218,22259,21416,36887,21561,22402,24101,25512,27700,28810,30561,31883,32736,34928,36930,37204,37648,37656,38543,29790,39620,23815,23913,25968,26530,36264,38619,25454,26441,26905,33733,38935,38592,35070,28548,25722,23544,19990,28716,30045,26159,20932,21046,21218,22995,24449,24615,25104,25919,25972,26143,26228,26866,26646,27491,28165,29298,29983,30427,31934,32854,22768,35069,35199,35488,35475,35531,36893,37266,38738,38745,25993,31246,33030,38587,24109,24796,25114,26021,26132,26512,30707,31309,31821,32318,33034,36012,36196,36321,36447,30889,20999,25305,25509,25666,25240,35373,31363,31680,35500,38634,32118,33292,34633,20185,20808,21315,21344,23459,23554,23574,24029,25126,25159,25776,26643,26676,27849,27973,27927,26579,28508,29006,29053,26059,31359,31661,32218,32330,32680,33146,33307,33337,34214,35438,36046,36341,36984,36983,37549,37521,38275,39854,21069,21892,28472,28982,20840,31109,32341,33203,31950,22092,22609,23720,25514,26366,26365,26970,29401,30095,30094,30990,31062,31199,31895,32032,32068,34311,35380,38459,36961,40736,20711,21109,21452,21474,20489,21930,22766,22863,29245,23435,23652,21277,24803,24819,25436,25475,25407,25531,25805,26089,26361,24035,27085,27133,28437,29157,20105,30185,30456,31379,31967,32207,32156,32865,33609,33624,33900,33980,34299,35013,36208,36865,36973,37783,38684,39442,20687,22679,24974,33235,34101,36104,36896,20419,20596,21063,21363,24687,25417,26463,28204,36275,36895,20439,23646,36042,26063,32154,21330,34966,20854,25539,23384,23403,23562,25613,26449,36956,20182,22810,22826,27760,35409,21822,22549,22949,24816,25171,26561,33333,26965,38464,39364,39464,20307,22534,23550,32784,23729,24111,24453,24608,24907,25140,26367,27888,28382,32974,33151,33492,34955,36024,36864,36910,38538,40667,39899,20195,21488,22823,31532,37261,38988,40441,28381,28711,21331,21828,23429,25176,25246,25299,27810,28655,29730,35351,37944,28609,35582,33592,20967,34552,21482,21481,20294,36948,36784,22890,33073,24061,31466,36799,26842,35895,29432,40008,27197,35504,20025,21336,22022,22374,25285,25506,26086,27470,28129,28251,28845,30701,31471,31658,32187,32829,32966,34507,35477,37723,22243,22727,24382,26029,26262,27264,27573,30007,35527,20516,30693,22320,24347,24677,26234,27744,30196,31258,32622,33268,34584,36933,39347,31689,30044,31481,31569,33988,36880,31209,31378,33590,23265,30528,20013,20210,23449,24544,25277,26172,26609,27880,34411,34935,35387,37198,37619,39376,27159,28710,29482,33511,33879,36015,19969,20806,20939,21899,23541,24086,24115,24193,24340,24373,24427,24500,25074,25361,26274,26397,28526,29266,30010,30522,32884,33081,33144,34678,35519,35548,36229,36339,37530,38263,38914,40165,21189,25431,30452,26389,27784,29645,36035,37806,38515,27941,22684,26894,27084,36861,37786,30171,36890,22618,26626,25524,27131,20291,28460,26584,36795,34086,32180,37716,26943,28528,22378,22775,23340,32044,29226,21514,37347,40372,20141,20302,20572,20597,21059,35998,21576,22564,23450,24093,24213,24237,24311,24351,24716,25269,25402,25552,26799,27712,30855,31118,31243,32224,33351,35330,35558,36420,36883,37048,37165,37336,40718,27877,25688,25826,25973,28404,30340,31515,36969,37841,28346,21746,24505,25764,36685,36845,37444,20856,22635,22825,23637,24215,28155,32399,29980,36028,36578,39003,28857,20253,27583,28593,30000,38651,20814,21520,22581,22615,22956,23648,24466,26007,26460,28193,30331,33759,36077,36884,37117,37709,30757,30778,21162,24230,22303,22900,24594,20498,20826,20908,20941,20992,21776,22612,22616,22871,23445,23798,23947,24764,25237,25645,26481,26691,26812,26847,30423,28120,28271,28059,28783,29128,24403,30168,31095,31561,31572,31570,31958,32113,21040,33891,34153,34276,35342,35588,35910,36367,36867,36879,37913,38518,38957,39472,38360,20685,21205,21516,22530,23566,24999,25758,27934,30643,31461,33012,33796,36947,37509,23776,40199,21311,24471,24499,28060,29305,30563,31167,31716,27602,29420,35501,26627,27233,20984,31361,26932,23626,40182,33515,23493,37193,28702,22136,23663,24775,25958,27788,35930,36929,38931,21585,26311,37389,22856,37027,20869,20045,20970,34201,35598,28760,25466,37707,26978,39348,32260,30071,21335,26976,36575,38627,27741,20108,23612,24336,36841,21250,36049,32905,34425,24319,26085,20083,20837,22914,23615,38894,20219,22922,24525,35469,28641,31152,31074,23527,33905,29483,29105,24180,24565,25467,25754,29123,31896,20035,24316,20043,22492,22178,24745,28611,32013,33021,33075,33215,36786,35223,34468,24052,25226,25773,35207,26487,27874,27966,29750,30772,23110,32629,33453,39340,20467,24259,25309,25490,25943,26479,30403,29260,32972,32954,36649,37197,20493,22521,23186,26757,26995,29028,29437,36023,22770,36064,38506,36889,34687,31204,30695,33833,20271,21093,21338,25293,26575,27850,30333,31636,31893,33334,34180,36843,26333,28448,29190,32283,33707,39361,40614,20989,31665,30834,31672,32903,31560,27368,24161,32908,30033,30048,20843,37474,28300,30330,37271,39658,20240,32624,25244,31567,38309,40169,22138,22617,34532,38588,20276,21028,21322,21453,21467,24070,25644,26001,26495,27710,27726,29256,29359,29677,30036,32321,33324,34281,36009,31684,37318,29033,38930,39151,25405,26217,30058,30436,30928,34115,34542,21290,21329,21542,22915,24199,24444,24754,25161,25209,25259,26000,27604,27852,30130,30382,30865,31192,32203,32631,32933,34987,35513,36027,36991,38750,39131,27147,31800,20633,23614,24494,26503,27608,29749,30473,32654,40763,26570,31255,21305,30091,39661,24422,33181,33777,32920,24380,24517,30050,31558,36924,26727,23019,23195,32016,30334,35628,20469,24426,27161,27703,28418,29922,31080,34920,35413,35961,24287,25551,30149,31186,33495,37672,37618,33948,34541,39981,21697,24428,25996,27996,28693,36007,36051,38971,25935,29942,19981,20184,22496,22827,23142,23500,20904,24067,24220,24598,25206,25975,26023,26222,28014,29238,31526,33104,33178,33433,35676,36000,36070,36212,38428,38468,20398,25771,27494,33310,33889,34154,37096,23553,26963,39080,33914,34135,20239,21103,24489,24133,26381,31119,33145,35079,35206,28149,24343,25173,27832,20175,29289,39826,20998,21563,22132,22707,24996,25198,28954,22894,31881,31966,32027,38640,25991,32862,19993,20341,20853,22592,24163,24179,24330,26564,20006,34109,38281,38491,31859,38913,20731,22721,30294,30887,21029,30629,34065,31622,20559,22793,29255,31687,32232,36794,36820,36941,20415,21193,23081,24321,38829,20445,33303,37610,22275,25429,27497,29995,35036,36628,31298,21215,22675,24917,25098,26286,27597,31807,33769,20515,20472,21253,21574,22577,22857,23453,23792,23791,23849,24214,25265,25447,25918,26041,26379,27861,27873,28921,30770,32299,32990,33459,33804,34028,34562,35090,35370,35914,37030,37586,39165,40179,40300,20047,20129,20621,21078,22346,22952,24125,24536,24537,25151,26292,26395,26576,26834,20882,32033,32938,33192,35584,35980,36031,37502,38450,21536,38956,21271,20693,21340,22696,25778,26420,29287,30566,31302,37350,21187,27809,27526,22528,24140,22868,26412,32763,20961,30406,25705,30952,39764,40635,22475,22969,26151,26522,27598,21737,27097,24149,33180,26517,39850,26622,40018,26717,20134,20451,21448,25273,26411,27819,36804,20397,32365,40639,19975,24930,28288,28459,34067,21619,26410,39749,24051,31637,23724,23494,34588,28234,34001,31252,33032,22937,31885,27665,30496,21209,22818,28961,29279,30683,38695,40289,26891,23167,23064,20901,21517,21629,26126,30431,36855,37528,40180,23018,29277,28357,20813,26825,32191,32236,38754,40634,25720,27169,33538,22916,23391,27611,29467,30450,32178,32791,33945,20786,26408,40665,30446,26466,21247,39173,23588,25147,31870,36016,21839,24758,32011,38272,21249,20063,20918,22812,29242,32822,37326,24357,30690,21380,24441,32004,34220,35379,36493,38742,26611,34222,37971,24841,24840,27833,30290,35565,36664,21807,20305,20778,21191,21451,23461,24189,24736,24962,25558,26377,26586,28263,28044,29494,29495,30001,31056,35029,35480,36938,37009,37109,38596,34701,22805,20104,20313,19982,35465,36671,38928,20653,24188,22934,23481,24248,25562,25594,25793,26332,26954,27096,27915,28342,29076,29992,31407,32650,32768,33865,33993,35201,35617,36362,36965,38525,39178,24958,25233,27442,27779,28020,32716,32764,28096,32645,34746,35064,26469,33713,38972,38647,27931,32097,33853,37226,20081,21365,23888,27396,28651,34253,34349,35239,21033,21519,23653,26446,26792,29702,29827,30178,35023,35041,37324,38626,38520,24459,29575,31435,33870,25504,30053,21129,27969,28316,29705,30041,30827,31890,38534,31452,40845,20406,24942,26053,34396,20102,20142,20698,20001,20940,23534,26009,26753,28092,29471,30274,30637,31260,31975,33391,35538,36988,37327,38517,38936,21147,32209,20523,21400,26519,28107,29136,29747,33256,36650,38563,40023,40607,29792,22593,28057,32047,39006,20196,20278,20363,20919,21169,23994,24604,29618,31036,33491,37428,38583,38646,38666,40599,40802,26278,27508,21015,21155,28872,35010,24265,24651,24976,28451,29001,31806,32244,32879,34030,36899,37676,21570,39791,27347,28809,36034,36335,38706,21172,23105,24266,24324,26391,27004,27028,28010,28431,29282,29436,31725,32769,32894,34635,37070,20845,40595,31108,32907,37682,35542,20525,21644,35441,27498,36036,33031,24785,26528,40434,20121,20120,39952,35435,34241,34152,26880,28286,30871,33109,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,24332,19984,19989,20010,20017,20022,20028,20031,20034,20054,20056,20098,20101,35947,20106,33298,24333,20110,20126,20127,20128,20130,20144,20147,20150,20174,20173,20164,20166,20162,20183,20190,20205,20191,20215,20233,20314,20272,20315,20317,20311,20295,20342,20360,20367,20376,20347,20329,20336,20369,20335,20358,20374,20760,20436,20447,20430,20440,20443,20433,20442,20432,20452,20453,20506,20520,20500,20522,20517,20485,20252,20470,20513,20521,20524,20478,20463,20497,20486,20547,20551,26371,20565,20560,20552,20570,20566,20588,20600,20608,20634,20613,20660,20658,20681,20682,20659,20674,20694,20702,20709,20717,20707,20718,20729,20725,20745,20737,20738,20758,20757,20756,20762,20769,20794,20791,20796,20795,20799,20800,20818,20812,20820,20834,31480,20841,20842,20846,20864,20866,22232,20876,20873,20879,20881,20883,20885,20886,20900,20902,20898,20905,20906,20907,20915,20913,20914,20912,20917,20925,20933,20937,20955,20960,34389,20969,20973,20976,20981,20990,20996,21003,21012,21006,21031,21034,21038,21043,21049,21071,21060,21067,21068,21086,21076,21098,21108,21097,21107,21119,21117,21133,21140,21138,21105,21128,21137,36776,36775,21164,21165,21180,21173,21185,21197,21207,21214,21219,21222,39149,21216,21235,21237,21240,21241,21254,21256,30008,21261,21264,21263,21269,21274,21283,21295,21297,21299,21304,21312,21318,21317,19991,21321,21325,20950,21342,21353,21358,22808,21371,21367,21378,21398,21408,21414,21413,21422,21424,21430,21443,31762,38617,21471,26364,29166,21486,21480,21485,21498,21505,21565,21568,21548,21549,21564,21550,21558,21545,21533,21582,21647,21621,21646,21599,21617,21623,21616,21650,21627,21632,21622,21636,21648,21638,21703,21666,21688,21669,21676,21700,21704,21672,21675,21698,21668,21694,21692,21720,21733,21734,21775,21780,21757,21742,21741,21754,21730,21817,21824,21859,21836,21806,21852,21829,21846,21847,21816,21811,21853,21913,21888,21679,21898,21919,21883,21886,21912,21918,21934,21884,21891,21929,21895,21928,21978,21957,21983,21956,21980,21988,21972,22036,22007,22038,22014,22013,22043,22009,22094,22096,29151,22068,22070,22066,22072,22123,22116,22063,22124,22122,22150,22144,22154,22176,22164,22159,22181,22190,22198,22196,22210,22204,22209,22211,22208,22216,22222,22225,22227,22231,22254,22265,22272,22271,22276,22281,22280,22283,22285,22291,22296,22294,21959,22300,22310,22327,22328,22350,22331,22336,22351,22377,22464,22408,22369,22399,22409,22419,22432,22451,22436,22442,22448,22467,22470,22484,22482,22483,22538,22486,22499,22539,22553,22557,22642,22561,22626,22603,22640,27584,22610,22589,22649,22661,22713,22687,22699,22714,22750,22715,22712,22702,22725,22739,22737,22743,22745,22744,22757,22748,22756,22751,22767,22778,22777,22779,22780,22781,22786,22794,22800,22811,26790,22821,22828,22829,22834,22840,22846,31442,22869,22864,22862,22874,22872,22882,22880,22887,22892,22889,22904,22913,22941,20318,20395,22947,22962,22982,23016,23004,22925,23001,23002,23077,23071,23057,23068,23049,23066,23104,23148,23113,23093,23094,23138,23146,23194,23228,23230,23243,23234,23229,23267,23255,23270,23273,23254,23290,23291,23308,23307,23318,23346,23248,23338,23350,23358,23363,23365,23360,23377,23381,23386,23387,23397,23401,23408,23411,23413,23416,25992,23418,23424,23427,23462,23480,23491,23495,23497,23508,23504,23524,23526,23522,23518,23525,23531,23536,23542,23539,23557,23559,23560,23565,23571,23584,23586,23592,23608,23609,23617,23622,23630,23635,23632,23631,23409,23660,23662,20066,23670,23673,23692,23697,23700,22939,23723,23739,23734,23740,23735,23749,23742,23751,23769,23785,23805,23802,23789,23948,23786,23819,23829,23831,23900,23839,23835,23825,23828,23842,23834,23833,23832,23884,23890,23886,23883,23916,23923,23926,23943,23940,23938,23970,23965,23980,23982,23997,23952,23991,23996,24009,24013,24019,24018,24022,24027,24043,24050,24053,24075,24090,24089,24081,24091,24118,24119,24132,24131,24128,24142,24151,24148,24159,24162,24164,24135,24181,24182,24186,40636,24191,24224,24257,24258,24264,24272,24271,24278,24291,24285,24282,24283,24290,24289,24296,24297,24300,24305,24307,24304,24308,24312,24318,24323,24329,24413,24412,24331,24337,24342,24361,24365,24376,24385,24392,24396,24398,24367,24401,24406,24407,24409,24417,24429,24435,24439,24451,24450,24447,24458,24456,24465,24455,24478,24473,24472,24480,24488,24493,24508,24534,24571,24548,24568,24561,24541,24755,24575,24609,24672,24601,24592,24617,24590,24625,24603,24597,24619,24614,24591,24634,24666,24641,24682,24695,24671,24650,24646,24653,24675,24643,24676,24642,24684,24683,24665,24705,24717,24807,24707,24730,24708,24731,24726,24727,24722,24743,24715,24801,24760,24800,24787,24756,24560,24765,24774,24757,24792,24909,24853,24838,24822,24823,24832,24820,24826,24835,24865,24827,24817,24845,24846,24903,24894,24872,24871,24906,24895,24892,24876,24884,24893,24898,24900,24947,24951,24920,24921,24922,24939,24948,24943,24933,24945,24927,24925,24915,24949,24985,24982,24967,25004,24980,24986,24970,24977,25003,25006,25036,25034,25033,25079,25032,25027,25030,25018,25035,32633,25037,25062,25059,25078,25082,25076,25087,25085,25084,25086,25088,25096,25097,25101,25100,25108,25115,25118,25121,25130,25134,25136,25138,25139,25153,25166,25182,25187,25179,25184,25192,25212,25218,25225,25214,25234,25235,25238,25300,25219,25236,25303,25297,25275,25295,25343,25286,25812,25288,25308,25292,25290,25282,25287,25243,25289,25356,25326,25329,25383,25346,25352,25327,25333,25424,25406,25421,25628,25423,25494,25486,25472,25515,25462,25507,25487,25481,25503,25525,25451,25449,25534,25577,25536,25542,25571,25545,25554,25590,25540,25622,25652,25606,25619,25638,25654,25885,25623,25640,25615,25703,25711,25718,25678,25898,25749,25747,25765,25769,25736,25788,25818,25810,25797,25799,25787,25816,25794,25841,25831,33289,25824,25825,25260,25827,25839,25900,25846,25844,25842,25850,25856,25853,25880,25884,25861,25892,25891,25899,25908,25909,25911,25910,25912,30027,25928,25942,25941,25933,25944,25950,25949,25970,25976,25986,25987,35722,26011,26015,26027,26039,26051,26054,26049,26052,26060,26066,26075,26073,26080,26081,26097,26482,26122,26115,26107,26483,26165,26166,26164,26140,26191,26180,26185,26177,26206,26205,26212,26215,26216,26207,26210,26224,26243,26248,26254,26249,26244,26264,26269,26305,26297,26313,26302,26300,26308,26296,26326,26330,26336,26175,26342,26345,26352,26357,26359,26383,26390,26398,26406,26407,38712,26414,26431,26422,26433,26424,26423,26438,26462,26464,26457,26467,26468,26505,26480,26537,26492,26474,26508,26507,26534,26529,26501,26551,26607,26548,26604,26547,26601,26552,26596,26590,26589,26594,26606,26553,26574,26566,26599,27292,26654,26694,26665,26688,26701,26674,26702,26803,26667,26713,26723,26743,26751,26783,26767,26797,26772,26781,26779,26755,27310,26809,26740,26805,26784,26810,26895,26765,26750,26881,26826,26888,26840,26914,26918,26849,26892,26829,26836,26855,26837,26934,26898,26884,26839,26851,26917,26873,26848,26863,26920,26922,26906,26915,26913,26822,27001,26999,26972,27000,26987,26964,27006,26990,26937,26996,26941,26969,26928,26977,26974,26973,27009,26986,27058,27054,27088,27071,27073,27091,27070,27086,23528,27082,27101,27067,27075,27047,27182,27025,27040,27036,27029,27060,27102,27112,27138,27163,27135,27402,27129,27122,27111,27141,27057,27166,27117,27156,27115,27146,27154,27329,27171,27155,27204,27148,27250,27190,27256,27207,27234,27225,27238,27208,27192,27170,27280,27277,27296,27268,27298,27299,27287,34327,27323,27331,27330,27320,27315,27308,27358,27345,27359,27306,27354,27370,27387,27397,34326,27386,27410,27414,39729,27423,27448,27447,30428,27449,39150,27463,27459,27465,27472,27481,27476,27483,27487,27489,27512,27513,27519,27520,27524,27523,27533,27544,27541,27550,27556,27562,27563,27567,27570,27569,27571,27575,27580,27590,27595,27603,27615,27628,27627,27635,27631,40638,27656,27667,27668,27675,27684,27683,27742,27733,27746,27754,27778,27789,27802,27777,27803,27774,27752,27763,27794,27792,27844,27889,27859,27837,27863,27845,27869,27822,27825,27838,27834,27867,27887,27865,27882,27935,34893,27958,27947,27965,27960,27929,27957,27955,27922,27916,28003,28051,28004,27994,28025,27993,28046,28053,28644,28037,28153,28181,28170,28085,28103,28134,28088,28102,28140,28126,28108,28136,28114,28101,28154,28121,28132,28117,28138,28142,28205,28270,28206,28185,28274,28255,28222,28195,28267,28203,28278,28237,28191,28227,28218,28238,28196,28415,28189,28216,28290,28330,28312,28361,28343,28371,28349,28335,28356,28338,28372,28373,28303,28325,28354,28319,28481,28433,28748,28396,28408,28414,28479,28402,28465,28399,28466,28364,28478,28435,28407,28550,28538,28536,28545,28544,28527,28507,28659,28525,28546,28540,28504,28558,28561,28610,28518,28595,28579,28577,28580,28601,28614,28586,28639,28629,28652,28628,28632,28657,28654,28635,28681,28683,28666,28689,28673,28687,28670,28699,28698,28532,28701,28696,28703,28720,28734,28722,28753,28771,28825,28818,28847,28913,28844,28856,28851,28846,28895,28875,28893,28889,28937,28925,28956,28953,29029,29013,29064,29030,29026,29004,29014,29036,29071,29179,29060,29077,29096,29100,29143,29113,29118,29138,29129,29140,29134,29152,29164,29159,29173,29180,29177,29183,29197,29200,29211,29224,29229,29228,29232,29234,29243,29244,29247,29248,29254,29259,29272,29300,29310,29314,29313,29319,29330,29334,29346,29351,29369,29362,29379,29382,29380,29390,29394,29410,29408,29409,29433,29431,20495,29463,29450,29468,29462,29469,29492,29487,29481,29477,29502,29518,29519,40664,29527,29546,29544,29552,29560,29557,29563,29562,29640,29619,29646,29627,29632,29669,29678,29662,29858,29701,29807,29733,29688,29746,29754,29781,29759,29791,29785,29761,29788,29801,29808,29795,29802,29814,29822,29835,29854,29863,29898,29903,29908,29681,29920,29923,29927,29929,29934,29938,29936,29937,29944,29943,29956,29955,29957,29964,29966,29965,29973,29971,29982,29990,29996,30012,30020,30029,30026,30025,30043,30022,30042,30057,30052,30055,30059,30061,30072,30070,30086,30087,30068,30090,30089,30082,30100,30106,30109,30117,30115,30146,30131,30147,30133,30141,30136,30140,30129,30157,30154,30162,30169,30179,30174,30206,30207,30204,30209,30192,30202,30194,30195,30219,30221,30217,30239,30247,30240,30241,30242,30244,30260,30256,30267,30279,30280,30278,30300,30296,30305,30306,30312,30313,30314,30311,30316,30320,30322,30326,30328,30332,30336,30339,30344,30347,30350,30358,30355,30361,30362,30384,30388,30392,30393,30394,30402,30413,30422,30418,30430,30433,30437,30439,30442,34351,30459,30472,30471,30468,30505,30500,30494,30501,30502,30491,30519,30520,30535,30554,30568,30571,30555,30565,30591,30590,30585,30606,30603,30609,30624,30622,30640,30646,30649,30655,30652,30653,30651,30663,30669,30679,30682,30684,30691,30702,30716,30732,30738,31014,30752,31018,30789,30862,30836,30854,30844,30874,30860,30883,30901,30890,30895,30929,30918,30923,30932,30910,30908,30917,30922,30956,30951,30938,30973,30964,30983,30994,30993,31001,31020,31019,31040,31072,31063,31071,31066,31061,31059,31098,31103,31114,31133,31143,40779,31146,31150,31155,31161,31162,31177,31189,31207,31212,31201,31203,31240,31245,31256,31257,31264,31263,31104,31281,31291,31294,31287,31299,31319,31305,31329,31330,31337,40861,31344,31353,31357,31368,31383,31381,31384,31382,31401,31432,31408,31414,31429,31428,31423,36995,31431,31434,31437,31439,31445,31443,31449,31450,31453,31457,31458,31462,31469,31472,31490,31503,31498,31494,31539,31512,31513,31518,31541,31528,31542,31568,31610,31492,31565,31499,31564,31557,31605,31589,31604,31591,31600,31601,31596,31598,31645,31640,31647,31629,31644,31642,31627,31634,31631,31581,31641,31691,31681,31692,31695,31668,31686,31709,31721,31761,31764,31718,31717,31840,31744,31751,31763,31731,31735,31767,31757,31734,31779,31783,31786,31775,31799,31787,31805,31820,31811,31828,31823,31808,31824,31832,31839,31844,31830,31845,31852,31861,31875,31888,31908,31917,31906,31915,31905,31912,31923,31922,31921,31918,31929,31933,31936,31941,31938,31960,31954,31964,31970,39739,31983,31986,31988,31990,31994,32006,32002,32028,32021,32010,32069,32075,32046,32050,32063,32053,32070,32115,32086,32078,32114,32104,32110,32079,32099,32147,32137,32091,32143,32125,32155,32186,32174,32163,32181,32199,32189,32171,32317,32162,32175,32220,32184,32159,32176,32216,32221,32228,32222,32251,32242,32225,32261,32266,32291,32289,32274,32305,32287,32265,32267,32290,32326,32358,32315,32309,32313,32323,32311,32306,32314,32359,32349,32342,32350,32345,32346,32377,32362,32361,32380,32379,32387,32213,32381,36782,32383,32392,32393,32396,32402,32400,32403,32404,32406,32398,32411,32412,32568,32570,32581,32588,32589,32590,32592,32593,32597,32596,32600,32607,32608,32616,32617,32615,32632,32642,32646,32643,32648,32647,32652,32660,32670,32669,32666,32675,32687,32690,32697,32686,32694,32696,35697,32709,32710,32714,32725,32724,32737,32742,32745,32755,32761,39132,32774,32772,32779,32786,32792,32793,32796,32801,32808,32831,32827,32842,32838,32850,32856,32858,32863,32866,32872,32883,32882,32880,32886,32889,32893,32895,32900,32902,32901,32923,32915,32922,32941,20880,32940,32987,32997,32985,32989,32964,32986,32982,33033,33007,33009,33051,33065,33059,33071,33099,38539,33094,33086,33107,33105,33020,33137,33134,33125,33126,33140,33155,33160,33162,33152,33154,33184,33173,33188,33187,33119,33171,33193,33200,33205,33214,33208,33213,33216,33218,33210,33225,33229,33233,33241,33240,33224,33242,33247,33248,33255,33274,33275,33278,33281,33282,33285,33287,33290,33293,33296,33302,33321,33323,33336,33331,33344,33369,33368,33373,33370,33375,33380,33378,33384,33386,33387,33326,33393,33399,33400,33406,33421,33426,33451,33439,33467,33452,33505,33507,33503,33490,33524,33523,33530,33683,33539,33531,33529,33502,33542,33500,33545,33497,33589,33588,33558,33586,33585,33600,33593,33616,33605,33583,33579,33559,33560,33669,33690,33706,33695,33698,33686,33571,33678,33671,33674,33660,33717,33651,33653,33696,33673,33704,33780,33811,33771,33742,33789,33795,33752,33803,33729,33783,33799,33760,33778,33805,33826,33824,33725,33848,34054,33787,33901,33834,33852,34138,33924,33911,33899,33965,33902,33922,33897,33862,33836,33903,33913,33845,33994,33890,33977,33983,33951,34009,33997,33979,34010,34000,33985,33990,34006,33953,34081,34047,34036,34071,34072,34092,34079,34069,34068,34044,34112,34147,34136,34120,34113,34306,34123,34133,34176,34212,34184,34193,34186,34216,34157,34196,34203,34282,34183,34204,34167,34174,34192,34249,34234,34255,34233,34256,34261,34269,34277,34268,34297,34314,34323,34315,34302,34298,34310,34338,34330,34352,34367,34381,20053,34388,34399,34407,34417,34451,34467,34473,34474,34443,34444,34486,34479,34500,34502,34480,34505,34851,34475,34516,34526,34537,34540,34527,34523,34543,34578,34566,34568,34560,34563,34555,34577,34569,34573,34553,34570,34612,34623,34615,34619,34597,34601,34586,34656,34655,34680,34636,34638,34676,34647,34664,34670,34649,34643,34659,34666,34821,34722,34719,34690,34735,34763,34749,34752,34768,38614,34731,34756,34739,34759,34758,34747,34799,34802,34784,34831,34829,34814,34806,34807,34830,34770,34833,34838,34837,34850,34849,34865,34870,34873,34855,34875,34884,34882,34898,34905,34910,34914,34923,34945,34942,34974,34933,34941,34997,34930,34946,34967,34962,34990,34969,34978,34957,34980,34992,35007,34993,35011,35012,35028,35032,35033,35037,35065,35074,35068,35060,35048,35058,35076,35084,35082,35091,35139,35102,35109,35114,35115,35137,35140,35131,35126,35128,35148,35101,35168,35166,35174,35172,35181,35178,35183,35188,35191,35198,35203,35208,35210,35219,35224,35233,35241,35238,35244,35247,35250,35258,35261,35263,35264,35290,35292,35293,35303,35316,35320,35331,35350,35344,35340,35355,35357,35365,35382,35393,35419,35410,35398,35400,35452,35437,35436,35426,35461,35458,35460,35496,35489,35473,35493,35494,35482,35491,35524,35533,35522,35546,35563,35571,35559,35556,35569,35604,35552,35554,35575,35550,35547,35596,35591,35610,35553,35606,35600,35607,35616,35635,38827,35622,35627,35646,35624,35649,35660,35663,35662,35657,35670,35675,35674,35691,35679,35692,35695,35700,35709,35712,35724,35726,35730,35731,35734,35737,35738,35898,35905,35903,35912,35916,35918,35920,35925,35938,35948,35960,35962,35970,35977,35973,35978,35981,35982,35988,35964,35992,25117,36013,36010,36029,36018,36019,36014,36022,36040,36033,36068,36067,36058,36093,36090,36091,36100,36101,36106,36103,36111,36109,36112,40782,36115,36045,36116,36118,36199,36205,36209,36211,36225,36249,36290,36286,36282,36303,36314,36310,36300,36315,36299,36330,36331,36319,36323,36348,36360,36361,36351,36381,36382,36368,36383,36418,36405,36400,36404,36426,36423,36425,36428,36432,36424,36441,36452,36448,36394,36451,36437,36470,36466,36476,36481,36487,36485,36484,36491,36490,36499,36497,36500,36505,36522,36513,36524,36528,36550,36529,36542,36549,36552,36555,36571,36579,36604,36603,36587,36606,36618,36613,36629,36626,36633,36627,36636,36639,36635,36620,36646,36659,36667,36665,36677,36674,36670,36684,36681,36678,36686,36695,36700,36706,36707,36708,36764,36767,36771,36781,36783,36791,36826,36837,36834,36842,36847,36999,36852,36869,36857,36858,36881,36885,36897,36877,36894,36886,36875,36903,36918,36917,36921,36856,36943,36944,36945,36946,36878,36937,36926,36950,36952,36958,36968,36975,36982,38568,36978,36994,36989,36993,36992,37002,37001,37007,37032,37039,37041,37045,37090,37092,25160,37083,37122,37138,37145,37170,37168,37194,37206,37208,37219,37221,37225,37235,37234,37259,37257,37250,37282,37291,37295,37290,37301,37300,37306,37312,37313,37321,37323,37328,37334,37343,37345,37339,37372,37365,37366,37406,37375,37396,37420,37397,37393,37470,37463,37445,37449,37476,37448,37525,37439,37451,37456,37532,37526,37523,37531,37466,37583,37561,37559,37609,37647,37626,37700,37678,37657,37666,37658,37667,37690,37685,37691,37724,37728,37756,37742,37718,37808,37804,37805,37780,37817,37846,37847,37864,37861,37848,37827,37853,37840,37832,37860,37914,37908,37907,37891,37895,37904,37942,37931,37941,37921,37946,37953,37970,37956,37979,37984,37986,37982,37994,37417,38000,38005,38007,38013,37978,38012,38014,38017,38015,38274,38279,38282,38292,38294,38296,38297,38304,38312,38311,38317,38332,38331,38329,38334,38346,28662,38339,38349,38348,38357,38356,38358,38364,38369,38373,38370,38433,38440,38446,38447,38466,38476,38479,38475,38519,38492,38494,38493,38495,38502,38514,38508,38541,38552,38549,38551,38570,38567,38577,38578,38576,38580,38582,38584,38585,38606,38603,38601,38605,35149,38620,38669,38613,38649,38660,38662,38664,38675,38670,38673,38671,38678,38681,38692,38698,38704,38713,38717,38718,38724,38726,38728,38722,38729,38748,38752,38756,38758,38760,21202,38763,38769,38777,38789,38780,38785,38778,38790,38795,38799,38800,38812,38824,38822,38819,38835,38836,38851,38854,38856,38859,38876,38893,40783,38898,31455,38902,38901,38927,38924,38968,38948,38945,38967,38973,38982,38991,38987,39019,39023,39024,39025,39028,39027,39082,39087,39089,39094,39108,39107,39110,39145,39147,39171,39177,39186,39188,39192,39201,39197,39198,39204,39200,39212,39214,39229,39230,39234,39241,39237,39248,39243,39249,39250,39244,39253,39319,39320,39333,39341,39342,39356,39391,39387,39389,39384,39377,39405,39406,39409,39410,39419,39416,39425,39439,39429,39394,39449,39467,39479,39493,39490,39488,39491,39486,39509,39501,39515,39511,39519,39522,39525,39524,39529,39531,39530,39597,39600,39612,39616,39631,39633,39635,39636,39646,39647,39650,39651,39654,39663,39659,39662,39668,39665,39671,39675,39686,39704,39706,39711,39714,39715,39717,39719,39720,39721,39722,39726,39727,39730,39748,39747,39759,39757,39758,39761,39768,39796,39827,39811,39825,39830,39831,39839,39840,39848,39860,39872,39882,39865,39878,39887,39889,39890,39907,39906,39908,39892,39905,39994,39922,39921,39920,39957,39956,39945,39955,39948,39942,39944,39954,39946,39940,39982,39963,39973,39972,39969,39984,40007,39986,40006,39998,40026,40032,40039,40054,40056,40167,40172,40176,40201,40200,40171,40195,40198,40234,40230,40367,40227,40223,40260,40213,40210,40257,40255,40254,40262,40264,40285,40286,40292,40273,40272,40281,40306,40329,40327,40363,40303,40314,40346,40356,40361,40370,40388,40385,40379,40376,40378,40390,40399,40386,40409,40403,40440,40422,40429,40431,40445,40474,40475,40478,40565,40569,40573,40577,40584,40587,40588,40594,40597,40593,40605,40613,40617,40632,40618,40621,38753,40652,40654,40655,40656,40660,40668,40670,40669,40672,40677,40680,40687,40692,40694,40695,40697,40699,40700,40701,40711,40712,30391,40725,40737,40748,40766,40778,40786,40788,40803,40799,40800,40801,40806,40807,40812,40810,40823,40818,40822,40853,40860,40864,22575,27079,36953,29796,20956,29081,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,32394,35100,37704,37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193,20220,20224,20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479,20510,20550,20592,20546,20628,20724,20696,20810,20836,20893,20926,20972,21013,21148,21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660,21642,21673,21759,21894,22361,22373,22444,22472,22471,64015,64016,22686,22706,22795,22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532,23582,23718,23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353,24372,24423,24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887,24880,24984,25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121,26158,26142,26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362,26382,63785,26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032,27106,27184,27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759,27866,27908,28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199,28220,28351,28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020,28998,28999,64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654,29667,29650,29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063,30338,30364,30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024,64024,64025,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072,32092,32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782,33864,33972,34131,34137,34155,64031,34224,64032,64033,34823,35061,35346,35383,35449,35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214,64035,36559,64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357,37358,37348,37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433,37479,37543,37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669,37665,37627,64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880,37937,37957,37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735,38737,38741,38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797,39794,39823,39857,39867,39936,40304,40299,64045,40473,40657,null,null,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,65506,65508,65287,65282,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,65506,65508,65287,65282,12849,8470,8481,8757,32394,35100,37704,37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193,20220,20224,20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479,20510,20550,20592,20546,20628,20724,20696,20810,20836,20893,20926,20972,21013,21148,21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660,21642,21673,21759,21894,22361,22373,22444,22472,22471,64015,64016,22686,22706,22795,22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532,23582,23718,23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353,24372,24423,24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887,24880,24984,25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121,26158,26142,26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362,26382,63785,26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032,27106,27184,27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759,27866,27908,28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199,28220,28351,28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020,28998,28999,64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654,29667,29650,29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063,30338,30364,30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024,64024,64025,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072,32092,32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782,33864,33972,34131,34137,34155,64031,34224,64032,64033,34823,35061,35346,35383,35449,35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214,64035,36559,64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357,37358,37348,37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433,37479,37543,37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669,37665,37627,64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880,37937,37957,37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735,38737,38741,38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797,39794,39823,39857,39867,39936,40304,40299,64045,40473,40657,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\n \"jis0212\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,728,711,184,729,733,175,731,730,65374,900,901,null,null,null,null,null,null,null,null,161,166,191,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,186,170,169,174,8482,164,8470,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,902,904,905,906,938,null,908,null,910,939,null,911,null,null,null,null,940,941,942,943,970,912,972,962,973,971,944,974,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1038,1039,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1118,1119,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,198,272,null,294,null,306,null,321,319,null,330,216,338,null,358,222,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,230,273,240,295,305,307,312,322,320,329,331,248,339,223,359,254,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,193,192,196,194,258,461,256,260,197,195,262,264,268,199,266,270,201,200,203,202,282,278,274,280,null,284,286,290,288,292,205,204,207,206,463,304,298,302,296,308,310,313,317,315,323,327,325,209,211,210,214,212,465,336,332,213,340,344,342,346,348,352,350,356,354,218,217,220,219,364,467,368,362,370,366,360,471,475,473,469,372,221,376,374,377,381,379,null,null,null,null,null,null,null,225,224,228,226,259,462,257,261,229,227,263,265,269,231,267,271,233,232,235,234,283,279,275,281,501,285,287,null,289,293,237,236,239,238,464,null,299,303,297,309,311,314,318,316,324,328,326,241,243,242,246,244,466,337,333,245,341,345,343,347,349,353,351,357,355,250,249,252,251,365,468,369,363,371,367,361,472,476,474,470,373,253,255,375,378,382,380,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,19970,19972,19973,19980,19986,19999,20003,20004,20008,20011,20014,20015,20016,20021,20032,20033,20036,20039,20049,20058,20060,20067,20072,20073,20084,20085,20089,20095,20109,20118,20119,20125,20143,20153,20163,20176,20186,20187,20192,20193,20194,20200,20207,20209,20211,20213,20221,20222,20223,20224,20226,20227,20232,20235,20236,20242,20245,20246,20247,20249,20270,20273,20320,20275,20277,20279,20281,20283,20286,20288,20290,20296,20297,20299,20300,20306,20308,20310,20312,20319,20323,20330,20332,20334,20337,20343,20344,20345,20346,20349,20350,20353,20354,20356,20357,20361,20362,20364,20366,20368,20370,20371,20372,20375,20377,20378,20382,20383,20402,20407,20409,20411,20412,20413,20414,20416,20417,20421,20422,20424,20425,20427,20428,20429,20431,20434,20444,20448,20450,20464,20466,20476,20477,20479,20480,20481,20484,20487,20490,20492,20494,20496,20499,20503,20504,20507,20508,20509,20510,20514,20519,20526,20528,20530,20531,20533,20544,20545,20546,20549,20550,20554,20556,20558,20561,20562,20563,20567,20569,20575,20576,20578,20579,20582,20583,20586,20589,20592,20593,20539,20609,20611,20612,20614,20618,20622,20623,20624,20626,20627,20628,20630,20635,20636,20638,20639,20640,20641,20642,20650,20655,20656,20665,20666,20669,20672,20675,20676,20679,20684,20686,20688,20691,20692,20696,20700,20701,20703,20706,20708,20710,20712,20713,20719,20721,20726,20730,20734,20739,20742,20743,20744,20747,20748,20749,20750,20722,20752,20759,20761,20763,20764,20765,20766,20771,20775,20776,20780,20781,20783,20785,20787,20788,20789,20792,20793,20802,20810,20815,20819,20821,20823,20824,20831,20836,20838,20862,20867,20868,20875,20878,20888,20893,20897,20899,20909,20920,20922,20924,20926,20927,20930,20936,20943,20945,20946,20947,20949,20952,20958,20962,20965,20974,20978,20979,20980,20983,20993,20994,20997,21010,21011,21013,21014,21016,21026,21032,21041,21042,21045,21052,21061,21065,21077,21079,21080,21082,21084,21087,21088,21089,21094,21102,21111,21112,21113,21120,21122,21125,21130,21132,21139,21141,21142,21143,21144,21146,21148,21156,21157,21158,21159,21167,21168,21174,21175,21176,21178,21179,21181,21184,21188,21190,21192,21196,21199,21201,21204,21206,21211,21212,21217,21221,21224,21225,21226,21228,21232,21233,21236,21238,21239,21248,21251,21258,21259,21260,21265,21267,21272,21275,21276,21278,21279,21285,21287,21288,21289,21291,21292,21293,21296,21298,21301,21308,21309,21310,21314,21324,21323,21337,21339,21345,21347,21349,21356,21357,21362,21369,21374,21379,21383,21384,21390,21395,21396,21401,21405,21409,21412,21418,21419,21423,21426,21428,21429,21431,21432,21434,21437,21440,21445,21455,21458,21459,21461,21466,21469,21470,21472,21478,21479,21493,21506,21523,21530,21537,21543,21544,21546,21551,21553,21556,21557,21571,21572,21575,21581,21583,21598,21602,21604,21606,21607,21609,21611,21613,21614,21620,21631,21633,21635,21637,21640,21641,21645,21649,21653,21654,21660,21663,21665,21670,21671,21673,21674,21677,21678,21681,21687,21689,21690,21691,21695,21702,21706,21709,21710,21728,21738,21740,21743,21750,21756,21758,21759,21760,21761,21765,21768,21769,21772,21773,21774,21781,21802,21803,21810,21813,21814,21819,21820,21821,21825,21831,21833,21834,21837,21840,21841,21848,21850,21851,21854,21856,21857,21860,21862,21887,21889,21890,21894,21896,21902,21903,21905,21906,21907,21908,21911,21923,21924,21933,21938,21951,21953,21955,21958,21961,21963,21964,21966,21969,21970,21971,21975,21976,21979,21982,21986,21993,22006,22015,22021,22024,22026,22029,22030,22031,22032,22033,22034,22041,22060,22064,22067,22069,22071,22073,22075,22076,22077,22079,22080,22081,22083,22084,22086,22089,22091,22093,22095,22100,22110,22112,22113,22114,22115,22118,22121,22125,22127,22129,22130,22133,22148,22149,22152,22155,22156,22165,22169,22170,22173,22174,22175,22182,22183,22184,22185,22187,22188,22189,22193,22195,22199,22206,22213,22217,22218,22219,22223,22224,22220,22221,22233,22236,22237,22239,22241,22244,22245,22246,22247,22248,22257,22251,22253,22262,22263,22273,22274,22279,22282,22284,22289,22293,22298,22299,22301,22304,22306,22307,22308,22309,22313,22314,22316,22318,22319,22323,22324,22333,22334,22335,22341,22342,22348,22349,22354,22370,22373,22375,22376,22379,22381,22382,22383,22384,22385,22387,22388,22389,22391,22393,22394,22395,22396,22398,22401,22403,22412,22420,22423,22425,22426,22428,22429,22430,22431,22433,22421,22439,22440,22441,22444,22456,22461,22471,22472,22476,22479,22485,22493,22494,22500,22502,22503,22505,22509,22512,22517,22518,22520,22525,22526,22527,22531,22532,22536,22537,22497,22540,22541,22555,22558,22559,22560,22566,22567,22573,22578,22585,22591,22601,22604,22605,22607,22608,22613,22623,22625,22628,22631,22632,22648,22652,22655,22656,22657,22663,22664,22665,22666,22668,22669,22671,22672,22676,22678,22685,22688,22689,22690,22694,22697,22705,22706,22724,22716,22722,22728,22733,22734,22736,22738,22740,22742,22746,22749,22753,22754,22761,22771,22789,22790,22795,22796,22802,22803,22804,34369,22813,22817,22819,22820,22824,22831,22832,22835,22837,22838,22847,22851,22854,22866,22867,22873,22875,22877,22878,22879,22881,22883,22891,22893,22895,22898,22901,22902,22905,22907,22908,22923,22924,22926,22930,22933,22935,22943,22948,22951,22957,22958,22959,22960,22963,22967,22970,22972,22977,22979,22980,22984,22986,22989,22994,23005,23006,23007,23011,23012,23015,23022,23023,23025,23026,23028,23031,23040,23044,23052,23053,23054,23058,23059,23070,23075,23076,23079,23080,23082,23085,23088,23108,23109,23111,23112,23116,23120,23125,23134,23139,23141,23143,23149,23159,23162,23163,23166,23179,23184,23187,23190,23193,23196,23198,23199,23200,23202,23207,23212,23217,23218,23219,23221,23224,23226,23227,23231,23236,23238,23240,23247,23258,23260,23264,23269,23274,23278,23285,23286,23293,23296,23297,23304,23319,23348,23321,23323,23325,23329,23333,23341,23352,23361,23371,23372,23378,23382,23390,23400,23406,23407,23420,23421,23422,23423,23425,23428,23430,23434,23438,23440,23441,23443,23444,23446,23464,23465,23468,23469,23471,23473,23474,23479,23482,23484,23488,23489,23501,23503,23510,23511,23512,23513,23514,23520,23535,23537,23540,23549,23564,23575,23582,23583,23587,23590,23593,23595,23596,23598,23600,23602,23605,23606,23641,23642,23644,23650,23651,23655,23656,23657,23661,23664,23668,23669,23674,23675,23676,23677,23687,23688,23690,23695,23698,23709,23711,23712,23714,23715,23718,23722,23730,23732,23733,23738,23753,23755,23762,23773,23767,23790,23793,23794,23796,23809,23814,23821,23826,23851,23843,23844,23846,23847,23857,23860,23865,23869,23871,23874,23875,23878,23880,23893,23889,23897,23882,23903,23904,23905,23906,23908,23914,23917,23920,23929,23930,23934,23935,23937,23939,23944,23946,23954,23955,23956,23957,23961,23963,23967,23968,23975,23979,23984,23988,23992,23993,24003,24007,24011,24016,24014,24024,24025,24032,24036,24041,24056,24057,24064,24071,24077,24082,24084,24085,24088,24095,24096,24110,24104,24114,24117,24126,24139,24144,24137,24145,24150,24152,24155,24156,24158,24168,24170,24171,24172,24173,24174,24176,24192,24203,24206,24226,24228,24229,24232,24234,24236,24241,24243,24253,24254,24255,24262,24268,24267,24270,24273,24274,24276,24277,24284,24286,24293,24299,24322,24326,24327,24328,24334,24345,24348,24349,24353,24354,24355,24356,24360,24363,24364,24366,24368,24372,24374,24379,24381,24383,24384,24388,24389,24391,24397,24400,24404,24408,24411,24416,24419,24420,24423,24431,24434,24436,24437,24440,24442,24445,24446,24457,24461,24463,24470,24476,24477,24482,24487,24491,24484,24492,24495,24496,24497,24504,24516,24519,24520,24521,24523,24528,24529,24530,24531,24532,24542,24545,24546,24552,24553,24554,24556,24557,24558,24559,24562,24563,24566,24570,24572,24583,24586,24589,24595,24596,24599,24600,24602,24607,24612,24621,24627,24629,24640,24647,24648,24649,24652,24657,24660,24662,24663,24669,24673,24679,24689,24702,24703,24706,24710,24712,24714,24718,24721,24723,24725,24728,24733,24734,24738,24740,24741,24744,24752,24753,24759,24763,24766,24770,24772,24776,24777,24778,24779,24782,24783,24788,24789,24793,24795,24797,24798,24802,24805,24818,24821,24824,24828,24829,24834,24839,24842,24844,24848,24849,24850,24851,24852,24854,24855,24857,24860,24862,24866,24874,24875,24880,24881,24885,24886,24887,24889,24897,24901,24902,24905,24926,24928,24940,24946,24952,24955,24956,24959,24960,24961,24963,24964,24971,24973,24978,24979,24983,24984,24988,24989,24991,24992,24997,25000,25002,25005,25016,25017,25020,25024,25025,25026,25038,25039,25045,25052,25053,25054,25055,25057,25058,25063,25065,25061,25068,25069,25071,25089,25091,25092,25095,25107,25109,25116,25120,25122,25123,25127,25129,25131,25145,25149,25154,25155,25156,25158,25164,25168,25169,25170,25172,25174,25178,25180,25188,25197,25199,25203,25210,25213,25229,25230,25231,25232,25254,25256,25267,25270,25271,25274,25278,25279,25284,25294,25301,25302,25306,25322,25330,25332,25340,25341,25347,25348,25354,25355,25357,25360,25363,25366,25368,25385,25386,25389,25397,25398,25401,25404,25409,25410,25411,25412,25414,25418,25419,25422,25426,25427,25428,25432,25435,25445,25446,25452,25453,25457,25460,25461,25464,25468,25469,25471,25474,25476,25479,25482,25488,25492,25493,25497,25498,25502,25508,25510,25517,25518,25519,25533,25537,25541,25544,25550,25553,25555,25556,25557,25564,25568,25573,25578,25580,25586,25587,25589,25592,25593,25609,25610,25616,25618,25620,25624,25630,25632,25634,25636,25637,25641,25642,25647,25648,25653,25661,25663,25675,25679,25681,25682,25683,25684,25690,25691,25692,25693,25695,25696,25697,25699,25709,25715,25716,25723,25725,25733,25735,25743,25744,25745,25752,25753,25755,25757,25759,25761,25763,25766,25768,25772,25779,25789,25790,25791,25796,25801,25802,25803,25804,25806,25808,25809,25813,25815,25828,25829,25833,25834,25837,25840,25845,25847,25851,25855,25857,25860,25864,25865,25866,25871,25875,25876,25878,25881,25883,25886,25887,25890,25894,25897,25902,25905,25914,25916,25917,25923,25927,25929,25936,25938,25940,25951,25952,25959,25963,25978,25981,25985,25989,25994,26002,26005,26008,26013,26016,26019,26022,26030,26034,26035,26036,26047,26050,26056,26057,26062,26064,26068,26070,26072,26079,26096,26098,26100,26101,26105,26110,26111,26112,26116,26120,26121,26125,26129,26130,26133,26134,26141,26142,26145,26146,26147,26148,26150,26153,26154,26155,26156,26158,26160,26161,26163,26169,26167,26176,26181,26182,26186,26188,26193,26190,26199,26200,26201,26203,26204,26208,26209,26363,26218,26219,26220,26238,26227,26229,26239,26231,26232,26233,26235,26240,26236,26251,26252,26253,26256,26258,26265,26266,26267,26268,26271,26272,26276,26285,26289,26290,26293,26299,26303,26304,26306,26307,26312,26316,26318,26319,26324,26331,26335,26344,26347,26348,26350,26362,26373,26375,26382,26387,26393,26396,26400,26402,26419,26430,26437,26439,26440,26444,26452,26453,26461,26470,26476,26478,26484,26486,26491,26497,26500,26510,26511,26513,26515,26518,26520,26521,26523,26544,26545,26546,26549,26555,26556,26557,26617,26560,26562,26563,26565,26568,26569,26578,26583,26585,26588,26593,26598,26608,26610,26614,26615,26706,26644,26649,26653,26655,26664,26663,26668,26669,26671,26672,26673,26675,26683,26687,26692,26693,26698,26700,26709,26711,26712,26715,26731,26734,26735,26736,26737,26738,26741,26745,26746,26747,26748,26754,26756,26758,26760,26774,26776,26778,26780,26785,26787,26789,26793,26794,26798,26802,26811,26821,26824,26828,26831,26832,26833,26835,26838,26841,26844,26845,26853,26856,26858,26859,26860,26861,26864,26865,26869,26870,26875,26876,26877,26886,26889,26890,26896,26897,26899,26902,26903,26929,26931,26933,26936,26939,26946,26949,26953,26958,26967,26971,26979,26980,26981,26982,26984,26985,26988,26992,26993,26994,27002,27003,27007,27008,27021,27026,27030,27032,27041,27045,27046,27048,27051,27053,27055,27063,27064,27066,27068,27077,27080,27089,27094,27095,27106,27109,27118,27119,27121,27123,27125,27134,27136,27137,27139,27151,27153,27157,27162,27165,27168,27172,27176,27184,27186,27188,27191,27195,27198,27199,27205,27206,27209,27210,27214,27216,27217,27218,27221,27222,27227,27236,27239,27242,27249,27251,27262,27265,27267,27270,27271,27273,27275,27281,27291,27293,27294,27295,27301,27307,27311,27312,27313,27316,27325,27326,27327,27334,27337,27336,27340,27344,27348,27349,27350,27356,27357,27364,27367,27372,27376,27377,27378,27388,27389,27394,27395,27398,27399,27401,27407,27408,27409,27415,27419,27422,27428,27432,27435,27436,27439,27445,27446,27451,27455,27462,27466,27469,27474,27478,27480,27485,27488,27495,27499,27502,27504,27509,27517,27518,27522,27525,27543,27547,27551,27552,27554,27555,27560,27561,27564,27565,27566,27568,27576,27577,27581,27582,27587,27588,27593,27596,27606,27610,27617,27619,27622,27623,27630,27633,27639,27641,27647,27650,27652,27653,27657,27661,27662,27664,27666,27673,27679,27686,27687,27688,27692,27694,27699,27701,27702,27706,27707,27711,27722,27723,27725,27727,27730,27732,27737,27739,27740,27755,27757,27759,27764,27766,27768,27769,27771,27781,27782,27783,27785,27796,27797,27799,27800,27804,27807,27824,27826,27828,27842,27846,27853,27855,27856,27857,27858,27860,27862,27866,27868,27872,27879,27881,27883,27884,27886,27890,27892,27908,27911,27914,27918,27919,27921,27923,27930,27942,27943,27944,27751,27950,27951,27953,27961,27964,27967,27991,27998,27999,28001,28005,28007,28015,28016,28028,28034,28039,28049,28050,28052,28054,28055,28056,28074,28076,28084,28087,28089,28093,28095,28100,28104,28106,28110,28111,28118,28123,28125,28127,28128,28130,28133,28137,28143,28144,28148,28150,28156,28160,28164,28190,28194,28199,28210,28214,28217,28219,28220,28228,28229,28232,28233,28235,28239,28241,28242,28243,28244,28247,28252,28253,28254,28258,28259,28264,28275,28283,28285,28301,28307,28313,28320,28327,28333,28334,28337,28339,28347,28351,28352,28353,28355,28359,28360,28362,28365,28366,28367,28395,28397,28398,28409,28411,28413,28420,28424,28426,28428,28429,28438,28440,28442,28443,28454,28457,28458,28463,28464,28467,28470,28475,28476,28461,28495,28497,28498,28499,28503,28505,28506,28509,28510,28513,28514,28520,28524,28541,28542,28547,28551,28552,28555,28556,28557,28560,28562,28563,28564,28566,28570,28575,28576,28581,28582,28583,28584,28590,28591,28592,28597,28598,28604,28613,28615,28616,28618,28634,28638,28648,28649,28656,28661,28665,28668,28669,28672,28677,28678,28679,28685,28695,28704,28707,28719,28724,28727,28729,28732,28739,28740,28744,28745,28746,28747,28756,28757,28765,28766,28750,28772,28773,28780,28782,28789,28790,28798,28801,28805,28806,28820,28821,28822,28823,28824,28827,28836,28843,28848,28849,28852,28855,28874,28881,28883,28884,28885,28886,28888,28892,28900,28922,28931,28932,28933,28934,28935,28939,28940,28943,28958,28960,28971,28973,28975,28976,28977,28984,28993,28997,28998,28999,29002,29003,29008,29010,29015,29018,29020,29022,29024,29032,29049,29056,29061,29063,29068,29074,29082,29083,29088,29090,29103,29104,29106,29107,29114,29119,29120,29121,29124,29131,29132,29139,29142,29145,29146,29148,29176,29182,29184,29191,29192,29193,29203,29207,29210,29213,29215,29220,29227,29231,29236,29240,29241,29249,29250,29251,29253,29262,29263,29264,29267,29269,29270,29274,29276,29278,29280,29283,29288,29291,29294,29295,29297,29303,29304,29307,29308,29311,29316,29321,29325,29326,29331,29339,29352,29357,29358,29361,29364,29374,29377,29383,29385,29388,29397,29398,29400,29407,29413,29427,29428,29434,29435,29438,29442,29444,29445,29447,29451,29453,29458,29459,29464,29465,29470,29474,29476,29479,29480,29484,29489,29490,29493,29498,29499,29501,29507,29517,29520,29522,29526,29528,29533,29534,29535,29536,29542,29543,29545,29547,29548,29550,29551,29553,29559,29561,29564,29568,29569,29571,29573,29574,29582,29584,29587,29589,29591,29592,29596,29598,29599,29600,29602,29605,29606,29610,29611,29613,29621,29623,29625,29628,29629,29631,29637,29638,29641,29643,29644,29647,29650,29651,29654,29657,29661,29665,29667,29670,29671,29673,29684,29685,29687,29689,29690,29691,29693,29695,29696,29697,29700,29703,29706,29713,29722,29723,29732,29734,29736,29737,29738,29739,29740,29741,29742,29743,29744,29745,29753,29760,29763,29764,29766,29767,29771,29773,29777,29778,29783,29789,29794,29798,29799,29800,29803,29805,29806,29809,29810,29824,29825,29829,29830,29831,29833,29839,29840,29841,29842,29848,29849,29850,29852,29855,29856,29857,29859,29862,29864,29865,29866,29867,29870,29871,29873,29874,29877,29881,29883,29887,29896,29897,29900,29904,29907,29912,29914,29915,29918,29919,29924,29928,29930,29931,29935,29940,29946,29947,29948,29951,29958,29970,29974,29975,29984,29985,29988,29991,29993,29994,29999,30006,30009,30013,30014,30015,30016,30019,30023,30024,30030,30032,30034,30039,30046,30047,30049,30063,30065,30073,30074,30075,30076,30077,30078,30081,30085,30096,30098,30099,30101,30105,30108,30114,30116,30132,30138,30143,30144,30145,30148,30150,30156,30158,30159,30167,30172,30175,30176,30177,30180,30183,30188,30190,30191,30193,30201,30208,30210,30211,30212,30215,30216,30218,30220,30223,30226,30227,30229,30230,30233,30235,30236,30237,30238,30243,30245,30246,30249,30253,30258,30259,30261,30264,30265,30266,30268,30282,30272,30273,30275,30276,30277,30281,30283,30293,30297,30303,30308,30309,30317,30318,30319,30321,30324,30337,30341,30348,30349,30357,30363,30364,30365,30367,30368,30370,30371,30372,30373,30374,30375,30376,30378,30381,30397,30401,30405,30409,30411,30412,30414,30420,30425,30432,30438,30440,30444,30448,30449,30454,30457,30460,30464,30470,30474,30478,30482,30484,30485,30487,30489,30490,30492,30498,30504,30509,30510,30511,30516,30517,30518,30521,30525,30526,30530,30533,30534,30538,30541,30542,30543,30546,30550,30551,30556,30558,30559,30560,30562,30564,30567,30570,30572,30576,30578,30579,30580,30586,30589,30592,30596,30604,30605,30612,30613,30614,30618,30623,30626,30631,30634,30638,30639,30641,30645,30654,30659,30665,30673,30674,30677,30681,30686,30687,30688,30692,30694,30698,30700,30704,30705,30708,30712,30715,30725,30726,30729,30733,30734,30737,30749,30753,30754,30755,30765,30766,30768,30773,30775,30787,30788,30791,30792,30796,30798,30802,30812,30814,30816,30817,30819,30820,30824,30826,30830,30842,30846,30858,30863,30868,30872,30881,30877,30878,30879,30884,30888,30892,30893,30896,30897,30898,30899,30907,30909,30911,30919,30920,30921,30924,30926,30930,30931,30933,30934,30948,30939,30943,30944,30945,30950,30954,30962,30963,30976,30966,30967,30970,30971,30975,30982,30988,30992,31002,31004,31006,31007,31008,31013,31015,31017,31021,31025,31028,31029,31035,31037,31039,31044,31045,31046,31050,31051,31055,31057,31060,31064,31067,31068,31079,31081,31083,31090,31097,31099,31100,31102,31115,31116,31121,31123,31124,31125,31126,31128,31131,31132,31137,31144,31145,31147,31151,31153,31156,31160,31163,31170,31172,31175,31176,31178,31183,31188,31190,31194,31197,31198,31200,31202,31205,31210,31211,31213,31217,31224,31228,31234,31235,31239,31241,31242,31244,31249,31253,31259,31262,31265,31271,31275,31277,31279,31280,31284,31285,31288,31289,31290,31300,31301,31303,31304,31308,31317,31318,31321,31324,31325,31327,31328,31333,31335,31338,31341,31349,31352,31358,31360,31362,31365,31366,31370,31371,31376,31377,31380,31390,31392,31395,31404,31411,31413,31417,31419,31420,31430,31433,31436,31438,31441,31451,31464,31465,31467,31468,31473,31476,31483,31485,31486,31495,31508,31519,31523,31527,31529,31530,31531,31533,31534,31535,31536,31537,31540,31549,31551,31552,31553,31559,31566,31573,31584,31588,31590,31593,31594,31597,31599,31602,31603,31607,31620,31625,31630,31632,31633,31638,31643,31646,31648,31653,31660,31663,31664,31666,31669,31670,31674,31675,31676,31677,31682,31685,31688,31690,31700,31702,31703,31705,31706,31707,31720,31722,31730,31732,31733,31736,31737,31738,31740,31742,31745,31746,31747,31748,31750,31753,31755,31756,31758,31759,31769,31771,31776,31781,31782,31784,31788,31793,31795,31796,31798,31801,31802,31814,31818,31829,31825,31826,31827,31833,31834,31835,31836,31837,31838,31841,31843,31847,31849,31853,31854,31856,31858,31865,31868,31869,31878,31879,31887,31892,31902,31904,31910,31920,31926,31927,31930,31931,31932,31935,31940,31943,31944,31945,31949,31951,31955,31956,31957,31959,31961,31962,31965,31974,31977,31979,31989,32003,32007,32008,32009,32015,32017,32018,32019,32022,32029,32030,32035,32038,32042,32045,32049,32060,32061,32062,32064,32065,32071,32072,32077,32081,32083,32087,32089,32090,32092,32093,32101,32103,32106,32112,32120,32122,32123,32127,32129,32130,32131,32133,32134,32136,32139,32140,32141,32145,32150,32151,32157,32158,32166,32167,32170,32179,32182,32183,32185,32194,32195,32196,32197,32198,32204,32205,32206,32215,32217,32256,32226,32229,32230,32234,32235,32237,32241,32245,32246,32249,32250,32264,32272,32273,32277,32279,32284,32285,32288,32295,32296,32300,32301,32303,32307,32310,32319,32324,32325,32327,32334,32336,32338,32344,32351,32353,32354,32357,32363,32366,32367,32371,32376,32382,32385,32390,32391,32394,32397,32401,32405,32408,32410,32413,32414,32572,32571,32573,32574,32575,32579,32580,32583,32591,32594,32595,32603,32604,32605,32609,32611,32612,32613,32614,32621,32625,32637,32638,32639,32640,32651,32653,32655,32656,32657,32662,32663,32668,32673,32674,32678,32682,32685,32692,32700,32703,32704,32707,32712,32718,32719,32731,32735,32739,32741,32744,32748,32750,32751,32754,32762,32765,32766,32767,32775,32776,32778,32781,32782,32783,32785,32787,32788,32790,32797,32798,32799,32800,32804,32806,32812,32814,32816,32820,32821,32823,32825,32826,32828,32830,32832,32836,32864,32868,32870,32877,32881,32885,32897,32904,32910,32924,32926,32934,32935,32939,32952,32953,32968,32973,32975,32978,32980,32981,32983,32984,32992,33005,33006,33008,33010,33011,33014,33017,33018,33022,33027,33035,33046,33047,33048,33052,33054,33056,33060,33063,33068,33072,33077,33082,33084,33093,33095,33098,33100,33106,33111,33120,33121,33127,33128,33129,33133,33135,33143,33153,33168,33156,33157,33158,33163,33166,33174,33176,33179,33182,33186,33198,33202,33204,33211,33227,33219,33221,33226,33230,33231,33237,33239,33243,33245,33246,33249,33252,33259,33260,33264,33265,33266,33269,33270,33272,33273,33277,33279,33280,33283,33295,33299,33300,33305,33306,33309,33313,33314,33320,33330,33332,33338,33347,33348,33349,33350,33355,33358,33359,33361,33366,33372,33376,33379,33383,33389,33396,33403,33405,33407,33408,33409,33411,33412,33415,33417,33418,33422,33425,33428,33430,33432,33434,33435,33440,33441,33443,33444,33447,33448,33449,33450,33454,33456,33458,33460,33463,33466,33468,33470,33471,33478,33488,33493,33498,33504,33506,33508,33512,33514,33517,33519,33526,33527,33533,33534,33536,33537,33543,33544,33546,33547,33620,33563,33565,33566,33567,33569,33570,33580,33581,33582,33584,33587,33591,33594,33596,33597,33602,33603,33604,33607,33613,33614,33617,33621,33622,33623,33648,33656,33661,33663,33664,33666,33668,33670,33677,33682,33684,33685,33688,33689,33691,33692,33693,33702,33703,33705,33708,33726,33727,33728,33735,33737,33743,33744,33745,33748,33757,33619,33768,33770,33782,33784,33785,33788,33793,33798,33802,33807,33809,33813,33817,33709,33839,33849,33861,33863,33864,33866,33869,33871,33873,33874,33878,33880,33881,33882,33884,33888,33892,33893,33895,33898,33904,33907,33908,33910,33912,33916,33917,33921,33925,33938,33939,33941,33950,33958,33960,33961,33962,33967,33969,33972,33978,33981,33982,33984,33986,33991,33992,33996,33999,34003,34012,34023,34026,34031,34032,34033,34034,34039,34098,34042,34043,34045,34050,34051,34055,34060,34062,34064,34076,34078,34082,34083,34084,34085,34087,34090,34091,34095,34099,34100,34102,34111,34118,34127,34128,34129,34130,34131,34134,34137,34140,34141,34142,34143,34144,34145,34146,34148,34155,34159,34169,34170,34171,34173,34175,34177,34181,34182,34185,34187,34188,34191,34195,34200,34205,34207,34208,34210,34213,34215,34228,34230,34231,34232,34236,34237,34238,34239,34242,34247,34250,34251,34254,34221,34264,34266,34271,34272,34278,34280,34285,34291,34294,34300,34303,34304,34308,34309,34317,34318,34320,34321,34322,34328,34329,34331,34334,34337,34343,34345,34358,34360,34362,34364,34365,34368,34370,34374,34386,34387,34390,34391,34392,34393,34397,34400,34401,34402,34403,34404,34409,34412,34415,34421,34422,34423,34426,34445,34449,34454,34456,34458,34460,34465,34470,34471,34472,34477,34481,34483,34484,34485,34487,34488,34489,34495,34496,34497,34499,34501,34513,34514,34517,34519,34522,34524,34528,34531,34533,34535,34440,34554,34556,34557,34564,34565,34567,34571,34574,34575,34576,34579,34580,34585,34590,34591,34593,34595,34600,34606,34607,34609,34610,34617,34618,34620,34621,34622,34624,34627,34629,34637,34648,34653,34657,34660,34661,34671,34673,34674,34683,34691,34692,34693,34694,34695,34696,34697,34699,34700,34704,34707,34709,34711,34712,34713,34718,34720,34723,34727,34732,34733,34734,34737,34741,34750,34751,34753,34760,34761,34762,34766,34773,34774,34777,34778,34780,34783,34786,34787,34788,34794,34795,34797,34801,34803,34808,34810,34815,34817,34819,34822,34825,34826,34827,34832,34841,34834,34835,34836,34840,34842,34843,34844,34846,34847,34856,34861,34862,34864,34866,34869,34874,34876,34881,34883,34885,34888,34889,34890,34891,34894,34897,34901,34902,34904,34906,34908,34911,34912,34916,34921,34929,34937,34939,34944,34968,34970,34971,34972,34975,34976,34984,34986,35002,35005,35006,35008,35018,35019,35020,35021,35022,35025,35026,35027,35035,35038,35047,35055,35056,35057,35061,35063,35073,35078,35085,35086,35087,35093,35094,35096,35097,35098,35100,35104,35110,35111,35112,35120,35121,35122,35125,35129,35130,35134,35136,35138,35141,35142,35145,35151,35154,35159,35162,35163,35164,35169,35170,35171,35179,35182,35184,35187,35189,35194,35195,35196,35197,35209,35213,35216,35220,35221,35227,35228,35231,35232,35237,35248,35252,35253,35254,35255,35260,35284,35285,35286,35287,35288,35301,35305,35307,35309,35313,35315,35318,35321,35325,35327,35332,35333,35335,35343,35345,35346,35348,35349,35358,35360,35362,35364,35366,35371,35372,35375,35381,35383,35389,35390,35392,35395,35397,35399,35401,35405,35406,35411,35414,35415,35416,35420,35421,35425,35429,35431,35445,35446,35447,35449,35450,35451,35454,35455,35456,35459,35462,35467,35471,35472,35474,35478,35479,35481,35487,35495,35497,35502,35503,35507,35510,35511,35515,35518,35523,35526,35528,35529,35530,35537,35539,35540,35541,35543,35549,35551,35564,35568,35572,35573,35574,35580,35583,35589,35590,35595,35601,35612,35614,35615,35594,35629,35632,35639,35644,35650,35651,35652,35653,35654,35656,35666,35667,35668,35673,35661,35678,35683,35693,35702,35704,35705,35708,35710,35713,35716,35717,35723,35725,35727,35732,35733,35740,35742,35743,35896,35897,35901,35902,35909,35911,35913,35915,35919,35921,35923,35924,35927,35928,35931,35933,35929,35939,35940,35942,35944,35945,35949,35955,35957,35958,35963,35966,35974,35975,35979,35984,35986,35987,35993,35995,35996,36004,36025,36026,36037,36038,36041,36043,36047,36054,36053,36057,36061,36065,36072,36076,36079,36080,36082,36085,36087,36088,36094,36095,36097,36099,36105,36114,36119,36123,36197,36201,36204,36206,36223,36226,36228,36232,36237,36240,36241,36245,36254,36255,36256,36262,36267,36268,36271,36274,36277,36279,36281,36283,36288,36293,36294,36295,36296,36298,36302,36305,36308,36309,36311,36313,36324,36325,36327,36332,36336,36284,36337,36338,36340,36349,36353,36356,36357,36358,36363,36369,36372,36374,36384,36385,36386,36387,36390,36391,36401,36403,36406,36407,36408,36409,36413,36416,36417,36427,36429,36430,36431,36436,36443,36444,36445,36446,36449,36450,36457,36460,36461,36463,36464,36465,36473,36474,36475,36482,36483,36489,36496,36498,36501,36506,36507,36509,36510,36514,36519,36521,36525,36526,36531,36533,36538,36539,36544,36545,36547,36548,36551,36559,36561,36564,36572,36584,36590,36592,36593,36599,36601,36602,36589,36608,36610,36615,36616,36623,36624,36630,36631,36632,36638,36640,36641,36643,36645,36647,36648,36652,36653,36654,36660,36661,36662,36663,36666,36672,36673,36675,36679,36687,36689,36690,36691,36692,36693,36696,36701,36702,36709,36765,36768,36769,36772,36773,36774,36789,36790,36792,36798,36800,36801,36806,36810,36811,36813,36816,36818,36819,36821,36832,36835,36836,36840,36846,36849,36853,36854,36859,36862,36866,36868,36872,36876,36888,36891,36904,36905,36911,36906,36908,36909,36915,36916,36919,36927,36931,36932,36940,36955,36957,36962,36966,36967,36972,36976,36980,36985,36997,37000,37003,37004,37006,37008,37013,37015,37016,37017,37019,37024,37025,37026,37029,37040,37042,37043,37044,37046,37053,37068,37054,37059,37060,37061,37063,37064,37077,37079,37080,37081,37084,37085,37087,37093,37074,37110,37099,37103,37104,37108,37118,37119,37120,37124,37125,37126,37128,37133,37136,37140,37142,37143,37144,37146,37148,37150,37152,37157,37154,37155,37159,37161,37166,37167,37169,37172,37174,37175,37177,37178,37180,37181,37187,37191,37192,37199,37203,37207,37209,37210,37211,37217,37220,37223,37229,37236,37241,37242,37243,37249,37251,37253,37254,37258,37262,37265,37267,37268,37269,37272,37278,37281,37286,37288,37292,37293,37294,37296,37297,37298,37299,37302,37307,37308,37309,37311,37314,37315,37317,37331,37332,37335,37337,37338,37342,37348,37349,37353,37354,37356,37357,37358,37359,37360,37361,37367,37369,37371,37373,37376,37377,37380,37381,37382,37383,37385,37386,37388,37392,37394,37395,37398,37400,37404,37405,37411,37412,37413,37414,37416,37422,37423,37424,37427,37429,37430,37432,37433,37434,37436,37438,37440,37442,37443,37446,37447,37450,37453,37454,37455,37457,37464,37465,37468,37469,37472,37473,37477,37479,37480,37481,37486,37487,37488,37493,37494,37495,37496,37497,37499,37500,37501,37503,37512,37513,37514,37517,37518,37522,37527,37529,37535,37536,37540,37541,37543,37544,37547,37551,37554,37558,37560,37562,37563,37564,37565,37567,37568,37569,37570,37571,37573,37574,37575,37576,37579,37580,37581,37582,37584,37587,37589,37591,37592,37593,37596,37597,37599,37600,37601,37603,37605,37607,37608,37612,37614,37616,37625,37627,37631,37632,37634,37640,37645,37649,37652,37653,37660,37661,37662,37663,37665,37668,37669,37671,37673,37674,37683,37684,37686,37687,37703,37704,37705,37712,37713,37714,37717,37719,37720,37722,37726,37732,37733,37735,37737,37738,37741,37743,37744,37745,37747,37748,37750,37754,37757,37759,37760,37761,37762,37768,37770,37771,37773,37775,37778,37781,37784,37787,37790,37793,37795,37796,37798,37800,37803,37812,37813,37814,37818,37801,37825,37828,37829,37830,37831,37833,37834,37835,37836,37837,37843,37849,37852,37854,37855,37858,37862,37863,37881,37879,37880,37882,37883,37885,37889,37890,37892,37896,37897,37901,37902,37903,37909,37910,37911,37919,37934,37935,37937,37938,37939,37940,37947,37951,37949,37955,37957,37960,37962,37964,37973,37977,37980,37983,37985,37987,37992,37995,37997,37998,37999,38001,38002,38020,38019,38264,38265,38270,38276,38280,38284,38285,38286,38301,38302,38303,38305,38310,38313,38315,38316,38324,38326,38330,38333,38335,38342,38344,38345,38347,38352,38353,38354,38355,38361,38362,38365,38366,38367,38368,38372,38374,38429,38430,38434,38436,38437,38438,38444,38449,38451,38455,38456,38457,38458,38460,38461,38465,38482,38484,38486,38487,38488,38497,38510,38516,38523,38524,38526,38527,38529,38530,38531,38532,38537,38545,38550,38554,38557,38559,38564,38565,38566,38569,38574,38575,38579,38586,38602,38610,23986,38616,38618,38621,38622,38623,38633,38639,38641,38650,38658,38659,38661,38665,38682,38683,38685,38689,38690,38691,38696,38705,38707,38721,38723,38730,38734,38735,38741,38743,38744,38746,38747,38755,38759,38762,38766,38771,38774,38775,38776,38779,38781,38783,38784,38793,38805,38806,38807,38809,38810,38814,38815,38818,38828,38830,38833,38834,38837,38838,38840,38841,38842,38844,38846,38847,38849,38852,38853,38855,38857,38858,38860,38861,38862,38864,38865,38868,38871,38872,38873,38877,38878,38880,38875,38881,38884,38895,38897,38900,38903,38904,38906,38919,38922,38937,38925,38926,38932,38934,38940,38942,38944,38947,38950,38955,38958,38959,38960,38962,38963,38965,38949,38974,38980,38983,38986,38993,38994,38995,38998,38999,39001,39002,39010,39011,39013,39014,39018,39020,39083,39085,39086,39088,39092,39095,39096,39098,39099,39103,39106,39109,39112,39116,39137,39139,39141,39142,39143,39146,39155,39158,39170,39175,39176,39185,39189,39190,39191,39194,39195,39196,39199,39202,39206,39207,39211,39217,39218,39219,39220,39221,39225,39226,39227,39228,39232,39233,39238,39239,39240,39245,39246,39252,39256,39257,39259,39260,39262,39263,39264,39323,39325,39327,39334,39344,39345,39346,39349,39353,39354,39357,39359,39363,39369,39379,39380,39385,39386,39388,39390,39399,39402,39403,39404,39408,39412,39413,39417,39421,39422,39426,39427,39428,39435,39436,39440,39441,39446,39454,39456,39458,39459,39460,39463,39469,39470,39475,39477,39478,39480,39495,39489,39492,39498,39499,39500,39502,39505,39508,39510,39517,39594,39596,39598,39599,39602,39604,39605,39606,39609,39611,39614,39615,39617,39619,39622,39624,39630,39632,39634,39637,39638,39639,39643,39644,39648,39652,39653,39655,39657,39660,39666,39667,39669,39673,39674,39677,39679,39680,39681,39682,39683,39684,39685,39688,39689,39691,39692,39693,39694,39696,39698,39702,39705,39707,39708,39712,39718,39723,39725,39731,39732,39733,39735,39737,39738,39741,39752,39755,39756,39765,39766,39767,39771,39774,39777,39779,39781,39782,39784,39786,39787,39788,39789,39790,39795,39797,39799,39800,39801,39807,39808,39812,39813,39814,39815,39817,39818,39819,39821,39823,39824,39828,39834,39837,39838,39846,39847,39849,39852,39856,39857,39858,39863,39864,39867,39868,39870,39871,39873,39879,39880,39886,39888,39895,39896,39901,39903,39909,39911,39914,39915,39919,39923,39927,39928,39929,39930,39933,39935,39936,39938,39947,39951,39953,39958,39960,39961,39962,39964,39966,39970,39971,39974,39975,39976,39977,39978,39985,39989,39990,39991,39997,40001,40003,40004,40005,40009,40010,40014,40015,40016,40019,40020,40022,40024,40027,40029,40030,40031,40035,40041,40042,40028,40043,40040,40046,40048,40050,40053,40055,40059,40166,40178,40183,40185,40203,40194,40209,40215,40216,40220,40221,40222,40239,40240,40242,40243,40244,40250,40252,40261,40253,40258,40259,40263,40266,40275,40276,40287,40291,40290,40293,40297,40298,40299,40304,40310,40311,40315,40316,40318,40323,40324,40326,40330,40333,40334,40338,40339,40341,40342,40343,40344,40353,40362,40364,40366,40369,40373,40377,40380,40383,40387,40391,40393,40394,40404,40405,40406,40407,40410,40414,40415,40416,40421,40423,40425,40427,40430,40432,40435,40436,40446,40458,40450,40455,40462,40464,40465,40466,40469,40470,40473,40476,40477,40570,40571,40572,40576,40578,40579,40580,40581,40583,40590,40591,40598,40600,40603,40606,40612,40616,40620,40622,40623,40624,40627,40628,40629,40646,40648,40651,40661,40671,40676,40679,40684,40685,40686,40688,40689,40690,40693,40696,40703,40706,40707,40713,40719,40720,40721,40722,40724,40726,40727,40729,40730,40731,40735,40738,40742,40746,40747,40751,40753,40754,40756,40759,40761,40762,40764,40765,40767,40769,40771,40772,40773,40774,40775,40787,40789,40790,40791,40792,40794,40797,40798,40808,40809,40813,40814,40815,40816,40817,40819,40821,40826,40829,40847,40848,40849,40850,40852,40854,40855,40862,40865,40866,40867,40869,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\n \"ibm866\":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],\n \"iso-8859-2\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],\n \"iso-8859-3\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],\n \"iso-8859-4\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],\n \"iso-8859-5\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],\n \"iso-8859-6\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],\n \"iso-8859-7\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],\n \"iso-8859-8\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],\n \"iso-8859-10\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],\n \"iso-8859-13\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],\n \"iso-8859-14\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],\n \"iso-8859-15\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],\n \"iso-8859-16\":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],\n \"koi8-r\":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],\n \"koi8-u\":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],\n \"macintosh\":[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],\n \"windows-874\":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],\n \"windows-1250\":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],\n \"windows-1251\":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],\n \"windows-1252\":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],\n \"windows-1253\":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],\n \"windows-1254\":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],\n \"windows-1255\":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],\n \"windows-1256\":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],\n \"windows-1257\":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],\n \"windows-1258\":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],\n \"x-mac-cyrillic\":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]\n};\n\n// For strict environments where `this` inside the global scope\n// is `undefined`, take a pure object instead\n}(this || {}));\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/text-encoding/lib/encoding-indexes.js?"); +/** + * Delete Scheduled Transaction + */ +RequestType_RequestType.ScheduleDelete = new RequestType_RequestType(71); -/***/ }), +/** + * Sign Scheduled Transaction + */ +RequestType_RequestType.ScheduleSign = new RequestType_RequestType(72); -/***/ "./node_modules/text-encoding/lib/encoding.js": -/*!****************************************************!*\ - !*** ./node_modules/text-encoding/lib/encoding.js ***! - \****************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * Get Scheduled Transaction Information + */ +RequestType_RequestType.ScheduleGetInfo = new RequestType_RequestType(73); -eval("// This is free and unencumbered software released into the public domain.\n// See LICENSE.md for more information.\n\n/**\n * @fileoverview Global |this| required for resolving indexes in node.\n * @suppress {globalThis}\n */\n(function(global) {\n 'use strict';\n\n // If we're in node require encoding-indexes and attach it to the global.\n if ( true && module.exports &&\n !global[\"encoding-indexes\"]) {\n global[\"encoding-indexes\"] =\n (__webpack_require__(/*! ./encoding-indexes.js */ \"./node_modules/text-encoding/lib/encoding-indexes.js\")[\"encoding-indexes\"]);\n }\n\n //\n // Utilities\n //\n\n /**\n * @param {number} a The number to test.\n * @param {number} min The minimum value in the range, inclusive.\n * @param {number} max The maximum value in the range, inclusive.\n * @return {boolean} True if a >= min and a <= max.\n */\n function inRange(a, min, max) {\n return min <= a && a <= max;\n }\n\n /**\n * @param {!Array.<*>} array The array to check.\n * @param {*} item The item to look for in the array.\n * @return {boolean} True if the item appears in the array.\n */\n function includes(array, item) {\n return array.indexOf(item) !== -1;\n }\n\n var floor = Math.floor;\n\n /**\n * @param {*} o\n * @return {Object}\n */\n function ToDictionary(o) {\n if (o === undefined) return {};\n if (o === Object(o)) return o;\n throw TypeError('Could not convert argument to dictionary');\n }\n\n /**\n * @param {string} string Input string of UTF-16 code units.\n * @return {!Array.} Code points.\n */\n function stringToCodePoints(string) {\n // https://heycam.github.io/webidl/#dfn-obtain-unicode\n\n // 1. Let S be the DOMString value.\n var s = String(string);\n\n // 2. Let n be the length of S.\n var n = s.length;\n\n // 3. Initialize i to 0.\n var i = 0;\n\n // 4. Initialize U to be an empty sequence of Unicode characters.\n var u = [];\n\n // 5. While i < n:\n while (i < n) {\n\n // 1. Let c be the code unit in S at index i.\n var c = s.charCodeAt(i);\n\n // 2. Depending on the value of c:\n\n // c < 0xD800 or c > 0xDFFF\n if (c < 0xD800 || c > 0xDFFF) {\n // Append to U the Unicode character with code point c.\n u.push(c);\n }\n\n // 0xDC00 ≤ c ≤ 0xDFFF\n else if (0xDC00 <= c && c <= 0xDFFF) {\n // Append to U a U+FFFD REPLACEMENT CHARACTER.\n u.push(0xFFFD);\n }\n\n // 0xD800 ≤ c ≤ 0xDBFF\n else if (0xD800 <= c && c <= 0xDBFF) {\n // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT\n // CHARACTER.\n if (i === n - 1) {\n u.push(0xFFFD);\n }\n // 2. Otherwise, i < n−1:\n else {\n // 1. Let d be the code unit in S at index i+1.\n var d = s.charCodeAt(i + 1);\n\n // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:\n if (0xDC00 <= d && d <= 0xDFFF) {\n // 1. Let a be c & 0x3FF.\n var a = c & 0x3FF;\n\n // 2. Let b be d & 0x3FF.\n var b = d & 0x3FF;\n\n // 3. Append to U the Unicode character with code point\n // 2^16+2^10*a+b.\n u.push(0x10000 + (a << 10) + b);\n\n // 4. Set i to i+1.\n i += 1;\n }\n\n // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a\n // U+FFFD REPLACEMENT CHARACTER.\n else {\n u.push(0xFFFD);\n }\n }\n }\n\n // 3. Set i to i+1.\n i += 1;\n }\n\n // 6. Return U.\n return u;\n }\n\n /**\n * @param {!Array.} code_points Array of code points.\n * @return {string} string String of UTF-16 code units.\n */\n function codePointsToString(code_points) {\n var s = '';\n for (var i = 0; i < code_points.length; ++i) {\n var cp = code_points[i];\n if (cp <= 0xFFFF) {\n s += String.fromCharCode(cp);\n } else {\n cp -= 0x10000;\n s += String.fromCharCode((cp >> 10) + 0xD800,\n (cp & 0x3FF) + 0xDC00);\n }\n }\n return s;\n }\n\n\n //\n // Implementation of Encoding specification\n // https://encoding.spec.whatwg.org/\n //\n\n //\n // 4. Terminology\n //\n\n /**\n * An ASCII byte is a byte in the range 0x00 to 0x7F, inclusive.\n * @param {number} a The number to test.\n * @return {boolean} True if a is in the range 0x00 to 0x7F, inclusive.\n */\n function isASCIIByte(a) {\n return 0x00 <= a && a <= 0x7F;\n }\n\n /**\n * An ASCII code point is a code point in the range U+0000 to\n * U+007F, inclusive.\n */\n var isASCIICodePoint = isASCIIByte;\n\n\n /**\n * End-of-stream is a special token that signifies no more tokens\n * are in the stream.\n * @const\n */ var end_of_stream = -1;\n\n /**\n * A stream represents an ordered sequence of tokens.\n *\n * @constructor\n * @param {!(Array.|Uint8Array)} tokens Array of tokens that provide\n * the stream.\n */\n function Stream(tokens) {\n /** @type {!Array.} */\n this.tokens = [].slice.call(tokens);\n // Reversed as push/pop is more efficient than shift/unshift.\n this.tokens.reverse();\n }\n\n Stream.prototype = {\n /**\n * @return {boolean} True if end-of-stream has been hit.\n */\n endOfStream: function() {\n return !this.tokens.length;\n },\n\n /**\n * When a token is read from a stream, the first token in the\n * stream must be returned and subsequently removed, and\n * end-of-stream must be returned otherwise.\n *\n * @return {number} Get the next token from the stream, or\n * end_of_stream.\n */\n read: function() {\n if (!this.tokens.length)\n return end_of_stream;\n return this.tokens.pop();\n },\n\n /**\n * When one or more tokens are prepended to a stream, those tokens\n * must be inserted, in given order, before the first token in the\n * stream.\n *\n * @param {(number|!Array.)} token The token(s) to prepend to the\n * stream.\n */\n prepend: function(token) {\n if (Array.isArray(token)) {\n var tokens = /**@type {!Array.}*/(token);\n while (tokens.length)\n this.tokens.push(tokens.pop());\n } else {\n this.tokens.push(token);\n }\n },\n\n /**\n * When one or more tokens are pushed to a stream, those tokens\n * must be inserted, in given order, after the last token in the\n * stream.\n *\n * @param {(number|!Array.)} token The tokens(s) to push to the\n * stream.\n */\n push: function(token) {\n if (Array.isArray(token)) {\n var tokens = /**@type {!Array.}*/(token);\n while (tokens.length)\n this.tokens.unshift(tokens.shift());\n } else {\n this.tokens.unshift(token);\n }\n }\n };\n\n //\n // 5. Encodings\n //\n\n // 5.1 Encoders and decoders\n\n /** @const */\n var finished = -1;\n\n /**\n * @param {boolean} fatal If true, decoding errors raise an exception.\n * @param {number=} opt_code_point Override the standard fallback code point.\n * @return {number} The code point to insert on a decoding error.\n */\n function decoderError(fatal, opt_code_point) {\n if (fatal)\n throw TypeError('Decoder error');\n return opt_code_point || 0xFFFD;\n }\n\n /**\n * @param {number} code_point The code point that could not be encoded.\n * @return {number} Always throws, no value is actually returned.\n */\n function encoderError(code_point) {\n throw TypeError('The code point ' + code_point + ' could not be encoded.');\n }\n\n /** @interface */\n function Decoder() {}\n Decoder.prototype = {\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point, or |finished|.\n */\n handler: function(stream, bite) {}\n };\n\n /** @interface */\n function Encoder() {}\n Encoder.prototype = {\n /**\n * @param {Stream} stream The stream of code points being encoded.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit, or |finished|.\n */\n handler: function(stream, code_point) {}\n };\n\n // 5.2 Names and labels\n\n // TODO: Define @typedef for Encoding: {name:string,labels:Array.}\n // https://github.com/google/closure-compiler/issues/247\n\n /**\n * @param {string} label The encoding label.\n * @return {?{name:string,labels:Array.}}\n */\n function getEncoding(label) {\n // 1. Remove any leading and trailing ASCII whitespace from label.\n label = String(label).trim().toLowerCase();\n\n // 2. If label is an ASCII case-insensitive match for any of the\n // labels listed in the table below, return the corresponding\n // encoding, and failure otherwise.\n if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) {\n return label_to_encoding[label];\n }\n return null;\n }\n\n /**\n * Encodings table: https://encoding.spec.whatwg.org/encodings.json\n * @const\n * @type {!Array.<{\n * heading: string,\n * encodings: Array.<{name:string,labels:Array.}>\n * }>}\n */\n var encodings = [\n {\n \"encodings\": [\n {\n \"labels\": [\n \"unicode-1-1-utf-8\",\n \"utf-8\",\n \"utf8\"\n ],\n \"name\": \"UTF-8\"\n }\n ],\n \"heading\": \"The Encoding\"\n },\n {\n \"encodings\": [\n {\n \"labels\": [\n \"866\",\n \"cp866\",\n \"csibm866\",\n \"ibm866\"\n ],\n \"name\": \"IBM866\"\n },\n {\n \"labels\": [\n \"csisolatin2\",\n \"iso-8859-2\",\n \"iso-ir-101\",\n \"iso8859-2\",\n \"iso88592\",\n \"iso_8859-2\",\n \"iso_8859-2:1987\",\n \"l2\",\n \"latin2\"\n ],\n \"name\": \"ISO-8859-2\"\n },\n {\n \"labels\": [\n \"csisolatin3\",\n \"iso-8859-3\",\n \"iso-ir-109\",\n \"iso8859-3\",\n \"iso88593\",\n \"iso_8859-3\",\n \"iso_8859-3:1988\",\n \"l3\",\n \"latin3\"\n ],\n \"name\": \"ISO-8859-3\"\n },\n {\n \"labels\": [\n \"csisolatin4\",\n \"iso-8859-4\",\n \"iso-ir-110\",\n \"iso8859-4\",\n \"iso88594\",\n \"iso_8859-4\",\n \"iso_8859-4:1988\",\n \"l4\",\n \"latin4\"\n ],\n \"name\": \"ISO-8859-4\"\n },\n {\n \"labels\": [\n \"csisolatincyrillic\",\n \"cyrillic\",\n \"iso-8859-5\",\n \"iso-ir-144\",\n \"iso8859-5\",\n \"iso88595\",\n \"iso_8859-5\",\n \"iso_8859-5:1988\"\n ],\n \"name\": \"ISO-8859-5\"\n },\n {\n \"labels\": [\n \"arabic\",\n \"asmo-708\",\n \"csiso88596e\",\n \"csiso88596i\",\n \"csisolatinarabic\",\n \"ecma-114\",\n \"iso-8859-6\",\n \"iso-8859-6-e\",\n \"iso-8859-6-i\",\n \"iso-ir-127\",\n \"iso8859-6\",\n \"iso88596\",\n \"iso_8859-6\",\n \"iso_8859-6:1987\"\n ],\n \"name\": \"ISO-8859-6\"\n },\n {\n \"labels\": [\n \"csisolatingreek\",\n \"ecma-118\",\n \"elot_928\",\n \"greek\",\n \"greek8\",\n \"iso-8859-7\",\n \"iso-ir-126\",\n \"iso8859-7\",\n \"iso88597\",\n \"iso_8859-7\",\n \"iso_8859-7:1987\",\n \"sun_eu_greek\"\n ],\n \"name\": \"ISO-8859-7\"\n },\n {\n \"labels\": [\n \"csiso88598e\",\n \"csisolatinhebrew\",\n \"hebrew\",\n \"iso-8859-8\",\n \"iso-8859-8-e\",\n \"iso-ir-138\",\n \"iso8859-8\",\n \"iso88598\",\n \"iso_8859-8\",\n \"iso_8859-8:1988\",\n \"visual\"\n ],\n \"name\": \"ISO-8859-8\"\n },\n {\n \"labels\": [\n \"csiso88598i\",\n \"iso-8859-8-i\",\n \"logical\"\n ],\n \"name\": \"ISO-8859-8-I\"\n },\n {\n \"labels\": [\n \"csisolatin6\",\n \"iso-8859-10\",\n \"iso-ir-157\",\n \"iso8859-10\",\n \"iso885910\",\n \"l6\",\n \"latin6\"\n ],\n \"name\": \"ISO-8859-10\"\n },\n {\n \"labels\": [\n \"iso-8859-13\",\n \"iso8859-13\",\n \"iso885913\"\n ],\n \"name\": \"ISO-8859-13\"\n },\n {\n \"labels\": [\n \"iso-8859-14\",\n \"iso8859-14\",\n \"iso885914\"\n ],\n \"name\": \"ISO-8859-14\"\n },\n {\n \"labels\": [\n \"csisolatin9\",\n \"iso-8859-15\",\n \"iso8859-15\",\n \"iso885915\",\n \"iso_8859-15\",\n \"l9\"\n ],\n \"name\": \"ISO-8859-15\"\n },\n {\n \"labels\": [\n \"iso-8859-16\"\n ],\n \"name\": \"ISO-8859-16\"\n },\n {\n \"labels\": [\n \"cskoi8r\",\n \"koi\",\n \"koi8\",\n \"koi8-r\",\n \"koi8_r\"\n ],\n \"name\": \"KOI8-R\"\n },\n {\n \"labels\": [\n \"koi8-ru\",\n \"koi8-u\"\n ],\n \"name\": \"KOI8-U\"\n },\n {\n \"labels\": [\n \"csmacintosh\",\n \"mac\",\n \"macintosh\",\n \"x-mac-roman\"\n ],\n \"name\": \"macintosh\"\n },\n {\n \"labels\": [\n \"dos-874\",\n \"iso-8859-11\",\n \"iso8859-11\",\n \"iso885911\",\n \"tis-620\",\n \"windows-874\"\n ],\n \"name\": \"windows-874\"\n },\n {\n \"labels\": [\n \"cp1250\",\n \"windows-1250\",\n \"x-cp1250\"\n ],\n \"name\": \"windows-1250\"\n },\n {\n \"labels\": [\n \"cp1251\",\n \"windows-1251\",\n \"x-cp1251\"\n ],\n \"name\": \"windows-1251\"\n },\n {\n \"labels\": [\n \"ansi_x3.4-1968\",\n \"ascii\",\n \"cp1252\",\n \"cp819\",\n \"csisolatin1\",\n \"ibm819\",\n \"iso-8859-1\",\n \"iso-ir-100\",\n \"iso8859-1\",\n \"iso88591\",\n \"iso_8859-1\",\n \"iso_8859-1:1987\",\n \"l1\",\n \"latin1\",\n \"us-ascii\",\n \"windows-1252\",\n \"x-cp1252\"\n ],\n \"name\": \"windows-1252\"\n },\n {\n \"labels\": [\n \"cp1253\",\n \"windows-1253\",\n \"x-cp1253\"\n ],\n \"name\": \"windows-1253\"\n },\n {\n \"labels\": [\n \"cp1254\",\n \"csisolatin5\",\n \"iso-8859-9\",\n \"iso-ir-148\",\n \"iso8859-9\",\n \"iso88599\",\n \"iso_8859-9\",\n \"iso_8859-9:1989\",\n \"l5\",\n \"latin5\",\n \"windows-1254\",\n \"x-cp1254\"\n ],\n \"name\": \"windows-1254\"\n },\n {\n \"labels\": [\n \"cp1255\",\n \"windows-1255\",\n \"x-cp1255\"\n ],\n \"name\": \"windows-1255\"\n },\n {\n \"labels\": [\n \"cp1256\",\n \"windows-1256\",\n \"x-cp1256\"\n ],\n \"name\": \"windows-1256\"\n },\n {\n \"labels\": [\n \"cp1257\",\n \"windows-1257\",\n \"x-cp1257\"\n ],\n \"name\": \"windows-1257\"\n },\n {\n \"labels\": [\n \"cp1258\",\n \"windows-1258\",\n \"x-cp1258\"\n ],\n \"name\": \"windows-1258\"\n },\n {\n \"labels\": [\n \"x-mac-cyrillic\",\n \"x-mac-ukrainian\"\n ],\n \"name\": \"x-mac-cyrillic\"\n }\n ],\n \"heading\": \"Legacy single-byte encodings\"\n },\n {\n \"encodings\": [\n {\n \"labels\": [\n \"chinese\",\n \"csgb2312\",\n \"csiso58gb231280\",\n \"gb2312\",\n \"gb_2312\",\n \"gb_2312-80\",\n \"gbk\",\n \"iso-ir-58\",\n \"x-gbk\"\n ],\n \"name\": \"GBK\"\n },\n {\n \"labels\": [\n \"gb18030\"\n ],\n \"name\": \"gb18030\"\n }\n ],\n \"heading\": \"Legacy multi-byte Chinese (simplified) encodings\"\n },\n {\n \"encodings\": [\n {\n \"labels\": [\n \"big5\",\n \"big5-hkscs\",\n \"cn-big5\",\n \"csbig5\",\n \"x-x-big5\"\n ],\n \"name\": \"Big5\"\n }\n ],\n \"heading\": \"Legacy multi-byte Chinese (traditional) encodings\"\n },\n {\n \"encodings\": [\n {\n \"labels\": [\n \"cseucpkdfmtjapanese\",\n \"euc-jp\",\n \"x-euc-jp\"\n ],\n \"name\": \"EUC-JP\"\n },\n {\n \"labels\": [\n \"csiso2022jp\",\n \"iso-2022-jp\"\n ],\n \"name\": \"ISO-2022-JP\"\n },\n {\n \"labels\": [\n \"csshiftjis\",\n \"ms932\",\n \"ms_kanji\",\n \"shift-jis\",\n \"shift_jis\",\n \"sjis\",\n \"windows-31j\",\n \"x-sjis\"\n ],\n \"name\": \"Shift_JIS\"\n }\n ],\n \"heading\": \"Legacy multi-byte Japanese encodings\"\n },\n {\n \"encodings\": [\n {\n \"labels\": [\n \"cseuckr\",\n \"csksc56011987\",\n \"euc-kr\",\n \"iso-ir-149\",\n \"korean\",\n \"ks_c_5601-1987\",\n \"ks_c_5601-1989\",\n \"ksc5601\",\n \"ksc_5601\",\n \"windows-949\"\n ],\n \"name\": \"EUC-KR\"\n }\n ],\n \"heading\": \"Legacy multi-byte Korean encodings\"\n },\n {\n \"encodings\": [\n {\n \"labels\": [\n \"csiso2022kr\",\n \"hz-gb-2312\",\n \"iso-2022-cn\",\n \"iso-2022-cn-ext\",\n \"iso-2022-kr\"\n ],\n \"name\": \"replacement\"\n },\n {\n \"labels\": [\n \"utf-16be\"\n ],\n \"name\": \"UTF-16BE\"\n },\n {\n \"labels\": [\n \"utf-16\",\n \"utf-16le\"\n ],\n \"name\": \"UTF-16LE\"\n },\n {\n \"labels\": [\n \"x-user-defined\"\n ],\n \"name\": \"x-user-defined\"\n }\n ],\n \"heading\": \"Legacy miscellaneous encodings\"\n }\n ];\n\n // Label to encoding registry.\n /** @type {Object.}>} */\n var label_to_encoding = {};\n encodings.forEach(function(category) {\n category.encodings.forEach(function(encoding) {\n encoding.labels.forEach(function(label) {\n label_to_encoding[label] = encoding;\n });\n });\n });\n\n // Registry of of encoder/decoder factories, by encoding name.\n /** @type {Object.} */\n var encoders = {};\n /** @type {Object.} */\n var decoders = {};\n\n //\n // 6. Indexes\n //\n\n /**\n * @param {number} pointer The |pointer| to search for.\n * @param {(!Array.|undefined)} index The |index| to search within.\n * @return {?number} The code point corresponding to |pointer| in |index|,\n * or null if |code point| is not in |index|.\n */\n function indexCodePointFor(pointer, index) {\n if (!index) return null;\n return index[pointer] || null;\n }\n\n /**\n * @param {number} code_point The |code point| to search for.\n * @param {!Array.} index The |index| to search within.\n * @return {?number} The first pointer corresponding to |code point| in\n * |index|, or null if |code point| is not in |index|.\n */\n function indexPointerFor(code_point, index) {\n var pointer = index.indexOf(code_point);\n return pointer === -1 ? null : pointer;\n }\n\n /**\n * @param {string} name Name of the index.\n * @return {(!Array.|!Array.>)}\n * */\n function index(name) {\n if (!('encoding-indexes' in global)) {\n throw Error(\"Indexes missing.\" +\n \" Did you forget to include encoding-indexes.js first?\");\n }\n return global['encoding-indexes'][name];\n }\n\n /**\n * @param {number} pointer The |pointer| to search for in the gb18030 index.\n * @return {?number} The code point corresponding to |pointer| in |index|,\n * or null if |code point| is not in the gb18030 index.\n */\n function indexGB18030RangesCodePointFor(pointer) {\n // 1. If pointer is greater than 39419 and less than 189000, or\n // pointer is greater than 1237575, return null.\n if ((pointer > 39419 && pointer < 189000) || (pointer > 1237575))\n return null;\n\n // 2. If pointer is 7457, return code point U+E7C7.\n if (pointer === 7457) return 0xE7C7;\n\n // 3. Let offset be the last pointer in index gb18030 ranges that\n // is equal to or less than pointer and let code point offset be\n // its corresponding code point.\n var offset = 0;\n var code_point_offset = 0;\n var idx = index('gb18030-ranges');\n var i;\n for (i = 0; i < idx.length; ++i) {\n /** @type {!Array.} */\n var entry = idx[i];\n if (entry[0] <= pointer) {\n offset = entry[0];\n code_point_offset = entry[1];\n } else {\n break;\n }\n }\n\n // 4. Return a code point whose value is code point offset +\n // pointer − offset.\n return code_point_offset + pointer - offset;\n }\n\n /**\n * @param {number} code_point The |code point| to locate in the gb18030 index.\n * @return {number} The first pointer corresponding to |code point| in the\n * gb18030 index.\n */\n function indexGB18030RangesPointerFor(code_point) {\n // 1. If code point is U+E7C7, return pointer 7457.\n if (code_point === 0xE7C7) return 7457;\n\n // 2. Let offset be the last code point in index gb18030 ranges\n // that is equal to or less than code point and let pointer offset\n // be its corresponding pointer.\n var offset = 0;\n var pointer_offset = 0;\n var idx = index('gb18030-ranges');\n var i;\n for (i = 0; i < idx.length; ++i) {\n /** @type {!Array.} */\n var entry = idx[i];\n if (entry[1] <= code_point) {\n offset = entry[1];\n pointer_offset = entry[0];\n } else {\n break;\n }\n }\n\n // 3. Return a pointer whose value is pointer offset + code point\n // − offset.\n return pointer_offset + code_point - offset;\n }\n\n /**\n * @param {number} code_point The |code_point| to search for in the Shift_JIS\n * index.\n * @return {?number} The code point corresponding to |pointer| in |index|,\n * or null if |code point| is not in the Shift_JIS index.\n */\n function indexShiftJISPointerFor(code_point) {\n // 1. Let index be index jis0208 excluding all entries whose\n // pointer is in the range 8272 to 8835, inclusive.\n shift_jis_index = shift_jis_index ||\n index('jis0208').map(function(code_point, pointer) {\n return inRange(pointer, 8272, 8835) ? null : code_point;\n });\n var index_ = shift_jis_index;\n\n // 2. Return the index pointer for code point in index.\n return index_.indexOf(code_point);\n }\n var shift_jis_index;\n\n /**\n * @param {number} code_point The |code_point| to search for in the big5\n * index.\n * @return {?number} The code point corresponding to |pointer| in |index|,\n * or null if |code point| is not in the big5 index.\n */\n function indexBig5PointerFor(code_point) {\n // 1. Let index be index Big5 excluding all entries whose pointer\n big5_index_no_hkscs = big5_index_no_hkscs ||\n index('big5').map(function(code_point, pointer) {\n return (pointer < (0xA1 - 0x81) * 157) ? null : code_point;\n });\n var index_ = big5_index_no_hkscs;\n\n // 2. If code point is U+2550, U+255E, U+2561, U+256A, U+5341, or\n // U+5345, return the last pointer corresponding to code point in\n // index.\n if (code_point === 0x2550 || code_point === 0x255E ||\n code_point === 0x2561 || code_point === 0x256A ||\n code_point === 0x5341 || code_point === 0x5345) {\n return index_.lastIndexOf(code_point);\n }\n\n // 3. Return the index pointer for code point in index.\n return indexPointerFor(code_point, index_);\n }\n var big5_index_no_hkscs;\n\n //\n // 8. API\n //\n\n /** @const */ var DEFAULT_ENCODING = 'utf-8';\n\n // 8.1 Interface TextDecoder\n\n /**\n * @constructor\n * @param {string=} label The label of the encoding;\n * defaults to 'utf-8'.\n * @param {Object=} options\n */\n function TextDecoder(label, options) {\n // Web IDL conventions\n if (!(this instanceof TextDecoder))\n throw TypeError('Called as a function. Did you forget \\'new\\'?');\n label = label !== undefined ? String(label) : DEFAULT_ENCODING;\n options = ToDictionary(options);\n\n // A TextDecoder object has an associated encoding, decoder,\n // stream, ignore BOM flag (initially unset), BOM seen flag\n // (initially unset), error mode (initially replacement), and do\n // not flush flag (initially unset).\n\n /** @private */\n this._encoding = null;\n /** @private @type {?Decoder} */\n this._decoder = null;\n /** @private @type {boolean} */\n this._ignoreBOM = false;\n /** @private @type {boolean} */\n this._BOMseen = false;\n /** @private @type {string} */\n this._error_mode = 'replacement';\n /** @private @type {boolean} */\n this._do_not_flush = false;\n\n\n // 1. Let encoding be the result of getting an encoding from\n // label.\n var encoding = getEncoding(label);\n\n // 2. If encoding is failure or replacement, throw a RangeError.\n if (encoding === null || encoding.name === 'replacement')\n throw RangeError('Unknown encoding: ' + label);\n if (!decoders[encoding.name]) {\n throw Error('Decoder not present.' +\n ' Did you forget to include encoding-indexes.js first?');\n }\n\n // 3. Let dec be a new TextDecoder object.\n var dec = this;\n\n // 4. Set dec's encoding to encoding.\n dec._encoding = encoding;\n\n // 5. If options's fatal member is true, set dec's error mode to\n // fatal.\n if (Boolean(options['fatal']))\n dec._error_mode = 'fatal';\n\n // 6. If options's ignoreBOM member is true, set dec's ignore BOM\n // flag.\n if (Boolean(options['ignoreBOM']))\n dec._ignoreBOM = true;\n\n // For pre-ES5 runtimes:\n if (!Object.defineProperty) {\n this.encoding = dec._encoding.name.toLowerCase();\n this.fatal = dec._error_mode === 'fatal';\n this.ignoreBOM = dec._ignoreBOM;\n }\n\n // 7. Return dec.\n return dec;\n }\n\n if (Object.defineProperty) {\n // The encoding attribute's getter must return encoding's name.\n Object.defineProperty(TextDecoder.prototype, 'encoding', {\n /** @this {TextDecoder} */\n get: function() { return this._encoding.name.toLowerCase(); }\n });\n\n // The fatal attribute's getter must return true if error mode\n // is fatal, and false otherwise.\n Object.defineProperty(TextDecoder.prototype, 'fatal', {\n /** @this {TextDecoder} */\n get: function() { return this._error_mode === 'fatal'; }\n });\n\n // The ignoreBOM attribute's getter must return true if ignore\n // BOM flag is set, and false otherwise.\n Object.defineProperty(TextDecoder.prototype, 'ignoreBOM', {\n /** @this {TextDecoder} */\n get: function() { return this._ignoreBOM; }\n });\n }\n\n /**\n * @param {BufferSource=} input The buffer of bytes to decode.\n * @param {Object=} options\n * @return {string} The decoded string.\n */\n TextDecoder.prototype.decode = function decode(input, options) {\n var bytes;\n if (typeof input === 'object' && input instanceof ArrayBuffer) {\n bytes = new Uint8Array(input);\n } else if (typeof input === 'object' && 'buffer' in input &&\n input.buffer instanceof ArrayBuffer) {\n bytes = new Uint8Array(input.buffer,\n input.byteOffset,\n input.byteLength);\n } else {\n bytes = new Uint8Array(0);\n }\n\n options = ToDictionary(options);\n\n // 1. If the do not flush flag is unset, set decoder to a new\n // encoding's decoder, set stream to a new stream, and unset the\n // BOM seen flag.\n if (!this._do_not_flush) {\n this._decoder = decoders[this._encoding.name]({\n fatal: this._error_mode === 'fatal'});\n this._BOMseen = false;\n }\n\n // 2. If options's stream is true, set the do not flush flag, and\n // unset the do not flush flag otherwise.\n this._do_not_flush = Boolean(options['stream']);\n\n // 3. If input is given, push a copy of input to stream.\n // TODO: Align with spec algorithm - maintain stream on instance.\n var input_stream = new Stream(bytes);\n\n // 4. Let output be a new stream.\n var output = [];\n\n /** @type {?(number|!Array.)} */\n var result;\n\n // 5. While true:\n while (true) {\n // 1. Let token be the result of reading from stream.\n var token = input_stream.read();\n\n // 2. If token is end-of-stream and the do not flush flag is\n // set, return output, serialized.\n // TODO: Align with spec algorithm.\n if (token === end_of_stream)\n break;\n\n // 3. Otherwise, run these subsubsteps:\n\n // 1. Let result be the result of processing token for decoder,\n // stream, output, and error mode.\n result = this._decoder.handler(input_stream, token);\n\n // 2. If result is finished, return output, serialized.\n if (result === finished)\n break;\n\n if (result !== null) {\n if (Array.isArray(result))\n output.push.apply(output, /**@type {!Array.}*/(result));\n else\n output.push(result);\n }\n\n // 3. Otherwise, if result is error, throw a TypeError.\n // (Thrown in handler)\n\n // 4. Otherwise, do nothing.\n }\n // TODO: Align with spec algorithm.\n if (!this._do_not_flush) {\n do {\n result = this._decoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (result === null)\n continue;\n if (Array.isArray(result))\n output.push.apply(output, /**@type {!Array.}*/(result));\n else\n output.push(result);\n } while (!input_stream.endOfStream());\n this._decoder = null;\n }\n\n // A TextDecoder object also has an associated serialize stream\n // algorithm...\n /**\n * @param {!Array.} stream\n * @return {string}\n * @this {TextDecoder}\n */\n function serializeStream(stream) {\n // 1. Let token be the result of reading from stream.\n // (Done in-place on array, rather than as a stream)\n\n // 2. If encoding is UTF-8, UTF-16BE, or UTF-16LE, and ignore\n // BOM flag and BOM seen flag are unset, run these subsubsteps:\n if (includes(['UTF-8', 'UTF-16LE', 'UTF-16BE'], this._encoding.name) &&\n !this._ignoreBOM && !this._BOMseen) {\n if (stream.length > 0 && stream[0] === 0xFEFF) {\n // 1. If token is U+FEFF, set BOM seen flag.\n this._BOMseen = true;\n stream.shift();\n } else if (stream.length > 0) {\n // 2. Otherwise, if token is not end-of-stream, set BOM seen\n // flag and append token to stream.\n this._BOMseen = true;\n } else {\n // 3. Otherwise, if token is not end-of-stream, append token\n // to output.\n // (no-op)\n }\n }\n // 4. Otherwise, return output.\n return codePointsToString(stream);\n }\n\n return serializeStream.call(this, output);\n };\n\n // 8.2 Interface TextEncoder\n\n /**\n * @constructor\n * @param {string=} label The label of the encoding. NONSTANDARD.\n * @param {Object=} options NONSTANDARD.\n */\n function TextEncoder(label, options) {\n // Web IDL conventions\n if (!(this instanceof TextEncoder))\n throw TypeError('Called as a function. Did you forget \\'new\\'?');\n options = ToDictionary(options);\n\n // A TextEncoder object has an associated encoding and encoder.\n\n /** @private */\n this._encoding = null;\n /** @private @type {?Encoder} */\n this._encoder = null;\n\n // Non-standard\n /** @private @type {boolean} */\n this._do_not_flush = false;\n /** @private @type {string} */\n this._fatal = Boolean(options['fatal']) ? 'fatal' : 'replacement';\n\n // 1. Let enc be a new TextEncoder object.\n var enc = this;\n\n // 2. Set enc's encoding to UTF-8's encoder.\n if (Boolean(options['NONSTANDARD_allowLegacyEncoding'])) {\n // NONSTANDARD behavior.\n label = label !== undefined ? String(label) : DEFAULT_ENCODING;\n var encoding = getEncoding(label);\n if (encoding === null || encoding.name === 'replacement')\n throw RangeError('Unknown encoding: ' + label);\n if (!encoders[encoding.name]) {\n throw Error('Encoder not present.' +\n ' Did you forget to include encoding-indexes.js first?');\n }\n enc._encoding = encoding;\n } else {\n // Standard behavior.\n enc._encoding = getEncoding('utf-8');\n\n if (label !== undefined && 'console' in global) {\n console.warn('TextEncoder constructor called with encoding label, '\n + 'which is ignored.');\n }\n }\n\n // For pre-ES5 runtimes:\n if (!Object.defineProperty)\n this.encoding = enc._encoding.name.toLowerCase();\n\n // 3. Return enc.\n return enc;\n }\n\n if (Object.defineProperty) {\n // The encoding attribute's getter must return encoding's name.\n Object.defineProperty(TextEncoder.prototype, 'encoding', {\n /** @this {TextEncoder} */\n get: function() { return this._encoding.name.toLowerCase(); }\n });\n }\n\n /**\n * @param {string=} opt_string The string to encode.\n * @param {Object=} options\n * @return {!Uint8Array} Encoded bytes, as a Uint8Array.\n */\n TextEncoder.prototype.encode = function encode(opt_string, options) {\n opt_string = opt_string === undefined ? '' : String(opt_string);\n options = ToDictionary(options);\n\n // NOTE: This option is nonstandard. None of the encodings\n // permitted for encoding (i.e. UTF-8, UTF-16) are stateful when\n // the input is a USVString so streaming is not necessary.\n if (!this._do_not_flush)\n this._encoder = encoders[this._encoding.name]({\n fatal: this._fatal === 'fatal'});\n this._do_not_flush = Boolean(options['stream']);\n\n // 1. Convert input to a stream.\n var input = new Stream(stringToCodePoints(opt_string));\n\n // 2. Let output be a new stream\n var output = [];\n\n /** @type {?(number|!Array.)} */\n var result;\n // 3. While true, run these substeps:\n while (true) {\n // 1. Let token be the result of reading from input.\n var token = input.read();\n if (token === end_of_stream)\n break;\n // 2. Let result be the result of processing token for encoder,\n // input, output.\n result = this._encoder.handler(input, token);\n if (result === finished)\n break;\n if (Array.isArray(result))\n output.push.apply(output, /**@type {!Array.}*/(result));\n else\n output.push(result);\n }\n // TODO: Align with spec algorithm.\n if (!this._do_not_flush) {\n while (true) {\n result = this._encoder.handler(input, input.read());\n if (result === finished)\n break;\n if (Array.isArray(result))\n output.push.apply(output, /**@type {!Array.}*/(result));\n else\n output.push(result);\n }\n this._encoder = null;\n }\n // 3. If result is finished, convert output into a byte sequence,\n // and then return a Uint8Array object wrapping an ArrayBuffer\n // containing output.\n return new Uint8Array(output);\n };\n\n\n //\n // 9. The encoding\n //\n\n // 9.1 utf-8\n\n // 9.1.1 utf-8 decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function UTF8Decoder(options) {\n var fatal = options.fatal;\n\n // utf-8's decoder's has an associated utf-8 code point, utf-8\n // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8\n // lower boundary (initially 0x80), and a utf-8 upper boundary\n // (initially 0xBF).\n var /** @type {number} */ utf8_code_point = 0,\n /** @type {number} */ utf8_bytes_seen = 0,\n /** @type {number} */ utf8_bytes_needed = 0,\n /** @type {number} */ utf8_lower_boundary = 0x80,\n /** @type {number} */ utf8_upper_boundary = 0xBF;\n\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,\n // set utf-8 bytes needed to 0 and return error.\n if (bite === end_of_stream && utf8_bytes_needed !== 0) {\n utf8_bytes_needed = 0;\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream, return finished.\n if (bite === end_of_stream)\n return finished;\n\n // 3. If utf-8 bytes needed is 0, based on byte:\n if (utf8_bytes_needed === 0) {\n\n // 0x00 to 0x7F\n if (inRange(bite, 0x00, 0x7F)) {\n // Return a code point whose value is byte.\n return bite;\n }\n\n // 0xC2 to 0xDF\n else if (inRange(bite, 0xC2, 0xDF)) {\n // 1. Set utf-8 bytes needed to 1.\n utf8_bytes_needed = 1;\n\n // 2. Set UTF-8 code point to byte & 0x1F.\n utf8_code_point = bite & 0x1F;\n }\n\n // 0xE0 to 0xEF\n else if (inRange(bite, 0xE0, 0xEF)) {\n // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.\n if (bite === 0xE0)\n utf8_lower_boundary = 0xA0;\n // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.\n if (bite === 0xED)\n utf8_upper_boundary = 0x9F;\n // 3. Set utf-8 bytes needed to 2.\n utf8_bytes_needed = 2;\n // 4. Set UTF-8 code point to byte & 0xF.\n utf8_code_point = bite & 0xF;\n }\n\n // 0xF0 to 0xF4\n else if (inRange(bite, 0xF0, 0xF4)) {\n // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.\n if (bite === 0xF0)\n utf8_lower_boundary = 0x90;\n // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.\n if (bite === 0xF4)\n utf8_upper_boundary = 0x8F;\n // 3. Set utf-8 bytes needed to 3.\n utf8_bytes_needed = 3;\n // 4. Set UTF-8 code point to byte & 0x7.\n utf8_code_point = bite & 0x7;\n }\n\n // Otherwise\n else {\n // Return error.\n return decoderError(fatal);\n }\n\n // Return continue.\n return null;\n }\n\n // 4. If byte is not in the range utf-8 lower boundary to utf-8\n // upper boundary, inclusive, run these substeps:\n if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {\n\n // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8\n // bytes seen to 0, set utf-8 lower boundary to 0x80, and set\n // utf-8 upper boundary to 0xBF.\n utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n utf8_lower_boundary = 0x80;\n utf8_upper_boundary = 0xBF;\n\n // 2. Prepend byte to stream.\n stream.prepend(bite);\n\n // 3. Return error.\n return decoderError(fatal);\n }\n\n // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary\n // to 0xBF.\n utf8_lower_boundary = 0x80;\n utf8_upper_boundary = 0xBF;\n\n // 6. Set UTF-8 code point to (UTF-8 code point << 6) | (byte &\n // 0x3F)\n utf8_code_point = (utf8_code_point << 6) | (bite & 0x3F);\n\n // 7. Increase utf-8 bytes seen by one.\n utf8_bytes_seen += 1;\n\n // 8. If utf-8 bytes seen is not equal to utf-8 bytes needed,\n // continue.\n if (utf8_bytes_seen !== utf8_bytes_needed)\n return null;\n\n // 9. Let code point be utf-8 code point.\n var code_point = utf8_code_point;\n\n // 10. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes\n // seen to 0.\n utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n\n // 11. Return a code point whose value is code point.\n return code_point;\n };\n }\n\n // 9.1.2 utf-8 encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\n function UTF8Encoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point, return a byte whose\n // value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 3. Set count and offset based on the range code point is in:\n var count, offset;\n // U+0080 to U+07FF, inclusive:\n if (inRange(code_point, 0x0080, 0x07FF)) {\n // 1 and 0xC0\n count = 1;\n offset = 0xC0;\n }\n // U+0800 to U+FFFF, inclusive:\n else if (inRange(code_point, 0x0800, 0xFFFF)) {\n // 2 and 0xE0\n count = 2;\n offset = 0xE0;\n }\n // U+10000 to U+10FFFF, inclusive:\n else if (inRange(code_point, 0x10000, 0x10FFFF)) {\n // 3 and 0xF0\n count = 3;\n offset = 0xF0;\n }\n\n // 4. Let bytes be a byte sequence whose first byte is (code\n // point >> (6 × count)) + offset.\n var bytes = [(code_point >> (6 * count)) + offset];\n\n // 5. Run these substeps while count is greater than 0:\n while (count > 0) {\n\n // 1. Set temp to code point >> (6 × (count − 1)).\n var temp = code_point >> (6 * (count - 1));\n\n // 2. Append to bytes 0x80 | (temp & 0x3F).\n bytes.push(0x80 | (temp & 0x3F));\n\n // 3. Decrease count by one.\n count -= 1;\n }\n\n // 6. Return bytes bytes, in order.\n return bytes;\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['UTF-8'] = function(options) {\n return new UTF8Encoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['UTF-8'] = function(options) {\n return new UTF8Decoder(options);\n };\n\n //\n // 10. Legacy single-byte encodings\n //\n\n // 10.1 single-byte decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {!Array.} index The encoding index.\n * @param {{fatal: boolean}} options\n */\n function SingleByteDecoder(index, options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream, return finished.\n if (bite === end_of_stream)\n return finished;\n\n // 2. If byte is an ASCII byte, return a code point whose value\n // is byte.\n if (isASCIIByte(bite))\n return bite;\n\n // 3. Let code point be the index code point for byte − 0x80 in\n // index single-byte.\n var code_point = index[bite - 0x80];\n\n // 4. If code point is null, return error.\n if (code_point === null)\n return decoderError(fatal);\n\n // 5. Return a code point whose value is code point.\n return code_point;\n };\n }\n\n // 10.2 single-byte encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {!Array.} index The encoding index.\n * @param {{fatal: boolean}} options\n */\n function SingleByteEncoder(index, options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point, return a byte whose\n // value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 3. Let pointer be the index pointer for code point in index\n // single-byte.\n var pointer = indexPointerFor(code_point, index);\n\n // 4. If pointer is null, return error with code point.\n if (pointer === null)\n encoderError(code_point);\n\n // 5. Return a byte whose value is pointer + 0x80.\n return pointer + 0x80;\n };\n }\n\n (function() {\n if (!('encoding-indexes' in global))\n return;\n encodings.forEach(function(category) {\n if (category.heading !== 'Legacy single-byte encodings')\n return;\n category.encodings.forEach(function(encoding) {\n var name = encoding.name;\n var idx = index(name.toLowerCase());\n /** @param {{fatal: boolean}} options */\n decoders[name] = function(options) {\n return new SingleByteDecoder(idx, options);\n };\n /** @param {{fatal: boolean}} options */\n encoders[name] = function(options) {\n return new SingleByteEncoder(idx, options);\n };\n });\n });\n }());\n\n //\n // 11. Legacy multi-byte Chinese (simplified) encodings\n //\n\n // 11.1 gbk\n\n // 11.1.1 gbk decoder\n // gbk's decoder is gb18030's decoder.\n /** @param {{fatal: boolean}} options */\n decoders['GBK'] = function(options) {\n return new GB18030Decoder(options);\n };\n\n // 11.1.2 gbk encoder\n // gbk's encoder is gb18030's encoder with its gbk flag set.\n /** @param {{fatal: boolean}} options */\n encoders['GBK'] = function(options) {\n return new GB18030Encoder(options, true);\n };\n\n // 11.2 gb18030\n\n // 11.2.1 gb18030 decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function GB18030Decoder(options) {\n var fatal = options.fatal;\n // gb18030's decoder has an associated gb18030 first, gb18030\n // second, and gb18030 third (all initially 0x00).\n var /** @type {number} */ gb18030_first = 0x00,\n /** @type {number} */ gb18030_second = 0x00,\n /** @type {number} */ gb18030_third = 0x00;\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and gb18030 first, gb18030\n // second, and gb18030 third are 0x00, return finished.\n if (bite === end_of_stream && gb18030_first === 0x00 &&\n gb18030_second === 0x00 && gb18030_third === 0x00) {\n return finished;\n }\n // 2. If byte is end-of-stream, and gb18030 first, gb18030\n // second, or gb18030 third is not 0x00, set gb18030 first,\n // gb18030 second, and gb18030 third to 0x00, and return error.\n if (bite === end_of_stream &&\n (gb18030_first !== 0x00 || gb18030_second !== 0x00 ||\n gb18030_third !== 0x00)) {\n gb18030_first = 0x00;\n gb18030_second = 0x00;\n gb18030_third = 0x00;\n decoderError(fatal);\n }\n var code_point;\n // 3. If gb18030 third is not 0x00, run these substeps:\n if (gb18030_third !== 0x00) {\n // 1. Let code point be null.\n code_point = null;\n // 2. If byte is in the range 0x30 to 0x39, inclusive, set\n // code point to the index gb18030 ranges code point for\n // (((gb18030 first − 0x81) × 10 + gb18030 second − 0x30) ×\n // 126 + gb18030 third − 0x81) × 10 + byte − 0x30.\n if (inRange(bite, 0x30, 0x39)) {\n code_point = indexGB18030RangesCodePointFor(\n (((gb18030_first - 0x81) * 10 + gb18030_second - 0x30) * 126 +\n gb18030_third - 0x81) * 10 + bite - 0x30);\n }\n\n // 3. Let buffer be a byte sequence consisting of gb18030\n // second, gb18030 third, and byte, in order.\n var buffer = [gb18030_second, gb18030_third, bite];\n\n // 4. Set gb18030 first, gb18030 second, and gb18030 third to\n // 0x00.\n gb18030_first = 0x00;\n gb18030_second = 0x00;\n gb18030_third = 0x00;\n\n // 5. If code point is null, prepend buffer to stream and\n // return error.\n if (code_point === null) {\n stream.prepend(buffer);\n return decoderError(fatal);\n }\n\n // 6. Return a code point whose value is code point.\n return code_point;\n }\n\n // 4. If gb18030 second is not 0x00, run these substeps:\n if (gb18030_second !== 0x00) {\n\n // 1. If byte is in the range 0x81 to 0xFE, inclusive, set\n // gb18030 third to byte and return continue.\n if (inRange(bite, 0x81, 0xFE)) {\n gb18030_third = bite;\n return null;\n }\n\n // 2. Prepend gb18030 second followed by byte to stream, set\n // gb18030 first and gb18030 second to 0x00, and return error.\n stream.prepend([gb18030_second, bite]);\n gb18030_first = 0x00;\n gb18030_second = 0x00;\n return decoderError(fatal);\n }\n\n // 5. If gb18030 first is not 0x00, run these substeps:\n if (gb18030_first !== 0x00) {\n\n // 1. If byte is in the range 0x30 to 0x39, inclusive, set\n // gb18030 second to byte and return continue.\n if (inRange(bite, 0x30, 0x39)) {\n gb18030_second = bite;\n return null;\n }\n\n // 2. Let lead be gb18030 first, let pointer be null, and set\n // gb18030 first to 0x00.\n var lead = gb18030_first;\n var pointer = null;\n gb18030_first = 0x00;\n\n // 3. Let offset be 0x40 if byte is less than 0x7F and 0x41\n // otherwise.\n var offset = bite < 0x7F ? 0x40 : 0x41;\n\n // 4. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80\n // to 0xFE, inclusive, set pointer to (lead − 0x81) × 190 +\n // (byte − offset).\n if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE))\n pointer = (lead - 0x81) * 190 + (bite - offset);\n\n // 5. Let code point be null if pointer is null and the index\n // code point for pointer in index gb18030 otherwise.\n code_point = pointer === null ? null :\n indexCodePointFor(pointer, index('gb18030'));\n\n // 6. If code point is null and byte is an ASCII byte, prepend\n // byte to stream.\n if (code_point === null && isASCIIByte(bite))\n stream.prepend(bite);\n\n // 7. If code point is null, return error.\n if (code_point === null)\n return decoderError(fatal);\n\n // 8. Return a code point whose value is code point.\n return code_point;\n }\n\n // 6. If byte is an ASCII byte, return a code point whose value\n // is byte.\n if (isASCIIByte(bite))\n return bite;\n\n // 7. If byte is 0x80, return code point U+20AC.\n if (bite === 0x80)\n return 0x20AC;\n\n // 8. If byte is in the range 0x81 to 0xFE, inclusive, set\n // gb18030 first to byte and return continue.\n if (inRange(bite, 0x81, 0xFE)) {\n gb18030_first = bite;\n return null;\n }\n\n // 9. Return error.\n return decoderError(fatal);\n };\n }\n\n // 11.2.2 gb18030 encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n * @param {boolean=} gbk_flag\n */\n function GB18030Encoder(options, gbk_flag) {\n var fatal = options.fatal;\n // gb18030's decoder has an associated gbk flag (initially unset).\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point, return a byte whose\n // value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 3. If code point is U+E5E5, return error with code point.\n if (code_point === 0xE5E5)\n return encoderError(code_point);\n\n // 4. If the gbk flag is set and code point is U+20AC, return\n // byte 0x80.\n if (gbk_flag && code_point === 0x20AC)\n return 0x80;\n\n // 5. Let pointer be the index pointer for code point in index\n // gb18030.\n var pointer = indexPointerFor(code_point, index('gb18030'));\n\n // 6. If pointer is not null, run these substeps:\n if (pointer !== null) {\n\n // 1. Let lead be floor(pointer / 190) + 0x81.\n var lead = floor(pointer / 190) + 0x81;\n\n // 2. Let trail be pointer % 190.\n var trail = pointer % 190;\n\n // 3. Let offset be 0x40 if trail is less than 0x3F and 0x41 otherwise.\n var offset = trail < 0x3F ? 0x40 : 0x41;\n\n // 4. Return two bytes whose values are lead and trail + offset.\n return [lead, trail + offset];\n }\n\n // 7. If gbk flag is set, return error with code point.\n if (gbk_flag)\n return encoderError(code_point);\n\n // 8. Set pointer to the index gb18030 ranges pointer for code\n // point.\n pointer = indexGB18030RangesPointerFor(code_point);\n\n // 9. Let byte1 be floor(pointer / 10 / 126 / 10).\n var byte1 = floor(pointer / 10 / 126 / 10);\n\n // 10. Set pointer to pointer − byte1 × 10 × 126 × 10.\n pointer = pointer - byte1 * 10 * 126 * 10;\n\n // 11. Let byte2 be floor(pointer / 10 / 126).\n var byte2 = floor(pointer / 10 / 126);\n\n // 12. Set pointer to pointer − byte2 × 10 × 126.\n pointer = pointer - byte2 * 10 * 126;\n\n // 13. Let byte3 be floor(pointer / 10).\n var byte3 = floor(pointer / 10);\n\n // 14. Let byte4 be pointer − byte3 × 10.\n var byte4 = pointer - byte3 * 10;\n\n // 15. Return four bytes whose values are byte1 + 0x81, byte2 +\n // 0x30, byte3 + 0x81, byte4 + 0x30.\n return [byte1 + 0x81,\n byte2 + 0x30,\n byte3 + 0x81,\n byte4 + 0x30];\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['gb18030'] = function(options) {\n return new GB18030Encoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['gb18030'] = function(options) {\n return new GB18030Decoder(options);\n };\n\n\n //\n // 12. Legacy multi-byte Chinese (traditional) encodings\n //\n\n // 12.1 Big5\n\n // 12.1.1 Big5 decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function Big5Decoder(options) {\n var fatal = options.fatal;\n // Big5's decoder has an associated Big5 lead (initially 0x00).\n var /** @type {number} */ Big5_lead = 0x00;\n\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and Big5 lead is not 0x00, set\n // Big5 lead to 0x00 and return error.\n if (bite === end_of_stream && Big5_lead !== 0x00) {\n Big5_lead = 0x00;\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream and Big5 lead is 0x00, return\n // finished.\n if (bite === end_of_stream && Big5_lead === 0x00)\n return finished;\n\n // 3. If Big5 lead is not 0x00, let lead be Big5 lead, let\n // pointer be null, set Big5 lead to 0x00, and then run these\n // substeps:\n if (Big5_lead !== 0x00) {\n var lead = Big5_lead;\n var pointer = null;\n Big5_lead = 0x00;\n\n // 1. Let offset be 0x40 if byte is less than 0x7F and 0x62\n // otherwise.\n var offset = bite < 0x7F ? 0x40 : 0x62;\n\n // 2. If byte is in the range 0x40 to 0x7E, inclusive, or 0xA1\n // to 0xFE, inclusive, set pointer to (lead − 0x81) × 157 +\n // (byte − offset).\n if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE))\n pointer = (lead - 0x81) * 157 + (bite - offset);\n\n // 3. If there is a row in the table below whose first column\n // is pointer, return the two code points listed in its second\n // column\n // Pointer | Code points\n // --------+--------------\n // 1133 | U+00CA U+0304\n // 1135 | U+00CA U+030C\n // 1164 | U+00EA U+0304\n // 1166 | U+00EA U+030C\n switch (pointer) {\n case 1133: return [0x00CA, 0x0304];\n case 1135: return [0x00CA, 0x030C];\n case 1164: return [0x00EA, 0x0304];\n case 1166: return [0x00EA, 0x030C];\n }\n\n // 4. Let code point be null if pointer is null and the index\n // code point for pointer in index Big5 otherwise.\n var code_point = (pointer === null) ? null :\n indexCodePointFor(pointer, index('big5'));\n\n // 5. If code point is null and byte is an ASCII byte, prepend\n // byte to stream.\n if (code_point === null && isASCIIByte(bite))\n stream.prepend(bite);\n\n // 6. If code point is null, return error.\n if (code_point === null)\n return decoderError(fatal);\n\n // 7. Return a code point whose value is code point.\n return code_point;\n }\n\n // 4. If byte is an ASCII byte, return a code point whose value\n // is byte.\n if (isASCIIByte(bite))\n return bite;\n\n // 5. If byte is in the range 0x81 to 0xFE, inclusive, set Big5\n // lead to byte and return continue.\n if (inRange(bite, 0x81, 0xFE)) {\n Big5_lead = bite;\n return null;\n }\n\n // 6. Return error.\n return decoderError(fatal);\n };\n }\n\n // 12.1.2 Big5 encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\n function Big5Encoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point, return a byte whose\n // value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 3. Let pointer be the index Big5 pointer for code point.\n var pointer = indexBig5PointerFor(code_point);\n\n // 4. If pointer is null, return error with code point.\n if (pointer === null)\n return encoderError(code_point);\n\n // 5. Let lead be floor(pointer / 157) + 0x81.\n var lead = floor(pointer / 157) + 0x81;\n\n // 6. If lead is less than 0xA1, return error with code point.\n if (lead < 0xA1)\n return encoderError(code_point);\n\n // 7. Let trail be pointer % 157.\n var trail = pointer % 157;\n\n // 8. Let offset be 0x40 if trail is less than 0x3F and 0x62\n // otherwise.\n var offset = trail < 0x3F ? 0x40 : 0x62;\n\n // Return two bytes whose values are lead and trail + offset.\n return [lead, trail + offset];\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['Big5'] = function(options) {\n return new Big5Encoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['Big5'] = function(options) {\n return new Big5Decoder(options);\n };\n\n\n //\n // 13. Legacy multi-byte Japanese encodings\n //\n\n // 13.1 euc-jp\n\n // 13.1.1 euc-jp decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function EUCJPDecoder(options) {\n var fatal = options.fatal;\n\n // euc-jp's decoder has an associated euc-jp jis0212 flag\n // (initially unset) and euc-jp lead (initially 0x00).\n var /** @type {boolean} */ eucjp_jis0212_flag = false,\n /** @type {number} */ eucjp_lead = 0x00;\n\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and euc-jp lead is not 0x00, set\n // euc-jp lead to 0x00, and return error.\n if (bite === end_of_stream && eucjp_lead !== 0x00) {\n eucjp_lead = 0x00;\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream and euc-jp lead is 0x00, return\n // finished.\n if (bite === end_of_stream && eucjp_lead === 0x00)\n return finished;\n\n // 3. If euc-jp lead is 0x8E and byte is in the range 0xA1 to\n // 0xDF, inclusive, set euc-jp lead to 0x00 and return a code\n // point whose value is 0xFF61 − 0xA1 + byte.\n if (eucjp_lead === 0x8E && inRange(bite, 0xA1, 0xDF)) {\n eucjp_lead = 0x00;\n return 0xFF61 - 0xA1 + bite;\n }\n\n // 4. If euc-jp lead is 0x8F and byte is in the range 0xA1 to\n // 0xFE, inclusive, set the euc-jp jis0212 flag, set euc-jp lead\n // to byte, and return continue.\n if (eucjp_lead === 0x8F && inRange(bite, 0xA1, 0xFE)) {\n eucjp_jis0212_flag = true;\n eucjp_lead = bite;\n return null;\n }\n\n // 5. If euc-jp lead is not 0x00, let lead be euc-jp lead, set\n // euc-jp lead to 0x00, and run these substeps:\n if (eucjp_lead !== 0x00) {\n var lead = eucjp_lead;\n eucjp_lead = 0x00;\n\n // 1. Let code point be null.\n var code_point = null;\n\n // 2. If lead and byte are both in the range 0xA1 to 0xFE,\n // inclusive, set code point to the index code point for (lead\n // − 0xA1) × 94 + byte − 0xA1 in index jis0208 if the euc-jp\n // jis0212 flag is unset and in index jis0212 otherwise.\n if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {\n code_point = indexCodePointFor(\n (lead - 0xA1) * 94 + (bite - 0xA1),\n index(!eucjp_jis0212_flag ? 'jis0208' : 'jis0212'));\n }\n\n // 3. Unset the euc-jp jis0212 flag.\n eucjp_jis0212_flag = false;\n\n // 4. If byte is not in the range 0xA1 to 0xFE, inclusive,\n // prepend byte to stream.\n if (!inRange(bite, 0xA1, 0xFE))\n stream.prepend(bite);\n\n // 5. If code point is null, return error.\n if (code_point === null)\n return decoderError(fatal);\n\n // 6. Return a code point whose value is code point.\n return code_point;\n }\n\n // 6. If byte is an ASCII byte, return a code point whose value\n // is byte.\n if (isASCIIByte(bite))\n return bite;\n\n // 7. If byte is 0x8E, 0x8F, or in the range 0xA1 to 0xFE,\n // inclusive, set euc-jp lead to byte and return continue.\n if (bite === 0x8E || bite === 0x8F || inRange(bite, 0xA1, 0xFE)) {\n eucjp_lead = bite;\n return null;\n }\n\n // 8. Return error.\n return decoderError(fatal);\n };\n }\n\n // 13.1.2 euc-jp encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\n function EUCJPEncoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point, return a byte whose\n // value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 3. If code point is U+00A5, return byte 0x5C.\n if (code_point === 0x00A5)\n return 0x5C;\n\n // 4. If code point is U+203E, return byte 0x7E.\n if (code_point === 0x203E)\n return 0x7E;\n\n // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,\n // return two bytes whose values are 0x8E and code point −\n // 0xFF61 + 0xA1.\n if (inRange(code_point, 0xFF61, 0xFF9F))\n return [0x8E, code_point - 0xFF61 + 0xA1];\n\n // 6. If code point is U+2212, set it to U+FF0D.\n if (code_point === 0x2212)\n code_point = 0xFF0D;\n\n // 7. Let pointer be the index pointer for code point in index\n // jis0208.\n var pointer = indexPointerFor(code_point, index('jis0208'));\n\n // 8. If pointer is null, return error with code point.\n if (pointer === null)\n return encoderError(code_point);\n\n // 9. Let lead be floor(pointer / 94) + 0xA1.\n var lead = floor(pointer / 94) + 0xA1;\n\n // 10. Let trail be pointer % 94 + 0xA1.\n var trail = pointer % 94 + 0xA1;\n\n // 11. Return two bytes whose values are lead and trail.\n return [lead, trail];\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['EUC-JP'] = function(options) {\n return new EUCJPEncoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['EUC-JP'] = function(options) {\n return new EUCJPDecoder(options);\n };\n\n // 13.2 iso-2022-jp\n\n // 13.2.1 iso-2022-jp decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function ISO2022JPDecoder(options) {\n var fatal = options.fatal;\n /** @enum */\n var states = {\n ASCII: 0,\n Roman: 1,\n Katakana: 2,\n LeadByte: 3,\n TrailByte: 4,\n EscapeStart: 5,\n Escape: 6\n };\n // iso-2022-jp's decoder has an associated iso-2022-jp decoder\n // state (initially ASCII), iso-2022-jp decoder output state\n // (initially ASCII), iso-2022-jp lead (initially 0x00), and\n // iso-2022-jp output flag (initially unset).\n var /** @type {number} */ iso2022jp_decoder_state = states.ASCII,\n /** @type {number} */ iso2022jp_decoder_output_state = states.ASCII,\n /** @type {number} */ iso2022jp_lead = 0x00,\n /** @type {boolean} */ iso2022jp_output_flag = false;\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // switching on iso-2022-jp decoder state:\n switch (iso2022jp_decoder_state) {\n default:\n case states.ASCII:\n // ASCII\n // Based on byte:\n\n // 0x1B\n if (bite === 0x1B) {\n // Set iso-2022-jp decoder state to escape start and return\n // continue.\n iso2022jp_decoder_state = states.EscapeStart;\n return null;\n }\n\n // 0x00 to 0x7F, excluding 0x0E, 0x0F, and 0x1B\n if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E\n && bite !== 0x0F && bite !== 0x1B) {\n // Unset the iso-2022-jp output flag and return a code point\n // whose value is byte.\n iso2022jp_output_flag = false;\n return bite;\n }\n\n // end-of-stream\n if (bite === end_of_stream) {\n // Return finished.\n return finished;\n }\n\n // Otherwise\n // Unset the iso-2022-jp output flag and return error.\n iso2022jp_output_flag = false;\n return decoderError(fatal);\n\n case states.Roman:\n // Roman\n // Based on byte:\n\n // 0x1B\n if (bite === 0x1B) {\n // Set iso-2022-jp decoder state to escape start and return\n // continue.\n iso2022jp_decoder_state = states.EscapeStart;\n return null;\n }\n\n // 0x5C\n if (bite === 0x5C) {\n // Unset the iso-2022-jp output flag and return code point\n // U+00A5.\n iso2022jp_output_flag = false;\n return 0x00A5;\n }\n\n // 0x7E\n if (bite === 0x7E) {\n // Unset the iso-2022-jp output flag and return code point\n // U+203E.\n iso2022jp_output_flag = false;\n return 0x203E;\n }\n\n // 0x00 to 0x7F, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E\n if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E && bite !== 0x0F\n && bite !== 0x1B && bite !== 0x5C && bite !== 0x7E) {\n // Unset the iso-2022-jp output flag and return a code point\n // whose value is byte.\n iso2022jp_output_flag = false;\n return bite;\n }\n\n // end-of-stream\n if (bite === end_of_stream) {\n // Return finished.\n return finished;\n }\n\n // Otherwise\n // Unset the iso-2022-jp output flag and return error.\n iso2022jp_output_flag = false;\n return decoderError(fatal);\n\n case states.Katakana:\n // Katakana\n // Based on byte:\n\n // 0x1B\n if (bite === 0x1B) {\n // Set iso-2022-jp decoder state to escape start and return\n // continue.\n iso2022jp_decoder_state = states.EscapeStart;\n return null;\n }\n\n // 0x21 to 0x5F\n if (inRange(bite, 0x21, 0x5F)) {\n // Unset the iso-2022-jp output flag and return a code point\n // whose value is 0xFF61 − 0x21 + byte.\n iso2022jp_output_flag = false;\n return 0xFF61 - 0x21 + bite;\n }\n\n // end-of-stream\n if (bite === end_of_stream) {\n // Return finished.\n return finished;\n }\n\n // Otherwise\n // Unset the iso-2022-jp output flag and return error.\n iso2022jp_output_flag = false;\n return decoderError(fatal);\n\n case states.LeadByte:\n // Lead byte\n // Based on byte:\n\n // 0x1B\n if (bite === 0x1B) {\n // Set iso-2022-jp decoder state to escape start and return\n // continue.\n iso2022jp_decoder_state = states.EscapeStart;\n return null;\n }\n\n // 0x21 to 0x7E\n if (inRange(bite, 0x21, 0x7E)) {\n // Unset the iso-2022-jp output flag, set iso-2022-jp lead\n // to byte, iso-2022-jp decoder state to trail byte, and\n // return continue.\n iso2022jp_output_flag = false;\n iso2022jp_lead = bite;\n iso2022jp_decoder_state = states.TrailByte;\n return null;\n }\n\n // end-of-stream\n if (bite === end_of_stream) {\n // Return finished.\n return finished;\n }\n\n // Otherwise\n // Unset the iso-2022-jp output flag and return error.\n iso2022jp_output_flag = false;\n return decoderError(fatal);\n\n case states.TrailByte:\n // Trail byte\n // Based on byte:\n\n // 0x1B\n if (bite === 0x1B) {\n // Set iso-2022-jp decoder state to escape start and return\n // continue.\n iso2022jp_decoder_state = states.EscapeStart;\n return decoderError(fatal);\n }\n\n // 0x21 to 0x7E\n if (inRange(bite, 0x21, 0x7E)) {\n // 1. Set the iso-2022-jp decoder state to lead byte.\n iso2022jp_decoder_state = states.LeadByte;\n\n // 2. Let pointer be (iso-2022-jp lead − 0x21) × 94 + byte − 0x21.\n var pointer = (iso2022jp_lead - 0x21) * 94 + bite - 0x21;\n\n // 3. Let code point be the index code point for pointer in\n // index jis0208.\n var code_point = indexCodePointFor(pointer, index('jis0208'));\n\n // 4. If code point is null, return error.\n if (code_point === null)\n return decoderError(fatal);\n\n // 5. Return a code point whose value is code point.\n return code_point;\n }\n\n // end-of-stream\n if (bite === end_of_stream) {\n // Set the iso-2022-jp decoder state to lead byte, prepend\n // byte to stream, and return error.\n iso2022jp_decoder_state = states.LeadByte;\n stream.prepend(bite);\n return decoderError(fatal);\n }\n\n // Otherwise\n // Set iso-2022-jp decoder state to lead byte and return\n // error.\n iso2022jp_decoder_state = states.LeadByte;\n return decoderError(fatal);\n\n case states.EscapeStart:\n // Escape start\n\n // 1. If byte is either 0x24 or 0x28, set iso-2022-jp lead to\n // byte, iso-2022-jp decoder state to escape, and return\n // continue.\n if (bite === 0x24 || bite === 0x28) {\n iso2022jp_lead = bite;\n iso2022jp_decoder_state = states.Escape;\n return null;\n }\n\n // 2. Prepend byte to stream.\n stream.prepend(bite);\n\n // 3. Unset the iso-2022-jp output flag, set iso-2022-jp\n // decoder state to iso-2022-jp decoder output state, and\n // return error.\n iso2022jp_output_flag = false;\n iso2022jp_decoder_state = iso2022jp_decoder_output_state;\n return decoderError(fatal);\n\n case states.Escape:\n // Escape\n\n // 1. Let lead be iso-2022-jp lead and set iso-2022-jp lead to\n // 0x00.\n var lead = iso2022jp_lead;\n iso2022jp_lead = 0x00;\n\n // 2. Let state be null.\n var state = null;\n\n // 3. If lead is 0x28 and byte is 0x42, set state to ASCII.\n if (lead === 0x28 && bite === 0x42)\n state = states.ASCII;\n\n // 4. If lead is 0x28 and byte is 0x4A, set state to Roman.\n if (lead === 0x28 && bite === 0x4A)\n state = states.Roman;\n\n // 5. If lead is 0x28 and byte is 0x49, set state to Katakana.\n if (lead === 0x28 && bite === 0x49)\n state = states.Katakana;\n\n // 6. If lead is 0x24 and byte is either 0x40 or 0x42, set\n // state to lead byte.\n if (lead === 0x24 && (bite === 0x40 || bite === 0x42))\n state = states.LeadByte;\n\n // 7. If state is non-null, run these substeps:\n if (state !== null) {\n // 1. Set iso-2022-jp decoder state and iso-2022-jp decoder\n // output state to states.\n iso2022jp_decoder_state = iso2022jp_decoder_state = state;\n\n // 2. Let output flag be the iso-2022-jp output flag.\n var output_flag = iso2022jp_output_flag;\n\n // 3. Set the iso-2022-jp output flag.\n iso2022jp_output_flag = true;\n\n // 4. Return continue, if output flag is unset, and error\n // otherwise.\n return !output_flag ? null : decoderError(fatal);\n }\n\n // 8. Prepend lead and byte to stream.\n stream.prepend([lead, bite]);\n\n // 9. Unset the iso-2022-jp output flag, set iso-2022-jp\n // decoder state to iso-2022-jp decoder output state and\n // return error.\n iso2022jp_output_flag = false;\n iso2022jp_decoder_state = iso2022jp_decoder_output_state;\n return decoderError(fatal);\n }\n };\n }\n\n // 13.2.2 iso-2022-jp encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\n function ISO2022JPEncoder(options) {\n var fatal = options.fatal;\n // iso-2022-jp's encoder has an associated iso-2022-jp encoder\n // state which is one of ASCII, Roman, and jis0208 (initially\n // ASCII).\n /** @enum */\n var states = {\n ASCII: 0,\n Roman: 1,\n jis0208: 2\n };\n var /** @type {number} */ iso2022jp_state = states.ASCII;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream and iso-2022-jp encoder\n // state is not ASCII, prepend code point to stream, set\n // iso-2022-jp encoder state to ASCII, and return three bytes\n // 0x1B 0x28 0x42.\n if (code_point === end_of_stream &&\n iso2022jp_state !== states.ASCII) {\n stream.prepend(code_point);\n iso2022jp_state = states.ASCII;\n return [0x1B, 0x28, 0x42];\n }\n\n // 2. If code point is end-of-stream and iso-2022-jp encoder\n // state is ASCII, return finished.\n if (code_point === end_of_stream && iso2022jp_state === states.ASCII)\n return finished;\n\n // 3. If ISO-2022-JP encoder state is ASCII or Roman, and code\n // point is U+000E, U+000F, or U+001B, return error with U+FFFD.\n if ((iso2022jp_state === states.ASCII ||\n iso2022jp_state === states.Roman) &&\n (code_point === 0x000E || code_point === 0x000F ||\n code_point === 0x001B)) {\n return encoderError(0xFFFD);\n }\n\n // 4. If iso-2022-jp encoder state is ASCII and code point is an\n // ASCII code point, return a byte whose value is code point.\n if (iso2022jp_state === states.ASCII &&\n isASCIICodePoint(code_point))\n return code_point;\n\n // 5. If iso-2022-jp encoder state is Roman and code point is an\n // ASCII code point, excluding U+005C and U+007E, or is U+00A5\n // or U+203E, run these substeps:\n if (iso2022jp_state === states.Roman &&\n ((isASCIICodePoint(code_point) &&\n code_point !== 0x005C && code_point !== 0x007E) ||\n (code_point == 0x00A5 || code_point == 0x203E))) {\n\n // 1. If code point is an ASCII code point, return a byte\n // whose value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 2. If code point is U+00A5, return byte 0x5C.\n if (code_point === 0x00A5)\n return 0x5C;\n\n // 3. If code point is U+203E, return byte 0x7E.\n if (code_point === 0x203E)\n return 0x7E;\n }\n\n // 6. If code point is an ASCII code point, and iso-2022-jp\n // encoder state is not ASCII, prepend code point to stream, set\n // iso-2022-jp encoder state to ASCII, and return three bytes\n // 0x1B 0x28 0x42.\n if (isASCIICodePoint(code_point) &&\n iso2022jp_state !== states.ASCII) {\n stream.prepend(code_point);\n iso2022jp_state = states.ASCII;\n return [0x1B, 0x28, 0x42];\n }\n\n // 7. If code point is either U+00A5 or U+203E, and iso-2022-jp\n // encoder state is not Roman, prepend code point to stream, set\n // iso-2022-jp encoder state to Roman, and return three bytes\n // 0x1B 0x28 0x4A.\n if ((code_point === 0x00A5 || code_point === 0x203E) &&\n iso2022jp_state !== states.Roman) {\n stream.prepend(code_point);\n iso2022jp_state = states.Roman;\n return [0x1B, 0x28, 0x4A];\n }\n\n // 8. If code point is U+2212, set it to U+FF0D.\n if (code_point === 0x2212)\n code_point = 0xFF0D;\n\n // 9. Let pointer be the index pointer for code point in index\n // jis0208.\n var pointer = indexPointerFor(code_point, index('jis0208'));\n\n // 10. If pointer is null, return error with code point.\n if (pointer === null)\n return encoderError(code_point);\n\n // 11. If iso-2022-jp encoder state is not jis0208, prepend code\n // point to stream, set iso-2022-jp encoder state to jis0208,\n // and return three bytes 0x1B 0x24 0x42.\n if (iso2022jp_state !== states.jis0208) {\n stream.prepend(code_point);\n iso2022jp_state = states.jis0208;\n return [0x1B, 0x24, 0x42];\n }\n\n // 12. Let lead be floor(pointer / 94) + 0x21.\n var lead = floor(pointer / 94) + 0x21;\n\n // 13. Let trail be pointer % 94 + 0x21.\n var trail = pointer % 94 + 0x21;\n\n // 14. Return two bytes whose values are lead and trail.\n return [lead, trail];\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['ISO-2022-JP'] = function(options) {\n return new ISO2022JPEncoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['ISO-2022-JP'] = function(options) {\n return new ISO2022JPDecoder(options);\n };\n\n // 13.3 Shift_JIS\n\n // 13.3.1 Shift_JIS decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function ShiftJISDecoder(options) {\n var fatal = options.fatal;\n // Shift_JIS's decoder has an associated Shift_JIS lead (initially\n // 0x00).\n var /** @type {number} */ Shift_JIS_lead = 0x00;\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and Shift_JIS lead is not 0x00,\n // set Shift_JIS lead to 0x00 and return error.\n if (bite === end_of_stream && Shift_JIS_lead !== 0x00) {\n Shift_JIS_lead = 0x00;\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream and Shift_JIS lead is 0x00,\n // return finished.\n if (bite === end_of_stream && Shift_JIS_lead === 0x00)\n return finished;\n\n // 3. If Shift_JIS lead is not 0x00, let lead be Shift_JIS lead,\n // let pointer be null, set Shift_JIS lead to 0x00, and then run\n // these substeps:\n if (Shift_JIS_lead !== 0x00) {\n var lead = Shift_JIS_lead;\n var pointer = null;\n Shift_JIS_lead = 0x00;\n\n // 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41\n // otherwise.\n var offset = (bite < 0x7F) ? 0x40 : 0x41;\n\n // 2. Let lead offset be 0x81, if lead is less than 0xA0, and\n // 0xC1 otherwise.\n var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1;\n\n // 3. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80\n // to 0xFC, inclusive, set pointer to (lead − lead offset) ×\n // 188 + byte − offset.\n if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFC))\n pointer = (lead - lead_offset) * 188 + bite - offset;\n\n // 4. If pointer is in the range 8836 to 10715, inclusive,\n // return a code point whose value is 0xE000 − 8836 + pointer.\n if (inRange(pointer, 8836, 10715))\n return 0xE000 - 8836 + pointer;\n\n // 5. Let code point be null, if pointer is null, and the\n // index code point for pointer in index jis0208 otherwise.\n var code_point = (pointer === null) ? null :\n indexCodePointFor(pointer, index('jis0208'));\n\n // 6. If code point is null and byte is an ASCII byte, prepend\n // byte to stream.\n if (code_point === null && isASCIIByte(bite))\n stream.prepend(bite);\n\n // 7. If code point is null, return error.\n if (code_point === null)\n return decoderError(fatal);\n\n // 8. Return a code point whose value is code point.\n return code_point;\n }\n\n // 4. If byte is an ASCII byte or 0x80, return a code point\n // whose value is byte.\n if (isASCIIByte(bite) || bite === 0x80)\n return bite;\n\n // 5. If byte is in the range 0xA1 to 0xDF, inclusive, return a\n // code point whose value is 0xFF61 − 0xA1 + byte.\n if (inRange(bite, 0xA1, 0xDF))\n return 0xFF61 - 0xA1 + bite;\n\n // 6. If byte is in the range 0x81 to 0x9F, inclusive, or 0xE0\n // to 0xFC, inclusive, set Shift_JIS lead to byte and return\n // continue.\n if (inRange(bite, 0x81, 0x9F) || inRange(bite, 0xE0, 0xFC)) {\n Shift_JIS_lead = bite;\n return null;\n }\n\n // 7. Return error.\n return decoderError(fatal);\n };\n }\n\n // 13.3.2 Shift_JIS encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\n function ShiftJISEncoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point or U+0080, return a\n // byte whose value is code point.\n if (isASCIICodePoint(code_point) || code_point === 0x0080)\n return code_point;\n\n // 3. If code point is U+00A5, return byte 0x5C.\n if (code_point === 0x00A5)\n return 0x5C;\n\n // 4. If code point is U+203E, return byte 0x7E.\n if (code_point === 0x203E)\n return 0x7E;\n\n // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,\n // return a byte whose value is code point − 0xFF61 + 0xA1.\n if (inRange(code_point, 0xFF61, 0xFF9F))\n return code_point - 0xFF61 + 0xA1;\n\n // 6. If code point is U+2212, set it to U+FF0D.\n if (code_point === 0x2212)\n code_point = 0xFF0D;\n\n // 7. Let pointer be the index Shift_JIS pointer for code point.\n var pointer = indexShiftJISPointerFor(code_point);\n\n // 8. If pointer is null, return error with code point.\n if (pointer === null)\n return encoderError(code_point);\n\n // 9. Let lead be floor(pointer / 188).\n var lead = floor(pointer / 188);\n\n // 10. Let lead offset be 0x81, if lead is less than 0x1F, and\n // 0xC1 otherwise.\n var lead_offset = (lead < 0x1F) ? 0x81 : 0xC1;\n\n // 11. Let trail be pointer % 188.\n var trail = pointer % 188;\n\n // 12. Let offset be 0x40, if trail is less than 0x3F, and 0x41\n // otherwise.\n var offset = (trail < 0x3F) ? 0x40 : 0x41;\n\n // 13. Return two bytes whose values are lead + lead offset and\n // trail + offset.\n return [lead + lead_offset, trail + offset];\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['Shift_JIS'] = function(options) {\n return new ShiftJISEncoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['Shift_JIS'] = function(options) {\n return new ShiftJISDecoder(options);\n };\n\n //\n // 14. Legacy multi-byte Korean encodings\n //\n\n // 14.1 euc-kr\n\n // 14.1.1 euc-kr decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function EUCKRDecoder(options) {\n var fatal = options.fatal;\n\n // euc-kr's decoder has an associated euc-kr lead (initially 0x00).\n var /** @type {number} */ euckr_lead = 0x00;\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and euc-kr lead is not 0x00, set\n // euc-kr lead to 0x00 and return error.\n if (bite === end_of_stream && euckr_lead !== 0) {\n euckr_lead = 0x00;\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream and euc-kr lead is 0x00, return\n // finished.\n if (bite === end_of_stream && euckr_lead === 0)\n return finished;\n\n // 3. If euc-kr lead is not 0x00, let lead be euc-kr lead, let\n // pointer be null, set euc-kr lead to 0x00, and then run these\n // substeps:\n if (euckr_lead !== 0x00) {\n var lead = euckr_lead;\n var pointer = null;\n euckr_lead = 0x00;\n\n // 1. If byte is in the range 0x41 to 0xFE, inclusive, set\n // pointer to (lead − 0x81) × 190 + (byte − 0x41).\n if (inRange(bite, 0x41, 0xFE))\n pointer = (lead - 0x81) * 190 + (bite - 0x41);\n\n // 2. Let code point be null, if pointer is null, and the\n // index code point for pointer in index euc-kr otherwise.\n var code_point = (pointer === null)\n ? null : indexCodePointFor(pointer, index('euc-kr'));\n\n // 3. If code point is null and byte is an ASCII byte, prepend\n // byte to stream.\n if (pointer === null && isASCIIByte(bite))\n stream.prepend(bite);\n\n // 4. If code point is null, return error.\n if (code_point === null)\n return decoderError(fatal);\n\n // 5. Return a code point whose value is code point.\n return code_point;\n }\n\n // 4. If byte is an ASCII byte, return a code point whose value\n // is byte.\n if (isASCIIByte(bite))\n return bite;\n\n // 5. If byte is in the range 0x81 to 0xFE, inclusive, set\n // euc-kr lead to byte and return continue.\n if (inRange(bite, 0x81, 0xFE)) {\n euckr_lead = bite;\n return null;\n }\n\n // 6. Return error.\n return decoderError(fatal);\n };\n }\n\n // 14.1.2 euc-kr encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\n function EUCKREncoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point, return a byte whose\n // value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 3. Let pointer be the index pointer for code point in index\n // euc-kr.\n var pointer = indexPointerFor(code_point, index('euc-kr'));\n\n // 4. If pointer is null, return error with code point.\n if (pointer === null)\n return encoderError(code_point);\n\n // 5. Let lead be floor(pointer / 190) + 0x81.\n var lead = floor(pointer / 190) + 0x81;\n\n // 6. Let trail be pointer % 190 + 0x41.\n var trail = (pointer % 190) + 0x41;\n\n // 7. Return two bytes whose values are lead and trail.\n return [lead, trail];\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['EUC-KR'] = function(options) {\n return new EUCKREncoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['EUC-KR'] = function(options) {\n return new EUCKRDecoder(options);\n };\n\n\n //\n // 15. Legacy miscellaneous encodings\n //\n\n // 15.1 replacement\n\n // Not needed - API throws RangeError\n\n // 15.2 Common infrastructure for utf-16be and utf-16le\n\n /**\n * @param {number} code_unit\n * @param {boolean} utf16be\n * @return {!Array.} bytes\n */\n function convertCodeUnitToBytes(code_unit, utf16be) {\n // 1. Let byte1 be code unit >> 8.\n var byte1 = code_unit >> 8;\n\n // 2. Let byte2 be code unit & 0x00FF.\n var byte2 = code_unit & 0x00FF;\n\n // 3. Then return the bytes in order:\n // utf-16be flag is set: byte1, then byte2.\n if (utf16be)\n return [byte1, byte2];\n // utf-16be flag is unset: byte2, then byte1.\n return [byte2, byte1];\n }\n\n // 15.2.1 shared utf-16 decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {boolean} utf16_be True if big-endian, false if little-endian.\n * @param {{fatal: boolean}} options\n */\n function UTF16Decoder(utf16_be, options) {\n var fatal = options.fatal;\n var /** @type {?number} */ utf16_lead_byte = null,\n /** @type {?number} */ utf16_lead_surrogate = null;\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and either utf-16 lead byte or\n // utf-16 lead surrogate is not null, set utf-16 lead byte and\n // utf-16 lead surrogate to null, and return error.\n if (bite === end_of_stream && (utf16_lead_byte !== null ||\n utf16_lead_surrogate !== null)) {\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream and utf-16 lead byte and utf-16\n // lead surrogate are null, return finished.\n if (bite === end_of_stream && utf16_lead_byte === null &&\n utf16_lead_surrogate === null) {\n return finished;\n }\n\n // 3. If utf-16 lead byte is null, set utf-16 lead byte to byte\n // and return continue.\n if (utf16_lead_byte === null) {\n utf16_lead_byte = bite;\n return null;\n }\n\n // 4. Let code unit be the result of:\n var code_unit;\n if (utf16_be) {\n // utf-16be decoder flag is set\n // (utf-16 lead byte << 8) + byte.\n code_unit = (utf16_lead_byte << 8) + bite;\n } else {\n // utf-16be decoder flag is unset\n // (byte << 8) + utf-16 lead byte.\n code_unit = (bite << 8) + utf16_lead_byte;\n }\n // Then set utf-16 lead byte to null.\n utf16_lead_byte = null;\n\n // 5. If utf-16 lead surrogate is not null, let lead surrogate\n // be utf-16 lead surrogate, set utf-16 lead surrogate to null,\n // and then run these substeps:\n if (utf16_lead_surrogate !== null) {\n var lead_surrogate = utf16_lead_surrogate;\n utf16_lead_surrogate = null;\n\n // 1. If code unit is in the range U+DC00 to U+DFFF,\n // inclusive, return a code point whose value is 0x10000 +\n // ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00).\n if (inRange(code_unit, 0xDC00, 0xDFFF)) {\n return 0x10000 + (lead_surrogate - 0xD800) * 0x400 +\n (code_unit - 0xDC00);\n }\n\n // 2. Prepend the sequence resulting of converting code unit\n // to bytes using utf-16be decoder flag to stream and return\n // error.\n stream.prepend(convertCodeUnitToBytes(code_unit, utf16_be));\n return decoderError(fatal);\n }\n\n // 6. If code unit is in the range U+D800 to U+DBFF, inclusive,\n // set utf-16 lead surrogate to code unit and return continue.\n if (inRange(code_unit, 0xD800, 0xDBFF)) {\n utf16_lead_surrogate = code_unit;\n return null;\n }\n\n // 7. If code unit is in the range U+DC00 to U+DFFF, inclusive,\n // return error.\n if (inRange(code_unit, 0xDC00, 0xDFFF))\n return decoderError(fatal);\n\n // 8. Return code point code unit.\n return code_unit;\n };\n }\n\n // 15.2.2 shared utf-16 encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {boolean} utf16_be True if big-endian, false if little-endian.\n * @param {{fatal: boolean}} options\n */\n function UTF16Encoder(utf16_be, options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is in the range U+0000 to U+FFFF, inclusive,\n // return the sequence resulting of converting code point to\n // bytes using utf-16be encoder flag.\n if (inRange(code_point, 0x0000, 0xFFFF))\n return convertCodeUnitToBytes(code_point, utf16_be);\n\n // 3. Let lead be ((code point − 0x10000) >> 10) + 0xD800,\n // converted to bytes using utf-16be encoder flag.\n var lead = convertCodeUnitToBytes(\n ((code_point - 0x10000) >> 10) + 0xD800, utf16_be);\n\n // 4. Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00,\n // converted to bytes using utf-16be encoder flag.\n var trail = convertCodeUnitToBytes(\n ((code_point - 0x10000) & 0x3FF) + 0xDC00, utf16_be);\n\n // 5. Return a byte sequence of lead followed by trail.\n return lead.concat(trail);\n };\n }\n\n // 15.3 utf-16be\n // 15.3.1 utf-16be decoder\n /** @param {{fatal: boolean}} options */\n encoders['UTF-16BE'] = function(options) {\n return new UTF16Encoder(true, options);\n };\n // 15.3.2 utf-16be encoder\n /** @param {{fatal: boolean}} options */\n decoders['UTF-16BE'] = function(options) {\n return new UTF16Decoder(true, options);\n };\n\n // 15.4 utf-16le\n // 15.4.1 utf-16le decoder\n /** @param {{fatal: boolean}} options */\n encoders['UTF-16LE'] = function(options) {\n return new UTF16Encoder(false, options);\n };\n // 15.4.2 utf-16le encoder\n /** @param {{fatal: boolean}} options */\n decoders['UTF-16LE'] = function(options) {\n return new UTF16Decoder(false, options);\n };\n\n // 15.5 x-user-defined\n\n // 15.5.1 x-user-defined decoder\n /**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\n function XUserDefinedDecoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream, return finished.\n if (bite === end_of_stream)\n return finished;\n\n // 2. If byte is an ASCII byte, return a code point whose value\n // is byte.\n if (isASCIIByte(bite))\n return bite;\n\n // 3. Return a code point whose value is 0xF780 + byte − 0x80.\n return 0xF780 + bite - 0x80;\n };\n }\n\n // 15.5.2 x-user-defined encoder\n /**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\n function XUserDefinedEncoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1.If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is an ASCII code point, return a byte whose\n // value is code point.\n if (isASCIICodePoint(code_point))\n return code_point;\n\n // 3. If code point is in the range U+F780 to U+F7FF, inclusive,\n // return a byte whose value is code point − 0xF780 + 0x80.\n if (inRange(code_point, 0xF780, 0xF7FF))\n return code_point - 0xF780 + 0x80;\n\n // 4. Return error with code point.\n return encoderError(code_point);\n };\n }\n\n /** @param {{fatal: boolean}} options */\n encoders['x-user-defined'] = function(options) {\n return new XUserDefinedEncoder(options);\n };\n /** @param {{fatal: boolean}} options */\n decoders['x-user-defined'] = function(options) {\n return new XUserDefinedDecoder(options);\n };\n\n if (!global['TextEncoder'])\n global['TextEncoder'] = TextEncoder;\n if (!global['TextDecoder'])\n global['TextDecoder'] = TextDecoder;\n\n if ( true && module.exports) {\n module.exports = {\n TextEncoder: global['TextEncoder'],\n TextDecoder: global['TextDecoder'],\n EncodingIndexes: global[\"encoding-indexes\"]\n };\n }\n\n// For strict environments where `this` inside the global scope\n// is `undefined`, take a pure object instead\n}(this || {}));\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/text-encoding/lib/encoding.js?"); +/** + * Get Token Account Nft Information + */ +RequestType_RequestType.TokenGetAccountNftInfos = new RequestType_RequestType(74); -/***/ }), +/** + * Get Token Nft Information + */ +RequestType_RequestType.TokenGetNftInfo = new RequestType_RequestType(75); -/***/ "./src/ApiService.ts": -/*!***************************!*\ - !*** ./src/ApiService.ts ***! - \***************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/** + * Get Token Nft List Information + */ +RequestType_RequestType.TokenGetNftInfos = new RequestType_RequestType(76); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"GET\": function() { return /* binding */ GET; },\n/* harmony export */ \"accountInfo\": function() { return /* binding */ accountInfo; },\n/* harmony export */ \"apiCallContractQuery\": function() { return /* binding */ apiCallContractQuery; },\n/* harmony export */ \"checkAccountCreationStatus\": function() { return /* binding */ checkAccountCreationStatus; },\n/* harmony export */ \"confirmAccountUpdate\": function() { return /* binding */ confirmAccountUpdate; },\n/* harmony export */ \"createAccount\": function() { return /* binding */ createAccount; },\n/* harmony export */ \"getAccountsFromPublicKey\": function() { return /* binding */ getAccountsFromPublicKey; },\n/* harmony export */ \"getC14token\": function() { return /* binding */ getC14token; },\n/* harmony export */ \"getEncryptedHeader\": function() { return /* binding */ getEncryptedHeader; },\n/* harmony export */ \"getPendingAccountData\": function() { return /* binding */ getPendingAccountData; },\n/* harmony export */ \"getTransaction\": function() { return /* binding */ getTransaction; },\n/* harmony export */ \"getTransactionsFrom\": function() { return /* binding */ getTransactionsFrom; },\n/* harmony export */ \"initApiService\": function() { return /* binding */ initApiService; },\n/* harmony export */ \"requestTokenInfo\": function() { return /* binding */ requestTokenInfo; },\n/* harmony export */ \"signContractCallTx\": function() { return /* binding */ signContractCallTx; },\n/* harmony export */ \"transferTokens\": function() { return /* binding */ transferTokens; }\n/* harmony export */ });\n/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\n/* harmony import */ var _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/sdk */ \"./node_modules/@hashgraph/sdk/src/browser.js\");\n/* harmony import */ var _models_Networks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./models/Networks */ \"./src/models/Networks.ts\");\n/* harmony import */ var _models_Common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./models/Common */ \"./src/models/Common.ts\");\n/* harmony import */ var _helpers_ArrayHelpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/ArrayHelpers */ \"./src/helpers/ArrayHelpers.ts\");\n/* harmony import */ var _helpers_TransactionHelpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers/TransactionHelpers */ \"./src/helpers/TransactionHelpers.ts\");\n/* harmony import */ var _helpers_SecurityHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers/SecurityHelper */ \"./src/helpers/SecurityHelper.ts\");\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (undefined && undefined.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n\n\n\n\n\nvar sdkVersion = \"\";\nvar visitorId = \"\";\nvar apiKey = \"\";\nvar environment = _models_Common__WEBPACK_IMPORTED_MODULE_3__.SdkEnvironment.Prod;\nvar initApiService = function (version, visitor, token, sdkEnvironment) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n sdkVersion = version;\n visitorId = visitor;\n environment = sdkEnvironment;\n apiKey = token;\n return [2 /*return*/];\n });\n}); };\nvar getEncryptedHeader = function (env, type) {\n if (env === void 0) { env = _models_Common__WEBPACK_IMPORTED_MODULE_3__.Environment.browser; }\n if (type === void 0) { type = _models_Common__WEBPACK_IMPORTED_MODULE_3__.EncryptedType.tvte; }\n return __awaiter(void 0, void 0, void 0, function () {\n var value, _a, platform, version, _b, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n value = \"\";\n _a = __read(sdkVersion.split(\"@\"), 2), platform = _a[0], version = _a[1];\n if (!(type === 'tvte')) return [3 /*break*/, 2];\n value = \"\".concat(version, \"@\").concat(Date.now());\n _c = (_b = \"\".concat(platform, \"@\")).concat;\n return [4 /*yield*/, (0,_helpers_SecurityHelper__WEBPACK_IMPORTED_MODULE_6__.encrypt)(value, apiKey, env)];\n case 1: return [2 /*return*/, _c.apply(_b, [_d.sent()])];\n case 2:\n if (!(type === 'vte')) return [3 /*break*/, 4];\n value = \"\".concat(visitorId, \"@\").concat(Date.now());\n return [4 /*yield*/, (0,_helpers_SecurityHelper__WEBPACK_IMPORTED_MODULE_6__.encrypt)(value, apiKey, env)];\n case 3: return [2 /*return*/, _d.sent()];\n case 4: return [2 /*return*/];\n }\n });\n });\n};\nvar getApiUrl = function () {\n return environment === _models_Common__WEBPACK_IMPORTED_MODULE_3__.SdkEnvironment.Prod\n ? \"https://rest.prod.bladewallet.io/openapi/v7\"\n : \"https://api.bld-dev.bladewallet.io/openapi/v7\";\n};\nvar fetchWithRetry = function (url, options, maxAttempts) {\n if (maxAttempts === void 0) { maxAttempts = 3; }\n return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve, reject) {\n var attemptCounter = 0;\n var interval = 5000;\n // tslint:disable-next-line:no-shadowed-variable\n var makeRequest = function (url, options) {\n attemptCounter += 1;\n fetch(url, options)\n .then(function (res) { return __awaiter(void 0, void 0, void 0, function () {\n var rawData;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!res.ok) return [3 /*break*/, 4];\n if (!((res.status === 408 || res.status === 429) && attemptCounter < maxAttempts)) return [3 /*break*/, 1];\n /* istanbul ignore next */\n setTimeout(function () {\n makeRequest(url, options);\n }, interval * attemptCounter);\n return [3 /*break*/, 3];\n case 1: return [4 /*yield*/, res.text()];\n case 2:\n rawData = _a.sent();\n try {\n reject(__assign({ url: res.url }, JSON.parse(rawData)));\n }\n catch (e) {\n reject({\n url: res.url,\n error: rawData\n });\n }\n _a.label = 3;\n case 3: return [3 /*break*/, 5];\n case 4:\n resolve(res);\n _a.label = 5;\n case 5: return [2 /*return*/];\n }\n });\n }); })\n .catch(function (e) {\n reject({\n url: url,\n error: e.message\n });\n });\n };\n makeRequest(url, options);\n })];\n });\n });\n};\nvar statusCheck = function (res) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!res.ok) return [3 /*break*/, 2];\n return [4 /*yield*/, res.json()];\n case 1: throw _a.sent();\n case 2: return [2 /*return*/, res];\n }\n });\n}); };\nvar GET = function (network, route) {\n return fetchWithRetry(\"\".concat(_models_Networks__WEBPACK_IMPORTED_MODULE_2__.NetworkMirrorNodes[network], \"/\").concat(route), {})\n .then(statusCheck)\n .then(function (x) { return x.json(); });\n};\nvar createAccount = function (network, params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, headers, _a, options;\n var _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/accounts\");\n _b = {\n \"X-NETWORK\": network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _a = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n headers = (_b[_a] = _c.sent(),\n _b[\"Content-Type\"] = \"application/json\",\n _b);\n if (params.deviceId) {\n headers[\"X-DID-API\"] = params.deviceId;\n }\n options = {\n method: \"POST\",\n headers: new Headers(headers),\n body: JSON.stringify({\n publicKey: params.publicKey\n })\n };\n return [2 /*return*/, fetchWithRetry(url, options)\n .then(statusCheck)\n .then(function (x) { return x.json(); })];\n }\n });\n}); };\nvar checkAccountCreationStatus = function (transactionId, network, params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, options, _a, _b;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/accounts/status?transactionId=\").concat(transactionId);\n _c = {\n method: \"GET\"\n };\n _a = Headers.bind;\n _d = {\n \"X-NETWORK\": network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _b = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(),\n _d[\"Content-Type\"] = \"application/json\",\n _d)]))(),\n _c);\n return [2 /*return*/, fetch(url, options)\n .then(statusCheck)\n .then(function (x) { return x.json(); })];\n }\n });\n}); };\nvar getPendingAccountData = function (transactionId, network, params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, options, _a, _b;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/accounts/details?transactionId=\").concat(transactionId);\n _c = {\n method: \"GET\"\n };\n _a = Headers.bind;\n _d = {\n \"X-NETWORK\": network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _b = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(),\n _d[\"Content-Type\"] = \"application/json\",\n _d)]))(),\n _c);\n return [2 /*return*/, fetch(url, options)\n .then(statusCheck)\n .then(function (x) { return x.json(); })];\n }\n });\n}); };\nvar confirmAccountUpdate = function (params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, options, _a, _b;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/accounts/confirm\");\n _c = {\n method: \"PATCH\"\n };\n _a = Headers.bind;\n _d = {\n \"X-NETWORK\": params.network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _b = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(),\n _d[\"Content-Type\"] = \"application/json\",\n _d)]))(),\n _c.body = JSON.stringify({\n id: params.accountId\n }),\n _c);\n return [2 /*return*/, fetchWithRetry(url, options)\n .then(statusCheck)];\n }\n });\n}); };\nvar requestTokenInfo = function (network, tokenId) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, GET(network, \"api/v1/tokens/\".concat(tokenId))];\n });\n}); };\nvar transferTokens = function (network, params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, options, _a, _b;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/tokens/transfers\");\n _c = {\n method: \"POST\"\n };\n _a = Headers.bind;\n _d = {\n \"X-NETWORK\": network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _b = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(),\n _d[\"Content-Type\"] = \"application/json\",\n _d)]))(),\n _c.body = JSON.stringify({\n receiverAccountId: params.receiverAccountId,\n senderAccountId: params.senderAccountId,\n amount: params.amount,\n decimals: params.decimals,\n memo: params.memo\n }),\n _c);\n return [2 /*return*/, fetch(url, options)\n .then(statusCheck)\n .then(function (x) { return x.json(); })];\n }\n });\n}); };\nvar signContractCallTx = function (network, params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, options, _a, _b;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/smart/contract/sign\");\n _c = {\n method: \"POST\"\n };\n _a = Headers.bind;\n _d = {\n \"X-NETWORK\": network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _b = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(),\n _d[\"Content-Type\"] = \"application/json\",\n _d)]))(),\n _c.body = JSON.stringify({\n functionParametersHash: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(params.contractFunctionParameters).toString(\"base64\"),\n contractId: params.contractId,\n functionName: params.functionName,\n gas: params.gas\n }),\n _c);\n return [2 /*return*/, fetch(url, options)\n .then(statusCheck)\n .then(function (x) { return x.json(); })];\n }\n });\n}); };\nvar apiCallContractQuery = function (network, params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, options, _a, _b;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/smart/contract/call\");\n _c = {\n method: \"POST\"\n };\n _a = Headers.bind;\n _d = {\n \"X-NETWORK\": network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _b = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(),\n _d[\"Content-Type\"] = \"application/json\",\n _d)]))(),\n _c.body = JSON.stringify({\n functionParametersHash: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(params.contractFunctionParameters).toString(\"base64\"),\n contractId: params.contractId,\n functionName: params.functionName,\n gas: params.gas\n }),\n _c);\n return [2 /*return*/, fetch(url, options)\n .then(statusCheck)\n .then(function (x) { return x.json(); })];\n }\n });\n}); };\nvar getC14token = function (params) { return __awaiter(void 0, void 0, void 0, function () {\n var url, options, _a, _b;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n url = \"\".concat(getApiUrl(), \"/c14/data\");\n _c = {\n method: \"GET\"\n };\n _a = Headers.bind;\n _d = {\n \"X-NETWORK\": params.network.toUpperCase(),\n \"X-VISITOR-ID\": params.visitorId,\n \"X-DAPP-CODE\": params.dAppCode\n };\n _b = \"X-SDK-TVTE-API\";\n return [4 /*yield*/, getEncryptedHeader()];\n case 1:\n options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(),\n _d[\"Content-Type\"] = \"application/json\",\n _d)]))(),\n _c);\n return [2 /*return*/, fetch(url, options)\n .then(statusCheck)\n .then(function (x) { return x.json(); })];\n }\n });\n}); };\nvar getAccountsFromPublicKey = function (network, publicKey) { return __awaiter(void 0, void 0, void 0, function () {\n var formatted;\n return __generator(this, function (_a) {\n formatted = publicKey.toStringRaw();\n return [2 /*return*/, GET(network, \"api/v1/accounts?account.publickey=\".concat(formatted))\n .then(function (x) { return x.accounts.map(function (acc) { return acc.account; }); })\n .catch(function () {\n return [];\n })];\n });\n}); };\nvar accountInfo = function (network, accountId) { return __awaiter(void 0, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, GET(network, \"api/v1/accounts/\".concat(accountId))];\n case 1:\n info = _a.sent();\n return [2 /*return*/, {\n evmAddress: info.evm_address ? info.evm_address : \"0x\".concat(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_1__.AccountId.fromString(accountId).toSolidityAddress()),\n publicKey: info.key.key\n }];\n }\n });\n}); };\nvar getTransactionsFrom = function (network, accountId, transactionType, nextPage, transactionsLimit) {\n if (transactionType === void 0) { transactionType = \"\"; }\n if (nextPage === void 0) { nextPage = null; }\n if (transactionsLimit === void 0) { transactionsLimit = \"10\"; }\n return __awaiter(void 0, void 0, void 0, function () {\n var limit, info, result, pageLimit, _loop_1, state_1;\n var _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n limit = parseInt(transactionsLimit, 10);\n result = [];\n pageLimit = limit >= 100 ? 100 : 25;\n _loop_1 = function () {\n var groupedTransactions, transactions;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n if (!nextPage) return [3 /*break*/, 2];\n return [4 /*yield*/, GET(network, nextPage)];\n case 1:\n info = _d.sent();\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, GET(network, \"api/v1/transactions/?account.id=\".concat(accountId, \"&limit=\").concat(pageLimit))];\n case 3:\n info = _d.sent();\n _d.label = 4;\n case 4:\n nextPage = (_b = (_a = info.links.next) === null || _a === void 0 ? void 0 : _a.substring(1)) !== null && _b !== void 0 ? _b : null;\n groupedTransactions = {};\n return [4 /*yield*/, Promise.all(info.transactions.map(function (t) { return __awaiter(void 0, void 0, void 0, function () {\n var _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = groupedTransactions;\n _b = t.transaction_id;\n return [4 /*yield*/, getTransaction(network, t.transaction_id, accountId)];\n case 1:\n _a[_b] = _c.sent();\n return [2 /*return*/];\n }\n });\n }); }))];\n case 5:\n _d.sent();\n transactions = (0,_helpers_ArrayHelpers__WEBPACK_IMPORTED_MODULE_4__.flatArray)(Object.values(groupedTransactions))\n .sort(function (a, b) { return new Date(b.time).valueOf() - new Date(a.time).valueOf(); });\n transactions = (0,_helpers_TransactionHelpers__WEBPACK_IMPORTED_MODULE_5__.filterAndFormatTransactions)(transactions, transactionType);\n result.push.apply(result, __spreadArray([], __read(transactions), false));\n if (result.length >= limit) {\n nextPage = \"api/v1/transactions?account.id=\".concat(accountId, \"×tamp=lt:\").concat(result[limit - 1].consensusTimestamp, \"&limit=\").concat(pageLimit);\n }\n if (!nextPage) {\n return [2 /*return*/, \"break\"];\n }\n return [2 /*return*/];\n }\n });\n };\n _c.label = 1;\n case 1:\n if (!(result.length < limit)) return [3 /*break*/, 3];\n return [5 /*yield**/, _loop_1()];\n case 2:\n state_1 = _c.sent();\n if (state_1 === \"break\")\n return [3 /*break*/, 3];\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, {\n nextPage: nextPage,\n transactions: result.slice(0, limit)\n }];\n }\n });\n });\n};\nvar getTransaction = function (network, transactionId, accountId) {\n return GET(network, \"api/v1/transactions/\".concat(transactionId))\n .then(function (x) { return x.transactions.map(function (t) {\n return {\n time: new Date(parseFloat(t.consensus_timestamp) * 1000),\n transfers: (__spreadArray(__spreadArray([], __read((t.token_transfers || [])), false), __read((t.transfers || [])), false))\n .filter(function (tt) { return tt.account !== accountId; })\n .map(function (tt) {\n tt.amount = !tt.token_id ? tt.amount / Math.pow(10, 8) : tt.amount;\n return tt;\n }),\n nftTransfers: t.nft_transfers || null,\n memo: __webpack_require__.g.atob(t.memo_base64),\n transactionId: t.transaction_id,\n fee: t.charged_tx_fee,\n type: t.name,\n consensusTimestamp: t.consensus_timestamp\n };\n }); })\n .catch(function () {\n return [];\n });\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/ApiService.ts?"); +/** + * Update a token's custom fee schedule, if permissible + */ +RequestType_RequestType.TokenFeeScheduleUpdate = new RequestType_RequestType(77); -/***/ }), +/** + * Get execution time(s) by TransactionID, if available + */ +RequestType_RequestType.NetworkGetExecutionTime = new RequestType_RequestType(78); -/***/ "./src/ParametersBuilder.ts": -/*!**********************************!*\ - !*** ./src/ParametersBuilder.ts ***! - \**********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/** + * Pause the Token + */ +RequestType_RequestType.TokenPause = new RequestType_RequestType(79); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ParametersBuilder\": function() { return /* binding */ ParametersBuilder; }\n/* harmony export */ });\n/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\n\n/**\n * ParametersBuilder is a helper class to build contract function parameters\n * @class\n * Used in {@link BladeSDK#contractCallFunction}, {@link BladeSDK#contractCallQueryFunction} and {@link BladeSDK#getParamsSignature}\n *\n * @example\n * const params = new ParametersBuilder()\n * .addAddress(\"0.0.123\")\n * .addUInt8(42)\n * .addBytes32([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F])\n * .addString(\"Hello World\")\n * .addTuple(new ParametersBuilder().addAddress(\"0.0.456\").addUInt8(42))\n * ;\n *\n */\nvar ParametersBuilder = /** @class */ (function () {\n function ParametersBuilder() {\n this.params = [];\n }\n ParametersBuilder.prototype.addAddress = function (value) {\n this.params.push({ type: \"address\", value: [value.toString()] });\n return this;\n };\n ParametersBuilder.prototype.addAddressArray = function (value) {\n this.params.push({ type: \"address[]\", value: value.map(function (v) { return v.toString(); }) });\n return this;\n };\n ParametersBuilder.prototype.addBytes32 = function (value) {\n if (!(value instanceof Uint8Array)) {\n value = Uint8Array.from(value);\n }\n if (value.length !== 32) {\n throw new Error(\"Bytes32 must be 32 bytes long\");\n }\n var encodedValue = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(\"[\".concat(value.toString(), \"]\")).toString('base64');\n this.params.push({ type: \"bytes32\", value: [encodedValue] });\n return this;\n };\n ParametersBuilder.prototype.addUInt8 = function (value) {\n this.params.push({ type: \"uint8\", value: [value.toString()] });\n return this;\n };\n ParametersBuilder.prototype.addUInt64 = function (value) {\n this.params.push({ type: \"uint64\", value: [value.toString()] });\n return this;\n };\n ParametersBuilder.prototype.addUInt64Array = function (value) {\n this.params.push({ type: \"uint64[]\", value: value.map(function (v) { return v.toString(); }) });\n return this;\n };\n ParametersBuilder.prototype.addInt64 = function (value) {\n this.params.push({ type: \"int64\", value: [value.toString()] });\n return this;\n };\n ParametersBuilder.prototype.addUInt256 = function (value) {\n this.params.push({ type: \"uint256\", value: [value.toString()] });\n return this;\n };\n ParametersBuilder.prototype.addUInt256Array = function (value) {\n this.params.push({ type: \"uint256[]\", value: value.map(function (v) { return v.toString(); }) });\n return this;\n };\n ParametersBuilder.prototype.addTuple = function (value) {\n this.params.push({ type: \"tuple\", value: [value.encode()] });\n return this;\n };\n ParametersBuilder.prototype.addTupleArray = function (value) {\n this.params.push({ type: \"tuple[]\", value: value.map(function (val) { return val.encode(); }) });\n return this;\n };\n ParametersBuilder.prototype.addString = function (value) {\n this.params.push({ type: \"string\", value: [value] });\n return this;\n };\n ParametersBuilder.prototype.addStringArray = function (value) {\n this.params.push({ type: \"string[]\", value: value });\n return this;\n };\n /**\n * Encodes the parameters to a base64 string, compatible with the methods of the BladeSDK\n * Calling this method is optional, as the BladeSDK will automatically encode the parameters if needed\n */\n ParametersBuilder.prototype.encode = function () {\n return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(JSON.stringify(this.params)).toString(\"base64\");\n };\n return ParametersBuilder;\n}());\n\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/ParametersBuilder.ts?"); +/** + * Unpause the Token + */ +RequestType_RequestType.TokenUnpause = new RequestType_RequestType(80); -/***/ }), +/** + * Approve allowance for a spender relative to the owner account + */ +RequestType_RequestType.CryptoApproveAllowance = new RequestType_RequestType(81); -/***/ "./src/config.ts": -/*!***********************!*\ - !*** ./src/config.ts ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/** + * Deletes granted allowances on owner account + */ +RequestType_RequestType.CryptoDeleteAllowance = new RequestType_RequestType(82); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n// Autogenerated file. Please check utils/fixConfig.js\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n sdkVersion: \"BladeSDK.js@0.6.0\",\n numberVersion: \"0.6.0\",\n});\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/config.ts?"); +/** + * Gets all the information about an account, including balance and allowances. This does not get the list of + * account records. + */ +RequestType_RequestType.GetAccountDetails = new RequestType_RequestType(83); -/***/ }), +/** + * Ethereum Transaction + */ +RequestType_RequestType.EthereumTransaction = new RequestType_RequestType(84); -/***/ "./src/fallback/unity/brorand.js": -/*!***************************************!*\ - !*** ./src/fallback/unity/brorand.js ***! - \***************************************/ -/***/ (function(module) { +/** + * Updates the staking info at the end of staking period to indicate new staking period has started. + */ +RequestType_RequestType.NodeStakeUpdate = new RequestType_RequestType(85); -eval("var r;\nmodule.exports = function rand(len) {\n if (!r)\n r = new Rand(null);\n return r.generate(len);\n};\nfunction Rand(rand) {\n this.rand = rand;\n}\nmodule.exports.Rand = Rand;\nRand.prototype.generate = function generate(len) {\n return this._rand(len);\n};\n// Emulate crypto API using randy\nRand.prototype._rand = function _rand(n) {\n var res = new Uint8Array(n);\n for (var i = 0; i < res.length; i++)\n res[i] = (Math.random() * 256) & 0xff;\n return res;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/fallback/unity/brorand.js?"); +/** + * Generates a pseudorandom number. + */ +RequestType_RequestType.Prng = new RequestType_RequestType(86); -/***/ }), +/** + * Get a record for a transaction (lasts 180 seconds) + */ +RequestType_RequestType.TransactionGetFastRecord = new RequestType_RequestType(87); -/***/ "./src/helpers/ArrayHelpers.ts": -/*!*************************************!*\ - !*** ./src/helpers/ArrayHelpers.ts ***! - \*************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/** + * Update the metadata of one or more NFT's of a specific token type. + */ +RequestType_RequestType.TokenUpdateNfts = new RequestType_RequestType(88); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"flatArray\": function() { return /* binding */ flatArray; }\n/* harmony export */ });\nvar __values = (undefined && undefined.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nvar __read = (undefined && undefined.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar flatArray = function (array) {\n var e_1, _a;\n var result = [];\n if (array && Array.isArray(array)) {\n try {\n for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {\n var value = array_1_1.value;\n if (Array.isArray(value)) {\n result.push.apply(result, __spreadArray([], __read(value), false));\n }\n else {\n result.push(value);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n return result;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/helpers/ArrayHelpers.ts?"); +/** + * A transaction body for a `createNode` request. + */ +RequestType_RequestType.NodeCreate = new RequestType_RequestType(89); -/***/ }), +/** + * A transaction body for an `updateNode` request. + */ +RequestType_RequestType.NodeUpdate = new RequestType_RequestType(90); -/***/ "./src/helpers/ContractHelpers.ts": -/*!****************************************!*\ - !*** ./src/helpers/ContractHelpers.ts ***! - \****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/** + * A transaction body for a `deleteNode` request. + */ +RequestType_RequestType.NodeDelete = new RequestType_RequestType(91); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"getContractFunctionBytecode\": function() { return /* binding */ getContractFunctionBytecode; },\n/* harmony export */ \"parseContractFunctionParams\": function() { return /* binding */ parseContractFunctionParams; },\n/* harmony export */ \"parseContractQueryResponse\": function() { return /* binding */ parseContractQueryResponse; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/sdk */ \"./node_modules/@hashgraph/sdk/src/browser.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/abi/lib.esm/interface.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/abi/lib.esm/fragments.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/abi/lib.esm/abi-coder.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\n/* harmony import */ var _ParametersBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ParametersBuilder */ \"./src/ParametersBuilder.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n\n\nvar getContractFunctionBytecode = function (functionName, paramsEncoded) { return __awaiter(void 0, void 0, void 0, function () {\n var _a, types, values, functionSignature, functionIdentifier, abiCoder, encodedBytes;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, parseContractFunctionParams(paramsEncoded)];\n case 1:\n _a = _b.sent(), types = _a.types, values = _a.values;\n functionSignature = \"\".concat(functionName, \"(\").concat(types.join(\",\"), \")\");\n functionIdentifier = new _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_3__.Interface([\n _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_4__.FunctionFragment.from(functionSignature)\n ]).getSighash(functionName);\n abiCoder = new _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_5__.AbiCoder();\n encodedBytes = abiCoder.encode(types, values);\n return [2 /*return*/, buffer__WEBPACK_IMPORTED_MODULE_1__.Buffer.concat([\n _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_6__.arrayify(functionIdentifier),\n _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_6__.arrayify(encodedBytes)\n ])];\n }\n });\n}); };\nvar parseContractFunctionParams = function (paramsEncoded) { return __awaiter(void 0, void 0, void 0, function () {\n var types, values, paramsData, i, param, _a, _b, _c, result, i_1, _d, _e, result, result, i_2, _f, _g, tupleTypes, i_3;\n return __generator(this, function (_h) {\n switch (_h.label) {\n case 0:\n types = [];\n values = [];\n if (paramsEncoded instanceof _ParametersBuilder__WEBPACK_IMPORTED_MODULE_2__.ParametersBuilder) {\n paramsEncoded = paramsEncoded.encode();\n }\n paramsData = JSON.parse(buffer__WEBPACK_IMPORTED_MODULE_1__.Buffer.from(paramsEncoded, \"base64\").toString());\n i = 0;\n _h.label = 1;\n case 1:\n if (!(i < paramsData.length)) return [3 /*break*/, 23];\n param = paramsData[i];\n _a = param === null || param === void 0 ? void 0 : param.type;\n switch (_a) {\n case \"address\": return [3 /*break*/, 2];\n case \"address[]\": return [3 /*break*/, 4];\n case \"bytes32\": return [3 /*break*/, 9];\n case \"uint8\": return [3 /*break*/, 10];\n case \"int64\": return [3 /*break*/, 10];\n case \"uint64\": return [3 /*break*/, 10];\n case \"uint256\": return [3 /*break*/, 10];\n case \"uint64[]\": return [3 /*break*/, 11];\n case \"uint256[]\": return [3 /*break*/, 11];\n case \"tuple\": return [3 /*break*/, 12];\n case \"tuple[]\": return [3 /*break*/, 14];\n case \"string\": return [3 /*break*/, 19];\n case \"string[]\": return [3 /*break*/, 20];\n }\n return [3 /*break*/, 21];\n case 2:\n // [\"0.0.48619523\"]\n types.push(param.type);\n _c = (_b = values).push;\n return [4 /*yield*/, valueToSolidity(param.value[0])];\n case 3:\n _c.apply(_b, [_h.sent()]);\n return [3 /*break*/, 22];\n case 4:\n result = [];\n i_1 = 0;\n _h.label = 5;\n case 5:\n if (!(i_1 < param.value.length)) return [3 /*break*/, 8];\n _e = (_d = result).push;\n return [4 /*yield*/, valueToSolidity(param.value[i_1])];\n case 6:\n _e.apply(_d, [_h.sent()]);\n _h.label = 7;\n case 7:\n i_1++;\n return [3 /*break*/, 5];\n case 8:\n types.push(param.type);\n values.push(result);\n return [3 /*break*/, 22];\n case 9:\n {\n // \"WzAsMSwyLDMsNCw1LDYsNyw4LDksMTAsMTEsMTIsMTMsMTQsMTUsMTYsMTcsMTgsMTksMjAsMjEsMjIsMjMsMjQsMjUsMjYsMjcsMjgsMjksMzAsMzFd\"\n // base64 decode -> json parse -> data\n types.push(param.type);\n values.push(Uint8Array.from(JSON.parse(atob(param.value[0]))));\n }\n return [3 /*break*/, 22];\n case 10:\n {\n types.push(param.type);\n values.push(param.value[0]);\n }\n return [3 /*break*/, 22];\n case 11:\n {\n types.push(param.type);\n values.push(param.value);\n }\n return [3 /*break*/, 22];\n case 12: return [4 /*yield*/, parseContractFunctionParams(param.value[0])];\n case 13:\n result = _h.sent();\n types.push(\"(\".concat(result.types, \")\"));\n values.push(result.values);\n return [3 /*break*/, 22];\n case 14:\n result = [];\n i_2 = 0;\n _h.label = 15;\n case 15:\n if (!(i_2 < param.value.length)) return [3 /*break*/, 18];\n _g = (_f = result).push;\n return [4 /*yield*/, parseContractFunctionParams(param.value[i_2])];\n case 16:\n _g.apply(_f, [_h.sent()]);\n _h.label = 17;\n case 17:\n i_2++;\n return [3 /*break*/, 15];\n case 18:\n tupleTypes = result[0].types.toString();\n for (i_3 = 1; i_3 < result.length; i_3++) {\n if (result[i_3].types.toString() !== tupleTypes) {\n throw {\n name: \"BladeSDK.JS\",\n reason: \"Tuple structure in array must be the same\"\n };\n }\n }\n types.push(\"(\".concat(result[0].types, \")[]\"));\n values.push(result.map(function (_a) {\n var values = _a.values;\n return values;\n }));\n return [3 /*break*/, 22];\n case 19:\n {\n types.push(param.type);\n values.push(param.value[0]);\n }\n return [3 /*break*/, 22];\n case 20:\n {\n types.push(param.type);\n values.push(param.value);\n }\n return [3 /*break*/, 22];\n case 21:\n {\n throw {\n name: \"BladeSDK.JS\",\n reason: \"Type \\\"\".concat(param === null || param === void 0 ? void 0 : param.type, \"\\\" not implemented on JS\")\n };\n }\n _h.label = 22;\n case 22:\n i++;\n return [3 /*break*/, 1];\n case 23: return [2 /*return*/, { types: types, values: values }];\n }\n });\n}); };\nvar valueToSolidity = function (value) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n // if input.length >=32 - return as EVM address\n // else convert input to solidity\n if (value.length >= 32) {\n return [2 /*return*/, value];\n }\n else {\n return [2 /*return*/, \"0x\".concat(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_0__.AccountId.fromString(value).toSolidityAddress())];\n }\n return [2 /*return*/];\n });\n}); };\nvar parseContractQueryResponse = function (contractFunctionResult, resultTypes) { return __awaiter(void 0, void 0, void 0, function () {\n var result, availableTypes;\n return __generator(this, function (_a) {\n result = [];\n availableTypes = [\"bytes32\", \"address\", \"string\", \"bool\", \"int32\", \"uint32\", \"int40\", \"uint40\", \"int48\", \"uint48\", \"int56\", \"uint56\", \"int64\", \"uint64\", \"int72\", \"uint72\", \"int80\", \"uint80\", \"int88\", \"uint88\", \"int96\", \"uint96\", \"int104\", \"uint104\", \"int112\", \"uint112\", \"int120\", \"uint120\", \"int128\", \"uint128\", \"int136\", \"uint136\", \"int144\", \"uint144\", \"int152\", \"uint152\", \"int160\", \"uint160\", \"int168\", \"uint168\", \"int176\", \"uint176\", \"int184\", \"uint184\", \"int192\", \"uint192\", \"int200\", \"uint200\", \"int208\", \"uint208\", \"int216\", \"uint216\", \"int224\", \"uint224\", \"int232\", \"uint232\", \"int240\", \"uint240\", \"int248\", \"uint248\", \"int256\", \"uint256\"];\n resultTypes.forEach(function (type, index) {\n type = type.toLowerCase();\n if (!availableTypes.includes(type)) {\n throw {\n name: \"BladeSDK.JS\",\n reason: \"Type '\".concat(type, \"' unsupported. Available types: \").concat(availableTypes.join(\", \"))\n };\n }\n var method = \"get\".concat(type.slice(0, 1).toUpperCase()).concat(type.slice(1));\n // @ts-ignore\n var value = contractFunctionResult[method](index).toString();\n if (type === \"bytes32\") {\n value = buffer__WEBPACK_IMPORTED_MODULE_1__.Buffer.from(value).toString(\"hex\");\n }\n result.push({ type: type, value: value });\n });\n return [2 /*return*/, result];\n });\n}); };\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/helpers/ContractHelpers.ts?"); +/** + * Transfer one or more token balances held by the requesting account to the treasury for each token type. + */ +RequestType_RequestType.TokenReject = new RequestType_RequestType(92); -/***/ }), +/** + * Airdrop one or more tokens to one or more accounts. + */ +RequestType_RequestType.TokenAirdrop = new RequestType_RequestType(93); -/***/ "./src/helpers/SecurityHelper.ts": -/*!***************************************!*\ - !*** ./src/helpers/SecurityHelper.ts ***! - \***************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +/** + * Remove one or more pending airdrops from state on behalf of the sender(s) for each airdrop. + */ +RequestType_RequestType.TokenCancelAirdrop = new RequestType_RequestType(94); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decrypt\": function() { return /* binding */ decrypt; },\n/* harmony export */ \"encrypt\": function() { return /* binding */ encrypt; }\n/* harmony export */ });\n/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (undefined && undefined.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar crypto = __webpack_require__(/*! crypto */ \"./node_modules/crypto-browserify/index.js\");\n\nvar CIPHER_IV_LENGTH = 12;\nvar CIPHER_KEY_LENGTH = 32;\nvar MAGIC_IV_INDEX = 3;\nvar encrypt = function (data, token, env) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(env === \"browser\")) return [3 /*break*/, 2];\n return [4 /*yield*/, encryptBrowser(data, token)];\n case 1: return [2 /*return*/, _a.sent()];\n case 2: return [4 /*yield*/, encryptNode(data, token)];\n case 3: return [2 /*return*/, _a.sent()];\n }\n });\n}); };\nvar encryptBrowser = function (data, token) { return __awaiter(void 0, void 0, void 0, function () {\n var encoder, ivStr, iv, tokenIdx, tokenArr, rawKey, i, key, encoded, cipher;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n encoder = new TextEncoder();\n ivStr = generateRandomString(CIPHER_IV_LENGTH);\n iv = encoder.encode(ivStr);\n tokenIdx = iv[MAGIC_IV_INDEX];\n tokenArr = encoder.encode(token);\n rawKey = new Uint8Array(CIPHER_KEY_LENGTH);\n for (i = 0; i < CIPHER_KEY_LENGTH; i++) {\n rawKey[i] = tokenArr[(i + tokenIdx) % tokenArr.length];\n }\n return [4 /*yield*/, window.crypto.subtle.importKey(\"raw\", rawKey, {\n name: \"AES-GCM\",\n }, false, [\"encrypt\", \"decrypt\"])];\n case 1:\n key = _a.sent();\n encoded = encoder.encode(data);\n return [4 /*yield*/, window.crypto.subtle.encrypt({\n name: 'AES-GCM',\n iv: iv,\n }, key, encoded)];\n case 2:\n cipher = _a.sent();\n return [2 /*return*/, btoa(ivStr + String.fromCharCode.apply(null, __spreadArray([], __read(new Uint8Array(cipher)), false)))];\n }\n });\n}); };\nvar encryptNode = function (data, token) { return __awaiter(void 0, void 0, void 0, function () {\n var ivStr, iv, tokenIdx, tokenBuffer, rawKey, i, cipher, nonceCiphertextTag;\n return __generator(this, function (_a) {\n ivStr = generateRandomString(CIPHER_IV_LENGTH);\n iv = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(ivStr, 'utf8');\n tokenIdx = iv[MAGIC_IV_INDEX];\n tokenBuffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(token, 'utf8');\n rawKey = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(CIPHER_KEY_LENGTH);\n for (i = 0; i < CIPHER_KEY_LENGTH; i++) {\n rawKey[i] = tokenBuffer[(i + tokenIdx) % tokenBuffer.length];\n }\n cipher = crypto.createCipheriv('aes-256-gcm', rawKey, iv);\n nonceCiphertextTag = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([\n iv,\n cipher.update(data),\n cipher.final(),\n cipher.getAuthTag() // Fix: Get tag with cipher.getAuthTag() and concatenate: nonce|ciphertext|tag\n ]);\n return [2 /*return*/, nonceCiphertextTag.toString('base64')];\n });\n}); };\nvar decrypt = function (cipherStr, token) { return __awaiter(void 0, void 0, void 0, function () {\n var encoder, decoder, cipher, ivStr, cipherDataStr, iv, tokenIdx, tokenArr, rawKey, i, key, buffer, bufferView, i, deciphered;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n encoder = new TextEncoder();\n decoder = new TextDecoder();\n cipher = atob(cipherStr);\n ivStr = cipher.substring(0, CIPHER_IV_LENGTH);\n cipherDataStr = cipher.substring(CIPHER_IV_LENGTH);\n iv = encoder.encode(ivStr);\n tokenIdx = iv[MAGIC_IV_INDEX];\n tokenArr = encoder.encode(token);\n rawKey = new Uint8Array(CIPHER_KEY_LENGTH);\n for (i = 0; i < CIPHER_KEY_LENGTH; i++) {\n rawKey[i] = tokenArr[(i + tokenIdx) % tokenArr.length];\n }\n return [4 /*yield*/, window.crypto.subtle.importKey(\"raw\", rawKey, {\n name: \"AES-GCM\",\n }, false, [\"encrypt\", \"decrypt\"])];\n case 1:\n key = _a.sent();\n buffer = new ArrayBuffer(cipherDataStr.length);\n bufferView = new Uint8Array(buffer);\n for (i = 0; i < cipherDataStr.length; i++) {\n bufferView[i] = cipherDataStr.charCodeAt(i);\n }\n return [4 /*yield*/, window.crypto.subtle.decrypt({\n name: 'AES-GCM',\n iv: iv,\n }, key, buffer)];\n case 2:\n deciphered = _a.sent();\n return [2 /*return*/, decoder.decode(deciphered)];\n }\n });\n}); };\nvar generateRandomString = function (length) {\n var result = \"\";\n var characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n return result;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/helpers/SecurityHelper.ts?"); +/** + * Claim one or more pending airdrops + */ +RequestType_RequestType.TokenClaimAirdrop = new RequestType_RequestType(95); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/TransactionFeeSchedule.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./src/helpers/StringHelpers.ts": -/*!**************************************!*\ - !*** ./src/helpers/StringHelpers.ts ***! - \**************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\nvar StringHelpers = /** @class */ (function () {\n function StringHelpers() {\n }\n StringHelpers.stringToNetwork = function (str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n };\n return StringHelpers;\n}());\n/* harmony default export */ __webpack_exports__[\"default\"] = (StringHelpers);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/helpers/StringHelpers.ts?"); -/***/ }), -/***/ "./src/helpers/TransactionHelpers.ts": -/*!*******************************************!*\ - !*** ./src/helpers/TransactionHelpers.ts ***! - \*******************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +class TransactionFeeSchedule_TransactionFeeSchedule { + /** + * @param {object} [props] + * @param {RequestType} [props.hederaFunctionality] + * @param {FeeData} [props.feeData] + * @param {FeeData[]} [props.fees] + */ + constructor(props = {}) { + /* + * A particular transaction or query + * + * @type {RequestType} + */ + this.hederaFunctionality = props.hederaFunctionality; + + /* + * Resource price coefficients + * + * @type {FeeData} + */ + this.feeData = props.feeData; + + /* + * Resource price coefficients + * + * @type {FeeData[]} + */ + this.fees = props.fees; + } + + /** + * @param {Uint8Array} bytes + * @returns {TransactionFeeSchedule} + */ + static fromBytes(bytes) { + return TransactionFeeSchedule_TransactionFeeSchedule._fromProtobuf( + HashgraphProto.proto.TransactionFeeSchedule.decode(bytes), + ); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransactionFeeSchedule} transactionFeeSchedule + * @returns {TransactionFeeSchedule} + */ + static _fromProtobuf(transactionFeeSchedule) { + return new TransactionFeeSchedule_TransactionFeeSchedule({ + hederaFunctionality: + transactionFeeSchedule.hederaFunctionality != null + ? RequestType._fromCode( + transactionFeeSchedule.hederaFunctionality, + ) + : undefined, + feeData: + transactionFeeSchedule.feeData != null + ? FeeData._fromProtobuf(transactionFeeSchedule.feeData) + : undefined, + fees: + transactionFeeSchedule.fees != null + ? transactionFeeSchedule.fees.map((fee) => + FeeData._fromProtobuf(fee), + ) + : undefined, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ITransactionFeeSchedule} + */ + _toProtobuf() { + return { + hederaFunctionality: + this.hederaFunctionality != null + ? this.hederaFunctionality.valueOf() + : undefined, + feeData: + this.feeData != null ? this.feeData._toProtobuf() : undefined, + fees: + this.fees != null + ? this.fees.map((fee) => fee._toProtobuf()) + : undefined, + }; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return HashgraphProto.proto.TransactionFeeSchedule.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/FeeSchedule.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"filterAndFormatTransactions\": function() { return /* binding */ filterAndFormatTransactions; }\n/* harmony export */ });\nvar filterAndFormatTransactions = function (transactions, transactionType) {\n switch (transactionType) {\n case \"CRYPTOTRANSFERTOKEN\":\n {\n transactions = transactions\n .filter(function (tx) {\n if (tx.type !== \"CRYPTOTRANSFER\") {\n return false;\n }\n var tokenTransfer = tx.transfers.find(function (transfer) { return transfer.token_id; });\n if (tokenTransfer) {\n tx.plainData = {\n type: transactionType,\n token_id: tokenTransfer.token_id,\n account: tokenTransfer.account,\n amount: tokenTransfer.amount\n };\n return true;\n }\n else {\n return false;\n }\n });\n }\n break;\n default: {\n if (transactionType) {\n transactions = transactions.filter(function (tx) { return tx.type === transactionType; });\n }\n }\n }\n return transactions;\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/helpers/TransactionHelpers.ts?"); -/***/ }), -/***/ "./src/models/Common.ts": -/*!******************************!*\ - !*** ./src/models/Common.ts ***! - \******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AccountStatus\": function() { return /* binding */ AccountStatus; },\n/* harmony export */ \"EncryptedType\": function() { return /* binding */ EncryptedType; },\n/* harmony export */ \"Environment\": function() { return /* binding */ Environment; },\n/* harmony export */ \"SdkEnvironment\": function() { return /* binding */ SdkEnvironment; }\n/* harmony export */ });\nvar SdkEnvironment;\n(function (SdkEnvironment) {\n SdkEnvironment[\"Prod\"] = \"Prod\";\n SdkEnvironment[\"CI\"] = \"CI\";\n})(SdkEnvironment || (SdkEnvironment = {}));\nvar Environment;\n(function (Environment) {\n Environment[\"browser\"] = \"browser\";\n Environment[\"node\"] = \"node\";\n})(Environment || (Environment = {}));\nvar EncryptedType;\n(function (EncryptedType) {\n EncryptedType[\"tvte\"] = \"tvte\";\n EncryptedType[\"vte\"] = \"vte\";\n})(EncryptedType || (EncryptedType = {}));\nvar AccountStatus;\n(function (AccountStatus) {\n AccountStatus[\"PENDING\"] = \"PENDING\";\n AccountStatus[\"SUCCESS\"] = \"SUCCESS\";\n AccountStatus[\"RETRY\"] = \"RETRY\";\n AccountStatus[\"FAILED\"] = \"FAILED\";\n})(AccountStatus || (AccountStatus = {}));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/models/Common.ts?"); -/***/ }), +class FeeSchedule_FeeSchedule { + /** + * @param {object} [props] + * @param {TransactionFeeSchedule[]} [props.transactionFeeSchedule] + * @param {Timestamp} [props.expirationTime] + */ + constructor(props = {}) { + /* + * List of price coefficients for network resources + * + * @type {TransactionFeeSchedule} + */ + this.transactionFeeSchedule = props.transactionFeeSchedule; + + /* + * FeeSchedule expiry time + * + * @type {Timestamp} + */ + this.expirationTime = props.expirationTime; + } + + /** + * @param {Uint8Array} bytes + * @returns {FeeSchedule} + */ + static fromBytes(bytes) { + return FeeSchedule_FeeSchedule._fromProtobuf( + HashgraphProto.proto.FeeSchedule.decode(bytes), + ); + } + + /** + * @internal + * @param {HashgraphProto.proto.IFeeSchedule} feeSchedule + * @returns {FeeSchedule} + */ + static _fromProtobuf(feeSchedule) { + return new FeeSchedule_FeeSchedule({ + transactionFeeSchedule: + feeSchedule.transactionFeeSchedule != null + ? feeSchedule.transactionFeeSchedule.map((schedule) => + TransactionFeeSchedule._fromProtobuf(schedule), + ) + : undefined, + expirationTime: + feeSchedule.expiryTime != null + ? Timestamp._fromProtobuf(feeSchedule.expiryTime) + : undefined, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IFeeSchedule} + */ + _toProtobuf() { + return { + transactionFeeSchedule: + this.transactionFeeSchedule != null + ? this.transactionFeeSchedule.map((transaction) => + transaction._toProtobuf(), + ) + : undefined, + expiryTime: + this.expirationTime != null + ? this.expirationTime._toProtobuf() + : undefined, + }; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return HashgraphProto.proto.FeeSchedule.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/FeeSchedules.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./src/models/Networks.ts": -/*!********************************!*\ - !*** ./src/models/Networks.ts ***! - \********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Network\": function() { return /* binding */ Network; },\n/* harmony export */ \"NetworkMirrorNodes\": function() { return /* binding */ NetworkMirrorNodes; }\n/* harmony export */ });\nvar _a;\nvar Network;\n(function (Network) {\n Network[\"Mainnet\"] = \"Mainnet\";\n Network[\"Testnet\"] = \"Testnet\";\n})(Network || (Network = {}));\nvar NetworkMirrorNodes = (_a = {},\n _a[Network.Mainnet] = \"https://mainnet-public.mirrornode.hedera.com\",\n _a[Network.Testnet] = \"https://testnet.mirrornode.hedera.com\",\n _a);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/models/Networks.ts?"); -/***/ }), -/***/ "./src/unity.ts": -/*!**********************!*\ - !*** ./src/unity.ts ***! - \**********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { +class FeeSchedules { + /** + * @param {object} [props] + * @param {FeeSchedule} [props.currentFeeSchedule] + * @param {FeeSchedule} [props.nextFeeSchedule] + */ + constructor(props = {}) { + /* + * Contains current Fee Schedule + * + * @type {FeeSchedule} + */ + this.current = props.currentFeeSchedule; + + /* + * Contains next Fee Schedule + * + * @type {FeeSchedule} + */ + this.next = props.nextFeeSchedule; + } + + /** + * @param {Uint8Array} bytes + * @returns {FeeSchedules} + */ + static fromBytes(bytes) { + return FeeSchedules._fromProtobuf( + HashgraphProto.proto.CurrentAndNextFeeSchedule.decode(bytes), + ); + } + + /** + * @internal + * @param {HashgraphProto.proto.ICurrentAndNextFeeSchedule} feeSchedules + * @returns {FeeSchedules} + */ + static _fromProtobuf(feeSchedules) { + return new FeeSchedules({ + currentFeeSchedule: + feeSchedules.currentFeeSchedule != null + ? FeeSchedule._fromProtobuf(feeSchedules.currentFeeSchedule) + : undefined, + nextFeeSchedule: + feeSchedules.nextFeeSchedule != null + ? FeeSchedule._fromProtobuf(feeSchedules.nextFeeSchedule) + : undefined, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ICurrentAndNextFeeSchedule} + */ + _toProtobuf() { + return { + currentFeeSchedule: + this.current != null ? this.current._toProtobuf() : undefined, + nextFeeSchedule: + this.next != null ? this.next._toProtobuf() : undefined, + }; + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return HashgraphProto.proto.CurrentAndNextFeeSchedule.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileContentsQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BladeUnitySDK\": function() { return /* binding */ BladeUnitySDK; }\n/* harmony export */ });\n/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\n/* harmony import */ var text_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! text-encoding */ \"./node_modules/text-encoding/index.js\");\n/* harmony import */ var text_encoding__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(text_encoding__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hashgraph/sdk */ \"./node_modules/@hashgraph/sdk/src/browser.js\");\n/* harmony import */ var _models_Common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./models/Common */ \"./src/models/Common.ts\");\n/* harmony import */ var _models_Networks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./models/Networks */ \"./src/models/Networks.ts\");\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./config */ \"./src/config.ts\");\n/* harmony import */ var _helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers/StringHelpers */ \"./src/helpers/StringHelpers.ts\");\n/* harmony import */ var _ApiService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ApiService */ \"./src/ApiService.ts\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/transactions/lib.esm/index.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@hethers/wallet/lib.esm/index.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @hashgraph/hethers */ \"./node_modules/@ethersproject/abi/lib.esm/abi-coder.js\");\n/* harmony import */ var _helpers_ContractHelpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helpers/ContractHelpers */ \"./src/helpers/ContractHelpers.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n\n\n\n\n\n\n\n\nObject.assign(globalThis, {\n unityEnv: true,\n Buffer: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer,\n TextEncoder: text_encoding__WEBPACK_IMPORTED_MODULE_1__.TextEncoder,\n TextDecoder: text_encoding__WEBPACK_IMPORTED_MODULE_1__.TextDecoder,\n btoa: function (str) { return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(str, \"binary\").toString(\"base64\"); },\n});\nvar BladeUnitySDK = /** @class */ (function () {\n function BladeUnitySDK() {\n this.apiKey = \"\";\n this.network = _models_Networks__WEBPACK_IMPORTED_MODULE_4__.Network.Testnet;\n this.dAppCode = \"\";\n this.visitorId = \"\";\n this.sdkEnvironment = _models_Common__WEBPACK_IMPORTED_MODULE_3__.SdkEnvironment.Prod;\n this.sdkVersion = _config__WEBPACK_IMPORTED_MODULE_5__[\"default\"].sdkVersion;\n }\n BladeUnitySDK.prototype.init = function (apiKey, network, dAppCode, visitorId, sdkEnvironment, sdkVersion) {\n if (sdkEnvironment === void 0) { sdkEnvironment = _models_Common__WEBPACK_IMPORTED_MODULE_3__.SdkEnvironment.Prod; }\n if (sdkVersion === void 0) { sdkVersion = _config__WEBPACK_IMPORTED_MODULE_5__[\"default\"].sdkVersion; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n this.apiKey = apiKey;\n this.network = _helpers_StringHelpers__WEBPACK_IMPORTED_MODULE_6__[\"default\"].stringToNetwork(network);\n this.dAppCode = dAppCode;\n this.visitorId = visitorId;\n this.sdkEnvironment = sdkEnvironment;\n this.sdkVersion = sdkVersion;\n (0,_ApiService__WEBPACK_IMPORTED_MODULE_7__.initApiService)(sdkVersion, visitorId, apiKey, sdkEnvironment);\n return [2 /*return*/, {\n apiKey: this.apiKey,\n dAppCode: this.dAppCode,\n network: this.network,\n visitorId: this.visitorId,\n sdkEnvironment: this.sdkEnvironment,\n sdkVersion: this.sdkVersion,\n nonce: Math.round(Math.random() * 1000000000)\n }];\n });\n });\n };\n BladeUnitySDK.prototype.transferHbars = function (accountId, accountPrivateKey, receiverID, amount, memo) {\n return __awaiter(this, void 0, void 0, function () {\n var client, parsedAmount, tx, _a, _b, error_1;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 2, , 3]);\n client = this.getClient();\n client.setOperator(accountId, accountPrivateKey);\n parsedAmount = parseFloat(amount);\n _b = (_a = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer).from;\n return [4 /*yield*/, (new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.TransferTransaction()\n .addHbarTransfer(receiverID, parsedAmount)\n .addHbarTransfer(accountId, -1 * parsedAmount)\n .setTransactionMemo(memo)\n .freezeWith(client)\n .sign(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(accountPrivateKey)))];\n case 1:\n tx = _b.apply(_a, [(_c.sent()).toBytes()]).toString('hex');\n return [2 /*return*/, this.sendMessageToNative({\n tx: tx,\n network: this.network,\n })];\n case 2:\n error_1 = _c.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_1)];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.signTransaction = function (transactionBytes, encoding, accountPrivateKey) {\n return __awaiter(this, void 0, void 0, function () {\n var buffer, transaction, tx, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(transactionBytes, encoding);\n transaction = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.Transaction.fromBytes(buffer);\n _b = (_a = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer).from;\n return [4 /*yield*/, transaction.sign(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(accountPrivateKey))];\n case 1:\n tx = _b.apply(_a, [(_c.sent()).toBytes()]).toString(\"hex\");\n return [2 /*return*/, this.sendMessageToNative({\n tx: tx,\n network: this.network,\n })];\n }\n });\n });\n };\n BladeUnitySDK.prototype.getEncryptedToken = function (type) {\n if (type === void 0) { type = _models_Common__WEBPACK_IMPORTED_MODULE_3__.EncryptedType.tvte; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, error_2;\n var _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 2, , 3]);\n _a = this.sendMessageToNative;\n _b = {};\n return [4 /*yield*/, (0,_ApiService__WEBPACK_IMPORTED_MODULE_7__.getEncryptedHeader)(_models_Common__WEBPACK_IMPORTED_MODULE_3__.Environment.node, type)];\n case 1: return [2 /*return*/, _a.apply(this, [(_b.value = _c.sent(),\n _b)])];\n case 2:\n error_2 = _c.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_2)];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.transferTokens = function (tokenId, accountId, accountPrivateKey, receiverID, correctedAmount, memo) {\n return __awaiter(this, void 0, void 0, function () {\n var client, tx, _a, _b, error_3;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 2, , 3]);\n client = this.getClient();\n client.setOperator(accountId, accountPrivateKey);\n _b = (_a = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer).from;\n return [4 /*yield*/, (new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.TransferTransaction()\n .addTokenTransfer(tokenId, receiverID, correctedAmount)\n .addTokenTransfer(tokenId, accountId, -1 * correctedAmount)\n .setTransactionMemo(memo)\n .freezeWith(client)\n .sign(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(accountPrivateKey)))];\n case 1:\n tx = _b.apply(_a, [(_c.sent()).toBytes()]).toString('hex');\n return [2 /*return*/, this.sendMessageToNative({\n tx: tx,\n network: this.network,\n })];\n case 2:\n error_3 = _c.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_3)];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.getAccountInfo = function (accountId, evmAddress, publicKey) {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n try {\n result = {\n accountId: accountId,\n evmAddress: (evmAddress ? evmAddress : \"0x\".concat(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.AccountId.fromString(accountId).toSolidityAddress())),\n calculatedEvmAddress: _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_9__.computeAddress(\"0x\".concat(publicKey)).toLowerCase()\n };\n return [2 /*return*/, this.sendMessageToNative(result)];\n }\n catch (error) {\n return [2 /*return*/, this.sendMessageToNative(null, error)];\n }\n return [2 /*return*/];\n });\n });\n };\n BladeUnitySDK.prototype.generateKeys = function () {\n return __awaiter(this, void 0, void 0, function () {\n var privateKey, publicKey;\n return __generator(this, function (_a) {\n try {\n privateKey = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.generateECDSA();\n publicKey = privateKey.publicKey.toStringDer();\n return [2 /*return*/, this.sendMessageToNative({\n privateKey: privateKey.toStringDer(),\n publicKey: publicKey,\n evmAddress: _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_9__.computeAddress(\"0x\".concat(privateKey.publicKey.toStringRaw()))\n })];\n }\n catch (error) {\n return [2 /*return*/, this.sendMessageToNative(null, error)];\n }\n return [2 /*return*/];\n });\n });\n };\n BladeUnitySDK.prototype.deleteAccount = function (deleteAccountId, deletePrivateKey, transferAccountId, operatorAccountId, operatorPrivateKey) {\n return __awaiter(this, void 0, void 0, function () {\n var client, deleteAccountKey, operatorAccountKey, transaction, tx, error_4;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 3, , 4]);\n client = this.getClient();\n deleteAccountKey = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(deletePrivateKey);\n operatorAccountKey = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(operatorPrivateKey);\n client.setOperator(operatorAccountId, operatorAccountKey);\n return [4 /*yield*/, (new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.AccountDeleteTransaction()\n .setAccountId(deleteAccountId)\n .setTransferAccountId(transferAccountId)\n .freezeWith(client)\n .sign(deleteAccountKey))];\n case 1: return [4 /*yield*/, (_a.sent()).sign(operatorAccountKey)];\n case 2:\n transaction = _a.sent();\n tx = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(transaction.toBytes()).toString('hex');\n return [2 /*return*/, this.sendMessageToNative({\n tx: tx,\n network: this.network,\n })];\n case 3:\n error_4 = _a.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_4)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.contractCallFunctionTransaction = function (contractId, functionName, paramsEncoded, accountId, accountPrivateKey, gas) {\n if (gas === void 0) { gas = 100000; }\n return __awaiter(this, void 0, void 0, function () {\n var client, contractFunctionParameters, transaction, tx, error_5;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 3, , 4]);\n client = this.getClient();\n client.setOperator(accountId, accountPrivateKey);\n return [4 /*yield*/, (0,_helpers_ContractHelpers__WEBPACK_IMPORTED_MODULE_8__.getContractFunctionBytecode)(functionName, paramsEncoded)];\n case 1:\n contractFunctionParameters = _a.sent();\n return [4 /*yield*/, (new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.ContractExecuteTransaction()\n .setContractId(contractId)\n .setGas(gas)\n .setFunction(functionName)\n .setFunctionParameters(contractFunctionParameters)\n .freezeWith(client)\n .sign(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(accountPrivateKey)))];\n case 2:\n transaction = _a.sent();\n tx = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(transaction.toBytes()).toString('hex');\n return [2 /*return*/, this.sendMessageToNative({\n tx: tx,\n network: this.network,\n })];\n case 3:\n error_5 = _a.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_5)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.getContractCallBytecode = function (functionName, paramsEncoded) {\n return __awaiter(this, void 0, void 0, function () {\n var contractFunctionParameters, error_6;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, (0,_helpers_ContractHelpers__WEBPACK_IMPORTED_MODULE_8__.getContractFunctionBytecode)(functionName, paramsEncoded)];\n case 1:\n contractFunctionParameters = _a.sent();\n return [2 /*return*/, this.sendMessageToNative({\n contractFunctionParameters: contractFunctionParameters.toString('base64')\n })];\n case 2:\n error_6 = _a.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_6)];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.contractCallQueryFunction = function (contractId, functionName, paramsEncoded, accountId, accountPrivateKey, gas, fee, nodeAccountId) {\n if (gas === void 0) { gas = 100000; }\n if (fee === void 0) { fee = 10000000; }\n if (nodeAccountId === void 0) { nodeAccountId = \"0.0.3\"; }\n return __awaiter(this, void 0, void 0, function () {\n var stopWhisperingMsg_1, privateKey_1, contractFunctionParameters, globalSignedTx_1, sharedTimestamp, clientWhisper, queryHex, q1, error_7, error_8;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 7, , 8]);\n stopWhisperingMsg_1 = \"All signs are collected. Stop whispering\";\n privateKey_1 = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(accountPrivateKey);\n return [4 /*yield*/, (0,_helpers_ContractHelpers__WEBPACK_IMPORTED_MODULE_8__.getContractFunctionBytecode)(functionName, paramsEncoded)];\n case 1:\n contractFunctionParameters = _a.sent();\n globalSignedTx_1 = [];\n sharedTimestamp = Date.now();\n clientWhisper = this.getClient();\n clientWhisper.setOperatorWith(accountId, privateKey_1.publicKey, function (buf) { return __awaiter(_this, void 0, void 0, function () {\n var signature;\n return __generator(this, function (_a) {\n signature = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(privateKey_1.sign(buf));\n globalSignedTx_1.push(signature.toString(\"hex\"));\n if (globalSignedTx_1.length >= 1) {\n throw new Error(stopWhisperingMsg_1);\n }\n return [2 /*return*/, buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(\"\")];\n });\n }); });\n queryHex = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.ContractCallQuery()\n .setContractId(contractId)\n .setGas(gas)\n .setFunction(functionName)\n .setFunctionParameters(contractFunctionParameters)\n .toBytes()).toString(\"hex\");\n return [4 /*yield*/, _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.Query.fromBytes(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(queryHex, \"hex\"))\n .setNodeAccountIds([_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.AccountId.fromString(nodeAccountId)])\n .setQueryPayment(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.Hbar.fromTinybars(fee))\n .setPaymentTransactionId(new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.TransactionId(_hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.AccountId.fromString(accountId), _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.Timestamp.fromDate(new Date(sharedTimestamp))))];\n case 2:\n q1 = _a.sent();\n _a.label = 3;\n case 3:\n _a.trys.push([3, 5, , 6]);\n return [4 /*yield*/, q1.execute(clientWhisper)];\n case 4:\n _a.sent();\n return [3 /*break*/, 6];\n case 5:\n error_7 = _a.sent();\n if (error_7.message !== stopWhisperingMsg_1) {\n throw error_7;\n }\n return [2 /*return*/, this.sendMessageToNative({\n queryHex: queryHex,\n signedBuffers: globalSignedTx_1,\n sharedTimestamp: sharedTimestamp,\n nodeAccountId: nodeAccountId,\n publicKey: privateKey_1.publicKey.toStringDer(),\n accountId: accountId,\n fee: fee,\n network: this.network,\n })];\n case 6: return [3 /*break*/, 8];\n case 7:\n error_8 = _a.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_8)];\n case 8: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.parseContractCallQueryResponse = function (contractId, gasUsed, rawResult, resultTypes) {\n return __awaiter(this, void 0, void 0, function () {\n var response, values, error_9;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n response = new _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.ContractFunctionResult({\n _createResult: false,\n contractId: _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.ContractId.fromString(contractId),\n errorMessage: \"\",\n bloom: Uint8Array.from([]),\n logs: [],\n createdContractIds: [],\n evmAddress: null,\n bytes: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(rawResult, \"base64\"),\n // @ts-ignore\n gasUsed: gasUsed,\n // @ts-ignore\n gas: gasUsed,\n // @ts-ignore\n amount: gasUsed,\n functionParameters: Uint8Array.from([]),\n senderAccountId: null,\n stateChanges: [],\n });\n return [4 /*yield*/, (0,_helpers_ContractHelpers__WEBPACK_IMPORTED_MODULE_8__.parseContractQueryResponse)(response, resultTypes)];\n case 1:\n values = _a.sent();\n return [2 /*return*/, this.sendMessageToNative({\n values: values,\n gasUsed: parseInt(response.gasUsed.toString(), 10)\n })];\n case 2:\n error_9 = _a.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_9)];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.sign = function (messageString, privateKey, encoding) {\n return __awaiter(this, void 0, void 0, function () {\n var key, signed;\n return __generator(this, function (_a) {\n try {\n key = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PrivateKey.fromString(privateKey);\n signed = key.sign(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(messageString, encoding));\n return [2 /*return*/, this.sendMessageToNative({\n signedMessage: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signed).toString(\"hex\")\n })];\n }\n catch (error) {\n return [2 /*return*/, this.sendMessageToNative(null, error)];\n }\n return [2 /*return*/];\n });\n });\n };\n BladeUnitySDK.prototype.signVerify = function (messageString, signature, publicKey, encoding) {\n return __awaiter(this, void 0, void 0, function () {\n var valid;\n return __generator(this, function (_a) {\n try {\n valid = _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.PublicKey.fromString(publicKey).verify(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(messageString, encoding), buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signature, \"hex\"));\n return [2 /*return*/, this.sendMessageToNative({ valid: valid })];\n }\n catch (error) {\n return [2 /*return*/, this.sendMessageToNative(null, error)];\n }\n return [2 /*return*/];\n });\n });\n };\n BladeUnitySDK.prototype.hethersSign = function (messageString, privateKey, encoding) {\n return __awaiter(this, void 0, void 0, function () {\n var wallet, signedMessage;\n return __generator(this, function (_a) {\n try {\n wallet = new _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_10__.Wallet(privateKey);\n signedMessage = wallet.signMessage(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(messageString, encoding));\n return [2 /*return*/, this.sendMessageToNative({\n signedMessage: signedMessage\n })];\n }\n catch (error) {\n return [2 /*return*/, this.sendMessageToNative(null, error)];\n }\n return [2 /*return*/];\n });\n });\n };\n BladeUnitySDK.prototype.splitSignature = function (signature) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, v, r, s;\n return __generator(this, function (_b) {\n try {\n _a = _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_11__.splitSignature(signature), v = _a.v, r = _a.r, s = _a.s;\n return [2 /*return*/, this.sendMessageToNative({ v: v, r: r, s: s })];\n }\n catch (error) {\n return [2 /*return*/, this.sendMessageToNative(null, error)];\n }\n return [2 /*return*/];\n });\n });\n };\n BladeUnitySDK.prototype.getParamsSignature = function (paramsEncoded, privateKey) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, types, values, hash, messageHashBytes, wallet, signed, _b, v, r, s, error_10;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 3, , 4]);\n return [4 /*yield*/, (0,_helpers_ContractHelpers__WEBPACK_IMPORTED_MODULE_8__.parseContractFunctionParams)(paramsEncoded)];\n case 1:\n _a = _c.sent(), types = _a.types, values = _a.values;\n hash = _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_12__.keccak256(_hashgraph_hethers__WEBPACK_IMPORTED_MODULE_13__.defaultAbiCoder.encode(types, values));\n messageHashBytes = _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_11__.arrayify(hash);\n wallet = new _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_10__.Wallet(privateKey);\n return [4 /*yield*/, wallet.signMessage(messageHashBytes)];\n case 2:\n signed = _c.sent();\n _b = _hashgraph_hethers__WEBPACK_IMPORTED_MODULE_11__.splitSignature(signed), v = _b.v, r = _b.r, s = _b.s;\n return [2 /*return*/, this.sendMessageToNative({ v: v, r: r, s: s })];\n case 3:\n error_10 = _c.sent();\n return [2 /*return*/, this.sendMessageToNative(null, error_10)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n BladeUnitySDK.prototype.getClient = function () {\n return this.network === _models_Networks__WEBPACK_IMPORTED_MODULE_4__.Network.Testnet ? _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.Client.forTestnet() : _hashgraph_sdk__WEBPACK_IMPORTED_MODULE_2__.Client.forMainnet();\n };\n BladeUnitySDK.prototype.sendMessageToNative = function (data, error) {\n if (error === void 0) { error = null; }\n // web-view bridge response\n var responseObject = {\n data: data\n };\n if (error) {\n responseObject.error = {\n name: (error === null || error === void 0 ? void 0 : error.name) || \"Error\",\n reason: error.reason || error.message || JSON.stringify(error)\n };\n }\n return JSON.stringify(responseObject);\n };\n return BladeUnitySDK;\n}());\n\nif (window)\n window[\"bladeSdk\"] = new BladeUnitySDK();\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./src/unity.ts?"); -/***/ }), -/***/ "./node_modules/tweetnacl/nacl-fast.js": -/*!*********************************************!*\ - !*** ./node_modules/tweetnacl/nacl-fast.js ***! - \*********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("(function(nacl) {\n'use strict';\n\n// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.\n// Public domain.\n//\n// Implementation derived from TweetNaCl version 20140427.\n// See for details: http://tweetnacl.cr.yp.to/\n\nvar gf = function(init) {\n var i, r = new Float64Array(16);\n if (init) for (i = 0; i < init.length; i++) r[i] = init[i];\n return r;\n};\n\n// Pluggable, initialized in high-level API below.\nvar randombytes = function(/* x, n */) { throw new Error('no PRNG'); };\n\nvar _0 = new Uint8Array(16);\nvar _9 = new Uint8Array(32); _9[0] = 9;\n\nvar gf0 = gf(),\n gf1 = gf([1]),\n _121665 = gf([0xdb41, 1]),\n D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),\n D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),\n X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),\n Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),\n I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);\n\nfunction ts64(x, i, h, l) {\n x[i] = (h >> 24) & 0xff;\n x[i+1] = (h >> 16) & 0xff;\n x[i+2] = (h >> 8) & 0xff;\n x[i+3] = h & 0xff;\n x[i+4] = (l >> 24) & 0xff;\n x[i+5] = (l >> 16) & 0xff;\n x[i+6] = (l >> 8) & 0xff;\n x[i+7] = l & 0xff;\n}\n\nfunction vn(x, xi, y, yi, n) {\n var i,d = 0;\n for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];\n return (1 & ((d - 1) >>> 8)) - 1;\n}\n\nfunction crypto_verify_16(x, xi, y, yi) {\n return vn(x,xi,y,yi,16);\n}\n\nfunction crypto_verify_32(x, xi, y, yi) {\n return vn(x,xi,y,yi,32);\n}\n\nfunction core_salsa20(o, p, k, c) {\n var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,\n j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,\n j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,\n j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,\n j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,\n j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,\n j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,\n j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,\n j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,\n j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,\n j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,\n j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,\n j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,\n j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,\n j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,\n j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;\n\n var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,\n x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,\n x15 = j15, u;\n\n for (var i = 0; i < 20; i += 2) {\n u = x0 + x12 | 0;\n x4 ^= u<<7 | u>>>(32-7);\n u = x4 + x0 | 0;\n x8 ^= u<<9 | u>>>(32-9);\n u = x8 + x4 | 0;\n x12 ^= u<<13 | u>>>(32-13);\n u = x12 + x8 | 0;\n x0 ^= u<<18 | u>>>(32-18);\n\n u = x5 + x1 | 0;\n x9 ^= u<<7 | u>>>(32-7);\n u = x9 + x5 | 0;\n x13 ^= u<<9 | u>>>(32-9);\n u = x13 + x9 | 0;\n x1 ^= u<<13 | u>>>(32-13);\n u = x1 + x13 | 0;\n x5 ^= u<<18 | u>>>(32-18);\n\n u = x10 + x6 | 0;\n x14 ^= u<<7 | u>>>(32-7);\n u = x14 + x10 | 0;\n x2 ^= u<<9 | u>>>(32-9);\n u = x2 + x14 | 0;\n x6 ^= u<<13 | u>>>(32-13);\n u = x6 + x2 | 0;\n x10 ^= u<<18 | u>>>(32-18);\n\n u = x15 + x11 | 0;\n x3 ^= u<<7 | u>>>(32-7);\n u = x3 + x15 | 0;\n x7 ^= u<<9 | u>>>(32-9);\n u = x7 + x3 | 0;\n x11 ^= u<<13 | u>>>(32-13);\n u = x11 + x7 | 0;\n x15 ^= u<<18 | u>>>(32-18);\n\n u = x0 + x3 | 0;\n x1 ^= u<<7 | u>>>(32-7);\n u = x1 + x0 | 0;\n x2 ^= u<<9 | u>>>(32-9);\n u = x2 + x1 | 0;\n x3 ^= u<<13 | u>>>(32-13);\n u = x3 + x2 | 0;\n x0 ^= u<<18 | u>>>(32-18);\n\n u = x5 + x4 | 0;\n x6 ^= u<<7 | u>>>(32-7);\n u = x6 + x5 | 0;\n x7 ^= u<<9 | u>>>(32-9);\n u = x7 + x6 | 0;\n x4 ^= u<<13 | u>>>(32-13);\n u = x4 + x7 | 0;\n x5 ^= u<<18 | u>>>(32-18);\n\n u = x10 + x9 | 0;\n x11 ^= u<<7 | u>>>(32-7);\n u = x11 + x10 | 0;\n x8 ^= u<<9 | u>>>(32-9);\n u = x8 + x11 | 0;\n x9 ^= u<<13 | u>>>(32-13);\n u = x9 + x8 | 0;\n x10 ^= u<<18 | u>>>(32-18);\n\n u = x15 + x14 | 0;\n x12 ^= u<<7 | u>>>(32-7);\n u = x12 + x15 | 0;\n x13 ^= u<<9 | u>>>(32-9);\n u = x13 + x12 | 0;\n x14 ^= u<<13 | u>>>(32-13);\n u = x14 + x13 | 0;\n x15 ^= u<<18 | u>>>(32-18);\n }\n x0 = x0 + j0 | 0;\n x1 = x1 + j1 | 0;\n x2 = x2 + j2 | 0;\n x3 = x3 + j3 | 0;\n x4 = x4 + j4 | 0;\n x5 = x5 + j5 | 0;\n x6 = x6 + j6 | 0;\n x7 = x7 + j7 | 0;\n x8 = x8 + j8 | 0;\n x9 = x9 + j9 | 0;\n x10 = x10 + j10 | 0;\n x11 = x11 + j11 | 0;\n x12 = x12 + j12 | 0;\n x13 = x13 + j13 | 0;\n x14 = x14 + j14 | 0;\n x15 = x15 + j15 | 0;\n\n o[ 0] = x0 >>> 0 & 0xff;\n o[ 1] = x0 >>> 8 & 0xff;\n o[ 2] = x0 >>> 16 & 0xff;\n o[ 3] = x0 >>> 24 & 0xff;\n\n o[ 4] = x1 >>> 0 & 0xff;\n o[ 5] = x1 >>> 8 & 0xff;\n o[ 6] = x1 >>> 16 & 0xff;\n o[ 7] = x1 >>> 24 & 0xff;\n\n o[ 8] = x2 >>> 0 & 0xff;\n o[ 9] = x2 >>> 8 & 0xff;\n o[10] = x2 >>> 16 & 0xff;\n o[11] = x2 >>> 24 & 0xff;\n\n o[12] = x3 >>> 0 & 0xff;\n o[13] = x3 >>> 8 & 0xff;\n o[14] = x3 >>> 16 & 0xff;\n o[15] = x3 >>> 24 & 0xff;\n\n o[16] = x4 >>> 0 & 0xff;\n o[17] = x4 >>> 8 & 0xff;\n o[18] = x4 >>> 16 & 0xff;\n o[19] = x4 >>> 24 & 0xff;\n\n o[20] = x5 >>> 0 & 0xff;\n o[21] = x5 >>> 8 & 0xff;\n o[22] = x5 >>> 16 & 0xff;\n o[23] = x5 >>> 24 & 0xff;\n\n o[24] = x6 >>> 0 & 0xff;\n o[25] = x6 >>> 8 & 0xff;\n o[26] = x6 >>> 16 & 0xff;\n o[27] = x6 >>> 24 & 0xff;\n\n o[28] = x7 >>> 0 & 0xff;\n o[29] = x7 >>> 8 & 0xff;\n o[30] = x7 >>> 16 & 0xff;\n o[31] = x7 >>> 24 & 0xff;\n\n o[32] = x8 >>> 0 & 0xff;\n o[33] = x8 >>> 8 & 0xff;\n o[34] = x8 >>> 16 & 0xff;\n o[35] = x8 >>> 24 & 0xff;\n\n o[36] = x9 >>> 0 & 0xff;\n o[37] = x9 >>> 8 & 0xff;\n o[38] = x9 >>> 16 & 0xff;\n o[39] = x9 >>> 24 & 0xff;\n\n o[40] = x10 >>> 0 & 0xff;\n o[41] = x10 >>> 8 & 0xff;\n o[42] = x10 >>> 16 & 0xff;\n o[43] = x10 >>> 24 & 0xff;\n\n o[44] = x11 >>> 0 & 0xff;\n o[45] = x11 >>> 8 & 0xff;\n o[46] = x11 >>> 16 & 0xff;\n o[47] = x11 >>> 24 & 0xff;\n\n o[48] = x12 >>> 0 & 0xff;\n o[49] = x12 >>> 8 & 0xff;\n o[50] = x12 >>> 16 & 0xff;\n o[51] = x12 >>> 24 & 0xff;\n\n o[52] = x13 >>> 0 & 0xff;\n o[53] = x13 >>> 8 & 0xff;\n o[54] = x13 >>> 16 & 0xff;\n o[55] = x13 >>> 24 & 0xff;\n\n o[56] = x14 >>> 0 & 0xff;\n o[57] = x14 >>> 8 & 0xff;\n o[58] = x14 >>> 16 & 0xff;\n o[59] = x14 >>> 24 & 0xff;\n\n o[60] = x15 >>> 0 & 0xff;\n o[61] = x15 >>> 8 & 0xff;\n o[62] = x15 >>> 16 & 0xff;\n o[63] = x15 >>> 24 & 0xff;\n}\n\nfunction core_hsalsa20(o,p,k,c) {\n var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,\n j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,\n j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,\n j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,\n j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,\n j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,\n j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,\n j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,\n j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,\n j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,\n j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,\n j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,\n j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,\n j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,\n j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,\n j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;\n\n var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,\n x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,\n x15 = j15, u;\n\n for (var i = 0; i < 20; i += 2) {\n u = x0 + x12 | 0;\n x4 ^= u<<7 | u>>>(32-7);\n u = x4 + x0 | 0;\n x8 ^= u<<9 | u>>>(32-9);\n u = x8 + x4 | 0;\n x12 ^= u<<13 | u>>>(32-13);\n u = x12 + x8 | 0;\n x0 ^= u<<18 | u>>>(32-18);\n\n u = x5 + x1 | 0;\n x9 ^= u<<7 | u>>>(32-7);\n u = x9 + x5 | 0;\n x13 ^= u<<9 | u>>>(32-9);\n u = x13 + x9 | 0;\n x1 ^= u<<13 | u>>>(32-13);\n u = x1 + x13 | 0;\n x5 ^= u<<18 | u>>>(32-18);\n\n u = x10 + x6 | 0;\n x14 ^= u<<7 | u>>>(32-7);\n u = x14 + x10 | 0;\n x2 ^= u<<9 | u>>>(32-9);\n u = x2 + x14 | 0;\n x6 ^= u<<13 | u>>>(32-13);\n u = x6 + x2 | 0;\n x10 ^= u<<18 | u>>>(32-18);\n\n u = x15 + x11 | 0;\n x3 ^= u<<7 | u>>>(32-7);\n u = x3 + x15 | 0;\n x7 ^= u<<9 | u>>>(32-9);\n u = x7 + x3 | 0;\n x11 ^= u<<13 | u>>>(32-13);\n u = x11 + x7 | 0;\n x15 ^= u<<18 | u>>>(32-18);\n\n u = x0 + x3 | 0;\n x1 ^= u<<7 | u>>>(32-7);\n u = x1 + x0 | 0;\n x2 ^= u<<9 | u>>>(32-9);\n u = x2 + x1 | 0;\n x3 ^= u<<13 | u>>>(32-13);\n u = x3 + x2 | 0;\n x0 ^= u<<18 | u>>>(32-18);\n\n u = x5 + x4 | 0;\n x6 ^= u<<7 | u>>>(32-7);\n u = x6 + x5 | 0;\n x7 ^= u<<9 | u>>>(32-9);\n u = x7 + x6 | 0;\n x4 ^= u<<13 | u>>>(32-13);\n u = x4 + x7 | 0;\n x5 ^= u<<18 | u>>>(32-18);\n\n u = x10 + x9 | 0;\n x11 ^= u<<7 | u>>>(32-7);\n u = x11 + x10 | 0;\n x8 ^= u<<9 | u>>>(32-9);\n u = x8 + x11 | 0;\n x9 ^= u<<13 | u>>>(32-13);\n u = x9 + x8 | 0;\n x10 ^= u<<18 | u>>>(32-18);\n\n u = x15 + x14 | 0;\n x12 ^= u<<7 | u>>>(32-7);\n u = x12 + x15 | 0;\n x13 ^= u<<9 | u>>>(32-9);\n u = x13 + x12 | 0;\n x14 ^= u<<13 | u>>>(32-13);\n u = x14 + x13 | 0;\n x15 ^= u<<18 | u>>>(32-18);\n }\n\n o[ 0] = x0 >>> 0 & 0xff;\n o[ 1] = x0 >>> 8 & 0xff;\n o[ 2] = x0 >>> 16 & 0xff;\n o[ 3] = x0 >>> 24 & 0xff;\n\n o[ 4] = x5 >>> 0 & 0xff;\n o[ 5] = x5 >>> 8 & 0xff;\n o[ 6] = x5 >>> 16 & 0xff;\n o[ 7] = x5 >>> 24 & 0xff;\n\n o[ 8] = x10 >>> 0 & 0xff;\n o[ 9] = x10 >>> 8 & 0xff;\n o[10] = x10 >>> 16 & 0xff;\n o[11] = x10 >>> 24 & 0xff;\n\n o[12] = x15 >>> 0 & 0xff;\n o[13] = x15 >>> 8 & 0xff;\n o[14] = x15 >>> 16 & 0xff;\n o[15] = x15 >>> 24 & 0xff;\n\n o[16] = x6 >>> 0 & 0xff;\n o[17] = x6 >>> 8 & 0xff;\n o[18] = x6 >>> 16 & 0xff;\n o[19] = x6 >>> 24 & 0xff;\n\n o[20] = x7 >>> 0 & 0xff;\n o[21] = x7 >>> 8 & 0xff;\n o[22] = x7 >>> 16 & 0xff;\n o[23] = x7 >>> 24 & 0xff;\n\n o[24] = x8 >>> 0 & 0xff;\n o[25] = x8 >>> 8 & 0xff;\n o[26] = x8 >>> 16 & 0xff;\n o[27] = x8 >>> 24 & 0xff;\n\n o[28] = x9 >>> 0 & 0xff;\n o[29] = x9 >>> 8 & 0xff;\n o[30] = x9 >>> 16 & 0xff;\n o[31] = x9 >>> 24 & 0xff;\n}\n\nfunction crypto_core_salsa20(out,inp,k,c) {\n core_salsa20(out,inp,k,c);\n}\n\nfunction crypto_core_hsalsa20(out,inp,k,c) {\n core_hsalsa20(out,inp,k,c);\n}\n\nvar sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);\n // \"expand 32-byte k\"\n\nfunction crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {\n var z = new Uint8Array(16), x = new Uint8Array(64);\n var u, i;\n for (i = 0; i < 16; i++) z[i] = 0;\n for (i = 0; i < 8; i++) z[i] = n[i];\n while (b >= 64) {\n crypto_core_salsa20(x,z,k,sigma);\n for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];\n u = 1;\n for (i = 8; i < 16; i++) {\n u = u + (z[i] & 0xff) | 0;\n z[i] = u & 0xff;\n u >>>= 8;\n }\n b -= 64;\n cpos += 64;\n mpos += 64;\n }\n if (b > 0) {\n crypto_core_salsa20(x,z,k,sigma);\n for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];\n }\n return 0;\n}\n\nfunction crypto_stream_salsa20(c,cpos,b,n,k) {\n var z = new Uint8Array(16), x = new Uint8Array(64);\n var u, i;\n for (i = 0; i < 16; i++) z[i] = 0;\n for (i = 0; i < 8; i++) z[i] = n[i];\n while (b >= 64) {\n crypto_core_salsa20(x,z,k,sigma);\n for (i = 0; i < 64; i++) c[cpos+i] = x[i];\n u = 1;\n for (i = 8; i < 16; i++) {\n u = u + (z[i] & 0xff) | 0;\n z[i] = u & 0xff;\n u >>>= 8;\n }\n b -= 64;\n cpos += 64;\n }\n if (b > 0) {\n crypto_core_salsa20(x,z,k,sigma);\n for (i = 0; i < b; i++) c[cpos+i] = x[i];\n }\n return 0;\n}\n\nfunction crypto_stream(c,cpos,d,n,k) {\n var s = new Uint8Array(32);\n crypto_core_hsalsa20(s,n,k,sigma);\n var sn = new Uint8Array(8);\n for (var i = 0; i < 8; i++) sn[i] = n[i+16];\n return crypto_stream_salsa20(c,cpos,d,sn,s);\n}\n\nfunction crypto_stream_xor(c,cpos,m,mpos,d,n,k) {\n var s = new Uint8Array(32);\n crypto_core_hsalsa20(s,n,k,sigma);\n var sn = new Uint8Array(8);\n for (var i = 0; i < 8; i++) sn[i] = n[i+16];\n return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);\n}\n\n/*\n* Port of Andrew Moon's Poly1305-donna-16. Public domain.\n* https://github.com/floodyberry/poly1305-donna\n*/\n\nvar poly1305 = function(key) {\n this.buffer = new Uint8Array(16);\n this.r = new Uint16Array(10);\n this.h = new Uint16Array(10);\n this.pad = new Uint16Array(8);\n this.leftover = 0;\n this.fin = 0;\n\n var t0, t1, t2, t3, t4, t5, t6, t7;\n\n t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;\n t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;\n t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;\n this.r[5] = ((t4 >>> 1)) & 0x1ffe;\n t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;\n t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n this.r[9] = ((t7 >>> 5)) & 0x007f;\n\n this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;\n this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;\n this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;\n this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;\n this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;\n this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;\n this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;\n this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;\n};\n\npoly1305.prototype.blocks = function(m, mpos, bytes) {\n var hibit = this.fin ? 0 : (1 << 11);\n var t0, t1, t2, t3, t4, t5, t6, t7, c;\n var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;\n\n var h0 = this.h[0],\n h1 = this.h[1],\n h2 = this.h[2],\n h3 = this.h[3],\n h4 = this.h[4],\n h5 = this.h[5],\n h6 = this.h[6],\n h7 = this.h[7],\n h8 = this.h[8],\n h9 = this.h[9];\n\n var r0 = this.r[0],\n r1 = this.r[1],\n r2 = this.r[2],\n r3 = this.r[3],\n r4 = this.r[4],\n r5 = this.r[5],\n r6 = this.r[6],\n r7 = this.r[7],\n r8 = this.r[8],\n r9 = this.r[9];\n\n while (bytes >= 16) {\n t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;\n t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;\n t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;\n h5 += ((t4 >>> 1)) & 0x1fff;\n t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;\n t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n h9 += ((t7 >>> 5)) | hibit;\n\n c = 0;\n\n d0 = c;\n d0 += h0 * r0;\n d0 += h1 * (5 * r9);\n d0 += h2 * (5 * r8);\n d0 += h3 * (5 * r7);\n d0 += h4 * (5 * r6);\n c = (d0 >>> 13); d0 &= 0x1fff;\n d0 += h5 * (5 * r5);\n d0 += h6 * (5 * r4);\n d0 += h7 * (5 * r3);\n d0 += h8 * (5 * r2);\n d0 += h9 * (5 * r1);\n c += (d0 >>> 13); d0 &= 0x1fff;\n\n d1 = c;\n d1 += h0 * r1;\n d1 += h1 * r0;\n d1 += h2 * (5 * r9);\n d1 += h3 * (5 * r8);\n d1 += h4 * (5 * r7);\n c = (d1 >>> 13); d1 &= 0x1fff;\n d1 += h5 * (5 * r6);\n d1 += h6 * (5 * r5);\n d1 += h7 * (5 * r4);\n d1 += h8 * (5 * r3);\n d1 += h9 * (5 * r2);\n c += (d1 >>> 13); d1 &= 0x1fff;\n\n d2 = c;\n d2 += h0 * r2;\n d2 += h1 * r1;\n d2 += h2 * r0;\n d2 += h3 * (5 * r9);\n d2 += h4 * (5 * r8);\n c = (d2 >>> 13); d2 &= 0x1fff;\n d2 += h5 * (5 * r7);\n d2 += h6 * (5 * r6);\n d2 += h7 * (5 * r5);\n d2 += h8 * (5 * r4);\n d2 += h9 * (5 * r3);\n c += (d2 >>> 13); d2 &= 0x1fff;\n\n d3 = c;\n d3 += h0 * r3;\n d3 += h1 * r2;\n d3 += h2 * r1;\n d3 += h3 * r0;\n d3 += h4 * (5 * r9);\n c = (d3 >>> 13); d3 &= 0x1fff;\n d3 += h5 * (5 * r8);\n d3 += h6 * (5 * r7);\n d3 += h7 * (5 * r6);\n d3 += h8 * (5 * r5);\n d3 += h9 * (5 * r4);\n c += (d3 >>> 13); d3 &= 0x1fff;\n\n d4 = c;\n d4 += h0 * r4;\n d4 += h1 * r3;\n d4 += h2 * r2;\n d4 += h3 * r1;\n d4 += h4 * r0;\n c = (d4 >>> 13); d4 &= 0x1fff;\n d4 += h5 * (5 * r9);\n d4 += h6 * (5 * r8);\n d4 += h7 * (5 * r7);\n d4 += h8 * (5 * r6);\n d4 += h9 * (5 * r5);\n c += (d4 >>> 13); d4 &= 0x1fff;\n\n d5 = c;\n d5 += h0 * r5;\n d5 += h1 * r4;\n d5 += h2 * r3;\n d5 += h3 * r2;\n d5 += h4 * r1;\n c = (d5 >>> 13); d5 &= 0x1fff;\n d5 += h5 * r0;\n d5 += h6 * (5 * r9);\n d5 += h7 * (5 * r8);\n d5 += h8 * (5 * r7);\n d5 += h9 * (5 * r6);\n c += (d5 >>> 13); d5 &= 0x1fff;\n\n d6 = c;\n d6 += h0 * r6;\n d6 += h1 * r5;\n d6 += h2 * r4;\n d6 += h3 * r3;\n d6 += h4 * r2;\n c = (d6 >>> 13); d6 &= 0x1fff;\n d6 += h5 * r1;\n d6 += h6 * r0;\n d6 += h7 * (5 * r9);\n d6 += h8 * (5 * r8);\n d6 += h9 * (5 * r7);\n c += (d6 >>> 13); d6 &= 0x1fff;\n\n d7 = c;\n d7 += h0 * r7;\n d7 += h1 * r6;\n d7 += h2 * r5;\n d7 += h3 * r4;\n d7 += h4 * r3;\n c = (d7 >>> 13); d7 &= 0x1fff;\n d7 += h5 * r2;\n d7 += h6 * r1;\n d7 += h7 * r0;\n d7 += h8 * (5 * r9);\n d7 += h9 * (5 * r8);\n c += (d7 >>> 13); d7 &= 0x1fff;\n\n d8 = c;\n d8 += h0 * r8;\n d8 += h1 * r7;\n d8 += h2 * r6;\n d8 += h3 * r5;\n d8 += h4 * r4;\n c = (d8 >>> 13); d8 &= 0x1fff;\n d8 += h5 * r3;\n d8 += h6 * r2;\n d8 += h7 * r1;\n d8 += h8 * r0;\n d8 += h9 * (5 * r9);\n c += (d8 >>> 13); d8 &= 0x1fff;\n\n d9 = c;\n d9 += h0 * r9;\n d9 += h1 * r8;\n d9 += h2 * r7;\n d9 += h3 * r6;\n d9 += h4 * r5;\n c = (d9 >>> 13); d9 &= 0x1fff;\n d9 += h5 * r4;\n d9 += h6 * r3;\n d9 += h7 * r2;\n d9 += h8 * r1;\n d9 += h9 * r0;\n c += (d9 >>> 13); d9 &= 0x1fff;\n\n c = (((c << 2) + c)) | 0;\n c = (c + d0) | 0;\n d0 = c & 0x1fff;\n c = (c >>> 13);\n d1 += c;\n\n h0 = d0;\n h1 = d1;\n h2 = d2;\n h3 = d3;\n h4 = d4;\n h5 = d5;\n h6 = d6;\n h7 = d7;\n h8 = d8;\n h9 = d9;\n\n mpos += 16;\n bytes -= 16;\n }\n this.h[0] = h0;\n this.h[1] = h1;\n this.h[2] = h2;\n this.h[3] = h3;\n this.h[4] = h4;\n this.h[5] = h5;\n this.h[6] = h6;\n this.h[7] = h7;\n this.h[8] = h8;\n this.h[9] = h9;\n};\n\npoly1305.prototype.finish = function(mac, macpos) {\n var g = new Uint16Array(10);\n var c, mask, f, i;\n\n if (this.leftover) {\n i = this.leftover;\n this.buffer[i++] = 1;\n for (; i < 16; i++) this.buffer[i] = 0;\n this.fin = 1;\n this.blocks(this.buffer, 0, 16);\n }\n\n c = this.h[1] >>> 13;\n this.h[1] &= 0x1fff;\n for (i = 2; i < 10; i++) {\n this.h[i] += c;\n c = this.h[i] >>> 13;\n this.h[i] &= 0x1fff;\n }\n this.h[0] += (c * 5);\n c = this.h[0] >>> 13;\n this.h[0] &= 0x1fff;\n this.h[1] += c;\n c = this.h[1] >>> 13;\n this.h[1] &= 0x1fff;\n this.h[2] += c;\n\n g[0] = this.h[0] + 5;\n c = g[0] >>> 13;\n g[0] &= 0x1fff;\n for (i = 1; i < 10; i++) {\n g[i] = this.h[i] + c;\n c = g[i] >>> 13;\n g[i] &= 0x1fff;\n }\n g[9] -= (1 << 13);\n\n mask = (c ^ 1) - 1;\n for (i = 0; i < 10; i++) g[i] &= mask;\n mask = ~mask;\n for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];\n\n this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;\n this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;\n this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;\n this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;\n this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;\n this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;\n this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;\n this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;\n\n f = this.h[0] + this.pad[0];\n this.h[0] = f & 0xffff;\n for (i = 1; i < 8; i++) {\n f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;\n this.h[i] = f & 0xffff;\n }\n\n mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;\n mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;\n mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;\n mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;\n mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;\n mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;\n mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;\n mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;\n mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;\n mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;\n mac[macpos+10] = (this.h[5] >>> 0) & 0xff;\n mac[macpos+11] = (this.h[5] >>> 8) & 0xff;\n mac[macpos+12] = (this.h[6] >>> 0) & 0xff;\n mac[macpos+13] = (this.h[6] >>> 8) & 0xff;\n mac[macpos+14] = (this.h[7] >>> 0) & 0xff;\n mac[macpos+15] = (this.h[7] >>> 8) & 0xff;\n};\n\npoly1305.prototype.update = function(m, mpos, bytes) {\n var i, want;\n\n if (this.leftover) {\n want = (16 - this.leftover);\n if (want > bytes)\n want = bytes;\n for (i = 0; i < want; i++)\n this.buffer[this.leftover + i] = m[mpos+i];\n bytes -= want;\n mpos += want;\n this.leftover += want;\n if (this.leftover < 16)\n return;\n this.blocks(this.buffer, 0, 16);\n this.leftover = 0;\n }\n\n if (bytes >= 16) {\n want = bytes - (bytes % 16);\n this.blocks(m, mpos, want);\n mpos += want;\n bytes -= want;\n }\n\n if (bytes) {\n for (i = 0; i < bytes; i++)\n this.buffer[this.leftover + i] = m[mpos+i];\n this.leftover += bytes;\n }\n};\n\nfunction crypto_onetimeauth(out, outpos, m, mpos, n, k) {\n var s = new poly1305(k);\n s.update(m, mpos, n);\n s.finish(out, outpos);\n return 0;\n}\n\nfunction crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {\n var x = new Uint8Array(16);\n crypto_onetimeauth(x,0,m,mpos,n,k);\n return crypto_verify_16(h,hpos,x,0);\n}\n\nfunction crypto_secretbox(c,m,d,n,k) {\n var i;\n if (d < 32) return -1;\n crypto_stream_xor(c,0,m,0,d,n,k);\n crypto_onetimeauth(c, 16, c, 32, d - 32, c);\n for (i = 0; i < 16; i++) c[i] = 0;\n return 0;\n}\n\nfunction crypto_secretbox_open(m,c,d,n,k) {\n var i;\n var x = new Uint8Array(32);\n if (d < 32) return -1;\n crypto_stream(x,0,32,n,k);\n if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;\n crypto_stream_xor(m,0,c,0,d,n,k);\n for (i = 0; i < 32; i++) m[i] = 0;\n return 0;\n}\n\nfunction set25519(r, a) {\n var i;\n for (i = 0; i < 16; i++) r[i] = a[i]|0;\n}\n\nfunction car25519(o) {\n var i, v, c = 1;\n for (i = 0; i < 16; i++) {\n v = o[i] + c + 65535;\n c = Math.floor(v / 65536);\n o[i] = v - c * 65536;\n }\n o[0] += c-1 + 37 * (c-1);\n}\n\nfunction sel25519(p, q, b) {\n var t, c = ~(b-1);\n for (var i = 0; i < 16; i++) {\n t = c & (p[i] ^ q[i]);\n p[i] ^= t;\n q[i] ^= t;\n }\n}\n\nfunction pack25519(o, n) {\n var i, j, b;\n var m = gf(), t = gf();\n for (i = 0; i < 16; i++) t[i] = n[i];\n car25519(t);\n car25519(t);\n car25519(t);\n for (j = 0; j < 2; j++) {\n m[0] = t[0] - 0xffed;\n for (i = 1; i < 15; i++) {\n m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);\n m[i-1] &= 0xffff;\n }\n m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);\n b = (m[15]>>16) & 1;\n m[14] &= 0xffff;\n sel25519(t, m, 1-b);\n }\n for (i = 0; i < 16; i++) {\n o[2*i] = t[i] & 0xff;\n o[2*i+1] = t[i]>>8;\n }\n}\n\nfunction neq25519(a, b) {\n var c = new Uint8Array(32), d = new Uint8Array(32);\n pack25519(c, a);\n pack25519(d, b);\n return crypto_verify_32(c, 0, d, 0);\n}\n\nfunction par25519(a) {\n var d = new Uint8Array(32);\n pack25519(d, a);\n return d[0] & 1;\n}\n\nfunction unpack25519(o, n) {\n var i;\n for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);\n o[15] &= 0x7fff;\n}\n\nfunction A(o, a, b) {\n for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];\n}\n\nfunction Z(o, a, b) {\n for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];\n}\n\nfunction M(o, a, b) {\n var v, c,\n t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,\n t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,\n t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,\n t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,\n b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11],\n b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n\n v = a[0];\n t0 += v * b0;\n t1 += v * b1;\n t2 += v * b2;\n t3 += v * b3;\n t4 += v * b4;\n t5 += v * b5;\n t6 += v * b6;\n t7 += v * b7;\n t8 += v * b8;\n t9 += v * b9;\n t10 += v * b10;\n t11 += v * b11;\n t12 += v * b12;\n t13 += v * b13;\n t14 += v * b14;\n t15 += v * b15;\n v = a[1];\n t1 += v * b0;\n t2 += v * b1;\n t3 += v * b2;\n t4 += v * b3;\n t5 += v * b4;\n t6 += v * b5;\n t7 += v * b6;\n t8 += v * b7;\n t9 += v * b8;\n t10 += v * b9;\n t11 += v * b10;\n t12 += v * b11;\n t13 += v * b12;\n t14 += v * b13;\n t15 += v * b14;\n t16 += v * b15;\n v = a[2];\n t2 += v * b0;\n t3 += v * b1;\n t4 += v * b2;\n t5 += v * b3;\n t6 += v * b4;\n t7 += v * b5;\n t8 += v * b6;\n t9 += v * b7;\n t10 += v * b8;\n t11 += v * b9;\n t12 += v * b10;\n t13 += v * b11;\n t14 += v * b12;\n t15 += v * b13;\n t16 += v * b14;\n t17 += v * b15;\n v = a[3];\n t3 += v * b0;\n t4 += v * b1;\n t5 += v * b2;\n t6 += v * b3;\n t7 += v * b4;\n t8 += v * b5;\n t9 += v * b6;\n t10 += v * b7;\n t11 += v * b8;\n t12 += v * b9;\n t13 += v * b10;\n t14 += v * b11;\n t15 += v * b12;\n t16 += v * b13;\n t17 += v * b14;\n t18 += v * b15;\n v = a[4];\n t4 += v * b0;\n t5 += v * b1;\n t6 += v * b2;\n t7 += v * b3;\n t8 += v * b4;\n t9 += v * b5;\n t10 += v * b6;\n t11 += v * b7;\n t12 += v * b8;\n t13 += v * b9;\n t14 += v * b10;\n t15 += v * b11;\n t16 += v * b12;\n t17 += v * b13;\n t18 += v * b14;\n t19 += v * b15;\n v = a[5];\n t5 += v * b0;\n t6 += v * b1;\n t7 += v * b2;\n t8 += v * b3;\n t9 += v * b4;\n t10 += v * b5;\n t11 += v * b6;\n t12 += v * b7;\n t13 += v * b8;\n t14 += v * b9;\n t15 += v * b10;\n t16 += v * b11;\n t17 += v * b12;\n t18 += v * b13;\n t19 += v * b14;\n t20 += v * b15;\n v = a[6];\n t6 += v * b0;\n t7 += v * b1;\n t8 += v * b2;\n t9 += v * b3;\n t10 += v * b4;\n t11 += v * b5;\n t12 += v * b6;\n t13 += v * b7;\n t14 += v * b8;\n t15 += v * b9;\n t16 += v * b10;\n t17 += v * b11;\n t18 += v * b12;\n t19 += v * b13;\n t20 += v * b14;\n t21 += v * b15;\n v = a[7];\n t7 += v * b0;\n t8 += v * b1;\n t9 += v * b2;\n t10 += v * b3;\n t11 += v * b4;\n t12 += v * b5;\n t13 += v * b6;\n t14 += v * b7;\n t15 += v * b8;\n t16 += v * b9;\n t17 += v * b10;\n t18 += v * b11;\n t19 += v * b12;\n t20 += v * b13;\n t21 += v * b14;\n t22 += v * b15;\n v = a[8];\n t8 += v * b0;\n t9 += v * b1;\n t10 += v * b2;\n t11 += v * b3;\n t12 += v * b4;\n t13 += v * b5;\n t14 += v * b6;\n t15 += v * b7;\n t16 += v * b8;\n t17 += v * b9;\n t18 += v * b10;\n t19 += v * b11;\n t20 += v * b12;\n t21 += v * b13;\n t22 += v * b14;\n t23 += v * b15;\n v = a[9];\n t9 += v * b0;\n t10 += v * b1;\n t11 += v * b2;\n t12 += v * b3;\n t13 += v * b4;\n t14 += v * b5;\n t15 += v * b6;\n t16 += v * b7;\n t17 += v * b8;\n t18 += v * b9;\n t19 += v * b10;\n t20 += v * b11;\n t21 += v * b12;\n t22 += v * b13;\n t23 += v * b14;\n t24 += v * b15;\n v = a[10];\n t10 += v * b0;\n t11 += v * b1;\n t12 += v * b2;\n t13 += v * b3;\n t14 += v * b4;\n t15 += v * b5;\n t16 += v * b6;\n t17 += v * b7;\n t18 += v * b8;\n t19 += v * b9;\n t20 += v * b10;\n t21 += v * b11;\n t22 += v * b12;\n t23 += v * b13;\n t24 += v * b14;\n t25 += v * b15;\n v = a[11];\n t11 += v * b0;\n t12 += v * b1;\n t13 += v * b2;\n t14 += v * b3;\n t15 += v * b4;\n t16 += v * b5;\n t17 += v * b6;\n t18 += v * b7;\n t19 += v * b8;\n t20 += v * b9;\n t21 += v * b10;\n t22 += v * b11;\n t23 += v * b12;\n t24 += v * b13;\n t25 += v * b14;\n t26 += v * b15;\n v = a[12];\n t12 += v * b0;\n t13 += v * b1;\n t14 += v * b2;\n t15 += v * b3;\n t16 += v * b4;\n t17 += v * b5;\n t18 += v * b6;\n t19 += v * b7;\n t20 += v * b8;\n t21 += v * b9;\n t22 += v * b10;\n t23 += v * b11;\n t24 += v * b12;\n t25 += v * b13;\n t26 += v * b14;\n t27 += v * b15;\n v = a[13];\n t13 += v * b0;\n t14 += v * b1;\n t15 += v * b2;\n t16 += v * b3;\n t17 += v * b4;\n t18 += v * b5;\n t19 += v * b6;\n t20 += v * b7;\n t21 += v * b8;\n t22 += v * b9;\n t23 += v * b10;\n t24 += v * b11;\n t25 += v * b12;\n t26 += v * b13;\n t27 += v * b14;\n t28 += v * b15;\n v = a[14];\n t14 += v * b0;\n t15 += v * b1;\n t16 += v * b2;\n t17 += v * b3;\n t18 += v * b4;\n t19 += v * b5;\n t20 += v * b6;\n t21 += v * b7;\n t22 += v * b8;\n t23 += v * b9;\n t24 += v * b10;\n t25 += v * b11;\n t26 += v * b12;\n t27 += v * b13;\n t28 += v * b14;\n t29 += v * b15;\n v = a[15];\n t15 += v * b0;\n t16 += v * b1;\n t17 += v * b2;\n t18 += v * b3;\n t19 += v * b4;\n t20 += v * b5;\n t21 += v * b6;\n t22 += v * b7;\n t23 += v * b8;\n t24 += v * b9;\n t25 += v * b10;\n t26 += v * b11;\n t27 += v * b12;\n t28 += v * b13;\n t29 += v * b14;\n t30 += v * b15;\n\n t0 += 38 * t16;\n t1 += 38 * t17;\n t2 += 38 * t18;\n t3 += 38 * t19;\n t4 += 38 * t20;\n t5 += 38 * t21;\n t6 += 38 * t22;\n t7 += 38 * t23;\n t8 += 38 * t24;\n t9 += 38 * t25;\n t10 += 38 * t26;\n t11 += 38 * t27;\n t12 += 38 * t28;\n t13 += 38 * t29;\n t14 += 38 * t30;\n // t15 left as is\n\n // first car\n c = 1;\n v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;\n v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;\n v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;\n v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;\n v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;\n v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;\n v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;\n v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;\n v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;\n v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;\n v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;\n v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;\n v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;\n v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;\n v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;\n v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;\n t0 += c-1 + 37 * (c-1);\n\n // second car\n c = 1;\n v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;\n v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;\n v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;\n v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;\n v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;\n v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;\n v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;\n v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;\n v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;\n v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;\n v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;\n v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;\n v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;\n v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;\n v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;\n v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;\n t0 += c-1 + 37 * (c-1);\n\n o[ 0] = t0;\n o[ 1] = t1;\n o[ 2] = t2;\n o[ 3] = t3;\n o[ 4] = t4;\n o[ 5] = t5;\n o[ 6] = t6;\n o[ 7] = t7;\n o[ 8] = t8;\n o[ 9] = t9;\n o[10] = t10;\n o[11] = t11;\n o[12] = t12;\n o[13] = t13;\n o[14] = t14;\n o[15] = t15;\n}\n\nfunction S(o, a) {\n M(o, a, a);\n}\n\nfunction inv25519(o, i) {\n var c = gf();\n var a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 253; a >= 0; a--) {\n S(c, c);\n if(a !== 2 && a !== 4) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction pow2523(o, i) {\n var c = gf();\n var a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 250; a >= 0; a--) {\n S(c, c);\n if(a !== 1) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction crypto_scalarmult(q, n, p) {\n var z = new Uint8Array(32);\n var x = new Float64Array(80), r, i;\n var a = gf(), b = gf(), c = gf(),\n d = gf(), e = gf(), f = gf();\n for (i = 0; i < 31; i++) z[i] = n[i];\n z[31]=(n[31]&127)|64;\n z[0]&=248;\n unpack25519(x,p);\n for (i = 0; i < 16; i++) {\n b[i]=x[i];\n d[i]=a[i]=c[i]=0;\n }\n a[0]=d[0]=1;\n for (i=254; i>=0; --i) {\n r=(z[i>>>3]>>>(i&7))&1;\n sel25519(a,b,r);\n sel25519(c,d,r);\n A(e,a,c);\n Z(a,a,c);\n A(c,b,d);\n Z(b,b,d);\n S(d,e);\n S(f,a);\n M(a,c,a);\n M(c,b,e);\n A(e,a,c);\n Z(a,a,c);\n S(b,a);\n Z(c,d,f);\n M(a,c,_121665);\n A(a,a,d);\n M(c,c,a);\n M(a,d,f);\n M(d,b,x);\n S(b,e);\n sel25519(a,b,r);\n sel25519(c,d,r);\n }\n for (i = 0; i < 16; i++) {\n x[i+16]=a[i];\n x[i+32]=c[i];\n x[i+48]=b[i];\n x[i+64]=d[i];\n }\n var x32 = x.subarray(32);\n var x16 = x.subarray(16);\n inv25519(x32,x32);\n M(x16,x16,x32);\n pack25519(q,x16);\n return 0;\n}\n\nfunction crypto_scalarmult_base(q, n) {\n return crypto_scalarmult(q, n, _9);\n}\n\nfunction crypto_box_keypair(y, x) {\n randombytes(x, 32);\n return crypto_scalarmult_base(y, x);\n}\n\nfunction crypto_box_beforenm(k, y, x) {\n var s = new Uint8Array(32);\n crypto_scalarmult(s, x, y);\n return crypto_core_hsalsa20(k, _0, s, sigma);\n}\n\nvar crypto_box_afternm = crypto_secretbox;\nvar crypto_box_open_afternm = crypto_secretbox_open;\n\nfunction crypto_box(c, m, d, n, y, x) {\n var k = new Uint8Array(32);\n crypto_box_beforenm(k, y, x);\n return crypto_box_afternm(c, m, d, n, k);\n}\n\nfunction crypto_box_open(m, c, d, n, y, x) {\n var k = new Uint8Array(32);\n crypto_box_beforenm(k, y, x);\n return crypto_box_open_afternm(m, c, d, n, k);\n}\n\nvar K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction crypto_hashblocks_hl(hh, hl, m, n) {\n var wh = new Int32Array(16), wl = new Int32Array(16),\n bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,\n bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,\n th, tl, i, j, h, l, a, b, c, d;\n\n var ah0 = hh[0],\n ah1 = hh[1],\n ah2 = hh[2],\n ah3 = hh[3],\n ah4 = hh[4],\n ah5 = hh[5],\n ah6 = hh[6],\n ah7 = hh[7],\n\n al0 = hl[0],\n al1 = hl[1],\n al2 = hl[2],\n al3 = hl[3],\n al4 = hl[4],\n al5 = hl[5],\n al6 = hl[6],\n al7 = hl[7];\n\n var pos = 0;\n while (n >= 128) {\n for (i = 0; i < 16; i++) {\n j = 8 * i + pos;\n wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];\n wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];\n }\n for (i = 0; i < 80; i++) {\n bh0 = ah0;\n bh1 = ah1;\n bh2 = ah2;\n bh3 = ah3;\n bh4 = ah4;\n bh5 = ah5;\n bh6 = ah6;\n bh7 = ah7;\n\n bl0 = al0;\n bl1 = al1;\n bl2 = al2;\n bl3 = al3;\n bl4 = al4;\n bl5 = al5;\n bl6 = al6;\n bl7 = al7;\n\n // add\n h = ah7;\n l = al7;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n // Sigma1\n h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));\n l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n // Ch\n h = (ah4 & ah5) ^ (~ah4 & ah6);\n l = (al4 & al5) ^ (~al4 & al6);\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n // K\n h = K[i*2];\n l = K[i*2+1];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n // w\n h = wh[i%16];\n l = wl[i%16];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n th = c & 0xffff | d << 16;\n tl = a & 0xffff | b << 16;\n\n // add\n h = th;\n l = tl;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n // Sigma0\n h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));\n l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n // Maj\n h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);\n l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n bh7 = (c & 0xffff) | (d << 16);\n bl7 = (a & 0xffff) | (b << 16);\n\n // add\n h = bh3;\n l = bl3;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = th;\n l = tl;\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n bh3 = (c & 0xffff) | (d << 16);\n bl3 = (a & 0xffff) | (b << 16);\n\n ah1 = bh0;\n ah2 = bh1;\n ah3 = bh2;\n ah4 = bh3;\n ah5 = bh4;\n ah6 = bh5;\n ah7 = bh6;\n ah0 = bh7;\n\n al1 = bl0;\n al2 = bl1;\n al3 = bl2;\n al4 = bl3;\n al5 = bl4;\n al6 = bl5;\n al7 = bl6;\n al0 = bl7;\n\n if (i%16 === 15) {\n for (j = 0; j < 16; j++) {\n // add\n h = wh[j];\n l = wl[j];\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = wh[(j+9)%16];\n l = wl[(j+9)%16];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n // sigma0\n th = wh[(j+1)%16];\n tl = wl[(j+1)%16];\n h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);\n l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n // sigma1\n th = wh[(j+14)%16];\n tl = wl[(j+14)%16];\n h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);\n l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n wh[j] = (c & 0xffff) | (d << 16);\n wl[j] = (a & 0xffff) | (b << 16);\n }\n }\n }\n\n // add\n h = ah0;\n l = al0;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[0];\n l = hl[0];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[0] = ah0 = (c & 0xffff) | (d << 16);\n hl[0] = al0 = (a & 0xffff) | (b << 16);\n\n h = ah1;\n l = al1;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[1];\n l = hl[1];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[1] = ah1 = (c & 0xffff) | (d << 16);\n hl[1] = al1 = (a & 0xffff) | (b << 16);\n\n h = ah2;\n l = al2;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[2];\n l = hl[2];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[2] = ah2 = (c & 0xffff) | (d << 16);\n hl[2] = al2 = (a & 0xffff) | (b << 16);\n\n h = ah3;\n l = al3;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[3];\n l = hl[3];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[3] = ah3 = (c & 0xffff) | (d << 16);\n hl[3] = al3 = (a & 0xffff) | (b << 16);\n\n h = ah4;\n l = al4;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[4];\n l = hl[4];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[4] = ah4 = (c & 0xffff) | (d << 16);\n hl[4] = al4 = (a & 0xffff) | (b << 16);\n\n h = ah5;\n l = al5;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[5];\n l = hl[5];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[5] = ah5 = (c & 0xffff) | (d << 16);\n hl[5] = al5 = (a & 0xffff) | (b << 16);\n\n h = ah6;\n l = al6;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[6];\n l = hl[6];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[6] = ah6 = (c & 0xffff) | (d << 16);\n hl[6] = al6 = (a & 0xffff) | (b << 16);\n\n h = ah7;\n l = al7;\n\n a = l & 0xffff; b = l >>> 16;\n c = h & 0xffff; d = h >>> 16;\n\n h = hh[7];\n l = hl[7];\n\n a += l & 0xffff; b += l >>> 16;\n c += h & 0xffff; d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[7] = ah7 = (c & 0xffff) | (d << 16);\n hl[7] = al7 = (a & 0xffff) | (b << 16);\n\n pos += 128;\n n -= 128;\n }\n\n return n;\n}\n\nfunction crypto_hash(out, m, n) {\n var hh = new Int32Array(8),\n hl = new Int32Array(8),\n x = new Uint8Array(256),\n i, b = n;\n\n hh[0] = 0x6a09e667;\n hh[1] = 0xbb67ae85;\n hh[2] = 0x3c6ef372;\n hh[3] = 0xa54ff53a;\n hh[4] = 0x510e527f;\n hh[5] = 0x9b05688c;\n hh[6] = 0x1f83d9ab;\n hh[7] = 0x5be0cd19;\n\n hl[0] = 0xf3bcc908;\n hl[1] = 0x84caa73b;\n hl[2] = 0xfe94f82b;\n hl[3] = 0x5f1d36f1;\n hl[4] = 0xade682d1;\n hl[5] = 0x2b3e6c1f;\n hl[6] = 0xfb41bd6b;\n hl[7] = 0x137e2179;\n\n crypto_hashblocks_hl(hh, hl, m, n);\n n %= 128;\n\n for (i = 0; i < n; i++) x[i] = m[b-n+i];\n x[n] = 128;\n\n n = 256-128*(n<112?1:0);\n x[n-9] = 0;\n ts64(x, n-8, (b / 0x20000000) | 0, b << 3);\n crypto_hashblocks_hl(hh, hl, x, n);\n\n for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);\n\n return 0;\n}\n\nfunction add(p, q) {\n var a = gf(), b = gf(), c = gf(),\n d = gf(), e = gf(), f = gf(),\n g = gf(), h = gf(), t = gf();\n\n Z(a, p[1], p[0]);\n Z(t, q[1], q[0]);\n M(a, a, t);\n A(b, p[0], p[1]);\n A(t, q[0], q[1]);\n M(b, b, t);\n M(c, p[3], q[3]);\n M(c, c, D2);\n M(d, p[2], q[2]);\n A(d, d, d);\n Z(e, b, a);\n Z(f, d, c);\n A(g, d, c);\n A(h, b, a);\n\n M(p[0], e, f);\n M(p[1], h, g);\n M(p[2], g, f);\n M(p[3], e, h);\n}\n\nfunction cswap(p, q, b) {\n var i;\n for (i = 0; i < 4; i++) {\n sel25519(p[i], q[i], b);\n }\n}\n\nfunction pack(r, p) {\n var tx = gf(), ty = gf(), zi = gf();\n inv25519(zi, p[2]);\n M(tx, p[0], zi);\n M(ty, p[1], zi);\n pack25519(r, ty);\n r[31] ^= par25519(tx) << 7;\n}\n\nfunction scalarmult(p, q, s) {\n var b, i;\n set25519(p[0], gf0);\n set25519(p[1], gf1);\n set25519(p[2], gf1);\n set25519(p[3], gf0);\n for (i = 255; i >= 0; --i) {\n b = (s[(i/8)|0] >> (i&7)) & 1;\n cswap(p, q, b);\n add(q, p);\n add(p, p);\n cswap(p, q, b);\n }\n}\n\nfunction scalarbase(p, s) {\n var q = [gf(), gf(), gf(), gf()];\n set25519(q[0], X);\n set25519(q[1], Y);\n set25519(q[2], gf1);\n M(q[3], X, Y);\n scalarmult(p, q, s);\n}\n\nfunction crypto_sign_keypair(pk, sk, seeded) {\n var d = new Uint8Array(64);\n var p = [gf(), gf(), gf(), gf()];\n var i;\n\n if (!seeded) randombytes(sk, 32);\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n scalarbase(p, d);\n pack(pk, p);\n\n for (i = 0; i < 32; i++) sk[i+32] = pk[i];\n return 0;\n}\n\nvar L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);\n\nfunction modL(r, x) {\n var carry, i, j, k;\n for (i = 63; i >= 32; --i) {\n carry = 0;\n for (j = i - 32, k = i - 12; j < k; ++j) {\n x[j] += carry - 16 * x[i] * L[j - (i - 32)];\n carry = Math.floor((x[j] + 128) / 256);\n x[j] -= carry * 256;\n }\n x[j] += carry;\n x[i] = 0;\n }\n carry = 0;\n for (j = 0; j < 32; j++) {\n x[j] += carry - (x[31] >> 4) * L[j];\n carry = x[j] >> 8;\n x[j] &= 255;\n }\n for (j = 0; j < 32; j++) x[j] -= carry * L[j];\n for (i = 0; i < 32; i++) {\n x[i+1] += x[i] >> 8;\n r[i] = x[i] & 255;\n }\n}\n\nfunction reduce(r) {\n var x = new Float64Array(64), i;\n for (i = 0; i < 64; i++) x[i] = r[i];\n for (i = 0; i < 64; i++) r[i] = 0;\n modL(r, x);\n}\n\n// Note: difference from C - smlen returned, not passed as argument.\nfunction crypto_sign(sm, m, n, sk) {\n var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);\n var i, j, x = new Float64Array(64);\n var p = [gf(), gf(), gf(), gf()];\n\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n var smlen = n + 64;\n for (i = 0; i < n; i++) sm[64 + i] = m[i];\n for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];\n\n crypto_hash(r, sm.subarray(32), n+32);\n reduce(r);\n scalarbase(p, r);\n pack(sm, p);\n\n for (i = 32; i < 64; i++) sm[i] = sk[i];\n crypto_hash(h, sm, n + 64);\n reduce(h);\n\n for (i = 0; i < 64; i++) x[i] = 0;\n for (i = 0; i < 32; i++) x[i] = r[i];\n for (i = 0; i < 32; i++) {\n for (j = 0; j < 32; j++) {\n x[i+j] += h[i] * d[j];\n }\n }\n\n modL(sm.subarray(32), x);\n return smlen;\n}\n\nfunction unpackneg(r, p) {\n var t = gf(), chk = gf(), num = gf(),\n den = gf(), den2 = gf(), den4 = gf(),\n den6 = gf();\n\n set25519(r[2], gf1);\n unpack25519(r[1], p);\n S(num, r[1]);\n M(den, num, D);\n Z(num, num, r[2]);\n A(den, r[2], den);\n\n S(den2, den);\n S(den4, den2);\n M(den6, den4, den2);\n M(t, den6, num);\n M(t, t, den);\n\n pow2523(t, t);\n M(t, t, num);\n M(t, t, den);\n M(t, t, den);\n M(r[0], t, den);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) M(r[0], r[0], I);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) return -1;\n\n if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);\n\n M(r[3], r[0], r[1]);\n return 0;\n}\n\nfunction crypto_sign_open(m, sm, n, pk) {\n var i;\n var t = new Uint8Array(32), h = new Uint8Array(64);\n var p = [gf(), gf(), gf(), gf()],\n q = [gf(), gf(), gf(), gf()];\n\n if (n < 64) return -1;\n\n if (unpackneg(q, pk)) return -1;\n\n for (i = 0; i < n; i++) m[i] = sm[i];\n for (i = 0; i < 32; i++) m[i+32] = pk[i];\n crypto_hash(h, m, n);\n reduce(h);\n scalarmult(p, q, h);\n\n scalarbase(q, sm.subarray(32));\n add(p, q);\n pack(t, p);\n\n n -= 64;\n if (crypto_verify_32(sm, 0, t, 0)) {\n for (i = 0; i < n; i++) m[i] = 0;\n return -1;\n }\n\n for (i = 0; i < n; i++) m[i] = sm[i + 64];\n return n;\n}\n\nvar crypto_secretbox_KEYBYTES = 32,\n crypto_secretbox_NONCEBYTES = 24,\n crypto_secretbox_ZEROBYTES = 32,\n crypto_secretbox_BOXZEROBYTES = 16,\n crypto_scalarmult_BYTES = 32,\n crypto_scalarmult_SCALARBYTES = 32,\n crypto_box_PUBLICKEYBYTES = 32,\n crypto_box_SECRETKEYBYTES = 32,\n crypto_box_BEFORENMBYTES = 32,\n crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,\n crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,\n crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,\n crypto_sign_BYTES = 64,\n crypto_sign_PUBLICKEYBYTES = 32,\n crypto_sign_SECRETKEYBYTES = 64,\n crypto_sign_SEEDBYTES = 32,\n crypto_hash_BYTES = 64;\n\nnacl.lowlevel = {\n crypto_core_hsalsa20: crypto_core_hsalsa20,\n crypto_stream_xor: crypto_stream_xor,\n crypto_stream: crypto_stream,\n crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,\n crypto_stream_salsa20: crypto_stream_salsa20,\n crypto_onetimeauth: crypto_onetimeauth,\n crypto_onetimeauth_verify: crypto_onetimeauth_verify,\n crypto_verify_16: crypto_verify_16,\n crypto_verify_32: crypto_verify_32,\n crypto_secretbox: crypto_secretbox,\n crypto_secretbox_open: crypto_secretbox_open,\n crypto_scalarmult: crypto_scalarmult,\n crypto_scalarmult_base: crypto_scalarmult_base,\n crypto_box_beforenm: crypto_box_beforenm,\n crypto_box_afternm: crypto_box_afternm,\n crypto_box: crypto_box,\n crypto_box_open: crypto_box_open,\n crypto_box_keypair: crypto_box_keypair,\n crypto_hash: crypto_hash,\n crypto_sign: crypto_sign,\n crypto_sign_keypair: crypto_sign_keypair,\n crypto_sign_open: crypto_sign_open,\n\n crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,\n crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,\n crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,\n crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,\n crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,\n crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,\n crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,\n crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,\n crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,\n crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,\n crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,\n crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,\n crypto_sign_BYTES: crypto_sign_BYTES,\n crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,\n crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,\n crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,\n crypto_hash_BYTES: crypto_hash_BYTES,\n\n gf: gf,\n D: D,\n L: L,\n pack25519: pack25519,\n unpack25519: unpack25519,\n M: M,\n A: A,\n S: S,\n Z: Z,\n pow2523: pow2523,\n add: add,\n set25519: set25519,\n modL: modL,\n scalarmult: scalarmult,\n scalarbase: scalarbase,\n};\n\n/* High-level API */\n\nfunction checkLengths(k, n) {\n if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');\n if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');\n}\n\nfunction checkBoxLengths(pk, sk) {\n if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');\n if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');\n}\n\nfunction checkArrayTypes() {\n for (var i = 0; i < arguments.length; i++) {\n if (!(arguments[i] instanceof Uint8Array))\n throw new TypeError('unexpected type, use Uint8Array');\n }\n}\n\nfunction cleanup(arr) {\n for (var i = 0; i < arr.length; i++) arr[i] = 0;\n}\n\nnacl.randomBytes = function(n) {\n var b = new Uint8Array(n);\n randombytes(b, n);\n return b;\n};\n\nnacl.secretbox = function(msg, nonce, key) {\n checkArrayTypes(msg, nonce, key);\n checkLengths(key, nonce);\n var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);\n var c = new Uint8Array(m.length);\n for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];\n crypto_secretbox(c, m, m.length, nonce, key);\n return c.subarray(crypto_secretbox_BOXZEROBYTES);\n};\n\nnacl.secretbox.open = function(box, nonce, key) {\n checkArrayTypes(box, nonce, key);\n checkLengths(key, nonce);\n var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);\n var m = new Uint8Array(c.length);\n for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];\n if (c.length < 32) return null;\n if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;\n return m.subarray(crypto_secretbox_ZEROBYTES);\n};\n\nnacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;\nnacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;\nnacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;\n\nnacl.scalarMult = function(n, p) {\n checkArrayTypes(n, p);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');\n if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');\n var q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult(q, n, p);\n return q;\n};\n\nnacl.scalarMult.base = function(n) {\n checkArrayTypes(n);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');\n var q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult_base(q, n);\n return q;\n};\n\nnacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;\nnacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;\n\nnacl.box = function(msg, nonce, publicKey, secretKey) {\n var k = nacl.box.before(publicKey, secretKey);\n return nacl.secretbox(msg, nonce, k);\n};\n\nnacl.box.before = function(publicKey, secretKey) {\n checkArrayTypes(publicKey, secretKey);\n checkBoxLengths(publicKey, secretKey);\n var k = new Uint8Array(crypto_box_BEFORENMBYTES);\n crypto_box_beforenm(k, publicKey, secretKey);\n return k;\n};\n\nnacl.box.after = nacl.secretbox;\n\nnacl.box.open = function(msg, nonce, publicKey, secretKey) {\n var k = nacl.box.before(publicKey, secretKey);\n return nacl.secretbox.open(msg, nonce, k);\n};\n\nnacl.box.open.after = nacl.secretbox.open;\n\nnacl.box.keyPair = function() {\n var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);\n var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);\n crypto_box_keypair(pk, sk);\n return {publicKey: pk, secretKey: sk};\n};\n\nnacl.box.keyPair.fromSecretKey = function(secretKey) {\n checkArrayTypes(secretKey);\n if (secretKey.length !== crypto_box_SECRETKEYBYTES)\n throw new Error('bad secret key size');\n var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);\n crypto_scalarmult_base(pk, secretKey);\n return {publicKey: pk, secretKey: new Uint8Array(secretKey)};\n};\n\nnacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;\nnacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;\nnacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;\nnacl.box.nonceLength = crypto_box_NONCEBYTES;\nnacl.box.overheadLength = nacl.secretbox.overheadLength;\n\nnacl.sign = function(msg, secretKey) {\n checkArrayTypes(msg, secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error('bad secret key size');\n var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);\n crypto_sign(signedMsg, msg, msg.length, secretKey);\n return signedMsg;\n};\n\nnacl.sign.open = function(signedMsg, publicKey) {\n checkArrayTypes(signedMsg, publicKey);\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error('bad public key size');\n var tmp = new Uint8Array(signedMsg.length);\n var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);\n if (mlen < 0) return null;\n var m = new Uint8Array(mlen);\n for (var i = 0; i < m.length; i++) m[i] = tmp[i];\n return m;\n};\n\nnacl.sign.detached = function(msg, secretKey) {\n var signedMsg = nacl.sign(msg, secretKey);\n var sig = new Uint8Array(crypto_sign_BYTES);\n for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];\n return sig;\n};\n\nnacl.sign.detached.verify = function(msg, sig, publicKey) {\n checkArrayTypes(msg, sig, publicKey);\n if (sig.length !== crypto_sign_BYTES)\n throw new Error('bad signature size');\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error('bad public key size');\n var sm = new Uint8Array(crypto_sign_BYTES + msg.length);\n var m = new Uint8Array(crypto_sign_BYTES + msg.length);\n var i;\n for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];\n for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];\n return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);\n};\n\nnacl.sign.keyPair = function() {\n var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n crypto_sign_keypair(pk, sk);\n return {publicKey: pk, secretKey: sk};\n};\n\nnacl.sign.keyPair.fromSecretKey = function(secretKey) {\n checkArrayTypes(secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error('bad secret key size');\n var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];\n return {publicKey: pk, secretKey: new Uint8Array(secretKey)};\n};\n\nnacl.sign.keyPair.fromSeed = function(seed) {\n checkArrayTypes(seed);\n if (seed.length !== crypto_sign_SEEDBYTES)\n throw new Error('bad seed size');\n var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n for (var i = 0; i < 32; i++) sk[i] = seed[i];\n crypto_sign_keypair(pk, sk, true);\n return {publicKey: pk, secretKey: sk};\n};\n\nnacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;\nnacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;\nnacl.sign.seedLength = crypto_sign_SEEDBYTES;\nnacl.sign.signatureLength = crypto_sign_BYTES;\n\nnacl.hash = function(msg) {\n checkArrayTypes(msg);\n var h = new Uint8Array(crypto_hash_BYTES);\n crypto_hash(h, msg, msg.length);\n return h;\n};\n\nnacl.hash.hashLength = crypto_hash_BYTES;\n\nnacl.verify = function(x, y) {\n checkArrayTypes(x, y);\n // Zero length arguments are considered not equal.\n if (x.length === 0 || y.length === 0) return false;\n if (x.length !== y.length) return false;\n return (vn(x, 0, y, 0, x.length) === 0) ? true : false;\n};\n\nnacl.setPRNG = function(fn) {\n randombytes = fn;\n};\n\n(function() {\n // Initialize PRNG if environment provides CSPRNG.\n // If not, methods calling randombytes will throw.\n var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;\n if (crypto && crypto.getRandomValues) {\n // Browsers.\n var QUOTA = 65536;\n nacl.setPRNG(function(x, n) {\n var i, v = new Uint8Array(n);\n for (i = 0; i < n; i += QUOTA) {\n crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));\n }\n for (i = 0; i < n; i++) x[i] = v[i];\n cleanup(v);\n });\n } else if (true) {\n // Node.js.\n crypto = __webpack_require__(/*! crypto */ \"?dba7\");\n if (crypto && crypto.randomBytes) {\n nacl.setPRNG(function(x, n) {\n var i, v = crypto.randomBytes(n);\n for (i = 0; i < n; i++) x[i] = v[i];\n cleanup(v);\n });\n }\n }\n})();\n\n})( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/tweetnacl/nacl-fast.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.IFileGetContentsQuery} HashgraphProto.proto.IFileGetContentsQuery + * @typedef {import("@hashgraph/proto").proto.IFileGetContentsResponse} HashgraphProto.proto.IFileGetContentsResponse + * @typedef {import("@hashgraph/proto").proto.FileGetContentsResponse.IFileContents} HashgraphProto.proto.FileGetContentsResponse.IFileContents + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ "./node_modules/util-deprecate/browser.js": -/*!************************************************!*\ - !*** ./node_modules/util-deprecate/browser.js ***! - \************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/** + * @augments {Query} + */ +class FileContentsQuery extends Query_Query { + /** + * @param {object} [props] + * @param {FileId | string} [props.fileId] + */ + constructor(props = {}) { + super(); + + /** + * @type {?FileId} + * @private + */ + this._fileId = null; + if (props.fileId != null) { + this.setFileId(props.fileId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {FileContentsQuery} + */ + static _fromProtobuf(query) { + const contents = + /** @type {HashgraphProto.proto.IFileGetContentsQuery} */ ( + query.fileGetContents + ); + + return new FileContentsQuery({ + fileId: + contents.fileID != null + ? FileId._fromProtobuf(contents.fileID) + : undefined, + }); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._fileId != null) { + this._fileId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.file.getFileContent(request); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * Set the file ID for which the info is being requested. + * + * @param {FileId | string} fileId + * @returns {FileContentsQuery} + */ + setFileId(fileId) { + this._fileId = + typeof fileId === "string" + ? FileId.fromString(fileId) + : fileId.clone(); + + return this; + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const fileGetContents = + /** @type {HashgraphProto.proto.IFileGetContentsResponse} */ ( + response.fileGetContents + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + fileGetContents.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @returns {Promise} + */ + _mapResponse(response) { + const fileContentsResponse = + /** @type {HashgraphProto.proto.IFileGetContentsResponse} */ ( + response.fileGetContents + ); + const fileConents = + /** @type {HashgraphProto.proto.FileGetContentsResponse.IFileContents} */ ( + fileContentsResponse.fileContents + ); + const contents = /** @type {Uint8Array} */ (fileConents.contents); + + return Promise.resolve(contents); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + fileGetContents: { + header, + fileID: + this._fileId != null ? this._fileId._toProtobuf() : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `FileContentsQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("fileGetContents", FileContentsQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -eval("\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!__webpack_require__.g.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = __webpack_require__.g.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/util-deprecate/browser.js?"); -/***/ }), -/***/ "?ff28": -/*!************************!*\ - !*** buffer (ignored) ***! - \************************/ -/***/ (function() { -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/buffer_(ignored)?"); -/***/ }), -/***/ "?0707": -/*!************************!*\ - !*** buffer (ignored) ***! - \************************/ -/***/ (function() { -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/buffer_(ignored)?"); -/***/ }), +const { proto: FileInfo_proto } = lib_namespaceObject; -/***/ "?8131": -/*!************************!*\ - !*** buffer (ignored) ***! - \************************/ -/***/ (function() { +/** + * Response when the client sends the node CryptoGetInfoQuery. + */ +class FileInfo { + /** + * @private + * @param {object} props + * @param {FileId} props.fileId + * @param {Long} props.size + * @param {Timestamp} props.expirationTime + * @param {boolean} props.isDeleted + * @param {KeyList} props.keys + * @param {string} props.fileMemo + * @param {LedgerId|null} props.ledgerId + */ + constructor(props) { + /** + * The ID of the file for which information is requested. + * + * @readonly + */ + this.fileId = props.fileId; + + /** + * Number of bytes in contents. + * + * @readonly + */ + this.size = props.size; + + /** + * The current time at which this account is set to expire. + * + * @readonly + */ + this.expirationTime = props.expirationTime; + + /** + * True if deleted but not yet expired. + * + * @readonly + */ + this.isDeleted = props.isDeleted; + + /** + * One of these keys must sign in order to delete the file. + * All of these keys must sign in order to update the file. + * + * @readonly + */ + this.keys = props.keys; + + this.fileMemo = props.fileMemo; + + this.ledgerId = props.ledgerId; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.FileGetInfoResponse.IFileInfo} info + * @returns {FileInfo} + */ + static _fromProtobuf(info) { + const size = /** @type {Long | number} */ (info.size); + + return new FileInfo({ + fileId: FileId._fromProtobuf( + /** @type {HashgraphProto.proto.IFileID} */ (info.fileID), + ), + size: size instanceof src_long ? size : src_long.fromValue(size), + expirationTime: Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.expirationTime + ), + ), + isDeleted: /** @type {boolean} */ (info.deleted), + keys: + info.keys != null + ? src_KeyList_KeyList.__fromProtobufKeyList(info.keys) + : new src_KeyList_KeyList(), + fileMemo: info.memo != null ? info.memo : "", + ledgerId: + info.ledgerId != null + ? LedgerId.fromBytes(info.ledgerId) + : null, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.FileGetInfoResponse.IFileInfo} + */ + _toProtobuf() { + return { + fileID: this.fileId._toProtobuf(), + size: this.size, + expirationTime: this.expirationTime._toProtobuf(), + deleted: this.isDeleted, + keys: this.keys._toProtobufKey().keyList, + memo: this.fileMemo, + ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {FileInfo} + */ + static fromBytes(bytes) { + return FileInfo._fromProtobuf( + lib.proto.FileGetInfoResponse.FileInfo.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return FileInfo_proto.FileGetInfoResponse.FileInfo.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/buffer_(ignored)?"); -/***/ }), -/***/ "?f9d4": -/*!************************!*\ - !*** buffer (ignored) ***! - \************************/ -/***/ (function() { -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/buffer_(ignored)?"); +// eslint-disable-next-line @typescript-eslint/no-unused-vars -/***/ }), -/***/ "?7a28": -/*!************************!*\ - !*** buffer (ignored) ***! - \************************/ -/***/ (function() { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.IFileGetInfoQuery} HashgraphProto.proto.IFileGetInfoQuery + * @typedef {import("@hashgraph/proto").proto.IFileGetInfoResponse} HashgraphProto.proto.IFileGetInfoResponse + * @typedef {import("@hashgraph/proto").proto.FileGetInfoResponse.IFileInfo} HashgraphProto.proto.IFileInfo + */ -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/buffer_(ignored)?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +/** + * @augments {Query} + */ +class FileInfoQuery extends Query_Query { + /** + * @param {object} [props] + * @param {FileId | string} [props.fileId] + */ + constructor(props = {}) { + super(); + + /** + * @type {?FileId} + * @private + */ + this._fileId = null; + if (props.fileId != null) { + this.setFileId(props.fileId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {FileInfoQuery} + */ + static _fromProtobuf(query) { + const info = /** @type {HashgraphProto.proto.IFileGetInfoQuery} */ ( + query.fileGetInfo + ); + + return new FileInfoQuery({ + fileId: + info.fileID != null + ? FileId._fromProtobuf(info.fileID) + : undefined, + }); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * Set the file ID for which the info is being requested. + * + * @param {FileId | string} fileId + * @returns {FileInfoQuery} + */ + setFileId(fileId) { + this._fileId = + typeof fileId === "string" + ? FileId.fromString(fileId) + : fileId.clone(); + + return this; + } + + /** + * @override + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + return super.getCost(client); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._fileId != null) { + this._fileId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.file.getFileInfo(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const fileGetInfo = + /** @type {HashgraphProto.proto.IFileGetInfoResponse} */ ( + response.fileGetInfo + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + fileGetInfo.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const info = /** @type {HashgraphProto.proto.IFileGetInfoResponse} */ ( + response.fileGetInfo + ); + + return Promise.resolve( + FileInfo._fromProtobuf( + /** @type {HashgraphProto.proto.IFileInfo} */ (info.fileInfo), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + fileGetInfo: { + header, + fileID: + this._fileId != null ? this._fileId._toProtobuf() : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `FileInfoQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("fileGetInfo", FileInfoQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/file/FileUpdateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "?ed1b": -/*!**********************!*\ - !*** util (ignored) ***! - \**********************/ -/***/ (function() { -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/util_(ignored)?"); -/***/ }), -/***/ "?d17e": -/*!**********************!*\ - !*** util (ignored) ***! - \**********************/ -/***/ (function() { -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/util_(ignored)?"); -/***/ }), -/***/ "?dba7": -/*!************************!*\ - !*** crypto (ignored) ***! - \************************/ -/***/ (function() { -eval("/* (ignored) */\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/crypto_(ignored)?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IFileUpdateTransactionBody} HashgraphProto.proto.IFileUpdateTransactionBody + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ "./node_modules/@hashgraph/cryptography/src/BadKeyError.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/BadKeyError.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Update a new Hedera™ crypto-currency file. + */ +class FileUpdateTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {FileId | string} [props.fileId] + * @param {Key[] | KeyList} [props.keys] + * @param {Timestamp | Date} [props.expirationTime] + * @param {Uint8Array | string} [props.contents] + * @param {string} [props.fileMemo] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?FileId} + */ + this._fileId = null; + + /** + * @private + * @type {?Key[]} + */ + this._keys = null; + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = null; + + /** + * @private + * @type {?Uint8Array} + */ + this._contents = null; + + /** + * @private + * @type {?string} + */ + this._fileMemo = null; + + if (props.fileId != null) { + this.setFileId(props.fileId); + } + + if (props.keys != null) { + this.setKeys(props.keys); + } + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + + if (props.contents != null) { + this.setContents(props.contents); + } + + if (props.fileMemo && props.fileMemo != null) { + this.setFileMemo(props.fileMemo); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {FileUpdateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const update = + /** @type {HashgraphProto.proto.IFileUpdateTransactionBody} */ ( + body.fileUpdate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new FileUpdateTransaction({ + fileId: + update.fileID != null + ? FileId._fromProtobuf(update.fileID) + : undefined, + keys: + update.keys != null + ? update.keys.keys != null + ? update.keys.keys.map((key) => + src_Key_Key._fromProtobufKey(key), + ) + : undefined + : undefined, + expirationTime: + update.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(update.expirationTime) + : undefined, + contents: update.contents != null ? update.contents : undefined, + fileMemo: + update.memo != null + ? update.memo.value != null + ? update.memo.value + : undefined + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * Set the keys which must sign any transactions modifying this file. Required. + * + * All keys must sign to modify the file's contents or keys. No key is required + * to sign for extending the expiration time (except the one for the operator account + * paying for the transaction). Only one key must sign to delete the file, however. + * + * To require more than one key to sign to delete a file, add them to a + * KeyList and pass that here. + * + * The network currently requires a file to have at least one key (or key list or threshold key) + * but this requirement may be lifted in the future. + * + * @param {FileId | string} fileId + * @returns {this} + */ + setFileId(fileId) { + this._requireNotFrozen(); + this._fileId = + typeof fileId === "string" + ? FileId.fromString(fileId) + : fileId.clone(); + + return this; + } + + /** + * @returns {?Key[]} + */ + get keys() { + return this._keys; + } + + /** + * Set the keys which must sign any transactions modifying this file. Required. + * + * All keys must sign to modify the file's contents or keys. No key is required + * to sign for extending the expiration time (except the one for the operator account + * paying for the transaction). Only one key must sign to delete the file, however. + * + * To require more than one key to sign to delete a file, add them to a + * KeyList and pass that here. + * + * The network currently requires a file to have at least one key (or key list or threshold key) + * but this requirement may be lifted in the future. + * + * @param {Key[] | KeyList} keys + * @returns {this} + */ + setKeys(keys) { + this._requireNotFrozen(); + if (keys instanceof src_KeyList_KeyList && keys.threshold != null) { + throw new Error("Cannot set threshold key as file key"); + } + + this._keys = keys instanceof src_KeyList_KeyList ? keys.toArray() : keys; + + return this; + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * Set the instant at which this file will expire, after which its contents will no longer be + * available. + * + * Defaults to 1/4 of a Julian year from the instant FileUpdateTransaction + * was invoked. + * + * May be extended using FileUpdateTransaction#setExpirationTime(Timestamp). + * + * @param {Timestamp | Date} expirationTime + * @returns {this} + */ + setExpirationTime(expirationTime) { + this._requireNotFrozen(); + this._expirationTime = + expirationTime instanceof Timestamp_Timestamp + ? expirationTime + : Timestamp_Timestamp.fromDate(expirationTime); + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get contents() { + return this._contents; + } + + /** + * Set the given byte array as the file's contents. + * + * This may be omitted to update an empty file. + * + * Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the + * network; if you exceed this you may receive a HederaPreCheckStatusException + * with Status#TransactionOversize. + * + * In this case, you will need to break the data into chunks of less than ~6KiB and execute this + * transaction with the first chunk and then use FileAppendTransaction with + * FileAppendTransaction#setContents(Uint8Array) for the remaining chunks. + * + * @param {Uint8Array | string} contents + * @returns {this} + */ + setContents(contents) { + this._requireNotFrozen(); + this._contents = + contents instanceof Uint8Array ? contents : encoding_utf8_browser_encode(contents); + + return this; + } + + /** + * @returns {?string} + */ + get fileMemo() { + return this._fileMemo; + } + + /** + * @param {string} memo + * @returns {this} + */ + setFileMemo(memo) { + this._requireNotFrozen(); + this._fileMemo = memo; + + return this; + } + + /** + * @returns {this} + */ + clearFileMemo() { + this._requireNotFrozen(); + this._fileMemo = null; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._fileId != null) { + this._fileId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.file.updateFile(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "fileUpdate"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IFileUpdateTransactionBody} + */ + _makeTransactionData() { + return { + fileID: this._fileId != null ? this._fileId._toProtobuf() : null, + keys: + this._keys != null + ? { + keys: this._keys.map((key) => key._toProtobufKey()), + } + : null, + expirationTime: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + contents: this._contents, + memo: + this._fileMemo != null + ? { + value: this._fileMemo, + } + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `FileUpdateTransaction:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +TRANSACTION_REGISTRY.set("fileUpdate", FileUpdateTransaction._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/FreezeType.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ BadKeyError; }\n/* harmony export */ });\n/**\n * Signals that a key could not be realized from the input.\n */\nclass BadKeyError extends Error {\n /**\n * @param {Error | string} messageOrCause\n */\n constructor(messageOrCause) {\n super(\n messageOrCause instanceof Error\n ? messageOrCause.message\n : messageOrCause\n );\n\n this.name = \"BadKeyError\";\n\n if (messageOrCause instanceof Error) {\n /** @type {Error=} */\n this.cause = messageOrCause;\n this.stack = messageOrCause.stack;\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/BadKeyError.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.FreezeType} HashgraphProto.proto.FreezeType + */ -/***/ }), +class FreezeType { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case FreezeType.UnknownFreezeType: + return "UNKNOWN_FREEZE_TYPE"; + case FreezeType.FreezeOnly: + return "FREEZE_ONLY"; + case FreezeType.PrepareUpgrade: + return "PREPARE_UPGRADE"; + case FreezeType.FreezeUpgrade: + return "FREEZE_UPGRADE"; + case FreezeType.FreezeAbort: + return "FREEZE_ABORT"; + case FreezeType.TelemetryUpgrade: + return "TELEMETRY_UPGRADE"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @internal + * @param {number} code + * @returns {FreezeType} + */ + static _fromCode(code) { + switch (code) { + case 0: + return FreezeType.UnknownFreezeType; + case 1: + return FreezeType.FreezeOnly; + case 2: + return FreezeType.PrepareUpgrade; + case 3: + return FreezeType.FreezeUpgrade; + case 4: + return FreezeType.FreezeAbort; + case 5: + return FreezeType.TelemetryUpgrade; + default: + throw new Error( + `(BUG) Status.fromCode() does not handle code: ${code}`, + ); + } + } + + /** + * @returns {HashgraphProto.proto.FreezeType} + */ + valueOf() { + return this._code; + } +} + +/** + * An (invalid) default value for this enum, to ensure the client explicitly sets + * the intended type of freeze transaction. + */ +FreezeType.UnknownFreezeType = new FreezeType(0); -/***/ "./node_modules/@hashgraph/cryptography/src/BadMnemonicError.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/BadMnemonicError.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Freezes the network at the specified time. The start_time field must be provided and + * must reference a future time. Any values specified for the update_file and file_hash + * fields will be ignored. This transaction does not perform any network changes or + * upgrades and requires manual intervention to restart the network. + */ +FreezeType.FreezeOnly = new FreezeType(1); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ BadMnemonicError; }\n/* harmony export */ });\n/* harmony import */ var _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadMnemonicReason.js */ \"./node_modules/@hashgraph/cryptography/src/BadMnemonicReason.js\");\n/** @typedef {import(\"./Mnemonic.js\").default} Mnemonic */\n\n\nclass BadMnemonicError extends Error {\n /**\n * @param {Mnemonic} mnemonic\n * @param {string} reason\n * @param {number[]} unknownWordIndices\n * @hideconstructor\n */\n constructor(mnemonic, reason, unknownWordIndices) {\n let reasonMessage;\n\n switch (reason) {\n case _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].BadLength:\n reasonMessage = \"mnemonic is of an unexpected number of words\";\n break;\n\n case _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].ChecksumMismatch:\n reasonMessage =\n \"checksum byte in mnemonic did not match the rest of the mnemonic\";\n break;\n\n case _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].UnknownWords:\n reasonMessage =\n \"mnemonic contained words that are not in the standard word list\";\n break;\n\n default:\n throw new Error(\n `unexpected value ${reason.toString()} for 'reason'`\n );\n }\n\n super(`invalid mnemonic: ${reasonMessage}`);\n\n if (typeof Error.captureStackTrace !== \"undefined\") {\n Error.captureStackTrace(this, BadMnemonicError);\n }\n\n this.name = \"BadMnemonicError\";\n\n /** The reason for which the mnemonic failed validation. */\n this.reason = reason;\n\n /** The mnemonic that failed validation. */\n this.mnemonic = mnemonic;\n\n /**\n * The indices in the mnemonic that were not found in the BIP-39\n * standard English word list.\n */\n this.unknownWordIndices = unknownWordIndices;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/BadMnemonicError.js?"); +/** + * A non-freezing operation that initiates network wide preparation in advance of a + * scheduled freeze upgrade. The update_file and file_hash fields must be provided and + * valid. The start_time field may be omitted and any value present will be ignored. + */ +FreezeType.PrepareUpgrade = new FreezeType(2); -/***/ }), +/** + * Freezes the network at the specified time and performs the previously prepared + * automatic upgrade across the entire network. + */ +FreezeType.FreezeUpgrade = new FreezeType(3); -/***/ "./node_modules/@hashgraph/cryptography/src/BadMnemonicReason.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/BadMnemonicReason.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Aborts a pending network freeze operation. + */ +FreezeType.FreezeAbort = new FreezeType(4); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/**\n * Possible statuses for {@link Mnemonic#validate()}.\n *\n * @readonly\n * @enum {string}\n */\nconst BadMnemonicReason = Object.freeze({\n /**\n * The mnemonic did not have a supported number of words (12 or 24 for regular and 22 for legacy).\n */\n BadLength: \"BadLength\",\n\n /**\n * The mnemonic contained words which were not found in the word list.\n */\n UnknownWords: \"UnknownWords\",\n\n /**\n * The checksum encoded in the mnemonic did not match the checksum we just calculated for\n * that mnemonic.\n *\n * 24-word mnemonics have an 8-bit checksum that is appended to the 32 bytes of source entropy\n * after being calculated from it, before being encoded into words.\n *\n * This could happen if two or more of the words were entered out of the original order or\n * replaced with another from the standard word list (as this is only returned if all the words\n * exist in the word list).\n */\n ChecksumMismatch: \"ChecksumMismatch\",\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (BadMnemonicReason);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/BadMnemonicReason.js?"); +/** + * Performs an immediate upgrade on auxilary services and containers providing + * telemetry/metrics. Does not impact network operations. + */ +FreezeType.TelemetryUpgrade = new FreezeType(5); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/system/FreezeTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/Cache.js": -/*!***********************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/Cache.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/**\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n * @typedef {import(\"./Ed25519PrivateKey.js\").default} Ed25519PrivateKey\n * @typedef {import(\"./EcdsaPrivateKey.js\").default} EcdsaPrivateKey\n */\n\nconst CACHE = {\n /** @type {((key: Ed25519PrivateKey | EcdsaPrivateKey) => PrivateKey) | null} */\n privateKeyConstructor: null,\n\n /** @type {((bytes: Uint8Array) => PrivateKey) | null} */\n privateKeyFromBytes: null,\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (CACHE);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/Cache.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/EcdsaPrivateKey.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/EcdsaPrivateKey.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EcdsaPrivateKey; }\n/* harmony export */ });\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EcdsaPublicKey.js */ \"./node_modules/@hashgraph/cryptography/src/EcdsaPublicKey.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n/* harmony import */ var _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./primitive/ecdsa.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js\");\n/* harmony import */ var _util_array_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util/array.js */ \"./node_modules/@hashgraph/cryptography/src/util/array.js\");\n\n\n\n\n\n\nconst derPrefix = \"3030020100300706052b8104000a04220420\";\nconst derPrefixBytes = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(derPrefix);\n\n/**\n * @typedef {object} KeyPair\n * @property {Uint8Array} publicKey\n * @property {Uint8Array} privateKey\n */\n\nclass EcdsaPrivateKey {\n /**\n * @hideconstructor\n * @internal\n * @param {KeyPair} keyPair\n * @param {(Uint8Array)=} chainCode\n */\n constructor(keyPair, chainCode) {\n /**\n * @type {KeyPair}\n * @readonly\n * @private\n */\n this._keyPair = keyPair;\n\n /**\n * @type {?Uint8Array}\n * @readonly\n */\n this._chainCode = chainCode != null ? chainCode : null;\n }\n\n /**\n * @returns {string}\n */\n get _type() {\n return \"secp256k1\";\n }\n\n /**\n * Generate a random ECDSA private key.\n *\n * @returns {EcdsaPrivateKey}\n */\n static generate() {\n return new EcdsaPrivateKey(_primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_3__.generate());\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise}\n */\n static async generateAsync() {\n return new EcdsaPrivateKey(await _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_3__.generateAsync());\n }\n\n /**\n * Construct a private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {EcdsaPrivateKey}\n */\n static fromBytes(data) {\n switch (data.length) {\n case 32:\n return EcdsaPrivateKey.fromBytesRaw(data);\n case 50:\n return EcdsaPrivateKey.fromBytesDer(data);\n default:\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `invalid private key length: ${data.length} bytes`\n );\n }\n }\n\n /**\n * Construct a private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {EcdsaPrivateKey}\n */\n static fromBytesDer(data) {\n if (data.length != 32 && !(0,_util_array_js__WEBPACK_IMPORTED_MODULE_4__.arrayStartsWith)(data, derPrefixBytes)) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"invalid der header\");\n }\n\n return new EcdsaPrivateKey(\n _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_3__.fromBytes(data.subarray(derPrefixBytes.length))\n );\n }\n\n /**\n * Construct a private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {EcdsaPrivateKey}\n */\n static fromBytesRaw(data) {\n return new EcdsaPrivateKey(_primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_3__.fromBytes(data));\n }\n\n /**\n * Construct a private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {EcdsaPrivateKey}\n */\n static fromString(text) {\n return EcdsaPrivateKey.fromBytes(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(text));\n }\n\n /**\n * Construct a private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {EcdsaPrivateKey}\n */\n static fromStringDer(text) {\n return EcdsaPrivateKey.fromBytesDer(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(text));\n }\n\n /**\n * Construct a private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {EcdsaPrivateKey}\n */\n static fromStringRaw(text) {\n return EcdsaPrivateKey.fromBytesRaw(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(text));\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {EcdsaPublicKey}\n */\n get publicKey() {\n return new _EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this._keyPair.publicKey);\n }\n\n /**\n * Sign a message with this private key.\n *\n * @param {Uint8Array} bytes\n * @returns {Uint8Array} - The signature bytes without the message\n */\n sign(bytes) {\n return _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_3__.sign(this._keyPair.privateKey, bytes);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n const bytes = new Uint8Array(derPrefixBytes.length + 32);\n\n bytes.set(derPrefixBytes, 0);\n bytes.set(\n this._keyPair.privateKey.subarray(0, 32),\n derPrefixBytes.length\n );\n\n return bytes;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n const bytes = new Uint8Array(32);\n bytes.set(this._keyPair.privateKey.slice(0, 32), 0);\n return bytes;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/EcdsaPrivateKey.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IFreezeTransactionBody} HashgraphProto.proto.IFreezeTransactionBody + */ -/***/ "./node_modules/@hashgraph/cryptography/src/EcdsaPublicKey.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/EcdsaPublicKey.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EcdsaPublicKey; }\n/* harmony export */ });\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/cryptography/src/Key.js\");\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _util_array_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/array.js */ \"./node_modules/@hashgraph/cryptography/src/util/array.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n/* harmony import */ var _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./primitive/ecdsa.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js\");\n/* harmony import */ var _primitive_keccak_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./primitive/keccak.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/keccak.js\");\n\n\n\n\n\n\n\nconst derPrefix = \"302d300706052b8104000a032200\";\nconst derPrefixBytes = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.decode(derPrefix);\n\n/**\n * An public key on the Hedera™ network.\n */\nclass EcdsaPublicKey extends _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @internal\n * @hideconstructor\n * @param {Uint8Array} keyData\n */\n constructor(keyData) {\n super();\n\n /**\n * @type {Uint8Array}\n * @private\n * @readonly\n */\n this._keyData = keyData;\n }\n\n /**\n * @returns {string}\n */\n get _type() {\n return \"secp256k1\";\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {EcdsaPublicKey}\n */\n static fromBytes(data) {\n switch (data.length) {\n case 33:\n return EcdsaPublicKey.fromBytesRaw(data);\n case 47:\n return EcdsaPublicKey.fromBytesDer(data);\n default:\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid public key length: ${data.length} bytes`\n );\n }\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {EcdsaPublicKey}\n */\n static fromBytesDer(data) {\n if (data.length != 47 || !(0,_util_array_js__WEBPACK_IMPORTED_MODULE_2__.arrayStartsWith)(data, derPrefixBytes)) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid public key length: ${data.length} bytes`\n );\n }\n\n return new EcdsaPublicKey(data.subarray(derPrefixBytes.length));\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {EcdsaPublicKey}\n */\n static fromBytesRaw(data) {\n if (data.length != 33) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid public key length: ${data.length} bytes`\n );\n }\n\n return new EcdsaPublicKey(data);\n }\n\n /**\n * Parse a public key from a string of hexadecimal digits.\n *\n * The public key may optionally be prefixed with\n * the DER header.\n *\n * @param {string} text\n * @returns {EcdsaPublicKey}\n */\n static fromString(text) {\n return EcdsaPublicKey.fromBytes(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.decode(text));\n }\n\n /**\n * Verify a signature on a message with this public key.\n *\n * @param {Uint8Array} message\n * @param {Uint8Array} signature\n * @returns {boolean}\n */\n verify(message, signature) {\n return _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_4__.verify(this._keyData, message, signature);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n const bytes = new Uint8Array(\n derPrefixBytes.length + this._keyData.length\n );\n\n bytes.set(derPrefixBytes, 0);\n bytes.set(this._keyData, derPrefixBytes.length);\n\n return bytes;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return new Uint8Array(this._keyData.subarray());\n }\n\n /**\n * @returns {string}\n */\n toEthereumAddress() {\n const hash = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.decode(\n (0,_primitive_keccak_js__WEBPACK_IMPORTED_MODULE_5__.keccak256)(\n `0x${_encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.encode(\n _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_4__.getFullPublicKey(this.toBytesRaw()).subarray(1)\n )}`\n )\n );\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.encode(hash.subarray(12));\n }\n\n /**\n * @param {EcdsaPublicKey} other\n * @returns {boolean}\n */\n equals(other) {\n return (0,_util_array_js__WEBPACK_IMPORTED_MODULE_2__.arrayEqual)(this._keyData, other._keyData);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/EcdsaPublicKey.js?"); +/** + * @typedef {object} HourMinute + * @property {number} hour + * @property {number} minute + */ -/***/ }), +class FreezeTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {HourMinute} [props.startTime] + * @param {HourMinute} [props.endTime] + * @param {Timestamp} [props.startTimestamp] + * @param {FileId} [props.updateFileId] + * @param {FileId} [props.fileId] + * @param {Uint8Array | string} [props.fileHash] + * @param { FreezeType } [props.freezeType] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?HourMinute} + */ + this._startTime = null; + + /** + * @private + * @type {?Timestamp} + */ + this._startTimestamp = null; + + /** + * @private + * @type {?HourMinute} + */ + this._endTime = null; + + /** + * @private + * @type {?FileId} + */ + this._fileId = null; + + /** + * @private + * @type {?Uint8Array} + */ + this._fileHash = null; + + /** + * @private + * @type {?FreezeType} + */ + this._freezeType = null; + + if (props.startTime != null) { + // eslint-disable-next-line deprecation/deprecation + this.setStartTime(props.startTime.hour, props.startTime.minute); + } + + if (props.endTime != null) { + // eslint-disable-next-line deprecation/deprecation + this.setEndTime(props.endTime.hour, props.endTime.minute); + } + + if (props.startTimestamp != null) { + this.setStartTimestamp(props.startTimestamp); + } + + if (props.updateFileId != null) { + // eslint-disable-next-line deprecation/deprecation + this.setUpdateFileId(props.updateFileId); + } + + if (props.fileId != null) { + this.setFileId(props.fileId); + } + + if (props.fileHash != null) { + this.setFileHash(props.fileHash); + } + + if (props.freezeType != null) { + this.setFreezeType(props.freezeType); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {FreezeTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const freeze = + /** @type {HashgraphProto.proto.IFreezeTransactionBody} */ ( + body.freeze + ); + + return Transaction_Transaction._fromProtobufTransactions( + new FreezeTransaction({ + startTime: + freeze.startHour != null && freeze.startMin != null + ? { + hour: freeze.startHour, + minute: freeze.startMin, + } + : undefined, + endTime: + freeze.endHour != null && freeze.endMin != null + ? { + hour: freeze.endHour, + minute: freeze.endMin, + } + : undefined, + startTimestamp: + freeze.startTime != null + ? Timestamp_Timestamp._fromProtobuf(freeze.startTime) + : undefined, + updateFileId: + freeze.updateFile != null + ? FileId._fromProtobuf(freeze.updateFile) + : undefined, + fileHash: freeze.fileHash != null ? freeze.fileHash : undefined, + freezeType: + freeze.freezeType != null + ? FreezeType._fromCode(freeze.freezeType) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @deprecated - Use `startTimestamp` instead + * @returns {?HourMinute} + */ + get startTime() { + return null; + } + + /** + * @deprecated - Use `startTimestamp` instead + * @param {number | string} startHourOrString + * @param {?number} startMinute + * @returns {FreezeTransaction} + */ + setStartTime(startHourOrString, startMinute) { + this._requireNotFrozen(); + if (typeof startHourOrString === "string") { + const split = startHourOrString.split(":"); + this._startTime = { + hour: Number(split[0]), + minute: Number(split[1]), + }; + } else { + this._startTime = { + hour: startHourOrString, + minute: /** @type {number} */ (startMinute), + }; + } + + return this; + } + + /** + * @returns {?Timestamp} + */ + get startTimestamp() { + return this._startTimestamp; + } + + /** + * @param {Timestamp} startTimestamp + * @returns {FreezeTransaction} + */ + setStartTimestamp(startTimestamp) { + this._requireNotFrozen(); + this._startTimestamp = startTimestamp; + + return this; + } + + /** + * @deprecated + * @returns {?HourMinute} + */ + get endTime() { + console.warn("`FreezeTransaction.endTime` is deprecated"); + return this._endTime; + } + + /** + * @deprecated + * @param {number | string} endHourOrString + * @param {?number} endMinute + * @returns {FreezeTransaction} + */ + setEndTime(endHourOrString, endMinute) { + console.warn("`FreezeTransaction.endTime` is deprecated"); + this._requireNotFrozen(); + if (typeof endHourOrString === "string") { + const split = endHourOrString.split(":"); + this._endTime = { + hour: Number(split[0]), + minute: Number(split[1]), + }; + } else { + this._endTime = { + hour: endHourOrString, + minute: /** @type {number} */ (endMinute), + }; + } + + return this; + } + + /** + * @deprecated - Use `fileId` instead + * @returns {?FileId} + */ + get updateFileId() { + return this.fileId; + } + + /** + * @deprecated - Use `setFileId()` instead + * @param {FileId} updateFileId + * @returns {FreezeTransaction} + */ + setUpdateFileId(updateFileId) { + return this.setFileId(updateFileId); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * @param {FileId} fileId + * @returns {FreezeTransaction} + */ + setFileId(fileId) { + this._requireNotFrozen(); + this._fileId = fileId; + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get fileHash() { + return this._fileHash; + } + + /** + * @param {Uint8Array | string} fileHash + * @returns {FreezeTransaction} + */ + setFileHash(fileHash) { + this._requireNotFrozen(); + this._fileHash = + typeof fileHash === "string" ? decode(fileHash) : fileHash; + + return this; + } + + /** + * @returns {?FreezeType} + */ + get freezeType() { + return this._freezeType; + } + + /** + * @param {FreezeType} freezeType + * @returns {FreezeTransaction} + */ + setFreezeType(freezeType) { + this._requireNotFrozen(); + this._freezeType = freezeType; + return this; + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "freeze"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IFreezeTransactionBody} + */ + _makeTransactionData() { + return { + startTime: + this._startTimestamp != null + ? this._startTimestamp._toProtobuf() + : null, + updateFile: + this._fileId != null ? this._fileId._toProtobuf() : null, + fileHash: this._fileHash, + freezeType: + this._freezeType != null ? this._freezeType.valueOf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `FreezeTransaction:${timestamp.toString()}`; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.freeze.freeze(request); + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +TRANSACTION_REGISTRY.set("freeze", FreezeTransaction._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/LiveHashAddTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/cryptography/src/Ed25519PrivateKey.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/Ed25519PrivateKey.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Ed25519PrivateKey; },\n/* harmony export */ \"derPrefix\": function() { return /* binding */ derPrefix; },\n/* harmony export */ \"derPrefixBytes\": function() { return /* binding */ derPrefixBytes; }\n/* harmony export */ });\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Ed25519PublicKey.js */ \"./node_modules/@hashgraph/cryptography/src/Ed25519PublicKey.js\");\n/* harmony import */ var tweetnacl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tweetnacl */ \"./node_modules/tweetnacl/nacl-fast.js\");\n/* harmony import */ var _util_array_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util/array.js */ \"./node_modules/@hashgraph/cryptography/src/util/array.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n/* harmony import */ var _primitive_random_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./primitive/random.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/random.js\");\n\n\n\n\n\n\n\nconst derPrefix = \"302e020100300506032b657004220420\";\nconst derPrefixBytes = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(derPrefix);\n\nclass Ed25519PrivateKey {\n /**\n * @hideconstructor\n * @internal\n * @param {nacl.SignKeyPair | Uint8Array} keyPair\n * @param {Uint8Array=} chainCode\n */\n constructor(keyPair, chainCode) {\n /**\n * @type {nacl.SignKeyPair}\n * @readonly\n * @private\n */\n this._keyPair =\n keyPair instanceof Uint8Array\n ? tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.keyPair.fromSeed(keyPair)\n : keyPair;\n\n /**\n * @type {?Uint8Array}\n * @readonly\n */\n this._chainCode = chainCode != null ? chainCode : null;\n }\n\n /**\n * @returns {string}\n */\n get _type() {\n return \"ED25519\";\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {Ed25519PrivateKey}\n */\n static generate() {\n // 32 bytes for the secret key\n // 32 bytes for the chain code (to support derivation)\n const entropy = _primitive_random_js__WEBPACK_IMPORTED_MODULE_5__.bytes(64);\n\n return new Ed25519PrivateKey(\n tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.keyPair.fromSeed(entropy.subarray(0, 32)),\n entropy.subarray(32)\n );\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise}\n */\n static async generateAsync() {\n // 32 bytes for the secret key\n // 32 bytes for the chain code (to support derivation)\n const entropy = await _primitive_random_js__WEBPACK_IMPORTED_MODULE_5__.bytesAsync(64);\n\n return new Ed25519PrivateKey(\n tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.keyPair.fromSeed(entropy.subarray(0, 32)),\n entropy.subarray(32)\n );\n }\n\n /**\n * Construct a private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {Ed25519PrivateKey}\n */\n static fromBytes(data) {\n switch (data.length) {\n case 48:\n return Ed25519PrivateKey.fromBytesDer(data);\n case 32:\n case 64:\n return Ed25519PrivateKey.fromBytesRaw(data);\n default:\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `invalid private key length: ${data.length} bytes`\n );\n }\n }\n\n /**\n * Construct a private key from bytes with DER header.\n *\n * @param {Uint8Array} data\n * @returns {Ed25519PrivateKey}\n */\n static fromBytesDer(data) {\n if (data.length != 48 || !(0,_util_array_js__WEBPACK_IMPORTED_MODULE_3__.arrayStartsWith)(data, derPrefixBytes)) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `invalid private key length: ${data.length} bytes`\n );\n }\n\n const keyPair = tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.keyPair.fromSeed(data.subarray(16));\n\n return new Ed25519PrivateKey(keyPair);\n }\n\n /**\n * Construct a private key from bytes without DER header.\n *\n * @param {Uint8Array} data\n * @returns {Ed25519PrivateKey}\n */\n static fromBytesRaw(data) {\n switch (data.length) {\n case 32:\n return new Ed25519PrivateKey(tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.keyPair.fromSeed(data));\n\n case 64:\n // priv + pub key\n return new Ed25519PrivateKey(\n tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.keyPair.fromSecretKey(data)\n );\n\n default:\n }\n\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `invalid private key length: ${data.length} bytes`\n );\n }\n\n /**\n * Construct a private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {Ed25519PrivateKey}\n */\n static fromString(text) {\n return Ed25519PrivateKey.fromBytes(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(text));\n }\n\n /**\n * Construct a private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {Ed25519PrivateKey}\n */\n static fromStringDer(text) {\n return Ed25519PrivateKey.fromBytesDer(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(text));\n }\n\n /**\n * Construct a private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {Ed25519PrivateKey}\n */\n static fromStringRaw(text) {\n return Ed25519PrivateKey.fromBytesRaw(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(text));\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {Ed25519PublicKey}\n */\n get publicKey() {\n return new _Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this._keyPair.publicKey);\n }\n\n /**\n * Sign a message with this private key.\n *\n * @param {Uint8Array} bytes\n * @returns {Uint8Array} - The signature bytes without the message\n */\n sign(bytes) {\n return tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.detached(bytes, this._keyPair.secretKey);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n const bytes = new Uint8Array(derPrefixBytes.length + 32);\n\n bytes.set(derPrefixBytes, 0);\n bytes.set(\n this._keyPair.secretKey.subarray(0, 32),\n derPrefixBytes.length\n );\n\n return bytes;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n // copy the bytes so they can't be modified accidentally\n return this._keyPair.secretKey.slice(0, 32);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/Ed25519PrivateKey.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/Ed25519PublicKey.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/Ed25519PublicKey.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Ed25519PublicKey; }\n/* harmony export */ });\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/cryptography/src/Key.js\");\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var tweetnacl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tweetnacl */ \"./node_modules/tweetnacl/nacl-fast.js\");\n/* harmony import */ var _util_array_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util/array.js */ \"./node_modules/@hashgraph/cryptography/src/util/array.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n\n\n\n\n\n\nconst derPrefix = \"302a300506032b6570032100\";\nconst derPrefixBytes = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(derPrefix);\n\n/**\n * An public key on the Hedera™ network.\n */\nclass Ed25519PublicKey extends _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @internal\n * @hideconstructor\n * @param {Uint8Array} keyData\n */\n constructor(keyData) {\n super();\n\n /**\n * @type {Uint8Array}\n * @private\n * @readonly\n */\n this._keyData = keyData;\n }\n\n /**\n * @returns {string}\n */\n get _type() {\n return \"ED25519\";\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {Ed25519PublicKey}\n */\n static fromBytes(data) {\n switch (data.length) {\n case 32:\n return Ed25519PublicKey.fromBytesRaw(data);\n case 44:\n return Ed25519PublicKey.fromBytesDer(data);\n default:\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid public key length: ${data.length} bytes`\n );\n }\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {Ed25519PublicKey}\n */\n static fromBytesDer(data) {\n if (data.length != 44 || !(0,_util_array_js__WEBPACK_IMPORTED_MODULE_3__.arrayStartsWith)(data, derPrefixBytes)) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid public key length: ${data.length} bytes`\n );\n }\n\n return new Ed25519PublicKey(data.subarray(12));\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {Ed25519PublicKey}\n */\n static fromBytesRaw(data) {\n if (data.length != 32) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid public key length: ${data.length} bytes`\n );\n }\n\n return new Ed25519PublicKey(data);\n }\n\n /**\n * Parse a public key from a string of hexadecimal digits.\n *\n * The public key may optionally be prefixed with\n * the DER header.\n *\n * @param {string} text\n * @returns {Ed25519PublicKey}\n */\n static fromString(text) {\n return Ed25519PublicKey.fromBytes(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(text));\n }\n\n /**\n * Verify a signature on a message with this public key.\n *\n * @param {Uint8Array} message\n * @param {Uint8Array} signature\n * @returns {boolean}\n */\n verify(message, signature) {\n return tweetnacl__WEBPACK_IMPORTED_MODULE_2__.sign.detached.verify(message, signature, this._keyData);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n const bytes = new Uint8Array(derPrefixBytes.length + 32);\n\n bytes.set(derPrefixBytes, 0);\n bytes.set(this._keyData.subarray(0, 32), derPrefixBytes.length);\n\n return bytes;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return this._keyData.slice();\n }\n\n /**\n * @param {Ed25519PublicKey} other\n * @returns {boolean}\n */\n equals(other) {\n return (0,_util_array_js__WEBPACK_IMPORTED_MODULE_3__.arrayEqual)(this._keyData, other._keyData);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/Ed25519PublicKey.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/Key.js": -/*!*********************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/Key.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ICryptoAddLiveHashTransactionBody} HashgraphProto.proto.ICryptoAddLiveHashTransactionBody + * @typedef {import("@hashgraph/proto").proto.ILiveHash} HashgraphProto.proto.ILiveHash + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Key; }\n/* harmony export */ });\nclass Key {}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/Key.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ }), +class LiveHashAddTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Uint8Array} [props.hash] + * @param {Key[]} [props.keys] + * @param {Duration | Long | number} [props.duration] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?Uint8Array} + */ + this._hash = null; + + /** + * @private + * @type {?Key[]} + */ + this._keys = null; + + /** + * @private + * @type {?Duration} + */ + this._duration = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + if (props.hash != null) { + this.setHash(props.hash); + } + + if (props.keys != null) { + this.setKeys(props.keys); + } + + if (props.duration != null) { + this.setDuration(props.duration); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {LiveHashAddTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const hashes = + /** @type {HashgraphProto.proto.ICryptoAddLiveHashTransactionBody} */ ( + body.cryptoAddLiveHash + ); + const liveHash_ = /** @type {HashgraphProto.proto.ILiveHash} */ ( + hashes.liveHash + ); + + return Transaction_Transaction._fromProtobufTransactions( + new LiveHashAddTransaction({ + hash: liveHash_.hash != null ? liveHash_.hash : undefined, + keys: + liveHash_.keys != null + ? liveHash_.keys.keys != null + ? liveHash_.keys.keys.map((key) => + src_Key_Key._fromProtobufKey(key), + ) + : undefined + : undefined, + duration: + liveHash_.duration != null + ? liveHash_.duration.seconds != null + ? liveHash_.duration.seconds + : undefined + : undefined, + accountId: + liveHash_.accountId != null + ? AccountId_AccountId._fromProtobuf(liveHash_.accountId) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?Uint8Array} + */ + get hash() { + return this._hash; + } + + /** + * @param {Uint8Array} hash + * @returns {LiveHashAddTransaction} + */ + setHash(hash) { + this._requireNotFrozen(); + this._hash = hash; + + return this; + } + + /** + * @returns {?Key[]} + */ + get keys() { + return this._keys; + } + + /** + * @param {Key[] | KeyList} keys + * @returns {LiveHashAddTransaction} + */ + setKeys(keys) { + this._requireNotFrozen(); + this._keys = keys instanceof src_KeyList_KeyList ? keys.toArray() : keys; + + return this; + } + + /** + * @returns {?Duration} + */ + get duration() { + return this._duration; + } + + /** + * @param {Duration | Long | number} duration + * @returns {LiveHashAddTransaction} + */ + setDuration(duration) { + this._requireNotFrozen(); + this._duration = + duration instanceof Duration_Duration ? duration : new Duration_Duration(duration); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {LiveHashAddTransaction} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.addLiveHash(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoAddLiveHash"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoAddLiveHashTransactionBody} + */ + _makeTransactionData() { + return { + liveHash: { + hash: this._hash, + keys: + this._keys != null + ? { + keys: this._keys.map((key) => + key._toProtobufKey(), + ), + } + : undefined, + duration: + this._duration != null + ? this._duration._toProtobuf() + : null, + accountId: + this._accountId != null + ? this._accountId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `LiveHashAddTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoAddLiveHash", + // eslint-disable-next-line @typescript-eslint/unbound-method + LiveHashAddTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/LiveHashDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/cryptography/src/KeyList.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/KeyList.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ KeyList; }\n/* harmony export */ });\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/cryptography/src/Key.js\");\n\n\n/**\n * A list of Keys (`Key`) with an optional threshold.\n */\nclass KeyList extends _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {?Key[]} [keys]\n * @param {?number} [threshold]\n */\n constructor(keys, threshold) {\n super();\n\n /**\n * @private\n * @type {Key[]}\n */\n // @ts-ignore\n if (keys == null) this._keys = [];\n //checks if the value for `keys` is passed as a single key\n //rather than a list that contains just one key\n else if (keys instanceof _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]) this._keys = [keys];\n else this._keys = keys;\n\n /**\n * @type {?number}\n */\n this._threshold = threshold == null ? null : threshold;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {KeyList}\n */\n static of(...keys) {\n return new KeyList(keys, null);\n }\n\n /**\n * @template T\n * @param {ArrayLike} arrayLike\n * @param {((key: Key) => Key)} [mapFn]\n * @param {T} [thisArg]\n * @returns {KeyList}\n */\n static from(arrayLike, mapFn, thisArg) {\n if (mapFn == null) {\n return new KeyList(Array.from(arrayLike));\n }\n\n return new KeyList(Array.from(arrayLike, mapFn, thisArg));\n }\n\n /**\n * @returns {?number}\n */\n get threshold() {\n return this._threshold;\n }\n\n /**\n * @param {number} threshold\n * @returns {this}\n */\n setThreshold(threshold) {\n this._threshold = threshold;\n return this;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {number}\n */\n push(...keys) {\n return this._keys.push(...keys);\n }\n\n /**\n * @param {number} start\n * @param {number} deleteCount\n * @param {Key[]} items\n * @returns {KeyList}\n */\n splice(start, deleteCount, ...items) {\n return new KeyList(\n this._keys.splice(start, deleteCount, ...items),\n this.threshold\n );\n }\n\n /**\n * @param {number=} start\n * @param {number=} end\n * @returns {KeyList}\n */\n slice(start, end) {\n return new KeyList(this._keys.slice(start, end), this.threshold);\n }\n\n /**\n * @returns {Iterator}\n */\n [Symbol.iterator]() {\n return this._keys[Symbol.iterator]();\n }\n\n /**\n * @returns {Key[]}\n */\n toArray() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this._keys.slice();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify({\n threshold: this._threshold,\n keys: this._keys.toString(),\n });\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/KeyList.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/Mnemonic.js": -/*!**************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/Mnemonic.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ICryptoDeleteLiveHashTransactionBody} HashgraphProto.proto.ICryptoDeleteLiveHashTransactionBody + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HARDEDED\": function() { return /* binding */ HARDEDED; },\n/* harmony export */ \"HEDERA_PATH\": function() { return /* binding */ HEDERA_PATH; },\n/* harmony export */ \"SLIP44_ECDSA_ETH_PATH\": function() { return /* binding */ SLIP44_ECDSA_ETH_PATH; },\n/* harmony export */ \"SLIP44_ECDSA_HEDERA_PATH\": function() { return /* binding */ SLIP44_ECDSA_HEDERA_PATH; },\n/* harmony export */ \"default\": function() { return /* binding */ Mnemonic; }\n/* harmony export */ });\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/cryptography/src/Cache.js\");\n/* harmony import */ var _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Ed25519PrivateKey.js */ \"./node_modules/@hashgraph/cryptography/src/Ed25519PrivateKey.js\");\n/* harmony import */ var _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BadMnemonicError.js */ \"./node_modules/@hashgraph/cryptography/src/BadMnemonicError.js\");\n/* harmony import */ var _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BadMnemonicReason.js */ \"./node_modules/@hashgraph/cryptography/src/BadMnemonicReason.js\");\n/* harmony import */ var _words_legacy_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./words/legacy.js */ \"./node_modules/@hashgraph/cryptography/src/words/legacy.js\");\n/* harmony import */ var _words_bip39_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./words/bip39.js */ \"./node_modules/@hashgraph/cryptography/src/words/bip39.js\");\n/* harmony import */ var tweetnacl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! tweetnacl */ \"./node_modules/tweetnacl/nacl-fast.js\");\n/* harmony import */ var _primitive_sha256_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./primitive/sha256.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/sha256.browser.js\");\n/* harmony import */ var _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./primitive/hmac.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js\");\n/* harmony import */ var _primitive_slip10_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./primitive/slip10.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/slip10.js\");\n/* harmony import */ var _primitive_bip32_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./primitive/bip32.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/bip32.js\");\n/* harmony import */ var _primitive_bip39_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./primitive/bip39.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/bip39.js\");\n/* harmony import */ var _util_entropy_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./util/entropy.js */ \"./node_modules/@hashgraph/cryptography/src/util/entropy.js\");\n/* harmony import */ var _primitive_random_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./primitive/random.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/random.js\");\n/* harmony import */ var _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./EcdsaPrivateKey.js */ \"./node_modules/@hashgraph/cryptography/src/EcdsaPrivateKey.js\");\n/* harmony import */ var _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./primitive/ecdsa.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst ED25519_SEED_TEXT = \"ed25519 seed\";\nconst ECDSA_SEED_TEXT = \"Bitcoin seed\";\n\nconst HARDEDED = 0x80000000;\n\n/// m/44'/3030'/0'/0' - All paths in EdDSA derivation are implicitly hardened.\nconst HEDERA_PATH = [44, 3030, 0, 0];\n\n/// m/44'/3030'/0'/0\nconst SLIP44_ECDSA_HEDERA_PATH = [\n 44 | HARDEDED,\n 3030 | HARDEDED,\n 0 | HARDEDED,\n 0,\n];\n\n/// m/44'/60'/0'/0\nconst SLIP44_ECDSA_ETH_PATH = [\n 44 | HARDEDED,\n 60 | HARDEDED,\n 0 | HARDEDED,\n 0,\n 0,\n];\n\n/**\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n */\n\n/**\n * Multi-word mnemonic phrase (BIP-39).\n *\n * Compatible with the official Hedera mobile\n * wallets (24-words or 22-words) and BRD (12-words).\n */\nclass Mnemonic {\n /**\n * @param {object} props\n * @param {string[]} props.words\n * @param {boolean} props.legacy\n * @throws {BadMnemonicError}\n * @hideconstructor\n * @private\n */\n constructor({ words, legacy }) {\n this.words = words;\n this._isLegacy = legacy;\n }\n\n /**\n * Returns a new random 24-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise}\n */\n static generate() {\n return Mnemonic._generate(24);\n }\n\n /**\n * Returns a new random 12-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise}\n */\n static generate12() {\n return Mnemonic._generate(12);\n }\n\n /**\n * @param {number} length\n * @returns {Promise}\n */\n static async _generate(length) {\n // only 12-word or 24-word lengths are supported\n let neededEntropy;\n\n if (length === 12) neededEntropy = 16;\n else if (length === 24) neededEntropy = 32;\n else {\n throw new Error(\n `unsupported phrase length ${length}, only 12 or 24 are supported`\n );\n }\n\n // inlined from (ISC) with heavy alternations for modern crypto\n // https://github.com/bitcoinjs/bip39/blob/8461e83677a1d2c685d0d5a9ba2a76bd228f74c6/ts_src/index.ts#L125\n const seed = await _primitive_random_js__WEBPACK_IMPORTED_MODULE_13__.bytesAsync(neededEntropy);\n const entropyBits = bytesToBinary(Array.from(seed));\n const checksumBits = await deriveChecksumBits(seed);\n const bits = entropyBits + checksumBits;\n const chunks = bits.match(/(.{1,11})/g);\n\n const words = (chunks != null ? chunks : []).map(\n (binary) => _words_bip39_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"][binaryToByte(binary)]\n );\n\n return new Mnemonic({ words, legacy: false });\n }\n\n /**\n * Construct a mnemonic from a list of words. Handles 12, 22 (legacy), and 24 words.\n *\n * An exception of BadMnemonicError will be thrown if the mnemonic\n * contains unknown words or fails the checksum. An invalid mnemonic\n * can still be used to create private keys, the exception will\n * contain the failing mnemonic in case you wish to ignore the\n * validation error and continue.\n *\n * @param {string[]} words\n * @throws {BadMnemonicError}\n * @returns {Promise}\n */\n static fromWords(words) {\n return new Mnemonic({\n words,\n legacy: words.length === 22,\n })._validate();\n }\n\n /**\n * @deprecated - Use `toEd25519PrivateKey()` or `toEcdsaPrivateKey()` instead\n * Recover a private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n toPrivateKey(passphrase = \"\") {\n return this.toEd25519PrivateKey(passphrase);\n }\n\n /**\n * Recover an Ed25519 private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise}\n */\n async toEd25519PrivateKey(passphrase = \"\", path = HEDERA_PATH) {\n if (this._isLegacy) {\n if (passphrase.length > 0) {\n throw new Error(\n \"legacy 22-word mnemonics do not support passphrases\"\n );\n }\n\n return this.toLegacyPrivateKey();\n }\n\n let { keyData, chainCode } = await this._toKeyData(\n passphrase,\n ED25519_SEED_TEXT\n );\n\n for (const index of path) {\n ({ keyData, chainCode } = await _primitive_slip10_js__WEBPACK_IMPORTED_MODULE_9__.derive(\n keyData,\n chainCode,\n index\n ));\n }\n\n const keyPair = tweetnacl__WEBPACK_IMPORTED_MODULE_6__.sign.keyPair.fromSeed(keyData);\n\n if (_Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].privateKeyConstructor == null) {\n throw new Error(\"PrivateKey not found in cache\");\n }\n\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].privateKeyConstructor(\n new _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](keyPair, chainCode)\n );\n }\n\n /**\n * Recover an ECDSA private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise}\n */\n async toEcdsaPrivateKey(passphrase = \"\", path = HEDERA_PATH) {\n let { keyData, chainCode } = await this._toKeyData(\n passphrase,\n ECDSA_SEED_TEXT\n );\n\n for (const index of path) {\n ({ keyData, chainCode } = await _primitive_bip32_js__WEBPACK_IMPORTED_MODULE_10__.derive(\n keyData,\n chainCode,\n index\n ));\n }\n\n if (_Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].privateKeyConstructor == null) {\n throw new Error(\"PrivateKey not found in cache\");\n }\n\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].privateKeyConstructor(\n new _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"](_primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_15__.fromBytes(keyData), chainCode)\n );\n }\n\n /**\n * @param {string} passphrase\n * @param {string} seedText\n * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>} seedText\n */\n async _toKeyData(passphrase, seedText) {\n const seed = await _primitive_bip39_js__WEBPACK_IMPORTED_MODULE_11__.toSeed(this.words, passphrase);\n const digest = await _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_8__.hash(\n _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_8__.HashAlgorithm.Sha512,\n seedText,\n seed\n );\n\n return {\n keyData: digest.subarray(0, 32),\n chainCode: digest.subarray(32),\n };\n }\n\n /**\n * Recover a mnemonic phrase from a string, splitting on spaces. Handles 12, 22 (legacy), and 24 words.\n *\n * @param {string} mnemonic\n * @returns {Promise}\n */\n static async fromString(mnemonic) {\n return Mnemonic.fromWords(mnemonic.split(/\\s|,/));\n }\n\n /**\n * @returns {Promise}\n * @private\n */\n async _validate() {\n //NOSONAR\n // Validate that this is a valid BIP-39 mnemonic\n // as generated by BIP-39's rules.\n\n // Technically, invalid mnemonics can still be used to generate valid private keys,\n // but if they became invalid due to user error then it will be difficult for the user\n // to tell the difference unless they compare the generated keys.\n\n // During validation, the following conditions are checked in order\n\n // 1)) 24 or 12 words\n\n // 2) All strings in {@link this.words} exist in the BIP-39\n // standard English word list (no normalization is done)\n\n // 3) The calculated checksum for the mnemonic equals the\n // checksum encoded in the mnemonic\n\n if (this._isLegacy) {\n if (this.words.length !== 22) {\n throw new _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n this,\n _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].BadLength,\n []\n );\n }\n\n const unknownWordIndices = this.words.reduce(\n (/** @type {number[]} */ unknowns, word, index) =>\n _words_legacy_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].includes(word.toLowerCase())\n ? unknowns\n : [...unknowns, index],\n []\n );\n\n if (unknownWordIndices.length > 0) {\n throw new _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n this,\n _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].UnknownWords,\n unknownWordIndices\n );\n }\n\n const [seed, checksum] = _util_entropy_js__WEBPACK_IMPORTED_MODULE_12__.legacy1(this.words, _words_legacy_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n const newChecksum = _util_entropy_js__WEBPACK_IMPORTED_MODULE_12__.crc8(seed);\n\n if (checksum !== newChecksum) {\n throw new _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n this,\n _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ChecksumMismatch,\n []\n );\n }\n } else {\n if (!(this.words.length === 12 || this.words.length === 24)) {\n throw new _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n this,\n _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].BadLength,\n []\n );\n }\n\n const unknownWordIndices = this.words.reduce(\n (/** @type {number[]} */ unknowns, word, index) =>\n _words_bip39_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].includes(word) ? unknowns : [...unknowns, index],\n []\n );\n\n if (unknownWordIndices.length > 0) {\n throw new _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n this,\n _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].UnknownWords,\n unknownWordIndices\n );\n }\n\n // FIXME: calculate checksum and compare\n // https://github.com/bitcoinjs/bip39/blob/master/ts_src/index.ts#L112\n\n const bits = this.words\n .map((word) => {\n return _words_bip39_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].indexOf(word)\n .toString(2)\n .padStart(11, \"0\");\n })\n .join(\"\");\n\n const dividerIndex = Math.floor(bits.length / 33) * 32;\n const entropyBits = bits.slice(0, dividerIndex);\n const checksumBits = bits.slice(dividerIndex);\n const entropyBitsRegex = entropyBits.match(/(.{1,8})/g);\n const entropyBytes = /** @type {RegExpMatchArray} */ (\n entropyBitsRegex\n ).map(binaryToByte);\n\n const newChecksum = await deriveChecksumBits(\n Uint8Array.from(entropyBytes)\n );\n\n if (newChecksum !== checksumBits) {\n throw new _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n this,\n _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ChecksumMismatch,\n []\n );\n }\n }\n\n return this;\n }\n\n /**\n * @returns {Promise}\n */\n async toLegacyPrivateKey() {\n let seed;\n if (this._isLegacy) {\n [seed] = _util_entropy_js__WEBPACK_IMPORTED_MODULE_12__.legacy1(this.words, _words_legacy_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n } else {\n seed = await _util_entropy_js__WEBPACK_IMPORTED_MODULE_12__.legacy2(this.words, _words_bip39_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]);\n }\n\n if (_Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].privateKeyFromBytes == null) {\n throw new Error(\"PrivateKey not found in cache\");\n }\n\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].privateKeyFromBytes(seed);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this.words.join(\" \");\n }\n}\n\n/**\n * @param {string} bin\n * @returns {number}\n */\nfunction binaryToByte(bin) {\n return parseInt(bin, 2);\n}\n\n/**\n * @param {number[]} bytes\n * @returns {string}\n */\nfunction bytesToBinary(bytes) {\n return bytes.map((x) => x.toString(2).padStart(8, \"0\")).join(\"\");\n}\n\n/**\n * @param {Uint8Array} entropyBuffer\n * @returns {Promise}\n */\nasync function deriveChecksumBits(entropyBuffer) {\n const ENT = entropyBuffer.length * 8;\n const CS = ENT / 32;\n const hash = await _primitive_sha256_js__WEBPACK_IMPORTED_MODULE_7__.digest(entropyBuffer);\n\n return bytesToBinary(Array.from(hash)).slice(0, CS);\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/Mnemonic.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ }), +class LiveHashDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Uint8Array} [props.hash] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?Uint8Array} + */ + this._hash = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + if (props.hash != null) { + this.setHash(props.hash); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {LiveHashDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const hashes = + /** @type {HashgraphProto.proto.ICryptoDeleteLiveHashTransactionBody} */ ( + body.cryptoDeleteLiveHash + ); + + return Transaction_Transaction._fromProtobufTransactions( + new LiveHashDeleteTransaction({ + hash: + hashes.liveHashToDelete != null + ? hashes.liveHashToDelete + : undefined, + accountId: + hashes.accountOfLiveHash != null + ? AccountId_AccountId._fromProtobuf(hashes.accountOfLiveHash) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?Uint8Array} + */ + get hash() { + return this._hash; + } + + /** + * @param {Uint8Array} hash + * @returns {LiveHashDeleteTransaction} + */ + setHash(hash) { + this._requireNotFrozen(); + this._hash = hash; + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {LiveHashDeleteTransaction} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.deleteLiveHash(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoDeleteLiveHash"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoDeleteLiveHashTransactionBody} + */ + _makeTransactionData() { + return { + liveHashToDelete: this._hash, + accountOfLiveHash: + this._accountId != null ? this._accountId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `LiveHashDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoDeleteLiveHash", + // eslint-disable-next-line @typescript-eslint/unbound-method + LiveHashDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/LiveHashQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/cryptography/src/PrivateKey.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/PrivateKey.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ PrivateKey; }\n/* harmony export */ });\n/* harmony import */ var _Mnemonic_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Mnemonic.js */ \"./node_modules/@hashgraph/cryptography/src/Mnemonic.js\");\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/cryptography/src/Key.js\");\n/* harmony import */ var _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Ed25519PrivateKey.js */ \"./node_modules/@hashgraph/cryptography/src/Ed25519PrivateKey.js\");\n/* harmony import */ var _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EcdsaPrivateKey.js */ \"./node_modules/@hashgraph/cryptography/src/EcdsaPrivateKey.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./PublicKey.js */ \"./node_modules/@hashgraph/cryptography/src/PublicKey.js\");\n/* harmony import */ var _primitive_keystore_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./primitive/keystore.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/keystore.js\");\n/* harmony import */ var _encoding_pem_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./encoding/pem.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/pem.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n/* harmony import */ var _primitive_slip10_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./primitive/slip10.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/slip10.js\");\n/* harmony import */ var _primitive_bip32_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./primitive/bip32.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/bip32.js\");\n/* harmony import */ var _util_derive_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./util/derive.js */ \"./node_modules/@hashgraph/cryptography/src/util/derive.js\");\n/* harmony import */ var _primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./primitive/ecdsa.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/cryptography/src/Cache.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {object} ProtoSignaturePair\n * @property {(Uint8Array | null)=} pubKeyPrefix\n * @property {(Uint8Array | null)=} ed25519\n * @property {(Uint8Array | null)=} ECDSASecp256k1\n */\n\n/**\n * @typedef {object} ProtoSigMap\n * @property {(ProtoSignaturePair[] | null)=} sigPair\n */\n\n/**\n * @typedef {object} ProtoSignedTransaction\n * @property {(Uint8Array | null)=} bodyBytes\n * @property {(ProtoSigMap | null)=} sigMap\n */\n\n/**\n * @typedef {object} Transaction\n * @property {() => boolean} isFrozen\n * @property {ProtoSignedTransaction[]} _signedTransactions\n * @property {Set} _signerPublicKeys\n * @property {(publicKey: PublicKey, signature: Uint8Array) => Transaction} addSignature\n * @property {() => void} _requireFrozen\n * @property {() => Transaction} freeze\n */\n\n/**\n * A private key on the Hedera™ network.\n */\nclass PrivateKey extends _Key_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @hideconstructor\n * @internal\n * @param {Ed25519PrivateKey | EcdsaPrivateKey} key\n */\n constructor(key) {\n super();\n\n /**\n * @type {Ed25519PrivateKey | EcdsaPrivateKey}\n * @readonly\n * @private\n */\n this._key = key;\n }\n\n /**\n * @returns {string}\n */\n get _type() {\n return this._key._type;\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generateED25519() {\n return new PrivateKey(_Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].generate());\n }\n\n /**\n * Generate a random EDSA private key.\n *\n * @returns {PrivateKey}\n */\n static generateECDSA() {\n return new PrivateKey(_EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].generate());\n }\n\n /**\n * Depredated - Use `generateED25519()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generate() {\n return PrivateKey.generateED25519();\n }\n\n /**\n * Depredated - Use `generateED25519Async()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise}\n */\n static async generateAsync() {\n return PrivateKey.generateED25519Async();\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise}\n */\n static async generateED25519Async() {\n return new PrivateKey(await _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].generateAsync());\n }\n\n /**\n * Generate a random ECDSA private key.\n *\n * @returns {Promise}\n */\n static async generateECDSAAsync() {\n return new PrivateKey(await _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].generateAsync());\n }\n\n /**\n * Construct a private key from bytes. Requires DER header.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytes(data) {\n try {\n return new PrivateKey(_Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromBytes(data));\n } catch {\n // Do nothing\n }\n\n try {\n return new PrivateKey(_EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromBytes(data));\n } catch {\n // Do nothing\n }\n\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid private key length: ${data.length} bytes`\n );\n }\n\n /**\n * Construct a ECDSA private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesECDSA(data) {\n return new PrivateKey(_EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromBytes(data));\n }\n\n /**\n * Construct a ED25519 private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesED25519(data) {\n return new PrivateKey(_Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromBytes(data));\n }\n\n /**\n * Construct a private key from a hex-encoded string. Requires DER header.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromString(text) {\n return PrivateKey.fromBytes(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__.decode(text));\n }\n\n /**\n * Construct a ECDSA private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringECDSA(text) {\n return PrivateKey.fromBytesECDSA(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__.decode(text));\n }\n\n /**\n * Construct a Ed25519 private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringED25519(text) {\n return PrivateKey.fromBytesED25519(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__.decode(text));\n }\n\n /**\n * @deprecated - Use `Mnemonic.from[Words|String]().to[Ed25519|Ecdsa]PrivateKey()` instead\n *\n * Recover a private key from a mnemonic phrase (and optionally a password).\n * @param {Mnemonic | string} mnemonic\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n static async fromMnemonic(mnemonic, passphrase = \"\") {\n return (\n typeof mnemonic === \"string\"\n ? await _Mnemonic_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(mnemonic)\n : mnemonic\n ).toEd25519PrivateKey(passphrase);\n }\n\n /**\n * Recover a private key from a keystore, previously created by `.toKeystore()`.\n *\n * This key will _not_ support child key derivation.\n *\n * @param {Uint8Array} data\n * @param {string} [passphrase]\n * @returns {Promise}\n * @throws {BadKeyError} If the passphrase is incorrect or the hash fails to validate.\n */\n static async fromKeystore(data, passphrase = \"\") {\n return PrivateKey.fromBytes(await (0,_primitive_keystore_js__WEBPACK_IMPORTED_MODULE_6__.loadKeystore)(data, passphrase));\n }\n\n /**\n * Recover a private key from a pem string; the private key may be encrypted.\n *\n * This method assumes the .pem file has been converted to a string already.\n *\n * If `passphrase` is not null or empty, this looks for the first `ENCRYPTED PRIVATE KEY`\n * section and uses `passphrase` to decrypt it; otherwise, it looks for the first `PRIVATE KEY`\n * section and decodes that as a DER-encoded private key.\n *\n * @param {string} data\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n static async fromPem(data, passphrase = \"\") {\n const pem = await (0,_encoding_pem_js__WEBPACK_IMPORTED_MODULE_7__.read)(data, passphrase);\n\n if (\n pem instanceof _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] ||\n pem instanceof _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n ) {\n return new PrivateKey(pem);\n }\n\n return PrivateKey.fromBytes(pem);\n }\n\n /**\n * Derive a new private key at the given wallet index.\n *\n * Only currently supported for keys created with `fromMnemonic()`; other keys will throw\n * an error.\n *\n * You can check if a key supports derivation with `.supportsDerivation()`\n *\n * @param {number} index\n * @returns {Promise}\n * @throws If this key does not support derivation.\n */\n async derive(index) {\n if (this._key._chainCode == null) {\n throw new Error(\"this private key does not support key derivation\");\n }\n\n if (this._key instanceof _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]) {\n const { keyData, chainCode } = await _primitive_slip10_js__WEBPACK_IMPORTED_MODULE_9__.derive(\n this.toBytesRaw(),\n this._key._chainCode,\n index\n );\n\n return new PrivateKey(new _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](keyData, chainCode));\n } else {\n const { keyData, chainCode } = await _primitive_bip32_js__WEBPACK_IMPORTED_MODULE_10__.derive(\n this.toBytesRaw(),\n this._key._chainCode,\n index\n );\n\n return new PrivateKey(\n new _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](_primitive_ecdsa_js__WEBPACK_IMPORTED_MODULE_12__.fromBytes(keyData), chainCode)\n );\n }\n }\n\n /**\n * @param {number} index\n * @returns {Promise}\n * @throws If this key does not support derivation.\n */\n async legacyDerive(index) {\n const keyBytes = await _util_derive_js__WEBPACK_IMPORTED_MODULE_11__.legacy(\n this.toBytesRaw().subarray(0, 32),\n index\n );\n\n /** @type {new (bytes: Uint8Array) => Ed25519PrivateKey | EcdsaPrivateKey} */\n const constructor = /** @type {any} */ (this._key.constructor);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n return new PrivateKey(new constructor(keyBytes));\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {PublicKey}\n */\n get publicKey() {\n return new _PublicKey_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](this._key.publicKey);\n }\n\n /**\n * Sign a message with this private key.\n *\n * @param {Uint8Array} bytes\n * @returns {Uint8Array} - The signature bytes without the message\n */\n sign(bytes) {\n return this._key.sign(bytes);\n }\n\n /**\n * @param {Transaction} transaction\n * @returns {Uint8Array}\n */\n signTransaction(transaction) {\n if (!transaction.isFrozen()) {\n transaction.freeze();\n }\n\n if (transaction._signedTransactions.length != 1) {\n throw new Error(\n \"`PrivateKey.signTransaction()` requires `Transaction` to have a single node `AccountId` set\"\n );\n }\n\n const tx = /** @type {ProtoSignedTransaction} */ (\n transaction._signedTransactions[0]\n );\n\n const publicKeyHex = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__.encode(this.publicKey.toBytesRaw());\n\n if (tx.sigMap == null) {\n tx.sigMap = {};\n }\n\n if (tx.sigMap.sigPair == null) {\n tx.sigMap.sigPair = [];\n }\n\n for (const sigPair of tx.sigMap.sigPair) {\n if (\n sigPair.pubKeyPrefix != null &&\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__.encode(sigPair.pubKeyPrefix) === publicKeyHex\n ) {\n switch (this._type) {\n case \"ED25519\":\n return /** @type {Uint8Array} */ (sigPair.ed25519);\n case \"secp256k1\":\n return /** @type {Uint8Array} */ (\n sigPair.ECDSASecp256k1\n );\n }\n }\n }\n\n const siganture = this.sign(\n tx.bodyBytes != null ? tx.bodyBytes : new Uint8Array()\n );\n\n /** @type {ProtoSignaturePair} */\n const protoSignature = {\n pubKeyPrefix: this.publicKey.toBytesRaw(),\n };\n\n switch (this._type) {\n case \"ED25519\":\n protoSignature.ed25519 = siganture;\n break;\n case \"secp256k1\":\n protoSignature.ECDSASecp256k1 = siganture;\n break;\n }\n\n tx.sigMap.sigPair.push(protoSignature);\n transaction._signerPublicKeys.add(publicKeyHex);\n\n return siganture;\n }\n\n /**\n * Check if `derive` can be called on this private key.\n *\n * This is only the case if the key was created from a mnemonic.\n *\n * @returns {boolean}\n */\n isDerivable() {\n return this._key._chainCode != null;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n if (this._key instanceof _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]) {\n return this.toBytesRaw();\n } else {\n return this.toBytesDer();\n }\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n return this._key.toBytesDer();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return this._key.toBytesRaw();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringDer() {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__.encode(this.toBytesDer());\n }\n\n /**\n * @returns {string}\n */\n toStringRaw() {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_8__.encode(this.toBytesRaw());\n }\n\n /**\n * Create a keystore with a given passphrase.\n *\n * The key can be recovered later with `fromKeystore()`.\n *\n * Note that this will not retain the ancillary data used for\n * deriving child keys, thus `.derive()` on the restored key will\n * throw even if this instance supports derivation.\n *\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n toKeystore(passphrase = \"\") {\n return (0,_primitive_keystore_js__WEBPACK_IMPORTED_MODULE_6__.createKeystore)(this.toBytesRaw(), passphrase);\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"].privateKeyConstructor = (key) => new PrivateKey(key);\n_Cache_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"].privateKeyFromBytes = (bytes) => PrivateKey.fromBytes(bytes);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/PrivateKey.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/PublicKey.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/PublicKey.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ PublicKey; }\n/* harmony export */ });\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/cryptography/src/Key.js\");\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Ed25519PublicKey.js */ \"./node_modules/@hashgraph/cryptography/src/Ed25519PublicKey.js\");\n/* harmony import */ var _EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EcdsaPublicKey.js */ \"./node_modules/@hashgraph/cryptography/src/EcdsaPublicKey.js\");\n/* harmony import */ var _util_array_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util/array.js */ \"./node_modules/@hashgraph/cryptography/src/util/array.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./PrivateKey.js\").Transaction} Transaction\n */\n\n/**\n * An public key on the Hedera™ network.\n */\nclass PublicKey extends _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @internal\n * @hideconstructor\n * @param {Ed25519PublicKey | EcdsaPublicKey} key\n */\n constructor(key) {\n super();\n\n /**\n * @type {Ed25519PublicKey | EcdsaPublicKey}\n * @private\n * @readonly\n */\n this._key = key;\n }\n\n /**\n * @returns {string}\n */\n get _type() {\n return this._key._type;\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {PublicKey}\n */\n static fromBytes(data) {\n try {\n return new PublicKey(_Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromBytes(data));\n } catch {\n // Do nothing\n }\n\n try {\n return new PublicKey(_EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromBytes(data));\n } catch {\n // Do nothing\n }\n\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](\n `invalid public key length: ${data.length} bytes`\n );\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {PublicKey}\n */\n static fromBytesED25519(data) {\n return new PublicKey(_Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromBytes(data));\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {PublicKey}\n */\n static fromBytesECDSA(data) {\n return new PublicKey(_EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromBytes(data));\n }\n\n /**\n * Parse a public key from a string of hexadecimal digits.\n *\n * The public key may optionally be prefixed with\n * the DER header.\n *\n * @param {string} text\n * @returns {PublicKey}\n */\n static fromString(text) {\n return PublicKey.fromBytes(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__.decode(text));\n }\n\n /**\n * @param {string} text\n * @returns {PublicKey}\n */\n static fromStringED25519(text) {\n return PublicKey.fromBytesED25519(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__.decode(text));\n }\n\n /**\n * @param {string} text\n * @returns {PublicKey}\n */\n static fromStringECDSA(text) {\n return PublicKey.fromBytesECDSA(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__.decode(text));\n }\n\n /**\n * Verify a signature on a message with this public key.\n *\n * @param {Uint8Array} message\n * @param {Uint8Array} signature\n * @returns {boolean}\n */\n verify(message, signature) {\n return this._key.verify(message, signature);\n }\n\n /**\n * @deprecated - use `@hashgraph/sdk`.PublicKey instead\n * @param {Transaction} transaction\n * @returns {boolean}\n */\n verifyTransaction(transaction) {\n //NOSONAR\n console.log(\"Deprecated: use `@hashgraph/sdk`.PublicKey instead\");\n\n transaction._requireFrozen();\n\n if (!transaction.isFrozen()) {\n transaction.freeze();\n }\n\n for (const signedTransaction of transaction._signedTransactions) {\n if (\n signedTransaction.sigMap != null &&\n signedTransaction.sigMap.sigPair != null\n ) {\n let found = false;\n for (const sigPair of signedTransaction.sigMap.sigPair) {\n const pubKeyPrefix = /** @type {Uint8Array} */ (\n sigPair.pubKeyPrefix\n );\n if ((0,_util_array_js__WEBPACK_IMPORTED_MODULE_4__.arrayEqual)(pubKeyPrefix, this.toBytesRaw())) {\n found = true;\n const bodyBytes = /** @type {Uint8Array} */ (\n signedTransaction.bodyBytes\n );\n const signature =\n sigPair.ed25519 != null\n ? sigPair.ed25519\n : /** @type {Uint8Array} */ (\n sigPair.ECDSASecp256k1\n );\n if (!this.verify(bodyBytes, signature)) {\n return false;\n }\n }\n }\n\n if (!found) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n if (this._key instanceof _Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]) {\n return this.toBytesRaw();\n } else {\n return this.toBytesDer();\n }\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n return this._key.toBytesDer();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return this._key.toBytesRaw();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringDer() {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__.encode(this.toBytesDer());\n }\n\n /**\n * @returns {string}\n */\n toStringRaw() {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__.encode(this.toBytesRaw());\n }\n\n /**\n * @returns {string}\n */\n toEthereumAddress() {\n if (this._key instanceof _EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]) {\n return this._key.toEthereumAddress();\n } else {\n throw new Error(\"unsupported operation on Ed25519PublicKey\");\n }\n }\n\n /**\n * @param {PublicKey} other\n * @returns {boolean}\n */\n equals(other) {\n if (\n this._key instanceof _Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] &&\n other._key instanceof _Ed25519PublicKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ) {\n return this._key.equals(other._key);\n } else if (\n this._key instanceof _EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] &&\n other._key instanceof _EcdsaPublicKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]\n ) {\n return this._key.equals(other._key);\n } else {\n return false;\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/PublicKey.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.ICryptoGetLiveHashQuery} HashgraphProto.proto.ICryptoGetLiveHashQuery + * @typedef {import("@hashgraph/proto").proto.ICryptoGetLiveHashResponse} HashgraphProto.proto.ICryptoGetLiveHashResponse + * @typedef {import("@hashgraph/proto").proto.ILiveHash} HashgraphProto.proto.ILiveHash + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + */ -/***/ "./node_modules/@hashgraph/cryptography/src/encoding/base64.browser.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/encoding/base64.browser.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @augments {Query} + */ +class LiveHashQuery extends Query_Query { + /** + * @param {object} [props] + * @param {AccountId | string} [props.accountId] + * @param {Uint8Array} [props.hash] + */ + constructor(props = {}) { + super(); + + /** + * @type {?AccountId} + * @private + */ + this._accountId = null; + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + + /** + * @type {?Uint8Array} + * @private + */ + this._hash = null; + + if (props.hash != null) { + this.setHash(props.hash); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {LiveHashQuery} + */ + static _fromProtobuf(query) { + const hash = + /** @type {HashgraphProto.proto.ICryptoGetLiveHashQuery} */ ( + query.cryptoGetLiveHash + ); + + return new LiveHashQuery({ + accountId: + hash.accountID != null + ? AccountId_AccountId._fromProtobuf(hash.accountID) + : undefined, + hash: hash.hash != null ? hash.hash : undefined, + }); + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * Set the account to which the livehash is associated. + * + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._accountId = + accountId instanceof AccountId_AccountId + ? accountId + : AccountId_AccountId.fromString(accountId); + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get liveHash() { + return this._hash; + } + + /** + * Set the SHA-384 data in the livehash. + * + * @param {Uint8Array} hash + * @returns {this} + */ + setHash(hash) { + this._hash = hash; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.getLiveHash(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const cryptoGetLiveHash = + /** @type {HashgraphProto.proto.ICryptoGetLiveHashResponse} */ ( + response.cryptoGetLiveHash + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + cryptoGetLiveHash.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @returns {Promise} + */ + _mapResponse(response) { + const hashes = + /** @type {HashgraphProto.proto.ICryptoGetLiveHashResponse} */ ( + response.cryptoGetLiveHash + ); + + return Promise.resolve( + LiveHash._fromProtobuf( + /** @type {HashgraphProto.proto.ILiveHash} */ (hashes.liveHash), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + cryptoGetLiveHash: { + header, + accountID: + this._accountId != null + ? this._accountId._toProtobuf() + : null, + hash: this._hash, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `LiveHashQuery:${timestamp.toString()}`; + } +} + +// @ts-ignore +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("cryptoGetLiveHash", LiveHashQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/network/SemanticVersion.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; },\n/* harmony export */ \"encode\": function() { return /* binding */ encode; }\n/* harmony export */ });\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nfunction decode(text) {\n // note: assumes is available in the global scope if is not\n // eslint-disable-next-line deprecation/deprecation\n return Uint8Array.from(atob(text), (c) => c.charCodeAt(0));\n}\n\n/**\n * @param {Uint8Array} data\n * @returns {string};\n */\nfunction encode(data) {\n // note: assumes is available in the global scope if is not\n // eslint-disable-next-line deprecation/deprecation\n return btoa(String.fromCharCode.apply(null, Array.from(data)));\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/encoding/base64.browser.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/encoding/der.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/encoding/der.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +class SemanticVersion { + /** + * @private + * @param {object} props + * @param {number} props.major + * @param {number} props.minor + * @param {number} props.patch + */ + constructor(props) { + /** @readonly */ + this.major = props.major; + /** @readonly */ + this.minor = props.minor; + /** @readonly */ + this.patch = props.patch; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.ISemanticVersion} version + * @returns {SemanticVersion} + */ + static _fromProtobuf(version) { + return new SemanticVersion({ + major: /** @type {number} */ (version.major), + minor: /** @type {number} */ (version.minor), + patch: /** @type {number} */ (version.patch), + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.ISemanticVersion} + */ + _toProtobuf() { + return { + major: this.major, + minor: this.minor, + patch: this.patch, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {SemanticVersion} + */ + static fromBytes(bytes) { + return SemanticVersion._fromProtobuf( + lib.proto.SemanticVersion.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.SemanticVersion.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; }\n/* harmony export */ });\n/**\n * @typedef {object} AsnSeq\n * @property {AsnType[]} seq\n */\n\n/**\n * @typedef {object} AsnInt\n * @property {number} int\n */\n\n/**\n * @typedef {object} AsnBytes\n * @property {Uint8Array} bytes\n */\n\n/**\n * @typedef {object} AsnIdent\n * @property {string} ident\n */\n\n/**\n * @typedef {{}} AsnNull\n */\n\n/**\n * @typedef {AsnSeq | AsnInt | AsnBytes | AsnIdent | AsnNull} AsnType\n */\n\n/**\n * Note: may throw weird errors on malformed input. Catch and rethrow with, e.g. `BadKeyError`.\n *\n *@param {Uint8Array} data\n *@returns {AsnType}\n */\nfunction decode(data) {\n return decodeIncremental(data)[0];\n}\n\n/**\n * @param {Uint8Array} bytes\n * @returns {[AsnType, Uint8Array]}\n */\nfunction decodeIncremental(bytes) {\n // slice off the initial tag byte, `decodeLength` returns a slice of the remaining data\n const [len, rem] = decodeLength(bytes.subarray(1));\n const data = rem.subarray(0, len);\n const tail = rem.subarray(len);\n\n switch (bytes[0]) {\n case 2:\n return [{ int: decodeInt(data) }, tail];\n case 4: // must always be primitive form in DER; for OCTET STRING this is literal bytes\n return [{ bytes: data }, tail];\n case 5: // empty\n return [{}, tail];\n case 6:\n return [{ ident: decodeObjectIdent(data) }, tail];\n case 48:\n return [{ seq: decodeSeq(data) }, tail];\n default:\n throw new Error(`unsupported DER type tag: ${bytes[0]}`);\n }\n}\n\n/**\n * @param {Uint8Array} seqBytes\n * @returns {AsnType[]}\n */\nfunction decodeSeq(seqBytes) {\n let data = seqBytes;\n\n const seq = [];\n\n while (data.length !== 0) {\n const [decoded, remaining] = decodeIncremental(data);\n seq.push(decoded);\n data = remaining;\n }\n\n return seq;\n}\n\n/**\n * @param {Uint8Array} idBytes\n * @returns {string}\n */\nfunction decodeObjectIdent(idBytes) {\n const id = [\n // first octet is 40 * value1 + value2\n Math.floor(idBytes[0] / 40),\n idBytes[0] % 40,\n ];\n\n // each following ID component is big-endian base128 where the MSB is set if another byte\n // follows for the same value\n let val = 0;\n\n for (const byte of idBytes.subarray(1)) {\n // shift the entire value left by 7 bits\n val *= 128;\n\n if (byte < 128) {\n // no more octets follow for this value, finish it off\n val += byte;\n id.push(val);\n val = 0;\n } else {\n // zero the MSB\n val += byte & 127;\n }\n }\n\n return id.join(\".\");\n}\n\n/**\n * @param {Uint8Array} lenBytes\n * @returns {[number, Uint8Array]}\n */\nfunction decodeLength(lenBytes) {\n if (lenBytes[0] < 128) {\n // definite, short form\n return [lenBytes[0], lenBytes.subarray(1)];\n }\n\n const numBytes = lenBytes[0] - 128;\n\n const intBytes = lenBytes.subarray(1, numBytes + 1);\n const rem = lenBytes.subarray(numBytes + 1);\n\n return [decodeInt(intBytes), rem];\n}\n\n/**\n * @param {Uint8Array} intBytes\n * @returns {number}\n */\nfunction decodeInt(intBytes) {\n const len = intBytes.length;\n if (len === 1) {\n return intBytes[0];\n }\n\n let view = new DataView(\n intBytes.buffer,\n intBytes.byteOffset,\n intBytes.byteLength\n );\n\n if (len === 2) return view.getUint16(0, false);\n\n if (len === 3) {\n // prefix a zero byte and we'll treat it as a 32-bit int\n const data = Uint8Array.of(0, ...intBytes);\n view = new DataView(data.buffer, data.byteOffset, data.byteLength);\n }\n\n if (len > 4) {\n // this probably means a bug in the decoding as this would mean a >4GB structure\n throw new Error(`unsupported DER integer length of ${len} bytes`);\n }\n\n return view.getUint32(0, false);\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/encoding/der.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; },\n/* harmony export */ \"encode\": function() { return /* binding */ encode; }\n/* harmony export */ });\n/**\n * @type {string[]}\n */\nconst byteToHex = [];\n\nfor (let n = 0; n <= 0xff; n += 1) {\n byteToHex.push(n.toString(16).padStart(2, \"0\"));\n}\n\n/**\n * @param {Uint8Array} data\n * @returns {string}\n */\nfunction encode(data) {\n let string = \"\";\n\n for (const byte of data) {\n string += byteToHex[byte];\n }\n\n return string;\n}\n\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nfunction decode(text) {\n const str = text.startsWith(\"0x\") ? text.substring(2) : text;\n const result = str.match(/.{1,2}/gu);\n\n return new Uint8Array(\n (result == null ? [] : result).map((byte) => parseInt(byte, 16))\n );\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js?"); +/** + * Response when the client sends the node CryptoGetVersionInfoQuery. + */ +class NetworkVersionInfo { + /** + * @private + * @param {object} props + * @param {SemanticVersion} props.protobufVersion + * @param {SemanticVersion} props.servicesVersion + */ + constructor(props) { + /** + * The account ID for which this information applies. + * + * @readonly + */ + this.protobufVersion = props.protobufVersion; + + /** + * The account ID for which this information applies. + * + * @readonly + */ + this.servicesVersion = props.servicesVersion; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.INetworkGetVersionInfoResponse} info + * @returns {NetworkVersionInfo} + */ + static _fromProtobuf(info) { + return new NetworkVersionInfo({ + protobufVersion: SemanticVersion._fromProtobuf( + /** @type {HashgraphProto.proto.ISemanticVersion} */ + (info.hapiProtoVersion), + ), + servicesVersion: SemanticVersion._fromProtobuf( + /** @type {HashgraphProto.proto.ISemanticVersion} */ + (info.hederaServicesVersion), + ), + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.INetworkGetVersionInfoResponse} + */ + _toProtobuf() { + return { + hapiProtoVersion: this.protobufVersion._toProtobuf(), + hederaServicesVersion: this.servicesVersion._toProtobuf(), + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {NetworkVersionInfo} + */ + static fromBytes(bytes) { + return NetworkVersionInfo._fromProtobuf( + lib.proto.NetworkGetVersionInfoResponse.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.NetworkGetVersionInfoResponse.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/encoding/pem.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/encoding/pem.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"read\": function() { return /* binding */ read; }\n/* harmony export */ });\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _primitive_pkcs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../primitive/pkcs.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/pkcs.js\");\n/* harmony import */ var _der_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./der.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/der.js\");\n/* harmony import */ var _base64_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base64.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/base64.browser.js\");\n/* harmony import */ var _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Ed25519PrivateKey.js */ \"./node_modules/@hashgraph/cryptography/src/Ed25519PrivateKey.js\");\n/* harmony import */ var _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../EcdsaPrivateKey.js */ \"./node_modules/@hashgraph/cryptography/src/EcdsaPrivateKey.js\");\n\n\n\n\n\n\n\nconst BEGIN_PRIVATEKEY = \"-----BEGIN PRIVATE KEY-----\\n\";\nconst END_PRIVATEKEY = \"-----END PRIVATE KEY-----\\n\";\n\nconst BEGIN_ENCRYPTED_PRIVATEKEY = \"-----BEGIN ENCRYPTED PRIVATE KEY-----\\n\";\nconst END_ENCRYPTED_PRIVATEKEY = \"-----END ENCRYPTED PRIVATE KEY-----\\n\";\n\n/**\n * @param {string} pem\n * @param {string} [passphrase]\n * @returns {Promise}\n */\nasync function read(pem, passphrase) {\n //NOSONAR\n const beginTag = passphrase ? BEGIN_ENCRYPTED_PRIVATEKEY : BEGIN_PRIVATEKEY;\n\n const endTag = passphrase ? END_ENCRYPTED_PRIVATEKEY : END_PRIVATEKEY;\n\n const beginIndex = pem.indexOf(beginTag);\n const endIndex = pem.indexOf(endTag);\n\n if (beginIndex === -1 || endIndex === -1) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"failed to find a private key in the PEM file\");\n }\n\n const keyEncoded = pem.slice(beginIndex + beginTag.length, endIndex);\n\n const key = _base64_js__WEBPACK_IMPORTED_MODULE_3__.decode(keyEncoded);\n\n if (passphrase) {\n let encrypted;\n\n try {\n encrypted = _primitive_pkcs_js__WEBPACK_IMPORTED_MODULE_1__.EncryptedPrivateKeyInfo.parse(key);\n } catch (error) {\n const message =\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error != null && /** @type {Error} */ (error).message != null\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n /** @type {Error} */ (error).message\n : \"\";\n\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `failed to parse encrypted private key: ${message}`\n );\n }\n\n const decrypted = await encrypted.decrypt(passphrase);\n\n let privateKey = null;\n\n if (decrypted.algId.algIdent === \"1.3.101.112\") {\n privateKey = _Ed25519PrivateKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n } else if (decrypted.algId.algIdent === \"1.3.132.0.10\") {\n privateKey = _EcdsaPrivateKey_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\n } else {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `unknown private key algorithm ${decrypted.algId.toString()}`\n );\n }\n\n const keyData = _der_js__WEBPACK_IMPORTED_MODULE_2__.decode(decrypted.privateKey);\n\n if (!(\"bytes\" in keyData)) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `expected ASN bytes, got ${JSON.stringify(keyData)}`\n );\n }\n\n return privateKey.fromBytes(keyData.bytes);\n }\n\n return key.subarray(16);\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/encoding/pem.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.INetworkGetVersionInfoQuery} HashgraphProto.proto.INetworkGetVersionInfoQuery + * @typedef {import("@hashgraph/proto").proto.INetworkGetVersionInfoResponse} HashgraphProto.proto.INetworkGetVersionInfoResponse + */ -/***/ "./node_modules/@hashgraph/cryptography/src/encoding/utf8.browser.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/encoding/utf8.browser.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; },\n/* harmony export */ \"encode\": function() { return /* binding */ encode; }\n/* harmony export */ });\n/**\n * @param {Uint8Array} data\n * @returns {string}\n */\nfunction decode(data) {\n // eslint-disable-next-line node/no-unsupported-features/node-builtins\n return new TextDecoder().decode(data);\n}\n\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nfunction encode(text) {\n // eslint-disable-next-line node/no-unsupported-features/node-builtins\n return new TextEncoder().encode(text);\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/encoding/utf8.browser.js?"); +/** + * @augments {Query} + */ +class NetworkVersionInfoQuery extends Query_Query { + constructor() { + super(); + } + + /** + * @param {HashgraphProto.proto.IQuery} query + * @returns {NetworkVersionInfoQuery} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static _fromProtobuf(query) { + return new NetworkVersionInfoQuery(); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.network.getVersionInfo(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const networkGetVersionInfo = + /** @type {HashgraphProto.proto.INetworkGetVersionInfoResponse} */ ( + response.networkGetVersionInfo + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + networkGetVersionInfo.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @returns {Promise} + */ + _mapResponse(response) { + const info = + /** @type {HashgraphProto.proto.INetworkGetVersionInfoResponse} */ ( + response.networkGetVersionInfo + ); + return Promise.resolve(NetworkVersionInfo._fromProtobuf(info)); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + networkGetVersionInfo: { + header, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `NetworkVersionInfoQuery:${timestamp.toString()}`; + } +} + +QUERY_REGISTRY.set( + "networkGetVersionInfo", + // eslint-disable-next-line @typescript-eslint/unbound-method + NetworkVersionInfoQuery._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Provider.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), +/** + * @typedef {import("./LedgerId.js").default} LedgerId + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("./transaction/Transaction.js").default} Transaction + * @typedef {import("./transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("./transaction/TransactionReceipt.js").default} TransactionReceipt + * @typedef {import("./transaction/TransactionRecord.js").default} TransactionRecord + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./account/AccountBalance.js").default} AccountBalance + * @typedef {import("./account/AccountInfo.js").default} AccountInfo + */ -/***/ "./node_modules/@hashgraph/cryptography/src/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/index.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @template O + * @typedef {import("./query/Query.js").default} Query + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BadKeyError\": function() { return /* reexport safe */ _BadKeyError_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]; },\n/* harmony export */ \"BadMnemonicError\": function() { return /* reexport safe */ _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]; },\n/* harmony export */ \"BadMnemonicReason\": function() { return /* reexport safe */ _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]; },\n/* harmony export */ \"HEDERA_PATH\": function() { return /* reexport safe */ _Mnemonic_js__WEBPACK_IMPORTED_MODULE_4__.HEDERA_PATH; },\n/* harmony export */ \"Key\": function() { return /* reexport safe */ _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]; },\n/* harmony export */ \"KeyList\": function() { return /* reexport safe */ _KeyList_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]; },\n/* harmony export */ \"Mnemonic\": function() { return /* reexport safe */ _Mnemonic_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]; },\n/* harmony export */ \"PrivateKey\": function() { return /* reexport safe */ _PrivateKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]; },\n/* harmony export */ \"PublicKey\": function() { return /* reexport safe */ _PublicKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; },\n/* harmony export */ \"SLIP44_ECDSA_ETH_PATH\": function() { return /* reexport safe */ _Mnemonic_js__WEBPACK_IMPORTED_MODULE_4__.SLIP44_ECDSA_ETH_PATH; },\n/* harmony export */ \"SLIP44_ECDSA_HEDERA_PATH\": function() { return /* reexport safe */ _Mnemonic_js__WEBPACK_IMPORTED_MODULE_4__.SLIP44_ECDSA_HEDERA_PATH; }\n/* harmony export */ });\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/cryptography/src/Key.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./KeyList.js */ \"./node_modules/@hashgraph/cryptography/src/KeyList.js\");\n/* harmony import */ var _PrivateKey_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PrivateKey.js */ \"./node_modules/@hashgraph/cryptography/src/PrivateKey.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PublicKey.js */ \"./node_modules/@hashgraph/cryptography/src/PublicKey.js\");\n/* harmony import */ var _Mnemonic_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Mnemonic.js */ \"./node_modules/@hashgraph/cryptography/src/Mnemonic.js\");\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _BadMnemonicError_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BadMnemonicError.js */ \"./node_modules/@hashgraph/cryptography/src/BadMnemonicError.js\");\n/* harmony import */ var _BadMnemonicReason_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BadMnemonicReason.js */ \"./node_modules/@hashgraph/cryptography/src/BadMnemonicReason.js\");\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/index.js?"); +/** + * @template RequestT + * @template ResponseT + * @template OutputT + * @typedef {import("./Executable.js").default} Executable + */ -/***/ }), +/** + * @typedef {object} Provider + * @property {() => LedgerId?} getLedgerId + * @property {() => {[key: string]: (string | AccountId)}} getNetwork + * @property {() => string[]} getMirrorNetwork + * @property {(accountId: AccountId | string) => Promise} getAccountBalance + * @property {(accountId: AccountId | string) => Promise} getAccountInfo + * @property {(accountId: AccountId | string) => Promise} getAccountRecords + * @property {(transactionId: TransactionId | string) => Promise} getTransactionReceipt + * @property {(response: TransactionResponse) => Promise} waitForReceipt + * @property {(request: Executable) => Promise} call + */ -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/aes.browser.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/aes.browser.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* harmony default export */ var Provider = ({}); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/PrngTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CipherAlgorithm\": function() { return /* binding */ CipherAlgorithm; },\n/* harmony export */ \"createCipheriv\": function() { return /* binding */ createCipheriv; },\n/* harmony export */ \"createDecipheriv\": function() { return /* binding */ createDecipheriv; }\n/* harmony export */ });\nconst CipherAlgorithm = {\n Aes128Ctr: \"AES-128-CTR\",\n Aes128Cbc: \"AES-128-CBC\",\n};\n\n/**\n * @param {string} algorithm\n * @param {Uint8Array} key\n * @param {Uint8Array} iv\n * @param {Uint8Array} data\n * @returns {Promise}\n */\nasync function createCipheriv(algorithm, key, iv, data) {\n let algorithm_;\n\n switch (algorithm.toUpperCase()) {\n case CipherAlgorithm.Aes128Ctr:\n algorithm_ = {\n name: \"AES-CTR\",\n counter: iv,\n length: 128,\n };\n break;\n case CipherAlgorithm.Aes128Cbc:\n algorithm_ = {\n name: \"AES-CBC\",\n iv: iv,\n };\n break;\n default:\n throw new Error(\n \"(BUG) non-exhaustive switch statement for CipherAlgorithm\"\n );\n }\n\n const key_ = await window.crypto.subtle.importKey(\n \"raw\",\n key,\n algorithm_.name,\n false,\n [\"encrypt\"]\n );\n\n return new Uint8Array(\n // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#return_value\n /** @type {ArrayBuffer} */ (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n await window.crypto.subtle.encrypt(algorithm_, key_, data)\n )\n );\n}\n\n/**\n * @param {string} algorithm\n * @param {Uint8Array} key\n * @param {Uint8Array} iv\n * @param {Uint8Array} data\n * @returns {Promise}\n */\nasync function createDecipheriv(algorithm, key, iv, data) {\n let algorithm_;\n\n switch (algorithm.toUpperCase()) {\n case CipherAlgorithm.Aes128Ctr:\n algorithm_ = {\n name: \"AES-CTR\",\n counter: iv,\n length: 128,\n };\n break;\n case CipherAlgorithm.Aes128Cbc:\n algorithm_ = {\n name: \"AES-CBC\",\n iv,\n };\n break;\n default:\n throw new Error(\n \"(BUG) non-exhaustive switch statement for CipherAlgorithm\"\n );\n }\n\n const key_ = await window.crypto.subtle.importKey(\n \"raw\",\n key,\n algorithm_.name,\n false,\n [\"decrypt\"]\n );\n\n return new Uint8Array(\n // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#return_value\n /** @type {ArrayBuffer} */ (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n await window.crypto.subtle.decrypt(algorithm_, key_, data)\n )\n );\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/aes.browser.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/bip32.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/bip32.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"derive\": function() { return /* binding */ derive; }\n/* harmony export */ });\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n/* harmony import */ var elliptic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! elliptic */ \"./node_modules/elliptic/lib/elliptic.js\");\n\n\n\n\nconst secp256k1 = new elliptic__WEBPACK_IMPORTED_MODULE_2__.ec(\"secp256k1\");\n\nconst HIGHEST_BIT = 0x80000000;\n\n/**\n * Mostly copied from https://github.com/bitcoinjs/bip32/blob/master/ts-src/bip32.ts\n * We cannot use that library directly because it uses `Buffer` and we want to avoid\n * polyfills as much as possible. Also, we only need the `derive` function.\n *\n * @param {Uint8Array} parentKey\n * @param {Uint8Array} chainCode\n * @param {number} index\n * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>}\n */\nasync function derive(parentKey, chainCode, index) {\n const isHardened = (index & HIGHEST_BIT) !== 0;\n const data = new Uint8Array(37);\n\n const publicKey = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(\n secp256k1.keyFromPrivate(parentKey).getPublic(true, \"hex\")\n );\n\n // Hardened child\n if (isHardened) {\n // data = 0x00 || ser256(kpar) || ser32(index)\n data[0] = 0x00;\n data.set(parentKey, 1);\n\n // Normal child\n } else {\n // data = serP(point(kpar)) || ser32(index)\n // = serP(Kpar) || ser32(index)\n data.set(publicKey, 0);\n }\n\n new DataView(data.buffer, data.byteOffset, data.byteLength).setUint32(\n 33,\n index,\n false\n );\n\n const I = await _hmac_js__WEBPACK_IMPORTED_MODULE_0__.hash(_hmac_js__WEBPACK_IMPORTED_MODULE_0__.HashAlgorithm.Sha512, chainCode, data);\n const IL = I.subarray(0, 32);\n const IR = I.subarray(32);\n\n // if parse256(IL) >= n, proceed with the next value for i\n try {\n // ki = parse256(IL) + kpar (mod n)\n const ki = secp256k1\n .keyFromPrivate(parentKey)\n .getPrivate()\n .add(secp256k1.keyFromPrivate(IL).getPrivate());\n // const ki = Buffer.from(ecc.privateAdd(this.privateKey!, IL)!);\n\n // In case ki == 0, proceed with the next value for i\n if (ki.eqn(0)) {\n return derive(parentKey, chainCode, index + 1);\n }\n\n return {\n keyData: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(\n secp256k1.keyFromPrivate(ki.toArray()).getPrivate(\"hex\")\n ),\n chainCode: IR,\n };\n } catch {\n return derive(parentKey, chainCode, index + 1);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/bip32.js?"); +/** + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.Transaction} HashgraphProto.proto.Transaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.SignedTransaction} HashgraphProto.proto.SignedTransaction + * @typedef {import("@hashgraph/proto").proto.IUtilPrngTransactionBody } HashgraphProto.proto.IUtilPrngTransactionBody + * @typedef {import("@hashgraph/proto").proto.UtilPrngTransactionBody} HashgraphProto.proto.UtilPrngTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.TransactionResponse + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + */ -/***/ }), +/** + * @typedef {import("./client/Client.js").default<*, *>} Client + * @typedef {import("./channel/Channel.js").default} Channel + */ -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/bip39.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/bip39.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Gets a pseudorandom 32-bit number. Not cryptographically secure. See HIP-351 https://hips.hedera.com/hip/hip-351 + */ +class PrngTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {?number } [props.range] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?number} + */ + this._range = null; + + if (props.range != null) { + this.setRange(props.range); + } + } + + /** + * @param {number} newRange + * @returns {this} + */ + setRange(newRange) { + this._range = newRange; + return this; + } + + get range() { + return this._range; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._range != null && isNumber(this._range)) { + this._validateChecksums(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.util.prng(request); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {PrngTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = /** @type {HashgraphProto.proto.ITransactionBody} */ ( + bodies[0] + ); + const transactionRange = + /** @type {HashgraphProto.proto.IUtilPrngTransactionBody} */ ( + body.utilPrng + ); + return Transaction_Transaction._fromProtobufTransactions( + new PrngTransaction({ + range: transactionRange.range, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "utilPrng"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IUtilPrngTransactionBody} + */ + _makeTransactionData() { + return { + range: this.range, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("./Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `RandomGenerate:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "utilPrng", + // eslint-disable-next-line @typescript-eslint/unbound-method + PrngTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/schedule/ScheduleCreateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"toSeed\": function() { return /* binding */ toSeed; }\n/* harmony export */ });\n/* harmony import */ var _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../primitive/hmac.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js\");\n/* harmony import */ var _pbkdf2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pbkdf2.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js\");\n\n\n\n/**\n * @param {string[]} words\n * @param {string} passphrase\n * @returns {Promise}\n */\nasync function toSeed(words, passphrase) {\n const input = words.join(\" \");\n const salt = `mnemonic${passphrase}`.normalize(\"NFKD\");\n\n return _pbkdf2_js__WEBPACK_IMPORTED_MODULE_1__.deriveKey(_primitive_hmac_js__WEBPACK_IMPORTED_MODULE_0__.HashAlgorithm.Sha512, input, salt, 2048, 64);\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/bip39.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"fromBytes\": function() { return /* binding */ fromBytes; },\n/* harmony export */ \"generate\": function() { return /* binding */ generate; },\n/* harmony export */ \"generateAsync\": function() { return /* binding */ generateAsync; },\n/* harmony export */ \"getFullPublicKey\": function() { return /* binding */ getFullPublicKey; },\n/* harmony export */ \"sign\": function() { return /* binding */ sign; },\n/* harmony export */ \"verify\": function() { return /* binding */ verify; }\n/* harmony export */ });\n/* harmony import */ var _keccak_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keccak.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/keccak.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n/* harmony import */ var elliptic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! elliptic */ \"./node_modules/elliptic/lib/elliptic.js\");\n\n\n\n\nconst secp256k1 = new elliptic__WEBPACK_IMPORTED_MODULE_2__.ec(\"secp256k1\");\n\n/**\n * @typedef {import(\"../EcdsaPrivateKey.js\").KeyPair} KeyPair\n */\n\n/**\n * @returns {KeyPair}\n */\nfunction generate() {\n const keypair = secp256k1.genKeyPair();\n\n return {\n privateKey: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(keypair.getPrivate(\"hex\")),\n publicKey: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(keypair.getPublic(true, \"hex\")),\n };\n}\n\n/**\n * @returns {Promise}\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function generateAsync() {\n return Promise.resolve(generate());\n}\n\n/**\n * @param {Uint8Array} data\n * @returns {KeyPair}\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction fromBytes(data) {\n const keypair = secp256k1.keyFromPrivate(data);\n\n return {\n privateKey: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(keypair.getPrivate(\"hex\")),\n publicKey: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(keypair.getPublic(true, \"hex\")),\n };\n}\n\n/**\n * @param {Uint8Array} data\n * @returns {Uint8Array}\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction getFullPublicKey(data) {\n const keypair = secp256k1.keyFromPublic(data);\n\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(keypair.getPublic(false, \"hex\"));\n}\n\n/**\n * @param {Uint8Array} keydata\n * @param {Uint8Array} message\n * @returns {Uint8Array}\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction sign(keydata, message) {\n const msg = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.encode(message);\n const data = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode((0,_keccak_js__WEBPACK_IMPORTED_MODULE_0__.keccak256)(`0x${msg}`));\n const keypair = secp256k1.keyFromPrivate(keydata);\n const signature = keypair.sign(data);\n\n const r = signature.r.toArray(\"be\", 32);\n const s = signature.s.toArray(\"be\", 32);\n\n const result = new Uint8Array(64);\n result.set(r, 0);\n result.set(s, 32);\n return result;\n}\n\n/**\n * @param {Uint8Array} keydata\n * @param {Uint8Array} message\n * @param {Uint8Array} signature\n * @returns {boolean}\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction verify(keydata, message, signature) {\n const msg = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.encode(message);\n const data = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode((0,_keccak_js__WEBPACK_IMPORTED_MODULE_0__.keccak256)(`0x${msg}`));\n const keypair = secp256k1.keyFromPublic(keydata);\n\n return keypair.verify(data, {\n r: signature.subarray(0, 32),\n s: signature.subarray(32, 64),\n });\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/ecdsa.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HashAlgorithm\": function() { return /* binding */ HashAlgorithm; },\n/* harmony export */ \"hash\": function() { return /* binding */ hash; }\n/* harmony export */ });\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/utf8.browser.js\");\n\n\n/**\n * @enum {string}\n */\nconst HashAlgorithm = {\n Sha256: \"SHA-256\",\n Sha384: \"SHA-384\",\n Sha512: \"SHA-512\",\n};\n\n/**\n * @param {HashAlgorithm} algorithm\n * @param {Uint8Array | string} secretKey\n * @param {Uint8Array | string} data\n * @returns {Promise}\n */\nasync function hash(algorithm, secretKey, data) {\n const key =\n typeof secretKey === \"string\" ? _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_0__.encode(secretKey) : secretKey;\n const value = typeof data === \"string\" ? _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_0__.encode(data) : data;\n\n try {\n const key_ = await window.crypto.subtle.importKey(\n \"raw\",\n key,\n {\n name: \"HMAC\",\n hash: algorithm,\n },\n false,\n [\"sign\"]\n );\n\n return new Uint8Array(\n await window.crypto.subtle.sign(\"HMAC\", key_, value)\n );\n } catch {\n throw new Error(\"Fallback if SubtleCrypto fails is not implemented\");\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js?"); -/***/ }), +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../PublicKey.js").default} PublicKey + * @typedef {import("../PrivateKey.js").default} PrivateKey + */ -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/keccak.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/keccak.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Create a new Hedera™ crypto-currency account. + */ +class ScheduleCreateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Key} [props.adminKey] + * @param {AccountId} [props.payerAccountID] + * @param {string} [props.scheduleMemo] + * @param {Timestamp} [props.expirationTime] + * @param {boolean} [props.waitForExpiry] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?Key} + */ + this._adminKey = null; + + /** + * @private + * @type {?Transaction} + */ + this._scheduledTransaction = null; + + /** + * @private + * @type {?AccountId} + */ + this._payerAccountId = null; + + /** + * @private + * @type {?string} + */ + this._scheduleMemo = null; + + /** + * @private + * @type {Set} + */ + this._scheduledSignerPublicKeys = new Set(); + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = null; + + /** + * @private + * @type {?boolean} + */ + this._waitForExpiry = null; + + if (props.adminKey != null) { + this.setAdminKey(props.adminKey); + } + + if (props.payerAccountID != null) { + this.setPayerAccountId(props.payerAccountID); + } + + if (props.scheduleMemo != null) { + this.setScheduleMemo(props.scheduleMemo); + } + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {ScheduleCreateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const create = + /** @type {HashgraphProto.proto.IScheduleCreateTransactionBody} */ ( + body.scheduleCreate + ); + + const scheduledTransaction = new ScheduleCreateTransaction({ + adminKey: + create.adminKey != null + ? src_Key_Key._fromProtobufKey(create.adminKey) + : undefined, + payerAccountID: + create.payerAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + create.payerAccountID + ), + ) + : undefined, + scheduleMemo: create.memo != null ? create.memo : undefined, + waitForExpiry: + create.waitForExpiry != null ? create.waitForExpiry : undefined, + expirationTime: + create.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(create.expirationTime) + : undefined, + }); + if (body.scheduleCreate != null) { + const scheduleCreateBody = + body.scheduleCreate.scheduledTransactionBody; + + const scheduleCreateBodyBytes = + lib.proto.TransactionBody.encode( + // @ts-ignore + scheduleCreateBody, + ).finish(); + + const signedScheduledCreateTransaction = + lib.proto.SignedTransaction.encode({ + bodyBytes: scheduleCreateBodyBytes, + }).finish(); + + const scheduleCreatetransaction = { + signedTransactionBytes: signedScheduledCreateTransaction, + }; + + const txlist = lib.proto.TransactionList.encode({ + transactionList: [scheduleCreatetransaction], + }).finish(); + + const finalScheduledDecodedTx = Transaction_Transaction.fromBytes(txlist); + + scheduledTransaction._setScheduledTransaction( + finalScheduledDecodedTx, + ); + } + + return Transaction_Transaction._fromProtobufTransactions( + scheduledTransaction, + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @internal + * @param {Transaction} tx + * @returns {this} + */ + _setScheduledTransaction(tx) { + this._scheduledTransaction = tx; + + return this; + } + + /** + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * Set the key for this account. + * + * This is the key that must sign each transfer out of the account. + * + * If `receiverSignatureRequired` is true, then the key must also sign + * any transfer into the account. + * + * @param {Key} key + * @returns {this} + */ + setAdminKey(key) { + this._requireNotFrozen(); + this._adminKey = key; + + return this; + } + + /** + * @returns {?AccountId} + */ + get payerAccountId() { + return this._payerAccountId; + } + + /** + * @param {AccountId} account + * @returns {this} + */ + setPayerAccountId(account) { + this._requireNotFrozen(); + this._payerAccountId = account; + + return this; + } + + /** + * @param {string} memo + * @returns {this} + */ + setScheduleMemo(memo) { + this._requireNotFrozen(); + this._scheduleMemo = memo; + + return this; + } + + /** + * @returns {?string} + */ + get getScheduleMemo() { + this._requireNotFrozen(); + return this._scheduleMemo; + } + + /** + * @param {Transaction} transaction + * @returns {this} + */ + setScheduledTransaction(transaction) { + this._requireNotFrozen(); + transaction._requireNotFrozen(); + + this._scheduledTransaction = + transaction.schedule()._scheduledTransaction; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._payerAccountId != null) { + this._payerAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.schedule.createSchedule(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "scheduleCreate"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IScheduleCreateTransactionBody} + */ + _makeTransactionData() { + return { + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + payerAccountID: + this._payerAccountId != null + ? this._payerAccountId._toProtobuf() + : null, + scheduledTransactionBody: + this._scheduledTransaction != null + ? this._scheduledTransaction._getScheduledTransactionBody() + : null, + memo: this._scheduleMemo, + waitForExpiry: this._waitForExpiry, + expirationTime: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `ScheduleCreateTransaction:${timestamp.toString()}`; + } + + /** + * @param {?Timestamp} expirationTime + * @returns {this} + */ + setExpirationTime(expirationTime) { + this._expirationTime = expirationTime; + return this; + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + this._requireNotFrozen(); + return this._expirationTime; + } + + /** + * @param {boolean} waitForExpiry + * @returns {this} + */ + setWaitForExpiry(waitForExpiry) { + this._waitForExpiry = waitForExpiry; + + return this; + } + + /** + * @returns {?boolean} + */ + get waitForExpiry() { + this._requireNotFrozen(); + return this._waitForExpiry; + } +} + +TRANSACTION_REGISTRY.set( + "scheduleCreate", + // eslint-disable-next-line @typescript-eslint/unbound-method + ScheduleCreateTransaction._fromProtobuf, +); + +SCHEDULE_CREATE_TRANSACTION.push(() => new ScheduleCreateTransaction()); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/schedule/ScheduleDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"keccak256\": function() { return /* binding */ keccak256; }\n/* harmony export */ });\n// Originally sourced from:\n// https://github.com/MaiaVictor/eth-lib/blob/da0971f5b09964d9c8449975fa87933f0c9fef35/src/hash.js\n// - added type declarations\n// - switched to es6 module syntax\n//\n// Disable linting for entire file because it's nearly all pure JS\n// eslint-disable\n\nconst HEX_CHARS = \"0123456789abcdef\".split(\"\");\nconst KECCAK_PADDING = [1, 256, 65536, 16777216];\nconst SHIFT = [0, 8, 16, 24];\nconst RC = [\n 1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0,\n 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0,\n 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905,\n 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0,\n 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648,\n 2147483649, 0, 2147516424, 2147483648,\n];\n\n/**\n * @typedef {object} KeccakT\n * @property {number[]} blocks\n * @property {number} blockCount\n * @property {number} outputBlocks\n * @property {number[]} s\n * @property {number} start\n * @property {number} block\n * @property {boolean} reset\n * @property {number=} lastByteIndex\n */\n\n/** @type {(bits: number) => KeccakT} */\nconst Keccak = (bits) => ({\n blocks: [],\n reset: true,\n block: 0,\n start: 0,\n blockCount: (1600 - (bits << 1)) >> 5,\n outputBlocks: bits >> 5,\n // @ts-ignore\n s: ((s) => [].concat(s, s, s, s, s))([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),\n});\n\n/** @type {(state: KeccakT, message: string | number[]) => string} */\nconst update = (state, /** @type {string | number[]} */ message) => {\n var length = message.length,\n blocks = state.blocks,\n byteCount = state.blockCount << 2,\n blockCount = state.blockCount,\n outputBlocks = state.outputBlocks,\n s = state.s,\n index = 0,\n i,\n code;\n\n // update\n while (index < length) {\n if (state.reset) {\n state.reset = false;\n blocks[0] = state.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (typeof message !== \"string\") {\n for (i = state.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = state.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |=\n (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code =\n 0x10000 +\n (((code & 0x3ff) << 10) |\n (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |=\n (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |=\n (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n state.lastByteIndex = i;\n if (i >= byteCount) {\n state.start = i - byteCount;\n state.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n state.reset = true;\n } else {\n state.start = i;\n }\n }\n\n // finalize\n i = state.lastByteIndex;\n // @ts-ignore\n blocks[i >> 2] |= KECCAK_PADDING[i & 3];\n if (state.lastByteIndex === byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n\n // toString\n var hex = \"\";\n var block;\n var j = 0;\n i = 0;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex +=\n HEX_CHARS[(block >> 4) & 0x0f] +\n HEX_CHARS[block & 0x0f] +\n HEX_CHARS[(block >> 12) & 0x0f] +\n HEX_CHARS[(block >> 8) & 0x0f] +\n HEX_CHARS[(block >> 20) & 0x0f] +\n HEX_CHARS[(block >> 16) & 0x0f] +\n HEX_CHARS[(block >> 28) & 0x0f] +\n HEX_CHARS[(block >> 24) & 0x0f];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n // @ts-ignore\n return \"0x\" + hex;\n};\n\n/** @type {(s: number[]) => void} */\nconst f = (s) => {\n var h,\n l,\n n,\n c0,\n c1,\n c2,\n c3,\n c4,\n c5,\n c6,\n c7,\n c8,\n c9,\n b0,\n b1,\n b2,\n b3,\n b4,\n b5,\n b6,\n b7,\n b8,\n b9,\n b10,\n b11,\n b12,\n b13,\n b14,\n b15,\n b16,\n b17,\n b18,\n b19,\n b20,\n b21,\n b22,\n b23,\n b24,\n b25,\n b26,\n b27,\n b28,\n b29,\n b30,\n b31,\n b32,\n b33,\n b34,\n b35,\n b36,\n b37,\n b38,\n b39,\n b40,\n b41,\n b42,\n b43,\n b44,\n b45,\n b46,\n b47,\n b48,\n b49;\n\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n};\n\nconst keccak = (/** @type {number} */ bits) => (/** @type {string} */ str) => {\n var msg;\n if (str.slice(0, 2) === \"0x\") {\n msg = [];\n for (var i = 2, l = str.length; i < l; i += 2)\n msg.push(parseInt(str.slice(i, i + 2), 16));\n } else {\n msg = str;\n }\n // @ts-ignore\n return update(Keccak(bits), msg);\n};\n\n/**\n * @type {(message: string) => string}\n */\nconst keccak256 = keccak(256);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/keccak.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/keystore.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/keystore.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"createKeystore\": function() { return /* binding */ createKeystore; },\n/* harmony export */ \"loadKeystore\": function() { return /* binding */ loadKeystore; }\n/* harmony export */ });\n/* harmony import */ var _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../BadKeyError.js */ \"./node_modules/@hashgraph/cryptography/src/BadKeyError.js\");\n/* harmony import */ var _aes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./aes.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/aes.browser.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/hex.browser.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/utf8.browser.js\");\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js\");\n/* harmony import */ var _pbkdf2_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pbkdf2.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js\");\n/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./random.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/random.js\");\n\n\n\n\n\n\n\n\nconst HMAC_SHA256 = \"hmac-sha256\";\n\n/**\n * @typedef {object} KeystoreKdfParams\n * @property {number} dkLen\n * @property {string} salt\n * @property {number} c\n * @property {string} prf\n */\n\n/**\n * @typedef {object} KeystoreCipherParams\n * @property {string} iv\n */\n\n/**\n * @typedef {object} KeystoreCrypto\n * @property {string} ciphertext\n * @property {KeystoreCipherParams} cipherparams\n * @property {string} cipher\n * @property {string} kdf\n * @property {KeystoreKdfParams} kdfparams\n * @property {string} mac\n */\n\n/**\n * @typedef {object} Keystore\n * @property {number} version\n * @property {KeystoreCrypto} crypto\n */\n\n/**\n * @param {Uint8Array} privateKey\n * @param {string} passphrase\n * @returns {Promise}\n */\nasync function createKeystore(privateKey, passphrase) {\n // all values taken from https://github.com/ethereumjs/ethereumjs-wallet/blob/de3a92e752673ada1d78f95cf80bc56ae1f59775/src/index.ts#L25\n const dkLen = 32;\n const c = 262144;\n const saltLen = 32;\n const salt = await _random_js__WEBPACK_IMPORTED_MODULE_6__.bytesAsync(saltLen);\n\n const key = await _pbkdf2_js__WEBPACK_IMPORTED_MODULE_5__.deriveKey(\n _hmac_js__WEBPACK_IMPORTED_MODULE_4__.HashAlgorithm.Sha256,\n passphrase,\n salt,\n c,\n dkLen\n );\n\n const iv = await _random_js__WEBPACK_IMPORTED_MODULE_6__.bytesAsync(16);\n\n // AES-128-CTR with the first half of the derived key and a random IV\n const cipherText = await _aes_js__WEBPACK_IMPORTED_MODULE_1__.createCipheriv(\n _aes_js__WEBPACK_IMPORTED_MODULE_1__.CipherAlgorithm.Aes128Ctr,\n key.slice(0, 16),\n iv,\n privateKey\n );\n\n const mac = await _hmac_js__WEBPACK_IMPORTED_MODULE_4__.hash(\n _hmac_js__WEBPACK_IMPORTED_MODULE_4__.HashAlgorithm.Sha384,\n key.slice(16),\n cipherText\n );\n\n /**\n * @type {Keystore}\n */\n const keystore = {\n version: 1,\n crypto: {\n ciphertext: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.encode(cipherText),\n cipherparams: { iv: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.encode(iv) },\n cipher: _aes_js__WEBPACK_IMPORTED_MODULE_1__.CipherAlgorithm.Aes128Ctr,\n kdf: \"pbkdf2\",\n kdfparams: {\n dkLen,\n salt: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.encode(salt),\n c,\n prf: HMAC_SHA256,\n },\n mac: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.encode(mac),\n },\n };\n\n return _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_3__.encode(JSON.stringify(keystore));\n}\n\n/**\n * @param {Uint8Array} keystoreBytes\n * @param {string} passphrase\n * @returns {Promise}\n */\nasync function loadKeystore(keystoreBytes, passphrase) {\n /**\n * @type {Keystore}\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const keystore = JSON.parse(_encoding_utf8_js__WEBPACK_IMPORTED_MODULE_3__.decode(keystoreBytes));\n\n if (keystore.version !== 1) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `unsupported keystore version: ${keystore.version}`\n );\n }\n\n const {\n ciphertext,\n cipherparams: { iv },\n cipher,\n kdf,\n kdfparams: { dkLen, salt, c, prf },\n mac,\n } = keystore.crypto;\n\n if (kdf !== \"pbkdf2\") {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](`unsupported key derivation function:\" + ${kdf}`);\n }\n\n if (prf !== HMAC_SHA256) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n `unsupported key derivation hash function: ${prf}`\n );\n }\n\n const saltBytes = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(salt);\n const ivBytes = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(iv);\n const cipherBytes = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(ciphertext);\n\n const key = await _pbkdf2_js__WEBPACK_IMPORTED_MODULE_5__.deriveKey(\n _hmac_js__WEBPACK_IMPORTED_MODULE_4__.HashAlgorithm.Sha256,\n passphrase,\n saltBytes,\n c,\n dkLen\n );\n\n const macHex = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(mac);\n const verifyHmac = await _hmac_js__WEBPACK_IMPORTED_MODULE_4__.hash(\n _hmac_js__WEBPACK_IMPORTED_MODULE_4__.HashAlgorithm.Sha384,\n key.slice(16),\n cipherBytes\n );\n\n // compare that these two Uint8Arrays are equivalent\n if (!macHex.every((b, i) => b === verifyHmac[i])) {\n throw new _BadKeyError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"HMAC mismatch; passphrase is incorrect\");\n }\n\n return _aes_js__WEBPACK_IMPORTED_MODULE_1__.createDecipheriv(\n cipher,\n key.slice(0, 16),\n ivBytes,\n cipherBytes\n );\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/keystore.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IScheduleDeleteTransactionBody} HashgraphProto.proto.IScheduleDeleteTransactionBody + * @typedef {import("@hashgraph/proto").proto.IScheduleID} HashgraphProto.proto.IScheduleID + */ -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("@hashgraph/cryptography").Key} Key + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../Timestamp.js").default} Timestamp + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"deriveKey\": function() { return /* binding */ deriveKey; }\n/* harmony export */ });\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/utf8.browser.js\");\n\n\n/**\n * @typedef {import(\"./hmac.js\").HashAlgorithm} HashAlgorithm\n */\n\n/**\n * @param {HashAlgorithm} algorithm\n * @param {Uint8Array | string} password\n * @param {Uint8Array | string} salt\n * @param {number} iterations\n * @param {number} length\n * @returns {Promise}\n */\nasync function deriveKey(algorithm, password, salt, iterations, length) {\n const pass =\n typeof password === \"string\"\n ? // Valid ASCII is also valid UTF-8 so encoding the password as UTF-8\n // should be fine if only valid ASCII characters are used in the password\n _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_0__.encode(password)\n : password;\n\n const nacl = typeof salt === \"string\" ? _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_0__.encode(salt) : salt;\n\n try {\n const key = await window.crypto.subtle.importKey(\n \"raw\",\n pass,\n {\n name: \"PBKDF2\",\n hash: algorithm,\n },\n false,\n [\"deriveBits\"]\n );\n\n return new Uint8Array(\n await window.crypto.subtle.deriveBits(\n {\n name: \"PBKDF2\",\n hash: algorithm,\n salt: nacl,\n iterations,\n },\n key,\n length << 3\n )\n );\n } catch {\n throw new Error(\"(BUG) Non-Exhaustive switch statement for algorithms\");\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js?"); +/** + * Create a new Hedera™ crypto-currency account. + */ +class ScheduleDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {ScheduleId | string} [props.scheduleId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?ScheduleId} + */ + this._scheduleId = null; + + if (props.scheduleId != null) { + this.setScheduleId(props.scheduleId); + } + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {ScheduleDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const scheduleDelete = + /** @type {HashgraphProto.proto.IScheduleDeleteTransactionBody} */ ( + body.scheduleDelete + ); + + return Transaction_Transaction._fromProtobufTransactions( + new ScheduleDeleteTransaction({ + scheduleId: + scheduleDelete.scheduleID != null + ? ScheduleId._fromProtobuf( + /** @type {HashgraphProto.proto.IScheduleID} */ ( + scheduleDelete.scheduleID + ), + ) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?ScheduleId} + */ + get scheduleId() { + return this._scheduleId; + } + + /** + * @param {ScheduleId | string} scheduleId + * @returns {this} + */ + setScheduleId(scheduleId) { + this._requireNotFrozen(); + this._scheduleId = + typeof scheduleId === "string" + ? ScheduleId.fromString(scheduleId) + : scheduleId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._scheduleId != null) { + this._scheduleId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.schedule.deleteSchedule(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "scheduleDelete"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IScheduleDeleteTransactionBody} + */ + _makeTransactionData() { + return { + scheduleID: + this._scheduleId != null + ? this._scheduleId._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `ScheduleDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "scheduleDelete", + // eslint-disable-next-line @typescript-eslint/unbound-method + ScheduleDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/pkcs.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/pkcs.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AlgorithmIdentifier\": function() { return /* binding */ AlgorithmIdentifier; },\n/* harmony export */ \"EncryptedPrivateKeyInfo\": function() { return /* binding */ EncryptedPrivateKeyInfo; },\n/* harmony export */ \"PrivateKeyInfo\": function() { return /* binding */ PrivateKeyInfo; }\n/* harmony export */ });\n/* harmony import */ var _aes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./aes.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/aes.browser.js\");\n/* harmony import */ var _encoding_der_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/der.js */ \"./node_modules/@hashgraph/cryptography/src/encoding/der.js\");\n/* harmony import */ var _pbkdf2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pbkdf2.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js\");\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js\");\n\n\n\n\n\nclass AlgorithmIdentifier {\n /**\n * @param {import(\"../encoding/der.js\").AsnType} asn\n */\n constructor(asn) {\n if (\"seq\" in asn && asn.seq.length >= 1 && \"ident\" in asn.seq[0]) {\n /**\n * @type {string}\n */\n this.algIdent = asn.seq[0].ident;\n\n /**\n * @type {import(\"../encoding/der.js\").AsnType | undefined}\n */\n this.parameters = asn.seq[1];\n } else {\n throw new Error(\n `error parsing AlgorithmIdentifier from ${JSON.stringify(asn)}`\n );\n }\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this);\n }\n}\n\nclass PBES2Params {\n /**\n * @param {import(\"../encoding/der.js\").AsnType} asn\n */\n constructor(asn) {\n if (\"seq\" in asn && asn.seq.length === 2) {\n /**\n * @type {AlgorithmIdentifier}\n */\n this.kdf = new AlgorithmIdentifier(asn.seq[0]);\n\n /**\n * @type {AlgorithmIdentifier}\n */\n this.encScheme = new AlgorithmIdentifier(asn.seq[1]);\n } else {\n throw new Error(\n `error parsing PBES2Params from ${JSON.stringify(asn)}`\n );\n }\n }\n}\n\nclass PBKDF2Params {\n /**\n * @param {import(\"../encoding/der.js\").AsnType} asn\n */\n constructor(asn) {\n if (\n \"seq\" in asn &&\n asn.seq.length >= 2 &&\n \"bytes\" in asn.seq[0] &&\n \"int\" in asn.seq[1]\n ) {\n /**\n * @type {Uint8Array}\n */\n this.salt = asn.seq[0].bytes;\n\n /**\n * @type {number}\n */\n this.iterCount = asn.seq[1][\"int\"];\n\n if (asn.seq.length > 2) {\n if (\"seq\" in asn.seq[2]) {\n this.prf = new AlgorithmIdentifier(asn.seq[2]);\n return;\n } else if (\"int\" in asn.seq[2]) {\n /**\n * @type {number | undefined}\n */\n this.keyLength = asn.seq[2][\"int\"];\n }\n\n if (asn.seq.length === 4) {\n /**\n * @type {AlgorithmIdentifier | undefined}\n */\n this.prf = new AlgorithmIdentifier(asn.seq[3]);\n }\n\n return;\n }\n }\n\n throw new Error(\n `error parsing PBKDF2Params from ${JSON.stringify(asn)}`\n );\n }\n}\n\nclass PrivateKeyInfo {\n /**\n * @param {import(\"../encoding/der.js\").AsnType} asn\n */\n constructor(asn) {\n if (\"seq\" in asn && asn.seq.length === 3) {\n if (\"int\" in asn.seq[0] && asn.seq[0][\"int\"] === 0) {\n /**\n * @type {number}\n */\n this.version = 0;\n } else {\n throw new Error(\n `expected version = 0, got ${JSON.stringify(asn.seq[0])}`\n );\n }\n\n /**\n * @type {AlgorithmIdentifier}\n */\n this.algId = new AlgorithmIdentifier(asn.seq[1]);\n\n if (\"bytes\" in asn.seq[2]) {\n /**\n * @type {Uint8Array}\n */\n this.privateKey = asn.seq[2].bytes;\n } else {\n throw new Error(\n `expected octet string as 3rd element, got ${JSON.stringify(\n asn.seq[2]\n )}`\n );\n }\n\n return;\n }\n\n throw new Error(\n `error parsing PrivateKeyInfo from ${JSON.stringify(asn)}`\n );\n }\n\n /**\n * @param {Uint8Array} encoded\n * @returns {PrivateKeyInfo}\n */\n static parse(encoded) {\n return new PrivateKeyInfo(_encoding_der_js__WEBPACK_IMPORTED_MODULE_1__.decode(encoded));\n }\n}\n\nclass EncryptedPrivateKeyInfo {\n /**\n * @param {import(\"../encoding/der.js\").AsnType} asn\n */\n constructor(asn) {\n if (\"seq\" in asn && asn.seq.length === 2 && \"bytes\" in asn.seq[1]) {\n /**\n * @type {AlgorithmIdentifier}\n */\n this.algId = new AlgorithmIdentifier(asn.seq[0]);\n\n /**\n * @type {Uint8Array}\n */\n this.data = asn.seq[1].bytes;\n return;\n }\n\n throw new Error(\n `error parsing EncryptedPrivateKeyInfo from ${JSON.stringify(asn)}`\n );\n }\n\n /**\n * @param {Uint8Array} encoded\n * @returns {EncryptedPrivateKeyInfo}\n */\n static parse(encoded) {\n return new EncryptedPrivateKeyInfo(_encoding_der_js__WEBPACK_IMPORTED_MODULE_1__.decode(encoded));\n }\n\n /**\n * @param {string} passphrase\n * @returns {Promise}\n */\n async decrypt(passphrase) {\n if (\n this.algId.algIdent !== \"1.2.840.113549.1.5.13\" ||\n !this.algId.parameters\n ) {\n // PBES2\n throw new Error(\n `unsupported key encryption algorithm: ${this.algId.toString()}`\n );\n }\n\n const pbes2Params = new PBES2Params(this.algId.parameters);\n\n if (\n pbes2Params.kdf.algIdent !== \"1.2.840.113549.1.5.12\" ||\n !pbes2Params.kdf.parameters\n ) {\n // PBKDF2\n throw new Error(\n `unsupported key derivation function: ${pbes2Params.kdf.toString()}`\n );\n }\n\n const pbkdf2Params = new PBKDF2Params(pbes2Params.kdf.parameters);\n\n if (!pbkdf2Params.prf) {\n throw new Error(\"unsupported PRF HMAC-SHA-1\");\n } else if (pbkdf2Params.prf.algIdent !== \"1.2.840.113549.2.9\") {\n // HMAC-SHA-256\n throw new Error(`unsupported PRF ${pbkdf2Params.prf.toString()}`);\n }\n\n if (pbes2Params.encScheme.algIdent !== \"2.16.840.1.101.3.4.1.2\") {\n // AES-128-CBC\n throw new Error(\n `unsupported encryption scheme: ${pbes2Params.encScheme.toString()}`\n );\n }\n\n if (\n !pbes2Params.encScheme.parameters ||\n !(\"bytes\" in pbes2Params.encScheme.parameters)\n ) {\n throw new Error(\n \"expected IV as bytes for AES-128-CBC, \" +\n `got: ${JSON.stringify(pbes2Params.encScheme.parameters)}`\n );\n }\n\n const keyLen = pbkdf2Params.keyLength || 16;\n const iv = pbes2Params.encScheme.parameters.bytes;\n\n const key = await _pbkdf2_js__WEBPACK_IMPORTED_MODULE_2__.deriveKey(\n _hmac_js__WEBPACK_IMPORTED_MODULE_3__.HashAlgorithm.Sha256,\n passphrase,\n pbkdf2Params.salt,\n pbkdf2Params.iterCount,\n keyLen\n );\n\n const decrypted = await _aes_js__WEBPACK_IMPORTED_MODULE_0__.createDecipheriv(\n _aes_js__WEBPACK_IMPORTED_MODULE_0__.CipherAlgorithm.Aes128Cbc,\n key,\n iv,\n this.data\n );\n\n return PrivateKeyInfo.parse(decrypted);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/pkcs.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/random.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/random.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"bytes\": function() { return /* binding */ bytes; },\n/* harmony export */ \"bytesAsync\": function() { return /* binding */ bytesAsync; }\n/* harmony export */ });\n/* harmony import */ var tweetnacl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tweetnacl */ \"./node_modules/tweetnacl/nacl-fast.js\");\n\n\n/**\n * @param {number} count\n * @returns {Uint8Array}\n */\nfunction bytes(count) {\n return tweetnacl__WEBPACK_IMPORTED_MODULE_0__.randomBytes(count);\n}\n\n/**\n * @param {number} count\n * @returns {Promise}\n */\nfunction bytesAsync(count) {\n return Promise.resolve(tweetnacl__WEBPACK_IMPORTED_MODULE_0__.randomBytes(count));\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/random.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/sha256.browser.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/sha256.browser.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"digest\": function() { return /* binding */ digest; }\n/* harmony export */ });\n/**\n * @param {Uint8Array} data\n * @returns {Promise}\n */\nasync function digest(data) {\n // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest\n return new Uint8Array(await crypto.subtle.digest(\"SHA-256\", data));\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/sha256.browser.js?"); -/***/ }), +const { proto: ScheduleInfo_proto } = lib_namespaceObject; -/***/ "./node_modules/@hashgraph/cryptography/src/primitive/slip10.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/primitive/slip10.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Response when the client sends the node ScheduleGetInfoQuery. + */ +class ScheduleInfo { + /** + * @private + * @param {object} props + * @param {ScheduleId} props.scheduleId; + * @param {?AccountId} props.creatorAccountID; + * @param {?AccountId} props.payerAccountID; + * @param {?HashgraphProto.proto.ISchedulableTransactionBody} props.schedulableTransactionBody; + * @param {?Key} props.adminKey + * @param {?KeyList} props.signers; + * @param {?string} props.scheduleMemo; + * @param {?Timestamp} props.expirationTime; + * @param {?Timestamp} props.executed; + * @param {?Timestamp} props.deleted; + * @param {?TransactionId} props.scheduledTransactionId; + * @param {boolean} props.waitForExpiry; + */ + constructor(props) { + /** + * @readonly + */ + this.scheduleId = props.scheduleId; + + /** + * @readonly + */ + this.creatorAccountId = props.creatorAccountID; + + /** + * @readonly + */ + this.payerAccountId = props.payerAccountID; + + /** + * @readonly + */ + this.schedulableTransactionBody = props.schedulableTransactionBody; + + /** + * @readonly + */ + this.signers = props.signers; + + /** + * @readonly + */ + this.scheduleMemo = props.scheduleMemo; + + /** + * @readonly + */ + this.adminKey = props.adminKey != null ? props.adminKey : null; + + /** + * @readonly + */ + this.expirationTime = props.expirationTime; + + /** + * @readonly + */ + this.executed = props.executed; + + /** + * @readonly + */ + this.deleted = props.deleted; + + /** + * @readonly + */ + this.scheduledTransactionId = props.scheduledTransactionId; + + /** + * + * @readonly + */ + this.waitForExpiry = props.waitForExpiry; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.IScheduleInfo} info + * @returns {ScheduleInfo} + */ + static _fromProtobuf(info) { + return new ScheduleInfo({ + scheduleId: ScheduleId._fromProtobuf( + /** @type {HashgraphProto.proto.IScheduleID} */ ( + info.scheduleID + ), + ), + creatorAccountID: + info.creatorAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + info.creatorAccountID + ), + ) + : null, + payerAccountID: + info.payerAccountID != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + info.payerAccountID + ), + ) + : null, + schedulableTransactionBody: + info.scheduledTransactionBody != null + ? info.scheduledTransactionBody + : null, + adminKey: + info.adminKey != null + ? src_Key_Key._fromProtobufKey(info.adminKey) + : null, + signers: + info.signers != null + ? src_KeyList_KeyList.__fromProtobufKeyList(info.signers) + : null, + scheduleMemo: info.memo != null ? info.memo : null, + expirationTime: + info.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.expirationTime + ), + ) + : null, + executed: + info.executionTime != null + ? Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.executionTime + ), + ) + : null, + deleted: + info.deletionTime != null + ? Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.deletionTime + ), + ) + : null, + scheduledTransactionId: + info.scheduledTransactionID != null + ? TransactionId_TransactionId._fromProtobuf(info.scheduledTransactionID) + : null, + waitForExpiry: + info.waitForExpiry != null ? info.waitForExpiry : false, + }); + } + + /** + * @returns {HashgraphProto.proto.IScheduleInfo} + */ + _toProtobuf() { + return { + scheduleID: + this.scheduleId != null ? this.scheduleId._toProtobuf() : null, + creatorAccountID: + this.creatorAccountId != null + ? this.creatorAccountId._toProtobuf() + : null, + payerAccountID: + this.payerAccountId != null + ? this.payerAccountId._toProtobuf() + : null, + scheduledTransactionBody: + this.schedulableTransactionBody != null + ? this.schedulableTransactionBody + : null, + adminKey: + this.adminKey != null ? this.adminKey._toProtobufKey() : null, + signers: + this.signers != null + ? this.signers._toProtobufKey().keyList + : null, + memo: this.scheduleMemo != null ? this.scheduleMemo : "", + expirationTime: + this.expirationTime != null + ? this.expirationTime._toProtobuf() + : null, + scheduledTransactionID: + this.scheduledTransactionId != null + ? this.scheduledTransactionId._toProtobuf() + : null, + waitForExpiry: this.waitForExpiry, + }; + } + + /** + * @returns {Transaction} + */ + get scheduledTransaction() { + if (this.schedulableTransactionBody == null) { + throw new Error("Scheduled transaction body is empty"); + } + + const scheduled = new ScheduleInfo_proto.SchedulableTransactionBody( + this.schedulableTransactionBody, + ); + const data = + /** @type {NonNullable} */ ( + scheduled.data + ); + + return Transaction_Transaction.fromBytes( + ScheduleInfo_proto.TransactionList.encode({ + transactionList: [ + { + signedTransactionBytes: ScheduleInfo_proto.SignedTransaction.encode({ + bodyBytes: ScheduleInfo_proto.TransactionBody.encode({ + transactionFee: + this.schedulableTransactionBody + .transactionFee, + memo: this.schedulableTransactionBody.memo, + [data]: scheduled[data], + }).finish(), + }).finish(), + }, + ], + }).finish(), + ); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"derive\": function() { return /* binding */ derive; }\n/* harmony export */ });\n/* harmony import */ var _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../primitive/hmac.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js\");\n\n\n/**\n * @param {Uint8Array} parentKey\n * @param {Uint8Array} chainCode\n * @param {number} index\n * @returns {Promise<{ keyData: Uint8Array; chainCode: Uint8Array }>}\n */\nasync function derive(parentKey, chainCode, index) {\n const input = new Uint8Array(37);\n\n // 0x00 + parentKey + index(BE)\n input[0] = 0;\n input.set(parentKey, 1);\n new DataView(input.buffer, input.byteOffset, input.byteLength).setUint32(\n 33,\n index,\n false\n );\n\n // set the index to hardened\n input[33] |= 128;\n\n const digest = await _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_0__.hash(_primitive_hmac_js__WEBPACK_IMPORTED_MODULE_0__.HashAlgorithm.Sha512, chainCode, input);\n\n return { keyData: digest.subarray(0, 32), chainCode: digest.subarray(32) };\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/primitive/slip10.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/util/array.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/util/array.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayEqual\": function() { return /* binding */ arrayEqual; },\n/* harmony export */ \"arrayStartsWith\": function() { return /* binding */ arrayStartsWith; }\n/* harmony export */ });\n/**\n * @param {Uint8Array} array1\n * @param {Uint8Array} array2\n * @returns {boolean}\n */\nfunction arrayEqual(array1, array2) {\n if (array1 === array2) {\n return true;\n }\n\n if (array1.byteLength !== array2.byteLength) {\n return false;\n }\n\n const view1 = new DataView(\n array1.buffer,\n array1.byteOffset,\n array1.byteLength\n );\n const view2 = new DataView(\n array2.buffer,\n array2.byteOffset,\n array2.byteLength\n );\n\n let i = array1.byteLength;\n\n while (i--) {\n if (view1.getUint8(i) !== view2.getUint8(i)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * @param {Uint8Array} array\n * @param {Uint8Array} arrayPrefix\n * @returns {boolean}\n */\nfunction arrayStartsWith(array, arrayPrefix) {\n if (array.byteLength < arrayPrefix.byteLength) {\n return false;\n }\n\n let i = arrayPrefix.byteLength;\n\n while (i--) {\n if (array[i] !== arrayPrefix[i]) {\n return false;\n }\n }\n\n return true;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/util/array.js?"); +// eslint-disable-next-line @typescript-eslint/no-unused-vars -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/util/derive.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/util/derive.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.IScheduleInfo} HashgraphProto.proto.IScheduleInfo + * @typedef {import("@hashgraph/proto").proto.IScheduleGetInfoQuery} HashgraphProto.proto.IScheduleGetInfoQuery + * @typedef {import("@hashgraph/proto").proto.IScheduleGetInfoResponse} HashgraphProto.proto.IScheduleGetInfoResponse + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"legacy\": function() { return /* binding */ legacy; }\n/* harmony export */ });\n/* harmony import */ var _primitive_pbkdf2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../primitive/pbkdf2.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/pbkdf2.browser.js\");\n/* harmony import */ var _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../primitive/hmac.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/hmac.browser.js\");\n\n\n\n/**\n * @param {Uint8Array} seed\n * @param {number} index\n * @returns {Promise}\n */\nfunction legacy(seed, index) {\n const password = new Uint8Array(seed.length + 8);\n password.set(seed, 0);\n\n const view = new DataView(\n password.buffer,\n password.byteOffset,\n password.byteLength\n );\n\n if (index === 0xffffffffff) {\n view.setInt32(seed.length + 0, 0xff);\n view.setInt32(seed.length + 4, -1); // 0xffffffff\n } else {\n view.setInt32(seed.length + 0, index < 0 ? -1 : 0);\n view.setInt32(seed.length + 4, index);\n }\n\n const salt = Uint8Array.from([0xff]);\n return _primitive_pbkdf2_js__WEBPACK_IMPORTED_MODULE_0__.deriveKey(\n _primitive_hmac_js__WEBPACK_IMPORTED_MODULE_1__.HashAlgorithm.Sha512,\n password,\n salt,\n 2048,\n 32\n );\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/util/derive.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +/** + * @augments {Query} + */ +class ScheduleInfoQuery extends Query_Query { + /** + * @param {object} properties + * @param {ScheduleId | string} [properties.scheduleId] + */ + constructor(properties = {}) { + super(); + + /** + * @private + * @type {?ScheduleId} + */ + this._scheduleId = null; + + if (properties.scheduleId != null) { + this.setScheduleId(properties.scheduleId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {ScheduleInfoQuery} + */ + static _fromProtobuf(query) { + const info = /** @type {HashgraphProto.proto.IScheduleGetInfoQuery} */ ( + query.scheduleGetInfo + ); + + return new ScheduleInfoQuery({ + scheduleId: + info.scheduleID != null + ? ScheduleId._fromProtobuf(info.scheduleID) + : undefined, + }); + } + + /** + * @returns {?ScheduleId} + */ + get scheduleId() { + return this._scheduleId; + } + + /** + * + * @param {ScheduleId | string} scheduleId + * @returns {ScheduleInfoQuery} + */ + setScheduleId(scheduleId) { + this._scheduleId = + typeof scheduleId === "string" + ? ScheduleId.fromString(scheduleId) + : scheduleId.clone(); + + return this; + } + + /** + * @override + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + return super.getCost(client); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._scheduleId != null) { + this._scheduleId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.schedule.getScheduleInfo(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const scheduleGetInfo = + /** @type {HashgraphProto.proto.IScheduleGetInfoResponse} */ ( + response.scheduleGetInfo + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + scheduleGetInfo.header + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const info = + /** @type {HashgraphProto.proto.IScheduleGetInfoResponse} */ ( + response.scheduleGetInfo + ); + + return Promise.resolve( + ScheduleInfo._fromProtobuf( + /** @type {HashgraphProto.proto.IScheduleInfo} */ ( + info.scheduleInfo + ), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + scheduleGetInfo: { + header, + scheduleID: + this._scheduleId != null + ? this._scheduleId._toProtobuf() + : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `ScheduleInfoQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("scheduleGetInfo", ScheduleInfoQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/schedule/ScheduleSignTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/cryptography/src/util/entropy.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/util/entropy.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"bytesToBits\": function() { return /* binding */ bytesToBits; },\n/* harmony export */ \"convertRadix\": function() { return /* binding */ convertRadix; },\n/* harmony export */ \"crc8\": function() { return /* binding */ crc8; },\n/* harmony export */ \"legacy1\": function() { return /* binding */ legacy1; },\n/* harmony export */ \"legacy2\": function() { return /* binding */ legacy2; }\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ \"./node_modules/bignumber.js/bignumber.mjs\");\n/* harmony import */ var _primitive_sha256_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../primitive/sha256.js */ \"./node_modules/@hashgraph/cryptography/src/primitive/sha256.browser.js\");\n\n\n\n/**\n * @param {string[]} words\n * @param {string[]} wordlist\n * @returns {[Uint8Array, number]}\n */\nfunction legacy1(words, wordlist) {\n const indicies = words.map((word) => wordlist.indexOf(word.toLowerCase()));\n\n const data = convertRadix(indicies, wordlist.length, 256, 33);\n const checksum = data[data.length - 1];\n const result = new Uint8Array(data.length - 1);\n\n for (let i = 0; i < data.length - 1; i += 1) {\n result[i] = data[i] ^ checksum;\n }\n\n return [result, checksum];\n}\n\n/**\n * @param {string[]} words\n * @param {string[]} wordlist\n * @returns {Promise}\n */\nasync function legacy2(words, wordlist) {\n const concatBitsLen = words.length * 11;\n /** @type {boolean[]} */\n const concatBits = [];\n concatBits.fill(false, 0, concatBitsLen);\n\n for (const [wordIndex, word] of words.entries()) {\n const index = wordlist.indexOf(word.toLowerCase());\n\n if (index < 0) {\n throw new Error(`Word not found in wordlist: ${word}`);\n }\n\n for (let i = 0; i < 11; i += 1) {\n concatBits[wordIndex * 11 + i] = (index & (1 << (10 - i))) !== 0;\n }\n }\n\n const checksumBitsLen = concatBitsLen / 33;\n const entropyBitsLen = concatBitsLen - checksumBitsLen;\n const entropy = new Uint8Array(entropyBitsLen / 8);\n\n for (let i = 0; i < entropy.length; i += 1) {\n for (let j = 0; j < 8; j += 1) {\n if (concatBits[i * 8 + j]) {\n entropy[i] |= 1 << (7 - j);\n }\n }\n }\n\n // Checksum validation\n const hash = await _primitive_sha256_js__WEBPACK_IMPORTED_MODULE_1__.digest(entropy);\n const hashBits = bytesToBits(hash);\n\n for (let i = 0; i < checksumBitsLen; i += 1) {\n if (concatBits[entropyBitsLen + i] !== hashBits[i]) {\n throw new Error(\"Checksum mismatch\");\n }\n }\n\n return entropy;\n}\n\n/**\n * @param {Uint8Array} data\n * @returns {number}\n */\nfunction crc8(data) {\n let crc = 0xff;\n\n for (let i = 0; i < data.length - 1; i += 1) {\n crc ^= data[i];\n for (let j = 0; j < 8; j += 1) {\n crc = (crc >>> 1) ^ ((crc & 1) === 0 ? 0 : 0xb2);\n }\n }\n\n return crc ^ 0xff;\n}\n\n/**\n * @param {number[]} nums\n * @param {number} fromRadix\n * @param {number} toRadix\n * @param {number} toLength\n * @returns {Uint8Array}\n */\nfunction convertRadix(nums, fromRadix, toRadix, toLength) {\n let num = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](0);\n\n for (const element of nums) {\n num = num.times(fromRadix);\n num = num.plus(element);\n }\n\n const result = new Uint8Array(toLength);\n\n for (let i = toLength - 1; i >= 0; i -= 1) {\n const tem = num.dividedToIntegerBy(toRadix);\n const rem = num.modulo(toRadix);\n num = tem;\n result[i] = rem.toNumber();\n }\n\n return result;\n}\n\n/**\n * @param {Uint8Array} data\n * @returns {boolean[]}\n */\nfunction bytesToBits(data) {\n /** @type {boolean[]} */\n const bits = [];\n bits.fill(false, 0, data.length * 8);\n\n for (let i = 0; i < data.length; i += 1) {\n for (let j = 0; j < 8; j += 1) {\n bits[i * 8 + j] = (data[i] & (1 << (7 - j))) !== 0;\n }\n }\n\n return bits;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/util/entropy.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/words/bip39.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/words/bip39.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = ([\n \"abandon\",\n \"ability\",\n \"able\",\n \"about\",\n \"above\",\n \"absent\",\n \"absorb\",\n \"abstract\",\n \"absurd\",\n \"abuse\",\n \"access\",\n \"accident\",\n \"account\",\n \"accuse\",\n \"achieve\",\n \"acid\",\n \"acoustic\",\n \"acquire\",\n \"across\",\n \"act\",\n \"action\",\n \"actor\",\n \"actress\",\n \"actual\",\n \"adapt\",\n \"add\",\n \"addict\",\n \"address\",\n \"adjust\",\n \"admit\",\n \"adult\",\n \"advance\",\n \"advice\",\n \"aerobic\",\n \"affair\",\n \"afford\",\n \"afraid\",\n \"again\",\n \"age\",\n \"agent\",\n \"agree\",\n \"ahead\",\n \"aim\",\n \"air\",\n \"airport\",\n \"aisle\",\n \"alarm\",\n \"album\",\n \"alcohol\",\n \"alert\",\n \"alien\",\n \"all\",\n \"alley\",\n \"allow\",\n \"almost\",\n \"alone\",\n \"alpha\",\n \"already\",\n \"also\",\n \"alter\",\n \"always\",\n \"amateur\",\n \"amazing\",\n \"among\",\n \"amount\",\n \"amused\",\n \"analyst\",\n \"anchor\",\n \"ancient\",\n \"anger\",\n \"angle\",\n \"angry\",\n \"animal\",\n \"ankle\",\n \"announce\",\n \"annual\",\n \"another\",\n \"answer\",\n \"antenna\",\n \"antique\",\n \"anxiety\",\n \"any\",\n \"apart\",\n \"apology\",\n \"appear\",\n \"apple\",\n \"approve\",\n \"april\",\n \"arch\",\n \"arctic\",\n \"area\",\n \"arena\",\n \"argue\",\n \"arm\",\n \"armed\",\n \"armor\",\n \"army\",\n \"around\",\n \"arrange\",\n \"arrest\",\n \"arrive\",\n \"arrow\",\n \"art\",\n \"artefact\",\n \"artist\",\n \"artwork\",\n \"ask\",\n \"aspect\",\n \"assault\",\n \"asset\",\n \"assist\",\n \"assume\",\n \"asthma\",\n \"athlete\",\n \"atom\",\n \"attack\",\n \"attend\",\n \"attitude\",\n \"attract\",\n \"auction\",\n \"audit\",\n \"august\",\n \"aunt\",\n \"author\",\n \"auto\",\n \"autumn\",\n \"average\",\n \"avocado\",\n \"avoid\",\n \"awake\",\n \"aware\",\n \"away\",\n \"awesome\",\n \"awful\",\n \"awkward\",\n \"axis\",\n \"baby\",\n \"bachelor\",\n \"bacon\",\n \"badge\",\n \"bag\",\n \"balance\",\n \"balcony\",\n \"ball\",\n \"bamboo\",\n \"banana\",\n \"banner\",\n \"bar\",\n \"barely\",\n \"bargain\",\n \"barrel\",\n \"base\",\n \"basic\",\n \"basket\",\n \"battle\",\n \"beach\",\n \"bean\",\n \"beauty\",\n \"because\",\n \"become\",\n \"beef\",\n \"before\",\n \"begin\",\n \"behave\",\n \"behind\",\n \"believe\",\n \"below\",\n \"belt\",\n \"bench\",\n \"benefit\",\n \"best\",\n \"betray\",\n \"better\",\n \"between\",\n \"beyond\",\n \"bicycle\",\n \"bid\",\n \"bike\",\n \"bind\",\n \"biology\",\n \"bird\",\n \"birth\",\n \"bitter\",\n \"black\",\n \"blade\",\n \"blame\",\n \"blanket\",\n \"blast\",\n \"bleak\",\n \"bless\",\n \"blind\",\n \"blood\",\n \"blossom\",\n \"blouse\",\n \"blue\",\n \"blur\",\n \"blush\",\n \"board\",\n \"boat\",\n \"body\",\n \"boil\",\n \"bomb\",\n \"bone\",\n \"bonus\",\n \"book\",\n \"boost\",\n \"border\",\n \"boring\",\n \"borrow\",\n \"boss\",\n \"bottom\",\n \"bounce\",\n \"box\",\n \"boy\",\n \"bracket\",\n \"brain\",\n \"brand\",\n \"brass\",\n \"brave\",\n \"bread\",\n \"breeze\",\n \"brick\",\n \"bridge\",\n \"brief\",\n \"bright\",\n \"bring\",\n \"brisk\",\n \"broccoli\",\n \"broken\",\n \"bronze\",\n \"broom\",\n \"brother\",\n \"brown\",\n \"brush\",\n \"bubble\",\n \"buddy\",\n \"budget\",\n \"buffalo\",\n \"build\",\n \"bulb\",\n \"bulk\",\n \"bullet\",\n \"bundle\",\n \"bunker\",\n \"burden\",\n \"burger\",\n \"burst\",\n \"bus\",\n \"business\",\n \"busy\",\n \"butter\",\n \"buyer\",\n \"buzz\",\n \"cabbage\",\n \"cabin\",\n \"cable\",\n \"cactus\",\n \"cage\",\n \"cake\",\n \"call\",\n \"calm\",\n \"camera\",\n \"camp\",\n \"can\",\n \"canal\",\n \"cancel\",\n \"candy\",\n \"cannon\",\n \"canoe\",\n \"canvas\",\n \"canyon\",\n \"capable\",\n \"capital\",\n \"captain\",\n \"car\",\n \"carbon\",\n \"card\",\n \"cargo\",\n \"carpet\",\n \"carry\",\n \"cart\",\n \"case\",\n \"cash\",\n \"casino\",\n \"castle\",\n \"casual\",\n \"cat\",\n \"catalog\",\n \"catch\",\n \"category\",\n \"cattle\",\n \"caught\",\n \"cause\",\n \"caution\",\n \"cave\",\n \"ceiling\",\n \"celery\",\n \"cement\",\n \"census\",\n \"century\",\n \"cereal\",\n \"certain\",\n \"chair\",\n \"chalk\",\n \"champion\",\n \"change\",\n \"chaos\",\n \"chapter\",\n \"charge\",\n \"chase\",\n \"chat\",\n \"cheap\",\n \"check\",\n \"cheese\",\n \"chef\",\n \"cherry\",\n \"chest\",\n \"chicken\",\n \"chief\",\n \"child\",\n \"chimney\",\n \"choice\",\n \"choose\",\n \"chronic\",\n \"chuckle\",\n \"chunk\",\n \"churn\",\n \"cigar\",\n \"cinnamon\",\n \"circle\",\n \"citizen\",\n \"city\",\n \"civil\",\n \"claim\",\n \"clap\",\n \"clarify\",\n \"claw\",\n \"clay\",\n \"clean\",\n \"clerk\",\n \"clever\",\n \"click\",\n \"client\",\n \"cliff\",\n \"climb\",\n \"clinic\",\n \"clip\",\n \"clock\",\n \"clog\",\n \"close\",\n \"cloth\",\n \"cloud\",\n \"clown\",\n \"club\",\n \"clump\",\n \"cluster\",\n \"clutch\",\n \"coach\",\n \"coast\",\n \"coconut\",\n \"code\",\n \"coffee\",\n \"coil\",\n \"coin\",\n \"collect\",\n \"color\",\n \"column\",\n \"combine\",\n \"come\",\n \"comfort\",\n \"comic\",\n \"common\",\n \"company\",\n \"concert\",\n \"conduct\",\n \"confirm\",\n \"congress\",\n \"connect\",\n \"consider\",\n \"control\",\n \"convince\",\n \"cook\",\n \"cool\",\n \"copper\",\n \"copy\",\n \"coral\",\n \"core\",\n \"corn\",\n \"correct\",\n \"cost\",\n \"cotton\",\n \"couch\",\n \"country\",\n \"couple\",\n \"course\",\n \"cousin\",\n \"cover\",\n \"coyote\",\n \"crack\",\n \"cradle\",\n \"craft\",\n \"cram\",\n \"crane\",\n \"crash\",\n \"crater\",\n \"crawl\",\n \"crazy\",\n \"cream\",\n \"credit\",\n \"creek\",\n \"crew\",\n \"cricket\",\n \"crime\",\n \"crisp\",\n \"critic\",\n \"crop\",\n \"cross\",\n \"crouch\",\n \"crowd\",\n \"crucial\",\n \"cruel\",\n \"cruise\",\n \"crumble\",\n \"crunch\",\n \"crush\",\n \"cry\",\n \"crystal\",\n \"cube\",\n \"culture\",\n \"cup\",\n \"cupboard\",\n \"curious\",\n \"current\",\n \"curtain\",\n \"curve\",\n \"cushion\",\n \"custom\",\n \"cute\",\n \"cycle\",\n \"dad\",\n \"damage\",\n \"damp\",\n \"dance\",\n \"danger\",\n \"daring\",\n \"dash\",\n \"daughter\",\n \"dawn\",\n \"day\",\n \"deal\",\n \"debate\",\n \"debris\",\n \"decade\",\n \"december\",\n \"decide\",\n \"decline\",\n \"decorate\",\n \"decrease\",\n \"deer\",\n \"defense\",\n \"define\",\n \"defy\",\n \"degree\",\n \"delay\",\n \"deliver\",\n \"demand\",\n \"demise\",\n \"denial\",\n \"dentist\",\n \"deny\",\n \"depart\",\n \"depend\",\n \"deposit\",\n \"depth\",\n \"deputy\",\n \"derive\",\n \"describe\",\n \"desert\",\n \"design\",\n \"desk\",\n \"despair\",\n \"destroy\",\n \"detail\",\n \"detect\",\n \"develop\",\n \"device\",\n \"devote\",\n \"diagram\",\n \"dial\",\n \"diamond\",\n \"diary\",\n \"dice\",\n \"diesel\",\n \"diet\",\n \"differ\",\n \"digital\",\n \"dignity\",\n \"dilemma\",\n \"dinner\",\n \"dinosaur\",\n \"direct\",\n \"dirt\",\n \"disagree\",\n \"discover\",\n \"disease\",\n \"dish\",\n \"dismiss\",\n \"disorder\",\n \"display\",\n \"distance\",\n \"divert\",\n \"divide\",\n \"divorce\",\n \"dizzy\",\n \"doctor\",\n \"document\",\n \"dog\",\n \"doll\",\n \"dolphin\",\n \"domain\",\n \"donate\",\n \"donkey\",\n \"donor\",\n \"door\",\n \"dose\",\n \"double\",\n \"dove\",\n \"draft\",\n \"dragon\",\n \"drama\",\n \"drastic\",\n \"draw\",\n \"dream\",\n \"dress\",\n \"drift\",\n \"drill\",\n \"drink\",\n \"drip\",\n \"drive\",\n \"drop\",\n \"drum\",\n \"dry\",\n \"duck\",\n \"dumb\",\n \"dune\",\n \"during\",\n \"dust\",\n \"dutch\",\n \"duty\",\n \"dwarf\",\n \"dynamic\",\n \"eager\",\n \"eagle\",\n \"early\",\n \"earn\",\n \"earth\",\n \"easily\",\n \"east\",\n \"easy\",\n \"echo\",\n \"ecology\",\n \"economy\",\n \"edge\",\n \"edit\",\n \"educate\",\n \"effort\",\n \"egg\",\n \"eight\",\n \"either\",\n \"elbow\",\n \"elder\",\n \"electric\",\n \"elegant\",\n \"element\",\n \"elephant\",\n \"elevator\",\n \"elite\",\n \"else\",\n \"embark\",\n \"embody\",\n \"embrace\",\n \"emerge\",\n \"emotion\",\n \"employ\",\n \"empower\",\n \"empty\",\n \"enable\",\n \"enact\",\n \"end\",\n \"endless\",\n \"endorse\",\n \"enemy\",\n \"energy\",\n \"enforce\",\n \"engage\",\n \"engine\",\n \"enhance\",\n \"enjoy\",\n \"enlist\",\n \"enough\",\n \"enrich\",\n \"enroll\",\n \"ensure\",\n \"enter\",\n \"entire\",\n \"entry\",\n \"envelope\",\n \"episode\",\n \"equal\",\n \"equip\",\n \"era\",\n \"erase\",\n \"erode\",\n \"erosion\",\n \"error\",\n \"erupt\",\n \"escape\",\n \"essay\",\n \"essence\",\n \"estate\",\n \"eternal\",\n \"ethics\",\n \"evidence\",\n \"evil\",\n \"evoke\",\n \"evolve\",\n \"exact\",\n \"example\",\n \"excess\",\n \"exchange\",\n \"excite\",\n \"exclude\",\n \"excuse\",\n \"execute\",\n \"exercise\",\n \"exhaust\",\n \"exhibit\",\n \"exile\",\n \"exist\",\n \"exit\",\n \"exotic\",\n \"expand\",\n \"expect\",\n \"expire\",\n \"explain\",\n \"expose\",\n \"express\",\n \"extend\",\n \"extra\",\n \"eye\",\n \"eyebrow\",\n \"fabric\",\n \"face\",\n \"faculty\",\n \"fade\",\n \"faint\",\n \"faith\",\n \"fall\",\n \"false\",\n \"fame\",\n \"family\",\n \"famous\",\n \"fan\",\n \"fancy\",\n \"fantasy\",\n \"farm\",\n \"fashion\",\n \"fat\",\n \"fatal\",\n \"father\",\n \"fatigue\",\n \"fault\",\n \"favorite\",\n \"feature\",\n \"february\",\n \"federal\",\n \"fee\",\n \"feed\",\n \"feel\",\n \"female\",\n \"fence\",\n \"festival\",\n \"fetch\",\n \"fever\",\n \"few\",\n \"fiber\",\n \"fiction\",\n \"field\",\n \"figure\",\n \"file\",\n \"film\",\n \"filter\",\n \"final\",\n \"find\",\n \"fine\",\n \"finger\",\n \"finish\",\n \"fire\",\n \"firm\",\n \"first\",\n \"fiscal\",\n \"fish\",\n \"fit\",\n \"fitness\",\n \"fix\",\n \"flag\",\n \"flame\",\n \"flash\",\n \"flat\",\n \"flavor\",\n \"flee\",\n \"flight\",\n \"flip\",\n \"float\",\n \"flock\",\n \"floor\",\n \"flower\",\n \"fluid\",\n \"flush\",\n \"fly\",\n \"foam\",\n \"focus\",\n \"fog\",\n \"foil\",\n \"fold\",\n \"follow\",\n \"food\",\n \"foot\",\n \"force\",\n \"forest\",\n \"forget\",\n \"fork\",\n \"fortune\",\n \"forum\",\n \"forward\",\n \"fossil\",\n \"foster\",\n \"found\",\n \"fox\",\n \"fragile\",\n \"frame\",\n \"frequent\",\n \"fresh\",\n \"friend\",\n \"fringe\",\n \"frog\",\n \"front\",\n \"frost\",\n \"frown\",\n \"frozen\",\n \"fruit\",\n \"fuel\",\n \"fun\",\n \"funny\",\n \"furnace\",\n \"fury\",\n \"future\",\n \"gadget\",\n \"gain\",\n \"galaxy\",\n \"gallery\",\n \"game\",\n \"gap\",\n \"garage\",\n \"garbage\",\n \"garden\",\n \"garlic\",\n \"garment\",\n \"gas\",\n \"gasp\",\n \"gate\",\n \"gather\",\n \"gauge\",\n \"gaze\",\n \"general\",\n \"genius\",\n \"genre\",\n \"gentle\",\n \"genuine\",\n \"gesture\",\n \"ghost\",\n \"giant\",\n \"gift\",\n \"giggle\",\n \"ginger\",\n \"giraffe\",\n \"girl\",\n \"give\",\n \"glad\",\n \"glance\",\n \"glare\",\n \"glass\",\n \"glide\",\n \"glimpse\",\n \"globe\",\n \"gloom\",\n \"glory\",\n \"glove\",\n \"glow\",\n \"glue\",\n \"goat\",\n \"goddess\",\n \"gold\",\n \"good\",\n \"goose\",\n \"gorilla\",\n \"gospel\",\n \"gossip\",\n \"govern\",\n \"gown\",\n \"grab\",\n \"grace\",\n \"grain\",\n \"grant\",\n \"grape\",\n \"grass\",\n \"gravity\",\n \"great\",\n \"green\",\n \"grid\",\n \"grief\",\n \"grit\",\n \"grocery\",\n \"group\",\n \"grow\",\n \"grunt\",\n \"guard\",\n \"guess\",\n \"guide\",\n \"guilt\",\n \"guitar\",\n \"gun\",\n \"gym\",\n \"habit\",\n \"hair\",\n \"half\",\n \"hammer\",\n \"hamster\",\n \"hand\",\n \"happy\",\n \"harbor\",\n \"hard\",\n \"harsh\",\n \"harvest\",\n \"hat\",\n \"have\",\n \"hawk\",\n \"hazard\",\n \"head\",\n \"health\",\n \"heart\",\n \"heavy\",\n \"hedgehog\",\n \"height\",\n \"hello\",\n \"helmet\",\n \"help\",\n \"hen\",\n \"hero\",\n \"hidden\",\n \"high\",\n \"hill\",\n \"hint\",\n \"hip\",\n \"hire\",\n \"history\",\n \"hobby\",\n \"hockey\",\n \"hold\",\n \"hole\",\n \"holiday\",\n \"hollow\",\n \"home\",\n \"honey\",\n \"hood\",\n \"hope\",\n \"horn\",\n \"horror\",\n \"horse\",\n \"hospital\",\n \"host\",\n \"hotel\",\n \"hour\",\n \"hover\",\n \"hub\",\n \"huge\",\n \"human\",\n \"humble\",\n \"humor\",\n \"hundred\",\n \"hungry\",\n \"hunt\",\n \"hurdle\",\n \"hurry\",\n \"hurt\",\n \"husband\",\n \"hybrid\",\n \"ice\",\n \"icon\",\n \"idea\",\n \"identify\",\n \"idle\",\n \"ignore\",\n \"ill\",\n \"illegal\",\n \"illness\",\n \"image\",\n \"imitate\",\n \"immense\",\n \"immune\",\n \"impact\",\n \"impose\",\n \"improve\",\n \"impulse\",\n \"inch\",\n \"include\",\n \"income\",\n \"increase\",\n \"index\",\n \"indicate\",\n \"indoor\",\n \"industry\",\n \"infant\",\n \"inflict\",\n \"inform\",\n \"inhale\",\n \"inherit\",\n \"initial\",\n \"inject\",\n \"injury\",\n \"inmate\",\n \"inner\",\n \"innocent\",\n \"input\",\n \"inquiry\",\n \"insane\",\n \"insect\",\n \"inside\",\n \"inspire\",\n \"install\",\n \"intact\",\n \"interest\",\n \"into\",\n \"invest\",\n \"invite\",\n \"involve\",\n \"iron\",\n \"island\",\n \"isolate\",\n \"issue\",\n \"item\",\n \"ivory\",\n \"jacket\",\n \"jaguar\",\n \"jar\",\n \"jazz\",\n \"jealous\",\n \"jeans\",\n \"jelly\",\n \"jewel\",\n \"job\",\n \"join\",\n \"joke\",\n \"journey\",\n \"joy\",\n \"judge\",\n \"juice\",\n \"jump\",\n \"jungle\",\n \"junior\",\n \"junk\",\n \"just\",\n \"kangaroo\",\n \"keen\",\n \"keep\",\n \"ketchup\",\n \"key\",\n \"kick\",\n \"kid\",\n \"kidney\",\n \"kind\",\n \"kingdom\",\n \"kiss\",\n \"kit\",\n \"kitchen\",\n \"kite\",\n \"kitten\",\n \"kiwi\",\n \"knee\",\n \"knife\",\n \"knock\",\n \"know\",\n \"lab\",\n \"label\",\n \"labor\",\n \"ladder\",\n \"lady\",\n \"lake\",\n \"lamp\",\n \"language\",\n \"laptop\",\n \"large\",\n \"later\",\n \"latin\",\n \"laugh\",\n \"laundry\",\n \"lava\",\n \"law\",\n \"lawn\",\n \"lawsuit\",\n \"layer\",\n \"lazy\",\n \"leader\",\n \"leaf\",\n \"learn\",\n \"leave\",\n \"lecture\",\n \"left\",\n \"leg\",\n \"legal\",\n \"legend\",\n \"leisure\",\n \"lemon\",\n \"lend\",\n \"length\",\n \"lens\",\n \"leopard\",\n \"lesson\",\n \"letter\",\n \"level\",\n \"liar\",\n \"liberty\",\n \"library\",\n \"license\",\n \"life\",\n \"lift\",\n \"light\",\n \"like\",\n \"limb\",\n \"limit\",\n \"link\",\n \"lion\",\n \"liquid\",\n \"list\",\n \"little\",\n \"live\",\n \"lizard\",\n \"load\",\n \"loan\",\n \"lobster\",\n \"local\",\n \"lock\",\n \"logic\",\n \"lonely\",\n \"long\",\n \"loop\",\n \"lottery\",\n \"loud\",\n \"lounge\",\n \"love\",\n \"loyal\",\n \"lucky\",\n \"luggage\",\n \"lumber\",\n \"lunar\",\n \"lunch\",\n \"luxury\",\n \"lyrics\",\n \"machine\",\n \"mad\",\n \"magic\",\n \"magnet\",\n \"maid\",\n \"mail\",\n \"main\",\n \"major\",\n \"make\",\n \"mammal\",\n \"man\",\n \"manage\",\n \"mandate\",\n \"mango\",\n \"mansion\",\n \"manual\",\n \"maple\",\n \"marble\",\n \"march\",\n \"margin\",\n \"marine\",\n \"market\",\n \"marriage\",\n \"mask\",\n \"mass\",\n \"master\",\n \"match\",\n \"material\",\n \"math\",\n \"matrix\",\n \"matter\",\n \"maximum\",\n \"maze\",\n \"meadow\",\n \"mean\",\n \"measure\",\n \"meat\",\n \"mechanic\",\n \"medal\",\n \"media\",\n \"melody\",\n \"melt\",\n \"member\",\n \"memory\",\n \"mention\",\n \"menu\",\n \"mercy\",\n \"merge\",\n \"merit\",\n \"merry\",\n \"mesh\",\n \"message\",\n \"metal\",\n \"method\",\n \"middle\",\n \"midnight\",\n \"milk\",\n \"million\",\n \"mimic\",\n \"mind\",\n \"minimum\",\n \"minor\",\n \"minute\",\n \"miracle\",\n \"mirror\",\n \"misery\",\n \"miss\",\n \"mistake\",\n \"mix\",\n \"mixed\",\n \"mixture\",\n \"mobile\",\n \"model\",\n \"modify\",\n \"mom\",\n \"moment\",\n \"monitor\",\n \"monkey\",\n \"monster\",\n \"month\",\n \"moon\",\n \"moral\",\n \"more\",\n \"morning\",\n \"mosquito\",\n \"mother\",\n \"motion\",\n \"motor\",\n \"mountain\",\n \"mouse\",\n \"move\",\n \"movie\",\n \"much\",\n \"muffin\",\n \"mule\",\n \"multiply\",\n \"muscle\",\n \"museum\",\n \"mushroom\",\n \"music\",\n \"must\",\n \"mutual\",\n \"myself\",\n \"mystery\",\n \"myth\",\n \"naive\",\n \"name\",\n \"napkin\",\n \"narrow\",\n \"nasty\",\n \"nation\",\n \"nature\",\n \"near\",\n \"neck\",\n \"need\",\n \"negative\",\n \"neglect\",\n \"neither\",\n \"nephew\",\n \"nerve\",\n \"nest\",\n \"net\",\n \"network\",\n \"neutral\",\n \"never\",\n \"news\",\n \"next\",\n \"nice\",\n \"night\",\n \"noble\",\n \"noise\",\n \"nominee\",\n \"noodle\",\n \"normal\",\n \"north\",\n \"nose\",\n \"notable\",\n \"note\",\n \"nothing\",\n \"notice\",\n \"novel\",\n \"now\",\n \"nuclear\",\n \"number\",\n \"nurse\",\n \"nut\",\n \"oak\",\n \"obey\",\n \"object\",\n \"oblige\",\n \"obscure\",\n \"observe\",\n \"obtain\",\n \"obvious\",\n \"occur\",\n \"ocean\",\n \"october\",\n \"odor\",\n \"off\",\n \"offer\",\n \"office\",\n \"often\",\n \"oil\",\n \"okay\",\n \"old\",\n \"olive\",\n \"olympic\",\n \"omit\",\n \"once\",\n \"one\",\n \"onion\",\n \"online\",\n \"only\",\n \"open\",\n \"opera\",\n \"opinion\",\n \"oppose\",\n \"option\",\n \"orange\",\n \"orbit\",\n \"orchard\",\n \"order\",\n \"ordinary\",\n \"organ\",\n \"orient\",\n \"original\",\n \"orphan\",\n \"ostrich\",\n \"other\",\n \"outdoor\",\n \"outer\",\n \"output\",\n \"outside\",\n \"oval\",\n \"oven\",\n \"over\",\n \"own\",\n \"owner\",\n \"oxygen\",\n \"oyster\",\n \"ozone\",\n \"pact\",\n \"paddle\",\n \"page\",\n \"pair\",\n \"palace\",\n \"palm\",\n \"panda\",\n \"panel\",\n \"panic\",\n \"panther\",\n \"paper\",\n \"parade\",\n \"parent\",\n \"park\",\n \"parrot\",\n \"party\",\n \"pass\",\n \"patch\",\n \"path\",\n \"patient\",\n \"patrol\",\n \"pattern\",\n \"pause\",\n \"pave\",\n \"payment\",\n \"peace\",\n \"peanut\",\n \"pear\",\n \"peasant\",\n \"pelican\",\n \"pen\",\n \"penalty\",\n \"pencil\",\n \"people\",\n \"pepper\",\n \"perfect\",\n \"permit\",\n \"person\",\n \"pet\",\n \"phone\",\n \"photo\",\n \"phrase\",\n \"physical\",\n \"piano\",\n \"picnic\",\n \"picture\",\n \"piece\",\n \"pig\",\n \"pigeon\",\n \"pill\",\n \"pilot\",\n \"pink\",\n \"pioneer\",\n \"pipe\",\n \"pistol\",\n \"pitch\",\n \"pizza\",\n \"place\",\n \"planet\",\n \"plastic\",\n \"plate\",\n \"play\",\n \"please\",\n \"pledge\",\n \"pluck\",\n \"plug\",\n \"plunge\",\n \"poem\",\n \"poet\",\n \"point\",\n \"polar\",\n \"pole\",\n \"police\",\n \"pond\",\n \"pony\",\n \"pool\",\n \"popular\",\n \"portion\",\n \"position\",\n \"possible\",\n \"post\",\n \"potato\",\n \"pottery\",\n \"poverty\",\n \"powder\",\n \"power\",\n \"practice\",\n \"praise\",\n \"predict\",\n \"prefer\",\n \"prepare\",\n \"present\",\n \"pretty\",\n \"prevent\",\n \"price\",\n \"pride\",\n \"primary\",\n \"print\",\n \"priority\",\n \"prison\",\n \"private\",\n \"prize\",\n \"problem\",\n \"process\",\n \"produce\",\n \"profit\",\n \"program\",\n \"project\",\n \"promote\",\n \"proof\",\n \"property\",\n \"prosper\",\n \"protect\",\n \"proud\",\n \"provide\",\n \"public\",\n \"pudding\",\n \"pull\",\n \"pulp\",\n \"pulse\",\n \"pumpkin\",\n \"punch\",\n \"pupil\",\n \"puppy\",\n \"purchase\",\n \"purity\",\n \"purpose\",\n \"purse\",\n \"push\",\n \"put\",\n \"puzzle\",\n \"pyramid\",\n \"quality\",\n \"quantum\",\n \"quarter\",\n \"question\",\n \"quick\",\n \"quit\",\n \"quiz\",\n \"quote\",\n \"rabbit\",\n \"raccoon\",\n \"race\",\n \"rack\",\n \"radar\",\n \"radio\",\n \"rail\",\n \"rain\",\n \"raise\",\n \"rally\",\n \"ramp\",\n \"ranch\",\n \"random\",\n \"range\",\n \"rapid\",\n \"rare\",\n \"rate\",\n \"rather\",\n \"raven\",\n \"raw\",\n \"razor\",\n \"ready\",\n \"real\",\n \"reason\",\n \"rebel\",\n \"rebuild\",\n \"recall\",\n \"receive\",\n \"recipe\",\n \"record\",\n \"recycle\",\n \"reduce\",\n \"reflect\",\n \"reform\",\n \"refuse\",\n \"region\",\n \"regret\",\n \"regular\",\n \"reject\",\n \"relax\",\n \"release\",\n \"relief\",\n \"rely\",\n \"remain\",\n \"remember\",\n \"remind\",\n \"remove\",\n \"render\",\n \"renew\",\n \"rent\",\n \"reopen\",\n \"repair\",\n \"repeat\",\n \"replace\",\n \"report\",\n \"require\",\n \"rescue\",\n \"resemble\",\n \"resist\",\n \"resource\",\n \"response\",\n \"result\",\n \"retire\",\n \"retreat\",\n \"return\",\n \"reunion\",\n \"reveal\",\n \"review\",\n \"reward\",\n \"rhythm\",\n \"rib\",\n \"ribbon\",\n \"rice\",\n \"rich\",\n \"ride\",\n \"ridge\",\n \"rifle\",\n \"right\",\n \"rigid\",\n \"ring\",\n \"riot\",\n \"ripple\",\n \"risk\",\n \"ritual\",\n \"rival\",\n \"river\",\n \"road\",\n \"roast\",\n \"robot\",\n \"robust\",\n \"rocket\",\n \"romance\",\n \"roof\",\n \"rookie\",\n \"room\",\n \"rose\",\n \"rotate\",\n \"rough\",\n \"round\",\n \"route\",\n \"royal\",\n \"rubber\",\n \"rude\",\n \"rug\",\n \"rule\",\n \"run\",\n \"runway\",\n \"rural\",\n \"sad\",\n \"saddle\",\n \"sadness\",\n \"safe\",\n \"sail\",\n \"salad\",\n \"salmon\",\n \"salon\",\n \"salt\",\n \"salute\",\n \"same\",\n \"sample\",\n \"sand\",\n \"satisfy\",\n \"satoshi\",\n \"sauce\",\n \"sausage\",\n \"save\",\n \"say\",\n \"scale\",\n \"scan\",\n \"scare\",\n \"scatter\",\n \"scene\",\n \"scheme\",\n \"school\",\n \"science\",\n \"scissors\",\n \"scorpion\",\n \"scout\",\n \"scrap\",\n \"screen\",\n \"script\",\n \"scrub\",\n \"sea\",\n \"search\",\n \"season\",\n \"seat\",\n \"second\",\n \"secret\",\n \"section\",\n \"security\",\n \"seed\",\n \"seek\",\n \"segment\",\n \"select\",\n \"sell\",\n \"seminar\",\n \"senior\",\n \"sense\",\n \"sentence\",\n \"series\",\n \"service\",\n \"session\",\n \"settle\",\n \"setup\",\n \"seven\",\n \"shadow\",\n \"shaft\",\n \"shallow\",\n \"share\",\n \"shed\",\n \"shell\",\n \"sheriff\",\n \"shield\",\n \"shift\",\n \"shine\",\n \"ship\",\n \"shiver\",\n \"shock\",\n \"shoe\",\n \"shoot\",\n \"shop\",\n \"short\",\n \"shoulder\",\n \"shove\",\n \"shrimp\",\n \"shrug\",\n \"shuffle\",\n \"shy\",\n \"sibling\",\n \"sick\",\n \"side\",\n \"siege\",\n \"sight\",\n \"sign\",\n \"silent\",\n \"silk\",\n \"silly\",\n \"silver\",\n \"similar\",\n \"simple\",\n \"since\",\n \"sing\",\n \"siren\",\n \"sister\",\n \"situate\",\n \"six\",\n \"size\",\n \"skate\",\n \"sketch\",\n \"ski\",\n \"skill\",\n \"skin\",\n \"skirt\",\n \"skull\",\n \"slab\",\n \"slam\",\n \"sleep\",\n \"slender\",\n \"slice\",\n \"slide\",\n \"slight\",\n \"slim\",\n \"slogan\",\n \"slot\",\n \"slow\",\n \"slush\",\n \"small\",\n \"smart\",\n \"smile\",\n \"smoke\",\n \"smooth\",\n \"snack\",\n \"snake\",\n \"snap\",\n \"sniff\",\n \"snow\",\n \"soap\",\n \"soccer\",\n \"social\",\n \"sock\",\n \"soda\",\n \"soft\",\n \"solar\",\n \"soldier\",\n \"solid\",\n \"solution\",\n \"solve\",\n \"someone\",\n \"song\",\n \"soon\",\n \"sorry\",\n \"sort\",\n \"soul\",\n \"sound\",\n \"soup\",\n \"source\",\n \"south\",\n \"space\",\n \"spare\",\n \"spatial\",\n \"spawn\",\n \"speak\",\n \"special\",\n \"speed\",\n \"spell\",\n \"spend\",\n \"sphere\",\n \"spice\",\n \"spider\",\n \"spike\",\n \"spin\",\n \"spirit\",\n \"split\",\n \"spoil\",\n \"sponsor\",\n \"spoon\",\n \"sport\",\n \"spot\",\n \"spray\",\n \"spread\",\n \"spring\",\n \"spy\",\n \"square\",\n \"squeeze\",\n \"squirrel\",\n \"stable\",\n \"stadium\",\n \"staff\",\n \"stage\",\n \"stairs\",\n \"stamp\",\n \"stand\",\n \"start\",\n \"state\",\n \"stay\",\n \"steak\",\n \"steel\",\n \"stem\",\n \"step\",\n \"stereo\",\n \"stick\",\n \"still\",\n \"sting\",\n \"stock\",\n \"stomach\",\n \"stone\",\n \"stool\",\n \"story\",\n \"stove\",\n \"strategy\",\n \"street\",\n \"strike\",\n \"strong\",\n \"struggle\",\n \"student\",\n \"stuff\",\n \"stumble\",\n \"style\",\n \"subject\",\n \"submit\",\n \"subway\",\n \"success\",\n \"such\",\n \"sudden\",\n \"suffer\",\n \"sugar\",\n \"suggest\",\n \"suit\",\n \"summer\",\n \"sun\",\n \"sunny\",\n \"sunset\",\n \"super\",\n \"supply\",\n \"supreme\",\n \"sure\",\n \"surface\",\n \"surge\",\n \"surprise\",\n \"surround\",\n \"survey\",\n \"suspect\",\n \"sustain\",\n \"swallow\",\n \"swamp\",\n \"swap\",\n \"swarm\",\n \"swear\",\n \"sweet\",\n \"swift\",\n \"swim\",\n \"swing\",\n \"switch\",\n \"sword\",\n \"symbol\",\n \"symptom\",\n \"syrup\",\n \"system\",\n \"table\",\n \"tackle\",\n \"tag\",\n \"tail\",\n \"talent\",\n \"talk\",\n \"tank\",\n \"tape\",\n \"target\",\n \"task\",\n \"taste\",\n \"tattoo\",\n \"taxi\",\n \"teach\",\n \"team\",\n \"tell\",\n \"ten\",\n \"tenant\",\n \"tennis\",\n \"tent\",\n \"term\",\n \"test\",\n \"text\",\n \"thank\",\n \"that\",\n \"theme\",\n \"then\",\n \"theory\",\n \"there\",\n \"they\",\n \"thing\",\n \"this\",\n \"thought\",\n \"three\",\n \"thrive\",\n \"throw\",\n \"thumb\",\n \"thunder\",\n \"ticket\",\n \"tide\",\n \"tiger\",\n \"tilt\",\n \"timber\",\n \"time\",\n \"tiny\",\n \"tip\",\n \"tired\",\n \"tissue\",\n \"title\",\n \"toast\",\n \"tobacco\",\n \"today\",\n \"toddler\",\n \"toe\",\n \"together\",\n \"toilet\",\n \"token\",\n \"tomato\",\n \"tomorrow\",\n \"tone\",\n \"tongue\",\n \"tonight\",\n \"tool\",\n \"tooth\",\n \"top\",\n \"topic\",\n \"topple\",\n \"torch\",\n \"tornado\",\n \"tortoise\",\n \"toss\",\n \"total\",\n \"tourist\",\n \"toward\",\n \"tower\",\n \"town\",\n \"toy\",\n \"track\",\n \"trade\",\n \"traffic\",\n \"tragic\",\n \"train\",\n \"transfer\",\n \"trap\",\n \"trash\",\n \"travel\",\n \"tray\",\n \"treat\",\n \"tree\",\n \"trend\",\n \"trial\",\n \"tribe\",\n \"trick\",\n \"trigger\",\n \"trim\",\n \"trip\",\n \"trophy\",\n \"trouble\",\n \"truck\",\n \"true\",\n \"truly\",\n \"trumpet\",\n \"trust\",\n \"truth\",\n \"try\",\n \"tube\",\n \"tuition\",\n \"tumble\",\n \"tuna\",\n \"tunnel\",\n \"turkey\",\n \"turn\",\n \"turtle\",\n \"twelve\",\n \"twenty\",\n \"twice\",\n \"twin\",\n \"twist\",\n \"two\",\n \"type\",\n \"typical\",\n \"ugly\",\n \"umbrella\",\n \"unable\",\n \"unaware\",\n \"uncle\",\n \"uncover\",\n \"under\",\n \"undo\",\n \"unfair\",\n \"unfold\",\n \"unhappy\",\n \"uniform\",\n \"unique\",\n \"unit\",\n \"universe\",\n \"unknown\",\n \"unlock\",\n \"until\",\n \"unusual\",\n \"unveil\",\n \"update\",\n \"upgrade\",\n \"uphold\",\n \"upon\",\n \"upper\",\n \"upset\",\n \"urban\",\n \"urge\",\n \"usage\",\n \"use\",\n \"used\",\n \"useful\",\n \"useless\",\n \"usual\",\n \"utility\",\n \"vacant\",\n \"vacuum\",\n \"vague\",\n \"valid\",\n \"valley\",\n \"valve\",\n \"van\",\n \"vanish\",\n \"vapor\",\n \"various\",\n \"vast\",\n \"vault\",\n \"vehicle\",\n \"velvet\",\n \"vendor\",\n \"venture\",\n \"venue\",\n \"verb\",\n \"verify\",\n \"version\",\n \"very\",\n \"vessel\",\n \"veteran\",\n \"viable\",\n \"vibrant\",\n \"vicious\",\n \"victory\",\n \"video\",\n \"view\",\n \"village\",\n \"vintage\",\n \"violin\",\n \"virtual\",\n \"virus\",\n \"visa\",\n \"visit\",\n \"visual\",\n \"vital\",\n \"vivid\",\n \"vocal\",\n \"voice\",\n \"void\",\n \"volcano\",\n \"volume\",\n \"vote\",\n \"voyage\",\n \"wage\",\n \"wagon\",\n \"wait\",\n \"walk\",\n \"wall\",\n \"walnut\",\n \"want\",\n \"warfare\",\n \"warm\",\n \"warrior\",\n \"wash\",\n \"wasp\",\n \"waste\",\n \"water\",\n \"wave\",\n \"way\",\n \"wealth\",\n \"weapon\",\n \"wear\",\n \"weasel\",\n \"weather\",\n \"web\",\n \"wedding\",\n \"weekend\",\n \"weird\",\n \"welcome\",\n \"west\",\n \"wet\",\n \"whale\",\n \"what\",\n \"wheat\",\n \"wheel\",\n \"when\",\n \"where\",\n \"whip\",\n \"whisper\",\n \"wide\",\n \"width\",\n \"wife\",\n \"wild\",\n \"will\",\n \"win\",\n \"window\",\n \"wine\",\n \"wing\",\n \"wink\",\n \"winner\",\n \"winter\",\n \"wire\",\n \"wisdom\",\n \"wise\",\n \"wish\",\n \"witness\",\n \"wolf\",\n \"woman\",\n \"wonder\",\n \"wood\",\n \"wool\",\n \"word\",\n \"work\",\n \"world\",\n \"worry\",\n \"worth\",\n \"wrap\",\n \"wreck\",\n \"wrestle\",\n \"wrist\",\n \"write\",\n \"wrong\",\n \"yard\",\n \"year\",\n \"yellow\",\n \"you\",\n \"young\",\n \"youth\",\n \"zebra\",\n \"zero\",\n \"zone\",\n \"zoo\",\n]);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/words/bip39.js?"); +/** + * @typedef {object} ProtoSignaturePair + * @property {(Uint8Array | null)=} pubKeyPrefix + * @property {(Uint8Array | null)=} ed25519 + */ + +/** + * @typedef {object} ProtoSigMap + * @property {(ProtoSignaturePair[] | null)=} sigPair + */ + +/** + * @typedef {object} ProtoSignedTransaction + * @property {(Uint8Array | null)=} bodyBytes + * @property {(ProtoSigMap | null)=} sigMap + */ + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IScheduleSignTransactionBody} HashgraphProto.proto.IScheduleSignTransactionBody + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.ISignatureMap} HashgraphProto.proto.ISignatureMap + */ + +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("@hashgraph/cryptography").Key} Key + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../Timestamp.js").default} Timestamp + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("@hashgraph/cryptography").PublicKey} PublicKey + */ + +/** + * Create a new Hedera™ crypto-currency account. + */ +class ScheduleSignTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {ScheduleId | string} [props.scheduleId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?ScheduleId} + */ + this._scheduleId = null; + + if (props.scheduleId != null) { + this.setScheduleId(props.scheduleId); + } + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {ScheduleSignTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const sign = + /** @type {HashgraphProto.proto.IScheduleSignTransactionBody} */ ( + body.scheduleSign + ); + + return Transaction_Transaction._fromProtobufTransactions( + new ScheduleSignTransaction({ + scheduleId: + sign.scheduleID != null + ? ScheduleId._fromProtobuf(sign.scheduleID) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?ScheduleId} + */ + get scheduleId() { + return this._scheduleId; + } + + /** + * @param {ScheduleId | string} scheduleId + * @returns {this} + */ + setScheduleId(scheduleId) { + this._requireNotFrozen(); + this._scheduleId = + typeof scheduleId === "string" + ? ScheduleId.fromString(scheduleId) + : scheduleId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._scheduleId != null) { + this._scheduleId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.schedule.signSchedule(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "scheduleSign"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IScheduleSignTransactionBody} + */ + _makeTransactionData() { + return { + scheduleID: + this._scheduleId != null + ? this._scheduleId._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `ScheduleSignTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "scheduleSign", + // eslint-disable-next-line @typescript-eslint/unbound-method + ScheduleSignTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Signer.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +/** + * @typedef {import("./LedgerId.js").default} LedgerId + * @typedef {import("./SignerSignature.js").default} SignerSignature + * @typedef {import("./transaction/TransactionId.js").default} TransactionId + * @typedef {import("./transaction/Transaction.js").default} Transaction + * @typedef {import("./transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("./transaction/TransactionReceipt.js").default} TransactionReceipt + * @typedef {import("./transaction/TransactionRecord.js").default} TransactionRecord + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./account/AccountBalance.js").default} AccountBalance + * @typedef {import("./account/AccountInfo.js").default} AccountInfo + * @typedef {import("./Key.js").default} Key + */ + +/** + * @template {any} O + * @typedef {import("./query/Query.js").default} Query + */ + +/** + * @template RequestT + * @template ResponseT + * @template OutputT + * @typedef {import("./Executable.js").default} Executable + */ + +/** + * @typedef {object} Signer + * @property {() => LedgerId?} getLedgerId + * @property {() => AccountId} getAccountId + * @property {() => Key} [getAccountKey] + * @property {() => {[key: string]: (string | AccountId)}} getNetwork + * @property {() => string[]} getMirrorNetwork + * @property {(messages: Uint8Array[]) => Promise} sign + * @property {() => Promise} getAccountBalance + * @property {() => Promise} getAccountInfo + * @property {() => Promise} getAccountRecords + * @property {(transaction: T) => Promise} signTransaction + * @property {(transaction: T) => Promise} checkTransaction + * @property {(transaction: T) => Promise} populateTransaction + * @property {(request: Executable) => Promise} call + */ + +/* harmony default export */ var Signer = ({}); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/system/SystemDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/cryptography/src/words/legacy.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/cryptography/src/words/legacy.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = ([\n \"aback\",\n \"abbey\",\n \"abbot\",\n \"abide\",\n \"ablaze\",\n \"able\",\n \"aboard\",\n \"abode\",\n \"abort\",\n \"abound\",\n \"about\",\n \"above\",\n \"abroad\",\n \"abrupt\",\n \"absent\",\n \"absorb\",\n \"absurd\",\n \"abuse\",\n \"accent\",\n \"accept\",\n \"access\",\n \"accord\",\n \"accuse\",\n \"ace\",\n \"ache\",\n \"aching\",\n \"acid\",\n \"acidic\",\n \"acorn\",\n \"acre\",\n \"across\",\n \"act\",\n \"action\",\n \"active\",\n \"actor\",\n \"actual\",\n \"acute\",\n \"adam\",\n \"adapt\",\n \"add\",\n \"added\",\n \"addict\",\n \"adept\",\n \"adhere\",\n \"adjust\",\n \"admire\",\n \"admit\",\n \"adobe\",\n \"adopt\",\n \"adrift\",\n \"adult\",\n \"adverb\",\n \"advice\",\n \"aerial\",\n \"afar\",\n \"affair\",\n \"affect\",\n \"afford\",\n \"afghan\",\n \"afield\",\n \"afloat\",\n \"afraid\",\n \"afresh\",\n \"after\",\n \"again\",\n \"age\",\n \"agency\",\n \"agenda\",\n \"agent\",\n \"aghast\",\n \"agile\",\n \"ago\",\n \"agony\",\n \"agree\",\n \"agreed\",\n \"ahead\",\n \"aid\",\n \"aide\",\n \"aim\",\n \"air\",\n \"airman\",\n \"airy\",\n \"akin\",\n \"alarm\",\n \"alaska\",\n \"albeit\",\n \"album\",\n \"ale\",\n \"alert\",\n \"alibi\",\n \"alice\",\n \"alien\",\n \"alight\",\n \"align\",\n \"alike\",\n \"alive\",\n \"alkali\",\n \"all\",\n \"alley\",\n \"allied\",\n \"allow\",\n \"alloy\",\n \"ally\",\n \"almond\",\n \"almost\",\n \"aloft\",\n \"alone\",\n \"along\",\n \"aloof\",\n \"aloud\",\n \"alpha\",\n \"alpine\",\n \"also\",\n \"altar\",\n \"alter\",\n \"always\",\n \"amaze\",\n \"amazon\",\n \"amber\",\n \"ambush\",\n \"amen\",\n \"amend\",\n \"amid\",\n \"amidst\",\n \"amiss\",\n \"among\",\n \"amount\",\n \"ample\",\n \"amuse\",\n \"anchor\",\n \"and\",\n \"andrew\",\n \"anew\",\n \"angel\",\n \"anger\",\n \"angle\",\n \"angry\",\n \"animal\",\n \"ankle\",\n \"annoy\",\n \"annual\",\n \"answer\",\n \"anthem\",\n \"any\",\n \"anyhow\",\n \"anyway\",\n \"apart\",\n \"apathy\",\n \"apex\",\n \"apiece\",\n \"appeal\",\n \"appear\",\n \"apple\",\n \"apply\",\n \"april\",\n \"apron\",\n \"arab\",\n \"arcade\",\n \"arcane\",\n \"arch\",\n \"arctic\",\n \"ardent\",\n \"are\",\n \"area\",\n \"argue\",\n \"arid\",\n \"arise\",\n \"ark\",\n \"arm\",\n \"armful\",\n \"army\",\n \"aroma\",\n \"around\",\n \"arouse\",\n \"array\",\n \"arrest\",\n \"arrive\",\n \"arrow\",\n \"arson\",\n \"art\",\n \"artery\",\n \"artful\",\n \"artist\",\n \"ascent\",\n \"ash\",\n \"ashen\",\n \"ashore\",\n \"aside\",\n \"ask\",\n \"asleep\",\n \"aspect\",\n \"assay\",\n \"assent\",\n \"assert\",\n \"assess\",\n \"asset\",\n \"assign\",\n \"assist\",\n \"assume\",\n \"assure\",\n \"asthma\",\n \"astute\",\n \"asylum\",\n \"ate\",\n \"athens\",\n \"atlas\",\n \"atom\",\n \"atomic\",\n \"attach\",\n \"attack\",\n \"attain\",\n \"attend\",\n \"attic\",\n \"auburn\",\n \"audio\",\n \"audit\",\n \"august\",\n \"aunt\",\n \"auntie\",\n \"aura\",\n \"austin\",\n \"author\",\n \"auto\",\n \"autumn\",\n \"avail\",\n \"avenge\",\n \"avenue\",\n \"avert\",\n \"avid\",\n \"avoid\",\n \"await\",\n \"awake\",\n \"awaken\",\n \"award\",\n \"aware\",\n \"awash\",\n \"away\",\n \"awful\",\n \"awhile\",\n \"axe\",\n \"axes\",\n \"axiom\",\n \"axis\",\n \"axle\",\n \"aye\",\n \"babe\",\n \"baby\",\n \"bach\",\n \"back\",\n \"backup\",\n \"bacon\",\n \"bad\",\n \"badge\",\n \"badly\",\n \"bag\",\n \"baggy\",\n \"bail\",\n \"bait\",\n \"bake\",\n \"baker\",\n \"bakery\",\n \"bald\",\n \"ball\",\n \"ballad\",\n \"ballet\",\n \"ballot\",\n \"baltic\",\n \"bamboo\",\n \"ban\",\n \"banal\",\n \"banana\",\n \"band\",\n \"bang\",\n \"bank\",\n \"bar\",\n \"barber\",\n \"bare\",\n \"barely\",\n \"barge\",\n \"bark\",\n \"barley\",\n \"barn\",\n \"baron\",\n \"barrel\",\n \"barren\",\n \"basalt\",\n \"base\",\n \"basic\",\n \"basil\",\n \"basin\",\n \"basis\",\n \"basket\",\n \"bass\",\n \"bat\",\n \"batch\",\n \"bath\",\n \"baton\",\n \"battle\",\n \"bay\",\n \"beach\",\n \"beacon\",\n \"beak\",\n \"beam\",\n \"bean\",\n \"bear\",\n \"beard\",\n \"beast\",\n \"beat\",\n \"beauty\",\n \"become\",\n \"bed\",\n \"beech\",\n \"beef\",\n \"beefy\",\n \"beep\",\n \"beer\",\n \"beet\",\n \"beetle\",\n \"before\",\n \"beg\",\n \"beggar\",\n \"begin\",\n \"behalf\",\n \"behave\",\n \"behind\",\n \"beige\",\n \"being\",\n \"belief\",\n \"bell\",\n \"belly\",\n \"belong\",\n \"below\",\n \"belt\",\n \"bench\",\n \"bend\",\n \"benign\",\n \"bent\",\n \"berlin\",\n \"berry\",\n \"berth\",\n \"beset\",\n \"beside\",\n \"best\",\n \"bestow\",\n \"bet\",\n \"beta\",\n \"betray\",\n \"better\",\n \"beware\",\n \"beyond\",\n \"bias\",\n \"biceps\",\n \"bicker\",\n \"bid\",\n \"big\",\n \"bigger\",\n \"bike\",\n \"bile\",\n \"bill\",\n \"bin\",\n \"binary\",\n \"bind\",\n \"biopsy\",\n \"birch\",\n \"bird\",\n \"birdie\",\n \"birth\",\n \"bishop\",\n \"bit\",\n \"bitch\",\n \"bite\",\n \"bitter\",\n \"black\",\n \"blade\",\n \"blame\",\n \"bland\",\n \"blast\",\n \"blaze\",\n \"bleak\",\n \"blend\",\n \"bless\",\n \"blew\",\n \"blind\",\n \"blink\",\n \"blip\",\n \"bliss\",\n \"blitz\",\n \"block\",\n \"blond\",\n \"blood\",\n \"bloody\",\n \"bloom\",\n \"blot\",\n \"blouse\",\n \"blow\",\n \"blue\",\n \"bluff\",\n \"blunt\",\n \"blur\",\n \"blush\",\n \"boar\",\n \"board\",\n \"boast\",\n \"boat\",\n \"bob\",\n \"bodily\",\n \"body\",\n \"bogus\",\n \"boil\",\n \"bold\",\n \"bolt\",\n \"bomb\",\n \"bombay\",\n \"bond\",\n \"bone\",\n \"bonn\",\n \"bonnet\",\n \"bonus\",\n \"bony\",\n \"book\",\n \"boom\",\n \"boost\",\n \"boot\",\n \"booth\",\n \"booze\",\n \"border\",\n \"bore\",\n \"borrow\",\n \"bosom\",\n \"boss\",\n \"boston\",\n \"both\",\n \"bother\",\n \"bottle\",\n \"bottom\",\n \"bought\",\n \"bounce\",\n \"bound\",\n \"bounty\",\n \"bout\",\n \"bovine\",\n \"bow\",\n \"bowel\",\n \"bowl\",\n \"box\",\n \"boy\",\n \"boyish\",\n \"brace\",\n \"brain\",\n \"brainy\",\n \"brake\",\n \"bran\",\n \"branch\",\n \"brand\",\n \"brandy\",\n \"brass\",\n \"brave\",\n \"bravo\",\n \"brazil\",\n \"breach\",\n \"bread\",\n \"break\",\n \"breast\",\n \"breath\",\n \"bred\",\n \"breed\",\n \"breeze\",\n \"brew\",\n \"bribe\",\n \"brick\",\n \"bride\",\n \"bridge\",\n \"brief\",\n \"bright\",\n \"brim\",\n \"brine\",\n \"bring\",\n \"brink\",\n \"brisk\",\n \"broad\",\n \"broke\",\n \"broken\",\n \"bronze\",\n \"brook\",\n \"broom\",\n \"brown\",\n \"bruise\",\n \"brush\",\n \"brutal\",\n \"brute\",\n \"bubble\",\n \"buck\",\n \"bucket\",\n \"buckle\",\n \"budget\",\n \"buffet\",\n \"buggy\",\n \"build\",\n \"bulb\",\n \"bulge\",\n \"bulk\",\n \"bulky\",\n \"bull\",\n \"bullet\",\n \"bully\",\n \"bump\",\n \"bumpy\",\n \"bunch\",\n \"bundle\",\n \"bunk\",\n \"bunny\",\n \"burden\",\n \"bureau\",\n \"burial\",\n \"buried\",\n \"burly\",\n \"burn\",\n \"burnt\",\n \"burrow\",\n \"burst\",\n \"bury\",\n \"bus\",\n \"bush\",\n \"bust\",\n \"bustle\",\n \"busy\",\n \"but\",\n \"butler\",\n \"butt\",\n \"butter\",\n \"button\",\n \"buy\",\n \"buyer\",\n \"buzz\",\n \"bye\",\n \"byte\",\n \"cab\",\n \"cabin\",\n \"cable\",\n \"cache\",\n \"cactus\",\n \"caesar\",\n \"cage\",\n \"cairo\",\n \"cajun\",\n \"cajole\",\n \"cake\",\n \"calf\",\n \"call\",\n \"caller\",\n \"calm\",\n \"calmly\",\n \"came\",\n \"camel\",\n \"camera\",\n \"camp\",\n \"campus\",\n \"can\",\n \"canada\",\n \"canal\",\n \"canary\",\n \"cancel\",\n \"cancer\",\n \"candid\",\n \"candle\",\n \"candy\",\n \"cane\",\n \"canine\",\n \"canoe\",\n \"canopy\",\n \"canvas\",\n \"canyon\",\n \"cap\",\n \"cape\",\n \"car\",\n \"carbon\",\n \"card\",\n \"care\",\n \"career\",\n \"caress\",\n \"cargo\",\n \"carl\",\n \"carnal\",\n \"carol\",\n \"carp\",\n \"carpet\",\n \"carrot\",\n \"carry\",\n \"cart\",\n \"cartel\",\n \"case\",\n \"cash\",\n \"cask\",\n \"cast\",\n \"castle\",\n \"casual\",\n \"cat\",\n \"catch\",\n \"cater\",\n \"cattle\",\n \"caught\",\n \"causal\",\n \"cause\",\n \"cave\",\n \"cease\",\n \"celery\",\n \"cell\",\n \"cellar\",\n \"celtic\",\n \"cement\",\n \"censor\",\n \"census\",\n \"cent\",\n \"cereal\",\n \"chain\",\n \"chair\",\n \"chalk\",\n \"chalky\",\n \"champ\",\n \"chance\",\n \"change\",\n \"chant\",\n \"chaos\",\n \"chap\",\n \"chapel\",\n \"charge\",\n \"charm\",\n \"chart\",\n \"chase\",\n \"chat\",\n \"cheap\",\n \"cheat\",\n \"check\",\n \"cheek\",\n \"cheeky\",\n \"cheer\",\n \"cheery\",\n \"cheese\",\n \"chef\",\n \"cheque\",\n \"cherry\",\n \"chess\",\n \"chest\",\n \"chew\",\n \"chic\",\n \"chick\",\n \"chief\",\n \"child\",\n \"chile\",\n \"chill\",\n \"chilly\",\n \"chin\",\n \"china\",\n \"chip\",\n \"choice\",\n \"choir\",\n \"choose\",\n \"chop\",\n \"choppy\",\n \"chord\",\n \"chorus\",\n \"chose\",\n \"chosen\",\n \"chris\",\n \"chrome\",\n \"chunk\",\n \"chunky\",\n \"church\",\n \"cider\",\n \"cigar\",\n \"cinema\",\n \"circa\",\n \"circle\",\n \"circus\",\n \"cite\",\n \"city\",\n \"civic\",\n \"civil\",\n \"clad\",\n \"claim\",\n \"clammy\",\n \"clan\",\n \"clap\",\n \"clash\",\n \"clasp\",\n \"class\",\n \"clause\",\n \"claw\",\n \"clay\",\n \"clean\",\n \"clear\",\n \"clergy\",\n \"clerk\",\n \"clever\",\n \"click\",\n \"client\",\n \"cliff\",\n \"climax\",\n \"climb\",\n \"clinch\",\n \"cling\",\n \"clinic\",\n \"clip\",\n \"cloak\",\n \"clock\",\n \"clone\",\n \"close\",\n \"closer\",\n \"closet\",\n \"cloth\",\n \"cloud\",\n \"cloudy\",\n \"clout\",\n \"clown\",\n \"club\",\n \"clue\",\n \"clumsy\",\n \"clung\",\n \"clutch\",\n \"coach\",\n \"coal\",\n \"coarse\",\n \"coast\",\n \"coat\",\n \"coax\",\n \"cobalt\",\n \"cobra\",\n \"coca\",\n \"cock\",\n \"cocoa\",\n \"code\",\n \"coffee\",\n \"coffin\",\n \"cohort\",\n \"coil\",\n \"coin\",\n \"coke\",\n \"cold\",\n \"collar\",\n \"colon\",\n \"colony\",\n \"colt\",\n \"column\",\n \"comb\",\n \"combat\",\n \"come\",\n \"comedy\",\n \"comic\",\n \"commit\",\n \"common\",\n \"compel\",\n \"comply\",\n \"concur\",\n \"cone\",\n \"confer\",\n \"congo\",\n \"consul\",\n \"convex\",\n \"convey\",\n \"convoy\",\n \"cook\",\n \"cool\",\n \"cope\",\n \"copper\",\n \"copy\",\n \"coral\",\n \"cord\",\n \"core\",\n \"cork\",\n \"corn\",\n \"corner\",\n \"corps\",\n \"corpse\",\n \"corpus\",\n \"cortex\",\n \"cosmic\",\n \"cosmos\",\n \"cost\",\n \"costly\",\n \"cotton\",\n \"couch\",\n \"cough\",\n \"could\",\n \"count\",\n \"county\",\n \"coup\",\n \"couple\",\n \"coupon\",\n \"course\",\n \"court\",\n \"cousin\",\n \"cove\",\n \"cover\",\n \"covert\",\n \"cow\",\n \"coward\",\n \"cowboy\",\n \"cozy\",\n \"crab\",\n \"crack\",\n \"cradle\",\n \"craft\",\n \"crafty\",\n \"crag\",\n \"crane\",\n \"crash\",\n \"crate\",\n \"crater\",\n \"crawl\",\n \"crazy\",\n \"creak\",\n \"cream\",\n \"creamy\",\n \"create\",\n \"credit\",\n \"creed\",\n \"creek\",\n \"creep\",\n \"creepy\",\n \"crept\",\n \"crest\",\n \"crew\",\n \"cried\",\n \"crime\",\n \"crisis\",\n \"crisp\",\n \"critic\",\n \"crook\",\n \"crop\",\n \"cross\",\n \"crow\",\n \"crowd\",\n \"crown\",\n \"crude\",\n \"cruel\",\n \"cruise\",\n \"crunch\",\n \"crush\",\n \"crust\",\n \"crux\",\n \"cry\",\n \"crypt\",\n \"cuba\",\n \"cube\",\n \"cubic\",\n \"cuckoo\",\n \"cuff\",\n \"cult\",\n \"cup\",\n \"curb\",\n \"cure\",\n \"curfew\",\n \"curl\",\n \"curry\",\n \"curse\",\n \"cursor\",\n \"curve\",\n \"cuss\",\n \"custom\",\n \"cut\",\n \"cute\",\n \"cycle\",\n \"cyclic\",\n \"cynic\",\n \"czech\",\n \"dad\",\n \"daddy\",\n \"dagger\",\n \"daily\",\n \"dairy\",\n \"daisy\",\n \"dale\",\n \"dam\",\n \"damage\",\n \"damp\",\n \"dampen\",\n \"dance\",\n \"danger\",\n \"danish\",\n \"dare\",\n \"dark\",\n \"darken\",\n \"darn\",\n \"dart\",\n \"dash\",\n \"data\",\n \"date\",\n \"david\",\n \"dawn\",\n \"day\",\n \"dead\",\n \"deadly\",\n \"deaf\",\n \"deal\",\n \"dealer\",\n \"dean\",\n \"dear\",\n \"death\",\n \"debate\",\n \"debit\",\n \"debris\",\n \"debt\",\n \"debtor\",\n \"decade\",\n \"decay\",\n \"decent\",\n \"decide\",\n \"deck\",\n \"decor\",\n \"decree\",\n \"deduce\",\n \"deed\",\n \"deep\",\n \"deeply\",\n \"deer\",\n \"defeat\",\n \"defect\",\n \"defend\",\n \"defer\",\n \"define\",\n \"defy\",\n \"degree\",\n \"deity\",\n \"delay\",\n \"delete\",\n \"delhi\",\n \"delta\",\n \"demand\",\n \"demise\",\n \"demo\",\n \"demure\",\n \"denial\",\n \"denote\",\n \"dense\",\n \"dental\",\n \"deny\",\n \"depart\",\n \"depend\",\n \"depict\",\n \"deploy\",\n \"depot\",\n \"depth\",\n \"deputy\",\n \"derive\",\n \"desert\",\n \"design\",\n \"desire\",\n \"desist\",\n \"desk\",\n \"detail\",\n \"detect\",\n \"deter\",\n \"detest\",\n \"detour\",\n \"device\",\n \"devise\",\n \"devoid\",\n \"devote\",\n \"devour\",\n \"dial\",\n \"diana\",\n \"diary\",\n \"dice\",\n \"dictum\",\n \"did\",\n \"die\",\n \"diesel\",\n \"diet\",\n \"differ\",\n \"dig\",\n \"digest\",\n \"digit\",\n \"dine\",\n \"dinghy\",\n \"dinner\",\n \"diode\",\n \"dip\",\n \"dire\",\n \"direct\",\n \"dirt\",\n \"dirty\",\n \"disc\",\n \"disco\",\n \"dish\",\n \"disk\",\n \"dismal\",\n \"dispel\",\n \"ditch\",\n \"dive\",\n \"divert\",\n \"divide\",\n \"divine\",\n \"dizzy\",\n \"docile\",\n \"dock\",\n \"doctor\",\n \"dog\",\n \"dogma\",\n \"dole\",\n \"doll\",\n \"dollar\",\n \"dolly\",\n \"domain\",\n \"dome\",\n \"domino\",\n \"donate\",\n \"done\",\n \"donkey\",\n \"donor\",\n \"doom\",\n \"door\",\n \"dorsal\",\n \"dose\",\n \"dot\",\n \"double\",\n \"doubt\",\n \"dough\",\n \"dour\",\n \"dove\",\n \"down\",\n \"dozen\",\n \"draft\",\n \"drag\",\n \"dragon\",\n \"drain\",\n \"drama\",\n \"drank\",\n \"draw\",\n \"drawer\",\n \"dread\",\n \"dream\",\n \"dreary\",\n \"dress\",\n \"drew\",\n \"dried\",\n \"drift\",\n \"drill\",\n \"drink\",\n \"drip\",\n \"drive\",\n \"driver\",\n \"drop\",\n \"drove\",\n \"drown\",\n \"drug\",\n \"drum\",\n \"drunk\",\n \"dry\",\n \"dual\",\n \"duck\",\n \"duct\",\n \"due\",\n \"duel\",\n \"duet\",\n \"duke\",\n \"dull\",\n \"duly\",\n \"dumb\",\n \"dummy\",\n \"dump\",\n \"dune\",\n \"dung\",\n \"duress\",\n \"during\",\n \"dusk\",\n \"dust\",\n \"dusty\",\n \"dutch\",\n \"duty\",\n \"dwarf\",\n \"dwell\",\n \"dyer\",\n \"dying\",\n \"dynamo\",\n \"each\",\n \"eager\",\n \"eagle\",\n \"ear\",\n \"earl\",\n \"early\",\n \"earn\",\n \"earth\",\n \"ease\",\n \"easel\",\n \"easily\",\n \"east\",\n \"easter\",\n \"easy\",\n \"eat\",\n \"eaten\",\n \"eater\",\n \"echo\",\n \"eddy\",\n \"eden\",\n \"edge\",\n \"edible\",\n \"edict\",\n \"edit\",\n \"editor\",\n \"eel\",\n \"eerie\",\n \"eerily\",\n \"effect\",\n \"effort\",\n \"egg\",\n \"ego\",\n \"eight\",\n \"eighth\",\n \"eighty\",\n \"either\",\n \"elbow\",\n \"elder\",\n \"eldest\",\n \"elect\",\n \"eleven\",\n \"elicit\",\n \"elite\",\n \"else\",\n \"elude\",\n \"elves\",\n \"embark\",\n \"emblem\",\n \"embryo\",\n \"emerge\",\n \"emit\",\n \"empire\",\n \"employ\",\n \"empty\",\n \"enable\",\n \"enamel\",\n \"end\",\n \"endure\",\n \"enemy\",\n \"energy\",\n \"engage\",\n \"engine\",\n \"enjoy\",\n \"enlist\",\n \"enough\",\n \"ensure\",\n \"entail\",\n \"enter\",\n \"entire\",\n \"entry\",\n \"envoy\",\n \"envy\",\n \"enzyme\",\n \"epic\",\n \"epoch\",\n \"equal\",\n \"equate\",\n \"equip\",\n \"equity\",\n \"era\",\n \"erect\",\n \"eric\",\n \"erode\",\n \"erotic\",\n \"errant\",\n \"error\",\n \"escape\",\n \"escort\",\n \"essay\",\n \"essex\",\n \"estate\",\n \"esteem\",\n \"ethic\",\n \"ethnic\",\n \"europe\",\n \"evade\",\n \"eve\",\n \"even\",\n \"event\",\n \"ever\",\n \"every\",\n \"evict\",\n \"evil\",\n \"evoke\",\n \"evolve\",\n \"exact\",\n \"exam\",\n \"exceed\",\n \"excel\",\n \"except\",\n \"excess\",\n \"excise\",\n \"excite\",\n \"excuse\",\n \"exempt\",\n \"exert\",\n \"exile\",\n \"exist\",\n \"exit\",\n \"exodus\",\n \"exotic\",\n \"expand\",\n \"expect\",\n \"expert\",\n \"expire\",\n \"export\",\n \"expose\",\n \"extend\",\n \"extra\",\n \"eye\",\n \"eyed\",\n \"fabric\",\n \"face\",\n \"facial\",\n \"fact\",\n \"factor\",\n \"fade\",\n \"fail\",\n \"faint\",\n \"fair\",\n \"fairly\",\n \"fairy\",\n \"faith\",\n \"fake\",\n \"falcon\",\n \"fall\",\n \"false\",\n \"falter\",\n \"fame\",\n \"family\",\n \"famine\",\n \"famous\",\n \"fan\",\n \"fancy\",\n \"far\",\n \"farce\",\n \"fare\",\n \"farm\",\n \"farmer\",\n \"fast\",\n \"fasten\",\n \"faster\",\n \"fat\",\n \"fatal\",\n \"fate\",\n \"father\",\n \"fatty\",\n \"fault\",\n \"faulty\",\n \"fauna\",\n \"fear\",\n \"feast\",\n \"feat\",\n \"fed\",\n \"fee\",\n \"feeble\",\n \"feed\",\n \"feel\",\n \"feet\",\n \"fell\",\n \"fellow\",\n \"felt\",\n \"female\",\n \"fence\",\n \"fend\",\n \"ferry\",\n \"fetal\",\n \"fetch\",\n \"feudal\",\n \"fever\",\n \"few\",\n \"fewer\",\n \"fiasco\",\n \"fiddle\",\n \"field\",\n \"fiend\",\n \"fierce\",\n \"fiery\",\n \"fifth\",\n \"fifty\",\n \"fig\",\n \"fight\",\n \"figure\",\n \"file\",\n \"fill\",\n \"filled\",\n \"filler\",\n \"film\",\n \"filter\",\n \"filth\",\n \"filthy\",\n \"final\",\n \"finale\",\n \"find\",\n \"fine\",\n \"finery\",\n \"finger\",\n \"finish\",\n \"finite\",\n \"fire\",\n \"firm\",\n \"firmly\",\n \"first\",\n \"fiscal\",\n \"fish\",\n \"fisher\",\n \"fist\",\n \"fit\",\n \"fitful\",\n \"five\",\n \"fix\",\n \"flag\",\n \"flair\",\n \"flak\",\n \"flame\",\n \"flank\",\n \"flap\",\n \"flare\",\n \"flash\",\n \"flask\",\n \"flat\",\n \"flavor\",\n \"flaw\",\n \"fled\",\n \"flee\",\n \"fleece\",\n \"fleet\",\n \"flesh\",\n \"fleshy\",\n \"flew\",\n \"flick\",\n \"flight\",\n \"flimsy\",\n \"flint\",\n \"flirt\",\n \"float\",\n \"flock\",\n \"flood\",\n \"floor\",\n \"floppy\",\n \"flora\",\n \"floral\",\n \"flour\",\n \"flow\",\n \"flower\",\n \"fluent\",\n \"fluffy\",\n \"fluid\",\n \"flung\",\n \"flurry\",\n \"flush\",\n \"flute\",\n \"flux\",\n \"fly\",\n \"flyer\",\n \"foal\",\n \"foam\",\n \"focal\",\n \"focus\",\n \"fog\",\n \"foil\",\n \"fold\",\n \"folk\",\n \"follow\",\n \"folly\",\n \"fond\",\n \"fondly\",\n \"font\",\n \"food\",\n \"fool\",\n \"foot\",\n \"for\",\n \"forbid\",\n \"force\",\n \"ford\",\n \"forest\",\n \"forge\",\n \"forget\",\n \"fork\",\n \"form\",\n \"formal\",\n \"format\",\n \"former\",\n \"fort\",\n \"forth\",\n \"forty\",\n \"forum\",\n \"fossil\",\n \"foster\",\n \"foul\",\n \"found\",\n \"four\",\n \"fourth\",\n \"fox\",\n \"foyer\",\n \"frail\",\n \"frame\",\n \"franc\",\n \"france\",\n \"frank\",\n \"fraud\",\n \"fred\",\n \"free\",\n \"freed\",\n \"freely\",\n \"freeze\",\n \"french\",\n \"frenzy\",\n \"fresh\",\n \"friar\",\n \"friday\",\n \"fridge\",\n \"fried\",\n \"friend\",\n \"fright\",\n \"fringe\",\n \"frock\",\n \"frog\",\n \"from\",\n \"front\",\n \"frost\",\n \"frosty\",\n \"frown\",\n \"frozen\",\n \"frugal\",\n \"fruit\",\n \"fry\",\n \"fudge\",\n \"fuel\",\n \"full\",\n \"fully\",\n \"fumes\",\n \"fun\",\n \"fund\",\n \"funny\",\n \"fur\",\n \"furry\",\n \"fury\",\n \"fuse\",\n \"fusion\",\n \"fuss\",\n \"fussy\",\n \"futile\",\n \"future\",\n \"fuzzy\",\n \"gadget\",\n \"gain\",\n \"gala\",\n \"galaxy\",\n \"gale\",\n \"gall\",\n \"galley\",\n \"gallon\",\n \"gallop\",\n \"gamble\",\n \"game\",\n \"gamma\",\n \"gandhi\",\n \"gang\",\n \"gap\",\n \"garage\",\n \"garden\",\n \"garlic\",\n \"gas\",\n \"gasp\",\n \"gate\",\n \"gather\",\n \"gauge\",\n \"gaunt\",\n \"gave\",\n \"gaze\",\n \"gear\",\n \"geese\",\n \"gem\",\n \"gemini\",\n \"gender\",\n \"gene\",\n \"geneva\",\n \"genial\",\n \"genius\",\n \"genre\",\n \"gentle\",\n \"gently\",\n \"gentry\",\n \"genus\",\n \"george\",\n \"germ\",\n \"get\",\n \"ghetto\",\n \"ghost\",\n \"giant\",\n \"gift\",\n \"giggle\",\n \"gill\",\n \"gilt\",\n \"ginger\",\n \"girl\",\n \"give\",\n \"given\",\n \"glad\",\n \"glade\",\n \"glance\",\n \"gland\",\n \"glare\",\n \"glass\",\n \"glassy\",\n \"gleam\",\n \"glee\",\n \"glide\",\n \"global\",\n \"globe\",\n \"gloom\",\n \"gloomy\",\n \"gloria\",\n \"glory\",\n \"gloss\",\n \"glossy\",\n \"glove\",\n \"glow\",\n \"glue\",\n \"gnat\",\n \"gnu\",\n \"goal\",\n \"goat\",\n \"gold\",\n \"golden\",\n \"golf\",\n \"gone\",\n \"gong\",\n \"goo\",\n \"good\",\n \"goose\",\n \"gore\",\n \"gorge\",\n \"gory\",\n \"gosh\",\n \"gospel\",\n \"gossip\",\n \"got\",\n \"gothic\",\n \"govern\",\n \"gown\",\n \"grab\",\n \"grace\",\n \"grade\",\n \"grail\",\n \"grain\",\n \"grand\",\n \"grant\",\n \"grape\",\n \"graph\",\n \"grasp\",\n \"grass\",\n \"grassy\",\n \"grate\",\n \"grave\",\n \"gravel\",\n \"gravy\",\n \"grease\",\n \"greasy\",\n \"great\",\n \"greece\",\n \"greed\",\n \"greedy\",\n \"greek\",\n \"green\",\n \"greet\",\n \"grew\",\n \"grey\",\n \"grid\",\n \"grief\",\n \"grill\",\n \"grim\",\n \"grin\",\n \"grind\",\n \"grip\",\n \"grit\",\n \"gritty\",\n \"groan\",\n \"groin\",\n \"groom\",\n \"groove\",\n \"gross\",\n \"ground\",\n \"group\",\n \"grove\",\n \"grow\",\n \"grown\",\n \"growth\",\n \"grudge\",\n \"grunt\",\n \"guard\",\n \"guess\",\n \"guest\",\n \"guide\",\n \"guild\",\n \"guilt\",\n \"guilty\",\n \"guise\",\n \"guitar\",\n \"gulf\",\n \"gully\",\n \"gun\",\n \"gunman\",\n \"guru\",\n \"gut\",\n \"guy\",\n \"gypsy\",\n \"habit\",\n \"hack\",\n \"had\",\n \"hail\",\n \"hair\",\n \"hairy\",\n \"haiti\",\n \"hale\",\n \"half\",\n \"hall\",\n \"halt\",\n \"hamlet\",\n \"hammer\",\n \"hand\",\n \"handle\",\n \"handy\",\n \"hang\",\n \"hangar\",\n \"hanoi\",\n \"happen\",\n \"happy\",\n \"harass\",\n \"harbor\",\n \"hard\",\n \"harder\",\n \"hardly\",\n \"hare\",\n \"harem\",\n \"harm\",\n \"harp\",\n \"harry\",\n \"harsh\",\n \"has\",\n \"hash\",\n \"hassle\",\n \"haste\",\n \"hasten\",\n \"hasty\",\n \"hat\",\n \"hatch\",\n \"hate\",\n \"haul\",\n \"haunt\",\n \"havana\",\n \"have\",\n \"haven\",\n \"havoc\",\n \"hawaii\",\n \"hawk\",\n \"hay\",\n \"hazard\",\n \"haze\",\n \"hazel\",\n \"hazy\",\n \"head\",\n \"heal\",\n \"health\",\n \"heap\",\n \"hear\",\n \"heard\",\n \"heart\",\n \"hearth\",\n \"hearty\",\n \"heat\",\n \"heater\",\n \"heaven\",\n \"heavy\",\n \"hebrew\",\n \"heck\",\n \"hectic\",\n \"hedge\",\n \"heel\",\n \"hefty\",\n \"height\",\n \"heir\",\n \"held\",\n \"helium\",\n \"helix\",\n \"hell\",\n \"hello\",\n \"helm\",\n \"helmet\",\n \"help\",\n \"hemp\",\n \"hence\",\n \"henry\",\n \"her\",\n \"herald\",\n \"herb\",\n \"herd\",\n \"here\",\n \"hereby\",\n \"hermes\",\n \"hernia\",\n \"hero\",\n \"heroic\",\n \"heroin\",\n \"hey\",\n \"heyday\",\n \"hick\",\n \"hidden\",\n \"hide\",\n \"high\",\n \"higher\",\n \"highly\",\n \"hill\",\n \"him\",\n \"hind\",\n \"hinder\",\n \"hint\",\n \"hippie\",\n \"hire\",\n \"his\",\n \"hiss\",\n \"hit\",\n \"hive\",\n \"hoard\",\n \"hoarse\",\n \"hobby\",\n \"hockey\",\n \"hold\",\n \"holder\",\n \"hole\",\n \"hollow\",\n \"holly\",\n \"holy\",\n \"home\",\n \"honest\",\n \"honey\",\n \"hood\",\n \"hook\",\n \"hope\",\n \"horn\",\n \"horrid\",\n \"horror\",\n \"horse\",\n \"hose\",\n \"host\",\n \"hot\",\n \"hotel\",\n \"hound\",\n \"hour\",\n \"house\",\n \"hover\",\n \"how\",\n \"huge\",\n \"hull\",\n \"human\",\n \"humane\",\n \"humble\",\n \"humid\",\n \"hung\",\n \"hunger\",\n \"hungry\",\n \"hunt\",\n \"hurdle\",\n \"hurl\",\n \"hurry\",\n \"hurt\",\n \"hush\",\n \"hut\",\n \"hybrid\",\n \"hymn\",\n \"hyphen\",\n \"ice\",\n \"icing\",\n \"icon\",\n \"idaho\",\n \"idea\",\n \"ideal\",\n \"idiom\",\n \"idiot\",\n \"idle\",\n \"idly\",\n \"idol\",\n \"ignite\",\n \"ignore\",\n \"ill\",\n \"image\",\n \"immune\",\n \"impact\",\n \"imply\",\n \"import\",\n \"impose\",\n \"inca\",\n \"incest\",\n \"inch\",\n \"income\",\n \"incur\",\n \"indeed\",\n \"index\",\n \"india\",\n \"indian\",\n \"indoor\",\n \"induce\",\n \"inept\",\n \"inert\",\n \"infant\",\n \"infect\",\n \"infer\",\n \"influx\",\n \"inform\",\n \"inject\",\n \"injure\",\n \"injury\",\n \"ink\",\n \"inlaid\",\n \"inland\",\n \"inlet\",\n \"inmate\",\n \"inn\",\n \"innate\",\n \"inner\",\n \"input\",\n \"insane\",\n \"insect\",\n \"insert\",\n \"inset\",\n \"inside\",\n \"insist\",\n \"insult\",\n \"insure\",\n \"intact\",\n \"intake\",\n \"intend\",\n \"inter\",\n \"into\",\n \"invade\",\n \"invent\",\n \"invest\",\n \"invite\",\n \"invoke\",\n \"inward\",\n \"iowa\",\n \"iran\",\n \"iraq\",\n \"irish\",\n \"iron\",\n \"ironic\",\n \"irony\",\n \"isaac\",\n \"isabel\",\n \"island\",\n \"isle\",\n \"israel\",\n \"issue\",\n \"italy\",\n \"itch\",\n \"item\",\n \"itself\",\n \"ivan\",\n \"ivory\",\n \"jack\",\n \"jacket\",\n \"jacob\",\n \"jade\",\n \"jaguar\",\n \"jail\",\n \"james\",\n \"jane\",\n \"japan\",\n \"jargon\",\n \"java\",\n \"jaw\",\n \"jazz\",\n \"jeep\",\n \"jelly\",\n \"jerky\",\n \"jest\",\n \"jet\",\n \"jewel\",\n \"jewish\",\n \"jim\",\n \"job\",\n \"jock\",\n \"jockey\",\n \"joe\",\n \"john\",\n \"join\",\n \"joint\",\n \"joke\",\n \"jolly\",\n \"jolt\",\n \"jordan\",\n \"joseph\",\n \"joy\",\n \"joyful\",\n \"joyous\",\n \"judge\",\n \"judy\",\n \"juice\",\n \"juicy\",\n \"july\",\n \"jumble\",\n \"jumbo\",\n \"jump\",\n \"june\",\n \"jungle\",\n \"junior\",\n \"junk\",\n \"junta\",\n \"jury\",\n \"just\",\n \"kansas\",\n \"karate\",\n \"karl\",\n \"keel\",\n \"keen\",\n \"keep\",\n \"keeper\",\n \"kenya\",\n \"kept\",\n \"kernel\",\n \"kettle\",\n \"key\",\n \"khaki\",\n \"kick\",\n \"kid\",\n \"kidnap\",\n \"kidney\",\n \"kill\",\n \"killer\",\n \"kin\",\n \"kind\",\n \"kindly\",\n \"king\",\n \"kiss\",\n \"kite\",\n \"kitten\",\n \"knack\",\n \"knee\",\n \"kneel\",\n \"knew\",\n \"knife\",\n \"knight\",\n \"knit\",\n \"knob\",\n \"knock\",\n \"knot\",\n \"know\",\n \"known\",\n \"koran\",\n \"korea\",\n \"kuwait\",\n \"label\",\n \"lace\",\n \"lack\",\n \"lad\",\n \"ladder\",\n \"laden\",\n \"lady\",\n \"lagoon\",\n \"laity\",\n \"lake\",\n \"lamb\",\n \"lame\",\n \"lamp\",\n \"lance\",\n \"land\",\n \"lane\",\n \"lap\",\n \"lapse\",\n \"large\",\n \"larval\",\n \"laser\",\n \"last\",\n \"latch\",\n \"late\",\n \"lately\",\n \"latent\",\n \"later\",\n \"latest\",\n \"latin\",\n \"latter\",\n \"laugh\",\n \"launch\",\n \"lava\",\n \"lavish\",\n \"law\",\n \"lawful\",\n \"lawn\",\n \"lawyer\",\n \"lay\",\n \"layer\",\n \"layman\",\n \"lazy\",\n \"lead\",\n \"leader\",\n \"leaf\",\n \"leafy\",\n \"league\",\n \"leak\",\n \"leaky\",\n \"lean\",\n \"leap\",\n \"learn\",\n \"lease\",\n \"leash\",\n \"least\",\n \"leave\",\n \"led\",\n \"ledge\",\n \"left\",\n \"leg\",\n \"legacy\",\n \"legal\",\n \"legend\",\n \"legion\",\n \"lemon\",\n \"lend\",\n \"length\",\n \"lens\",\n \"lent\",\n \"leo\",\n \"leper\",\n \"lesion\",\n \"less\",\n \"lessen\",\n \"lesser\",\n \"lesson\",\n \"lest\",\n \"let\",\n \"lethal\",\n \"letter\",\n \"level\",\n \"lever\",\n \"levy\",\n \"lewis\",\n \"liable\",\n \"liar\",\n \"libel\",\n \"libya\",\n \"lice\",\n \"lick\",\n \"lid\",\n \"lie\",\n \"lied\",\n \"lier\",\n \"life\",\n \"lift\",\n \"light\",\n \"like\",\n \"likely\",\n \"limb\",\n \"lime\",\n \"limit\",\n \"limp\",\n \"line\",\n \"linear\",\n \"linen\",\n \"linger\",\n \"link\",\n \"lint\",\n \"lion\",\n \"lip\",\n \"liquid\",\n \"liquor\",\n \"list\",\n \"listen\",\n \"lit\",\n \"live\",\n \"lively\",\n \"liver\",\n \"liz\",\n \"lizard\",\n \"load\",\n \"loaf\",\n \"loan\",\n \"lobby\",\n \"lobe\",\n \"local\",\n \"locate\",\n \"lock\",\n \"locus\",\n \"lodge\",\n \"loft\",\n \"lofty\",\n \"log\",\n \"logic\",\n \"logo\",\n \"london\",\n \"lone\",\n \"lonely\",\n \"long\",\n \"longer\",\n \"look\",\n \"loop\",\n \"loose\",\n \"loosen\",\n \"loot\",\n \"lord\",\n \"lorry\",\n \"lose\",\n \"loss\",\n \"lost\",\n \"lot\",\n \"lotion\",\n \"lotus\",\n \"loud\",\n \"loudly\",\n \"lounge\",\n \"lousy\",\n \"love\",\n \"lovely\",\n \"lover\",\n \"low\",\n \"lower\",\n \"lowest\",\n \"loyal\",\n \"lucid\",\n \"luck\",\n \"lucky\",\n \"lucy\",\n \"lull\",\n \"lump\",\n \"lumpy\",\n \"lunacy\",\n \"lunar\",\n \"lunch\",\n \"lung\",\n \"lure\",\n \"lurid\",\n \"lush\",\n \"lust\",\n \"lute\",\n \"luther\",\n \"luxury\",\n \"lying\",\n \"lymph\",\n \"lynch\",\n \"lyric\",\n \"macho\",\n \"macro\",\n \"mad\",\n \"madam\",\n \"made\",\n \"mafia\",\n \"magic\",\n \"magma\",\n \"magnet\",\n \"magnum\",\n \"magpie\",\n \"maid\",\n \"maiden\",\n \"mail\",\n \"main\",\n \"mainly\",\n \"major\",\n \"make\",\n \"maker\",\n \"male\",\n \"malice\",\n \"mall\",\n \"malt\",\n \"mammal\",\n \"manage\",\n \"mane\",\n \"mania\",\n \"manic\",\n \"manner\",\n \"manor\",\n \"mantle\",\n \"manual\",\n \"manure\",\n \"many\",\n \"map\",\n \"maple\",\n \"marble\",\n \"march\",\n \"mare\",\n \"margin\",\n \"maria\",\n \"marina\",\n \"mark\",\n \"market\",\n \"marry\",\n \"mars\",\n \"marsh\",\n \"martin\",\n \"martyr\",\n \"mary\",\n \"mask\",\n \"mason\",\n \"mass\",\n \"mast\",\n \"master\",\n \"mat\",\n \"match\",\n \"mate\",\n \"matrix\",\n \"matter\",\n \"mature\",\n \"maxim\",\n \"may\",\n \"maybe\",\n \"mayor\",\n \"maze\",\n \"mead\",\n \"meadow\",\n \"meal\",\n \"mean\",\n \"meant\",\n \"meat\",\n \"medal\",\n \"media\",\n \"median\",\n \"medic\",\n \"medium\",\n \"meet\",\n \"mellow\",\n \"melody\",\n \"melon\",\n \"melt\",\n \"member\",\n \"memo\",\n \"memory\",\n \"menace\",\n \"mend\",\n \"mental\",\n \"mentor\",\n \"menu\",\n \"mercy\",\n \"mere\",\n \"merely\",\n \"merge\",\n \"merger\",\n \"merit\",\n \"merry\",\n \"mesh\",\n \"mess\",\n \"messy\",\n \"met\",\n \"metal\",\n \"meter\",\n \"method\",\n \"methyl\",\n \"metric\",\n \"metro\",\n \"mexico\",\n \"miami\",\n \"mickey\",\n \"mid\",\n \"midday\",\n \"middle\",\n \"midst\",\n \"midway\",\n \"might\",\n \"mighty\",\n \"mild\",\n \"mildew\",\n \"mile\",\n \"milk\",\n \"milky\",\n \"mill\",\n \"mimic\",\n \"mince\",\n \"mind\",\n \"mine\",\n \"mini\",\n \"mink\",\n \"minor\",\n \"mint\",\n \"minus\",\n \"minute\",\n \"mire\",\n \"mirror\",\n \"mirth\",\n \"misery\",\n \"miss\",\n \"mist\",\n \"misty\",\n \"mite\",\n \"mix\",\n \"moan\",\n \"moat\",\n \"mob\",\n \"mobile\",\n \"mock\",\n \"mode\",\n \"model\",\n \"modem\",\n \"modern\",\n \"modest\",\n \"modify\",\n \"module\",\n \"moist\",\n \"molar\",\n \"mold\",\n \"mole\",\n \"molten\",\n \"moment\",\n \"monday\",\n \"money\",\n \"monk\",\n \"monkey\",\n \"month\",\n \"mood\",\n \"moody\",\n \"moon\",\n \"moor\",\n \"moral\",\n \"morale\",\n \"morbid\",\n \"more\",\n \"morgue\",\n \"mortal\",\n \"mortar\",\n \"mosaic\",\n \"moscow\",\n \"moses\",\n \"mosque\",\n \"moss\",\n \"most\",\n \"mostly\",\n \"moth\",\n \"mother\",\n \"motion\",\n \"motive\",\n \"motor\",\n \"mount\",\n \"mourn\",\n \"mouse\",\n \"mouth\",\n \"move\",\n \"movie\",\n \"mrs\",\n \"much\",\n \"muck\",\n \"mucus\",\n \"mud\",\n \"muddle\",\n \"muddy\",\n \"mule\",\n \"mummy\",\n \"munich\",\n \"murder\",\n \"murky\",\n \"murmur\",\n \"muscle\",\n \"museum\",\n \"music\",\n \"mussel\",\n \"must\",\n \"mutant\",\n \"mute\",\n \"mutiny\",\n \"mutter\",\n \"mutton\",\n \"mutual\",\n \"muzzle\",\n \"myopic\",\n \"myriad\",\n \"myself\",\n \"mystic\",\n \"myth\",\n \"nadir\",\n \"nail\",\n \"naked\",\n \"name\",\n \"namely\",\n \"nape\",\n \"napkin\",\n \"naples\",\n \"narrow\",\n \"nasal\",\n \"nasty\",\n \"nathan\",\n \"nation\",\n \"native\",\n \"nature\",\n \"nausea\",\n \"naval\",\n \"nave\",\n \"navy\",\n \"near\",\n \"nearer\",\n \"nearly\",\n \"neat\",\n \"neatly\",\n \"neck\",\n \"need\",\n \"needle\",\n \"needy\",\n \"negate\",\n \"neon\",\n \"nepal\",\n \"nephew\",\n \"nerve\",\n \"nest\",\n \"net\",\n \"neural\",\n \"never\",\n \"newly\",\n \"next\",\n \"nice\",\n \"nicely\",\n \"niche\",\n \"nickel\",\n \"niece\",\n \"night\",\n \"nile\",\n \"nimble\",\n \"nine\",\n \"ninety\",\n \"ninth\",\n \"nobel\",\n \"noble\",\n \"nobody\",\n \"node\",\n \"noise\",\n \"noisy\",\n \"none\",\n \"noon\",\n \"nor\",\n \"norm\",\n \"normal\",\n \"north\",\n \"norway\",\n \"nose\",\n \"nosy\",\n \"not\",\n \"note\",\n \"notice\",\n \"notify\",\n \"notion\",\n \"noun\",\n \"novel\",\n \"novice\",\n \"now\",\n \"nozzle\",\n \"null\",\n \"numb\",\n \"number\",\n \"nurse\",\n \"nut\",\n \"nylon\",\n \"nymph\",\n \"oak\",\n \"oar\",\n \"oasis\",\n \"oath\",\n \"obese\",\n \"obey\",\n \"object\",\n \"oblige\",\n \"oboe\",\n \"obtain\",\n \"obtuse\",\n \"occult\",\n \"occupy\",\n \"occur\",\n \"ocean\",\n \"octave\",\n \"odd\",\n \"off\",\n \"offend\",\n \"offer\",\n \"office\",\n \"offset\",\n \"often\",\n \"ohio\",\n \"oil\",\n \"oily\",\n \"okay\",\n \"old\",\n \"older\",\n \"oldest\",\n \"olive\",\n \"omega\",\n \"omen\",\n \"omit\",\n \"once\",\n \"one\",\n \"onion\",\n \"only\",\n \"onset\",\n \"onto\",\n \"onus\",\n \"onward\",\n \"opaque\",\n \"open\",\n \"openly\",\n \"opera\",\n \"opium\",\n \"oppose\",\n \"optic\",\n \"option\",\n \"oracle\",\n \"oral\",\n \"orange\",\n \"orbit\",\n \"orchid\",\n \"ordeal\",\n \"order\",\n \"organ\",\n \"orgasm\",\n \"orient\",\n \"origin\",\n \"ornate\",\n \"orphan\",\n \"oscar\",\n \"other\",\n \"otter\",\n \"ought\",\n \"ounce\",\n \"our\",\n \"out\",\n \"outer\",\n \"output\",\n \"outset\",\n \"oval\",\n \"oven\",\n \"over\",\n \"overt\",\n \"owe\",\n \"owing\",\n \"owl\",\n \"own\",\n \"owner\",\n \"oxford\",\n \"oxide\",\n \"oxygen\",\n \"oyster\",\n \"ozone\",\n \"pace\",\n \"pack\",\n \"packet\",\n \"pact\",\n \"pad\",\n \"paddle\",\n \"paddy\",\n \"pagan\",\n \"page\",\n \"paid\",\n \"pain\",\n \"paint\",\n \"pair\",\n \"palace\",\n \"pale\",\n \"palm\",\n \"pan\",\n \"panama\",\n \"panel\",\n \"panic\",\n \"papa\",\n \"papal\",\n \"paper\",\n \"parade\",\n \"parcel\",\n \"pardon\",\n \"parent\",\n \"paris\",\n \"parish\",\n \"park\",\n \"parody\",\n \"parrot\",\n \"part\",\n \"partly\",\n \"party\",\n \"pascal\",\n \"pass\",\n \"past\",\n \"paste\",\n \"pastel\",\n \"pastor\",\n \"pastry\",\n \"pat\",\n \"patch\",\n \"patent\",\n \"path\",\n \"patio\",\n \"patrol\",\n \"patron\",\n \"paul\",\n \"pause\",\n \"pave\",\n \"paw\",\n \"pawn\",\n \"pay\",\n \"peace\",\n \"peach\",\n \"peak\",\n \"pear\",\n \"pearl\",\n \"pedal\",\n \"peel\",\n \"peer\",\n \"peking\",\n \"pelvic\",\n \"pelvis\",\n \"pen\",\n \"penal\",\n \"pence\",\n \"pencil\",\n \"penny\",\n \"people\",\n \"pepper\",\n \"per\",\n \"perch\",\n \"peril\",\n \"period\",\n \"perish\",\n \"permit\",\n \"person\",\n \"peru\",\n \"pest\",\n \"pet\",\n \"peter\",\n \"petite\",\n \"petrol\",\n \"petty\",\n \"phase\",\n \"philip\",\n \"phone\",\n \"photo\",\n \"phrase\",\n \"piano\",\n \"pick\",\n \"picket\",\n \"picnic\",\n \"pie\",\n \"piece\",\n \"pier\",\n \"pierce\",\n \"piety\",\n \"pig\",\n \"pigeon\",\n \"piggy\",\n \"pike\",\n \"pile\",\n \"pill\",\n \"pillar\",\n \"pillow\",\n \"pilot\",\n \"pin\",\n \"pinch\",\n \"pine\",\n \"pink\",\n \"pint\",\n \"pious\",\n \"pipe\",\n \"pirate\",\n \"piss\",\n \"pistol\",\n \"piston\",\n \"pit\",\n \"pitch\",\n \"pity\",\n \"pivot\",\n \"pixel\",\n \"pizza\",\n \"place\",\n \"placid\",\n \"plague\",\n \"plain\",\n \"plan\",\n \"plane\",\n \"planet\",\n \"plank\",\n \"plant\",\n \"plasma\",\n \"plate\",\n \"play\",\n \"player\",\n \"plea\",\n \"plead\",\n \"please\",\n \"pledge\",\n \"plenty\",\n \"plight\",\n \"plot\",\n \"plough\",\n \"ploy\",\n \"plug\",\n \"plum\",\n \"plump\",\n \"plunge\",\n \"plural\",\n \"plus\",\n \"plush\",\n \"pocket\",\n \"poem\",\n \"poet\",\n \"poetic\",\n \"poetry\",\n \"point\",\n \"poison\",\n \"poland\",\n \"polar\",\n \"pole\",\n \"police\",\n \"policy\",\n \"polish\",\n \"polite\",\n \"poll\",\n \"pollen\",\n \"polo\",\n \"pond\",\n \"ponder\",\n \"pony\",\n \"pool\",\n \"poor\",\n \"poorly\",\n \"pop\",\n \"poppy\",\n \"pore\",\n \"pork\",\n \"port\",\n \"portal\",\n \"pose\",\n \"posh\",\n \"post\",\n \"postal\",\n \"pot\",\n \"potato\",\n \"potent\",\n \"pouch\",\n \"pound\",\n \"pour\",\n \"powder\",\n \"power\",\n \"praise\",\n \"pray\",\n \"prayer\",\n \"preach\",\n \"prefer\",\n \"prefix\",\n \"press\",\n \"pretty\",\n \"price\",\n \"pride\",\n \"priest\",\n \"primal\",\n \"prime\",\n \"prince\",\n \"print\",\n \"prior\",\n \"prism\",\n \"prison\",\n \"privy\",\n \"prize\",\n \"probe\",\n \"profit\",\n \"prompt\",\n \"prone\",\n \"proof\",\n \"propel\",\n \"proper\",\n \"prose\",\n \"proton\",\n \"proud\",\n \"prove\",\n \"proven\",\n \"proxy\",\n \"prune\",\n \"pry\",\n \"psalm\",\n \"pseudo\",\n \"psyche\",\n \"pub\",\n \"public\",\n \"puff\",\n \"pull\",\n \"pulp\",\n \"pulpit\",\n \"pulsar\",\n \"pulse\",\n \"pump\",\n \"punch\",\n \"punish\",\n \"punk\",\n \"pupil\",\n \"puppet\",\n \"puppy\",\n \"pure\",\n \"purely\",\n \"purge\",\n \"purify\",\n \"purple\",\n \"purse\",\n \"pursue\",\n \"push\",\n \"pushy\",\n \"put\",\n \"putt\",\n \"puzzle\",\n \"quaint\",\n \"quake\",\n \"quarry\",\n \"quart\",\n \"quartz\",\n \"quebec\",\n \"queen\",\n \"queer\",\n \"query\",\n \"quest\",\n \"queue\",\n \"quick\",\n \"quid\",\n \"quiet\",\n \"quilt\",\n \"quirk\",\n \"quit\",\n \"quite\",\n \"quiver\",\n \"quiz\",\n \"quota\",\n \"quote\",\n \"rabbit\",\n \"race\",\n \"racial\",\n \"racism\",\n \"rack\",\n \"racket\",\n \"radar\",\n \"radio\",\n \"radish\",\n \"radius\",\n \"raffle\",\n \"raft\",\n \"rage\",\n \"raid\",\n \"rail\",\n \"rain\",\n \"rainy\",\n \"raise\",\n \"rake\",\n \"rally\",\n \"ramp\",\n \"random\",\n \"range\",\n \"rank\",\n \"ransom\",\n \"rape\",\n \"rapid\",\n \"rare\",\n \"rarely\",\n \"rarity\",\n \"rash\",\n \"rat\",\n \"rate\",\n \"rather\",\n \"ratify\",\n \"ratio\",\n \"rattle\",\n \"rave\",\n \"raven\",\n \"raw\",\n \"ray\",\n \"razor\",\n \"reach\",\n \"react\",\n \"read\",\n \"reader\",\n \"ready\",\n \"real\",\n \"really\",\n \"realm\",\n \"reap\",\n \"rear\",\n \"reason\",\n \"rebel\",\n \"recall\",\n \"recent\",\n \"recess\",\n \"recipe\",\n \"reckon\",\n \"record\",\n \"recoup\",\n \"rector\",\n \"red\",\n \"redeem\",\n \"redo\",\n \"reduce\",\n \"reed\",\n \"reef\",\n \"reek\",\n \"refer\",\n \"reform\",\n \"refuge\",\n \"refuse\",\n \"regal\",\n \"regard\",\n \"regent\",\n \"regime\",\n \"region\",\n \"regret\",\n \"reign\",\n \"reject\",\n \"relate\",\n \"relax\",\n \"relay\",\n \"relic\",\n \"relief\",\n \"relish\",\n \"rely\",\n \"remain\",\n \"remark\",\n \"remedy\",\n \"remind\",\n \"remit\",\n \"remote\",\n \"remove\",\n \"renal\",\n \"render\",\n \"rent\",\n \"rental\",\n \"repair\",\n \"repeal\",\n \"repeat\",\n \"repent\",\n \"reply\",\n \"report\",\n \"rescue\",\n \"resent\",\n \"reside\",\n \"resign\",\n \"resin\",\n \"resist\",\n \"resort\",\n \"rest\",\n \"result\",\n \"resume\",\n \"retail\",\n \"retain\",\n \"retina\",\n \"retire\",\n \"return\",\n \"reveal\",\n \"review\",\n \"revise\",\n \"revive\",\n \"revolt\",\n \"reward\",\n \"rex\",\n \"rhine\",\n \"rhino\",\n \"rhyme\",\n \"rhythm\",\n \"ribbon\",\n \"rice\",\n \"rich\",\n \"rick\",\n \"rid\",\n \"ride\",\n \"rider\",\n \"ridge\",\n \"rife\",\n \"rifle\",\n \"rift\",\n \"right\",\n \"rigid\",\n \"rile\",\n \"rim\",\n \"ring\",\n \"rinse\",\n \"riot\",\n \"ripe\",\n \"ripen\",\n \"ripple\",\n \"rise\",\n \"risk\",\n \"risky\",\n \"rite\",\n \"ritual\",\n \"ritz\",\n \"rival\",\n \"river\",\n \"road\",\n \"roar\",\n \"roast\",\n \"rob\",\n \"robe\",\n \"robert\",\n \"robin\",\n \"robot\",\n \"robust\",\n \"rock\",\n \"rocket\",\n \"rocky\",\n \"rod\",\n \"rode\",\n \"rodent\",\n \"rogue\",\n \"role\",\n \"roll\",\n \"roman\",\n \"rome\",\n \"roof\",\n \"room\",\n \"root\",\n \"rope\",\n \"rose\",\n \"rosy\",\n \"rot\",\n \"rotate\",\n \"rotor\",\n \"rotten\",\n \"rouge\",\n \"rough\",\n \"round\",\n \"route\",\n \"rover\",\n \"row\",\n \"royal\",\n \"rub\",\n \"rubber\",\n \"rubble\",\n \"ruby\",\n \"rudder\",\n \"rude\",\n \"rug\",\n \"rugby\",\n \"ruin\",\n \"rule\",\n \"ruler\",\n \"rumble\",\n \"rump\",\n \"run\",\n \"rune\",\n \"rung\",\n \"runway\",\n \"rural\",\n \"rush\",\n \"russia\",\n \"rust\",\n \"rustic\",\n \"rusty\",\n \"sack\",\n \"sacred\",\n \"sad\",\n \"saddle\",\n \"sadism\",\n \"sadly\",\n \"safari\",\n \"safe\",\n \"safely\",\n \"safer\",\n \"safety\",\n \"saga\",\n \"sage\",\n \"sahara\",\n \"said\",\n \"sail\",\n \"sailor\",\n \"saint\",\n \"sake\",\n \"salad\",\n \"salary\",\n \"sale\",\n \"saline\",\n \"saliva\",\n \"salmon\",\n \"saloon\",\n \"salt\",\n \"salty\",\n \"salute\",\n \"sam\",\n \"same\",\n \"sample\",\n \"sand\",\n \"sandy\",\n \"sane\",\n \"sash\",\n \"satin\",\n \"satire\",\n \"saturn\",\n \"sauce\",\n \"saucer\",\n \"saudi\",\n \"sauna\",\n \"savage\",\n \"save\",\n \"saw\",\n \"say\",\n \"scale\",\n \"scalp\",\n \"scan\",\n \"scant\",\n \"scar\",\n \"scarce\",\n \"scare\",\n \"scarf\",\n \"scary\",\n \"scene\",\n \"scenic\",\n \"scent\",\n \"school\",\n \"scold\",\n \"scope\",\n \"score\",\n \"scorn\",\n \"scotch\",\n \"scott\",\n \"scout\",\n \"scrap\",\n \"scrape\",\n \"scream\",\n \"screen\",\n \"screw\",\n \"script\",\n \"scroll\",\n \"scrub\",\n \"scum\",\n \"sea\",\n \"seal\",\n \"seam\",\n \"seaman\",\n \"search\",\n \"season\",\n \"seat\",\n \"second\",\n \"secret\",\n \"sect\",\n \"sector\",\n \"secure\",\n \"see\",\n \"seed\",\n \"seeing\",\n \"seek\",\n \"seem\",\n \"seize\",\n \"seldom\",\n \"select\",\n \"self\",\n \"sell\",\n \"seller\",\n \"semi\",\n \"senate\",\n \"send\",\n \"senile\",\n \"senior\",\n \"sense\",\n \"sensor\",\n \"sent\",\n \"sentry\",\n \"seoul\",\n \"sequel\",\n \"serene\",\n \"serial\",\n \"series\",\n \"sermon\",\n \"serum\",\n \"serve\",\n \"server\",\n \"set\",\n \"settle\",\n \"seven\",\n \"severe\",\n \"sew\",\n \"sewage\",\n \"shabby\",\n \"shade\",\n \"shadow\",\n \"shady\",\n \"shaft\",\n \"shaggy\",\n \"shah\",\n \"shake\",\n \"shaky\",\n \"shall\",\n \"sham\",\n \"shame\",\n \"shape\",\n \"share\",\n \"shark\",\n \"sharp\",\n \"shawl\",\n \"she\",\n \"shear\",\n \"sheen\",\n \"sheep\",\n \"sheer\",\n \"sheet\",\n \"shelf\",\n \"shell\",\n \"sherry\",\n \"shield\",\n \"shift\",\n \"shine\",\n \"shiny\",\n \"ship\",\n \"shire\",\n \"shirk\",\n \"shirt\",\n \"shiver\",\n \"shock\",\n \"shoe\",\n \"shook\",\n \"shoot\",\n \"shop\",\n \"shore\",\n \"short\",\n \"shot\",\n \"should\",\n \"shout\",\n \"show\",\n \"shower\",\n \"shrank\",\n \"shrewd\",\n \"shrill\",\n \"shrimp\",\n \"shrine\",\n \"shrink\",\n \"shrub\",\n \"shrug\",\n \"shut\",\n \"shy\",\n \"shyly\",\n \"sick\",\n \"side\",\n \"siege\",\n \"sigh\",\n \"sight\",\n \"sigma\",\n \"sign\",\n \"signal\",\n \"silent\",\n \"silk\",\n \"silken\",\n \"silky\",\n \"sill\",\n \"silly\",\n \"silo\",\n \"silver\",\n \"simple\",\n \"simply\",\n \"since\",\n \"sinful\",\n \"sing\",\n \"singer\",\n \"single\",\n \"sink\",\n \"sir\",\n \"sire\",\n \"siren\",\n \"sister\",\n \"sit\",\n \"site\",\n \"sitter\",\n \"six\",\n \"sixth\",\n \"sixty\",\n \"size\",\n \"sketch\",\n \"skill\",\n \"skin\",\n \"skinny\",\n \"skip\",\n \"skirt\",\n \"skull\",\n \"sky\",\n \"slab\",\n \"slack\",\n \"slain\",\n \"slam\",\n \"slang\",\n \"slap\",\n \"slat\",\n \"slate\",\n \"slave\",\n \"sleek\",\n \"sleep\",\n \"sleepy\",\n \"sleeve\",\n \"slice\",\n \"slick\",\n \"slid\",\n \"slide\",\n \"slight\",\n \"slim\",\n \"slimy\",\n \"sling\",\n \"slip\",\n \"slit\",\n \"slogan\",\n \"slope\",\n \"sloppy\",\n \"slot\",\n \"slow\",\n \"slowly\",\n \"slug\",\n \"slum\",\n \"slump\",\n \"smack\",\n \"small\",\n \"smart\",\n \"smash\",\n \"smear\",\n \"smell\",\n \"smelly\",\n \"smelt\",\n \"smile\",\n \"smite\",\n \"smoke\",\n \"smoky\",\n \"smooth\",\n \"smug\",\n \"snack\",\n \"snail\",\n \"snake\",\n \"snap\",\n \"snatch\",\n \"sneak\",\n \"snow\",\n \"snowy\",\n \"snug\",\n \"soak\",\n \"soap\",\n \"sober\",\n \"soccer\",\n \"social\",\n \"sock\",\n \"socket\",\n \"socks\",\n \"soda\",\n \"sodden\",\n \"sodium\",\n \"sofa\",\n \"soft\",\n \"soften\",\n \"softly\",\n \"soggy\",\n \"soil\",\n \"solar\",\n \"sold\",\n \"sole\",\n \"solely\",\n \"solemn\",\n \"solid\",\n \"solo\",\n \"solve\",\n \"some\",\n \"son\",\n \"sonar\",\n \"sonata\",\n \"song\",\n \"sonic\",\n \"sony\",\n \"soon\",\n \"sooner\",\n \"soot\",\n \"soothe\",\n \"sordid\",\n \"sore\",\n \"sorrow\",\n \"sorry\",\n \"sort\",\n \"soul\",\n \"sound\",\n \"soup\",\n \"sour\",\n \"source\",\n \"soviet\",\n \"sow\",\n \"space\",\n \"spade\",\n \"spain\",\n \"span\",\n \"spare\",\n \"spark\",\n \"sparse\",\n \"spasm\",\n \"spat\",\n \"spate\",\n \"speak\",\n \"spear\",\n \"speech\",\n \"speed\",\n \"speedy\",\n \"spell\",\n \"spend\",\n \"sphere\",\n \"spice\",\n \"spicy\",\n \"spider\",\n \"spiky\",\n \"spill\",\n \"spin\",\n \"spinal\",\n \"spine\",\n \"spiral\",\n \"spirit\",\n \"spit\",\n \"spite\",\n \"splash\",\n \"split\",\n \"spoil\",\n \"spoke\",\n \"sponge\",\n \"spoon\",\n \"sport\",\n \"spot\",\n \"spouse\",\n \"spray\",\n \"spread\",\n \"spree\",\n \"spring\",\n \"sprint\",\n \"spur\",\n \"squad\",\n \"square\",\n \"squash\",\n \"squat\",\n \"squid\",\n \"stab\",\n \"stable\",\n \"stack\",\n \"staff\",\n \"stage\",\n \"stain\",\n \"stair\",\n \"stairs\",\n \"stake\",\n \"stale\",\n \"stall\",\n \"stamp\",\n \"stance\",\n \"stand\",\n \"staple\",\n \"star\",\n \"starch\",\n \"stare\",\n \"stark\",\n \"start\",\n \"starve\",\n \"state\",\n \"static\",\n \"statue\",\n \"status\",\n \"stay\",\n \"stead\",\n \"steady\",\n \"steak\",\n \"steal\",\n \"steam\",\n \"steel\",\n \"steep\",\n \"steer\",\n \"stem\",\n \"stench\",\n \"step\",\n \"stereo\",\n \"stern\",\n \"stew\",\n \"stick\",\n \"sticky\",\n \"stiff\",\n \"stifle\",\n \"stigma\",\n \"still\",\n \"sting\",\n \"stint\",\n \"stir\",\n \"stitch\",\n \"stock\",\n \"stocky\",\n \"stone\",\n \"stony\",\n \"stool\",\n \"stop\",\n \"store\",\n \"storm\",\n \"stormy\",\n \"story\",\n \"stout\",\n \"stove\",\n \"stow\",\n \"strain\",\n \"strait\",\n \"strand\",\n \"strap\",\n \"strata\",\n \"straw\",\n \"stray\",\n \"streak\",\n \"stream\",\n \"street\",\n \"stress\",\n \"strict\",\n \"stride\",\n \"strife\",\n \"strike\",\n \"string\",\n \"strip\",\n \"stripe\",\n \"strive\",\n \"stroke\",\n \"stroll\",\n \"strong\",\n \"stud\",\n \"studio\",\n \"study\",\n \"stuff\",\n \"stuffy\",\n \"stunt\",\n \"stupid\",\n \"sturdy\",\n \"style\",\n \"submit\",\n \"subtle\",\n \"subtly\",\n \"suburb\",\n \"such\",\n \"sudden\",\n \"sue\",\n \"suez\",\n \"suffer\",\n \"sugar\",\n \"suit\",\n \"suite\",\n \"suitor\",\n \"sullen\",\n \"sultan\",\n \"sum\",\n \"summer\",\n \"summit\",\n \"summon\",\n \"sun\",\n \"sunday\",\n \"sunny\",\n \"sunset\",\n \"super\",\n \"superb\",\n \"supper\",\n \"supple\",\n \"supply\",\n \"sure\",\n \"surely\",\n \"surf\",\n \"surge\",\n \"survey\",\n \"suture\",\n \"swamp\",\n \"swan\",\n \"swap\",\n \"swarm\",\n \"sway\",\n \"swear\",\n \"sweat\",\n \"sweaty\",\n \"sweden\",\n \"sweep\",\n \"sweet\",\n \"swell\",\n \"swift\",\n \"swim\",\n \"swine\",\n \"swing\",\n \"swirl\",\n \"swiss\",\n \"switch\",\n \"sword\",\n \"swore\",\n \"sydney\",\n \"symbol\",\n \"synod\",\n \"syntax\",\n \"syria\",\n \"syrup\",\n \"system\",\n \"table\",\n \"tablet\",\n \"taboo\",\n \"tacit\",\n \"tackle\",\n \"tact\",\n \"tactic\",\n \"tail\",\n \"tailor\",\n \"taiwan\",\n \"take\",\n \"tale\",\n \"talent\",\n \"talk\",\n \"tall\",\n \"tally\",\n \"tame\",\n \"tampa\",\n \"tan\",\n \"tandem\",\n \"tangle\",\n \"tank\",\n \"tap\",\n \"tape\",\n \"target\",\n \"tariff\",\n \"tarp\",\n \"tart\",\n \"tarzan\",\n \"task\",\n \"taste\",\n \"tasty\",\n \"tattoo\",\n \"taurus\",\n \"taut\",\n \"tavern\",\n \"tax\",\n \"taxi\",\n \"tea\",\n \"teach\",\n \"teak\",\n \"team\",\n \"tear\",\n \"tease\",\n \"tech\",\n \"teeth\",\n \"tell\",\n \"temper\",\n \"temple\",\n \"tempo\",\n \"tempt\",\n \"ten\",\n \"tenant\",\n \"tend\",\n \"tender\",\n \"tendon\",\n \"tennis\",\n \"tenor\",\n \"tense\",\n \"tent\",\n \"tenth\",\n \"tenure\",\n \"teresa\",\n \"term\",\n \"terror\",\n \"terse\",\n \"test\",\n \"texas\",\n \"text\",\n \"thank\",\n \"thaw\",\n \"them\",\n \"theme\",\n \"thence\",\n \"theory\",\n \"there\",\n \"these\",\n \"thesis\",\n \"they\",\n \"thick\",\n \"thief\",\n \"thigh\",\n \"thin\",\n \"thing\",\n \"think\",\n \"third\",\n \"thirst\",\n \"thirty\",\n \"this\",\n \"thomas\",\n \"thorn\",\n \"those\",\n \"though\",\n \"thread\",\n \"threat\",\n \"three\",\n \"thrill\",\n \"thrive\",\n \"throat\",\n \"throne\",\n \"throng\",\n \"throw\",\n \"thrust\",\n \"thud\",\n \"thug\",\n \"thumb\",\n \"thus\",\n \"thyme\",\n \"tibet\",\n \"tick\",\n \"ticket\",\n \"tidal\",\n \"tide\",\n \"tidy\",\n \"tie\",\n \"tier\",\n \"tiger\",\n \"tight\",\n \"tile\",\n \"till\",\n \"tilt\",\n \"timber\",\n \"time\",\n \"timid\",\n \"tin\",\n \"tiny\",\n \"tip\",\n \"tire\",\n \"tissue\",\n \"title\",\n \"toad\",\n \"toast\",\n \"today\",\n \"toe\",\n \"toilet\",\n \"token\",\n \"tokyo\",\n \"told\",\n \"toll\",\n \"tom\",\n \"tomato\",\n \"tomb\",\n \"tonal\",\n \"tone\",\n \"tongue\",\n \"tonic\",\n \"too\",\n \"took\",\n \"tool\",\n \"tooth\",\n \"top\",\n \"topaz\",\n \"topic\",\n \"torch\",\n \"torque\",\n \"torso\",\n \"tort\",\n \"toss\",\n \"total\",\n \"touch\",\n \"tough\",\n \"tour\",\n \"toward\",\n \"towel\",\n \"tower\",\n \"town\",\n \"toxic\",\n \"toxin\",\n \"toy\",\n \"trace\",\n \"track\",\n \"tract\",\n \"trade\",\n \"tragic\",\n \"trail\",\n \"train\",\n \"trait\",\n \"tram\",\n \"trance\",\n \"trap\",\n \"trauma\",\n \"travel\",\n \"tray\",\n \"tread\",\n \"treat\",\n \"treaty\",\n \"treble\",\n \"tree\",\n \"trek\",\n \"tremor\",\n \"trench\",\n \"trend\",\n \"trendy\",\n \"trial\",\n \"tribal\",\n \"tribe\",\n \"trick\",\n \"tricky\",\n \"tried\",\n \"trifle\",\n \"trim\",\n \"trio\",\n \"trip\",\n \"triple\",\n \"troop\",\n \"trophy\",\n \"trot\",\n \"trough\",\n \"trout\",\n \"truce\",\n \"truck\",\n \"true\",\n \"truly\",\n \"trunk\",\n \"trust\",\n \"truth\",\n \"try\",\n \"tube\",\n \"tumble\",\n \"tuna\",\n \"tundra\",\n \"tune\",\n \"tunic\",\n \"tunnel\",\n \"turban\",\n \"turf\",\n \"turk\",\n \"turkey\",\n \"turn\",\n \"turtle\",\n \"tutor\",\n \"tweed\",\n \"twelve\",\n \"twenty\",\n \"twice\",\n \"twin\",\n \"twist\",\n \"two\",\n \"tycoon\",\n \"tying\",\n \"type\",\n \"tyrant\",\n \"ugly\",\n \"ulcer\",\n \"ultra\",\n \"umpire\",\n \"unable\",\n \"uncle\",\n \"under\",\n \"uneasy\",\n \"unfair\",\n \"unify\",\n \"union\",\n \"unique\",\n \"unit\",\n \"unite\",\n \"unity\",\n \"unlike\",\n \"unrest\",\n \"unruly\",\n \"until\",\n \"update\",\n \"upheld\",\n \"uphill\",\n \"uphold\",\n \"upon\",\n \"upper\",\n \"uproar\",\n \"upset\",\n \"upshot\",\n \"uptake\",\n \"upturn\",\n \"upward\",\n \"urban\",\n \"urge\",\n \"urgent\",\n \"urging\",\n \"urine\",\n \"usable\",\n \"usage\",\n \"use\",\n \"useful\",\n \"user\",\n \"usual\",\n \"utmost\",\n \"utter\",\n \"vacant\",\n \"vacuum\",\n \"vague\",\n \"vain\",\n \"valet\",\n \"valid\",\n \"valley\",\n \"value\",\n \"valve\",\n \"van\",\n \"vanish\",\n \"vanity\",\n \"vary\",\n \"vase\",\n \"vast\",\n \"vat\",\n \"vault\",\n \"vector\",\n \"veil\",\n \"vein\",\n \"velvet\",\n \"vendor\",\n \"veneer\",\n \"venice\",\n \"venom\",\n \"vent\",\n \"venue\",\n \"venus\",\n \"verb\",\n \"verbal\",\n \"verge\",\n \"verify\",\n \"verity\",\n \"verse\",\n \"versus\",\n \"very\",\n \"vessel\",\n \"vest\",\n \"vet\",\n \"veto\",\n \"via\",\n \"viable\",\n \"vicar\",\n \"vice\",\n \"victim\",\n \"victor\",\n \"video\",\n \"vienna\",\n \"view\",\n \"vigil\",\n \"viking\",\n \"vile\",\n \"villa\",\n \"vine\",\n \"vinyl\",\n \"viola\",\n \"violet\",\n \"violin\",\n \"viral\",\n \"virgo\",\n \"virtue\",\n \"virus\",\n \"visa\",\n \"vision\",\n \"visit\",\n \"visual\",\n \"vital\",\n \"vivid\",\n \"vocal\",\n \"vodka\",\n \"vogue\",\n \"voice\",\n \"void\",\n \"volley\",\n \"volume\",\n \"vote\",\n \"vowel\",\n \"voyage\",\n \"vulgar\",\n \"wade\",\n \"wage\",\n \"waist\",\n \"wait\",\n \"waiter\",\n \"wake\",\n \"walk\",\n \"walker\",\n \"wall\",\n \"wallet\",\n \"walnut\",\n \"wander\",\n \"want\",\n \"war\",\n \"warden\",\n \"warm\",\n \"warmth\",\n \"warn\",\n \"warp\",\n \"warsaw\",\n \"wary\",\n \"was\",\n \"wash\",\n \"wasp\",\n \"waste\",\n \"watch\",\n \"water\",\n \"watery\",\n \"wave\",\n \"wax\",\n \"way\",\n \"weak\",\n \"weaken\",\n \"wealth\",\n \"weapon\",\n \"wear\",\n \"weary\",\n \"weave\",\n \"wedge\",\n \"wee\",\n \"weed\",\n \"week\",\n \"weekly\",\n \"weep\",\n \"weigh\",\n \"weight\",\n \"weird\",\n \"well\",\n \"were\",\n \"west\",\n \"wet\",\n \"whale\",\n \"wharf\",\n \"what\",\n \"wheat\",\n \"wheel\",\n \"when\",\n \"whence\",\n \"where\",\n \"which\",\n \"whiff\",\n \"while\",\n \"whim\",\n \"whip\",\n \"whisky\",\n \"white\",\n \"who\",\n \"whole\",\n \"wholly\",\n \"whom\",\n \"whose\",\n \"why\",\n \"wicked\",\n \"wide\",\n \"widely\",\n \"widen\",\n \"wider\",\n \"widow\",\n \"width\",\n \"wife\",\n \"wig\",\n \"wild\",\n \"wildly\",\n \"will\",\n \"willow\",\n \"wily\",\n \"win\",\n \"wind\",\n \"window\",\n \"windy\",\n \"wine\",\n \"wing\",\n \"wink\",\n \"winner\",\n \"winter\",\n \"wipe\",\n \"wire\",\n \"wisdom\",\n \"wise\",\n \"wish\",\n \"wit\",\n \"witch\",\n \"with\",\n \"within\",\n \"witty\",\n \"wizard\",\n \"woke\",\n \"wolf\",\n \"wolves\",\n \"woman\",\n \"womb\",\n \"won\",\n \"wonder\",\n \"wood\",\n \"wooden\",\n \"woods\",\n \"woody\",\n \"wool\",\n \"word\",\n \"work\",\n \"worker\",\n \"world\",\n \"worm\",\n \"worry\",\n \"worse\",\n \"worst\",\n \"worth\",\n \"worthy\",\n \"would\",\n \"wound\",\n \"wrap\",\n \"wrath\",\n \"wreath\",\n \"wreck\",\n \"wring\",\n \"wrist\",\n \"writ\",\n \"write\",\n \"writer\",\n \"wrong\",\n \"xerox\",\n \"yacht\",\n \"yale\",\n \"yard\",\n \"yarn\",\n \"yeah\",\n \"year\",\n \"yeard\",\n \"yeast\",\n \"yellow\",\n \"yet\",\n \"yield\",\n \"yogurt\",\n \"yolk\",\n \"you\",\n \"young\",\n \"your\",\n \"youth\",\n \"zaire\",\n \"zeal\",\n \"zebra\",\n \"zenith\",\n \"zero\",\n \"zeus\",\n \"zigzag\",\n \"zinc\",\n \"zombie\",\n \"zone\",\n]);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/cryptography/src/words/legacy.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/BadEntityIdError.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/BadEntityIdError.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ BadEntityIdError; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\nclass BadEntityIdError extends Error {\n /**\n * @param {Long} shard\n * @param {Long} realm\n * @param {Long} num\n * @param {string} presentChecksum\n * @param {string} expectedChecksum\n */\n constructor(shard, realm, num, presentChecksum, expectedChecksum) {\n super(\n `Entity ID ${shard.toString()}.${realm.toString()}.${num.toString()}-${presentChecksum} was incorrect.`\n );\n\n this.name = \"BadEntityIdException\";\n\n this.shard = shard;\n this.realm = realm;\n this.num = num;\n this.presentChecksum = presentChecksum;\n this.expectedChecksum = expectedChecksum;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/BadEntityIdError.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ISystemDeleteTransactionBody} HashgraphProto.proto.ISystemDeleteTransactionBody + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + * @typedef {import("@hashgraph/proto").proto.IFileID} HashgraphProto.proto.IFileID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +class SystemDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {FileId | string} [props.fileId] + * @param {ContractId | string} [props.contractId] + * @param {Timestamp} [props.expirationTime] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?FileId} + */ + this._fileId = null; + + /** + * @private + * @type {?ContractId} + */ + this._contractId = null; + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = null; + + if (props.fileId != null) { + this.setFileId(props.fileId); + } + + if (props.contractId != null) { + this.setContractId(props.contractId); + } + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {SystemDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const systemDelete = + /** @type {HashgraphProto.proto.ISystemDeleteTransactionBody} */ ( + body.systemDelete + ); + + return Transaction_Transaction._fromProtobufTransactions( + new SystemDeleteTransaction({ + fileId: + systemDelete.fileID != null + ? FileId._fromProtobuf( + /** @type {HashgraphProto.proto.IFileID} */ ( + systemDelete.fileID + ), + ) + : undefined, + contractId: + systemDelete.contractID != null + ? ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + systemDelete.contractID + ), + ) + : undefined, + expirationTime: + systemDelete.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(systemDelete.expirationTime) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * @param {FileId | string} fileId + * @returns {this} + */ + setFileId(fileId) { + this._requireNotFrozen(); + this._fileId = + fileId instanceof FileId ? fileId : FileId.fromString(fileId); + + return this; + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * @param {ContractId | string} contractId + * @returns {this} + */ + setContractId(contractId) { + this._requireNotFrozen(); + this._contractId = + contractId instanceof ContractId_ContractId + ? contractId + : ContractId_ContractId.fromString(contractId); + + return this; + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * @param {Timestamp} expirationTime + * @returns {SystemDeleteTransaction} + */ + setExpirationTime(expirationTime) { + this._requireNotFrozen(); + this._expirationTime = expirationTime; + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + if (this._fileId != null) { + return channel.file.systemDelete(request); + } else { + return channel.smartContract.systemDelete(request); + } + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "systemDelete"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ISystemDeleteTransactionBody} + */ + _makeTransactionData() { + return { + fileID: this._fileId != null ? this._fileId._toProtobuf() : null, + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + expirationTime: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `SystemDeleteTransaction:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +TRANSACTION_REGISTRY.set("systemDelete", SystemDeleteTransaction._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/system/SystemUndeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ISystemUndeleteTransactionBody} HashgraphProto.proto.ISystemUndeleteTransactionBody + * @typedef {import("@hashgraph/proto").proto.IContractID} HashgraphProto.proto.IContractID + * @typedef {import("@hashgraph/proto").proto.IFileID} HashgraphProto.proto.IFileID + */ + +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../Timestamp.js").default} Timestamp + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ + +class SystemUndeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {FileId | string} [props.fileId] + * @param {ContractId | string} [props.contractId] + * @param {Timestamp} [props.expirationTime] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?FileId} + */ + this._fileId = null; + + /** + * @private + * @type {?ContractId} + */ + this._contractId = null; + + if (props.fileId != null) { + this.setFileId(props.fileId); + } + + if (props.contractId != null) { + this.setContractId(props.contractId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {SystemUndeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const systemUndelete = + /** @type {HashgraphProto.proto.ISystemUndeleteTransactionBody} */ ( + body.systemUndelete + ); + + return Transaction_Transaction._fromProtobufTransactions( + new SystemUndeleteTransaction({ + fileId: + systemUndelete.fileID != null + ? FileId._fromProtobuf( + /** @type {HashgraphProto.proto.IFileID} */ ( + systemUndelete.fileID + ), + ) + : undefined, + contractId: + systemUndelete.contractID != null + ? ContractId_ContractId._fromProtobuf( + /** @type {HashgraphProto.proto.IContractID} */ ( + systemUndelete.contractID + ), + ) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?FileId} + */ + get fileId() { + return this._fileId; + } + + /** + * @param {FileId | string} fileId + * @returns {this} + */ + setFileId(fileId) { + this._requireNotFrozen(); + this._fileId = + fileId instanceof FileId ? fileId : FileId.fromString(fileId); + + return this; + } + + /** + * @returns {?ContractId} + */ + get contractId() { + return this._contractId; + } + + /** + * @param {ContractId | string} contractId + * @returns {this} + */ + setContractId(contractId) { + this._requireNotFrozen(); + this._contractId = + contractId instanceof ContractId_ContractId + ? contractId + : ContractId_ContractId.fromString(contractId); + + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + if (this._fileId != null) { + return channel.file.systemUndelete(request); + } else { + return channel.smartContract.systemUndelete(request); + } + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "systemUndelete"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ISystemUndeleteTransactionBody} + */ + _makeTransactionData() { + return { + fileID: this._fileId != null ? this._fileId._toProtobuf() : null, + contractID: + this._contractId != null + ? this._contractId._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `SystemUndeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "systemUndelete", + // eslint-disable-next-line @typescript-eslint/unbound-method + SystemUndeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenAssociateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/Cache.js": -/*!**************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Cache.js ***! - \**************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @typedef {import(\"./contract/ContractId.js\").default} ContractId\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./KeyList.js\").default} KeyList\n * @typedef {import(\"./PublicKey.js\").default} PublicKey\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n * @typedef {import(\"./EvmAddress.js\").default} EvmAddress\n * @typedef {import(\"./EthereumTransactionData.js\").default} EthereumTransactionData\n * @typedef {import(\"./transaction/TransactionReceiptQuery.js\").default} TransactionReceiptQuery\n * @typedef {import(\"./transaction/TransactionRecordQuery.js\").default} TransactionRecordQuery\n * @typedef {import(\"./network/AddressBookQuery.js\").default} AddressBookQuery\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.IKeyList} HashgraphProto.proto.IKeyList\n * @typedef {import(\"@hashgraph/proto\").proto.IThresholdKey} HashgraphProto.proto.IThresholdKey\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n */\n\n/**\n * @namespace cryptography\n * @typedef {import(\"@hashgraph/cryptography\").PrivateKey} cryptography.PrivateKey\n */\n\n/**\n * @template {object} ProtobufT\n * @template {object} SdkT\n * @typedef {{ (proto: ProtobufT): SdkT }} FromProtobufKeyFuncT\n */\n\n/**\n * This variable is strictly designed to prevent cyclic dependencies.\n */\nclass Cache {\n constructor() {\n /** @type {number} */\n this._timeDrift = 0;\n\n /** @type {FromProtobufKeyFuncT | null} */\n this._contractId = null;\n\n /** @type {FromProtobufKeyFuncT | null} */\n this._keyList = null;\n\n /** @type {FromProtobufKeyFuncT | null} */\n this._thresholdKey = null;\n\n /** @type {FromProtobufKeyFuncT | null} */\n this._publicKeyED25519 = null;\n\n /** @type {FromProtobufKeyFuncT | null} */\n this._publicKeyECDSA = null;\n\n /** @type {((key: cryptography.PrivateKey) => PrivateKey) | null} */\n this._privateKeyConstructor = null;\n\n /** @type {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId) | null} */\n this._accountIdConstructor = null;\n\n /** @type {FromProtobufKeyFuncT | null} */\n this._delegateContractId = null;\n\n /** @type {FromProtobufKeyFuncT | null} */\n this._evmAddress = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataLegacyFromBytes = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataEip1559FromBytes = null;\n\n /** @type {(() => TransactionReceiptQuery) | null} */\n this._transactionReceiptQueryConstructor = null;\n\n /** @type {(() => TransactionRecordQuery) | null} */\n this._transactionRecordQueryConstructor = null;\n }\n\n /**\n * @param {number} timeDrift\n */\n setTimeDrift(timeDrift) {\n this._timeDrift = timeDrift;\n }\n\n /**\n * @returns {number}\n */\n get timeDrift() {\n if (this._timeDrift == null) {\n throw new Error(\"Cache.timeDrift was used before it was set\");\n }\n\n return this._timeDrift;\n }\n\n /**\n * @param {FromProtobufKeyFuncT} contractId\n */\n setContractId(contractId) {\n this._contractId = contractId;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT}\n */\n get contractId() {\n if (this._contractId == null) {\n throw new Error(\"Cache.contractId was used before it was set\");\n }\n\n return this._contractId;\n }\n\n /**\n * @param {FromProtobufKeyFuncT} keyList\n */\n setKeyList(keyList) {\n this._keyList = keyList;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT}\n */\n get keyList() {\n if (this._keyList == null) {\n throw new Error(\"Cache.keyList was used before it was set\");\n }\n\n return this._keyList;\n }\n\n /**\n * @param {FromProtobufKeyFuncT} thresholdKey\n */\n setThresholdKey(thresholdKey) {\n this._thresholdKey = thresholdKey;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT}\n */\n get thresholdKey() {\n if (this._thresholdKey == null) {\n throw new Error(\"Cache.thresholdKey was used before it was set\");\n }\n\n return this._thresholdKey;\n }\n\n /**\n * @param {FromProtobufKeyFuncT} publicKeyED25519\n */\n setPublicKeyED25519(publicKeyED25519) {\n this._publicKeyED25519 = publicKeyED25519;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT}\n */\n get publicKeyED25519() {\n if (this._publicKeyED25519 == null) {\n throw new Error(\n \"Cache.publicKeyED25519 was used before it was set\"\n );\n }\n\n return this._publicKeyED25519;\n }\n\n /**\n * @param {FromProtobufKeyFuncT} publicKeyECDSA\n */\n setPublicKeyECDSA(publicKeyECDSA) {\n this._publicKeyECDSA = publicKeyECDSA;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT}\n */\n get publicKeyECDSA() {\n if (this._publicKeyECDSA == null) {\n throw new Error(\"Cache.publicKeyECDSA was used before it was set\");\n }\n\n return this._publicKeyECDSA;\n }\n\n /**\n * @param {((key: cryptography.PrivateKey) => PrivateKey)} privateKeyConstructor\n */\n setPrivateKeyConstructor(privateKeyConstructor) {\n this._privateKeyConstructor = privateKeyConstructor;\n }\n\n /**\n * @returns {((key: cryptography.PrivateKey) => PrivateKey)}\n */\n get privateKeyConstructor() {\n if (this._privateKeyConstructor == null) {\n throw new Error(\n \"Cache.privateKeyConstructor was used before it was set\"\n );\n }\n\n return this._privateKeyConstructor;\n }\n\n /**\n * @param {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)} accountIdConstructor\n */\n setAccountIdConstructor(accountIdConstructor) {\n this._accountIdConstructor = accountIdConstructor;\n }\n\n /**\n * @returns {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)}\n */\n get accountIdConstructor() {\n if (this._accountIdConstructor == null) {\n throw new Error(\n \"Cache.accountIdConstructor was used before it was set\"\n );\n }\n\n return this._accountIdConstructor;\n }\n\n /**\n * @param {FromProtobufKeyFuncT} delegateContractId\n */\n setDelegateContractId(delegateContractId) {\n this._delegateContractId = delegateContractId;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT}\n */\n get delegateContractId() {\n if (this._delegateContractId == null) {\n throw new Error(\n \"Cache.delegateContractId was used before it was set\"\n );\n }\n\n return this._delegateContractId;\n }\n\n /**\n * @param {FromProtobufKeyFuncT} evmAddress\n */\n setEvmAddress(evmAddress) {\n this._evmAddress = evmAddress;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT}\n */\n get evmAddress() {\n if (this._evmAddress == null) {\n throw new Error(\"Cache.evmAddress was used before it was set\");\n }\n\n return this._evmAddress;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataLegacyFromBytes\n */\n setEthereumTransactionDataLegacyFromBytes(\n ethereumTransactionDataLegacyFromBytes\n ) {\n this._ethereumTransactionDataLegacyFromBytes =\n ethereumTransactionDataLegacyFromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataLegacyFromBytes() {\n if (this._ethereumTransactionDataLegacyFromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataLegacyFromBytes was used before it was set\"\n );\n }\n\n return this._ethereumTransactionDataLegacyFromBytes;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip1559FromBytes\n */\n setEthereumTransactionDataEip1559FromBytes(\n ethereumTransactionDataEip1559FromBytes\n ) {\n this._ethereumTransactionDataEip1559FromBytes =\n ethereumTransactionDataEip1559FromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataEip1559FromBytes() {\n if (this._ethereumTransactionDataEip1559FromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataEip1559FromBytes was used before it was set\"\n );\n }\n\n return this._ethereumTransactionDataEip1559FromBytes;\n }\n\n /**\n * @param {(() => TransactionReceiptQuery)} transactionReceiptQueryConstructor\n */\n setTransactionReceiptQueryConstructor(transactionReceiptQueryConstructor) {\n this._transactionReceiptQueryConstructor =\n transactionReceiptQueryConstructor;\n }\n\n /**\n * @returns {(() => TransactionReceiptQuery)}\n */\n get transactionReceiptQueryConstructor() {\n if (this._transactionReceiptQueryConstructor == null) {\n throw new Error(\n \"Cache.transactionReceiptQueryConstructor was used before it was set\"\n );\n }\n\n return this._transactionReceiptQueryConstructor;\n }\n\n /**\n * @param {(() => TransactionRecordQuery)} transactionRecordQueryConstructor\n */\n setTransactionRecordQueryConstructor(transactionRecordQueryConstructor) {\n this._transactionRecordQueryConstructor =\n transactionRecordQueryConstructor;\n }\n\n /**\n * @returns {(() => TransactionRecordQuery)}\n */\n get transactionRecordQueryConstructor() {\n if (this._transactionRecordQueryConstructor == null) {\n throw new Error(\n \"Cache.transactionRecordQueryConstructor was used before it was set\"\n );\n }\n\n return this._transactionRecordQueryConstructor;\n }\n\n /**\n * @param {() => AddressBookQuery} addressBookQueryConstructor\n */\n setAddressBookQueryConstructor(addressBookQueryConstructor) {\n this._addressBookQueryConstructor = addressBookQueryConstructor;\n }\n\n /**\n * @returns {() => AddressBookQuery}\n */\n get addressBookQueryConstructor() {\n if (this._addressBookQueryConstructor == null) {\n throw new Error(\n \"Cache.addressBookQueryConstructor was used before it was set\"\n );\n }\n\n return this._addressBookQueryConstructor;\n }\n}\n\nconst CACHE = new Cache();\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (CACHE);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Cache.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/Duration.js": -/*!*****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Duration.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenAssociateTransactionBody} HashgraphProto.proto.ITokenAssociateTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Duration; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IDuration} HashgraphProto.proto.IDuration\n */\n\n/**\n * A duration type.\n *\n * The main point of this tyope is for encapsulating the `[to|from]Protobuf()` implementations\n */\nclass Duration {\n /**\n * @param {Long | number} seconds\n */\n constructor(seconds) {\n /**\n * @readonly\n * @type {Long}\n */\n this.seconds =\n seconds instanceof long__WEBPACK_IMPORTED_MODULE_0__ ? seconds : long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(seconds);\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IDuration}\n */\n _toProtobuf() {\n return {\n seconds: this.seconds,\n };\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IDuration} duration\n * @returns {Duration}\n */\n static _fromProtobuf(duration) {\n return new Duration(/** @type {Long} */ (duration.seconds));\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Duration.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ }), +/** + * Associate a new Hedera™ crypto-currency token. + */ +class TokenAssociateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {(TokenId | string)[]} [props.tokenIds] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId[]} + */ + this._tokenIds = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + + if (props.tokenIds != null) { + this.setTokenIds(props.tokenIds); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenAssociateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const associateToken = + /** @type {HashgraphProto.proto.ITokenAssociateTransactionBody} */ ( + body.tokenAssociate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenAssociateTransaction({ + tokenIds: + associateToken.tokens != null + ? associateToken.tokens.map((token) => + TokenId_TokenId._fromProtobuf(token), + ) + : undefined, + accountId: + associateToken.account != null + ? AccountId_AccountId._fromProtobuf(associateToken.account) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId[]} + */ + get tokenIds() { + return this._tokenIds; + } + + /** + * @param {(TokenId | string)[]} tokenIds + * @returns {this} + */ + setTokenIds(tokenIds) { + this._requireNotFrozen(); + this._tokenIds = tokenIds.map((tokenId) => + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(), + ); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + + for (const tokenId of this._tokenIds != null ? this._tokenIds : []) { + if (tokenId != null) { + tokenId.validateChecksum(client); + } + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.associateTokens(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenAssociate"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenAssociateTransactionBody} + */ + _makeTransactionData() { + return { + tokens: + this._tokenIds != null + ? this._tokenIds.map((tokenId) => tokenId._toProtobuf()) + : null, + account: + this._accountId != null ? this._accountId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenAssociateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenAssociate", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenAssociateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenBurnTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/EntityIdHelper.js": -/*!***********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/EntityIdHelper.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"_checksum\": function() { return /* binding */ _checksum; },\n/* harmony export */ \"_parseAddress\": function() { return /* binding */ _parseAddress; },\n/* harmony export */ \"compare\": function() { return /* binding */ compare; },\n/* harmony export */ \"constructor\": function() { return /* binding */ constructor; },\n/* harmony export */ \"fromSolidityAddress\": function() { return /* binding */ fromSolidityAddress; },\n/* harmony export */ \"fromString\": function() { return /* binding */ fromString; },\n/* harmony export */ \"fromStringSplitter\": function() { return /* binding */ fromStringSplitter; },\n/* harmony export */ \"toSolidityAddress\": function() { return /* binding */ toSolidityAddress; },\n/* harmony export */ \"toStringWithChecksum\": function() { return /* binding */ toStringWithChecksum; },\n/* harmony export */ \"validateChecksum\": function() { return /* binding */ validateChecksum; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _BadEntityIdError_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BadEntityIdError.js */ \"./node_modules/@hashgraph/sdk/src/BadEntityIdError.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @typedef {object} IEntityId\n * @property {number | Long} num\n * @property {(number | Long)=} shard\n * @property {(number | Long)=} realm\n */\n\n/**\n * @typedef {object} IEntityIdResult\n * @property {Long} shard\n * @property {Long} realm\n * @property {Long} num\n */\n\n/**\n * @typedef {object} IEntityIdParts\n * @property {string?} shard\n * @property {string?} realm\n * @property {string} numOrHex\n * @property {string?} checksum\n */\n\n/**\n * @typedef {object} IEntityIdResultWithChecksum\n * @property {Long} shard\n * @property {Long} realm\n * @property {Long} num\n * @property {string | null} checksum\n */\n\nconst regex =\n /\"^(0|(?:[1-9]\\\\d*))\\\\.(0|(?:[1-9]\\\\d*))\\\\.(0|(?:[1-9]\\\\d*))(?:-([a-z]{5}))?$/;\n\n/**\n * This regex supports entity IDs\n * - as stand alone nubmers\n * - as shard.realm.num\n * - as shard.realm.hex\n * - can optionally provide checksum for any of the above\n */\nconst ENTITY_ID_REGEX = /^(\\d+)(?:\\.(\\d+)\\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/;\n\n/**\n * This method is called by most entity ID constructors. It's purpose is to\n * deduplicate the constuctors.\n *\n * @param {number | Long | IEntityId} props\n * @param {(number | null | Long)=} realmOrNull\n * @param {(number | null | Long)=} numOrNull\n * @returns {IEntityIdResult}\n */\nfunction constructor(props, realmOrNull, numOrNull) {\n // Make sure either both the second and third parameter are\n // set or not set; we shouldn't have one set, but the other not set.\n //\n //NOSONAR\n if (\n (realmOrNull == null && numOrNull != null) ||\n (realmOrNull != null && numOrNull == null)\n ) {\n throw new Error(\"invalid entity ID\");\n }\n\n // If the first parameter is a nubmer then we need to conver the\n // first, second, and third parameters into numbers. Otherwise,\n // we should look at the fields `shard`, `realm`, and `num` on\n // `props`\n const [shard, realm, num] =\n typeof props === \"number\" || long__WEBPACK_IMPORTED_MODULE_0__.isLong(props)\n ? [\n numOrNull != null\n ? long__WEBPACK_IMPORTED_MODULE_0__.fromValue(/** @type {Long | number} */ (props))\n : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n realmOrNull != null ? long__WEBPACK_IMPORTED_MODULE_0__.fromValue(realmOrNull) : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n numOrNull != null\n ? long__WEBPACK_IMPORTED_MODULE_0__.fromValue(numOrNull)\n : long__WEBPACK_IMPORTED_MODULE_0__.fromValue(/** @type {Long | number} */ (props)),\n ]\n : [\n props.shard != null ? long__WEBPACK_IMPORTED_MODULE_0__.fromValue(props.shard) : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n props.realm != null ? long__WEBPACK_IMPORTED_MODULE_0__.fromValue(props.realm) : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n long__WEBPACK_IMPORTED_MODULE_0__.fromValue(props.num),\n ];\n\n // Make sure none of the numbers are negative\n if (shard.isNegative() || realm.isNegative() || num.isNegative()) {\n throw new Error(\"negative numbers are not allowed in IDs\");\n }\n\n return {\n shard,\n realm,\n num,\n };\n}\n\n/**\n * A simple comparison function for comparing entity IDs\n *\n * @param {[Long, Long, Long]} a\n * @param {[Long, Long, Long]} b\n * @returns {number}\n */\nfunction compare(a, b) {\n let comparison = a[0].compare(b[0]);\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = a[1].compare(b[1]);\n if (comparison != 0) {\n return comparison;\n }\n\n return a[2].compare(b[2]);\n}\n\n/**\n * This type is part of the entity ID checksums feature which\n * is responsible for checking if an entity ID was created on\n * the same ledger ID as the client is currently using.\n *\n * @typedef {object} ParseAddressResult\n * @property {number} status\n * @property {Long} [num1]\n * @property {Long} [num2]\n * @property {Long} [num3]\n * @property {string} [correctChecksum]\n * @property {string} [givenChecksum]\n * @property {string} [noChecksumFormat]\n * @property {string} [withChecksumFormat]\n */\n\n/**\n * @param {string} text\n * @returns {IEntityIdParts}\n */\nfunction fromStringSplitter(text) {\n const match = ENTITY_ID_REGEX.exec(text);\n\n if (match == null) {\n throw new Error(`failed to parse entity id: ${text}`);\n }\n\n if (match[2] == null && match[3] == null) {\n return {\n shard: \"0\",\n realm: \"0\",\n numOrHex: match[1],\n checksum: match[4],\n };\n } else {\n return {\n shard: match[1],\n realm: match[2],\n numOrHex: match[3],\n checksum: match[4],\n };\n }\n}\n\n/**\n * @param {string} text\n * @returns {IEntityIdResultWithChecksum}\n */\nfunction fromString(text) {\n const result = fromStringSplitter(text);\n\n if (\n Number.isNaN(result.shard) ||\n Number.isNaN(result.realm) ||\n Number.isNaN(result.numOrHex)\n ) {\n throw new Error(\"invalid format for entity ID\");\n }\n\n return {\n shard: result.shard != null ? long__WEBPACK_IMPORTED_MODULE_0__.fromString(result.shard) : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n realm: result.realm != null ? long__WEBPACK_IMPORTED_MODULE_0__.fromString(result.realm) : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n num: long__WEBPACK_IMPORTED_MODULE_0__.fromString(result.numOrHex),\n checksum: result.checksum,\n };\n}\n\n/**\n * Return the shard, realm, and num from a solidity address.\n *\n * Solidity addresses are 20 bytes long and hex encoded, where the first 4\n * bytes represent the shard, the next 8 bytes represent the realm, and\n * the last 8 bytes represent the num. All in Big Endian format\n *\n * @param {string} address\n * @returns {[Long, Long, Long]}\n */\nfunction fromSolidityAddress(address) {\n const addr = address.startsWith(\"0x\")\n ? _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(address.slice(2))\n : _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(address);\n\n if (addr.length !== 20) {\n throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${address.length}`);\n }\n\n const shard = long__WEBPACK_IMPORTED_MODULE_0__.fromBytesBE([0, 0, 0, 0, ...addr.slice(0, 4)]);\n const realm = long__WEBPACK_IMPORTED_MODULE_0__.fromBytesBE(Array.from(addr.slice(4, 12)));\n const num = long__WEBPACK_IMPORTED_MODULE_0__.fromBytesBE(Array.from(addr.slice(12, 20)));\n\n return [shard, realm, num];\n}\n\n/**\n * Convert shard, realm, and num into a solidity address.\n *\n * See `fromSolidityAddress()` for more documentation.\n *\n * @param {[Long,Long,Long] | [number,number,number]} address\n * @returns {string}\n */\nfunction toSolidityAddress(address) {\n const buffer = new Uint8Array(20);\n const view = _util_js__WEBPACK_IMPORTED_MODULE_3__.safeView(buffer);\n const [shard, realm, num] = address;\n\n view.setUint32(0, _util_js__WEBPACK_IMPORTED_MODULE_3__.convertToNumber(shard));\n view.setUint32(8, _util_js__WEBPACK_IMPORTED_MODULE_3__.convertToNumber(realm));\n view.setUint32(16, _util_js__WEBPACK_IMPORTED_MODULE_3__.convertToNumber(num));\n\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.encode(buffer);\n}\n\n/**\n * Parse the address string addr and return an object with the results (8 fields).\n * The first four fields are numbers, which could be implemented as signed 32 bit\n * integers, and the last four are strings.\n *\n * status; //the status of the parsed address\n * // 0 = syntax error\n * // 1 = an invalid with-checksum address (bad checksum)\n * // 2 = a valid no-checksum address\n * // 3 = a valid with-checksum address\n * num1; //the 3 numbers in the address, such as 1.2.3, with leading zeros removed\n * num2;\n * num3;\n * correctchecksum; //the correct checksum\n * givenChecksum; //the checksum in the address that was parsed\n * noChecksumFormat; //the address in no-checksum format\n * withChecksumFormat; //the address in with-checksum format\n *\n * @param {Uint8Array} ledgerId\n * @param {string} addr\n * @returns {ParseAddressResult}\n */\nfunction _parseAddress(ledgerId, addr) {\n let match = regex.exec(addr);\n if (match === null) {\n let result = { status: 0 }; // When status == 0, the rest of the fields should be ignored\n return result;\n }\n let a = [\n long__WEBPACK_IMPORTED_MODULE_0__.fromString(match[1]),\n long__WEBPACK_IMPORTED_MODULE_0__.fromString(match[2]),\n long__WEBPACK_IMPORTED_MODULE_0__.fromString(match[3]),\n ];\n let ad = `${a[0].toString()}.${a[1].toString()}.${a[2].toString()}`;\n let c = _checksum(ledgerId, ad);\n let s = match[4] === undefined ? 2 : c == match[4] ? 3 : 1; //NOSONAR\n return {\n status: s,\n num1: a[0],\n num2: a[1],\n num3: a[2],\n givenChecksum: match[4],\n correctChecksum: c,\n noChecksumFormat: ad,\n withChecksumFormat: `${ad}-${c}`,\n };\n}\n\n/**\n * Given an address like \"0.0.123\", return a checksum like \"laujm\"\n *\n * @param {Uint8Array} ledgerId\n * @param {string} addr\n * @returns {string}\n */\nfunction _checksum(ledgerId, addr) {\n let answer = \"\";\n let d = []; // Digits with 10 for \".\", so if addr == \"0.0.123\" then d == [0, 10, 0, 10, 1, 2, 3]\n let s0 = 0; // Sum of even positions (mod 11)\n let s1 = 0; // Sum of odd positions (mod 11)\n let s = 0; // Weighted sum of all positions (mod p3)\n let sh = 0; // Hash of the ledger ID\n let c = 0; // The checksum, as a single number\n const p3 = 26 * 26 * 26; // 3 digits in base 26\n const p5 = 26 * 26 * 26 * 26 * 26; // 5 digits in base 26\n const ascii_a = \"a\".charCodeAt(0); // 97\n const m = 1000003; // Min prime greater than a million. Used for the final permutation.\n const w = 31; // Sum s of digit values weights them by powers of w. Should be coprime to p5.\n\n let h = new Uint8Array(ledgerId.length + 6);\n h.set(ledgerId, 0);\n h.set([0, 0, 0, 0, 0, 0], ledgerId.length);\n for (let i = 0; i < addr.length; i++) {\n //NOSONAR\n d.push(addr[i] === \".\" ? 10 : parseInt(addr[i], 10));\n }\n for (let i = 0; i < d.length; i++) {\n s = (w * s + d[i]) % p3;\n if (i % 2 === 0) {\n s0 = (s0 + d[i]) % 11;\n } else {\n s1 = (s1 + d[i]) % 11;\n }\n }\n for (let i = 0; i < h.length; i++) {\n sh = (w * sh + h[i]) % p5;\n }\n c = ((((addr.length % 5) * 11 + s0) * 11 + s1) * p3 + s + sh) % p5;\n c = (c * m) % p5;\n\n for (let i = 0; i < 5; i++) {\n answer = String.fromCharCode(ascii_a + (c % 26)) + answer;\n c /= 26;\n }\n\n return answer;\n}\n\n/**\n * Validate an entity ID checksum against a client\n *\n * @param {Long} shard\n * @param {Long} realm\n * @param {Long} num\n * @param {string | null} checksum\n * @param {Client} client\n */\nfunction validateChecksum(shard, realm, num, checksum, client) {\n if (client._network._ledgerId == null || checksum == null) {\n return;\n }\n\n const expectedChecksum = _checksum(\n client._network._ledgerId._ledgerId,\n `${shard.toString()}.${realm.toString()}.${num.toString()}`\n );\n\n if (checksum != expectedChecksum) {\n throw new _BadEntityIdError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n shard,\n realm,\n num,\n checksum,\n expectedChecksum\n );\n }\n}\n\n/**\n * Stringify the entity ID with a checksum.\n *\n * @param {string} string\n * @param {Client} client\n * @returns {string}\n */\nfunction toStringWithChecksum(string, client) {\n if (client._network._ledgerId == null) {\n throw new Error(\n \"cannot calculate checksum with a client that does not contain a recognzied ledger ID\"\n );\n }\n\n const checksum = _checksum(client._network._ledgerId._ledgerId, string);\n\n return `${string}-${checksum}`;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/EntityIdHelper.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/EthereumFlow.js": -/*!*********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/EthereumFlow.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EthereumFlow; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _EthereumTransaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EthereumTransaction.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransaction.js\");\n/* harmony import */ var _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./EthereumTransactionData.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js\");\n/* harmony import */ var _file_FileCreateTransaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./file/FileCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileCreateTransaction.js\");\n/* harmony import */ var _file_FileAppendTransaction_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./file/FileAppendTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileAppendTransaction.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IEthereumTransactionBody} HashgraphProto.proto.IEthereumTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./file/FileId.js\").default} FileId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./Timestamp.js\").default} Timestamp\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"long\").Long} Long\n */\n\n/**\n * Create a new Hedera™ transaction wrapped ethereum transaction.\n */\nclass EthereumFlow {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.ethereumData]\n * @param {FileId} [props.callData]\n * @param {number | string | Long | BigNumber | Hbar} [props.maxGasAllowance]\n */\n constructor(props = {}) {\n /**\n * @private\n * @type {?EthereumTransactionData}\n */\n this._ethereumData = null;\n\n /**\n * @private\n * @type {?FileId}\n */\n this._callDataFileId = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._maxGasAllowance = null;\n\n if (props.ethereumData != null) {\n this.setEthereumData(props.ethereumData);\n }\n\n if (props.maxGasAllowance != null) {\n this.setMaxGasAllowanceHbar(props.maxGasAllowance);\n }\n\n this._maxChunks = null;\n }\n\n /**\n * @returns {number | null}\n */\n get maxChunks() {\n return this._maxChunks;\n }\n\n /**\n * @param {number} maxChunks\n * @returns {this}\n */\n setMaxChunks(maxChunks) {\n this._maxChunks = maxChunks;\n return this;\n }\n\n /**\n * @returns {?EthereumTransactionData}\n */\n get ethereumData() {\n return this._ethereumData;\n }\n\n /**\n * The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete\n * unless the callData field is set.\n *\n * @param {EthereumTransactionData | Uint8Array} ethereumData\n * @returns {this}\n */\n setEthereumData(ethereumData) {\n this._ethereumData =\n ethereumData instanceof Uint8Array\n ? _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromBytes(ethereumData)\n : ethereumData;\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get maxGasAllowance() {\n return this._maxGasAllowance;\n }\n\n /**\n * @deprecated - use masGasAllowanceHbar instead.\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowance(maxGasAllowance) {\n return this.setMaxGasAllowanceHbar(maxGasAllowance);\n }\n\n /**\n * The maximum amount, in tinybars, that the payer of the hedera transaction\n * is willing to pay to complete the transaction.\n *\n * Ordinarily the account with the ECDSA alias corresponding to the public\n * key that is extracted from the ethereum_data signature is responsible for\n * fees that result from the execution of the transaction. If that amount of\n * authorized fees is not sufficient then the payer of the transaction can be\n * charged, up to but not exceeding this amount. If the ethereum_data\n * transaction authorized an amount that was insufficient then the payer will\n * only be charged the amount needed to make up the difference. If the gas\n * price in the transaction was set to zero then the payer will be assessed\n * the entire fee.\n *\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowanceHbar(maxGasAllowance) {\n this._maxGasAllowance =\n maxGasAllowance instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? maxGasAllowance\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](maxGasAllowance);\n return this;\n }\n\n /**\n * @template {Channel} ChannelT\n * @template MirrorChannelT\n * @param {import(\"./client/Client.js\").default} client\n * @returns {Promise}\n */\n async execute(client) {\n if (this._ethereumData == null) {\n throw new Error(\n \"cannot submit ethereum transaction with no ethereum data\"\n );\n }\n\n const ethereumTransaction = new _EthereumTransaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n const ethereumTransactionDataBytes = this._ethereumData.toBytes();\n\n if (this._maxGasAllowance != null) {\n ethereumTransaction.setMaxGasAllowanceHbar(this._maxGasAllowance);\n }\n\n if (this._callDataFileId != null) {\n if (this._ethereumData.callData.length === 0) {\n throw new Error(\n \"call data file ID provided, but ethereum data already contains call data\"\n );\n }\n\n ethereumTransaction\n .setEthereumData(ethereumTransactionDataBytes)\n .setCallDataFileId(this._callDataFileId);\n } else if (ethereumTransactionDataBytes.length <= 5120) {\n ethereumTransaction.setEthereumData(ethereumTransactionDataBytes);\n } else {\n const fileId = await createFile(\n this._ethereumData.callData,\n client,\n this._maxChunks\n );\n\n this._ethereumData.callData = new Uint8Array();\n\n ethereumTransaction\n .setEthereumData(this._ethereumData.toBytes())\n .setCallDataFileId(fileId);\n }\n\n return ethereumTransaction.execute(client);\n }\n}\n\n/**\n * @template {Channel} ChannelT\n * @template MirrorChannelT\n * @param {Uint8Array} callData\n * @param {import(\"./client/Client.js\").default} client\n * @param {?number} maxChunks\n * @returns {Promise}\n */\nasync function createFile(callData, client, maxChunks) {\n const hexedCallData = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__.encode(callData);\n\n const fileId = /** @type {FileId} */ (\n (\n await (\n await new _file_FileCreateTransaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]()\n .setContents(hexedCallData.substring(0, 4096))\n .setKeys(\n client.operatorPublicKey\n ? [client.operatorPublicKey]\n : []\n )\n .execute(client)\n ).getReceipt(client)\n ).fileId\n );\n\n if (callData.length > 4096) {\n let fileAppendTransaction = new _file_FileAppendTransaction_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]()\n .setFileId(fileId)\n .setContents(hexedCallData.substring(4096, hexedCallData.length));\n if (maxChunks != null) {\n fileAppendTransaction.setMaxChunks(maxChunks);\n }\n\n await (await fileAppendTransaction.execute(client)).getReceipt(client);\n }\n\n return fileId;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/EthereumFlow.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenBurnTransactionBody} HashgraphProto.proto.ITokenBurnTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ "./node_modules/@hashgraph/sdk/src/EthereumTransaction.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/EthereumTransaction.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Burn a new Hedera™ crypto-currency token. + */ +class TokenBurnTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {Long | number} [props.amount] + * @param {(Long | number)[]} [props.serials] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?Long} + */ + this._amount = null; + + /** + * @private + * @type {Long[]} + */ + this._serials = []; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.amount != null) { + this.setAmount(props.amount); + } + + if (props.serials != null) { + this.setSerials(props.serials); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenBurnTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const burnToken = + /** @type {HashgraphProto.proto.ITokenBurnTransactionBody} */ ( + body.tokenBurn + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenBurnTransaction({ + tokenId: + burnToken.token != null + ? TokenId_TokenId._fromProtobuf(burnToken.token) + : undefined, + amount: burnToken.amount != null ? burnToken.amount : undefined, + serials: + burnToken.serialNumbers != null + ? burnToken.serialNumbers + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?Long} + */ + get amount() { + return this._amount; + } + + /** + * @param {Long | number} amount + * @returns {this} + */ + setAmount(amount) { + this._requireNotFrozen(); + this._amount = amount instanceof src_long ? amount : src_long.fromValue(amount); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + } + + /** + * @returns {Long[]} + */ + get serials() { + return this._serials; + } + + /** + * @param {(Long | number)[]} serials + * @returns {this} + */ + setSerials(serials) { + this._requireNotFrozen(); + this._serials = serials.map((serial) => + serial instanceof src_long ? serial : src_long.fromValue(serial), + ); + + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.burnToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenBurn"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenBurnTransactionBody} + */ + _makeTransactionData() { + return { + amount: this._amount, + serialNumbers: this._serials, + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenBurnTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenBurn", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenBurnTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenReference.js + + + +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.TokenReference} HashgraphProto.proto.TokenReference + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EthereumTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IEthereumTransactionBody} HashgraphProto.proto.IEthereumTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./Timestamp.js\").default} Timestamp\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"long\").Long} Long\n */\n\n/**\n * Create a new Hedera™ transaction wrapped ethereum transaction.\n */\nclass EthereumTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.ethereumData]\n * @param {FileId} [props.callData]\n * @param {FileId} [props.callDataFileId]\n * @param {number | string | Long | BigNumber | Hbar} [props.maxGasAllowance]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._ethereumData = null;\n\n /**\n * @private\n * @type {?FileId}\n */\n this._callDataFileId = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._maxGasAllowance = null;\n\n if (props.ethereumData != null) {\n this.setEthereumData(props.ethereumData);\n }\n\n if (props.callData != null) {\n this.setCallDataFileId(props.callData);\n }\n\n if (props.callDataFileId != null) {\n this.setCallDataFileId(props.callDataFileId);\n }\n\n if (props.maxGasAllowance != null) {\n this.setMaxGasAllowanceHbar(props.maxGasAllowance);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {EthereumTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const transaction =\n /** @type {HashgraphProto.proto.IEthereumTransactionBody} */ (\n body.ethereumTransaction\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new EthereumTransaction({\n ethereumData:\n transaction.ethereumData != null\n ? transaction.ethereumData\n : undefined,\n callData:\n transaction.callData != null\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(transaction.callData)\n : undefined,\n maxGasAllowance:\n transaction.maxGasAllowance != null\n ? _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromTinybars(transaction.maxGasAllowance)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?(Uint8Array | FileId)}\n */\n get ethereumData() {\n return this._ethereumData;\n }\n\n /**\n * The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete\n * unless the callData field is set.\n *\n * @param {Uint8Array} ethereumData\n * @returns {this}\n */\n setEthereumData(ethereumData) {\n this._requireNotFrozen();\n this._ethereumData = ethereumData;\n return this;\n }\n\n /**\n * @deprecated - Use `callDataFileId` instead\n * @returns {?FileId}\n */\n get callData() {\n return this.callDataFileId;\n }\n\n /**\n * @deprecated - Use `setCallDataFileId()` instead\n *\n * For large transactions (for example contract create) this is the callData\n * of the callData. The data in the callData will be re-written with\n * the callData element as a zero length string with the original contents in\n * the referenced file at time of execution. The callData will need to be\n * \"rehydrated\" with the callData for signature validation to pass.\n * @param {FileId} callDataFileId\n * @returns {this}\n */\n setCallData(callDataFileId) {\n return this.setCallDataFileId(callDataFileId);\n }\n\n /**\n * @returns {?FileId}\n */\n get callDataFileId() {\n return this._callDataFileId;\n }\n\n /**\n * For large transactions (for example contract create) this is the callData\n * of the callData. The data in the callData will be re-written with\n * the callData element as a zero length string with the original contents in\n * the referenced file at time of execution. The callData will need to be\n * \"rehydrated\" with the callData for signature validation to pass.\n *\n * @param {FileId} callDataFileId\n * @returns {this}\n */\n setCallDataFileId(callDataFileId) {\n this._requireNotFrozen();\n this._callDataFileId = callDataFileId;\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get maxGasAllowance() {\n return this._maxGasAllowance;\n }\n\n /**\n * @deprecated -- use setMaxGasAllowanceHbar instead\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowance(maxGasAllowance) {\n return this.setMaxGasAllowanceHbar(maxGasAllowance);\n }\n\n /**\n * The maximum amount, in tinybars, that the payer of the hedera transaction\n * is willing to pay to complete the transaction.\n *\n * Ordinarily the account with the ECDSA alias corresponding to the public\n * key that is extracted from the ethereum_data signature is responsible for\n * fees that result from the execution of the transaction. If that amount of\n * authorized fees is not sufficient then the payer of the transaction can be\n * charged, up to but not exceeding this amount. If the ethereum_data\n * transaction authorized an amount that was insufficient then the payer will\n * only be charged the amount needed to make up the difference. If the gas\n * price in the transaction was set to zero then the payer will be assessed\n * the entire fee.\n *\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowanceHbar(maxGasAllowance) {\n this._requireNotFrozen();\n this._maxGasAllowance =\n maxGasAllowance instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? maxGasAllowance\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](maxGasAllowance);\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (\n this._ethereumData != null &&\n this._ethereumData instanceof _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ) {\n this._ethereumData.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.callEthereum(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"ethereumTransaction\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IEthereumTransactionBody}\n */\n _makeTransactionData() {\n return {\n ethereumData: this._ethereumData,\n callData:\n this._callDataFileId != null\n ? this._callDataFileId._toProtobuf()\n : null,\n maxGasAllowance:\n this._maxGasAllowance != null\n ? this._maxGasAllowance.toTinybars()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"./Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `EthereumTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"ethereumTransaction\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n EthereumTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/EthereumTransaction.js?"); +class TokenReference { + constructor() { + /** + * @public + * @type {?TokenId} + */ + this.fungibleToken = null; + /** + * @public + * @type {?NftId} + */ + this.nft = null; + } + + /** + * @public + * @param {HashgraphProto.proto.TokenReference} reference + * @returns {TokenReference} + */ + static _fromProtobuf(reference) { + return { + fungibleToken: + reference.fungibleToken != undefined + ? TokenId_TokenId._fromProtobuf(reference.fungibleToken) + : null, + nft: + reference.nft != undefined + ? NftId_NftId._fromProtobuf(reference.nft) + : null, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenRejectTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EthereumTransactionData; }\n/* harmony export */ });\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n\n\nclass EthereumTransactionData {\n /**\n * @protected\n * @param {object} props\n * @param {Uint8Array} props.callData\n */\n constructor(props) {\n this.callData = props.callData;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {EthereumTransactionData}\n */\n static fromBytes(bytes) {\n if (bytes.length === 0) {\n throw new Error(\"empty bytes\");\n }\n\n if (bytes[0] != 2) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].ethereumTransactionDataLegacyFromBytes(bytes);\n } else {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].ethereumTransactionDataEip1559FromBytes(bytes);\n }\n }\n\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n throw new Error(\"not implemented\");\n }\n\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * @returns {string}\n */\n toString() {\n throw new Error(\"not implemented\");\n }\n\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * @returns {{[key: string]: any}}\n */\n toJSON() {\n throw new Error(\"not implemented\");\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/EthereumTransactionDataEip1559.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/EthereumTransactionDataEip1559.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenRejectTransactionBody} HashgraphProto.proto.ITokenRejectTransactionBody + * @typedef {import("@hashgraph/proto").proto.TokenReference} HashgraphProto.proto.TokenReference + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EthereumTransactionDataEip1559; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EthereumTransactionData.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n\n\n\n\n\n/**\n * @typedef {object} EthereumTransactionDataEip1559JSON\n * @property {string} chainId\n * @property {string} nonce\n * @property {string} maxPriorityGas\n * @property {string} maxGas\n * @property {string} gasLimit\n * @property {string} to\n * @property {string} value\n * @property {string} callData\n * @property {string[]} accessList\n * @property {string} recId\n * @property {string} r\n * @property {string} s\n */\n\nclass EthereumTransactionDataEip1559 extends _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @private\n * @param {object} props\n * @param {Uint8Array} props.chainId\n * @param {Uint8Array} props.nonce\n * @param {Uint8Array} props.maxPriorityGas\n * @param {Uint8Array} props.maxGas\n * @param {Uint8Array} props.gasLimit\n * @param {Uint8Array} props.to\n * @param {Uint8Array} props.value\n * @param {Uint8Array} props.callData\n * @param {Uint8Array[]} props.accessList\n * @param {Uint8Array} props.recId\n * @param {Uint8Array} props.r\n * @param {Uint8Array} props.s\n */\n constructor(props) {\n super(props);\n\n this.chainId = props.chainId;\n this.nonce = props.nonce;\n this.maxPriorityGas = props.maxPriorityGas;\n this.maxGas = props.maxGas;\n this.gasLimit = props.gasLimit;\n this.to = props.to;\n this.value = props.value;\n this.accessList = props.accessList;\n this.recId = props.recId;\n this.r = props.r;\n this.s = props.s;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {EthereumTransactionData}\n */\n static fromBytes(bytes) {\n if (bytes.length === 0) {\n throw new Error(\"empty bytes\");\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const decoded = /** @type {string[]} */ (_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__.decode(bytes.subarray(1)));\n\n if (!Array.isArray(decoded)) {\n throw new Error(\"ethereum data is not a list\");\n }\n\n if (decoded.length != 12) {\n throw new Error(\"invalid ethereum transaction data\");\n }\n\n // TODO\n return new EthereumTransactionDataEip1559({\n chainId: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[0])),\n nonce: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[1])),\n maxPriorityGas: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[2])),\n maxGas: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[3])),\n gasLimit: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[4])),\n to: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[5])),\n value: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[6])),\n callData: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[7])),\n // @ts-ignore\n accessList: /** @type {string[]} */ (decoded[8]).map((v) =>\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(v)\n ),\n recId: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[9])),\n r: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[10])),\n s: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[11])),\n });\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n const encoded = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__.encode([\n this.chainId,\n this.nonce,\n this.maxPriorityGas,\n this.maxGas,\n this.gasLimit,\n this.to,\n this.value,\n this.callData,\n this.accessList,\n this.recId,\n this.r,\n this.s,\n ]);\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(\"02\" + encoded.substring(2));\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON(), null, 2);\n }\n\n /**\n * @returns {EthereumTransactionDataEip1559JSON}\n */\n toJSON() {\n return {\n chainId: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.chainId),\n nonce: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.nonce),\n maxPriorityGas: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.maxPriorityGas),\n maxGas: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.maxGas),\n gasLimit: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.gasLimit),\n to: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.to),\n value: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.value),\n callData: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.callData),\n accessList: this.accessList.map((v) => _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(v)),\n recId: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.recId),\n r: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.r),\n s: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.s),\n };\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].setEthereumTransactionDataEip1559FromBytes((bytes) =>\n EthereumTransactionDataEip1559.fromBytes(bytes)\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/EthereumTransactionDataEip1559.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../token/TokenId.js").default} TokenId + * @typedef {import("../token/NftId.js").default} NftId + */ -/***/ }), +/** + * Reject a new Hedera™ crypto-currency token. + */ +class TokenRejectTransaction_TokenRejectTransaction extends Transaction_Transaction { + /** + * + * @param {object} [props] + * @param {?AccountId} [props.owner] + * @param {NftId[]} [props.nftIds] + * @param {TokenId[]} [props.tokenIds] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?AccountId} + */ + this._owner = null; + + if (props.owner != null) { + this.setOwnerId(props.owner); + } + + /** + * @private + * @type {TokenId[]} + */ + this._tokenIds = []; + + /** + * @private + * @type {NftId[]} + */ + this._nftIds = []; + + if (props.tokenIds != null) { + this.setTokenIds(props.tokenIds); + } + + if (props.nftIds != null) { + this.setNftIds(props.nftIds); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenRejectTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const rejectToken = + /** @type {HashgraphProto.proto.ITokenRejectTransactionBody} */ ( + body.tokenReject + ); + + const tokenIds = rejectToken.rejections?.map((rejection) => + TokenReference._fromProtobuf(rejection), + ); + const ftIds = tokenIds + ?.filter((token) => token.fungibleToken) + .map(({ fungibleToken }) => { + if (fungibleToken == null) { + throw new Error("Fungible Token cannot be null"); + } + return fungibleToken; + }); + + const nftIds = tokenIds + ?.filter((token) => token.nft) + .map(({ nft }) => { + if (nft == null) { + throw new Error("Nft cannot be null"); + } + return nft; + }); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenRejectTransaction_TokenRejectTransaction({ + owner: + rejectToken.owner != null + ? AccountId_AccountId._fromProtobuf(rejectToken.owner) + : undefined, + + tokenIds: ftIds, + nftIds: nftIds, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {TokenId[]} + */ + get tokenIds() { + return this._tokenIds; + } + + /** + * @param {TokenId[]} tokenIds + * @returns {this} + */ + setTokenIds(tokenIds) { + this._requireNotFrozen(); + this._tokenIds = tokenIds; + return this; + } + + /** + * @param {TokenId} tokenId + * @returns {this} + */ + addTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenIds?.push(tokenId); + return this; + } + + /** + * @returns {NftId[]} + * + */ + get nftIds() { + return this._nftIds; + } + + /** + * + * @param {NftId[]} nftIds + * @returns {this} + */ + setNftIds(nftIds) { + this._requireNotFrozen(); + this._nftIds = nftIds; + return this; + } + + /** + * @param {NftId} nftId + * @returns {this} + */ + addNftId(nftId) { + this._requireNotFrozen(); + this._nftIds?.push(nftId); + return this; + } + + /** + * @returns {?AccountId} + */ + get ownerId() { + return this._owner; + } + + /** + * @param {AccountId} owner + * @returns {this} + */ + setOwnerId(owner) { + this._requireNotFrozen(); + this._owner = owner; + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.rejectToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenReject"; + } + + /** + * @returns {HashgraphProto.proto.ITokenRejectTransactionBody} + */ + _makeTransactionData() { + /** @type {HashgraphProto.proto.TokenReference[]} */ + const rejections = []; + for (const tokenId of this._tokenIds) { + rejections.push({ + fungibleToken: tokenId._toProtobuf(), + }); + } + + for (const nftId of this._nftIds) { + rejections.push({ + nft: nftId._toProtobuf(), + }); + } + return { + owner: this.ownerId?._toProtobuf() ?? null, + rejections, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenRejectTransaction:${timestamp.toString()}`; + } +} +TRANSACTION_REGISTRY.set( + "tokenReject", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenRejectTransaction_TokenRejectTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenDissociateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/EthereumTransactionDataLegacy.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/EthereumTransactionDataLegacy.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EthereumTransactionDataLegacy; }\n/* harmony export */ });\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EthereumTransactionData.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n\n\n\n\n\n/**\n * @typedef {object} EthereumTransactionDataLegacyJSON\n * @property {string} nonce\n * @property {string} gasPrice\n * @property {string} gasLimit\n * @property {string} to\n * @property {string} value\n * @property {string} callData\n * @property {string} v\n * @property {string} r\n * @property {string} s\n */\n\nclass EthereumTransactionDataLegacy extends _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @private\n * @param {object} props\n * @param {Uint8Array} props.nonce\n * @param {Uint8Array} props.gasPrice\n * @param {Uint8Array} props.gasLimit\n * @param {Uint8Array} props.to\n * @param {Uint8Array} props.value\n * @param {Uint8Array} props.callData\n * @param {Uint8Array} props.v\n * @param {Uint8Array} props.r\n * @param {Uint8Array} props.s\n */\n constructor(props) {\n super(props);\n\n this.nonce = props.nonce;\n this.gasPrice = props.gasPrice;\n this.gasLimit = props.gasLimit;\n this.to = props.to;\n this.value = props.value;\n this.v = props.v;\n this.r = props.r;\n this.s = props.s;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {EthereumTransactionData}\n */\n static fromBytes(bytes) {\n if (bytes.length === 0) {\n throw new Error(\"empty bytes\");\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const decoded = /** @type {string[]} */ (_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__.decode(bytes));\n\n if (decoded.length != 9) {\n throw new Error(\"invalid ethereum transaction data\");\n }\n\n return new EthereumTransactionDataLegacy({\n nonce: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[0])),\n gasPrice: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[1])),\n gasLimit: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[2])),\n to: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[3])),\n value: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[4])),\n callData: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[5])),\n v: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[6])),\n r: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[7])),\n s: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(/** @type {string} */ (decoded[8])),\n });\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(\n _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__.encode([\n this.nonce,\n this.gasPrice,\n this.gasLimit,\n this.to,\n this.value,\n this.callData,\n this.v,\n this.r,\n this.s,\n ])\n );\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON(), null, 2);\n }\n\n /**\n * @returns {EthereumTransactionDataLegacyJSON}\n */\n toJSON() {\n return {\n nonce: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.nonce),\n gasPrice: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.gasPrice),\n gasLimit: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.gasLimit),\n to: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.to),\n value: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.value),\n callData: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.callData),\n v: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.v),\n r: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.r),\n s: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this.s),\n };\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].setEthereumTransactionDataLegacyFromBytes((bytes) =>\n EthereumTransactionDataLegacy.fromBytes(bytes)\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/EthereumTransactionDataLegacy.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/EvmAddress.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/EvmAddress.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EvmAddress; }\n/* harmony export */ });\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n */\n\n/**\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n */\n\nclass EvmAddress extends _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @internal\n * @param {Uint8Array} bytes\n */\n constructor(bytes) {\n super();\n this._bytes = bytes;\n }\n\n /**\n * @param {string} text\n * @returns {EvmAddress}\n */\n static fromString(text) {\n return new EvmAddress(_encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(text));\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {EvmAddress}\n */\n static fromBytes(bytes) {\n return new EvmAddress(bytes);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return this._bytes;\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.encode(this._bytes);\n }\n\n /**\n * @param {EvmAddress} other\n * @returns {boolean}\n */\n equals(other) {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_2__.arrayEqual)(this._bytes, other._bytes);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/EvmAddress.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenDissociateTransactionBody} HashgraphProto.proto.ITokenDissociateTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ "./node_modules/@hashgraph/sdk/src/ExchangeRate.js": -/*!*********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/ExchangeRate.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ExchangeRate; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\nclass ExchangeRate {\n /**\n * @private\n * @param {object} props\n * @param {number} props.hbars\n * @param {number} props.cents\n * @param {Date} props.expirationTime\n */\n constructor(props) {\n /**\n * Denotes Hbar equivalent to cents (USD)\n *\n * @readonly\n * @type {number}\n */\n this.hbars = props.hbars;\n\n /**\n * Denotes cents (USD) equivalent to Hbar\n *\n * @readonly\n * @type {number}\n */\n this.cents = props.cents;\n\n /**\n * Expiration time of this exchange rate\n *\n * @readonly\n * @type {Date}\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * Calculated exchange rate\n *\n * @readonly\n * @type {number}\n */\n this.exchangeRateInCents = props.cents / props.hbars;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {import(\"@hashgraph/proto\").proto.IExchangeRate} rate\n * @returns {ExchangeRate}\n */\n static _fromProtobuf(rate) {\n return new ExchangeRate({\n hbars: /** @type {number} */ (rate.hbarEquiv),\n cents: /** @type {number} */ (rate.centEquiv),\n expirationTime: new Date(\n rate.expirationTime != null\n ? rate.expirationTime.seconds != null\n ? long__WEBPACK_IMPORTED_MODULE_0__.isLong(rate.expirationTime.seconds)\n ? rate.expirationTime.seconds.toInt() * 1000\n : rate.expirationTime.seconds\n : 0\n : 0\n ),\n });\n }\n\n /**\n * @internal\n * @returns {import(\"@hashgraph/proto\").proto.IExchangeRate}\n */\n _toProtobuf() {\n return {\n hbarEquiv: this.hbars,\n centEquiv: this.cents,\n expirationTime: {\n seconds: long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(\n Math.trunc(this.expirationTime.getTime() / 1000)\n ),\n },\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/ExchangeRate.js?"); +/** + * Dissociate a new Hedera™ crypto-currency token. + */ +class TokenDissociateTransaction_TokenDissociateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {(TokenId | string)[]} [props.tokenIds] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId[]} + */ + this._tokenIds = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + this._defaultMaxTransactionFee = new Hbar_Hbar(5); + + if (props.tokenIds != null) { + this.setTokenIds(props.tokenIds); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenDissociateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const dissociateToken = + /** @type {HashgraphProto.proto.ITokenDissociateTransactionBody} */ ( + body.tokenDissociate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenDissociateTransaction_TokenDissociateTransaction({ + tokenIds: + dissociateToken.tokens != null + ? dissociateToken.tokens.map((token) => + TokenId_TokenId._fromProtobuf(token), + ) + : undefined, + accountId: + dissociateToken.account != null + ? AccountId_AccountId._fromProtobuf(dissociateToken.account) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId[]} + */ + get tokenIds() { + return this._tokenIds; + } + + /** + * @param {(TokenId | string)[]} tokenIds + * @returns {this} + */ + setTokenIds(tokenIds) { + this._requireNotFrozen(); + this._tokenIds = tokenIds.map((tokenId) => + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(), + ); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + + for (const tokenId of this._tokenIds != null ? this._tokenIds : []) { + if (tokenId != null) { + tokenId.validateChecksum(client); + } + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.dissociateTokens(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenDissociate"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenDissociateTransactionBody} + */ + _makeTransactionData() { + return { + tokens: + this._tokenIds != null + ? this._tokenIds.map((tokenId) => tokenId._toProtobuf()) + : null, + account: + this._accountId != null ? this._accountId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenDissociateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenDissociate", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenDissociateTransaction_TokenDissociateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenRejectFlow.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/ExchangeRates.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/ExchangeRates.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ExchangeRates; }\n/* harmony export */ });\n/* harmony import */ var _ExchangeRate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExchangeRate.js */ \"./node_modules/@hashgraph/sdk/src/ExchangeRate.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\nconst { proto } = /*#__PURE__*/ (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_1___namespace_cache || (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_1___namespace_cache = __webpack_require__.t(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__, 2)));\n\nclass ExchangeRates {\n /**\n * @private\n * @param {object} props\n * @param {ExchangeRate} props.currentRate\n * @param {ExchangeRate} props.nextRate\n */\n constructor(props) {\n /**\n * @readonly\n */\n this.currentRate = props.currentRate;\n\n /**\n * @readonly\n */\n this.nextRate = props.nextRate;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IExchangeRateSet} rateSet\n * @returns {ExchangeRates}\n */\n static _fromProtobuf(rateSet) {\n return new ExchangeRates({\n currentRate: _ExchangeRate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IExchangeRate} */ (\n rateSet.currentRate\n )\n ),\n nextRate: _ExchangeRate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IExchangeRate} */ (\n rateSet.nextRate\n )\n ),\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IExchangeRateSet}\n */\n _toProtobuf() {\n return {\n currentRate: this.currentRate._toProtobuf(),\n nextRate: this.nextRate._toProtobuf(),\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ExchangeRates}\n */\n static fromBytes(bytes) {\n return ExchangeRates._fromProtobuf(proto.ExchangeRateSet.decode(bytes));\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/ExchangeRates.js?"); +/** + * @typedef {import("../PrivateKey.js").default} PrivateKey + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../Signer.js").default} Signer + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../transaction/Transaction.js").default} Transaction + * @typedef {import("../transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("../token/TokenId.js").default} TokenId + * @typedef {import("../token/NftId.js").default} NftId + * @typedef {import("../PublicKey.js").default} PublicKey + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +/** + * Reject undesired token(s) and dissociate in a single flow. + */ +class TokenRejectFlow { + constructor() { + /** + * @private + * @type {?AccountId} + */ + this._ownerId = null; + + /** + * @private + * @type {TokenId[]} + */ + this._tokenIds = []; + + /** + * @private + * @type {NftId[]} + */ + this._nftIds = []; + + /** + * @private + * @type {?Client} + */ + this._freezeWithClient = null; + + /** + * @private + * @type {?PrivateKey} + */ + this._signPrivateKey = null; + + /** + * @private + * @type {?PublicKey} + */ + this._signPublicKey = null; + + /** + * @private + * @type {?(message: Uint8Array) => Promise} + */ + this._transactionSigner = null; + } + + /** + * + * @param {AccountId} ownerId + * @returns {this} + */ + setOwnerId(ownerId) { + this.requireNotFrozen(); + this._ownerId = ownerId; + return this; + } + + /** + * @returns {?AccountId} + */ + get ownerId() { + return this._ownerId; + } + + /** + * + * @param {TokenId[]} ids + * @returns {this} + */ + setTokenIds(ids) { + this.requireNotFrozen(); + this._tokenIds = ids; + return this; + } + + /** + * + * @param {TokenId} id + * @returns {this} + */ + addTokenId(id) { + this.requireNotFrozen(); + this._tokenIds.push(id); + return this; + } + + /** + * + * @returns {TokenId[]} + */ + get tokenIds() { + return this._tokenIds; + } + + /** + * + * @param {NftId[]} ids + * @returns {this} + */ + setNftIds(ids) { + this.requireNotFrozen(); + this._nftIds = ids; + return this; + } + + /** + * + * @param {NftId} id + * @returns {this} + */ + addNftId(id) { + this.requireNotFrozen(); + this._nftIds.push(id); + return this; + } + + /** + * + * @returns {NftId[]} + */ + get nftIds() { + return this._nftIds; + } + + /** + * + * @param {PrivateKey} privateKey + * @returns {this} + */ + sign(privateKey) { + this._signPrivateKey = privateKey; + this._signPublicKey = null; + this._transactionSigner = null; + return this; + } + + /** + * + * @param {PublicKey} publicKey + * @param {((message: Uint8Array) => Promise)} signer + * @returns {this} + */ + signWith(publicKey, signer) { + this._signPublicKey = publicKey; + this._transactionSigner = signer; + this._signPrivateKey = null; + return this; + } + + /** + * @param {Client} client + * @returns {this} + */ + signWithOperator(client) { + const operator = client.getOperator(); + if (operator == null) { + throw new Error("Client operator must be set"); + } + this._signPublicKey = operator.publicKey; + this._transactionSigner = operator.transactionSigner; + this._signPrivateKey = null; + return this; + } + + /** + * @private + * @param {Transaction} transaction + */ + fillOutTransaction(transaction) { + if (this._freezeWithClient) { + transaction.freezeWith(this._freezeWithClient); + } + if (this._signPrivateKey) { + void transaction.sign(this._signPrivateKey); + } else if (this._signPublicKey && this._transactionSigner) { + void transaction.signWith( + this._signPublicKey, + this._transactionSigner, + ); + } + } + /** + * + * @param {Client} client + * @returns {this} + */ + freezeWith(client) { + this._freezeWithClient = client; + return this; + } + + /** + * @param {Client} client + * @returns {Promise} + */ + async execute(client) { + const tokenRejectTxn = new TokenRejectTransaction() + .setTokenIds(this.tokenIds) + .setNftIds(this.nftIds); + + if (this.ownerId) { + tokenRejectTxn.setOwnerId(this.ownerId); + } + + this.fillOutTransaction(tokenRejectTxn); + + /* Get all token ids from NFT and remove duplicates as duplicated IDs + will trigger a TOKEN_REFERENCE_REPEATED error. */ + const nftTokenIds = this.nftIds + .map((nftId) => nftId.tokenId) + .filter(function (value, index, array) { + return array.indexOf(value) === index; + }); + + const tokenDissociateTxn = new TokenDissociateTransaction().setTokenIds( + [...this.tokenIds, ...nftTokenIds], + ); + + if (this.ownerId != null) { + tokenDissociateTxn.setAccountId(this.ownerId); + } + + this.fillOutTransaction(tokenDissociateTxn); + + const tokenRejectResponse = await tokenRejectTxn.execute(client); + await tokenRejectResponse.getReceipt(client); + + const tokenDissociateResponse = + await tokenDissociateTxn.execute(client); + await tokenDissociateResponse.getReceipt(client); + + return tokenRejectResponse; + } + + requireNotFrozen() { + if (this._freezeWithClient != null) { + throw new Error( + "Transaction is already frozen and cannot be modified", + ); + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenType.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/Executable.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Executable.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.TokenType} HashgraphProto.proto.TokenType + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ExecutionState\": function() { return /* binding */ ExecutionState; },\n/* harmony export */ \"RST_STREAM\": function() { return /* binding */ RST_STREAM; },\n/* harmony export */ \"default\": function() { return /* binding */ Executable; }\n/* harmony export */ });\n/* harmony import */ var _grpc_GrpcServiceError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./grpc/GrpcServiceError.js */ \"./node_modules/@hashgraph/sdk/src/grpc/GrpcServiceError.js\");\n/* harmony import */ var _grpc_GrpcStatus_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./grpc/GrpcStatus.js */ \"./node_modules/@hashgraph/sdk/src/grpc/GrpcStatus.js\");\n/* harmony import */ var _transaction_List_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./transaction/List.js */ \"./node_modules/@hashgraph/sdk/src/transaction/List.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _http_HttpError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./http/HttpError.js */ \"./node_modules/@hashgraph/sdk/src/http/HttpError.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./Status.js\").default} Status\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"./Signer.js\").Signer} Signer\n * @typedef {import(\"./PublicKey.js\").default} PublicKey\n */\n\n/**\n * @enum {string}\n */\nconst ExecutionState = {\n Finished: \"Finished\",\n Retry: \"Retry\",\n Error: \"Error\",\n};\n\nconst RST_STREAM = /\\brst[^0-9a-zA-Z]stream\\b/i;\n\n/**\n * @abstract\n * @internal\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n */\nclass Executable {\n constructor() {\n /**\n * The number of times we can retry the grpc call\n *\n * @private\n * @type {number}\n */\n this._maxAttempts = 10;\n\n /**\n * List of node account IDs for each transaction that has been\n * built.\n *\n * @internal\n * @type {List}\n */\n this._nodeAccountIds = new _transaction_List_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n\n /**\n * @internal\n */\n this._signOnDemand = false;\n\n /**\n * This is the request's min backoff\n *\n * @internal\n * @type {number | null}\n */\n this._minBackoff = null;\n\n /**\n * This is the request's max backoff\n *\n * @internal\n * @type {number | null}\n */\n this._maxBackoff = null;\n\n /**\n * The operator that was used to execute this request.\n * The reason we save the operator in the request is because of the signing on\n * demand feature. This feature requires us to sign new request on each attempt\n * meaning if a client with an operator was used we'd need to sign with the operator\n * on each attempt.\n *\n * @internal\n * @type {ClientOperator | null}\n */\n this._operator = null;\n\n /**\n * The complete timeout for running the `execute()` method\n *\n * @internal\n * @type {number | null}\n */\n this._requestTimeout = null;\n\n /**\n * The grpc request timeout aka deadline.\n *\n * The reason we have this is because there were times that consensus nodes held the grpc\n * connection, but didn't return anything; not error nor regular response. This resulted\n * in some weird behavior in the SDKs. To fix this we've added a grpc deadline to prevent\n * nodes from stalling the executing of a request.\n *\n * @internal\n * @type {number | null}\n */\n this._grpcDeadline = null;\n }\n\n /**\n * Get the list of node account IDs on the request. If no nodes are set, then null is returned.\n * The reasoning for this is simply \"legacy behavior\".\n *\n * @returns {?AccountId[]}\n */\n get nodeAccountIds() {\n if (this._nodeAccountIds.isEmpty) {\n return null;\n } else {\n this._nodeAccountIds.setLocked();\n return this._nodeAccountIds.list;\n }\n }\n\n /**\n * Set the node account IDs on the request\n *\n * @param {AccountId[]} nodeIds\n * @returns {this}\n */\n setNodeAccountIds(nodeIds) {\n // Set the node account IDs, and lock the list. This will require `execute`\n // to use these nodes instead of random nodes from the network.\n this._nodeAccountIds.setList(nodeIds).setLocked();\n return this;\n }\n\n /**\n * @deprecated\n * @returns {number}\n */\n get maxRetries() {\n console.warn(\"Deprecated: use maxAttempts instead\");\n return this.maxAttempts;\n }\n\n /**\n * @param {number} maxRetries\n * @returns {this}\n */\n setMaxRetries(maxRetries) {\n console.warn(\"Deprecated: use setMaxAttempts() instead\");\n return this.setMaxAttempts(maxRetries);\n }\n\n /**\n * Get the max attempts on the request\n *\n * @returns {number}\n */\n get maxAttempts() {\n return this._maxAttempts;\n }\n\n /**\n * Set the max attempts on the request\n *\n * @param {number} maxAttempts\n * @returns {this}\n */\n setMaxAttempts(maxAttempts) {\n this._maxAttempts = maxAttempts;\n\n return this;\n }\n\n /**\n * Get the grpc deadline\n *\n * @returns {?number}\n */\n get grpcDeadline() {\n return this._grpcDeadline;\n }\n\n /**\n * Set the grpc deadline\n *\n * @param {number} grpcDeadline\n * @returns {this}\n */\n setGrpcDeadline(grpcDeadline) {\n this._grpcDeadline = grpcDeadline;\n\n return this;\n }\n\n /**\n * Set the min backoff for the request\n *\n * @param {number} minBackoff\n * @returns {this}\n */\n setMinBackoff(minBackoff) {\n // Honestly we shouldn't be checking for null since that should be TypeScript's job.\n // Also verify that min backoff is not greater than max backoff.\n if (minBackoff == null) {\n throw new Error(\"minBackoff cannot be null.\");\n } else if (this._maxBackoff != null && minBackoff > this._maxBackoff) {\n throw new Error(\"minBackoff cannot be larger than maxBackoff.\");\n }\n this._minBackoff = minBackoff;\n return this;\n }\n\n /**\n * Get the min backoff\n *\n * @returns {number | null}\n */\n get minBackoff() {\n return this._minBackoff;\n }\n\n /**\n * Set the max backoff for the request\n *\n * @param {?number} maxBackoff\n * @returns {this}\n */\n setMaxBackoff(maxBackoff) {\n // Honestly we shouldn't be checking for null since that should be TypeScript's job.\n // Also verify that max backoff is not less than min backoff.\n if (maxBackoff == null) {\n throw new Error(\"maxBackoff cannot be null.\");\n } else if (this._minBackoff != null && maxBackoff < this._minBackoff) {\n throw new Error(\"maxBackoff cannot be smaller than minBackoff.\");\n }\n this._maxBackoff = maxBackoff;\n return this;\n }\n\n /**\n * Get the max backoff\n *\n * @returns {number | null}\n */\n get maxBackoff() {\n return this._maxBackoff;\n }\n\n /**\n * This method is responsible for doing any work before the executing process begins.\n * For paid queries this will result in executing a cost query, for transactions this\n * will make sure we save the operator and sign any requests that need to be signed\n * in case signing on demand is disabled.\n *\n * @abstract\n * @protected\n * @param {import(\"./client/Client.js\").default} client\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _beforeExecute(client) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Create a protobuf request which will be passed into the `_execute()` method\n *\n * @abstract\n * @protected\n * @returns {Promise}\n */\n _makeRequestAsync() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * This name is a bit wrong now, but the purpose of this method is to map the\n * request and response into an error. This method will only be called when\n * `_shouldRetry` returned `ExecutionState.Error`\n *\n * @abstract\n * @internal\n * @param {RequestT} request\n * @param {ResponseT} response\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Map the request, response, and the node account ID used for this attempt into a response.\n * This method will only be called when `_shouldRetry` returned `ExecutionState.Finished`\n *\n * @abstract\n * @protected\n * @param {ResponseT} response\n * @param {AccountId} nodeAccountId\n * @param {RequestT} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Perform a single grpc call with the given request. Each request has it's own\n * required service so we just pass in channel, and it'$ the request's responsiblity\n * to use the right service and call the right grpc method.\n *\n * @abstract\n * @internal\n * @param {Channel} channel\n * @param {RequestT} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _execute(channel, request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Return the current transaction ID for the request. All requests which are\n * use the same transaction ID for each node, but the catch is that `Transaction`\n * implicitly supports chunked transactions. Meaning there could be multiple\n * transaction IDs stored in the request, and a different transaction ID will be used\n * on subsequent calls to `execute()`\n *\n * FIXME: This method can most likely be removed, although some further inspection\n * is required.\n *\n * @abstract\n * @protected\n * @returns {TransactionId}\n */\n _getTransactionId() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Return the log ID for this particular request\n *\n * Log IDs are simply a string constructed to make it easy to track each request's\n * execution even when mulitple requests are executing in parallel. Typically, this\n * method returns the format of `[.]`\n *\n * Maybe we should deduplicate this using ${this.consturtor.name}\n *\n * @abstract\n * @internal\n * @returns {string}\n */\n _getLogId() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Serialize the request into bytes\n *\n * @abstract\n * @param {RequestT} request\n * @returns {Uint8Array}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _requestToBytes(request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Serialize the response into bytes\n *\n * @abstract\n * @param {ResponseT} response\n * @returns {Uint8Array}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _responseToBytes(response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Advance the request to the next node\n *\n * FIXME: This method used to perform different code depending on if we're\n * executing a query or transaction, but that is no longer the case\n * and hence could be removed.\n *\n * @protected\n * @returns {void}\n */\n _advanceRequest() {\n this._nodeAccountIds.advance();\n }\n\n /**\n * Determine if we should continue the execution process, error, or finish.\n *\n * FIXME: This method should really be called something else. Initially it returned\n * a boolean so `shouldRetry` made sense, but now it returns an enum, so the name\n * no longer makes sense.\n *\n * @abstract\n * @protected\n * @param {RequestT} request\n * @param {ResponseT} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Determine if we should error based on the gRPC status\n *\n * Unlike `shouldRetry` this method does in fact still return a boolean\n *\n * @protected\n * @param {Error} error\n * @returns {boolean}\n */\n _shouldRetryExceptionally(error) {\n if (error instanceof _grpc_GrpcServiceError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]) {\n return (\n error.status._code === _grpc_GrpcStatus_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Timeout._code ||\n error.status._code === _grpc_GrpcStatus_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Unavailable._code ||\n error.status._code === _grpc_GrpcStatus_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].ResourceExhausted._code ||\n (error.status._code === _grpc_GrpcStatus_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Internal._code &&\n RST_STREAM.test(error.message))\n );\n } else {\n // if we get to the 'else' statement, the 'error' is instanceof 'HttpError'\n // and in this case, we have to retry always\n return true;\n }\n }\n\n /**\n * A helper method for setting the operator on the request\n *\n * @internal\n * @param {AccountId} accountId\n * @param {PublicKey} publicKey\n * @param {(message: Uint8Array) => Promise} transactionSigner\n * @returns {this}\n */\n _setOperatorWith(accountId, publicKey, transactionSigner) {\n this._operator = {\n transactionSigner,\n accountId,\n publicKey,\n };\n return this;\n }\n\n /**\n * Execute this request using the signer\n *\n * This method is part of the signature providers feature\n * https://hips.hedera.com/hip/hip-338\n *\n * @param {Signer} signer\n * @returns {Promise}\n */\n async executeWithSigner(signer) {\n return signer.call(this);\n }\n\n /**\n * Execute the request using a client and an optional request timeout\n *\n * @template {Channel} ChannelT\n * @template MirrorChannelT\n * @param {import(\"./client/Client.js\").default} client\n * @param {number=} requestTimeout\n * @returns {Promise}\n */\n async execute(client, requestTimeout) {\n // If the request timeout is set on the request we'll prioritize that instead\n // of the parameter provided, and if the parameter isn't provided we'll\n // use the default request timeout on client\n if (this._requestTimeout == null) {\n this._requestTimeout =\n requestTimeout != null ? requestTimeout : client.requestTimeout;\n }\n\n // Some request need to perform additional requests before the executing\n // such as paid queries need to fetch the cost of the query before\n // finally executing the actual query.\n await this._beforeExecute(client);\n\n // If the max backoff on the request is not set, use the default value in client\n if (this._maxBackoff == null) {\n this._maxBackoff = client.maxBackoff;\n }\n\n // If the min backoff on the request is not set, use the default value in client\n if (this._minBackoff == null) {\n this._minBackoff = client.minBackoff;\n }\n\n // If the max attempts on the request is not set, use the default value in client\n // If the default value in client is not set, use a default of 10.\n //\n // FIXME: current implementation is wrong, update to follow comment above.\n const maxAttempts =\n client._maxAttempts != null\n ? client._maxAttempts\n : this._maxAttempts;\n\n // Save the start time to be used later with request timeout\n const startTime = Date.now();\n\n // Saves each error we get so when we err due to max attempts exceeded we'll have\n // the last error that was returned by the consensus node\n let persistentError = null;\n\n // The retry loop\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n // Determine if we've exceeded request timeout\n if (\n this._requestTimeout != null &&\n startTime + this._requestTimeout <= Date.now()\n ) {\n throw new Error(\"timeout exceeded\");\n }\n\n let nodeAccountId;\n let node;\n\n // If node account IDs is locked then use the node account IDs\n // from the list, otherwise build a new list of one node account ID\n // using the entire network\n if (this._nodeAccountIds.locked) {\n nodeAccountId = this._nodeAccountIds.current;\n node = client._network.getNode(nodeAccountId);\n } else {\n node = client._network.getNode();\n nodeAccountId = node.accountId;\n this._nodeAccountIds.setList([nodeAccountId]);\n }\n\n if (node == null) {\n throw new Error(\n `NodeAccountId not recognized: ${nodeAccountId.toString()}`\n );\n }\n\n // Get the log ID for the request.\n const logId = this._getLogId();\n js_logger__WEBPACK_IMPORTED_MODULE_3__.debug(\n `[${logId}] Node AccountID: ${node.accountId.toString()}, IP: ${node.address.toString()}`\n );\n\n const channel = node.getChannel();\n const request = await this._makeRequestAsync();\n\n // advance the internal index\n // non-free queries and transactions map to more than 1 actual transaction and this will cause\n // the next invocation of makeRequest to return the _next_ transaction\n // FIXME: This is likely no longer relavent after we've transitioned to using our `List` type\n // can be replaced with `this._nodeAccountIds.advance();`\n this._advanceRequest();\n\n let response;\n\n // If the node is unhealthy, wait for it to be healthy\n // FIXME: This is wrong, we should skip to the next node, and only perform\n // a request backoff after we've tried all nodes in the current list.\n if (!node.isHealthy()) {\n js_logger__WEBPACK_IMPORTED_MODULE_3__.debug(\n `[${logId}] node is not healthy, skipping waiting ${node.getRemainingTime()}`\n );\n // We don't need to wait, we can proceed to the next attempt.\n continue;\n }\n\n try {\n // Race the execution promise against the grpc timeout to prevent grpc connections\n // from blocking this request\n const promises = [];\n\n // If a grpc deadline is est, we should race it, otherwise the only thing in the\n // list of promises will be the execution promise.\n if (this._grpcDeadline != null) {\n promises.push(\n // eslint-disable-next-line ie11/no-loop-func\n new Promise((_, reject) =>\n setTimeout(\n // eslint-disable-next-line ie11/no-loop-func\n () =>\n reject(new Error(\"grpc deadline exceeded\")),\n /** @type {number=} */ (this._grpcDeadline)\n )\n )\n );\n }\n js_logger__WEBPACK_IMPORTED_MODULE_3__.trace(\n `[${this._getLogId()}] sending protobuf ${_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._requestToBytes(request)\n )}`\n );\n promises.push(this._execute(channel, request));\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n response = /** @type {ResponseT} */ (\n await Promise.race(promises)\n );\n } catch (err) {\n // If we received a grpc status error we need to determine if\n // we should retry on this error, or err from the request entirely.\n const error = _grpc_GrpcServiceError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromResponse(\n /** @type {Error} */ (err)\n );\n\n // Save the error in case we retry\n persistentError = error;\n js_logger__WEBPACK_IMPORTED_MODULE_3__.debug(\n `[${logId}] received error ${JSON.stringify(error)}`\n );\n\n if (\n (error instanceof _grpc_GrpcServiceError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] ||\n error instanceof _http_HttpError_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]) &&\n this._shouldRetryExceptionally(error) &&\n attempt <= maxAttempts\n ) {\n // Increase the backoff for the particular node and remove it from\n // the healthy node list\n client._network.increaseBackoff(node);\n continue;\n }\n\n throw err;\n }\n\n js_logger__WEBPACK_IMPORTED_MODULE_3__.trace(\n `[${this._getLogId()}] sending protobuf ${_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._responseToBytes(response)\n )}`\n );\n\n // If we didn't receive an error we should decrease the current nodes backoff\n // in case it is a recovering node\n client._network.decreaseBackoff(node);\n\n // Determine what execution state we're in by the response\n // For transactions this would be as simple as checking the response status is `OK`\n // while for _most_ queries it would check if the response status is `SUCCESS`\n // The only odd balls are `TransactionReceiptQuery` and `TransactionRecordQuery`\n const [err, shouldRetry] = this._shouldRetry(request, response);\n if (err != null) {\n persistentError = err;\n }\n\n // Determine by the executing state what we should do\n switch (shouldRetry) {\n case ExecutionState.Retry:\n await delayForAttempt(\n attempt,\n this._minBackoff,\n this._maxBackoff\n );\n continue;\n case ExecutionState.Finished:\n return this._mapResponse(response, nodeAccountId, request);\n case ExecutionState.Error:\n throw this._mapStatusError(request, response);\n default:\n throw new Error(\n \"(BUG) non-exhuastive switch statement for `ExecutionState`\"\n );\n }\n }\n\n // We'll only get here if we've run out of attempts, so we return an error wrapping the\n // persistent error we saved before.\n throw new Error(\n `max attempts of ${maxAttempts.toString()} was reached for request with last error being: ${\n persistentError != null ? persistentError.toString() : \"\"\n }`\n );\n }\n\n /**\n * The current purpose of this method is to easily support signature providers since\n * signature providers need to serialize _any_ request into bytes. `Query` and `Transaction`\n * already implement `toBytes()` so it only made sense to make it avaiable here too.\n *\n * @abstract\n * @returns {Uint8Array}\n */\n toBytes() {\n throw new Error(\"not implemented\");\n }\n}\n\n/**\n * A simple function that returns a promise timeout for a specific period of time\n *\n * @param {number} attempt\n * @param {number} minBackoff\n * @param {number} maxBackoff\n * @returns {Promise}\n */\nfunction delayForAttempt(attempt, minBackoff, maxBackoff) {\n // 0.1s, 0.2s, 0.4s, 0.8s, ...\n const ms = Math.min(\n Math.floor(minBackoff * Math.pow(2, attempt)),\n maxBackoff\n );\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Executable.js?"); +class TokenType { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case TokenType.FungibleCommon: + return "FUNGIBLE_COMMON"; + case TokenType.NonFungibleUnique: + return "NON_FUNGIBLE_UNIQUE"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @internal + * @param {number} code + * @returns {TokenType} + */ + static _fromCode(code) { + switch (code) { + case 0: + return TokenType.FungibleCommon; + case 1: + return TokenType.NonFungibleUnique; + } + + throw new Error( + `(BUG) TokenType.fromCode() does not handle code: ${code}`, + ); + } + + /** + * @returns {HashgraphProto.proto.TokenType} + */ + valueOf() { + return this._code; + } +} + +/** + * Interchangeable value with one another, where any quantity of them has the + * same value as another equal quantity if they are in the same class. Share + * a single set of properties, not distinct from one another. Simply represented + * as a balance or quantity to a given Hedera account. + */ +TokenType.FungibleCommon = new TokenType(0); -/***/ }), +/** + * Unique, not interchangeable with other tokens of the same type as they + * typically have different values. Individually traced and can carry unique + * properties (e.g. serial number). + */ +TokenType.NonFungibleUnique = new TokenType(1); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenSupplyType.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/FeeComponents.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/FeeComponents.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.TokenSupplyType} HashgraphProto.proto.TokenSupplyType + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FeeComponents; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\nclass FeeComponents {\n /**\n * @param {object} [props]\n * @param {Long} [props.min]\n * @param {Long} [props.max]\n * @param {Long} [props.constant]\n * @param {Long} [props.transactionBandwidthByte]\n * @param {Long} [props.transactionVerification]\n * @param {Long} [props.transactionRamByteHour]\n * @param {Long} [props.transactionStorageByteHour]\n * @param {Long} [props.contractTransactionGas]\n * @param {Long} [props.transferVolumeHbar]\n * @param {Long} [props.responseMemoryByte]\n * @param {Long} [props.responseDiskByte]\n */\n constructor(props = {}) {\n /*\n * A minimum, the calculated fee must be greater than this value\n *\n * @type {Long}\n */\n this.min = props.min;\n\n /*\n * A maximum, the calculated fee must be less than this value\n *\n * @type {Long}\n */\n this.max = props.max;\n\n /*\n * A constant contribution to the fee\n *\n * @type {Long}\n */\n this.constant = props.constant;\n\n /*\n * The price of bandwidth consumed by a transaction, measured in bytes\n *\n * @type {Long}\n */\n this.transactionBandwidthByte = props.transactionBandwidthByte;\n\n /*\n * The price per signature verification for a transaction\n *\n * @type {Long}\n */\n this.transactionVerification = props.transactionVerification;\n\n /*\n * The price of RAM consumed by a transaction, measured in byte-hours\n *\n * @type {Long}\n */\n this.transactionRamByteHour = props.transactionRamByteHour;\n\n /*\n * The price of storage consumed by a transaction, measured in byte-hours\n *\n * @type {Long}\n */\n this.transactionStorageByteHour = props.transactionStorageByteHour;\n\n /*\n * The price of computation for a smart contract transaction, measured in gas\n *\n * @type {Long}\n */\n this.contractTransactionGas = props.contractTransactionGas;\n\n /*\n * The price per hbar transferred for a transfer\n *\n * @type {Long}\n */\n this.transferVolumeHbar = props.transferVolumeHbar;\n\n /*\n * The price of bandwidth for data retrieved from memory for a response, measured in bytes\n *\n * @type {Long}\n */\n this.responseMemoryByte = props.responseMemoryByte;\n\n /*\n * The price of bandwidth for data retrieved from disk for a response, measured in bytes\n *\n * @type {Long}\n */\n this.responseDiskByte = props.responseDiskByte;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FeeComponents}\n */\n static fromBytes(bytes) {\n return FeeComponents._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.FeeComponents.decode(bytes)\n );\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IFeeComponents} feeComponents\n * @returns {FeeComponents}\n */\n static _fromProtobuf(feeComponents) {\n return new FeeComponents({\n min: feeComponents.min != null ? feeComponents.min : undefined,\n max: feeComponents.max != null ? feeComponents.max : undefined,\n constant:\n feeComponents.constant != null\n ? feeComponents.constant\n : undefined,\n transactionBandwidthByte:\n feeComponents.bpt != null ? feeComponents.bpt : undefined,\n transactionVerification:\n feeComponents.vpt != null ? feeComponents.vpt : undefined,\n transactionRamByteHour:\n feeComponents.rbh != null ? feeComponents.rbh : undefined,\n transactionStorageByteHour:\n feeComponents.sbh != null ? feeComponents.sbh : undefined,\n contractTransactionGas:\n feeComponents.gas != null ? feeComponents.gas : undefined,\n transferVolumeHbar:\n feeComponents.tv != null ? feeComponents.tv : undefined,\n responseMemoryByte:\n feeComponents.bpr != null ? feeComponents.bpr : undefined,\n responseDiskByte:\n feeComponents.sbpr != null ? feeComponents.sbpr : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IFeeComponents}\n */\n _toProtobuf() {\n return {\n min: this.min != null ? this.min : undefined,\n max: this.max != null ? this.max : undefined,\n constant: this.constant != null ? this.constant : undefined,\n bpt:\n this.transactionBandwidthByte != null\n ? this.transactionBandwidthByte\n : undefined,\n vpt:\n this.transactionVerification != null\n ? this.transactionVerification\n : undefined,\n rbh:\n this.transactionRamByteHour != null\n ? this.transactionRamByteHour\n : undefined,\n sbh:\n this.transactionStorageByteHour != null\n ? this.transactionStorageByteHour\n : undefined,\n gas:\n this.contractTransactionGas != null\n ? this.contractTransactionGas\n : undefined,\n tv:\n this.transferVolumeHbar != null\n ? this.transferVolumeHbar\n : undefined,\n bpr:\n this.responseMemoryByte != null\n ? this.responseMemoryByte\n : undefined,\n sbpr:\n this.responseDiskByte != null\n ? this.responseDiskByte\n : undefined,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.FeeComponents.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/FeeComponents.js?"); +class TokenSupplyType { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case TokenSupplyType.Infinite: + return "INFINITE"; + case TokenSupplyType.Finite: + return "FINITE"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @internal + * @param {number} code + * @returns {TokenSupplyType} + */ + static _fromCode(code) { + switch (code) { + case 0: + return TokenSupplyType.Infinite; + case 1: + return TokenSupplyType.Finite; + } + + throw new Error( + `(BUG) TokenSupplyType.fromCode() does not handle code: ${code}`, + ); + } + + /** + * @returns {HashgraphProto.proto.TokenSupplyType} + */ + valueOf() { + return this._code; + } +} + +/** + * Interchangeable value with one another, where any quantity of them has the + * same value as another equal quantity if they are in the same class. Share + * a single set of properties, not distinct from one another. Simply represented + * as a balance or quantity to a given Hedera account. + */ +TokenSupplyType.Infinite = new TokenSupplyType(0); -/***/ }), +/** + * Unique, not interchangeable with other tokens of the same type as they + * typically have different values. Individually traced and can carry unique + * properties (e.g. serial number). + */ +TokenSupplyType.Finite = new TokenSupplyType(1); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenCreateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/FeeData.js": -/*!****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/FeeData.js ***! - \****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FeeData; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _FeeComponents_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FeeComponents.js */ \"./node_modules/@hashgraph/sdk/src/FeeComponents.js\");\n/* harmony import */ var _FeeDataType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FeeDataType.js */ \"./node_modules/@hashgraph/sdk/src/FeeDataType.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\nclass FeeData {\n /**\n * @param {object} [props]\n * @param {FeeComponents} [props.nodedata]\n * @param {FeeComponents} [props.networkdata]\n * @param {FeeComponents} [props.servicedata]\n * @param {FeeDataType} [props.feeDataType]\n */\n constructor(props = {}) {\n /*\n * Fee paid to the submitting node\n *\n * @type {FeeComponents}\n */\n this.nodedata = props.nodedata;\n\n /*\n * Fee paid to the network for processing a transaction into consensus\n *\n * @type {FeeComponents}\n */\n this.networkdata = props.networkdata;\n\n /*\n * Fee paid to the network for providing the service associated with the transaction; for instance, storing a file\n *\n * @type {FeeComponents}\n */\n this.servicedata = props.servicedata;\n\n /*\n * SubType distinguishing between different types of FeeData, correlating to the same HederaFunctionality\n *\n * @type {SubType}\n */\n this.feeDataType = props.feeDataType;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FeeData}\n */\n static fromBytes(bytes) {\n return FeeData._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.FeeData.decode(bytes)\n );\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IFeeData} feeData\n * @returns {FeeData}\n */\n static _fromProtobuf(feeData) {\n return new FeeData({\n nodedata:\n feeData.nodedata != null\n ? _FeeComponents_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(feeData.nodedata)\n : undefined,\n networkdata:\n feeData.networkdata != null\n ? _FeeComponents_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(feeData.networkdata)\n : undefined,\n servicedata:\n feeData.servicedata != null\n ? _FeeComponents_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(feeData.servicedata)\n : undefined,\n feeDataType:\n feeData.subType != null\n ? _FeeDataType_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromCode(feeData.subType)\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IFeeData}\n */\n _toProtobuf() {\n return {\n nodedata:\n this.nodedata != null ? this.nodedata._toProtobuf() : undefined,\n\n networkdata:\n this.networkdata != null\n ? this.networkdata._toProtobuf()\n : undefined,\n\n servicedata:\n this.servicedata != null\n ? this.servicedata._toProtobuf()\n : undefined,\n\n subType:\n this.feeDataType != null\n ? this.feeDataType.valueOf()\n : undefined,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.FeeData.encode(this._toProtobuf()).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/FeeData.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/FeeDataType.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/FeeDataType.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FeeDataType; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.SubType} HashgraphProto.proto.SubType\n */\n\nclass FeeDataType {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case FeeDataType.Default:\n return \"DEFAULT\";\n case FeeDataType.TokenFungibleCommon:\n return \"TOKEN_FUNGIBLE_COMMON\";\n case FeeDataType.TokenNonFungibleUnique:\n return \"TOKEN_NON_FUNGIBLE_UNIQUE\";\n case FeeDataType.TokenFungibleCommonWithCustomFees:\n return \"TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES\";\n case FeeDataType.TokenNonFungibleUniqueWithCustomFees:\n return \"TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES\";\n case FeeDataType.ScheduleCreateContractCall:\n return \"SCHEDULE_CREATE_CONTRACT_CALL\";\n default:\n return `UNKNOWN (${this._code})`;\n }\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {FeeDataType}\n */\n static _fromCode(code) {\n switch (code) {\n case 0:\n return FeeDataType.Default;\n case 1:\n return FeeDataType.TokenFungibleCommon;\n case 2:\n return FeeDataType.TokenNonFungibleUnique;\n case 3:\n return FeeDataType.TokenFungibleCommonWithCustomFees;\n case 4:\n return FeeDataType.TokenNonFungibleUniqueWithCustomFees;\n case 5:\n return FeeDataType.ScheduleCreateContractCall;\n }\n\n throw new Error(\n `(BUG) SubType.fromCode() does not handle code: ${code}`\n );\n }\n\n /**\n * @returns {HashgraphProto.proto.SubType}\n */\n valueOf() {\n return this._code;\n }\n}\n\n/**\n * The resource prices have no special scope\n */\nFeeDataType.Default = new FeeDataType(0);\n\n/**\n * The resource prices are scoped to an operation on a fungible common token\n */\nFeeDataType.TokenFungibleCommon = new FeeDataType(1);\n\n/**\n * The resource prices are scoped to an operation on a non-fungible unique token\n */\nFeeDataType.TokenNonFungibleUnique = new FeeDataType(2);\n\n/**\n * The resource prices are scoped to an operation on a fungible common token with a custom fee schedule\n */\nFeeDataType.TokenFungibleCommonWithCustomFees = new FeeDataType(3);\n\n/**\n * The resource prices are scoped to an operation on a non-fungible unique token with a custom fee schedule\n */\nFeeDataType.TokenNonFungibleUniqueWithCustomFees = new FeeDataType(4);\n\n/**\n * The resource prices are scoped to a ScheduleCreate containing a ContractCall.\n */\nFeeDataType.ScheduleCreateContractCall = new FeeDataType(5);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/FeeDataType.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/FeeSchedule.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/FeeSchedule.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FeeSchedule; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _TransactionFeeSchedule_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransactionFeeSchedule.js */ \"./node_modules/@hashgraph/sdk/src/TransactionFeeSchedule.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\nclass FeeSchedule {\n /**\n * @param {object} [props]\n * @param {TransactionFeeSchedule[]} [props.transactionFeeSchedule]\n * @param {Timestamp} [props.expirationTime]\n */\n constructor(props = {}) {\n /*\n * List of price coefficients for network resources\n *\n * @type {TransactionFeeSchedule}\n */\n this.transactionFeeSchedule = props.transactionFeeSchedule;\n\n /*\n * FeeSchedule expiry time\n *\n * @type {Timestamp}\n */\n this.expirationTime = props.expirationTime;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FeeSchedule}\n */\n static fromBytes(bytes) {\n return FeeSchedule._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.FeeSchedule.decode(bytes)\n );\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IFeeSchedule} feeSchedule\n * @returns {FeeSchedule}\n */\n static _fromProtobuf(feeSchedule) {\n return new FeeSchedule({\n transactionFeeSchedule:\n feeSchedule.transactionFeeSchedule != null\n ? feeSchedule.transactionFeeSchedule.map((schedule) =>\n _TransactionFeeSchedule_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(schedule)\n )\n : undefined,\n expirationTime:\n feeSchedule.expiryTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(feeSchedule.expiryTime)\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IFeeSchedule}\n */\n _toProtobuf() {\n return {\n transactionFeeSchedule:\n this.transactionFeeSchedule != null\n ? this.transactionFeeSchedule.map((transaction) =>\n transaction._toProtobuf()\n )\n : undefined,\n expiryTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : undefined,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.FeeSchedule.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/FeeSchedule.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/FeeSchedules.js": -/*!*********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/FeeSchedules.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FeeSchedules; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _FeeSchedule_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FeeSchedule.js */ \"./node_modules/@hashgraph/sdk/src/FeeSchedule.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\nclass FeeSchedules {\n /**\n * @param {object} [props]\n * @param {FeeSchedule} [props.currentFeeSchedule]\n * @param {FeeSchedule} [props.nextFeeSchedule]\n */\n constructor(props = {}) {\n /*\n * Contains current Fee Schedule\n *\n * @type {FeeSchedule}\n */\n this.current = props.currentFeeSchedule;\n\n /*\n * Contains next Fee Schedule\n *\n * @type {FeeSchedule}\n */\n this.next = props.nextFeeSchedule;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FeeSchedules}\n */\n static fromBytes(bytes) {\n return FeeSchedules._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.CurrentAndNextFeeSchedule.decode(bytes)\n );\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ICurrentAndNextFeeSchedule} feeSchedules\n * @returns {FeeSchedules}\n */\n static _fromProtobuf(feeSchedules) {\n return new FeeSchedules({\n currentFeeSchedule:\n feeSchedules.currentFeeSchedule != null\n ? _FeeSchedule_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(feeSchedules.currentFeeSchedule)\n : undefined,\n nextFeeSchedule:\n feeSchedules.nextFeeSchedule != null\n ? _FeeSchedule_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(feeSchedules.nextFeeSchedule)\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ICurrentAndNextFeeSchedule}\n */\n _toProtobuf() {\n return {\n currentFeeSchedule:\n this.current != null ? this.current._toProtobuf() : undefined,\n nextFeeSchedule:\n this.next != null ? this.next._toProtobuf() : undefined,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.CurrentAndNextFeeSchedule.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/FeeSchedules.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/FreezeType.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/FreezeType.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FreezeType; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.FreezeType} HashgraphProto.proto.FreezeType\n */\n\nclass FreezeType {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case FreezeType.UnknownFreezeType:\n return \"UNKNOWN_FREEZE_TYPE\";\n case FreezeType.FreezeOnly:\n return \"FREEZE_ONLY\";\n case FreezeType.PrepareUpgrade:\n return \"PREPARE_UPGRADE\";\n case FreezeType.FreezeUpgrade:\n return \"FREEZE_UPGRADE\";\n case FreezeType.FreezeAbort:\n return \"FREEZE_ABORT\";\n case FreezeType.TelemetryUpgrade:\n return \"TELEMETRY_UPGRADE\";\n default:\n return `UNKNOWN (${this._code})`;\n }\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {FreezeType}\n */\n static _fromCode(code) {\n switch (code) {\n case 0:\n return FreezeType.UnknownFreezeType;\n case 1:\n return FreezeType.FreezeOnly;\n case 2:\n return FreezeType.PrepareUpgrade;\n case 3:\n return FreezeType.FreezeUpgrade;\n case 4:\n return FreezeType.FreezeAbort;\n case 5:\n return FreezeType.TelemetryUpgrade;\n default:\n throw new Error(\n `(BUG) Status.fromCode() does not handle code: ${code}`\n );\n }\n }\n\n /**\n * @returns {HashgraphProto.proto.FreezeType}\n */\n valueOf() {\n return this._code;\n }\n}\n\n/**\n * An (invalid) default value for this enum, to ensure the client explicitly sets\n * the intended type of freeze transaction.\n */\nFreezeType.UnknownFreezeType = new FreezeType(0);\n\n/**\n * Freezes the network at the specified time. The start_time field must be provided and\n * must reference a future time. Any values specified for the update_file and file_hash\n * fields will be ignored. This transaction does not perform any network changes or\n * upgrades and requires manual intervention to restart the network.\n */\nFreezeType.FreezeOnly = new FreezeType(1);\n\n/**\n * A non-freezing operation that initiates network wide preparation in advance of a\n * scheduled freeze upgrade. The update_file and file_hash fields must be provided and\n * valid. The start_time field may be omitted and any value present will be ignored.\n */\nFreezeType.PrepareUpgrade = new FreezeType(2);\n\n/**\n * Freezes the network at the specified time and performs the previously prepared\n * automatic upgrade across the entire network.\n */\nFreezeType.FreezeUpgrade = new FreezeType(3);\n\n/**\n * Aborts a pending network freeze operation.\n */\nFreezeType.FreezeAbort = new FreezeType(4);\n\n/**\n * Performs an immediate upgrade on auxilary services and containers providing\n * telemetry/metrics. Does not impact network operations.\n */\nFreezeType.TelemetryUpgrade = new FreezeType(5);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/FreezeType.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenCreateTransactionBody} HashgraphProto.proto.ITokenCreateTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ }), +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("./CustomFee.js").default} CustomFee + */ -/***/ "./node_modules/@hashgraph/sdk/src/Hbar.js": -/*!*************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Hbar.js ***! - \*************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Create a new Hedera™ crypto-currency token. + */ +class TokenCreateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {string} [props.tokenName] + * @param {string} [props.tokenSymbol] + * @param {Long | number} [props.decimals] + * @param {Long | number} [props.initialSupply] + * @param {AccountId | string} [props.treasuryAccountId] + * @param {Key} [props.adminKey] + * @param {Key} [props.kycKey] + * @param {Key} [props.freezeKey] + * @param {Key} [props.pauseKey] + * @param {Key} [props.wipeKey] + * @param {Key} [props.supplyKey] + * @param {Key} [props.feeScheduleKey] + * @param {boolean} [props.freezeDefault] + * @param {AccountId | string} [props.autoRenewAccountId] + * @param {Timestamp | Date} [props.expirationTime] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {string} [props.tokenMemo] + * @param {CustomFee[]} [props.customFees] + * @param {TokenType} [props.tokenType] + * @param {TokenSupplyType} [props.supplyType] + * @param {Long | number} [props.maxSupply] + * @param {Key} [props.metadataKey] + * @param {Uint8Array} [props.metadata] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?string} + */ + this._tokenName = null; + + /** + * @private + * @type {?string} + */ + this._tokenSymbol = null; + + /** + * @private + * @type {?Long} + */ + this._decimals = null; + + /** + * @private + * @type {?Long} + */ + this._initialSupply = null; + + /** + * @private + * @type {?AccountId} + */ + this._treasuryAccountId = null; + + /** + * @private + * @type {?Key} + */ + this._adminKey = null; + + /** + * @private + * @type {?Key} + */ + this._kycKey = null; + + /** + * @private + * @type {?Key} + */ + this._freezeKey = null; + + /** + * @private + * @type {?Key} + */ + this._pauseKey = null; + + /** + * @private + * @type {?Key} + */ + this._wipeKey = null; + + /** + * @private + * @type {?Key} + */ + this._supplyKey = null; + + /** + * @private + * @type {?Key} + */ + this._feeScheduleKey = null; + + /** + * @private + * @type {?boolean} + */ + this._freezeDefault = null; + + /** + * @private + * @type {?AccountId} + */ + this._autoRenewAccountId = null; + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = new Timestamp_Timestamp( + Math.floor( + Date.now() / 1000 + DEFAULT_AUTO_RENEW_PERIOD.toNumber(), + ), + 0, + ); + + /** + * @private + * @type {?Duration} + */ + this._autoRenewPeriod = new Duration_Duration(DEFAULT_AUTO_RENEW_PERIOD); + + /** + * @private + * @type {?string} + */ + this._tokenMemo = null; + + /** + * @private + * @type {CustomFee[]} + */ + this._customFees = []; + + /** + * @private + * @type {?TokenType} + */ + this._tokenType = null; + + /** + * @private + * @type {?TokenSupplyType} + */ + this._supplyType = null; + + /** + * @private + * @type {?Long} + */ + this._maxSupply = null; + + this._defaultMaxTransactionFee = new Hbar_Hbar(30); + + /** + * @private + * @type {?Key} + */ + this._metadataKey = null; + + /** + * @private + * @description Metadata of the created token definition. + * @type {?Uint8Array} + */ + this._metadata = null; + + if (props.tokenName != null) { + this.setTokenName(props.tokenName); + } + + if (props.tokenSymbol != null) { + this.setTokenSymbol(props.tokenSymbol); + } + + if (props.decimals != null) { + this.setDecimals(props.decimals); + } + + if (props.initialSupply != null) { + this.setInitialSupply(props.initialSupply); + } + + if (props.treasuryAccountId != null) { + this.setTreasuryAccountId(props.treasuryAccountId); + } + + if (props.adminKey != null) { + this.setAdminKey(props.adminKey); + } + + if (props.kycKey != null) { + this.setKycKey(props.kycKey); + } + + if (props.freezeKey != null) { + this.setFreezeKey(props.freezeKey); + } + + if (props.pauseKey != null) { + this.setPauseKey(props.pauseKey); + } + + if (props.wipeKey != null) { + this.setWipeKey(props.wipeKey); + } + + if (props.supplyKey != null) { + this.setSupplyKey(props.supplyKey); + } + + if (props.feeScheduleKey != null) { + this.setFeeScheduleKey(props.feeScheduleKey); + } + + if (props.freezeDefault != null) { + this.setFreezeDefault(props.freezeDefault); + } + + if (props.autoRenewAccountId != null) { + this.setAutoRenewAccountId(props.autoRenewAccountId); + } + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + if (props.tokenMemo != null) { + this.setTokenMemo(props.tokenMemo); + } + + if (props.customFees != null) { + this.setCustomFees(props.customFees); + } + + if (props.tokenType != null) { + this.setTokenType(props.tokenType); + } + + if (props.supplyType != null) { + this.setSupplyType(props.supplyType); + } + + if (props.maxSupply != null) { + this.setMaxSupply(props.maxSupply); + } + + if (props.metadataKey != null) { + this.setMetadataKey(props.metadataKey); + } + + if (props.metadata != null) { + this.setMetadata(props.metadata); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenCreateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const create = + /** @type {HashgraphProto.proto.ITokenCreateTransactionBody} */ ( + body.tokenCreation + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenCreateTransaction({ + tokenName: create.name != null ? create.name : undefined, + tokenSymbol: create.symbol != null ? create.symbol : undefined, + decimals: create.decimals != null ? create.decimals : undefined, + initialSupply: + create.initialSupply != null + ? create.initialSupply + : undefined, + treasuryAccountId: + create.treasury != null + ? AccountId_AccountId._fromProtobuf(create.treasury) + : undefined, + adminKey: + create.adminKey != null + ? src_Key_Key._fromProtobufKey(create.adminKey) + : undefined, + kycKey: + create.kycKey != null + ? src_Key_Key._fromProtobufKey(create.kycKey) + : undefined, + freezeKey: + create.freezeKey != null + ? src_Key_Key._fromProtobufKey(create.freezeKey) + : undefined, + pauseKey: + create.pauseKey != null + ? src_Key_Key._fromProtobufKey(create.pauseKey) + : undefined, + wipeKey: + create.wipeKey != null + ? src_Key_Key._fromProtobufKey(create.wipeKey) + : undefined, + supplyKey: + create.supplyKey != null + ? src_Key_Key._fromProtobufKey(create.supplyKey) + : undefined, + feeScheduleKey: + create.feeScheduleKey != null + ? src_Key_Key._fromProtobufKey(create.feeScheduleKey) + : undefined, + freezeDefault: + create.freezeDefault != null + ? create.freezeDefault + : undefined, + autoRenewAccountId: + create.autoRenewAccount != null + ? AccountId_AccountId._fromProtobuf(create.autoRenewAccount) + : undefined, + expirationTime: + create.expiry != null + ? Timestamp_Timestamp._fromProtobuf(create.expiry) + : undefined, + autoRenewPeriod: + create.autoRenewPeriod != null + ? Duration_Duration._fromProtobuf(create.autoRenewPeriod) + : undefined, + tokenMemo: create.memo != null ? create.memo : undefined, + customFees: + create.customFees != null + ? create.customFees.map((fee) => { + if (fee.fixedFee != null) { + return CustomFixedFee._fromProtobuf(fee); + } else if (fee.fractionalFee != null) { + return CustomFractionalFee._fromProtobuf(fee); + } else { + return CustomRoyalyFee._fromProtobuf(fee); + } + }) + : undefined, + tokenType: + create.tokenType != null + ? TokenType._fromCode(create.tokenType) + : undefined, + supplyType: + create.supplyType != null + ? TokenSupplyType._fromCode(create.supplyType) + : undefined, + maxSupply: + create.maxSupply != null ? create.maxSupply : undefined, + metadataKey: + create.metadataKey != null + ? src_Key_Key._fromProtobufKey(create.metadataKey) + : undefined, + metadata: create.metadata != null ? create.metadata : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?string} + */ + get tokenName() { + return this._tokenName; + } + + /** + * @param {string} name + * @returns {this} + */ + setTokenName(name) { + this._requireNotFrozen(); + this._tokenName = name; + + return this; + } + + /** + * @returns {?string} + */ + get tokenSymbol() { + return this._tokenSymbol; + } + + /** + * @param {string} symbol + * @returns {this} + */ + setTokenSymbol(symbol) { + this._requireNotFrozen(); + this._tokenSymbol = symbol; + + return this; + } + + /** + * @returns {?Long} + */ + get decimals() { + return this._decimals; + } + + /** + * @param {Long | number} decimals + * @returns {this} + */ + setDecimals(decimals) { + this._requireNotFrozen(); + this._decimals = + decimals instanceof src_long ? decimals : src_long.fromValue(decimals); + + return this; + } + + /** + * @returns {?Long} + */ + get initialSupply() { + return this._initialSupply; + } + + /** + * @param {Long | number} initialSupply + * @returns {this} + */ + setInitialSupply(initialSupply) { + this._requireNotFrozen(); + this._initialSupply = src_long.fromValue(initialSupply); + + return this; + } + + /** + * @returns {?AccountId} + */ + get treasuryAccountId() { + return this._treasuryAccountId; + } + + /** + * @param {AccountId | string} id + * @returns {this} + */ + setTreasuryAccountId(id) { + this._requireNotFrozen(); + this._treasuryAccountId = + typeof id === "string" ? AccountId_AccountId.fromString(id) : id.clone(); + + return this; + } + + /** + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setAdminKey(key) { + this._requireNotFrozen(); + this._adminKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get kycKey() { + return this._kycKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setKycKey(key) { + this._requireNotFrozen(); + this._kycKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get freezeKey() { + return this._freezeKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setFreezeKey(key) { + this._requireNotFrozen(); + this._freezeKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get pauseKey() { + return this._pauseKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setPauseKey(key) { + this._requireNotFrozen(); + this._pauseKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get wipeKey() { + return this._wipeKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setWipeKey(key) { + this._requireNotFrozen(); + this._wipeKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get supplyKey() { + return this._supplyKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setSupplyKey(key) { + this._requireNotFrozen(); + this._supplyKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get feeScheduleKey() { + return this._feeScheduleKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setFeeScheduleKey(key) { + this._requireNotFrozen(); + this._feeScheduleKey = key; + + return this; + } + + /** + * @returns {?boolean} + */ + get freezeDefault() { + return this._freezeDefault; + } + + /** + * @param {boolean} freeze + * @returns {this} + */ + setFreezeDefault(freeze) { + this._requireNotFrozen(); + this._freezeDefault = freeze; + + return this; + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * @param {Timestamp | Date} time + * @returns {this} + */ + setExpirationTime(time) { + this._requireNotFrozen(); + this._expirationTime = + time instanceof Timestamp_Timestamp ? time : Timestamp_Timestamp.fromDate(time); + + return this; + } + + /** + * @returns {?AccountId} + */ + get autoRenewAccountId() { + return this._autoRenewAccountId; + } + + /** + * @param {AccountId | string} id + * @returns {this} + */ + setAutoRenewAccountId(id) { + this._requireNotFrozen(); + this._autoRenewAccountId = + id instanceof AccountId_AccountId ? id : AccountId_AccountId.fromString(id); + + return this; + } + + /** + * @returns {?Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * Set the auto renew period for this token. + * + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @returns {?string} + */ + get tokenMemo() { + return this._tokenMemo; + } + + /** + * @param {string} memo + * @returns {this} + */ + setTokenMemo(memo) { + this._requireNotFrozen(); + this._tokenMemo = memo; + + return this; + } + + /** + * @returns {CustomFee[]} + */ + get customFees() { + return this._customFees; + } + + /** + * @param {CustomFee[]} customFees + * @returns {this} + */ + setCustomFees(customFees) { + this._customFees = customFees; + return this; + } + + /** + * @returns {?TokenType} + */ + get tokenType() { + return this._tokenType; + } + + /** + * @param {TokenType} tokenType + * @returns {this} + */ + setTokenType(tokenType) { + this._tokenType = tokenType; + return this; + } + + /** + * @returns {?TokenSupplyType} + */ + get supplyType() { + return this._supplyType; + } + + /** + * @param {TokenSupplyType} supplyType + * @returns {this} + */ + setSupplyType(supplyType) { + this._supplyType = supplyType; + return this; + } + + /** + * @returns {?Long} + */ + get maxSupply() { + return this._maxSupply; + } + + /** + * @param {Long | number} maxSupply + * @returns {this} + */ + setMaxSupply(maxSupply) { + this._maxSupply = + typeof maxSupply === "number" + ? src_long.fromNumber(maxSupply) + : maxSupply; + return this; + } + + /** + * @returns {?Key} + */ + get metadataKey() { + return this._metadataKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setMetadataKey(key) { + this._requireNotFrozen(); + this._metadataKey = key; + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get metadata() { + return this._metadata; + } + + /** + * @param {Uint8Array} metadata + * @returns {this} + */ + setMetadata(metadata) { + this._requireNotFrozen(); + this._metadata = metadata; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._treasuryAccountId != null) { + this._treasuryAccountId.validateChecksum(client); + } + + if (this._autoRenewAccountId != null) { + this._autoRenewAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.createToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenCreation"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenCreateTransactionBody} + */ + _makeTransactionData() { + return { + name: this._tokenName, + symbol: this._tokenSymbol, + decimals: this._decimals != null ? this._decimals.toInt() : null, + initialSupply: this._initialSupply, + treasury: + this._treasuryAccountId != null + ? this._treasuryAccountId._toProtobuf() + : null, + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + kycKey: this._kycKey != null ? this._kycKey._toProtobufKey() : null, + freezeKey: + this._freezeKey != null + ? this._freezeKey._toProtobufKey() + : null, + pauseKey: + this._pauseKey != null ? this._pauseKey._toProtobufKey() : null, + wipeKey: + this._wipeKey != null ? this._wipeKey._toProtobufKey() : null, + supplyKey: + this._supplyKey != null + ? this._supplyKey._toProtobufKey() + : null, + feeScheduleKey: + this._feeScheduleKey != null + ? this._feeScheduleKey._toProtobufKey() + : null, + freezeDefault: this._freezeDefault, + autoRenewAccount: + this._autoRenewAccountId != null + ? this._autoRenewAccountId._toProtobuf() + : null, + expiry: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + autoRenewPeriod: + this._autoRenewPeriod != null + ? this._autoRenewPeriod._toProtobuf() + : null, + memo: this._tokenMemo, + customFees: this.customFees.map((fee) => fee._toProtobuf()), + tokenType: this._tokenType != null ? this._tokenType._code : null, + supplyType: + this._supplyType != null ? this._supplyType._code : null, + maxSupply: this.maxSupply, + metadataKey: + this._metadataKey != null + ? this._metadataKey._toProtobufKey() + : null, + metadata: this._metadata != null ? this._metadata : undefined, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenCreateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenCreation", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenCreateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Hbar; }\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ \"./node_modules/bignumber.js/bignumber.mjs\");\n/* harmony import */ var _long_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./long.js */ \"./node_modules/@hashgraph/sdk/src/long.js\");\n/* harmony import */ var _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./HbarUnit.js */ \"./node_modules/@hashgraph/sdk/src/HbarUnit.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./long.js\").LongObject} LongObject\n */\n\nclass Hbar {\n /**\n * @param {number | string | Long | LongObject | BigNumber} amount\n * @param {HbarUnit=} unit\n */\n constructor(amount, unit = _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Hbar) {\n if (unit === _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Tinybar) {\n this._valueInTinybar = (0,_long_js__WEBPACK_IMPORTED_MODULE_1__.valueToLong)(amount);\n } else {\n /** @type {BigNumber} */\n let bigAmount;\n\n if (long__WEBPACK_IMPORTED_MODULE_3__.isLong(amount)) {\n bigAmount = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](amount.toString(10));\n } else if (\n bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isBigNumber(amount) ||\n typeof amount === \"string\" ||\n typeof amount === \"number\"\n ) {\n bigAmount = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](amount);\n } else {\n bigAmount = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](0);\n }\n\n /**\n * @type {BigNumber}\n */\n this._valueInTinybar = bigAmount.multipliedBy(unit._tinybar);\n }\n if (!this._valueInTinybar.isInteger()) {\n throw new Error(\"Hbar in tinybars contains decimals\");\n }\n }\n\n /**\n * @param {number | Long | BigNumber} amount\n * @param {HbarUnit} unit\n * @returns {Hbar}\n */\n static from(amount, unit) {\n return new Hbar(amount, unit);\n }\n\n /**\n * @param {number | Long | string | BigNumber} amount\n * @returns {Hbar}\n */\n static fromTinybars(amount) {\n if (typeof amount === \"string\") {\n return this.fromString(amount, _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Tinybar);\n }\n return new Hbar(amount, _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Tinybar);\n }\n\n /**\n * @param {string} str\n * @param {HbarUnit=} unit\n * @returns {Hbar}\n */\n static fromString(str, unit = _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Hbar) {\n const pattern = /^((?:\\+|-)?\\d+(?:\\.\\d+)?)(?: (tℏ|μℏ|mℏ|ℏ|kℏ|Mℏ|Gℏ))?$/;\n if (pattern.test(str)) {\n let [amount, symbol] = str.split(\" \");\n if (symbol != null) {\n unit = _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(symbol);\n }\n return new Hbar(new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](amount), unit);\n } else {\n throw new Error(\"invalid argument provided\");\n }\n }\n\n /**\n * @param {HbarUnit} unit\n * @returns {BigNumber}\n */\n to(unit) {\n return this._valueInTinybar.dividedBy(unit._tinybar);\n }\n\n /**\n * @returns {BigNumber}\n */\n toBigNumber() {\n return this.to(_HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Hbar);\n }\n\n /**\n * @returns {Long}\n */\n toTinybars() {\n return long__WEBPACK_IMPORTED_MODULE_3__.fromValue(this._valueInTinybar.toFixed());\n }\n\n /**\n * @returns {Hbar}\n */\n negated() {\n return Hbar.fromTinybars(this._valueInTinybar.negated());\n }\n\n /**\n * @returns {boolean}\n */\n isNegative() {\n return this._valueInTinybar.isNegative();\n }\n\n /**\n * @param {HbarUnit=} unit\n * @returns {string}\n */\n toString(unit) {\n if (unit != null) {\n return `${this._valueInTinybar\n .dividedBy(unit._tinybar)\n .toString()} ${unit._symbol}`;\n }\n\n if (\n this._valueInTinybar.isLessThan(10000) &&\n this._valueInTinybar.isGreaterThan(-10000)\n ) {\n return `${this._valueInTinybar.toFixed()} ${\n _HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Tinybar._symbol\n }`;\n }\n\n return `${this.to(_HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Hbar).toString()} ${_HbarUnit_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].Hbar._symbol}`;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Hbar.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/HbarUnit.js": -/*!*****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/HbarUnit.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ HbarUnit; }\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ \"./node_modules/bignumber.js/bignumber.mjs\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\nclass HbarUnit {\n /**\n * @internal\n * @param {string} name\n * @param {string} symbol\n * @param {BigNumber} tinybar\n */\n constructor(name, symbol, tinybar) {\n /**\n * @internal\n * @readonly\n */\n this._name = name;\n\n /**\n * @internal\n * @readonly\n */\n this._symbol = symbol;\n\n /**\n * @internal\n * @readonly\n */\n this._tinybar = tinybar;\n\n Object.freeze(this);\n }\n\n /**\n * @param {string} unit\n * @returns {HbarUnit}\n */\n static fromString(unit) {\n switch (unit) {\n case HbarUnit.Hbar._symbol:\n return HbarUnit.Hbar;\n case HbarUnit.Tinybar._symbol:\n return HbarUnit.Tinybar;\n case HbarUnit.Microbar._symbol:\n return HbarUnit.Microbar;\n case HbarUnit.Millibar._symbol:\n return HbarUnit.Millibar;\n case HbarUnit.Kilobar._symbol:\n return HbarUnit.Kilobar;\n case HbarUnit.Megabar._symbol:\n return HbarUnit.Megabar;\n case HbarUnit.Gigabar._symbol:\n return HbarUnit.Gigabar;\n default:\n throw new Error(\"Unknown unit.\");\n }\n }\n}\n\nHbarUnit.Tinybar = new HbarUnit(\"tinybar\", \"tℏ\", new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](1));\n\nHbarUnit.Microbar = new HbarUnit(\"microbar\", \"μℏ\", new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](100));\n\nHbarUnit.Millibar = new HbarUnit(\"millibar\", \"mℏ\", new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](100000));\n\nHbarUnit.Hbar = new HbarUnit(\"hbar\", \"ℏ\", new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"100000000\"));\n\nHbarUnit.Kilobar = new HbarUnit(\n \"kilobar\",\n \"kℏ\",\n new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](1000).multipliedBy(new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"100000000\"))\n);\n\nHbarUnit.Megabar = new HbarUnit(\n \"megabar\",\n \"Mℏ\",\n new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](1000000).multipliedBy(new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"100000000\"))\n);\n\nHbarUnit.Gigabar = new HbarUnit(\n \"gigabar\",\n \"Gℏ\",\n new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"1000000000\").multipliedBy(new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"100000000\"))\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/HbarUnit.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenDeleteTransactionBody} HashgraphProto.proto.ITokenDeleteTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ "./node_modules/@hashgraph/sdk/src/Key.js": -/*!************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Key.js ***! - \************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Delete a new Hedera™ crypto-currency token. + */ +class TokenDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const deleteToken = + /** @type {HashgraphProto.proto.ITokenDeleteTransactionBody} */ ( + body.tokenDeletion + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenDeleteTransaction({ + tokenId: + deleteToken.token != null + ? TokenId_TokenId._fromProtobuf(deleteToken.token) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.deleteToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenDeletion"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenDeleteTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenDeletion", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenFeeScheduleUpdateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Key; }\n/* harmony export */ });\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n */\n\nclass Key {\n /**\n * @internal\n * @abstract\n * @returns {HashgraphProto.proto.IKey}\n */\n // eslint-disable-next-line jsdoc/require-returns-check\n _toProtobufKey() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IKey} key\n * @returns {Key}\n */\n static _fromProtobufKey(key) {\n if (key.contractID != null) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].contractId(key.contractID);\n }\n\n if (key.delegatableContractId != null) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].delegateContractId(key.delegatableContractId);\n }\n\n if (key.ed25519 != null && key.ed25519.byteLength > 0) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].publicKeyED25519(key.ed25519);\n }\n\n if (key.ECDSASecp256k1 != null && key.ECDSASecp256k1.byteLength > 0) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].publicKeyECDSA(key.ECDSASecp256k1);\n }\n\n if (key.thresholdKey != null && key.thresholdKey.threshold != null) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].thresholdKey(key.thresholdKey);\n }\n\n if (key.keyList != null) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].keyList(key.keyList);\n }\n\n //TODO think of a better solution\n // @ts-ignore\n return null;\n\n /* throw new Error(\n `(BUG) keyFromProtobuf: not implemented key case: ${JSON.stringify(\n key\n )}`\n ); */\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Key.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/KeyList.js": -/*!****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/KeyList.js ***! - \****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ KeyList; }\n/* harmony export */ });\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.IKeyList} HashgraphProto.proto.IKeyList\n * @typedef {import(\"@hashgraph/proto\").proto.IThresholdKey} HashgraphProto.proto.IThresholdKey\n */\n\n/**\n * A list of Keys (`Key`) with an optional threshold.\n */\nclass KeyList extends _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {?Key[]} [keys]\n * @param {?number} [threshold]\n */\n constructor(keys, threshold) {\n super();\n\n /**\n * @private\n * @type {Key[]}\n */\n // @ts-ignore\n if (keys == null) this._keys = [];\n //checks if the value for `keys` is passed as a single key\n //rather than a list that contains just one key\n else if (keys instanceof _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]) this._keys = [keys];\n else this._keys = keys;\n\n /**\n * @type {?number}\n */\n this._threshold = threshold == null ? null : threshold;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {KeyList}\n */\n static of(...keys) {\n return new KeyList(keys, null);\n }\n\n /**\n * @template T\n * @param {ArrayLike} arrayLike\n * @param {((key: Key) => Key)} [mapFn]\n * @param {T} [thisArg]\n * @returns {KeyList}\n */\n static from(arrayLike, mapFn, thisArg) {\n if (mapFn == null) {\n return new KeyList(Array.from(arrayLike));\n }\n\n return new KeyList(Array.from(arrayLike, mapFn, thisArg));\n }\n\n /**\n * @returns {?number}\n */\n get threshold() {\n return this._threshold;\n }\n\n /**\n * @param {number} threshold\n * @returns {this}\n */\n setThreshold(threshold) {\n this._threshold = threshold;\n return this;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {number}\n */\n push(...keys) {\n return this._keys.push(...keys);\n }\n\n /**\n * @param {number} start\n * @param {number} deleteCount\n * @param {Key[]} items\n * @returns {KeyList}\n */\n splice(start, deleteCount, ...items) {\n return new KeyList(\n this._keys.splice(start, deleteCount, ...items),\n this.threshold\n );\n }\n\n /**\n * @param {number=} start\n * @param {number=} end\n * @returns {KeyList}\n */\n slice(start, end) {\n return new KeyList(this._keys.slice(start, end), this.threshold);\n }\n\n /**\n * @returns {Iterator}\n */\n [Symbol.iterator]() {\n return this._keys[Symbol.iterator]();\n }\n\n /**\n * @returns {Key[]}\n */\n toArray() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this._keys.slice();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify({\n threshold: this._threshold,\n keys: this._keys.toString(),\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.IKey}\n */\n _toProtobufKey() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return\n const keys = this._keys.map((key) => key._toProtobufKey());\n\n if (this.threshold == null) {\n return { keyList: { keys } };\n } else {\n return {\n thresholdKey: {\n threshold: this.threshold,\n keys: { keys },\n },\n };\n }\n }\n\n /**\n * @param {HashgraphProto.proto.IKeyList} key\n * @returns {KeyList}\n */\n static __fromProtobufKeyList(key) {\n const keys = (key.keys != null ? key.keys : []).map((key) =>\n _Key_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufKey(key)\n );\n return new KeyList(keys);\n }\n\n /**\n * @param {HashgraphProto.proto.IThresholdKey} key\n * @returns {KeyList}\n */\n static __fromProtobufThresoldKey(key) {\n const list = KeyList.__fromProtobufKeyList(\n key.keys != null ? key.keys : {}\n );\n list.setThreshold(key.threshold != null ? key.threshold : 0);\n return list;\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setKeyList((key) => KeyList.__fromProtobufKeyList(key));\n_Cache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setThresholdKey((key) => KeyList.__fromProtobufThresoldKey(key));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/KeyList.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/LedgerId.js": -/*!*****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/LedgerId.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ LedgerId; }\n/* harmony export */ });\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * Represents the ID of a network.\n */\nclass LedgerId {\n /**\n * @hideconstructor\n * @internal\n * @param {Uint8Array} ledgerId\n */\n constructor(ledgerId) {\n /**\n * @readonly\n * @type {Uint8Array}\n */\n this._ledgerId = ledgerId;\n\n Object.freeze(this);\n }\n\n /**\n * @param {string} ledgerId\n * @returns {LedgerId}\n */\n static fromString(ledgerId) {\n switch (ledgerId) {\n case NETNAMES[0]:\n case \"0\":\n return LedgerId.MAINNET;\n case NETNAMES[1]:\n case \"1\":\n return LedgerId.TESTNET;\n case NETNAMES[2]:\n case \"2\":\n return LedgerId.PREVIEWNET;\n case NETNAMES[3]:\n case \"3\":\n return LedgerId.LOCAL_NODE;\n default: {\n let ledgerIdDecoded = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.decode(ledgerId);\n if (ledgerIdDecoded.length == 0 && ledgerId.length != 0) {\n throw new Error(\"Default reached for fromString\");\n } else {\n return new LedgerId(ledgerIdDecoded);\n }\n }\n }\n }\n\n /**\n * If the ledger ID is a known value such as `[0]`, `[1]`, `[2]` this method\n * will instead return \"mainnet\", \"testnet\", or \"previewnet\", otherwise it will\n * hex encode the bytes.\n *\n * @returns {string}\n */\n toString() {\n if (this._ledgerId.length == 1) {\n switch (this._ledgerId[0]) {\n case 0:\n return NETNAMES[0];\n case 1:\n return NETNAMES[1];\n case 2:\n return NETNAMES[2];\n case 3:\n return NETNAMES[3];\n default:\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this._ledgerId);\n }\n } else {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_0__.encode(this._ledgerId);\n }\n }\n\n /**\n * Using the UTF-8 byte representation of \"mainnet\", \"testnet\",\n * or \"previewnet\" is NOT supported.\n *\n * @param {Uint8Array} bytes\n * @returns {LedgerId}\n */\n static fromBytes(bytes) {\n return new LedgerId(bytes);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return this._ledgerId;\n }\n\n /**\n * @returns {boolean}\n */\n isMainnet() {\n return this.toString() == NETNAMES[0];\n }\n\n /**\n * @returns {boolean}\n */\n isTestnet() {\n return this.toString() == NETNAMES[1];\n }\n\n /**\n * @returns {boolean}\n */\n isPreviewnet() {\n return this.toString() == NETNAMES[2];\n }\n\n /**\n * @returns {boolean}\n */\n isLocalNode() {\n return this.toString() == NETNAMES[3];\n }\n}\n\nconst NETNAMES = [\"mainnet\", \"testnet\", \"previewnet\", \"local-node\"];\n\nLedgerId.MAINNET = new LedgerId(new Uint8Array([0]));\n\nLedgerId.TESTNET = new LedgerId(new Uint8Array([1]));\n\nLedgerId.PREVIEWNET = new LedgerId(new Uint8Array([2]));\n\nLedgerId.LOCAL_NODE = new LedgerId(new Uint8Array([3]));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/LedgerId.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenFeeScheduleUpdateTransactionBody} HashgraphProto.proto.ITokenFeeScheduleUpdateTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ }), +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("./CustomFee.js").default} CustomFee + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ "./node_modules/@hashgraph/sdk/src/ManagedNode.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/ManagedNode.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * FeeScheduleUpdate a new Hedera™ crypto-currency token. + */ +class TokenFeeScheduleUpdateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {CustomFee[]} [props.customFees] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {CustomFee[]} + */ + this._customFees = []; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.customFees != null) { + this.setCustomFees(props.customFees); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenFeeScheduleUpdateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const feeScheduleUpdate = + /** @type {HashgraphProto.proto.ITokenFeeScheduleUpdateTransactionBody} */ ( + body.tokenFeeScheduleUpdate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenFeeScheduleUpdateTransaction({ + tokenId: + feeScheduleUpdate.tokenId != null + ? TokenId_TokenId._fromProtobuf(feeScheduleUpdate.tokenId) + : undefined, + customFees: + feeScheduleUpdate.customFees != null + ? feeScheduleUpdate.customFees.map((fee) => { + if (fee.fixedFee != null) { + return CustomFixedFee._fromProtobuf(fee); + } else if (fee.fractionalFee != null) { + return CustomFractionalFee._fromProtobuf(fee); + } else { + return CustomRoyalyFee._fromProtobuf(fee); + } + }) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : TokenId_TokenId._fromProtobuf(tokenId._toProtobuf()); + + return this; + } + + /** + * @returns {CustomFee[]} + */ + get customFees() { + return this._customFees; + } + + /** + * @param {CustomFee[]} fees + * @returns {this} + */ + setCustomFees(fees) { + this._requireNotFrozen(); + this._customFees = fees; + + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.updateTokenFeeSchedule(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenFeeScheduleUpdate"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenFeeScheduleUpdateTransactionBody} + */ + _makeTransactionData() { + return { + tokenId: this._tokenId != null ? this._tokenId._toProtobuf() : null, + customFees: this._customFees.map((fee) => fee._toProtobuf()), + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenFeeScheduleUpdateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenFeeScheduleUpdate", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenFeeScheduleUpdateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenFreezeTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ManagedNode; }\n/* harmony export */ });\n/* harmony import */ var _ManagedNodeAddress_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ManagedNodeAddress.js */ \"./node_modules/@hashgraph/sdk/src/ManagedNodeAddress.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"./address_book/NodeAddress.js\").default} NodeAddress\n */\n\n/**\n * @template {Channel | MirrorChannel} ChannelT\n * @typedef {object} NewNode\n * @property {string | ManagedNodeAddress} address\n * @property {(address: string, cert?: string) => ChannelT} channelInitFunction\n */\n\n/**\n * @template {Channel | MirrorChannel} ChannelT\n * @typedef {object} CloneNode\n * @property {ManagedNode} node\n * @property {ManagedNodeAddress} address\n */\n\n/**\n * @abstract\n * @template {Channel | MirrorChannel} ChannelT\n */\nclass ManagedNode {\n /**\n * @param {object} props\n * @param {NewNode=} [props.newNode]\n * @param {CloneNode=} [props.cloneNode]\n */\n constructor(props = {}) {\n if (props.newNode != null) {\n this._address =\n typeof props.newNode.address === \"string\"\n ? _ManagedNodeAddress_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(props.newNode.address)\n : props.newNode.address;\n\n /** @type {string=} */\n this._cert = undefined;\n\n /** @type {ChannelT | null} */\n this._channel = null;\n\n /** @type {(address: string, cert?: string) => ChannelT} */\n this._channelInitFunction = props.newNode.channelInitFunction;\n\n this._lastUsed = Date.now();\n this._readmitTime = Date.now();\n this._useCount = 0;\n this._badGrpcStatusCount = 0;\n this._minBackoff = 8000;\n this._maxBackoff = 1000 * 60 * 60;\n this._currentBackoff = this._minBackoff;\n } else if (props.cloneNode != null) {\n /** @type {ManagedNodeAddress} */\n this._address = props.cloneNode.address;\n\n /** @type {string=} */\n this._cert = props.cloneNode.node._cert;\n\n /** @type {ChannelT | null} */\n this._channel = props.cloneNode.node._channel;\n\n /** @type {(address: string, cert?: string) => ChannelT} */\n this._channelInitFunction =\n props.cloneNode.node._channelInitFunction;\n\n /** @type {number} */\n this._currentBackoff = props.cloneNode.node._currentBackoff;\n\n /** @type {number} */\n this._lastUsed = props.cloneNode.node._lastUsed;\n\n /** @type {number} */\n this._readmitTime = props.cloneNode.node._readmitTime;\n\n /** @type {number} */\n this._useCount = props.cloneNode.node._useCount;\n\n /** @type {number} */\n this._badGrpcStatusCount = props.cloneNode.node._badGrpcStatusCount;\n\n /** @type {number} */\n this._minBackoff = props.cloneNode.node._minBackoff;\n\n /** @type {number} */\n this._maxBackoff = props.cloneNode.node._minBackoff;\n } else {\n throw new Error(\n `failed to create ManagedNode: ${JSON.stringify(props)}`\n );\n }\n }\n\n /**\n * @abstract\n * @returns {string}\n */\n // eslint-disable-next-line jsdoc/require-returns-check\n getKey() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @abstract\n * @returns {ManagedNode}\n */\n // eslint-disable-next-line jsdoc/require-returns-check\n toInsecure() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @abstract\n * @returns {ManagedNode}\n */\n // eslint-disable-next-line jsdoc/require-returns-check\n toSecure() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @param {string} ledgerId\n * @returns {this}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setCert(ledgerId) {\n return this;\n }\n\n /**\n * @returns {ManagedNodeAddress}\n */\n get address() {\n return this._address;\n }\n\n /**\n * @returns {number}\n */\n get attempts() {\n return this._badGrpcStatusCount;\n }\n\n /**\n * @returns {number}\n */\n get minBackoff() {\n return this._minBackoff;\n }\n\n /**\n * @param {number} minBackoff\n * @returns {this}\n */\n setMinBackoff(minBackoff) {\n if (this._currentBackoff <= minBackoff) {\n this._currentBackoff = minBackoff;\n }\n\n this._minBackoff = minBackoff;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxBackoff() {\n return this._maxBackoff;\n }\n\n /**\n * @param {number} maxBackoff\n * @returns {this}\n */\n setMaxBackoff(maxBackoff) {\n if (this._currentBackoff <= maxBackoff) {\n this._currentBackoff = maxBackoff;\n }\n\n this._maxBackoff = maxBackoff;\n return this;\n }\n\n getChannel() {\n this._useCount++;\n this.__lastUsed = Date.now();\n\n if (this._channel != null) {\n return this._channel;\n }\n\n this._channel = this._channelInitFunction(\n this.address.toString(),\n this._cert\n );\n return this._channel;\n }\n\n /**\n * Determines if this node is healthy by checking if this node hasn't been\n * in use for a the required `_currentBackoff` period. Since this looks at `this._lastUsed`\n * and that value is only set in the `wait()` method, any node that has not\n * returned a bad gRPC status will always be considered healthy.\n *\n * @returns {boolean}\n */\n isHealthy() {\n return this._readmitTime <= Date.now();\n }\n\n increaseBackoff() {\n this._currentBackoff = Math.min(\n this._currentBackoff * 2,\n this._maxBackoff\n );\n this._readmitTime = Date.now() + this._currentBackoff;\n }\n\n decreaseBackoff() {\n this._currentBackoff = Math.max(\n this._currentBackoff / 2,\n this._minBackoff\n );\n }\n\n /**\n * @returns {number}\n */\n getRemainingTime() {\n return this._readmitTime - this._lastUsed;\n }\n\n /**\n * This is only ever called if the node itself is down.\n * A node returning a transaction with a bad status code does not indicate\n * the node is down, and hence this method will not be called.\n *\n * @returns {Promise}\n */\n backoff() {\n return new Promise((resolve) =>\n setTimeout(resolve, this.getRemainingTime())\n );\n }\n\n /**\n * @param {ManagedNode<*>} node\n * @returns {number}\n */\n compare(node) {\n let comparison = this.getRemainingTime() - node.getRemainingTime();\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = this._currentBackoff - node._currentBackoff;\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = this._badGrpcStatusCount - node._badGrpcStatusCount;\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = this._useCount - node._useCount;\n if (comparison != 0) {\n return comparison;\n }\n\n return this._lastUsed - node._lastUsed;\n }\n\n close() {\n if (this._channel != null) {\n this._channel.close();\n }\n\n this._channel = null;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/ManagedNode.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/ManagedNodeAddress.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/ManagedNodeAddress.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HOST_AND_PORT\": function() { return /* binding */ HOST_AND_PORT; },\n/* harmony export */ \"default\": function() { return /* binding */ ManagedNodeAddress; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"./address_book/NodeAddress.js\").default} NodeAddress\n */\n\nconst HOST_AND_PORT = /^(\\S+):(\\d+)$/;\n\nclass ManagedNodeAddress {\n /**\n * @param {object} props\n * @param {string} [props.address]\n * @param {string} [props.host]\n * @param {number | null} [props.port]\n */\n constructor(props = {}) {\n if (props.address != null) {\n const hostAndPortResult = HOST_AND_PORT.exec(props.address);\n\n if (hostAndPortResult == null) {\n throw new Error(`failed to parse address: ${props.address}`);\n }\n\n /** @type {string} */\n this._address = /** @type {string} */ (hostAndPortResult[1]);\n\n /** @type {number | null} */\n this._port =\n hostAndPortResult[2] != null\n ? parseInt(/** @type {string }*/ (hostAndPortResult[2]))\n : null;\n } else if (props.host != null && props.port != null) {\n /** @type {string} */\n this._address = props.host;\n\n /** @type {number | null} */\n this._port = props.port;\n } else {\n throw new Error(\n `failed to create a managed node address: ${JSON.stringify(\n props\n )}`\n );\n }\n\n Object.freeze(this);\n }\n\n /**\n * @param {string} address\n * @returns {ManagedNodeAddress};\n */\n static fromString(address) {\n return new ManagedNodeAddress({ address });\n }\n\n toInsecure() {\n let port = this.port;\n\n switch (this.port) {\n case 50212:\n port = 50211;\n break;\n case 443:\n port = 5600;\n }\n\n return new ManagedNodeAddress({ host: this.address, port });\n }\n\n toSecure() {\n let port = this.port;\n\n switch (this.port) {\n case 50211:\n port = 50212;\n break;\n case 5600:\n port = 443;\n }\n\n return new ManagedNodeAddress({ host: this.address, port });\n }\n\n /**\n * @returns {string}\n */\n get address() {\n return this._address;\n }\n\n /**\n * @returns {number | null}\n */\n get port() {\n return this._port;\n }\n\n /**\n * @returns {boolean}\n */\n isTransportSecurity() {\n return this._port == 50212 || this._port == 443;\n }\n\n /**\n * @returns {string}\n */\n toString() {\n if (this.port == null) {\n return this.address;\n } else {\n return `${this.address}:${this.port}`;\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/ManagedNodeAddress.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenFreezeAccountTransactionBody} HashgraphProto.proto.ITokenFreezeAccountTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ "./node_modules/@hashgraph/sdk/src/MaxQueryPaymentExceeded.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/MaxQueryPaymentExceeded.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ MaxQueryPaymentExceeded; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @typedef {import(\"./Hbar.js\").default} Hbar\n */\n\nclass MaxQueryPaymentExceeded extends Error {\n /**\n * @param {Hbar} queryCost\n * @param {Hbar} maxQueryPayment\n */\n constructor(queryCost, maxQueryPayment) {\n super();\n\n this.message = `query cost of ${queryCost.toString()} HBAR exceeds max set on client: ${maxQueryPayment.toString()} HBAR`;\n this.name = \"MaxQueryPaymentExceededError\";\n this.queryCost = queryCost;\n this.maxQueryPayment = maxQueryPayment;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/MaxQueryPaymentExceeded.js?"); +/** + * Freeze a new Hedera™ crypto-currency token. + */ +class TokenFreezeTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenFreezeTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const freezeToken = + /** @type {HashgraphProto.proto.ITokenFreezeAccountTransactionBody} */ ( + body.tokenFreeze + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenFreezeTransaction({ + tokenId: + freezeToken.token != null + ? TokenId_TokenId._fromProtobuf(freezeToken.token) + : undefined, + accountId: + freezeToken.account != null + ? AccountId_AccountId._fromProtobuf(freezeToken.account) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.freezeTokenAccount(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenFreeze"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenFreezeAccountTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + account: + this._accountId != null ? this._accountId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenFreezeTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenFreeze", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenFreezeTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenGrantKycTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/MirrorNode.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/MirrorNode.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ MirrorNode; }\n/* harmony export */ });\n/* harmony import */ var _ManagedNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ManagedNode.js */ \"./node_modules/@hashgraph/sdk/src/ManagedNode.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @typedef {import(\"./channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"./ManagedNodeAddress.js\").default} ManagedNodeAddress\n */\n\n/**\n * @typedef {object} NewNode\n * @property {string} address\n * @property {(address: string, cert?: string) => MirrorChannel} channelInitFunction\n */\n\n/**\n * @typedef {object} CloneNode\n * @property {MirrorNode} node\n * @property {ManagedNodeAddress} address\n */\n\n/**\n * @augments {ManagedNode}\n */\nclass MirrorNode extends _ManagedNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {NewNode=} [props.newNode]\n * @param {CloneNode=} [props.cloneNode]\n */\n constructor(props = {}) {\n super(props);\n }\n\n /**\n * @returns {string}\n */\n getKey() {\n return this._address.toString();\n }\n\n /**\n * @returns {MirrorNode}\n */\n toInsecure() {\n return new MirrorNode({\n cloneNode: { node: this, address: this._address.toInsecure() },\n });\n }\n\n /**\n * @returns {MirrorNode}\n */\n toSecure() {\n return new MirrorNode({\n cloneNode: { node: this, address: this._address.toSecure() },\n });\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/MirrorNode.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/Mnemonic.js": -/*!*****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Mnemonic.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenGrantKycTransactionBody} HashgraphProto.proto.ITokenGrantKycTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Mnemonic; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/cryptography */ \"./node_modules/@hashgraph/cryptography/src/index.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n */\n\n/**\n * Multi-word mnemonic phrase (BIP-39).\n *\n * Compatible with the official Hedera mobile\n * wallets (24-words or 22-words) and BRD (12-words).\n */\nclass Mnemonic {\n /**\n * @param {cryptography.Mnemonic} mnemonic\n * @hideconstructor\n * @private\n */\n constructor(mnemonic) {\n this._mnemonic = mnemonic;\n }\n\n /**\n * Returns a new random 24-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise}\n */\n static async generate() {\n return new Mnemonic(await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.Mnemonic._generate(24));\n }\n\n /**\n * Returns a new random 12-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise}\n */\n static async generate12() {\n return new Mnemonic(await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.Mnemonic._generate(12));\n }\n\n /**\n * Construct a mnemonic from a list of words. Handles 12, 22 (legacy), and 24 words.\n *\n * An exception of BadMnemonicError will be thrown if the mnemonic\n * contains unknown words or fails the checksum. An invalid mnemonic\n * can still be used to create private keys, the exception will\n * contain the failing mnemonic in case you wish to ignore the\n * validation error and continue.\n *\n * @param {string[]} words\n * @throws {BadMnemonicError}\n * @returns {Promise}\n */\n static async fromWords(words) {\n return new Mnemonic(await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.Mnemonic.fromWords(words));\n }\n\n /**\n * @deprecated - Use `toEd25519PrivateKey()` or `toEcdsaPrivateKey()` instead\n * Recover a private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n async toPrivateKey(passphrase = \"\") {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].privateKeyConstructor(\n // eslint-disable-next-line deprecation/deprecation\n await this._mnemonic.toPrivateKey(passphrase)\n );\n }\n\n /**\n * Recover an Ed25519 private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise}\n */\n async toEd25519PrivateKey(passphrase = \"\", path) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].privateKeyConstructor(\n await this._mnemonic.toEd25519PrivateKey(passphrase, path)\n );\n }\n\n /**\n * Recover an ECDSA private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise}\n */\n async toEcdsaPrivateKey(passphrase = \"\", path) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].privateKeyConstructor(\n await this._mnemonic.toEcdsaPrivateKey(passphrase, path)\n );\n }\n\n /**\n * Recover a mnemonic phrase from a string, splitting on spaces. Handles 12, 22 (legacy), and 24 words.\n *\n * @param {string} mnemonic\n * @returns {Promise}\n */\n static async fromString(mnemonic) {\n return new Mnemonic(await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.Mnemonic.fromString(mnemonic));\n }\n\n /**\n * @returns {Promise}\n */\n async toLegacyPrivateKey() {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].privateKeyConstructor(\n await this._mnemonic.toLegacyPrivateKey()\n );\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._mnemonic.toString();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Mnemonic.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ }), +/** + * GrantKyc a new Hedera™ crypto-currency token. + */ +class TokenGrantKycTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenGrantKycTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const grantKycToken = + /** @type {HashgraphProto.proto.ITokenGrantKycTransactionBody} */ ( + body.tokenGrantKyc + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenGrantKycTransaction({ + tokenId: + grantKycToken.token != null + ? TokenId_TokenId._fromProtobuf(grantKycToken.token) + : undefined, + accountId: + grantKycToken.account != null + ? AccountId_AccountId._fromProtobuf(grantKycToken.account) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.grantKycToTokenAccount(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenGrantKyc"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenGrantKycTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + account: + this._accountId != null ? this._accountId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenGrantKycTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenGrantKyc", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenGrantKycTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/Node.js": -/*!*************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Node.js ***! - \*************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Node; }\n/* harmony export */ });\n/* harmony import */ var _ManagedNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ManagedNode.js */ \"./node_modules/@hashgraph/sdk/src/ManagedNode.js\");\n/* harmony import */ var _NodeCerts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NodeCerts.js */ \"./node_modules/@hashgraph/sdk/src/NodeCerts.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./address_book/NodeAddress.js\").default} NodeAddress\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./ManagedNodeAddress.js\").default} ManagedNodeAddress\n * @typedef {import(\"./LedgerId.js\").default} LedgerId\n */\n\n/**\n * @typedef {object} NewNode\n * @property {AccountId} accountId\n * @property {string} address\n * @property {(address: string, cert?: string) => Channel} channelInitFunction\n */\n\n/**\n * @typedef {object} CloneNode\n * @property {Node} node\n * @property {ManagedNodeAddress} address\n */\n\n/**\n * @augments {ManagedNode}\n */\nclass Node extends _ManagedNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {NewNode=} [props.newNode]\n * @param {CloneNode=} [props.cloneNode]\n */\n constructor(props = {}) {\n super(props);\n\n if (props.newNode != null) {\n /** @type {AccountId} */\n this._accountId = props.newNode.accountId;\n\n /** @type {NodeAddress | null} */\n this._nodeAddress = null;\n } else if (props.cloneNode != null) {\n /** @type {AccountId} */\n this._accountId = props.cloneNode.node._accountId;\n\n /** @type {NodeAddress | null} */\n this._nodeAddress = props.cloneNode.node._nodeAddress;\n } else {\n throw new Error(`failed to create node: ${JSON.stringify(props)}`);\n }\n }\n\n /**\n * @returns {string}\n */\n getKey() {\n return this._accountId.toString();\n }\n\n /**\n * @returns {ManagedNode}\n */\n toInsecure() {\n return /** @type {this} */ (\n new Node({\n cloneNode: { node: this, address: this._address.toInsecure() },\n })\n );\n }\n\n /**\n * @returns {ManagedNode}\n */\n toSecure() {\n return /** @type {this} */ (\n new Node({\n cloneNode: { node: this, address: this._address.toSecure() },\n })\n );\n }\n\n /**\n * @param {LedgerId|string} ledgerId\n * @returns {this}\n */\n setCert(ledgerId) {\n switch (ledgerId.toString()) {\n case \"previewnet\":\n this._cert = _NodeCerts_js__WEBPACK_IMPORTED_MODULE_1__.PREVIEWNET_CERTS[this._accountId.toString()];\n break;\n case \"testnet\":\n this._cert = _NodeCerts_js__WEBPACK_IMPORTED_MODULE_1__.TESTNET_CERTS[this._accountId.toString()];\n break;\n case \"mainnet\":\n this._cert = _NodeCerts_js__WEBPACK_IMPORTED_MODULE_1__.MAINNET_CERTS[this._accountId.toString()];\n break;\n }\n\n return this;\n }\n\n /**\n * @returns {AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @returns {NodeAddress | null}\n */\n get nodeAddress() {\n return this._nodeAddress;\n }\n\n /**\n * @param {NodeAddress} nodeAddress\n * @returns {this}\n */\n setNodeAddress(nodeAddress) {\n this._nodeAddress = nodeAddress;\n return this;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Node.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/NodeCerts.js": -/*!******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/NodeCerts.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MAINNET_CERTS\": function() { return /* binding */ MAINNET_CERTS; },\n/* harmony export */ \"PREVIEWNET_CERTS\": function() { return /* binding */ PREVIEWNET_CERTS; },\n/* harmony export */ \"TESTNET_CERTS\": function() { return /* binding */ TESTNET_CERTS; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/** @type {{[key: string]: string}} */\nconst PREVIEWNET_CERTS = {\n \"0.0.3\": `-----BEGIN CERTIFICATE-----\nMIICnzCCAiWgAwIBAgIUenyqJ4UaFBbwokatcUqAwW3o3rswCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDAxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMTU4WhgPMjI5NTA2MDcyMjIxNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAwMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEm5b1+oG9R0qt\nzM7UZnS5l/xxUNHIHq5+NAvtlviCpJL19jrW9+/UOy00Qqc6vS6tS1hS+dNJmpiZ\nFN0EHew4VDR7ACnL4LDJKmIHWjQ0iwvZo5kCpO0r9BtPN5FvaSxyo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUeciBviJtjeuue0GPf1xllNw7qvYwCgYIKoZIzj0EAwMDaAAwZQIw\nJeG0H2HdsI1VhOYmJmYlNeKCNgAk+LMorzPmsIInVBO2HK2IrKfpReWDS/m5j51V\nAjEAxKBxDezJDqAZHTkTXCg+X9Q9V6J6M5yDy5IS90aCWEo+W8C1Hc6hkn2/NrvT\nPhwK\n-----END CERTIFICATE-----\n`,\n \"0.0.4\": `-----BEGIN CERTIFICATE-----\nMIICnjCCAiWgAwIBAgIUUfjO8LyXBdzrzbAe1Yl+d34IDsIwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDExHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMTU5WhgPMjI5NTA2MDcyMjIxNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAxMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAERwfj4ZtD/wRb\nf8h9NEMu2sQoLFK9Gc4SQ8o6j4ccLYGdgOoVoq4zzy4Jr7ZtCTuACfCfhp7wy8ra\n+6cugccaSd6AzOKRSVZvQvkUTFKIoAOKwp6IhlU48rmi80MT07eyo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUCGhfVMP72Y0G5XUksE3dPgFHrzkwCgYIKoZIzj0EAwMDZwAwZAIw\ncpX7irZWyuujWRYUs9kLNgB2YLQK+n8r1fH+tJg3+zkcZ2pzhGWmpUUZWOzsDqGC\nAjBUbhlmrTc4LrEBN0EMiRYzfPD2kBZxusLBDIg/aDYERCMcsFvF1T9SsuasF/B+\ncI8=\n-----END CERTIFICATE-----\n`,\n \"0.0.5\": `-----BEGIN CERTIFICATE-----\nMIICnjCCAiWgAwIBAgIUIo4L+7xe/mUmpKy4qOAQEIxz8UMwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDIxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMTU5WhgPMjI5NTA2MDcyMjIxNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAyMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEoFgCjb1/7BUJ\nEXKIPJLlsOSp/39G8l92wOSr7h+Py7iwVwu68H2ykftMOq3tRwDRXZHz7ViqcIZ9\nlfMcS8sbRtVm9tBbNciVUqTLWX9nHr/c4PhKEi+LdgtSUr2+hHiWo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUMR89BHC3yKC4YwUgyBVQUGBCprQwCgYIKoZIzj0EAwMDZwAwZAIw\nUs2BdslcScIwcmxoB60K7/1BPfQI8ccDZIMosas6U2zhinTnRKik1T0i+uHhLl8e\nAjA5apAwSPTnP7j3Bo/FOCkfjTqOjwp2lUqzDJYKolKsHX2sy8hX9MkYiY46SaJ1\nP+0=\n-----END CERTIFICATE-----\n`,\n \"0.0.6\": `-----BEGIN CERTIFICATE-----\nMIICnzCCAiWgAwIBAgIUWpji03mJsR/16MP8BrOfpNz7aQMwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDMxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMTU5WhgPMjI5NTA2MDcyMjIxNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAzMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE+KDMC99Q1rWi\n+FwlytGMS5qzTDytCvk+PzdONnDZ/weNSv4j3BXSo588IwhIxLtfcBlyo/+PmE1c\n5qGFXuMoZjGr22VpvogkRgPejD+Gawb4A2XHkMCD8NmO66uPw97po1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUN1qEI4eQ+WHavb9ypGV417NvhGowCgYIKoZIzj0EAwMDaAAwZQIw\nL0khkiDOiFRa3wx9l5JNjaSRePPc3ZaTaJQkPYeauMaLWEvmC/0e2/e9gPm5qJ8E\nAjEAgXQMko3vNB8VRN4XjyFJa8p/muZ/tLA15wPnb/boUmiZ+njDDSaiu8tIQrTB\ngHW6\n-----END CERTIFICATE-----\n`,\n \"0.0.7\": `-----BEGIN CERTIFICATE-----\nMIICnjCCAiWgAwIBAgIUEJ7AJvrqDUBNKbssGoJtww3v+WowCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDQxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMjAwWhgPMjI5NTA2MDcyMjIyMDBaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA0MR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEfgJ8w9GUWM3y\nyusedZOFQrgXFVsdtRsMSHbqyVCN6+Wow6SIjy29GRMSP5R2aswupFgh6lXJRqnr\ntY+hpRumFKsmSo+5+l8DBcql4rzs4utESTehM+Cq9LYc4A1z0UIRo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUMCm3UqSbT01Zr23hLzCGnXbDa+MwCgYIKoZIzj0EAwMDZwAwZAIw\nFNcN7mKJo/bwpRT+y/KbYkCJsvljdbXzJOXXQ3e6J6R+0vLqcT25J/ry6pBZMUwR\nAjAswu29z8KJCSxnWwnPpHDmkRT15zG/xS+pAmx3oeQSqp6ZD7qpdJE8zzhbfe5x\nwAc=\n-----END CERTIFICATE-----\n`,\n};\n\n/** @type {{[key: string]: string}} */\nconst TESTNET_CERTS = {\n \"0.0.3\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiWgAwIBAgIUMkNeM6Sbk9ZFYmRWZmSgTQHHWyUwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDAxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMjU4WhgPMjI5NTA2MDcyMjIyNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAwMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETLLoIMZjEhDP\nKLHS7bJT4OTYGgR/8mB65yfx3KqMLYFF+q2SpWkIrYgUQLVEUEibVSnLlxRUzH7R\nszcKynpTwh0W0yfWanZKQg+RWoKkEYlu2GvkUtJb8cRVM9NLmJUeo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUSrIepwFx8gZ8/G+WGaxs6GgkMtQwCgYIKoZIzj0EAwMDaQAwZgIx\nAJxC0fjB1OrF9vkCKsfnPS3Z+1hscrZhEDG38NxdLEAfPQ5VmyrSBgJy11FBp8yB\n0QIxAKzbge3Lf7iBMwYwm+2M/GiVgmHNMLdtrYuerWpdbYOHgRNAkyt57JoThn0u\nTzkd5Q==\n-----END CERTIFICATE-----\n`,\n \"0.0.4\": `-----BEGIN CERTIFICATE-----\nMIICnzCCAiWgAwIBAgIUGLriiLPacglp6U+BtJcF9TI7xEUwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDExHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMjU4WhgPMjI5NTA2MDcyMjIyNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAxMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEXhR9cb6mH9AE\nGNSGk3OkxN1C/JW49ddYZ/XWD4InjS8D1kXmB1Y39v1mF0L1loG6lDT8Zp46zrj7\n5zMONXZeD2b0mx5hHhtllPTpJ10Tlt9FDoyFbKwPRQ/SAPNADfuzo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUCaKtx8RZ1XJO9rmZMbIcFJZkcv4wCgYIKoZIzj0EAwMDaAAwZQIx\nAPhDW0VrNSmq8hODdhIVV4GyvpYhp3Fksg+sZr3DmUatwn+ptj+X+9IzgPl9QYE3\nkAIwcy2ixgNkjC/DYVmgT4MpUnLneLK0gA23Vj2QwACaTH99H/ybqUH7srj0POB9\n5wvV\n-----END CERTIFICATE-----\n`,\n \"0.0.5\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiWgAwIBAgIUEMduome38hvAuIKoGjg/tHatQZMwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDIxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMjU4WhgPMjI5NTA2MDcyMjIyNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAyMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEl1olzP1L4WgX\nd7aujOXmTQZt3tEOGzkMa3S6qJwISLBI7Tb9KaW8zYIe9xWBVAwphCbD0wn9xpPV\nwMr4uTn+JocugYBbe2YoUGzWTkxWnOEKXbh/nQJCe3XE/C0FY8fAo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQULfw7LVtTiUDVIvZwhhWW0soQtSQwCgYIKoZIzj0EAwMDaQAwZgIx\nAID5v3Lo2zlnpFzTdJFqBpw6fV+vmpI+JBj61f264J/uHMbELiu2dwxhwWaMElX7\nwQIxAJxccFr7Bf1KjaMyT2dq75zQzFuKDMj9x92yAqM2Gas/Yay+Ccpm8FBn7BFl\nke1Qwg==\n-----END CERTIFICATE-----\n`,\n \"0.0.6\": `-----BEGIN CERTIFICATE-----\nMIICnzCCAiWgAwIBAgIUcCg/gZGxk/UjYkhW1jg4Zki+jfwwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDMxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMjU5WhgPMjI5NTA2MDcyMjIyNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAzMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEOSsXBZicyrxy\ntHJHKh04Mvu6SKM49IC7rAXw5CjlOod5OTeHg0fa5vVoBME4mlWP+LsMMqf8welC\n20b4wMwUC1Hnd66v8crX8L1wvZ9EmKLTvhTd65bS5zloMiSbpdF2o1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUgMMwqaGuUT6JCH0gsbqullaW6/QwCgYIKoZIzj0EAwMDaAAwZQIx\nAMggJ1eMmT7C14z7wHCsOdDOgmzg733+a5dsuAcxknoz/sQLN8wqy1JxShWgEIA/\nxwIweTDAX/4JZnr3mlSC57lYXbHk/c319VfN9Ybxg0FaDXa8tOqg7Ml6Uu3IGujQ\na3eY\n-----END CERTIFICATE-----\n`,\n \"0.0.7\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiWgAwIBAgIUXADwhiD5acpA66GPoXuAevBfZBIwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDQxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjIyMjU5WhgPMjI5NTA2MDcyMjIyNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA0MR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEBgLhLiGz8qWu\n50vzxSyQkrmhpxuHBJhpGzA0WaUJdAUlaUOL1753ZxxA08wUmcozILNEnMaQ+ROn\n+fuGctv90ZcrSekODjxjbKH2ntVLP8xwkBRCTJ0WRBNenxxBD438o1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUhYOOD/z3ty9O5GuSTXnyujIqBRgwCgYIKoZIzj0EAwMDaQAwZgIx\nAMxbZ4gvkXaORauQFUPRYwOJrihWIA+3ttGDua//YfEbshytQ8b4L65W/1Xs8eOd\nDwIxAImwTzRam8tScdOzmuGgPcML2lkETMpMA2rZYVyEL/VNktIxvB2oE+4M0v5l\nr8IbTA==\n-----END CERTIFICATE-----\n`,\n};\n\n/** @type {{[key: string]: string}} */\nconst MAINNET_CERTS = {\n \"0.0.3\": `-----BEGIN CERTIFICATE-----\nMIICnjCCAiWgAwIBAgIUZWoT9TlgbZy+syLbqZhO5++1cVgwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDAxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjQ3WhgPMjI5NTA2MDcyMjQyNDdaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAwMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8NhDGK/dgWvD\nRHEJ8af7CBDdhvujH5XIrLen33GTLY8DbJwJW2jdsLGx3+DRVVmeNQZxCbcGj0e2\nIyypkG6s0mtnmeymD8mI3JU8m1aZiuIptZSH3Bw1BNn2hKU4x42co1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUbYGliiNtMkGaroQxXWCl+kYHDBwwCgYIKoZIzj0EAwMDZwAwZAIw\nImTOEYu0y73Ggt4NAjFFsN2sV7CsEL3NoJqJ7MZ6U+b3Ax1hnc1eE0oei6xH4VNF\nAjBB4iZNvAn6Esiu4k+JPlYuMesplgMv33fU5GsfvLIovN8pOJDe0c+CUmsnfGbP\nOsQ=\n-----END CERTIFICATE-----\n`,\n \"0.0.4\": `-----BEGIN CERTIFICATE-----\nMIICnjCCAiWgAwIBAgIUEGWU0F4aKffY+le55ahQaScDYDwwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDExHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjQ3WhgPMjI5NTA2MDcyMjQyNDdaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAxMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEqW6TqxMmjL3h\n9AVBgfVaFRZlXUcyWa+QYhzxr8sksgJqfDbmGtdaHIdiL1qCPuC4v4G3qrAbXZRm\nTYNo5Lz0X2ic5pES6DbacdjOgHH7TAY4BVKkuVrydln2jjhh7SmBo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUcBlY5a1rV0H1iQuJMwWxrTEWQ6MwCgYIKoZIzj0EAwMDZwAwZAIw\nR+mY9B2U26yD44s03hjz4TlpkyXbVfmgL3Elqo3lrWDJtvT4zpjGjxg3Q1P3SpZQ\nAjAy9DRVrZPzq8iq5Ir7B8XgLQH5QL7SQ3tUL1HzXJYOukvn9Ofr+QADhpb0oJLB\nKug=\n-----END CERTIFICATE-----\n`,\n \"0.0.5\": `-----BEGIN CERTIFICATE-----\nMIICnjCCAiWgAwIBAgIUbxzfD3ihIK5snumqqKtqtcBPSSQwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDIxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjQ3WhgPMjI5NTA2MDcyMjQyNDdaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAyMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEWoAjWmW7vpUr\nU69wRbK9Firons4kRoin6N8lMjCD+xzsrsT6/wycpzC0F8fxfIvOYSMWRtinhOKl\nZAxp60OWYP87iH7RqWBAnHIJZj/znKTGd+8Sqp/RVQmButFHg/+Go1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUTMtwuDzI4Hun7SPp2Nb3scjUUXkwCgYIKoZIzj0EAwMDZwAwZAIw\nHKAgaX39Lgc+4/xHXzZR9mi2p3pf6CDO85Xm56UR/t48HnBkRorR3TFCBXACeIIs\nAjBtXglpDnRf6M+nVBlxLdwCQXiwr6vQJ9+dUo+suNkZ1JBmtHypyIqkG2yT4z9C\nLcs=\n-----END CERTIFICATE-----\n`,\n \"0.0.6\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiWgAwIBAgIUPwXdJvpCJYO9lm6uQN3S1aBi3PswCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDMxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjQ4WhgPMjI5NTA2MDcyMjQyNDhaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAzMR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8PwBQ0ywu+0t\neIYbaiKwzGEScQMOYFYAMw49++6bGRiH/XZjsypqlJWy3F/mB3+HNVZsqgB61Jpj\n2p98Afkl57MYWhWM29t/x5qAQ8LhKGu2k+BOnCcvHDU2pR+fmFSOo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUgI4r3/iwzFN2wh76y/4XDBk7wgkwCgYIKoZIzj0EAwMDaQAwZgIx\nANAjwHdTWYMCCjrtb2NWzDpsKjf3m6ZcaxbEcM1ta/Zji/4x0+VRZa917CkfaEsr\nLAIxAK/erPvIXRU9eNaK/TAQqppSRaF35G6iNnYjQZzfjTU2DczhT4oCjKzGoCHT\nkI1zOg==\n-----END CERTIFICATE-----\n`,\n \"0.0.7\": `-----BEGIN CERTIFICATE-----\nMIICnzCCAiWgAwIBAgIUXUGzJj13Ck2Cp0BKauLOdzgCPwIwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDQxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjQ4WhgPMjI5NTA2MDcyMjQyNDhaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA0MR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8Ee64Tbu53i/\nKsuLOJG3GQ4e9gQ+9BtEy7U8kfFzRHh6Ejn7LOW38ZdKX1HP4zXuUusjNvytqDvr\n7eclitqnegcEOkIeFK3wQwBoNILuq+r4LRVi19V+AIcl5w3qkJvIo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQU2tbfu7hd7USgbS2WsG/6BduKEAMwCgYIKoZIzj0EAwMDaAAwZQIw\nRw/BOLoScmU7P/1JnNPsGarmnvcuJrokAv1wk6j8s5LGuQHReX+d+O3RPLggwcAY\nAjEAjoZnt9simul4cVcVy4G/0f39atanUva17gyzlYXEYx7B6UloxLeEcZhlbBf8\nGjRf\n-----END CERTIFICATE-----\n`,\n \"0.0.8\": ``,\n \"0.0.9\": ``,\n \"0.0.10\": `-----BEGIN CERTIFICATE-----\nMIICnzCCAiWgAwIBAgIUNauEDBCmP9igXLWtRpzkQqIGo/wwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDcxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjQ5WhgPMjI5NTA2MDcyMjQyNDlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA3MR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEjbkoJBshQXUy\nqm5K8ldpTDR94Wk8iEM7QwHfceIxK5pPgaVGRkoJyVLSK5LMH4jyaIHUrtA0lIBQ\no0MsYkq7TOOm7+vo1Yrd8EMbu5StMb3gsXUrj7E/SBKIxULak6hCo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUyKHMzIBPRV/mrgG7tIjzOiw2xbUwCgYIKoZIzj0EAwMDaAAwZQIx\nANsigVtLgTdKWBPVJPstWA0H8yihf0/dmM3GO4qp5keGTWz/O3tnom4iDB6eSrcA\njwIwU82Dh+Wxl3kAD3YJH5VhlfHTm1rPlJETBHZgvPBOYqippao6+WZFEpn2/IDC\nNTjn\n-----END CERTIFICATE-----\n`,\n \"0.0.11\": `-----BEGIN CERTIFICATE-----\nMIICnjCCAiWgAwIBAgIUWtnJm2kswnXYu7/S5BnnTQiDRcUwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDgxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjUwWhgPMjI5NTA2MDcyMjQyNTBaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA4MR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEjY9Rl+s00xFV\ntdTpAixLR4kJIGLfSLOdm+ofU/KuKMRSz5x1ORhIicppKZK24U5WLGXQU1fKLvxX\nOmqwqL+6oAONmiHszqVdhWne4QPUba0yw7rf1/OI+IFF1HRK3shQo1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUb/htoTodbq5hjP5RNlQ0rkKwWB0wCgYIKoZIzj0EAwMDZwAwZAIw\nbO+9yArr21XKXjYHPadEAYINDxgXEC3W8e3X6MJsHCIZITddWWOyXRNFhz504vN0\nAjB8aBuhrKcg1b4CrQDZQcosyVPUGIZKkXdQFfbVdivKrGZvqLS+GdPLd3v2MmHY\norA=\n-----END CERTIFICATE-----\n`,\n \"0.0.12\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiWgAwIBAgIUHBsegV0bKtwpHRoOnnhbK7CTHxMwCgYIKoZIzj0EAwMw\ngYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw\nMDAwMDkxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz\nMjI0MjUwWhgPMjI5NTA2MDcyMjQyNTBaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE\nCAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G\nA1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA5MR8wHQYJKoZIhvcNAQkBFhBh\nZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEK+ZAs/00RXaj\nbuQJJy4zwr/YTj9h5V+vbY7sq9Z1RByEwTRRQOI3OuzzMq1EWKkVJKF/QF5b4yda\nx6W9O/NT4EjBXH5XR5X1V6h7aT01YBqsxgMxuUP7kw9K+fW4k6Zao1QwUjAPBgNV\nHREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd\nBgNVHQ4EFgQUKbecoYirLjf2O2oPkoggEE2P7FcwCgYIKoZIzj0EAwMDaQAwZgIx\nAP67wsVOkeFo/9QRo+PnZhzEvjOZ/+IUoUhimdljcVwn79tzNP+obf7VW3Oq1wH7\n4wIxAL65+WmMTMoI2cN7TCiL7G/W2ChDsASeHfaP/4e4ZViNONWotlY9i9aS3Kwt\nLTea1Q==\n-----END CERTIFICATE-----\n`,\n \"0.0.13\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiegAwIBAgIUBNxMZRKru9jzFA8zsOAI4xkMFCMwCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDEwMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1MFoYDzIyOTUwNjA3MjI0MjUwWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTAxHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAShUi9sglwb\n0U8QUrGOXJuHRXA9HP8RypkgNBwNRs1YcmPLcuwK70unWlkB81M44IQ7z/dG/0cW\nhfFdRI5x4jAeiUFivmWmMLT6lJMPxJ0BkWTGVFVwI3SKcgSvHP9pNS2jVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBSqIMCDzCKKwJJLCXhu9YJYPw6lsDAKBggqhkjOPQQDAwNnADBk\nAjBl0bJG2A3443ybvrkKjWu8do6nDSR08/M49+19QfA1aDw0nb2sdCOE+xNitpQ9\n7ngCMGuQHmnKA2EyOIVpNl2EtRoG+vdmLJQaoukhmCWjkGrQHkai473tGa9cRZ/8\n+RZFzw==\n-----END CERTIFICATE-----\n`,\n \"0.0.14\": `-----BEGIN CERTIFICATE-----\nMIICoTCCAiegAwIBAgIUJcQrEmPlIh0KWwiC2X6lZ/OdNs8wCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDExMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1MVoYDzIyOTUwNjA3MjI0MjUxWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTExHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASxRizKJSbB\nHmG2amvTHLCyExJngCh42agaFkv5Ab9mZYbqZPe0nUn/8RlVAvEiRNggCMYXC6MU\ne4J6D1aeLhYaa0UY8Fmxd20NUjAOWhJgUXds4ILMMVG+pevofeC8AsujVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBS2Ic+LU/6Wssns4Yyf3N6E666xDzAKBggqhkjOPQQDAwNoADBl\nAjAH0JMX48GD6vThA6FUsVnJmBID376PRZgxhuZvn9C0HawvNjZVQTkpzpYCwmia\ndO4CMQCotakNxyiOxu/BbnPx6ld5+dqVCugsfqClhUhy8ROpNHfKxp3rW7HopowT\nWiMlIyI=\n-----END CERTIFICATE-----\n`,\n \"0.0.15\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiegAwIBAgIUSFFNFv1iquxd5txlWA3PlkNju2EwCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDEyMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1MVoYDzIyOTUwNjA3MjI0MjUxWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTIxHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQus3nAPZkb\nja4Efo7iD4s8NLsFwEwQXQBgBGIJwtA2JRgLyXeWpuu125ib6qJzT8CHvQZhel3b\ncwYWi4f2JpabMDepHELLxwZ9fILnAQ8GiHlzhrVq2NI15DI84dXVe4OjVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBSEO/JFC5/fDcT2gtipDMYMMTd96DAKBggqhkjOPQQDAwNnADBk\nAjBalAU47XQL4ziHD8lj21pcp3+R5FKzn96HclMT/vraknCT1Sl+vCf6EYsqmi6Z\n+RwCMDpxL6P6OMqyE+HzAeYQ4Fa7MYEQfZGMjka4zxetBLvIpwUCT4EAO8gv9GoU\nwCBUzQ==\n-----END CERTIFICATE-----\n`,\n \"0.0.16\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiegAwIBAgIUdnkil4P+VthVMnqygVwGKLt7VfAwCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDEzMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1MVoYDzIyOTUwNjA3MjI0MjUxWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTMxHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARUdz9ig/iA\nhEAth2YinHKY6WM63BAxUVItzgk65l1T4wTzwoK4XEwclY5vIeFmZy2e0s95lWgq\nSI68VS9gmJ3xp8Q9wOel/bvuF2tvNZmF393TeoNQQVHrQM1yJAx+nPyjVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBTBFdNwHKSRDo6CxfA1aglY0N8joTAKBggqhkjOPQQDAwNnADBk\nAjAqPIel58Rcl2kDxZxJPD9mK9xW4TU+d2NuP3n140TQ6nPlw1OwCPI7a4i3wfEe\n08ICMBbrpNRdFZcvy76KoLPfTPvqbtWWaR/0tLZg4Rjj3x7SYgUg3vrVDmodHGkb\n4T2Raw==\n-----END CERTIFICATE-----\n`,\n \"0.0.17\": `-----BEGIN CERTIFICATE-----\nMIICoDCCAiegAwIBAgIUDg+G4Ep+KEmIo+nCOY8DjFX60swwCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDE0MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1MloYDzIyOTUwNjA3MjI0MjUyWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTQxHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASCQRL5xUUh\n1bsTXRPAf/qVFWEOxsJTiMlF3+UJ4MajWE5zmc2QNIzqj7NE24z3fNxgjViNK/8+\noBNQeqXfyJ/4etNMzTyG4JTsvWRAQ3aR1J4WDbfwpcgw6AIOKq9OLP6jVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBQB9V2fygf48zyyVL3bnAxCLDUV9zAKBggqhkjOPQQDAwNnADBk\nAjBonlThjjvi3fg7ODQcatPHBkp8Yon/p1ukm3YzYA3kitqroXU7BkmwRae2fbqD\nTTICMHI+fAy+xWGwXAFNcvNTop11IIoszcgJJY+1Mc2Q/USk3pP6iezta+rvnaWu\n7JySHg==\n-----END CERTIFICATE-----\n`,\n \"0.0.18\": `-----BEGIN CERTIFICATE-----\nMIICojCCAiegAwIBAgIUBvI2Vq6O8yXNzbQlj6uQOdpd1lIwCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDE1MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1MloYDzIyOTUwNjA3MjI0MjUyWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTUxHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR+jFDSzCdn\nmMQpgz/vrmD/xioMioumUmyLAkB+voTNsMAOtiaDVbvJty3b4SJETv5tuZyaF5Gb\nQAYuKsP7X8siCCVLZC9i9nCg46NHtuQkEmw1pzUUDmYFDfSV2tWedNqjVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBSqvCmoaVEp2d9WPctby+ooPMGmvTAKBggqhkjOPQQDAwNpADBm\nAjEA9fQ2OFZa7fAQGGYydfVaUF0ObxKj3T+hyl0jiCKLe+hyxJSrXCFS2BM71UiG\nZMVxAjEAmCzESBzTVvl4Uv3TyActGTijTCqTNpN3gJmQbZYjKVtqf8Wxj9WeH0pM\nE8BlA/qE\n-----END CERTIFICATE-----\n`,\n \"0.0.19\": `-----BEGIN CERTIFICATE-----\nMIICojCCAiegAwIBAgIUZBwp7UPLJkDgngbUIx5xjbAn+7YwCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDE2MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1M1oYDzIyOTUwNjA3MjI0MjUzWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTYxHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASCVYu2uF3T\nkCkyRP0FfXVyyTA1z8DFqCKGrcODgGJuVAk59H6u8FIRsNipkb3BXFI0xGccok5X\nT+t5bMaGDHYJ4fjU78UtPNmankQ5HoiMRJpy7Vn8mzizUzUqGpnhu6GjVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBQzE6RGn4YlIbdrl0niKWTtJzfXoTAKBggqhkjOPQQDAwNpADBm\nAjEAobnXnwlNGNWoHscbl/ytUBSyjC7V11sLYJqtORSRX3k2+bFGsg4ltmOVjTdd\nlXatAjEA/Ja3jufmdruqfLa6qigXuYI00YaI96sOwNhdHlnksYfqF41nDe4BsSW6\neQ6N5M9d\n-----END CERTIFICATE-----\n`,\n \"0.0.20\": `-----BEGIN CERTIFICATE-----\nMIICoTCCAiegAwIBAgIUE1ZRB5n+Yby+Mwgb2xAcVfTZ53kwCgYIKoZIzj0EAwMw\ngYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv\nbjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw\nMDAwMDE3MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy\nMzIyNDI1M1oYDzIyOTUwNjA3MjI0MjUzWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV\nBAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN\nBgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTcxHzAdBgkqhkiG9w0BCQEW\nEGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR0OfTmHjxT\nkBiU3GMa/bTvlTswCDAuFQGIIpMWHaf6V4ighzmn20jCg0AVFStb2q7YLRr4HUx8\nToMzsd7/yjl74BwJgfZnL75T/JInwyMgOBiCTXEf6qVDvhNzL4QJuVujVDBSMA8G\nA1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB\nMB0GA1UdDgQWBBQFKRUUmdFcDFQzBN9XqMvLgPd7NzAKBggqhkjOPQQDAwNoADBl\nAjEA5MUUXSehY3KVIv/2LMgrqo1kPiV39fwYuLSnsMJ67wK8yN1NAkkycg6q2K6g\nrBIvAjB3J3a40TINOZTYG+eQs+MSWyfANJLRuJTEOorXzMWM6+05+JYhPnLA8hke\nCRfzmSw=\n-----END CERTIFICATE-----\n`,\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/NodeCerts.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/ObjectMap.js": -/*!******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/ObjectMap.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ObjectMap; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * A simple \"map\" type that allows indexing by objects other than\n * strings, numbers, or booleans, and doesn't use the object pointer.\n *\n * @abstract\n * @template {{ toString(): string }} KeyT\n * @template {any} ValueT\n */\nclass ObjectMap {\n /**\n * @param {(s: string) => KeyT} fromString\n */\n constructor(fromString) {\n /**\n * This map is from the stringified version of the key, to the value\n *\n * @type {Map}\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this._map = new Map();\n\n /**\n * This map is from the key, to the value\n *\n * @type {Map}\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this.__map = new Map();\n\n /**\n * A function pointer to convert a key into a string. So we can set each\n * value in both maps.\n */\n this._fromString = fromString;\n }\n\n /**\n * Get a value by key or string.\n *\n * This is the main benefit of this class. If a user provides a `KeyT` we\n * implicitly serialize it to a string and use the string version. Otherwise\n * the user will get `undefined` even for a key that exists in the map since\n * the `KeyT` the provided has a different pointer than the one we have stored.\n * The string version doesn't have this issue since JS hashes the string and\n * that would result in both `KeyT` hitting the same value even if they're\n * different pointers.\n *\n * @param {KeyT | string} key\n * @returns {?ValueT}\n */\n get(key) {\n const k = typeof key === \"string\" ? key : key.toString();\n\n const value = this._map.get(k);\n return value != null ? value : null;\n }\n\n /**\n * Set the key to a value in both maps\n *\n * @internal\n * @param {KeyT} key\n * @param {ValueT} value\n */\n _set(key, value) {\n const k = typeof key === \"string\" ? key : key.toString();\n\n this._map.set(k, value);\n this.__map.set(key, value);\n }\n\n /**\n * Create iterator of values\n *\n * @returns {IterableIterator}\n */\n values() {\n return this._map.values();\n }\n\n /**\n * Get the size of the map\n *\n * @returns {number}\n */\n get size() {\n return this._map.size;\n }\n\n /**\n * Get the keys of the map.\n *\n * @returns {IterableIterator}\n */\n keys() {\n return this.__map.keys();\n }\n\n /**\n * Create an iterator over key, value pairs\n *\n * @returns {IterableIterator<[KeyT, ValueT]>}\n */\n [Symbol.iterator]() {\n return this.__map[Symbol.iterator]();\n }\n\n /**\n * Stringify the map into _something_ readable.\n * **NOTE**: This implementation is not stable and can change.\n *\n * @returns {string}\n */\n toString() {\n /** @type {Object} */\n const map = {};\n\n for (const [key, value] of this._map) {\n map[key] = value;\n }\n\n return JSON.stringify(map);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/ObjectMap.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ PrecheckStatusError; }\n/* harmony export */ });\n/* harmony import */ var _StatusError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StatusError.js */ \"./node_modules/@hashgraph/sdk/src/StatusError.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @typedef {import(\"./Status.js\").default} Status\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./contract/ContractFunctionResult.js\").default} ContractFunctionResult\n */\n\n/**\n * @typedef {object} PrecheckStatusErrorJSON\n * @property {string} name\n * @property {string} status\n * @property {string} transactionId\n * @property {string} message\n * @property {?ContractFunctionResult} contractFunctionResult\n */\n\nclass PrecheckStatusError extends _StatusError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {Status} props.status\n * @param {TransactionId} props.transactionId\n * @param {?ContractFunctionResult} props.contractFunctionResult\n */\n constructor(props) {\n super(\n props,\n `transaction ${props.transactionId.toString()} failed precheck with status ${props.status.toString()}`\n );\n\n /**\n * @type {?ContractFunctionResult}\n * @readonly\n */\n this.contractFunctionResult = props.contractFunctionResult;\n }\n\n /**\n * @returns {PrecheckStatusErrorJSON}\n */\n toJSON() {\n return {\n name: this.name,\n status: this.status.toString(),\n transactionId: this.transactionId.toString(),\n message: this.message,\n contractFunctionResult: this.contractFunctionResult,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/PrivateKey.js": -/*!*******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/PrivateKey.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ PrivateKey; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/cryptography */ \"./node_modules/@hashgraph/cryptography/src/index.js\");\n/* harmony import */ var _Mnemonic_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Mnemonic.js */ \"./node_modules/@hashgraph/sdk/src/Mnemonic.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./transaction/Transaction.js\").default} Transaction\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignaturePair} HashgraphProto.proto.ISignaturePair\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n */\n\nclass PrivateKey extends _Key_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n /**\n * @internal\n * @hideconstructor\n * @param {cryptography.PrivateKey} key\n */\n constructor(key) {\n super();\n\n this._key = key;\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generateED25519() {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.generateED25519());\n }\n\n /**\n * Generate a random EDSA private key.\n *\n * @returns {PrivateKey}\n */\n static generateECDSA() {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.generateECDSA());\n }\n\n /**\n * Depredated - Use `generateED25519()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generate() {\n return PrivateKey.generateED25519();\n }\n\n /**\n * Depredated - Use `generateED25519Async()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise}\n */\n static async generateAsync() {\n return new PrivateKey(await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.generateAsync());\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise}\n */\n static async generateED25519Async() {\n return new PrivateKey(\n await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.generateED25519Async()\n );\n }\n\n /**\n * Generate a random ECDSA private key.\n *\n * @returns {Promise}\n */\n static async generateECDSAAsync() {\n return new PrivateKey(\n await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.generateECDSAAsync()\n );\n }\n\n /**\n * Construct a private key from bytes. Requires DER header.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytes(data) {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromBytes(data));\n }\n\n /**\n * Construct a ECDSA private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesECDSA(data) {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromBytesECDSA(data));\n }\n\n /**\n * Construct a ED25519 private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesED25519(data) {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromBytesED25519(data));\n }\n\n /**\n * Construct a private key from a hex-encoded string. Requires DER header.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromString(text) {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromString(text));\n }\n\n /**\n * Construct a ECDSA private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringECDSA(text) {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromStringECDSA(text));\n }\n\n /**\n * Construct a Ed25519 private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringED25519(text) {\n return new PrivateKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromStringED25519(text));\n }\n\n /**\n * @deprecated - Use `Mnemonic.from[Words|String]().to[Ed25519|Ecdsa]PrivateKey()` instead\n *\n * Recover a private key from a mnemonic phrase (and optionally a password).\n * @param {Mnemonic | cryptography.Mnemonic | string} mnemonic\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n static async fromMnemonic(mnemonic, passphrase = \"\") {\n if (mnemonic instanceof _Mnemonic_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]) {\n return new PrivateKey(\n // eslint-disable-next-line deprecation/deprecation\n await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromMnemonic(\n mnemonic._mnemonic,\n passphrase\n )\n );\n }\n\n return new PrivateKey(\n // eslint-disable-next-line deprecation/deprecation\n await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromMnemonic(mnemonic, passphrase)\n );\n }\n\n /**\n * Recover a private key from a keystore, previously created by `.toKeystore()`.\n *\n * This key will _not_ support child key derivation.\n *\n * @param {Uint8Array} data\n * @param {string} [passphrase]\n * @returns {Promise}\n * @throws {BadKeyError} If the passphrase is incorrect or the hash fails to validate.\n */\n static async fromKeystore(data, passphrase = \"\") {\n return new PrivateKey(\n await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromKeystore(data, passphrase)\n );\n }\n\n /**\n * Recover a private key from a pem string; the private key may be encrypted.\n *\n * This method assumes the .pem file has been converted to a string already.\n *\n * If `passphrase` is not null or empty, this looks for the first `ENCRYPTED PRIVATE KEY`\n * section and uses `passphrase` to decrypt it; otherwise, it looks for the first `PRIVATE KEY`\n * section and decodes that as a DER-encoded private key.\n *\n * @param {string} data\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n static async fromPem(data, passphrase = \"\") {\n return new PrivateKey(\n await _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PrivateKey.fromPem(data, passphrase)\n );\n }\n\n /**\n * Derive a new private key at the given wallet index.\n *\n * Only currently supported for keys created with `fromMnemonic()`; other keys will throw\n * an error.\n *\n * You can check if a key supports derivation with `.supportsDerivation()`\n *\n * @param {number} index\n * @returns {Promise}\n * @throws If this key does not support derivation.\n */\n async derive(index) {\n return new PrivateKey(await this._key.derive(index));\n }\n\n /**\n * @param {number} index\n * @returns {Promise}\n * @throws If this key does not support derivation.\n */\n async legacyDerive(index) {\n return new PrivateKey(await this._key.legacyDerive(index));\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {PublicKey}\n */\n get publicKey() {\n return new _PublicKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](this._key.publicKey);\n }\n\n /**\n * Sign a message with this private key.\n *\n * @param {Uint8Array} bytes\n * @returns {Uint8Array} - The signature bytes without the message\n */\n sign(bytes) {\n return this._key.sign(bytes);\n }\n\n /**\n * @param {Transaction} transaction\n * @returns {Uint8Array}\n */\n signTransaction(transaction) {\n const tx = transaction._signedTransactions.get(0);\n const signature =\n tx.bodyBytes != null ? this.sign(tx.bodyBytes) : new Uint8Array();\n\n transaction.addSignature(this.publicKey, signature);\n\n return signature;\n }\n\n /**\n * Check if `derive` can be called on this private key.\n *\n * This is only the case if the key was created from a mnemonic.\n *\n * @returns {boolean}\n */\n isDerivable() {\n return this._key.isDerivable();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return this._key.toBytes();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n return this._key.toBytesDer();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return this._key.toBytesRaw();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._key.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringDer() {\n return this._key.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringRaw() {\n return this._key.toStringRaw();\n }\n\n /**\n * Create a keystore with a given passphrase.\n *\n * The key can be recovered later with `fromKeystore()`.\n *\n * Note that this will not retain the ancillary data used for\n * deriving child keys, thus `.derive()` on the restored key will\n * throw even if this instance supports derivation.\n *\n * @param {string} [passphrase]\n * @returns {Promise}\n */\n toKeystore(passphrase = \"\") {\n return this._key.toKeystore(passphrase);\n }\n\n /**\n * @returns {HashgraphProto.proto.IKey}\n */\n _toProtobufKey() {\n return this.publicKey._toProtobufKey();\n }\n\n /**\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @returns {AccountId}\n */\n toAccountId(shard, realm) {\n return this.publicKey.toAccountId(shard, realm);\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].setPrivateKeyConstructor((key) => new PrivateKey(key));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/PrivateKey.js?"); -/***/ }), +/** + * @typedef {import("./CustomFee.js").default} CustomFee + */ -/***/ "./node_modules/@hashgraph/sdk/src/PrngTransaction.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/PrngTransaction.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Response when the client sends the node TokenGetInfoQuery. + */ +class TokenInfo { + /** + * @private + * @param {object} props + * @param {TokenId} props.tokenId; + * @param {string} props.name; + * @param {string} props.symbol; + * @param {number} props.decimals; + * @param {Long} props.totalSupply; + * @param {AccountId | null} props.treasuryAccountId; + * @param {Key | null} props.adminKey; + * @param {Key | null} props.kycKey; + * @param {Key | null} props.freezeKey; + * @param {Key | null} props.pauseKey; + * @param {Key | null} props.wipeKey; + * @param {Key | null} props.supplyKey; + * @param {Key | null} props.feeScheduleKey; + * @param {boolean | null} props.defaultFreezeStatus; + * @param {boolean | null} props.defaultKycStatus; + * @param {boolean | null} props.pauseStatus; + * @param {boolean} props.isDeleted; + * @param {AccountId | null} props.autoRenewAccountId; + * @param {Duration | null} props.autoRenewPeriod; + * @param {Timestamp | null} props.expirationTime; + * @param {string} props.tokenMemo; + * @param {CustomFee[]} props.customFees; + * @param {TokenType | null} props.tokenType; + * @param {TokenSupplyType | null} props.supplyType; + * @param {Long | null} props.maxSupply; + * @param {LedgerId|null} props.ledgerId; + * @param {Key | null} props.metadataKey; + * @param {Uint8Array | null} props.metadata; + */ + constructor(props) { + /** + * ID of the token instance + * + * @readonly + */ + this.tokenId = props.tokenId; + + /** + * The name of the token. It is a string of ASCII only characters + * + * @readonly + */ + this.name = props.name; + + /** + * The symbol of the token. It is a UTF-8 capitalized alphabetical string + * + * @readonly + */ + this.symbol = props.symbol; + + /** + * The number of decimal places a token is divisible by + * + * @readonly + */ + this.decimals = props.decimals; + + /** + * The total supply of tokens that are currently in circulation + * + * @readonly + */ + this.totalSupply = props.totalSupply; + + /** + * The ID of the account which is set as treasuryAccountId + * + * @readonly + */ + this.treasuryAccountId = props.treasuryAccountId; + + /** + * The key which can perform update/delete operations on the token. If empty, the token can be perceived as + * immutable (not being able to be updated/deleted) + * + * @readonly + */ + this.adminKey = props.adminKey; + + /** + * The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, + * and KYC grant or revoke operations are not possible. + * + * @readonly + */ + this.kycKey = props.kycKey; + + /** + * The key which can freeze or unfreeze an account for token transactions. If empty, freezing is not possible + * + * @readonly + */ + this.freezeKey = props.freezeKey; + + /** + * The Key which can pause and unpause the Token. + * + * @readonly + */ + this.pauseKey = props.pauseKey; + + /** + * The key which can wipe token balance of an account. If empty, wipe is not possible + * + * @readonly + */ + this.wipeKey = props.wipeKey; + + /** + * The key which can change the supply of a token. The key is used to sign Token Mint/Burn operations + * + * @readonly + */ + this.supplyKey = props.supplyKey; + + this.feeScheduleKey = props.feeScheduleKey; + + /** + * The default Freeze status (not applicable = null, frozen = false, or unfrozen = true) of Hedera accounts relative to this token. + * FreezeNotApplicable is returned if Token Freeze Key is empty. Frozen is returned if Token Freeze Key is set and + * defaultFreeze is set to true. Unfrozen is returned if Token Freeze Key is set and defaultFreeze is set to false + * FreezeNotApplicable = null; + * Frozen = true; + * Unfrozen = false; + * + * @readonly + */ + this.defaultFreezeStatus = props.defaultFreezeStatus; + + /** + * The default KYC status (KycNotApplicable or Revoked) of Hedera accounts relative to this token. KycNotApplicable + * is returned if KYC key is not set, otherwise Revoked + * KycNotApplicable = null; + * Granted = true; + * Revoked = false; + * + * @readonly + */ + this.defaultKycStatus = props.defaultKycStatus; + + /** + * The default pause status of Hedera accounts relative to this token. + * PauseNotApplicable is returned if pauseKey is not set + * PauseNotApplicable = null; + * Paused = true; + * Unpaused = false; + * + * @readonly + */ + this.pauseStatus = props.pauseStatus; + + /** + * Specifies whether the token was deleted or not + * + * @readonly + */ + this.isDeleted = props.isDeleted; + + /** + * An account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval + * + * @readonly + */ + this.autoRenewAccountId = props.autoRenewAccountId; + + /** + * The interval at which the auto-renew account will be charged to extend the token's expiry + * + * @readonly + */ + this.autoRenewPeriod = props.autoRenewPeriod; + + /** + * The epoch second at which the token expire: will; if an auto-renew account and period are specified, + * this is coerced to the current epoch second plus the autoRenewPeriod + * + * @readonly + */ + this.expirationTime = props.expirationTime; + + /** + * The memo associated with the token. + * + * @readonly + */ + this.tokenMemo = props.tokenMemo; + + this.customFees = props.customFees; + + this.tokenType = props.tokenType; + + this.supplyType = props.supplyType; + + this.maxSupply = props.maxSupply; + + this.ledgerId = props.ledgerId; + + /** + * @description The key which can change the metadata of a token (token definition and individual NFTs). + * + * @readonly + */ + this.metadataKey = props.metadataKey; + + /** + * @description Metadata of the created token definition. + * @readonly + */ + this.metadata = props.metadata; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITokenInfo} info + * @returns {TokenInfo} + */ + static _fromProtobuf(info) { + const defaultFreezeStatus = + /** @type {HashgraphProto.proto.TokenFreezeStatus} */ ( + info.defaultFreezeStatus + ); + const defaultKycStatus = + /** @type {HashgraphProto.proto.TokenKycStatus} */ ( + info.defaultKycStatus + ); + const pauseStatus = + /**@type {HashgraphProto.proto.TokenPauseStatus} */ ( + info.pauseStatus + ); + + const autoRenewAccountId = + info.autoRenewAccount != null + ? AccountId_AccountId._fromProtobuf(info.autoRenewAccount) + : new AccountId_AccountId(0); + + return new TokenInfo({ + tokenId: TokenId_TokenId._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenID} */ (info.tokenId), + ), + name: /** @type {string} */ (info.name), + symbol: /** @type {string} */ (info.symbol), + decimals: /** @type {number} */ (info.decimals), + totalSupply: src_long.fromValue(/** @type {Long} */ (info.totalSupply)), + treasuryAccountId: + info.treasury != null + ? AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + info.treasury + ), + ) + : null, + adminKey: + info.adminKey != null + ? src_Key_Key._fromProtobufKey(info.adminKey) + : null, + kycKey: + info.kycKey != null ? src_Key_Key._fromProtobufKey(info.kycKey) : null, + freezeKey: + info.freezeKey != null + ? src_Key_Key._fromProtobufKey(info.freezeKey) + : null, + pauseKey: + info.pauseKey != null + ? src_Key_Key._fromProtobufKey(info.pauseKey) + : null, + wipeKey: + info.wipeKey != null + ? src_Key_Key._fromProtobufKey(info.wipeKey) + : null, + supplyKey: + info.supplyKey != null + ? src_Key_Key._fromProtobufKey(info.supplyKey) + : null, + feeScheduleKey: + info.feeScheduleKey != null + ? src_Key_Key._fromProtobufKey(info.feeScheduleKey) + : null, + defaultFreezeStatus: + defaultFreezeStatus === 0 ? null : defaultFreezeStatus == 1, + defaultKycStatus: + defaultKycStatus === 0 ? null : defaultKycStatus == 1, + pauseStatus: pauseStatus === 0 ? null : pauseStatus == 1, + isDeleted: /** @type {boolean} */ (info.deleted), + autoRenewAccountId: !( + autoRenewAccountId.shard.toInt() == 0 && + autoRenewAccountId.realm.toInt() == 0 && + autoRenewAccountId.num.toInt() == 0 + ) + ? autoRenewAccountId + : null, + autoRenewPeriod: + info.autoRenewPeriod != null + ? Duration_Duration._fromProtobuf( + /** @type {HashgraphProto.proto.IDuration} */ ( + info.autoRenewPeriod + ), + ) + : null, + expirationTime: + info.expiry != null + ? Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.expiry + ), + ) + : null, + tokenMemo: info.memo != null ? info.memo : "", + customFees: + info.customFees != null + ? info.customFees.map((fee) => { + if (fee.fixedFee != null) { + return CustomFixedFee._fromProtobuf(fee); + } else if (fee.fractionalFee != null) { + return CustomFractionalFee._fromProtobuf(fee); + } else { + return CustomRoyalyFee._fromProtobuf(fee); + } + }) + : [], + tokenType: + info.tokenType != null + ? TokenType._fromCode(info.tokenType) + : null, + supplyType: + info.supplyType != null + ? TokenSupplyType._fromCode(info.supplyType) + : null, + maxSupply: info.maxSupply != null ? info.maxSupply : null, + ledgerId: + info.ledgerId != null + ? LedgerId.fromBytes(info.ledgerId) + : null, + metadataKey: + info.metadataKey != null + ? src_Key_Key._fromProtobufKey(info.metadataKey) + : null, + metadata: info.metadata != null ? info.metadata : new Uint8Array(), + }); + } + + /** + * @returns {HashgraphProto.proto.ITokenInfo} + */ + _toProtobuf() { + return { + tokenId: this.tokenId._toProtobuf(), + name: this.name, + symbol: this.symbol, + decimals: this.decimals, + totalSupply: this.totalSupply, + treasury: + this.treasuryAccountId != null + ? this.treasuryAccountId._toProtobuf() + : null, + adminKey: + this.adminKey != null ? this.adminKey._toProtobufKey() : null, + kycKey: this.kycKey != null ? this.kycKey._toProtobufKey() : null, + freezeKey: + this.freezeKey != null ? this.freezeKey._toProtobufKey() : null, + pauseKey: + this.pauseKey != null ? this.pauseKey._toProtobufKey() : null, + wipeKey: + this.wipeKey != null ? this.wipeKey._toProtobufKey() : null, + supplyKey: + this.supplyKey != null ? this.supplyKey._toProtobufKey() : null, + feeScheduleKey: + this.feeScheduleKey != null + ? this.feeScheduleKey._toProtobufKey() + : null, + defaultFreezeStatus: + this.defaultFreezeStatus == null + ? 0 + : this.defaultFreezeStatus + ? 1 + : 2, + defaultKycStatus: + this.defaultKycStatus == null + ? 0 + : this.defaultKycStatus + ? 1 + : 2, + pauseStatus: + this.pauseStatus == null ? 0 : this.pauseStatus ? 1 : 2, + deleted: this.isDeleted, + autoRenewAccount: + this.autoRenewAccountId != null + ? this.autoRenewAccountId._toProtobuf() + : undefined, + autoRenewPeriod: + this.autoRenewPeriod != null + ? this.autoRenewPeriod._toProtobuf() + : null, + expiry: + this.expirationTime != null + ? this.expirationTime._toProtobuf() + : null, + memo: this.tokenMemo, + customFees: this.customFees.map((fee) => fee._toProtobuf()), + tokenType: this.tokenType != null ? this.tokenType._code : null, + supplyType: this.supplyType != null ? this.supplyType._code : null, + maxSupply: this.maxSupply, + ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null, + metadataKey: + this.metadataKey != null + ? this.metadataKey._toProtobufKey() + : null, + metadata: this.metadata != null ? this.metadata : null, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {TokenInfo} + */ + static fromBytes(bytes) { + return TokenInfo._fromProtobuf( + lib.proto.TokenInfo.decode(bytes), + ); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.TokenInfo.encode( + this._toProtobuf(), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ PrngTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.Transaction} HashgraphProto.proto.Transaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.SignedTransaction} HashgraphProto.proto.SignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.IUtilPrngTransactionBody } HashgraphProto.proto.IUtilPrngTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.UtilPrngTransactionBody} HashgraphProto.proto.UtilPrngTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.TransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n */\n\n/**\n * Gets a pseudorandom 32-bit number. Not cryptographically secure. See HIP-351 https://hips.hedera.com/hip/hip-351\n */\nclass PrngTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {?number } [props.range]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?number}\n */\n this._range = null;\n\n if (props.range != null) {\n this.setRange(props.range);\n }\n }\n\n /**\n * @param {number} newRange\n * @returns {this}\n */\n setRange(newRange) {\n this._range = newRange;\n return this;\n }\n\n get range() {\n return this._range;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._range != null && (0,_util_js__WEBPACK_IMPORTED_MODULE_1__.isNumber)(this._range)) {\n this._validateChecksums(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.util.prng(request);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {PrngTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = /** @type {HashgraphProto.proto.ITransactionBody} */ (\n bodies[0]\n );\n const transactionRange =\n /** @type {HashgraphProto.proto.IUtilPrngTransactionBody} */ (\n body.utilPrng\n );\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new PrngTransaction({\n range: transactionRange.range,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"utilPrng\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IUtilPrngTransactionBody}\n */\n _makeTransactionData() {\n return {\n range: this.range,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"./Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `RandomGenerate:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"utilPrng\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n PrngTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/PrngTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/Provider.js": -/*!*****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Provider.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @typedef {import(\"./LedgerId.js\").default} LedgerId\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./transaction/Transaction.js\").default} Transaction\n * @typedef {import(\"./transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"./transaction/TransactionReceipt.js\").default} TransactionReceipt\n * @typedef {import(\"./transaction/TransactionRecord.js\").default} TransactionRecord\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./account/AccountBalance.js\").default} AccountBalance\n * @typedef {import(\"./account/AccountInfo.js\").default} AccountInfo\n */\n\n/**\n * @template O\n * @typedef {import(\"./query/Query.js\").default} Query\n */\n\n/**\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n * @typedef {import(\"./Executable.js\").default} Executable\n */\n\n/**\n * @typedef {object} Provider\n * @property {() => LedgerId?} getLedgerId\n * @property {() => {[key: string]: (string | AccountId)}} getNetwork\n * @property {() => string[]} getMirrorNetwork\n * @property {(accountId: AccountId | string) => Promise} getAccountBalance\n * @property {(accountId: AccountId | string) => Promise} getAccountInfo\n * @property {(accountId: AccountId | string) => Promise} getAccountRecords\n * @property {(transactionId: TransactionId | string) => Promise} getTransactionReceipt\n * @property {(response: TransactionResponse) => Promise} waitForReceipt\n * @property {(request: Executable) => Promise} call\n */\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({});\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Provider.js?"); +// eslint-disable-next-line @typescript-eslint/no-unused-vars -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/PublicKey.js": -/*!******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/PublicKey.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.ITokenInfo} HashgraphProto.proto.ITokenInfo + * @typedef {import("@hashgraph/proto").proto.ITokenGetInfoQuery} HashgraphProto.proto.ITokenGetInfoQuery + * @typedef {import("@hashgraph/proto").proto.ITokenGetInfoResponse} HashgraphProto.proto.ITokenGetInfoResponse + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ PublicKey; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/cryptography */ \"./node_modules/@hashgraph/cryptography/src/index.js\");\n/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./array.js */ \"./node_modules/@hashgraph/sdk/src/array.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @typedef {import(\"./transaction/Transaction.js\").default} Transaction\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignaturePair} HashgraphProto.proto.ISignaturePair\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n */\n\nclass PublicKey extends _Key_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @internal\n * @hideconstructor\n * @param {cryptography.PublicKey} key\n */\n constructor(key) {\n super();\n\n this._key = key;\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {PublicKey}\n */\n static fromBytes(data) {\n return new PublicKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PublicKey.fromBytes(data));\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {PublicKey}\n */\n static fromBytesED25519(data) {\n return new PublicKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PublicKey.fromBytesED25519(data));\n }\n\n /**\n * @param {Uint8Array} data\n * @returns {PublicKey}\n */\n static fromBytesECDSA(data) {\n return new PublicKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PublicKey.fromBytesECDSA(data));\n }\n\n /**\n * Parse a public key from a string of hexadecimal digits.\n *\n * The public key may optionally be prefixed with\n * the DER header.\n *\n * @param {string} text\n * @returns {PublicKey}\n */\n static fromString(text) {\n return new PublicKey(_hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_0__.PublicKey.fromString(text));\n }\n\n /**\n * Verify a signature on a message with this public key.\n *\n * @param {Uint8Array} message\n * @param {Uint8Array} signature\n * @returns {boolean}\n */\n verify(message, signature) {\n return this._key.verify(message, signature);\n }\n\n /**\n * @param {Transaction} transaction\n * @returns {boolean}\n */\n verifyTransaction(transaction) {\n transaction._requireFrozen();\n\n if (!transaction.isFrozen()) {\n transaction.freeze();\n }\n\n for (const signedTransaction of transaction._signedTransactions.list) {\n if (\n signedTransaction.sigMap != null &&\n signedTransaction.sigMap.sigPair != null\n ) {\n let found = false;\n for (const sigPair of signedTransaction.sigMap.sigPair) {\n const pubKeyPrefix = /** @type {Uint8Array} */ (\n sigPair.pubKeyPrefix\n );\n if ((0,_array_js__WEBPACK_IMPORTED_MODULE_1__.arrayEqual)(pubKeyPrefix, this.toBytesRaw())) {\n found = true;\n\n const bodyBytes = /** @type {Uint8Array} */ (\n signedTransaction.bodyBytes\n );\n\n let signature = null;\n if (sigPair.ed25519 != null) {\n signature = sigPair.ed25519;\n } else if (sigPair.ECDSASecp256k1 != null) {\n signature = sigPair.ECDSASecp256k1;\n }\n\n if (signature == null) {\n continue;\n }\n\n if (!this.verify(bodyBytes, signature)) {\n return false;\n }\n }\n }\n\n if (!found) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return this._key.toBytes();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n return this._key.toBytesDer();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return this._key.toBytesRaw();\n }\n\n /**\n * @deprecated Use `toEvmAddress()` instead.\n * @returns {string}\n */\n toEthereumAddress() {\n return this._key.toEthereumAddress();\n }\n\n /**\n * @returns {string}\n */\n toEvmAddress() {\n return this._key.toEthereumAddress();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._key.toString();\n }\n\n /**\n * @returns {string}\n */\n toStringDer() {\n return this._key.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringRaw() {\n return this._key.toStringRaw();\n }\n\n /**\n * @param {PublicKey} other\n * @returns {boolean}\n */\n equals(other) {\n return this._key.equals(other._key);\n }\n\n /**\n * @returns {HashgraphProto.proto.IKey}\n */\n _toProtobufKey() {\n switch (this._key._type) {\n case \"ED25519\":\n return {\n ed25519: this._key.toBytesRaw(),\n };\n case \"secp256k1\":\n return {\n ECDSASecp256k1: this._key.toBytesRaw(),\n };\n default:\n throw new Error(`unrecognized key type ${this._key._type}`);\n }\n }\n\n /**\n * @param {Uint8Array} signature\n * @returns {HashgraphProto.proto.ISignaturePair}\n */\n _toProtobufSignature(signature) {\n switch (this._key._type) {\n case \"ED25519\":\n return {\n pubKeyPrefix: this._key.toBytesRaw(),\n ed25519: signature,\n };\n case \"secp256k1\":\n return {\n pubKeyPrefix: this._key.toBytesRaw(),\n ECDSASecp256k1: signature,\n };\n default:\n throw new Error(`unrecognized key type ${this._key._type}`);\n }\n }\n\n /**\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @returns {AccountId}\n */\n toAccountId(shard, realm) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].accountIdConstructor(shard, realm, this);\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setPublicKeyED25519((key) => PublicKey.fromBytesED25519(key));\n_Cache_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setPublicKeyECDSA((key) => PublicKey.fromBytesECDSA(key));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/PublicKey.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +/** + * @augments {Query} + */ +class TokenInfoQuery extends Query_Query { + /** + * @param {object} properties + * @param {TokenId | string} [properties.tokenId] + */ + constructor(properties = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + if (properties.tokenId != null) { + this.setTokenId(properties.tokenId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {TokenInfoQuery} + */ + static _fromProtobuf(query) { + const info = /** @type {HashgraphProto.proto.ITokenGetInfoQuery} */ ( + query.tokenGetInfo + ); + + return new TokenInfoQuery({ + tokenId: + info.token != null + ? TokenId_TokenId._fromProtobuf(info.token) + : undefined, + }); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * Set the token ID for which the info is being requested. + * + * @param {TokenId | string} tokenId + * @returns {TokenInfoQuery} + */ + setTokenId(tokenId) { + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @override + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + return super.getCost(client); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.getTokenInfo(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const tokenGetInfo = + /** @type {HashgraphProto.proto.ITokenGetInfoResponse} */ ( + response.tokenGetInfo + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + tokenGetInfo.header + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const info = /** @type {HashgraphProto.proto.ITokenGetInfoResponse} */ ( + response.tokenGetInfo + ); + + return Promise.resolve( + TokenInfo._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenInfo} */ (info.tokenInfo), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + tokenGetInfo: { + header, + token: + this._tokenId != null ? this._tokenId._toProtobuf() : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `TokenInfoQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("tokenGetInfo", TokenInfoQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenMintTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ReceiptStatusError; }\n/* harmony export */ });\n/* harmony import */ var _StatusError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StatusError.js */ \"./node_modules/@hashgraph/sdk/src/StatusError.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @typedef {import(\"./Status.js\").default} Status\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./transaction/TransactionReceipt.js\").default} TransactionReceipt\n */\n\nclass ReceiptStatusError extends _StatusError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {TransactionReceipt} props.transactionReceipt\n * @param {Status} props.status\n * @param {TransactionId} props.transactionId\n */\n constructor(props) {\n super(\n props,\n `receipt for transaction ${props.transactionId.toString()} contained error status ${props.status.toString()}`\n );\n\n /**\n * @type {TransactionReceipt}\n * @readonly\n */\n this.transactionReceipt = props.transactionReceipt;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/RequestType.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/RequestType.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ RequestType; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.HederaFunctionality} HashgraphProto.proto.HederaFunctionality\n */\n\nclass RequestType {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case RequestType.None:\n return \"NONE\";\n case RequestType.CryptoTransfer:\n return \"CryptoTransfer\";\n case RequestType.CryptoUpdate:\n return \"CryptoUpdate\";\n case RequestType.CryptoDelete:\n return \"CryptoDelete\";\n case RequestType.CryptoAddLiveHash:\n return \"CryptoAddLiveHash\";\n case RequestType.CryptoDeleteLiveHash:\n return \"CryptoDeleteLiveHash\";\n case RequestType.ContractCall:\n return \"ContractCall\";\n case RequestType.ContractCreate:\n return \"ContractCreate\";\n case RequestType.ContractUpdate:\n return \"ContractUpdate\";\n case RequestType.FileCreate:\n return \"FileCreate\";\n case RequestType.FileAppend:\n return \"FileAppend\";\n case RequestType.FileUpdate:\n return \"FileUpdate\";\n case RequestType.FileDelete:\n return \"FileDelete\";\n case RequestType.CryptoGetAccountBalance:\n return \"CryptoGetAccountBalance\";\n case RequestType.CryptoGetAccountRecords:\n return \"CryptoGetAccountRecords\";\n case RequestType.CryptoGetInfo:\n return \"CryptoGetInfo\";\n case RequestType.ContractCallLocal:\n return \"ContractCallLocal\";\n case RequestType.ContractGetInfo:\n return \"ContractGetInfo\";\n case RequestType.ContractGetBytecode:\n return \"ContractGetBytecode\";\n case RequestType.GetBySolidityID:\n return \"GetBySolidityID\";\n case RequestType.GetByKey:\n return \"GetByKey\";\n case RequestType.CryptoGetLiveHash:\n return \"CryptoGetLiveHash\";\n case RequestType.CryptoGetStakers:\n return \"CryptoGetStakers\";\n case RequestType.FileGetContents:\n return \"FileGetContents\";\n case RequestType.FileGetInfo:\n return \"FileGetInfo\";\n case RequestType.TransactionGetRecord:\n return \"TransactionGetRecord\";\n case RequestType.ContractGetRecords:\n return \"ContractGetRecords\";\n case RequestType.CryptoCreate:\n return \"CryptoCreate\";\n case RequestType.SystemDelete:\n return \"SystemDelete\";\n case RequestType.SystemUndelete:\n return \"SystemUndelete\";\n case RequestType.ContractDelete:\n return \"ContractDelete\";\n case RequestType.Freeze:\n return \"Freeze\";\n case RequestType.CreateTransactionRecord:\n return \"CreateTransactionRecord\";\n case RequestType.CryptoAccountAutoRenew:\n return \"CryptoAccountAutoRenew\";\n case RequestType.ContractAutoRenew:\n return \"ContractAutoRenew\";\n case RequestType.GetVersionInfo:\n return \"GetVersionInfo\";\n case RequestType.TransactionGetReceipt:\n return \"TransactionGetReceipt\";\n case RequestType.ConsensusCreateTopic:\n return \"ConsensusCreateTopic\";\n case RequestType.ConsensusUpdateTopic:\n return \"ConsensusUpdateTopic\";\n case RequestType.ConsensusDeleteTopic:\n return \"ConsensusDeleteTopic\";\n case RequestType.ConsensusGetTopicInfo:\n return \"ConsensusGetTopicInfo\";\n case RequestType.ConsensusSubmitMessage:\n return \"ConsensusSubmitMessage\";\n case RequestType.UncheckedSubmit:\n return \"UncheckedSubmit\";\n case RequestType.TokenCreate:\n return \"TokenCreate\";\n case RequestType.TokenGetInfo:\n return \"TokenGetInfo\";\n case RequestType.TokenFreezeAccount:\n return \"TokenFreezeAccount\";\n case RequestType.TokenUnfreezeAccount:\n return \"TokenUnfreezeAccount\";\n case RequestType.TokenGrantKycToAccount:\n return \"TokenGrantKycToAccount\";\n case RequestType.TokenRevokeKycFromAccount:\n return \"TokenRevokeKycFromAccount\";\n case RequestType.TokenDelete:\n return \"TokenDelete\";\n case RequestType.TokenUpdate:\n return \"TokenUpdate\";\n case RequestType.TokenMint:\n return \"TokenMint\";\n case RequestType.TokenBurn:\n return \"TokenBurn\";\n case RequestType.TokenAccountWipe:\n return \"TokenAccountWipe\";\n case RequestType.TokenAssociateToAccount:\n return \"TokenAssociateToAccount\";\n case RequestType.TokenDissociateFromAccount:\n return \"TokenDissociateFromAccount\";\n case RequestType.ScheduleCreate:\n return \"ScheduleCreate\";\n case RequestType.ScheduleDelete:\n return \"ScheduleDelete\";\n case RequestType.ScheduleSign:\n return \"ScheduleSign\";\n case RequestType.ScheduleGetInfo:\n return \"ScheduleGetInfo\";\n case RequestType.TokenGetAccountNftInfos:\n return \"TokenGetAccountNftInfos\";\n case RequestType.TokenGetNftInfo:\n return \"TokenGetNftInfo\";\n case RequestType.TokenGetNftInfos:\n return \"TokenGetNftInfos\";\n case RequestType.TokenFeeScheduleUpdate:\n return \"TokenFeeScheduleUpdate\";\n case RequestType.NetworkGetExecutionTime:\n return \"NetworkGetExecutionTime\";\n case RequestType.TokenPause:\n return \"TokenPause\";\n case RequestType.TokenUnpause:\n return \"TokenUnpause\";\n case RequestType.CryptoApproveAllowance:\n return \"CryptoApproveAllowance\";\n case RequestType.CryptoDeleteAllowance:\n return \"CryptoDeleteAllowance\";\n case RequestType.GetAccountDetails:\n return \"GetAccountDetails\";\n case RequestType.EthereumTransaction:\n return \"EthereumTransaction\";\n case RequestType.NodeStakeUpdate:\n return \"NodeStakeUpdate\";\n case RequestType.Prng:\n return \"UtilPrng\";\n default:\n return `UNKNOWN (${this._code})`;\n }\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {RequestType}\n */\n static _fromCode(code) {\n switch (code) {\n case 0:\n return RequestType.None;\n case 1:\n return RequestType.CryptoTransfer;\n case 2:\n return RequestType.CryptoUpdate;\n case 3:\n return RequestType.CryptoDelete;\n case 4:\n return RequestType.CryptoAddLiveHash;\n case 5:\n return RequestType.CryptoDeleteLiveHash;\n case 6:\n return RequestType.ContractCall;\n case 7:\n return RequestType.ContractCreate;\n case 8:\n return RequestType.ContractUpdate;\n case 9:\n return RequestType.FileCreate;\n case 10:\n return RequestType.FileAppend;\n case 11:\n return RequestType.FileUpdate;\n case 12:\n return RequestType.FileDelete;\n case 13:\n return RequestType.CryptoGetAccountBalance;\n case 14:\n return RequestType.CryptoGetAccountRecords;\n case 15:\n return RequestType.CryptoGetInfo;\n case 16:\n return RequestType.ContractCallLocal;\n case 17:\n return RequestType.ContractGetInfo;\n case 18:\n return RequestType.ContractGetBytecode;\n case 19:\n return RequestType.GetBySolidityID;\n case 20:\n return RequestType.GetByKey;\n case 21:\n return RequestType.CryptoGetLiveHash;\n case 22:\n return RequestType.CryptoGetStakers;\n case 23:\n return RequestType.FileGetContents;\n case 24:\n return RequestType.FileGetInfo;\n case 25:\n return RequestType.TransactionGetRecord;\n case 26:\n return RequestType.ContractGetRecords;\n case 27:\n return RequestType.CryptoCreate;\n case 28:\n return RequestType.SystemDelete;\n case 29:\n return RequestType.SystemUndelete;\n case 30:\n return RequestType.ContractDelete;\n case 31:\n return RequestType.Freeze;\n case 32:\n return RequestType.CreateTransactionRecord;\n case 33:\n return RequestType.CryptoAccountAutoRenew;\n case 34:\n return RequestType.ContractAutoRenew;\n case 35:\n return RequestType.GetVersionInfo;\n case 36:\n return RequestType.TransactionGetReceipt;\n case 50:\n return RequestType.ConsensusCreateTopic;\n case 51:\n return RequestType.ConsensusUpdateTopic;\n case 52:\n return RequestType.ConsensusDeleteTopic;\n case 53:\n return RequestType.ConsensusGetTopicInfo;\n case 54:\n return RequestType.ConsensusSubmitMessage;\n case 55:\n return RequestType.UncheckedSubmit;\n case 56:\n return RequestType.TokenCreate;\n case 58:\n return RequestType.TokenGetInfo;\n case 59:\n return RequestType.TokenFreezeAccount;\n case 60:\n return RequestType.TokenUnfreezeAccount;\n case 61:\n return RequestType.TokenGrantKycToAccount;\n case 62:\n return RequestType.TokenRevokeKycFromAccount;\n case 63:\n return RequestType.TokenDelete;\n case 64:\n return RequestType.TokenUpdate;\n case 65:\n return RequestType.TokenMint;\n case 66:\n return RequestType.TokenBurn;\n case 67:\n return RequestType.TokenAccountWipe;\n case 68:\n return RequestType.TokenAssociateToAccount;\n case 69:\n return RequestType.TokenDissociateFromAccount;\n case 70:\n return RequestType.ScheduleCreate;\n case 71:\n return RequestType.ScheduleDelete;\n case 72:\n return RequestType.ScheduleSign;\n case 73:\n return RequestType.ScheduleGetInfo;\n case 74:\n return RequestType.TokenGetAccountNftInfos;\n case 75:\n return RequestType.TokenGetNftInfo;\n case 76:\n return RequestType.TokenGetNftInfos;\n case 77:\n return RequestType.TokenFeeScheduleUpdate;\n case 78:\n return RequestType.NetworkGetExecutionTime;\n case 79:\n return RequestType.TokenPause;\n case 80:\n return RequestType.TokenUnpause;\n case 81:\n return RequestType.CryptoApproveAllowance;\n case 82:\n return RequestType.CryptoDeleteAllowance;\n case 83:\n return RequestType.GetAccountDetails;\n case 84:\n return RequestType.EthereumTransaction;\n case 85:\n return RequestType.NodeStakeUpdate;\n case 86:\n return RequestType.Prng;\n }\n\n throw new Error(\n `(BUG) RequestType.fromCode() does not handle code: ${code}`\n );\n }\n\n /**\n * @returns {HashgraphProto.proto.HederaFunctionality}\n */\n valueOf() {\n return this._code;\n }\n}\n\n/**\n * UNSPECIFIED - Need to keep first value as unspecified because first element is ignored and\n * not parsed (0 is ignored by parser)\n */\nRequestType.None = new RequestType(0);\n\n/**\n * crypto transfer\n */\nRequestType.CryptoTransfer = new RequestType(1);\n\n/**\n * crypto update account\n */\nRequestType.CryptoUpdate = new RequestType(2);\n\n/**\n * crypto delete account\n */\nRequestType.CryptoDelete = new RequestType(3);\n\n/**\n * Add a livehash to a crypto account\n */\nRequestType.CryptoAddLiveHash = new RequestType(4);\n\n/**\n * Delete a livehash from a crypto account\n */\nRequestType.CryptoDeleteLiveHash = new RequestType(5);\n\n/**\n * Smart Contract Call\n */\nRequestType.ContractCall = new RequestType(6);\n\n/**\n * Smart Contract Create Contract\n */\nRequestType.ContractCreate = new RequestType(7);\n\n/**\n * Smart Contract update contract\n */\nRequestType.ContractUpdate = new RequestType(8);\n\n/**\n * File Operation create file\n */\nRequestType.FileCreate = new RequestType(9);\n\n/**\n * File Operation append file\n */\nRequestType.FileAppend = new RequestType(10);\n\n/**\n * File Operation update file\n */\nRequestType.FileUpdate = new RequestType(11);\n\n/**\n * File Operation delete file\n */\nRequestType.FileDelete = new RequestType(12);\n\n/**\n * crypto get account balance\n */\nRequestType.CryptoGetAccountBalance = new RequestType(13);\n\n/**\n * crypto get account record\n */\nRequestType.CryptoGetAccountRecords = new RequestType(14);\n\n/**\n * Crypto get info\n */\nRequestType.CryptoGetInfo = new RequestType(15);\n\n/**\n * Smart Contract Call\n */\nRequestType.ContractCallLocal = new RequestType(16);\n\n/**\n * Smart Contract get info\n */\nRequestType.ContractGetInfo = new RequestType(17);\n\n/**\n * Smart Contract, get the runtime code\n */\nRequestType.ContractGetBytecode = new RequestType(18);\n\n/**\n * Smart Contract, get by solidity ID\n */\nRequestType.GetBySolidityID = new RequestType(19);\n\n/**\n * Smart Contract, get by key\n */\nRequestType.GetByKey = new RequestType(20);\n\n/**\n * Get a live hash from a crypto account\n */\nRequestType.CryptoGetLiveHash = new RequestType(21);\n\n/**\n * Crypto, get the stakers for the node\n */\nRequestType.CryptoGetStakers = new RequestType(22);\n\n/**\n * File Operations get file contents\n */\nRequestType.FileGetContents = new RequestType(23);\n\n/**\n * File Operations get the info of the file\n */\nRequestType.FileGetInfo = new RequestType(24);\n\n/**\n * Crypto get the transaction records\n */\nRequestType.TransactionGetRecord = new RequestType(25);\n\n/**\n * Contract get the transaction records\n */\nRequestType.ContractGetRecords = new RequestType(26);\n\n/**\n * crypto create account\n */\nRequestType.CryptoCreate = new RequestType(27);\n\n/**\n * system delete file\n */\nRequestType.SystemDelete = new RequestType(28);\n\n/**\n * system undelete file\n */\nRequestType.SystemUndelete = new RequestType(29);\n\n/**\n * delete contract\n */\nRequestType.ContractDelete = new RequestType(30);\n\n/**\n * freeze\n */\nRequestType.Freeze = new RequestType(31);\n\n/**\n * Create Tx Record\n */\nRequestType.CreateTransactionRecord = new RequestType(32);\n\n/**\n * Crypto Auto Renew\n */\nRequestType.CryptoAccountAutoRenew = new RequestType(33);\n\n/**\n * Contract Auto Renew\n */\nRequestType.ContractAutoRenew = new RequestType(34);\n\n/**\n * Get Version\n */\nRequestType.GetVersionInfo = new RequestType(35);\n\n/**\n * Transaction Get Receipt\n */\nRequestType.TransactionGetReceipt = new RequestType(36);\n\n/**\n * Create Topic\n */\nRequestType.ConsensusCreateTopic = new RequestType(50);\n\n/**\n * Update Topic\n */\nRequestType.ConsensusUpdateTopic = new RequestType(51);\n\n/**\n * Delete Topic\n */\nRequestType.ConsensusDeleteTopic = new RequestType(52);\n\n/**\n * Get Topic information\n */\nRequestType.ConsensusGetTopicInfo = new RequestType(53);\n\n/**\n * Submit message to topic\n */\nRequestType.ConsensusSubmitMessage = new RequestType(54);\n\nRequestType.UncheckedSubmit = new RequestType(55);\n/**\n * Create Token\n */\nRequestType.TokenCreate = new RequestType(56);\n\n/**\n * Get Token information\n */\nRequestType.TokenGetInfo = new RequestType(58);\n\n/**\n * Freeze Account\n */\nRequestType.TokenFreezeAccount = new RequestType(59);\n\n/**\n * Unfreeze Account\n */\nRequestType.TokenUnfreezeAccount = new RequestType(60);\n\n/**\n * Grant KYC to Account\n */\nRequestType.TokenGrantKycToAccount = new RequestType(61);\n\n/**\n * Revoke KYC from Account\n */\nRequestType.TokenRevokeKycFromAccount = new RequestType(62);\n\n/**\n * Delete Token\n */\nRequestType.TokenDelete = new RequestType(63);\n\n/**\n * Update Token\n */\nRequestType.TokenUpdate = new RequestType(64);\n\n/**\n * Mint tokens to treasury\n */\nRequestType.TokenMint = new RequestType(65);\n\n/**\n * Burn tokens from treasury\n */\nRequestType.TokenBurn = new RequestType(66);\n\n/**\n * Wipe token amount from Account holder\n */\nRequestType.TokenAccountWipe = new RequestType(67);\n\n/**\n * Associate tokens to an account\n */\nRequestType.TokenAssociateToAccount = new RequestType(68);\n\n/**\n * Dissociate tokens from an account\n */\nRequestType.TokenDissociateFromAccount = new RequestType(69);\n\n/**\n * Create Scheduled Transaction\n */\nRequestType.ScheduleCreate = new RequestType(70);\n\n/**\n * Delete Scheduled Transaction\n */\nRequestType.ScheduleDelete = new RequestType(71);\n\n/**\n * Sign Scheduled Transaction\n */\nRequestType.ScheduleSign = new RequestType(72);\n\n/**\n * Get Scheduled Transaction Information\n */\nRequestType.ScheduleGetInfo = new RequestType(73);\n\n/**\n * Get Token Account Nft Information\n */\nRequestType.TokenGetAccountNftInfos = new RequestType(74);\n\n/**\n * Get Token Nft Information\n */\nRequestType.TokenGetNftInfo = new RequestType(75);\n\n/**\n * Get Token Nft List Information\n */\nRequestType.TokenGetNftInfos = new RequestType(76);\n\n/**\n * Update a token's custom fee schedule, if permissible\n */\nRequestType.TokenFeeScheduleUpdate = new RequestType(77);\n\n/**\n * Get execution time(s) by TransactionID, if available\n */\nRequestType.NetworkGetExecutionTime = new RequestType(78);\n\n/**\n * Pause the Token\n */\nRequestType.TokenPause = new RequestType(79);\n\n/**\n * Unpause the Token\n */\nRequestType.TokenUnpause = new RequestType(80);\n\n/**\n * Approve allowance for a spender relative to the owner account\n */\nRequestType.CryptoApproveAllowance = new RequestType(81);\n\n/**\n * Deletes granted allowances on owner account\n */\nRequestType.CryptoDeleteAllowance = new RequestType(82);\n\n/**\n * Gets all the information about an account, including balance and allowances. This does not get the list of\n * account records.\n */\nRequestType.GetAccountDetails = new RequestType(83);\n\n/**\n * Ethereum Transaction\n */\nRequestType.EthereumTransaction = new RequestType(84);\n\n/**\n * Updates the staking info at the end of staking period to indicate new staking period has started.\n */\nRequestType.NodeStakeUpdate = new RequestType(85);\n\n/**\n * Generates a pseudorandom number.\n */\nRequestType.Prng = new RequestType(86);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/RequestType.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenMintTransactionBody} HashgraphProto.proto.ITokenMintTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ "./node_modules/@hashgraph/sdk/src/Signer.js": -/*!***************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Signer.js ***! - \***************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @typedef {import(\"./LedgerId.js\").default} LedgerId\n * @typedef {import(\"./SignerSignature.js\").default} SignerSignature\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./transaction/Transaction.js\").default} Transaction\n * @typedef {import(\"./transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"./transaction/TransactionReceipt.js\").default} TransactionReceipt\n * @typedef {import(\"./transaction/TransactionRecord.js\").default} TransactionRecord\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./account/AccountBalance.js\").default} AccountBalance\n * @typedef {import(\"./account/AccountInfo.js\").default} AccountInfo\n * @typedef {import(\"./Key.js\").default} Key\n */\n\n/**\n * @template {any} O\n * @typedef {import(\"./query/Query.js\").default} Query\n */\n\n/**\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n * @typedef {import(\"./Executable.js\").default} Executable\n */\n\n/**\n * @typedef {object} Signer\n * @property {() => LedgerId?} getLedgerId\n * @property {() => AccountId} getAccountId\n * @property {() => Key} [getAccountKey]\n * @property {() => {[key: string]: (string | AccountId)}} getNetwork\n * @property {() => string[]} getMirrorNetwork\n * @property {(messages: Uint8Array[]) => Promise} sign\n * @property {() => Promise} getAccountBalance\n * @property {() => Promise} getAccountInfo\n * @property {() => Promise} getAccountRecords\n * @property {(transaction: T) => Promise} signTransaction\n * @property {(transaction: T) => Promise} checkTransaction\n * @property {(transaction: T) => Promise} populateTransaction\n * @property {(request: Executable) => Promise} call\n */\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({});\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Signer.js?"); +/** + * Mint a new Hedera™ crypto-currency token. + */ +class TokenMintTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {Long | number} [props.amount] + * @param {Uint8Array[]} [props.metadata] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?Long} + */ + this._amount = null; + + /** + * @private + * @type {Uint8Array[]} + */ + this._metadata = []; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.amount != null) { + this.setAmount(props.amount); + } + + if (props.metadata != null) { + this.setMetadata(props.metadata); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenMintTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const mintToken = + /** @type {HashgraphProto.proto.ITokenMintTransactionBody} */ ( + body.tokenMint + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenMintTransaction({ + tokenId: + mintToken.token != null + ? TokenId_TokenId._fromProtobuf(mintToken.token) + : undefined, + amount: mintToken.amount != null ? mintToken.amount : undefined, + metadata: + mintToken.metadata != null ? mintToken.metadata : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?Long} + */ + get amount() { + return this._amount; + } + + /** + * @param {Long | number} amount + * @returns {this} + */ + setAmount(amount) { + this._requireNotFrozen(); + this._amount = amount instanceof src_long ? amount : src_long.fromValue(amount); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + } + + /** + * @returns {Uint8Array[]} + */ + get metadata() { + return this._metadata; + } + + /** + * @param {Uint8Array | string} metadata + * @returns {this} + */ + addMetadata(metadata) { + this._requireNotFrozen(); + + if (typeof metadata === "string") { + console.warn( + "Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.", + ); + } + + this._metadata.push( + typeof metadata === "string" ? decode(metadata) : metadata, + ); + + return this; + } + + /** + * @param {Uint8Array[]} metadata + * @returns {this} + */ + setMetadata(metadata) { + this._requireNotFrozen(); + + for (const data of metadata) { + if (typeof data === "string") { + console.warn( + "Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.", + ); + break; + } + } + + this._metadata = metadata.map((data) => + typeof data === "string" ? decode(data) : data, + ); + + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.mintToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenMint"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenMintTransactionBody} + */ + _makeTransactionData() { + return { + amount: this._amount, + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + metadata: this._metadata, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenMintTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenMint", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenMintTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenNftInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/SignerSignature.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/SignerSignature.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SignerSignature; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @typedef {import(\"./PublicKey.js\").default} PublicKey\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n */\n\nclass SignerSignature {\n /**\n * @param {object} props\n * @param {PublicKey} props.publicKey\n * @param {Uint8Array} props.signature\n * @param {AccountId} props.accountId\n */\n constructor(props) {\n this.publicKey = props.publicKey;\n this.signature = props.signature;\n this.accountId = props.accountId;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/SignerSignature.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/StakingInfo.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/StakingInfo.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ StakingInfo; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @typedef {import(\"long\").Long} Long\n */\n\n/**\n * @typedef {object} StakingInfoJson\n * @property {boolean} declineStakingReward\n * @property {?string} stakePeriodStart\n * @property {?string} pendingReward\n * @property {?string} stakedToMe\n * @property {?string} stakedAccountId\n * @property {?string} stakedNodeId\n */\n\n/**\n * Staking metadata for an account or a contract returned in CryptoGetInfo or ContractGetInfo queries\n */\nclass StakingInfo {\n /**\n * @private\n * @param {object} props\n * @param {boolean} props.declineStakingReward\n * @param {?Timestamp} props.stakePeriodStart\n * @param {?Hbar} props.pendingReward\n * @param {?Hbar} props.stakedToMe\n * @param {?AccountId} props.stakedAccountId\n * @param {?Long} props.stakedNodeId\n */\n constructor(props) {\n /**\n * If true, this account or contract declined to receive a staking reward.\n *\n * @readonly\n */\n this.declineStakingReward = props.declineStakingReward;\n\n /**\n * The staking period during which either the staking settings for this\n * account or contract changed (such as starting staking or changing\n * staked_node_id) or the most recent reward was earned, whichever is\n * later. If this account or contract is not currently staked to a\n * node, then this field is not set.\n *\n * @readonly\n */\n this.stakePeriodStart = props.stakePeriodStart;\n\n /**\n * The amount in tinybars that will be received in the next reward\n * situation.\n *\n * @readonly\n */\n this.pendingReward = props.pendingReward;\n\n /**\n * The total of balance of all accounts staked to this account or contract.\n *\n * @readonly\n */\n this.stakedToMe = props.stakedToMe;\n\n /**\n * The account to which this account or contract is staking.\n *\n * @readonly\n */\n this.stakedAccountId = props.stakedAccountId;\n\n /**\n * The ID of the node this account or contract is staked to.\n *\n * @readonly\n */\n this.stakedNodeId = props.stakedNodeId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IStakingInfo} info\n * @returns {StakingInfo}\n */\n static _fromProtobuf(info) {\n return new StakingInfo({\n declineStakingReward: info.declineReward == true,\n stakePeriodStart:\n info.stakePeriodStart != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(info.stakePeriodStart)\n : null,\n pendingReward:\n info.pendingReward != null\n ? _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(info.pendingReward)\n : null,\n stakedToMe:\n info.stakedToMe != null\n ? _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(info.stakedToMe)\n : null,\n stakedAccountId:\n info.stakedAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(info.stakedAccountId)\n : null,\n stakedNodeId: info.stakedNodeId != null ? info.stakedNodeId : null,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.IStakingInfo}\n */\n _toProtobuf() {\n return {\n declineReward: this.declineStakingReward,\n stakePeriodStart:\n this.stakePeriodStart != null\n ? this.stakePeriodStart._toProtobuf()\n : null,\n pendingReward:\n this.pendingReward != null\n ? this.pendingReward.toTinybars()\n : null,\n stakedToMe:\n this.stakedToMe != null ? this.stakedToMe.toTinybars() : null,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId._toProtobuf()\n : null,\n stakedNodeId: this.stakedNodeId,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {StakingInfo}\n */\n static fromBytes(bytes) {\n return StakingInfo._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_3__.proto.StakingInfo.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_3__.proto.StakingInfo.encode(\n this._toProtobuf()\n ).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {StakingInfoJson}\n */\n toJSON() {\n return {\n declineStakingReward: this.declineStakingReward,\n stakePeriodStart:\n this.stakePeriodStart != null\n ? this.stakePeriodStart.toString()\n : null,\n pendingReward:\n this.pendingReward != null\n ? this.pendingReward.toString()\n : null,\n stakedToMe:\n this.stakedToMe != null ? this.stakedToMe.toString() : null,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId.toString()\n : null,\n stakedNodeId:\n this.stakedNodeId != null ? this.stakedNodeId.toString() : null,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/StakingInfo.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.TokenFreezeStatus} HashgraphProto.proto.TokenFreezeStatus + * @typedef {import("@hashgraph/proto").proto.TokenKycStatus} HashgraphProto.proto.TokenKycStatus + * @typedef {import("@hashgraph/proto").proto.TokenPauseStatus} HashgraphProto.proto.TokenPauseStatus + * @typedef {import("@hashgraph/proto").proto.ITokenNftInfo} HashgraphProto.proto.ITokenNftInfo + * @typedef {import("@hashgraph/proto").proto.INftID} HashgraphProto.proto.INftID + * @typedef {import("@hashgraph/proto").proto.ITimestamp} HashgraphProto.proto.ITimestamp + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + * @typedef {import("@hashgraph/proto").proto.IKey} HashgraphProto.proto.IKey + * @typedef {import("@hashgraph/proto").proto.IDuration} HashgraphProto.proto.IDuration + */ -/***/ "./node_modules/@hashgraph/sdk/src/Status.js": -/*!***************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Status.js ***! - \***************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +class TokenNftInfo { + /** + * @private + * @param {object} props + * @param {NftId} props.nftId + * @param {AccountId} props.accountId + * @param {Timestamp} props.creationTime + * @param {Uint8Array | null} props.metadata + * @param {LedgerId|null} props.ledgerId + * @param {AccountId|null} props.spenderId + */ + constructor(props) { + /** + * ID of the nft instance + * + * @readonly + */ + this.nftId = props.nftId; + + /** + * @readonly + */ + this.accountId = props.accountId; + + /** + * @readonly + */ + this.creationTime = props.creationTime; + + /** + * @readonly + */ + this.metadata = props.metadata; + + this.ledgerId = props.ledgerId; + + this.spenderId = props.spenderId; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.ITokenNftInfo} info + * @returns {TokenNftInfo} + */ + static _fromProtobuf(info) { + return new TokenNftInfo({ + nftId: NftId_NftId._fromProtobuf( + /** @type {HashgraphProto.proto.INftID} */ (info.nftID), + ), + accountId: AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ (info.accountID), + ), + creationTime: Timestamp_Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + info.creationTime + ), + ), + metadata: info.metadata !== undefined ? info.metadata : null, + ledgerId: + info.ledgerId != null + ? LedgerId.fromBytes(info.ledgerId) + : null, + spenderId: + info.spenderId != null + ? AccountId_AccountId._fromProtobuf(info.spenderId) + : null, + }); + } + + /** + * @returns {HashgraphProto.proto.ITokenNftInfo} + */ + _toProtobuf() { + return { + nftID: this.nftId._toProtobuf(), + accountID: this.accountId._toProtobuf(), + creationTime: this.creationTime._toProtobuf(), + metadata: this.metadata, + ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null, + spenderId: + this.spenderId != null ? this.spenderId._toProtobuf() : null, + }; + } + + /** + * @typedef {object} TokenNftInfoJson + * @property {string} nftId + * @property {string} accountId + * @property {string} creationTime + * @property {string | null} metadata + * @property {string | null} ledgerId + * @property {string | null} spenderId + * @returns {TokenNftInfoJson} + */ + toJson() { + return { + nftId: this.nftId.toString(), + accountId: this.accountId.toString(), + creationTime: this.creationTime.toString(), + metadata: this.metadata != null ? hex_browser_encode(this.metadata) : null, + ledgerId: this.ledgerId != null ? this.ledgerId.toString() : null, + spenderId: + this.spenderId != null ? this.spenderId.toString() : null, + }; + } + + /** + * @returns {string} + */ + toString() { + return JSON.stringify(this.toJson()); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenNftInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Status; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ResponseCodeEnum} HashgraphProto.proto.ResponseCodeEnum\n */\n\nclass Status {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case Status.Ok:\n return \"OK\";\n case Status.InvalidTransaction:\n return \"INVALID_TRANSACTION\";\n case Status.PayerAccountNotFound:\n return \"PAYER_ACCOUNT_NOT_FOUND\";\n case Status.InvalidNodeAccount:\n return \"INVALID_NODE_ACCOUNT\";\n case Status.TransactionExpired:\n return \"TRANSACTION_EXPIRED\";\n case Status.InvalidTransactionStart:\n return \"INVALID_TRANSACTION_START\";\n case Status.InvalidTransactionDuration:\n return \"INVALID_TRANSACTION_DURATION\";\n case Status.InvalidSignature:\n return \"INVALID_SIGNATURE\";\n case Status.MemoTooLong:\n return \"MEMO_TOO_LONG\";\n case Status.InsufficientTxFee:\n return \"INSUFFICIENT_TX_FEE\";\n case Status.InsufficientPayerBalance:\n return \"INSUFFICIENT_PAYER_BALANCE\";\n case Status.DuplicateTransaction:\n return \"DUPLICATE_TRANSACTION\";\n case Status.Busy:\n return \"BUSY\";\n case Status.NotSupported:\n return \"NOT_SUPPORTED\";\n case Status.InvalidFileId:\n return \"INVALID_FILE_ID\";\n case Status.InvalidAccountId:\n return \"INVALID_ACCOUNT_ID\";\n case Status.InvalidContractId:\n return \"INVALID_CONTRACT_ID\";\n case Status.InvalidTransactionId:\n return \"INVALID_TRANSACTION_ID\";\n case Status.ReceiptNotFound:\n return \"RECEIPT_NOT_FOUND\";\n case Status.RecordNotFound:\n return \"RECORD_NOT_FOUND\";\n case Status.InvalidSolidityId:\n return \"INVALID_SOLIDITY_ID\";\n case Status.Unknown:\n return \"UNKNOWN\";\n case Status.Success:\n return \"SUCCESS\";\n case Status.FailInvalid:\n return \"FAIL_INVALID\";\n case Status.FailFee:\n return \"FAIL_FEE\";\n case Status.FailBalance:\n return \"FAIL_BALANCE\";\n case Status.KeyRequired:\n return \"KEY_REQUIRED\";\n case Status.BadEncoding:\n return \"BAD_ENCODING\";\n case Status.InsufficientAccountBalance:\n return \"INSUFFICIENT_ACCOUNT_BALANCE\";\n case Status.InvalidSolidityAddress:\n return \"INVALID_SOLIDITY_ADDRESS\";\n case Status.InsufficientGas:\n return \"INSUFFICIENT_GAS\";\n case Status.ContractSizeLimitExceeded:\n return \"CONTRACT_SIZE_LIMIT_EXCEEDED\";\n case Status.LocalCallModificationException:\n return \"LOCAL_CALL_MODIFICATION_EXCEPTION\";\n case Status.ContractRevertExecuted:\n return \"CONTRACT_REVERT_EXECUTED\";\n case Status.ContractExecutionException:\n return \"CONTRACT_EXECUTION_EXCEPTION\";\n case Status.InvalidReceivingNodeAccount:\n return \"INVALID_RECEIVING_NODE_ACCOUNT\";\n case Status.MissingQueryHeader:\n return \"MISSING_QUERY_HEADER\";\n case Status.AccountUpdateFailed:\n return \"ACCOUNT_UPDATE_FAILED\";\n case Status.InvalidKeyEncoding:\n return \"INVALID_KEY_ENCODING\";\n case Status.NullSolidityAddress:\n return \"NULL_SOLIDITY_ADDRESS\";\n case Status.ContractUpdateFailed:\n return \"CONTRACT_UPDATE_FAILED\";\n case Status.InvalidQueryHeader:\n return \"INVALID_QUERY_HEADER\";\n case Status.InvalidFeeSubmitted:\n return \"INVALID_FEE_SUBMITTED\";\n case Status.InvalidPayerSignature:\n return \"INVALID_PAYER_SIGNATURE\";\n case Status.KeyNotProvided:\n return \"KEY_NOT_PROVIDED\";\n case Status.InvalidExpirationTime:\n return \"INVALID_EXPIRATION_TIME\";\n case Status.NoWaclKey:\n return \"NO_WACL_KEY\";\n case Status.FileContentEmpty:\n return \"FILE_CONTENT_EMPTY\";\n case Status.InvalidAccountAmounts:\n return \"INVALID_ACCOUNT_AMOUNTS\";\n case Status.EmptyTransactionBody:\n return \"EMPTY_TRANSACTION_BODY\";\n case Status.InvalidTransactionBody:\n return \"INVALID_TRANSACTION_BODY\";\n case Status.InvalidSignatureTypeMismatchingKey:\n return \"INVALID_SIGNATURE_TYPE_MISMATCHING_KEY\";\n case Status.InvalidSignatureCountMismatchingKey:\n return \"INVALID_SIGNATURE_COUNT_MISMATCHING_KEY\";\n case Status.EmptyLiveHashBody:\n return \"EMPTY_LIVE_HASH_BODY\";\n case Status.EmptyLiveHash:\n return \"EMPTY_LIVE_HASH\";\n case Status.EmptyLiveHashKeys:\n return \"EMPTY_LIVE_HASH_KEYS\";\n case Status.InvalidLiveHashSize:\n return \"INVALID_LIVE_HASH_SIZE\";\n case Status.EmptyQueryBody:\n return \"EMPTY_QUERY_BODY\";\n case Status.EmptyLiveHashQuery:\n return \"EMPTY_LIVE_HASH_QUERY\";\n case Status.LiveHashNotFound:\n return \"LIVE_HASH_NOT_FOUND\";\n case Status.AccountIdDoesNotExist:\n return \"ACCOUNT_ID_DOES_NOT_EXIST\";\n case Status.LiveHashAlreadyExists:\n return \"LIVE_HASH_ALREADY_EXISTS\";\n case Status.InvalidFileWacl:\n return \"INVALID_FILE_WACL\";\n case Status.SerializationFailed:\n return \"SERIALIZATION_FAILED\";\n case Status.TransactionOversize:\n return \"TRANSACTION_OVERSIZE\";\n case Status.TransactionTooManyLayers:\n return \"TRANSACTION_TOO_MANY_LAYERS\";\n case Status.ContractDeleted:\n return \"CONTRACT_DELETED\";\n case Status.PlatformNotActive:\n return \"PLATFORM_NOT_ACTIVE\";\n case Status.KeyPrefixMismatch:\n return \"KEY_PREFIX_MISMATCH\";\n case Status.PlatformTransactionNotCreated:\n return \"PLATFORM_TRANSACTION_NOT_CREATED\";\n case Status.InvalidRenewalPeriod:\n return \"INVALID_RENEWAL_PERIOD\";\n case Status.InvalidPayerAccountId:\n return \"INVALID_PAYER_ACCOUNT_ID\";\n case Status.AccountDeleted:\n return \"ACCOUNT_DELETED\";\n case Status.FileDeleted:\n return \"FILE_DELETED\";\n case Status.AccountRepeatedInAccountAmounts:\n return \"ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS\";\n case Status.SettingNegativeAccountBalance:\n return \"SETTING_NEGATIVE_ACCOUNT_BALANCE\";\n case Status.ObtainerRequired:\n return \"OBTAINER_REQUIRED\";\n case Status.ObtainerSameContractId:\n return \"OBTAINER_SAME_CONTRACT_ID\";\n case Status.ObtainerDoesNotExist:\n return \"OBTAINER_DOES_NOT_EXIST\";\n case Status.ModifyingImmutableContract:\n return \"MODIFYING_IMMUTABLE_CONTRACT\";\n case Status.FileSystemException:\n return \"FILE_SYSTEM_EXCEPTION\";\n case Status.AutorenewDurationNotInRange:\n return \"AUTORENEW_DURATION_NOT_IN_RANGE\";\n case Status.ErrorDecodingBytestring:\n return \"ERROR_DECODING_BYTESTRING\";\n case Status.ContractFileEmpty:\n return \"CONTRACT_FILE_EMPTY\";\n case Status.ContractBytecodeEmpty:\n return \"CONTRACT_BYTECODE_EMPTY\";\n case Status.InvalidInitialBalance:\n return \"INVALID_INITIAL_BALANCE\";\n case Status.InvalidReceiveRecordThreshold:\n return \"INVALID_RECEIVE_RECORD_THRESHOLD\";\n case Status.InvalidSendRecordThreshold:\n return \"INVALID_SEND_RECORD_THRESHOLD\";\n case Status.AccountIsNotGenesisAccount:\n return \"ACCOUNT_IS_NOT_GENESIS_ACCOUNT\";\n case Status.PayerAccountUnauthorized:\n return \"PAYER_ACCOUNT_UNAUTHORIZED\";\n case Status.InvalidFreezeTransactionBody:\n return \"INVALID_FREEZE_TRANSACTION_BODY\";\n case Status.FreezeTransactionBodyNotFound:\n return \"FREEZE_TRANSACTION_BODY_NOT_FOUND\";\n case Status.TransferListSizeLimitExceeded:\n return \"TRANSFER_LIST_SIZE_LIMIT_EXCEEDED\";\n case Status.ResultSizeLimitExceeded:\n return \"RESULT_SIZE_LIMIT_EXCEEDED\";\n case Status.NotSpecialAccount:\n return \"NOT_SPECIAL_ACCOUNT\";\n case Status.ContractNegativeGas:\n return \"CONTRACT_NEGATIVE_GAS\";\n case Status.ContractNegativeValue:\n return \"CONTRACT_NEGATIVE_VALUE\";\n case Status.InvalidFeeFile:\n return \"INVALID_FEE_FILE\";\n case Status.InvalidExchangeRateFile:\n return \"INVALID_EXCHANGE_RATE_FILE\";\n case Status.InsufficientLocalCallGas:\n return \"INSUFFICIENT_LOCAL_CALL_GAS\";\n case Status.EntityNotAllowedToDelete:\n return \"ENTITY_NOT_ALLOWED_TO_DELETE\";\n case Status.AuthorizationFailed:\n return \"AUTHORIZATION_FAILED\";\n case Status.FileUploadedProtoInvalid:\n return \"FILE_UPLOADED_PROTO_INVALID\";\n case Status.FileUploadedProtoNotSavedToDisk:\n return \"FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK\";\n case Status.FeeScheduleFilePartUploaded:\n return \"FEE_SCHEDULE_FILE_PART_UPLOADED\";\n case Status.ExchangeRateChangeLimitExceeded:\n return \"EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED\";\n case Status.MaxContractStorageExceeded:\n return \"MAX_CONTRACT_STORAGE_EXCEEDED\";\n case Status.TransferAccountSameAsDeleteAccount:\n return \"TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT\";\n case Status.TotalLedgerBalanceInvalid:\n return \"TOTAL_LEDGER_BALANCE_INVALID\";\n case Status.ExpirationReductionNotAllowed:\n return \"EXPIRATION_REDUCTION_NOT_ALLOWED\";\n case Status.MaxGasLimitExceeded:\n return \"MAX_GAS_LIMIT_EXCEEDED\";\n case Status.MaxFileSizeExceeded:\n return \"MAX_FILE_SIZE_EXCEEDED\";\n case Status.ReceiverSigRequired:\n return \"RECEIVER_SIG_REQUIRED\";\n case Status.InvalidTopicId:\n return \"INVALID_TOPIC_ID\";\n case Status.InvalidAdminKey:\n return \"INVALID_ADMIN_KEY\";\n case Status.InvalidSubmitKey:\n return \"INVALID_SUBMIT_KEY\";\n case Status.Unauthorized:\n return \"UNAUTHORIZED\";\n case Status.InvalidTopicMessage:\n return \"INVALID_TOPIC_MESSAGE\";\n case Status.InvalidAutorenewAccount:\n return \"INVALID_AUTORENEW_ACCOUNT\";\n case Status.AutorenewAccountNotAllowed:\n return \"AUTORENEW_ACCOUNT_NOT_ALLOWED\";\n case Status.TopicExpired:\n return \"TOPIC_EXPIRED\";\n case Status.InvalidChunkNumber:\n return \"INVALID_CHUNK_NUMBER\";\n case Status.InvalidChunkTransactionId:\n return \"INVALID_CHUNK_TRANSACTION_ID\";\n case Status.AccountFrozenForToken:\n return \"ACCOUNT_FROZEN_FOR_TOKEN\";\n case Status.TokensPerAccountLimitExceeded:\n return \"TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED\";\n case Status.InvalidTokenId:\n return \"INVALID_TOKEN_ID\";\n case Status.InvalidTokenDecimals:\n return \"INVALID_TOKEN_DECIMALS\";\n case Status.InvalidTokenInitialSupply:\n return \"INVALID_TOKEN_INITIAL_SUPPLY\";\n case Status.InvalidTreasuryAccountForToken:\n return \"INVALID_TREASURY_ACCOUNT_FOR_TOKEN\";\n case Status.InvalidTokenSymbol:\n return \"INVALID_TOKEN_SYMBOL\";\n case Status.TokenHasNoFreezeKey:\n return \"TOKEN_HAS_NO_FREEZE_KEY\";\n case Status.TransfersNotZeroSumForToken:\n return \"TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN\";\n case Status.MissingTokenSymbol:\n return \"MISSING_TOKEN_SYMBOL\";\n case Status.TokenSymbolTooLong:\n return \"TOKEN_SYMBOL_TOO_LONG\";\n case Status.AccountKycNotGrantedForToken:\n return \"ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN\";\n case Status.TokenHasNoKycKey:\n return \"TOKEN_HAS_NO_KYC_KEY\";\n case Status.InsufficientTokenBalance:\n return \"INSUFFICIENT_TOKEN_BALANCE\";\n case Status.TokenWasDeleted:\n return \"TOKEN_WAS_DELETED\";\n case Status.TokenHasNoSupplyKey:\n return \"TOKEN_HAS_NO_SUPPLY_KEY\";\n case Status.TokenHasNoWipeKey:\n return \"TOKEN_HAS_NO_WIPE_KEY\";\n case Status.InvalidTokenMintAmount:\n return \"INVALID_TOKEN_MINT_AMOUNT\";\n case Status.InvalidTokenBurnAmount:\n return \"INVALID_TOKEN_BURN_AMOUNT\";\n case Status.TokenNotAssociatedToAccount:\n return \"TOKEN_NOT_ASSOCIATED_TO_ACCOUNT\";\n case Status.CannotWipeTokenTreasuryAccount:\n return \"CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT\";\n case Status.InvalidKycKey:\n return \"INVALID_KYC_KEY\";\n case Status.InvalidWipeKey:\n return \"INVALID_WIPE_KEY\";\n case Status.InvalidFreezeKey:\n return \"INVALID_FREEZE_KEY\";\n case Status.InvalidSupplyKey:\n return \"INVALID_SUPPLY_KEY\";\n case Status.MissingTokenName:\n return \"MISSING_TOKEN_NAME\";\n case Status.TokenNameTooLong:\n return \"TOKEN_NAME_TOO_LONG\";\n case Status.InvalidWipingAmount:\n return \"INVALID_WIPING_AMOUNT\";\n case Status.TokenIsImmutable:\n return \"TOKEN_IS_IMMUTABLE\";\n case Status.TokenAlreadyAssociatedToAccount:\n return \"TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT\";\n case Status.TransactionRequiresZeroTokenBalances:\n return \"TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES\";\n case Status.AccountIsTreasury:\n return \"ACCOUNT_IS_TREASURY\";\n case Status.TokenIdRepeatedInTokenList:\n return \"TOKEN_ID_REPEATED_IN_TOKEN_LIST\";\n case Status.TokenTransferListSizeLimitExceeded:\n return \"TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED\";\n case Status.EmptyTokenTransferBody:\n return \"EMPTY_TOKEN_TRANSFER_BODY\";\n case Status.EmptyTokenTransferAccountAmounts:\n return \"EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS\";\n case Status.InvalidScheduleId:\n return \"INVALID_SCHEDULE_ID\";\n case Status.ScheduleIsImmutable:\n return \"SCHEDULE_IS_IMMUTABLE\";\n case Status.InvalidSchedulePayerId:\n return \"INVALID_SCHEDULE_PAYER_ID\";\n case Status.InvalidScheduleAccountId:\n return \"INVALID_SCHEDULE_ACCOUNT_ID\";\n case Status.NoNewValidSignatures:\n return \"NO_NEW_VALID_SIGNATURES\";\n case Status.UnresolvableRequiredSigners:\n return \"UNRESOLVABLE_REQUIRED_SIGNERS\";\n case Status.ScheduledTransactionNotInWhitelist:\n return \"SCHEDULED_TRANSACTION_NOT_IN_WHITELIST\";\n case Status.SomeSignaturesWereInvalid:\n return \"SOME_SIGNATURES_WERE_INVALID\";\n case Status.TransactionIdFieldNotAllowed:\n return \"TRANSACTION_ID_FIELD_NOT_ALLOWED\";\n case Status.IdenticalScheduleAlreadyCreated:\n return \"IDENTICAL_SCHEDULE_ALREADY_CREATED\";\n case Status.InvalidZeroByteInString:\n return \"INVALID_ZERO_BYTE_IN_STRING\";\n case Status.ScheduleAlreadyDeleted:\n return \"SCHEDULE_ALREADY_DELETED\";\n case Status.ScheduleAlreadyExecuted:\n return \"SCHEDULE_ALREADY_EXECUTED\";\n case Status.MessageSizeTooLarge:\n return \"MESSAGE_SIZE_TOO_LARGE\";\n case Status.OperationRepeatedInBucketGroups:\n return \"OPERATION_REPEATED_IN_BUCKET_GROUPS\";\n case Status.BucketCapacityOverflow:\n return \"BUCKET_CAPACITY_OVERFLOW\";\n case Status.NodeCapacityNotSufficientForOperation:\n return \"NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION\";\n case Status.BucketHasNoThrottleGroups:\n return \"BUCKET_HAS_NO_THROTTLE_GROUPS\";\n case Status.ThrottleGroupHasZeroOpsPerSec:\n return \"THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC\";\n case Status.SuccessButMissingExpectedOperation:\n return \"SUCCESS_BUT_MISSING_EXPECTED_OPERATION\";\n case Status.UnparseableThrottleDefinitions:\n return \"UNPARSEABLE_THROTTLE_DEFINITIONS\";\n case Status.InvalidThrottleDefinitions:\n return \"INVALID_THROTTLE_DEFINITIONS\";\n case Status.AccountExpiredAndPendingRemoval:\n return \"ACCOUNT_EXPIRED_AND_PENDING_REMOVAL\";\n case Status.InvalidTokenMaxSupply:\n return \"INVALID_TOKEN_MAX_SUPPLY\";\n case Status.InvalidTokenNftSerialNumber:\n return \"INVALID_TOKEN_NFT_SERIAL_NUMBER\";\n case Status.InvalidNftId:\n return \"INVALID_NFT_ID\";\n case Status.MetadataTooLong:\n return \"METADATA_TOO_LONG\";\n case Status.BatchSizeLimitExceeded:\n return \"BATCH_SIZE_LIMIT_EXCEEDED\";\n case Status.InvalidQueryRange:\n return \"INVALID_QUERY_RANGE\";\n case Status.FractionDividesByZero:\n return \"FRACTION_DIVIDES_BY_ZERO\";\n case Status.InsufficientPayerBalanceForCustomFee:\n return \"INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE\";\n case Status.CustomFeesListTooLong:\n return \"CUSTOM_FEES_LIST_TOO_LONG\";\n case Status.InvalidCustomFeeCollector:\n return \"INVALID_CUSTOM_FEE_COLLECTOR\";\n case Status.InvalidTokenIdInCustomFees:\n return \"INVALID_TOKEN_ID_IN_CUSTOM_FEES\";\n case Status.TokenNotAssociatedToFeeCollector:\n return \"TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR\";\n case Status.TokenMaxSupplyReached:\n return \"TOKEN_MAX_SUPPLY_REACHED\";\n case Status.SenderDoesNotOwnNftSerialNo:\n return \"SENDER_DOES_NOT_OWN_NFT_SERIAL_NO\";\n case Status.CustomFeeNotFullySpecified:\n return \"CUSTOM_FEE_NOT_FULLY_SPECIFIED\";\n case Status.CustomFeeMustBePositive:\n return \"CUSTOM_FEE_MUST_BE_POSITIVE\";\n case Status.TokenHasNoFeeScheduleKey:\n return \"TOKEN_HAS_NO_FEE_SCHEDULE_KEY\";\n case Status.CustomFeeOutsideNumericRange:\n return \"CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE\";\n case Status.RoyaltyFractionCannotExceedOne:\n return \"ROYALTY_FRACTION_CANNOT_EXCEED_ONE\";\n case Status.FractionalFeeMaxAmountLessThanMinAmount:\n return \"FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT\";\n case Status.CustomScheduleAlreadyHasNoFees:\n return \"CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES\";\n case Status.CustomFeeDenominationMustBeFungibleCommon:\n return \"CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON\";\n case Status.CustomFractionalFeeOnlyAllowedForFungibleCommon:\n return \"CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON\";\n case Status.InvalidCustomFeeScheduleKey:\n return \"INVALID_CUSTOM_FEE_SCHEDULE_KEY\";\n case Status.InvalidTokenMintMetadata:\n return \"INVALID_TOKEN_MINT_METADATA\";\n case Status.InvalidTokenBurnMetadata:\n return \"INVALID_TOKEN_BURN_METADATA\";\n case Status.CurrentTreasuryStillOwnsNfts:\n return \"CURRENT_TREASURY_STILL_OWNS_NFTS\";\n case Status.AccountStillOwnsNfts:\n return \"ACCOUNT_STILL_OWNS_NFTS\";\n case Status.TreasuryMustOwnBurnedNft:\n return \"TREASURY_MUST_OWN_BURNED_NFT\";\n case Status.AccountDoesNotOwnWipedNft:\n return \"ACCOUNT_DOES_NOT_OWN_WIPED_NFT\";\n case Status.AccountAmountTransfersOnlyAllowedForFungibleCommon:\n return \"ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON\";\n case Status.MaxNftsInPriceRegimeHaveBeenMinted:\n return \"MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED\";\n case Status.PayerAccountDeleted:\n return \"PAYER_ACCOUNT_DELETED\";\n case Status.CustomFeeChargingExceededMaxRecursionDepth:\n return \"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH\";\n case Status.CustomFeeChargingExceededMaxAccountAmounts:\n return \"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS\";\n case Status.InsufficientSenderAccountBalanceForCustomFee:\n return \"INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE\";\n case Status.SerialNumberLimitReached:\n return \"SERIAL_NUMBER_LIMIT_REACHED\";\n case Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique:\n return \"CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE\";\n case Status.NoRemainingAutomaticAssociations:\n return \"NO_REMAINING_AUTOMATIC_ASSOCIATIONS\";\n case Status.ExistingAutomaticAssociationsExceedGivenLimit:\n return \"EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT\";\n case Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit:\n return \"REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT\";\n case Status.TokenIsPaused:\n return \"TOKEN_IS_PAUSED\";\n case Status.TokenHasNoPauseKey:\n return \"TOKEN_HAS_NO_PAUSE_KEY\";\n case Status.InvalidPauseKey:\n return \"INVALID_PAUSE_KEY\";\n case Status.FreezeUpdateFileDoesNotExist:\n return \"FREEZE_UPDATE_FILE_DOES_NOT_EXIST\";\n case Status.FreezeUpdateFileHashDoesNotMatch:\n return \"FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH\";\n case Status.NoUpgradeHasBeenPrepared:\n return \"NO_UPGRADE_HAS_BEEN_PREPARED\";\n case Status.NoFreezeIsScheduled:\n return \"NO_FREEZE_IS_SCHEDULED\";\n case Status.UpdateFileHashChangedSincePrepareUpgrade:\n return \"UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE\";\n case Status.FreezeStartTimeMustBeFuture:\n return \"FREEZE_START_TIME_MUST_BE_FUTURE\";\n case Status.PreparedUpdateFileIsImmutable:\n return \"PREPARED_UPDATE_FILE_IS_IMMUTABLE\";\n case Status.FreezeAlreadyScheduled:\n return \"FREEZE_ALREADY_SCHEDULED\";\n case Status.FreezeUpgradeInProgress:\n return \"FREEZE_UPGRADE_IN_PROGRESS\";\n case Status.UpdateFileIdDoesNotMatchPrepared:\n return \"UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED\";\n case Status.UpdateFileHashDoesNotMatchPrepared:\n return \"UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED\";\n case Status.ConsensusGasExhausted:\n return \"CONSENSUS_GAS_EXHAUSTED\";\n case Status.RevertedSuccess:\n return \"REVERTED_SUCCESS\";\n case Status.MaxStorageInPriceRegimeHasBeenUsed:\n return \"MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED\";\n case Status.InvalidAliasKey:\n return \"INVALID_ALIAS_KEY\";\n case Status.UnexpectedTokenDecimals:\n return \"UNEXPECTED_TOKEN_DECIMALS\";\n case Status.InvalidProxyAccountId:\n return \"INVALID_PROXY_ACCOUNT_ID\";\n case Status.InvalidTransferAccountId:\n return \"INVALID_TRANSFER_ACCOUNT_ID\";\n case Status.InvalidFeeCollectorAccountId:\n return \"INVALID_FEE_COLLECTOR_ACCOUNT_ID\";\n case Status.AliasIsImmutable:\n return \"ALIAS_IS_IMMUTABLE\";\n case Status.SpenderAccountSameAsOwner:\n return \"SPENDER_ACCOUNT_SAME_AS_OWNER\";\n case Status.AmountExceedsTokenMaxSupply:\n return \"AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY\";\n case Status.NegativeAllowanceAmount:\n return \"NEGATIVE_ALLOWANCE_AMOUNT\";\n case Status.CannotApproveForAllFungibleCommon:\n return \"CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON\";\n case Status.SpenderDoesNotHaveAllowance:\n return \"SPENDER_DOES_NOT_HAVE_ALLOWANCE\";\n case Status.AmountExceedsAllowance:\n return \"AMOUNT_EXCEEDS_ALLOWANCE\";\n case Status.MaxAllowancesExceeded:\n return \"MAX_ALLOWANCES_EXCEEDED\";\n case Status.EmptyAllowances:\n return \"EMPTY_ALLOWANCES\";\n case Status.SpenderAccountRepeatedInAllowances:\n return \"SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES\";\n case Status.RepeatedSerialNumsInNftAllowances:\n return \"REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES\";\n case Status.FungibleTokenInNftAllowances:\n return \"FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES\";\n case Status.NftInFungibleTokenAllowances:\n return \"NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES\";\n case Status.InvalidAllowanceOwnerId:\n return \"INVALID_ALLOWANCE_OWNER_ID\";\n case Status.InvalidAllowanceSpenderId:\n return \"INVALID_ALLOWANCE_SPENDER_ID\";\n case Status.RepeatedAllowancesToDelete:\n return \"REPEATED_ALLOWANCES_TO_DELETE\";\n case Status.InvalidDelegatingSpender:\n return \"INVALID_DELEGATING_SPENDER\";\n case Status.DelegatingSpenderCannotGrantApproveForAll:\n return \"DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL\";\n case Status.DelegatingSpenderDoesNotHaveApproveForAll:\n return \"DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL\";\n case Status.ScheduleExpirationTimeTooFarInFuture:\n return \"SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE\";\n case Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime:\n return \"SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME\";\n case Status.ScheduleFutureThrottleExceeded:\n return \"SCHEDULE_FUTURE_THROTTLE_EXCEEDED\";\n case Status.ScheduleFutureGasLimitExceeded:\n return \"SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED\";\n case Status.InvalidEthereumTransaction:\n return \"INVALID_ETHEREUM_TRANSACTION\";\n case Status.WrongChainId:\n return \"WRONG_CHAIN_ID\";\n case Status.WrongNonce:\n return \"WRONG_NONCE\";\n case Status.AccessListUnsupported:\n return \"ACCESS_LIST_UNSUPPORTED\";\n case Status.SchedulePendingExpiration:\n return \"SCHEDULE_PENDING_EXPIRATION\";\n case Status.ContractIsTokenTreasury:\n return \"CONTRACT_IS_TOKEN_TREASURY\";\n case Status.ContractHasNonZeroTokenBalances:\n return \"CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES\";\n case Status.ContractExpiredAndPendingRemoval:\n return \"CONTRACT_EXPIRED_AND_PENDING_REMOVAL\";\n case Status.ContractHasNoAutoRenewAccount:\n return \"CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT\";\n case Status.PermanentRemovalRequiresSystemInitiation:\n return \"PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION\";\n case Status.ProxyAccountIdFieldIsDeprecated:\n return \"PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED\";\n case Status.SelfStakingIsNotAllowed:\n return \"SELF_STAKING_IS_NOT_ALLOWED\";\n case Status.InvalidStakingId:\n return \"INVALID_STAKING_ID\";\n case Status.StakingNotEnabled:\n return \"STAKING_NOT_ENABLED\";\n case Status.InvalidPrngRange:\n return \"INVALID_PRNG_RANGE\";\n case Status.MaxEntitiesInPriceRegimeHaveBeenCreated:\n return \"MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED\";\n case Status.InvalidFullPrefixSignatureForPrecompile:\n return \"INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE\";\n case Status.InsufficientBalancesForStorageRent:\n return \"INSUFFICIENT_BALANCES_FOR_STORAGE_RENT\";\n case Status.MaxChildRecordsExceeded:\n return \"MAX_CHILD_RECORDS_EXCEEDED\";\n case Status.InsufficientBalancesForRenewalFees:\n return \"INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES\";\n case Status.TransactionHasUnknownFields:\n return \"TRANSACTION_HAS_UNKNOWN_FIELDS\";\n case Status.AccountIsImmutable:\n return \"ACCOUNT_IS_IMMUTABLE\";\n case Status.AliasAlreadyAssigned:\n return \"ALIAS_ALREADY_ASSIGNED\";\n default:\n return `UNKNOWN (${this._code})`;\n }\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {Status}\n */\n static _fromCode(code) {\n switch (code) {\n case 0:\n return Status.Ok;\n case 1:\n return Status.InvalidTransaction;\n case 2:\n return Status.PayerAccountNotFound;\n case 3:\n return Status.InvalidNodeAccount;\n case 4:\n return Status.TransactionExpired;\n case 5:\n return Status.InvalidTransactionStart;\n case 6:\n return Status.InvalidTransactionDuration;\n case 7:\n return Status.InvalidSignature;\n case 8:\n return Status.MemoTooLong;\n case 9:\n return Status.InsufficientTxFee;\n case 10:\n return Status.InsufficientPayerBalance;\n case 11:\n return Status.DuplicateTransaction;\n case 12:\n return Status.Busy;\n case 13:\n return Status.NotSupported;\n case 14:\n return Status.InvalidFileId;\n case 15:\n return Status.InvalidAccountId;\n case 16:\n return Status.InvalidContractId;\n case 17:\n return Status.InvalidTransactionId;\n case 18:\n return Status.ReceiptNotFound;\n case 19:\n return Status.RecordNotFound;\n case 20:\n return Status.InvalidSolidityId;\n case 21:\n return Status.Unknown;\n case 22:\n return Status.Success;\n case 23:\n return Status.FailInvalid;\n case 24:\n return Status.FailFee;\n case 25:\n return Status.FailBalance;\n case 26:\n return Status.KeyRequired;\n case 27:\n return Status.BadEncoding;\n case 28:\n return Status.InsufficientAccountBalance;\n case 29:\n return Status.InvalidSolidityAddress;\n case 30:\n return Status.InsufficientGas;\n case 31:\n return Status.ContractSizeLimitExceeded;\n case 32:\n return Status.LocalCallModificationException;\n case 33:\n return Status.ContractRevertExecuted;\n case 34:\n return Status.ContractExecutionException;\n case 35:\n return Status.InvalidReceivingNodeAccount;\n case 36:\n return Status.MissingQueryHeader;\n case 37:\n return Status.AccountUpdateFailed;\n case 38:\n return Status.InvalidKeyEncoding;\n case 39:\n return Status.NullSolidityAddress;\n case 40:\n return Status.ContractUpdateFailed;\n case 41:\n return Status.InvalidQueryHeader;\n case 42:\n return Status.InvalidFeeSubmitted;\n case 43:\n return Status.InvalidPayerSignature;\n case 44:\n return Status.KeyNotProvided;\n case 45:\n return Status.InvalidExpirationTime;\n case 46:\n return Status.NoWaclKey;\n case 47:\n return Status.FileContentEmpty;\n case 48:\n return Status.InvalidAccountAmounts;\n case 49:\n return Status.EmptyTransactionBody;\n case 50:\n return Status.InvalidTransactionBody;\n case 51:\n return Status.InvalidSignatureTypeMismatchingKey;\n case 52:\n return Status.InvalidSignatureCountMismatchingKey;\n case 53:\n return Status.EmptyLiveHashBody;\n case 54:\n return Status.EmptyLiveHash;\n case 55:\n return Status.EmptyLiveHashKeys;\n case 56:\n return Status.InvalidLiveHashSize;\n case 57:\n return Status.EmptyQueryBody;\n case 58:\n return Status.EmptyLiveHashQuery;\n case 59:\n return Status.LiveHashNotFound;\n case 60:\n return Status.AccountIdDoesNotExist;\n case 61:\n return Status.LiveHashAlreadyExists;\n case 62:\n return Status.InvalidFileWacl;\n case 63:\n return Status.SerializationFailed;\n case 64:\n return Status.TransactionOversize;\n case 65:\n return Status.TransactionTooManyLayers;\n case 66:\n return Status.ContractDeleted;\n case 67:\n return Status.PlatformNotActive;\n case 68:\n return Status.KeyPrefixMismatch;\n case 69:\n return Status.PlatformTransactionNotCreated;\n case 70:\n return Status.InvalidRenewalPeriod;\n case 71:\n return Status.InvalidPayerAccountId;\n case 72:\n return Status.AccountDeleted;\n case 73:\n return Status.FileDeleted;\n case 74:\n return Status.AccountRepeatedInAccountAmounts;\n case 75:\n return Status.SettingNegativeAccountBalance;\n case 76:\n return Status.ObtainerRequired;\n case 77:\n return Status.ObtainerSameContractId;\n case 78:\n return Status.ObtainerDoesNotExist;\n case 79:\n return Status.ModifyingImmutableContract;\n case 80:\n return Status.FileSystemException;\n case 81:\n return Status.AutorenewDurationNotInRange;\n case 82:\n return Status.ErrorDecodingBytestring;\n case 83:\n return Status.ContractFileEmpty;\n case 84:\n return Status.ContractBytecodeEmpty;\n case 85:\n return Status.InvalidInitialBalance;\n case 86:\n return Status.InvalidReceiveRecordThreshold;\n case 87:\n return Status.InvalidSendRecordThreshold;\n case 88:\n return Status.AccountIsNotGenesisAccount;\n case 89:\n return Status.PayerAccountUnauthorized;\n case 90:\n return Status.InvalidFreezeTransactionBody;\n case 91:\n return Status.FreezeTransactionBodyNotFound;\n case 92:\n return Status.TransferListSizeLimitExceeded;\n case 93:\n return Status.ResultSizeLimitExceeded;\n case 94:\n return Status.NotSpecialAccount;\n case 95:\n return Status.ContractNegativeGas;\n case 96:\n return Status.ContractNegativeValue;\n case 97:\n return Status.InvalidFeeFile;\n case 98:\n return Status.InvalidExchangeRateFile;\n case 99:\n return Status.InsufficientLocalCallGas;\n case 100:\n return Status.EntityNotAllowedToDelete;\n case 101:\n return Status.AuthorizationFailed;\n case 102:\n return Status.FileUploadedProtoInvalid;\n case 103:\n return Status.FileUploadedProtoNotSavedToDisk;\n case 104:\n return Status.FeeScheduleFilePartUploaded;\n case 105:\n return Status.ExchangeRateChangeLimitExceeded;\n case 106:\n return Status.MaxContractStorageExceeded;\n case 107:\n return Status.TransferAccountSameAsDeleteAccount;\n case 108:\n return Status.TotalLedgerBalanceInvalid;\n case 110:\n return Status.ExpirationReductionNotAllowed;\n case 111:\n return Status.MaxGasLimitExceeded;\n case 112:\n return Status.MaxFileSizeExceeded;\n case 113:\n return Status.ReceiverSigRequired;\n case 150:\n return Status.InvalidTopicId;\n case 155:\n return Status.InvalidAdminKey;\n case 156:\n return Status.InvalidSubmitKey;\n case 157:\n return Status.Unauthorized;\n case 158:\n return Status.InvalidTopicMessage;\n case 159:\n return Status.InvalidAutorenewAccount;\n case 160:\n return Status.AutorenewAccountNotAllowed;\n case 162:\n return Status.TopicExpired;\n case 163:\n return Status.InvalidChunkNumber;\n case 164:\n return Status.InvalidChunkTransactionId;\n case 165:\n return Status.AccountFrozenForToken;\n case 166:\n return Status.TokensPerAccountLimitExceeded;\n case 167:\n return Status.InvalidTokenId;\n case 168:\n return Status.InvalidTokenDecimals;\n case 169:\n return Status.InvalidTokenInitialSupply;\n case 170:\n return Status.InvalidTreasuryAccountForToken;\n case 171:\n return Status.InvalidTokenSymbol;\n case 172:\n return Status.TokenHasNoFreezeKey;\n case 173:\n return Status.TransfersNotZeroSumForToken;\n case 174:\n return Status.MissingTokenSymbol;\n case 175:\n return Status.TokenSymbolTooLong;\n case 176:\n return Status.AccountKycNotGrantedForToken;\n case 177:\n return Status.TokenHasNoKycKey;\n case 178:\n return Status.InsufficientTokenBalance;\n case 179:\n return Status.TokenWasDeleted;\n case 180:\n return Status.TokenHasNoSupplyKey;\n case 181:\n return Status.TokenHasNoWipeKey;\n case 182:\n return Status.InvalidTokenMintAmount;\n case 183:\n return Status.InvalidTokenBurnAmount;\n case 184:\n return Status.TokenNotAssociatedToAccount;\n case 185:\n return Status.CannotWipeTokenTreasuryAccount;\n case 186:\n return Status.InvalidKycKey;\n case 187:\n return Status.InvalidWipeKey;\n case 188:\n return Status.InvalidFreezeKey;\n case 189:\n return Status.InvalidSupplyKey;\n case 190:\n return Status.MissingTokenName;\n case 191:\n return Status.TokenNameTooLong;\n case 192:\n return Status.InvalidWipingAmount;\n case 193:\n return Status.TokenIsImmutable;\n case 194:\n return Status.TokenAlreadyAssociatedToAccount;\n case 195:\n return Status.TransactionRequiresZeroTokenBalances;\n case 196:\n return Status.AccountIsTreasury;\n case 197:\n return Status.TokenIdRepeatedInTokenList;\n case 198:\n return Status.TokenTransferListSizeLimitExceeded;\n case 199:\n return Status.EmptyTokenTransferBody;\n case 200:\n return Status.EmptyTokenTransferAccountAmounts;\n case 201:\n return Status.InvalidScheduleId;\n case 202:\n return Status.ScheduleIsImmutable;\n case 203:\n return Status.InvalidSchedulePayerId;\n case 204:\n return Status.InvalidScheduleAccountId;\n case 205:\n return Status.NoNewValidSignatures;\n case 206:\n return Status.UnresolvableRequiredSigners;\n case 207:\n return Status.ScheduledTransactionNotInWhitelist;\n case 208:\n return Status.SomeSignaturesWereInvalid;\n case 209:\n return Status.TransactionIdFieldNotAllowed;\n case 210:\n return Status.IdenticalScheduleAlreadyCreated;\n case 211:\n return Status.InvalidZeroByteInString;\n case 212:\n return Status.ScheduleAlreadyDeleted;\n case 213:\n return Status.ScheduleAlreadyExecuted;\n case 214:\n return Status.MessageSizeTooLarge;\n case 215:\n return Status.OperationRepeatedInBucketGroups;\n case 216:\n return Status.BucketCapacityOverflow;\n case 217:\n return Status.NodeCapacityNotSufficientForOperation;\n case 218:\n return Status.BucketHasNoThrottleGroups;\n case 219:\n return Status.ThrottleGroupHasZeroOpsPerSec;\n case 220:\n return Status.SuccessButMissingExpectedOperation;\n case 221:\n return Status.UnparseableThrottleDefinitions;\n case 222:\n return Status.InvalidThrottleDefinitions;\n case 223:\n return Status.AccountExpiredAndPendingRemoval;\n case 224:\n return Status.InvalidTokenMaxSupply;\n case 225:\n return Status.InvalidTokenNftSerialNumber;\n case 226:\n return Status.InvalidNftId;\n case 227:\n return Status.MetadataTooLong;\n case 228:\n return Status.BatchSizeLimitExceeded;\n case 229:\n return Status.InvalidQueryRange;\n case 230:\n return Status.FractionDividesByZero;\n case 231:\n return Status.InsufficientPayerBalanceForCustomFee;\n case 232:\n return Status.CustomFeesListTooLong;\n case 233:\n return Status.InvalidCustomFeeCollector;\n case 234:\n return Status.InvalidTokenIdInCustomFees;\n case 235:\n return Status.TokenNotAssociatedToFeeCollector;\n case 236:\n return Status.TokenMaxSupplyReached;\n case 237:\n return Status.SenderDoesNotOwnNftSerialNo;\n case 238:\n return Status.CustomFeeNotFullySpecified;\n case 239:\n return Status.CustomFeeMustBePositive;\n case 240:\n return Status.TokenHasNoFeeScheduleKey;\n case 241:\n return Status.CustomFeeOutsideNumericRange;\n case 242:\n return Status.RoyaltyFractionCannotExceedOne;\n case 243:\n return Status.FractionalFeeMaxAmountLessThanMinAmount;\n case 244:\n return Status.CustomScheduleAlreadyHasNoFees;\n case 245:\n return Status.CustomFeeDenominationMustBeFungibleCommon;\n case 246:\n return Status.CustomFractionalFeeOnlyAllowedForFungibleCommon;\n case 247:\n return Status.InvalidCustomFeeScheduleKey;\n case 248:\n return Status.InvalidTokenMintMetadata;\n case 249:\n return Status.InvalidTokenBurnMetadata;\n case 250:\n return Status.CurrentTreasuryStillOwnsNfts;\n case 251:\n return Status.AccountStillOwnsNfts;\n case 252:\n return Status.TreasuryMustOwnBurnedNft;\n case 253:\n return Status.AccountDoesNotOwnWipedNft;\n case 254:\n return Status.AccountAmountTransfersOnlyAllowedForFungibleCommon;\n case 255:\n return Status.MaxNftsInPriceRegimeHaveBeenMinted;\n case 256:\n return Status.PayerAccountDeleted;\n case 257:\n return Status.CustomFeeChargingExceededMaxRecursionDepth;\n case 258:\n return Status.CustomFeeChargingExceededMaxAccountAmounts;\n case 259:\n return Status.InsufficientSenderAccountBalanceForCustomFee;\n case 260:\n return Status.SerialNumberLimitReached;\n case 261:\n return Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique;\n case 262:\n return Status.NoRemainingAutomaticAssociations;\n case 263:\n return Status.ExistingAutomaticAssociationsExceedGivenLimit;\n case 264:\n return Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit;\n case 265:\n return Status.TokenIsPaused;\n case 266:\n return Status.TokenHasNoPauseKey;\n case 267:\n return Status.InvalidPauseKey;\n case 268:\n return Status.FreezeUpdateFileDoesNotExist;\n case 269:\n return Status.FreezeUpdateFileHashDoesNotMatch;\n case 270:\n return Status.NoUpgradeHasBeenPrepared;\n case 271:\n return Status.NoFreezeIsScheduled;\n case 272:\n return Status.UpdateFileHashChangedSincePrepareUpgrade;\n case 273:\n return Status.FreezeStartTimeMustBeFuture;\n case 274:\n return Status.PreparedUpdateFileIsImmutable;\n case 275:\n return Status.FreezeAlreadyScheduled;\n case 276:\n return Status.FreezeUpgradeInProgress;\n case 277:\n return Status.UpdateFileIdDoesNotMatchPrepared;\n case 278:\n return Status.UpdateFileHashDoesNotMatchPrepared;\n case 279:\n return Status.ConsensusGasExhausted;\n case 280:\n return Status.RevertedSuccess;\n case 281:\n return Status.MaxStorageInPriceRegimeHasBeenUsed;\n case 282:\n return Status.InvalidAliasKey;\n case 283:\n return Status.UnexpectedTokenDecimals;\n case 284:\n return Status.InvalidProxyAccountId;\n case 285:\n return Status.InvalidTransferAccountId;\n case 286:\n return Status.InvalidFeeCollectorAccountId;\n case 287:\n return Status.AliasIsImmutable;\n case 288:\n return Status.SpenderAccountSameAsOwner;\n case 289:\n return Status.AmountExceedsTokenMaxSupply;\n case 290:\n return Status.NegativeAllowanceAmount;\n case 291:\n return Status.CannotApproveForAllFungibleCommon;\n case 292:\n return Status.SpenderDoesNotHaveAllowance;\n case 293:\n return Status.AmountExceedsAllowance;\n case 294:\n return Status.MaxAllowancesExceeded;\n case 295:\n return Status.EmptyAllowances;\n case 296:\n return Status.SpenderAccountRepeatedInAllowances;\n case 297:\n return Status.RepeatedSerialNumsInNftAllowances;\n case 298:\n return Status.FungibleTokenInNftAllowances;\n case 299:\n return Status.NftInFungibleTokenAllowances;\n case 300:\n return Status.InvalidAllowanceOwnerId;\n case 301:\n return Status.InvalidAllowanceSpenderId;\n case 302:\n return Status.RepeatedAllowancesToDelete;\n case 303:\n return Status.InvalidDelegatingSpender;\n case 304:\n return Status.DelegatingSpenderCannotGrantApproveForAll;\n case 305:\n return Status.DelegatingSpenderDoesNotHaveApproveForAll;\n case 306:\n return Status.ScheduleExpirationTimeTooFarInFuture;\n case 307:\n return Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime;\n case 308:\n return Status.ScheduleFutureThrottleExceeded;\n case 309:\n return Status.ScheduleFutureGasLimitExceeded;\n case 310:\n return Status.InvalidEthereumTransaction;\n case 311:\n return Status.WrongChainId;\n case 312:\n return Status.WrongNonce;\n case 313:\n return Status.AccessListUnsupported;\n case 314:\n return Status.SchedulePendingExpiration;\n case 315:\n return Status.ContractIsTokenTreasury;\n case 316:\n return Status.ContractHasNonZeroTokenBalances;\n case 317:\n return Status.ContractExpiredAndPendingRemoval;\n case 318:\n return Status.ContractHasNoAutoRenewAccount;\n case 319:\n return Status.PermanentRemovalRequiresSystemInitiation;\n case 320:\n return Status.ProxyAccountIdFieldIsDeprecated;\n case 321:\n return Status.SelfStakingIsNotAllowed;\n case 322:\n return Status.InvalidStakingId;\n case 323:\n return Status.StakingNotEnabled;\n case 324:\n return Status.InvalidPrngRange;\n case 325:\n return Status.MaxEntitiesInPriceRegimeHaveBeenCreated;\n case 326:\n return Status.InvalidFullPrefixSignatureForPrecompile;\n case 327:\n return Status.InsufficientBalancesForStorageRent;\n case 328:\n return Status.MaxChildRecordsExceeded;\n case 329:\n return Status.InsufficientBalancesForRenewalFees;\n case 330:\n return Status.TransactionHasUnknownFields;\n case 331:\n return Status.AccountIsImmutable;\n case 332:\n return Status.AliasAlreadyAssigned;\n default:\n throw new Error(\n `(BUG) Status.fromCode() does not handle code: ${code}`\n );\n }\n }\n\n /**\n * @returns {HashgraphProto.proto.ResponseCodeEnum}\n */\n valueOf() {\n return this._code;\n }\n}\n\n/**\n * The transaction passed the precheck validations.\n */\nStatus.Ok = new Status(0);\n\n/**\n * For any error not handled by specific error codes listed below.\n */\nStatus.InvalidTransaction = new Status(1);\n\n/**\n * Payer account does not exist.\n */\nStatus.PayerAccountNotFound = new Status(2);\n\n/**\n * Node Account provided does not match the node account of the node the transaction was submitted\n * to.\n */\nStatus.InvalidNodeAccount = new Status(3);\n\n/**\n * Pre-Check error when TransactionValidStart + transactionValidDuration is less than current\n * consensus time.\n */\nStatus.TransactionExpired = new Status(4);\n\n/**\n * Transaction start time is greater than current consensus time\n */\nStatus.InvalidTransactionStart = new Status(5);\n\n/**\n * The given transactionValidDuration was either non-positive, or greater than the maximum\n * valid duration of 180 secs.\n *\n */\nStatus.InvalidTransactionDuration = new Status(6);\n\n/**\n * The transaction signature is not valid\n */\nStatus.InvalidSignature = new Status(7);\n\n/**\n * Transaction memo size exceeded 100 bytes\n */\nStatus.MemoTooLong = new Status(8);\n\n/**\n * The fee provided in the transaction is insufficient for this type of transaction\n */\nStatus.InsufficientTxFee = new Status(9);\n\n/**\n * The payer account has insufficient cryptocurrency to pay the transaction fee\n */\nStatus.InsufficientPayerBalance = new Status(10);\n\n/**\n * This transaction ID is a duplicate of one that was submitted to this node or reached consensus\n * in the last 180 seconds (receipt period)\n */\nStatus.DuplicateTransaction = new Status(11);\n\n/**\n * If API is throttled out\n */\nStatus.Busy = new Status(12);\n\n/**\n * The API is not currently supported\n */\nStatus.NotSupported = new Status(13);\n\n/**\n * The file id is invalid or does not exist\n */\nStatus.InvalidFileId = new Status(14);\n\n/**\n * The account id is invalid or does not exist\n */\nStatus.InvalidAccountId = new Status(15);\n\n/**\n * The contract id is invalid or does not exist\n */\nStatus.InvalidContractId = new Status(16);\n\n/**\n * Transaction id is not valid\n */\nStatus.InvalidTransactionId = new Status(17);\n\n/**\n * Receipt for given transaction id does not exist\n */\nStatus.ReceiptNotFound = new Status(18);\n\n/**\n * Record for given transaction id does not exist\n */\nStatus.RecordNotFound = new Status(19);\n\n/**\n * The solidity id is invalid or entity with this solidity id does not exist\n */\nStatus.InvalidSolidityId = new Status(20);\n\n/**\n * The responding node has submitted the transaction to the network. Its final status is still\n * unknown.\n */\nStatus.Unknown = new Status(21);\n\n/**\n * The transaction succeeded\n */\nStatus.Success = new Status(22);\n\n/**\n * There was a system error and the transaction failed because of invalid request parameters.\n */\nStatus.FailInvalid = new Status(23);\n\n/**\n * There was a system error while performing fee calculation, reserved for future.\n */\nStatus.FailFee = new Status(24);\n\n/**\n * There was a system error while performing balance checks, reserved for future.\n */\nStatus.FailBalance = new Status(25);\n\n/**\n * Key not provided in the transaction body\n */\nStatus.KeyRequired = new Status(26);\n\n/**\n * Unsupported algorithm/encoding used for keys in the transaction\n */\nStatus.BadEncoding = new Status(27);\n\n/**\n * When the account balance is not sufficient for the transfer\n */\nStatus.InsufficientAccountBalance = new Status(28);\n\n/**\n * During an update transaction when the system is not able to find the Users Solidity address\n */\nStatus.InvalidSolidityAddress = new Status(29);\n\n/**\n * Not enough gas was supplied to execute transaction\n */\nStatus.InsufficientGas = new Status(30);\n\n/**\n * contract byte code size is over the limit\n */\nStatus.ContractSizeLimitExceeded = new Status(31);\n\n/**\n * local execution (query) is requested for a function which changes state\n */\nStatus.LocalCallModificationException = new Status(32);\n\n/**\n * Contract REVERT OPCODE executed\n */\nStatus.ContractRevertExecuted = new Status(33);\n\n/**\n * For any contract execution related error not handled by specific error codes listed above.\n */\nStatus.ContractExecutionException = new Status(34);\n\n/**\n * In Query validation, account with +ve(amount) value should be Receiving node account, the\n * receiver account should be only one account in the list\n */\nStatus.InvalidReceivingNodeAccount = new Status(35);\n\n/**\n * Header is missing in Query request\n */\nStatus.MissingQueryHeader = new Status(36);\n\n/**\n * The update of the account failed\n */\nStatus.AccountUpdateFailed = new Status(37);\n\n/**\n * Provided key encoding was not supported by the system\n */\nStatus.InvalidKeyEncoding = new Status(38);\n\n/**\n * null solidity address\n */\nStatus.NullSolidityAddress = new Status(39);\n\n/**\n * update of the contract failed\n */\nStatus.ContractUpdateFailed = new Status(40);\n\n/**\n * the query header is invalid\n */\nStatus.InvalidQueryHeader = new Status(41);\n\n/**\n * Invalid fee submitted\n */\nStatus.InvalidFeeSubmitted = new Status(42);\n\n/**\n * Payer signature is invalid\n */\nStatus.InvalidPayerSignature = new Status(43);\n\n/**\n * The keys were not provided in the request.\n */\nStatus.KeyNotProvided = new Status(44);\n\n/**\n * Expiration time provided in the transaction was invalid.\n */\nStatus.InvalidExpirationTime = new Status(45);\n\n/**\n * WriteAccess Control Keys are not provided for the file\n */\nStatus.NoWaclKey = new Status(46);\n\n/**\n * The contents of file are provided as empty.\n */\nStatus.FileContentEmpty = new Status(47);\n\n/**\n * The crypto transfer credit and debit do not sum equal to 0\n */\nStatus.InvalidAccountAmounts = new Status(48);\n\n/**\n * Transaction body provided is empty\n */\nStatus.EmptyTransactionBody = new Status(49);\n\n/**\n * Invalid transaction body provided\n */\nStatus.InvalidTransactionBody = new Status(50);\n\n/**\n * the type of key (base ed25519 key, KeyList, or ThresholdKey) does not match the type of\n * signature (base ed25519 signature, SignatureList, or ThresholdKeySignature)\n */\nStatus.InvalidSignatureTypeMismatchingKey = new Status(51);\n\n/**\n * the number of key (KeyList, or ThresholdKey) does not match that of signature (SignatureList,\n * or ThresholdKeySignature). e.g. if a keyList has 3 base keys, then the corresponding\n * signatureList should also have 3 base signatures.\n */\nStatus.InvalidSignatureCountMismatchingKey = new Status(52);\n\n/**\n * the livehash body is empty\n */\nStatus.EmptyLiveHashBody = new Status(53);\n\n/**\n * the livehash data is missing\n */\nStatus.EmptyLiveHash = new Status(54);\n\n/**\n * the keys for a livehash are missing\n */\nStatus.EmptyLiveHashKeys = new Status(55);\n\n/**\n * the livehash data is not the output of a SHA-384 digest\n */\nStatus.InvalidLiveHashSize = new Status(56);\n\n/**\n * the query body is empty\n */\nStatus.EmptyQueryBody = new Status(57);\n\n/**\n * the crypto livehash query is empty\n */\nStatus.EmptyLiveHashQuery = new Status(58);\n\n/**\n * the livehash is not present\n */\nStatus.LiveHashNotFound = new Status(59);\n\n/**\n * the account id passed has not yet been created.\n */\nStatus.AccountIdDoesNotExist = new Status(60);\n\n/**\n * the livehash already exists for a given account\n */\nStatus.LiveHashAlreadyExists = new Status(61);\n\n/**\n * File WACL keys are invalid\n */\nStatus.InvalidFileWacl = new Status(62);\n\n/**\n * Serialization failure\n */\nStatus.SerializationFailed = new Status(63);\n\n/**\n * The size of the Transaction is greater than transactionMaxBytes\n */\nStatus.TransactionOversize = new Status(64);\n\n/**\n * The Transaction has more than 50 levels\n */\nStatus.TransactionTooManyLayers = new Status(65);\n\n/**\n * Contract is marked as deleted\n */\nStatus.ContractDeleted = new Status(66);\n\n/**\n * the platform node is either disconnected or lagging behind.\n */\nStatus.PlatformNotActive = new Status(67);\n\n/**\n * one public key matches more than one prefixes on the signature map\n */\nStatus.KeyPrefixMismatch = new Status(68);\n\n/**\n * transaction not created by platform due to large backlog\n */\nStatus.PlatformTransactionNotCreated = new Status(69);\n\n/**\n * auto renewal period is not a positive number of seconds\n */\nStatus.InvalidRenewalPeriod = new Status(70);\n\n/**\n * the response code when a smart contract id is passed for a crypto API request\n */\nStatus.InvalidPayerAccountId = new Status(71);\n\n/**\n * the account has been marked as deleted\n */\nStatus.AccountDeleted = new Status(72);\n\n/**\n * the file has been marked as deleted\n */\nStatus.FileDeleted = new Status(73);\n\n/**\n * same accounts repeated in the transfer account list\n */\nStatus.AccountRepeatedInAccountAmounts = new Status(74);\n\n/**\n * attempting to set negative balance value for crypto account\n */\nStatus.SettingNegativeAccountBalance = new Status(75);\n\n/**\n * when deleting smart contract that has crypto balance either transfer account or transfer smart\n * contract is required\n */\nStatus.ObtainerRequired = new Status(76);\n\n/**\n * when deleting smart contract that has crypto balance you can not use the same contract id as\n * transferContractId as the one being deleted\n */\nStatus.ObtainerSameContractId = new Status(77);\n\n/**\n * transferAccountId or transferContractId specified for contract delete does not exist\n */\nStatus.ObtainerDoesNotExist = new Status(78);\n\n/**\n * attempting to modify (update or delete a immutable smart contract, i.e. one created without a\n * admin key)\n */\nStatus.ModifyingImmutableContract = new Status(79);\n\n/**\n * Unexpected exception thrown by file system functions\n */\nStatus.FileSystemException = new Status(80);\n\n/**\n * the duration is not a subset of [MINIMUM_AUTORENEW_DURATION,MAXIMUM_AUTORENEW_DURATION]\n */\nStatus.AutorenewDurationNotInRange = new Status(81);\n\n/**\n * Decoding the smart contract binary to a byte array failed. Check that the input is a valid hex\n * string.\n */\nStatus.ErrorDecodingBytestring = new Status(82);\n\n/**\n * File to create a smart contract was of length zero\n */\nStatus.ContractFileEmpty = new Status(83);\n\n/**\n * Bytecode for smart contract is of length zero\n */\nStatus.ContractBytecodeEmpty = new Status(84);\n\n/**\n * Attempt to set negative initial balance\n */\nStatus.InvalidInitialBalance = new Status(85);\n\n/**\n * [Deprecated]. attempt to set negative receive record threshold\n */\nStatus.InvalidReceiveRecordThreshold = new Status(86);\n\n/**\n * [Deprecated]. attempt to set negative send record threshold\n */\nStatus.InvalidSendRecordThreshold = new Status(87);\n\n/**\n * Special Account Operations should be performed by only Genesis account, return this code if it\n * is not Genesis Account\n */\nStatus.AccountIsNotGenesisAccount = new Status(88);\n\n/**\n * The fee payer account doesn't have permission to submit such Transaction\n */\nStatus.PayerAccountUnauthorized = new Status(89);\n\n/**\n * FreezeTransactionBody is invalid\n */\nStatus.InvalidFreezeTransactionBody = new Status(90);\n\n/**\n * FreezeTransactionBody does not exist\n */\nStatus.FreezeTransactionBodyNotFound = new Status(91);\n\n/**\n * Exceeded the number of accounts (both from and to) allowed for crypto transfer list\n */\nStatus.TransferListSizeLimitExceeded = new Status(92);\n\n/**\n * Smart contract result size greater than specified maxResultSize\n */\nStatus.ResultSizeLimitExceeded = new Status(93);\n\n/**\n * The payer account is not a special account(account 0.0.55)\n */\nStatus.NotSpecialAccount = new Status(94);\n\n/**\n * Negative gas was offered in smart contract call\n */\nStatus.ContractNegativeGas = new Status(95);\n\n/**\n * Negative value / initial balance was specified in a smart contract call / create\n */\nStatus.ContractNegativeValue = new Status(96);\n\n/**\n * Failed to update fee file\n */\nStatus.InvalidFeeFile = new Status(97);\n\n/**\n * Failed to update exchange rate file\n */\nStatus.InvalidExchangeRateFile = new Status(98);\n\n/**\n * Payment tendered for contract local call cannot cover both the fee and the gas\n */\nStatus.InsufficientLocalCallGas = new Status(99);\n\n/**\n * Entities with Entity ID below 1000 are not allowed to be deleted\n */\nStatus.EntityNotAllowedToDelete = new Status(100);\n\n/**\n * Violating one of these rules: 1) treasury account can update all entities below 0.0.1000, 2)\n * account 0.0.50 can update all entities from 0.0.51 - 0.0.80, 3) Network Function Master Account\n * A/c 0.0.50 - Update all Network Function accounts & perform all the Network Functions listed\n * below, 4) Network Function Accounts: i) A/c 0.0.55 - Update Address Book files (0.0.101/102),\n * ii) A/c 0.0.56 - Update Fee schedule (0.0.111), iii) A/c 0.0.57 - Update Exchange Rate\n * (0.0.112).\n */\nStatus.AuthorizationFailed = new Status(101);\n\n/**\n * Fee Schedule Proto uploaded but not valid (append or update is required)\n */\nStatus.FileUploadedProtoInvalid = new Status(102);\n\n/**\n * Fee Schedule Proto uploaded but not valid (append or update is required)\n */\nStatus.FileUploadedProtoNotSavedToDisk = new Status(103);\n\n/**\n * Fee Schedule Proto File Part uploaded\n */\nStatus.FeeScheduleFilePartUploaded = new Status(104);\n\n/**\n * The change on Exchange Rate exceeds Exchange_Rate_Allowed_Percentage\n */\nStatus.ExchangeRateChangeLimitExceeded = new Status(105);\n\n/**\n * Contract permanent storage exceeded the currently allowable limit\n */\nStatus.MaxContractStorageExceeded = new Status(106);\n\n/**\n * Transfer Account should not be same as Account to be deleted\n */\nStatus.TransferAccountSameAsDeleteAccount = new Status(107);\n\nStatus.TotalLedgerBalanceInvalid = new Status(108);\n/**\n * The expiration date/time on a smart contract may not be reduced\n */\nStatus.ExpirationReductionNotAllowed = new Status(110);\n\n/**\n * Gas exceeded currently allowable gas limit per transaction\n */\nStatus.MaxGasLimitExceeded = new Status(111);\n\n/**\n * File size exceeded the currently allowable limit\n */\nStatus.MaxFileSizeExceeded = new Status(112);\n\n/**\n * When a valid signature is not provided for operations on account with receiverSigRequired=true\n */\nStatus.ReceiverSigRequired = new Status(113);\n\n/**\n * The Topic ID specified is not in the system.\n */\nStatus.InvalidTopicId = new Status(150);\n\n/**\n * A provided admin key was invalid.\n */\nStatus.InvalidAdminKey = new Status(155);\n\n/**\n * A provided submit key was invalid.\n */\nStatus.InvalidSubmitKey = new Status(156);\n\n/**\n * An attempted operation was not authorized (ie - a deleteTopic for a topic with no adminKey).\n */\nStatus.Unauthorized = new Status(157);\n\n/**\n * A ConsensusService message is empty.\n */\nStatus.InvalidTopicMessage = new Status(158);\n\n/**\n * The autoRenewAccount specified is not a valid, active account.\n */\nStatus.InvalidAutorenewAccount = new Status(159);\n\n/**\n * An adminKey was not specified on the topic, so there must not be an autoRenewAccount.\n */\nStatus.AutorenewAccountNotAllowed = new Status(160);\n\n/**\n * The topic has expired, was not automatically renewed, and is in a 7 day grace period before the\n * topic will be deleted unrecoverably. This error response code will not be returned until\n * autoRenew functionality is supported by HAPI.\n */\nStatus.TopicExpired = new Status(162);\n\n/**\n * chunk number must be from 1 to total (chunks) inclusive.\n */\nStatus.InvalidChunkNumber = new Status(163);\n\n/**\n * For every chunk, the payer account that is part of initialTransactionID must match the Payer Account of this transaction. The entire initialTransactionID should match the transactionID of the first chunk, but this is not checked or enforced by Hedera except when the chunk number is 1.\n */\nStatus.InvalidChunkTransactionId = new Status(164);\n\n/**\n * Account is frozen and cannot transact with the token\n */\nStatus.AccountFrozenForToken = new Status(165);\n\n/**\n * An involved account already has more than tokens.maxPerAccount associations with non-deleted tokens.\n */\nStatus.TokensPerAccountLimitExceeded = new Status(166);\n\n/**\n * The token is invalid or does not exist\n */\nStatus.InvalidTokenId = new Status(167);\n\n/**\n * Invalid token decimals\n */\nStatus.InvalidTokenDecimals = new Status(168);\n\n/**\n * Invalid token initial supply\n */\nStatus.InvalidTokenInitialSupply = new Status(169);\n\n/**\n * Treasury Account does not exist or is deleted\n */\nStatus.InvalidTreasuryAccountForToken = new Status(170);\n\n/**\n * Token Symbol is not UTF-8 capitalized alphabetical string\n */\nStatus.InvalidTokenSymbol = new Status(171);\n\n/**\n * Freeze key is not set on token\n */\nStatus.TokenHasNoFreezeKey = new Status(172);\n\n/**\n * Amounts in transfer list are not net zero\n */\nStatus.TransfersNotZeroSumForToken = new Status(173);\n\n/**\n * A token symbol was not provided\n */\nStatus.MissingTokenSymbol = new Status(174);\n\n/**\n * The provided token symbol was too long\n */\nStatus.TokenSymbolTooLong = new Status(175);\n\n/**\n * KYC must be granted and account does not have KYC granted\n */\nStatus.AccountKycNotGrantedForToken = new Status(176);\n\n/**\n * KYC key is not set on token\n */\nStatus.TokenHasNoKycKey = new Status(177);\n\n/**\n * Token balance is not sufficient for the transaction\n */\nStatus.InsufficientTokenBalance = new Status(178);\n\n/**\n * Token transactions cannot be executed on deleted token\n */\nStatus.TokenWasDeleted = new Status(179);\n\n/**\n * Supply key is not set on token\n */\nStatus.TokenHasNoSupplyKey = new Status(180);\n\n/**\n * Wipe key is not set on token\n */\nStatus.TokenHasNoWipeKey = new Status(181);\n\n/**\n * The requested token mint amount would cause an invalid total supply\n */\nStatus.InvalidTokenMintAmount = new Status(182);\n\n/**\n * The requested token burn amount would cause an invalid total supply\n */\nStatus.InvalidTokenBurnAmount = new Status(183);\n\n/**\n * A required token-account relationship is missing\n */\nStatus.TokenNotAssociatedToAccount = new Status(184);\n\n/**\n * The target of a wipe operation was the token treasury account\n */\nStatus.CannotWipeTokenTreasuryAccount = new Status(185);\n\n/**\n * The provided KYC key was invalid.\n */\nStatus.InvalidKycKey = new Status(186);\n\n/**\n * The provided wipe key was invalid.\n */\nStatus.InvalidWipeKey = new Status(187);\n\n/**\n * The provided freeze key was invalid.\n */\nStatus.InvalidFreezeKey = new Status(188);\n\n/**\n * The provided supply key was invalid.\n */\nStatus.InvalidSupplyKey = new Status(189);\n\n/**\n * Token Name is not provided\n */\nStatus.MissingTokenName = new Status(190);\n\n/**\n * Token Name is too long\n */\nStatus.TokenNameTooLong = new Status(191);\n\n/**\n * The provided wipe amount must not be negative, zero or bigger than the token holder balance\n */\nStatus.InvalidWipingAmount = new Status(192);\n\n/**\n * Token does not have Admin key set, thus update/delete transactions cannot be performed\n */\nStatus.TokenIsImmutable = new Status(193);\n\n/**\n * An associateToken operation specified a token already associated to the account\n */\nStatus.TokenAlreadyAssociatedToAccount = new Status(194);\n\n/**\n * An attempted operation is invalid until all token balances for the target account are zero\n */\nStatus.TransactionRequiresZeroTokenBalances = new Status(195);\n\n/**\n * An attempted operation is invalid because the account is a treasury\n */\nStatus.AccountIsTreasury = new Status(196);\n\n/**\n * Same TokenIDs present in the token list\n */\nStatus.TokenIdRepeatedInTokenList = new Status(197);\n\n/**\n * Exceeded the number of token transfers (both from and to) allowed for token transfer list\n */\nStatus.TokenTransferListSizeLimitExceeded = new Status(198);\n\n/**\n * TokenTransfersTransactionBody has no TokenTransferList\n */\nStatus.EmptyTokenTransferBody = new Status(199);\n\n/**\n * TokenTransfersTransactionBody has a TokenTransferList with no AccountAmounts\n */\nStatus.EmptyTokenTransferAccountAmounts = new Status(200);\n\n/**\n * The Scheduled entity does not exist; or has now expired, been deleted, or been executed\n */\nStatus.InvalidScheduleId = new Status(201);\n\n/**\n * The Scheduled entity cannot be modified. Admin key not set\n */\nStatus.ScheduleIsImmutable = new Status(202);\n\n/**\n * The provided Scheduled Payer does not exist\n */\nStatus.InvalidSchedulePayerId = new Status(203);\n\n/**\n * The Schedule Create Transaction TransactionID account does not exist\n */\nStatus.InvalidScheduleAccountId = new Status(204);\n\n/**\n * The provided sig map did not contain any new valid signatures from required signers of the scheduled transaction\n */\nStatus.NoNewValidSignatures = new Status(205);\n\n/**\n * The required signers for a scheduled transaction cannot be resolved, for example because they do not exist or have been deleted\n */\nStatus.UnresolvableRequiredSigners = new Status(206);\n\n/**\n * Only whitelisted transaction types may be scheduled\n */\nStatus.ScheduledTransactionNotInWhitelist = new Status(207);\n\n/**\n * At least one of the signatures in the provided sig map did not represent a valid signature for any required signer\n */\nStatus.SomeSignaturesWereInvalid = new Status(208);\n\n/**\n * The scheduled field in the TransactionID may not be set to true\n */\nStatus.TransactionIdFieldNotAllowed = new Status(209);\n\n/**\n * A schedule already exists with the same identifying fields of an attempted ScheduleCreate (that is, all fields other than scheduledPayerAccountID)\n */\nStatus.IdenticalScheduleAlreadyCreated = new Status(210);\n\n/**\n * A string field in the transaction has a UTF-8 encoding with the prohibited zero byte\n */\nStatus.InvalidZeroByteInString = new Status(211);\n\n/**\n * A schedule being signed or deleted has already been deleted\n */\nStatus.ScheduleAlreadyDeleted = new Status(212);\n\n/**\n * A schedule being signed or deleted has already been executed\n */\nStatus.ScheduleAlreadyExecuted = new Status(213);\n\n/**\n * ConsensusSubmitMessage request's message size is larger than allowed.\n */\nStatus.MessageSizeTooLarge = new Status(214);\n\n/**\n * An operation was assigned to more than one throttle group in a given bucket\n */\nStatus.OperationRepeatedInBucketGroups = new Status(215);\n\n/**\n * The capacity needed to satisfy all opsPerSec groups in a bucket overflowed a signed 8-byte integral type\n */\nStatus.BucketCapacityOverflow = new Status(216);\n\n/**\n * Given the network size in the address book, the node-level capacity for an operation would never be enough to accept a single request; usually means a bucket burstPeriod should be increased\n */\nStatus.NodeCapacityNotSufficientForOperation = new Status(217);\n\n/**\n * A bucket was defined without any throttle groups\n */\nStatus.BucketHasNoThrottleGroups = new Status(218);\n\n/**\n * A throttle group was granted zero opsPerSec\n */\nStatus.ThrottleGroupHasZeroOpsPerSec = new Status(219);\n\n/**\n * The throttle definitions file was updated, but some supported operations were not assigned a bucket\n */\nStatus.SuccessButMissingExpectedOperation = new Status(220);\n\n/**\n * The new contents for the throttle definitions system file were not valid protobuf\n */\nStatus.UnparseableThrottleDefinitions = new Status(221);\n\n/**\n * The new throttle definitions system file were invalid, and no more specific error could be divined\n */\nStatus.InvalidThrottleDefinitions = new Status(222);\n\n/**\n * The transaction references an account which has passed its expiration without renewal funds available, and currently remains in the ledger only because of the grace period given to expired entities\n */\nStatus.AccountExpiredAndPendingRemoval = new Status(223);\n\n/**\n * Invalid token max supply\n */\nStatus.InvalidTokenMaxSupply = new Status(224);\n\n/**\n * Invalid token nft serial number\n */\nStatus.InvalidTokenNftSerialNumber = new Status(225);\n\n/**\n * Invalid nft id\n */\nStatus.InvalidNftId = new Status(226);\n\n/**\n * Nft metadata is too long\n */\nStatus.MetadataTooLong = new Status(227);\n\n/**\n * Repeated operations count exceeds the limit\n */\nStatus.BatchSizeLimitExceeded = new Status(228);\n\n/**\n * The range of data to be gathered is out of the set boundaries\n */\nStatus.InvalidQueryRange = new Status(229);\n\n/**\n * A custom fractional fee set a denominator of zero\n */\nStatus.FractionDividesByZero = new Status(230);\n\n/**\n * The transaction payer could not afford a custom fee\n */\nStatus.InsufficientPayerBalanceForCustomFee = new Status(231);\n\n/**\n * More than 10 custom fees were specified\n */\nStatus.CustomFeesListTooLong = new Status(232);\n\n/**\n * Any of the feeCollector accounts for customFees is invalid\n */\nStatus.InvalidCustomFeeCollector = new Status(233);\n\n/**\n * Any of the token Ids in customFees is invalid\n */\nStatus.InvalidTokenIdInCustomFees = new Status(234);\n\n/**\n * Any of the token Ids in customFees are not associated to feeCollector\n */\nStatus.TokenNotAssociatedToFeeCollector = new Status(235);\n\n/**\n * A token cannot have more units minted due to its configured supply ceiling\n */\nStatus.TokenMaxSupplyReached = new Status(236);\n\n/**\n * The transaction attempted to move an NFT serial number from an account other than its owner\n */\nStatus.SenderDoesNotOwnNftSerialNo = new Status(237);\n\n/**\n * A custom fee schedule entry did not specify either a fixed or fractional fee\n */\nStatus.CustomFeeNotFullySpecified = new Status(238);\n\n/**\n * Only positive fees may be assessed at this time\n */\nStatus.CustomFeeMustBePositive = new Status(239);\n\n/**\n * Fee schedule key is not set on token\n */\nStatus.TokenHasNoFeeScheduleKey = new Status(240);\n\n/**\n * A fractional custom fee exceeded the range of a 64-bit signed integer\n */\nStatus.CustomFeeOutsideNumericRange = new Status(241);\n\n/**\n * A royalty cannot exceed the total fungible value exchanged for an NFT\n */\nStatus.RoyaltyFractionCannotExceedOne = new Status(242);\n\n/**\n * Each fractional custom fee must have its maximum_amount, if specified, at least its minimum_amount\n */\nStatus.FractionalFeeMaxAmountLessThanMinAmount = new Status(243);\n\n/**\n * A fee schedule update tried to clear the custom fees from a token whose fee schedule was already empty\n */\nStatus.CustomScheduleAlreadyHasNoFees = new Status(244);\n\n/**\n * Only tokens of type FUNGIBLE_COMMON can be used to as fee schedule denominations\n */\nStatus.CustomFeeDenominationMustBeFungibleCommon = new Status(245);\n\n/**\n * Only tokens of type FUNGIBLE_COMMON can have fractional fees\n */\nStatus.CustomFractionalFeeOnlyAllowedForFungibleCommon = new Status(246);\n\n/**\n * The provided custom fee schedule key was invalid\n */\nStatus.InvalidCustomFeeScheduleKey = new Status(247);\n\n/**\n * The requested token mint metadata was invalid\n */\nStatus.InvalidTokenMintMetadata = new Status(248);\n\n/**\n * The requested token burn metadata was invalid\n */\nStatus.InvalidTokenBurnMetadata = new Status(249);\n\n/**\n * The treasury for a unique token cannot be changed until it owns no NFTs\n */\nStatus.CurrentTreasuryStillOwnsNfts = new Status(250);\n\n/**\n * An account cannot be dissociated from a unique token if it owns NFTs for the token\n */\nStatus.AccountStillOwnsNfts = new Status(251);\n\n/**\n * A NFT can only be burned when owned by the unique token's treasury\n */\nStatus.TreasuryMustOwnBurnedNft = new Status(252);\n\n/**\n * An account did not own the NFT to be wiped\n */\nStatus.AccountDoesNotOwnWipedNft = new Status(253);\n\n/**\n * An AccountAmount token transfers list referenced a token type other than FUNGIBLE_COMMON\n */\nStatus.AccountAmountTransfersOnlyAllowedForFungibleCommon = new Status(254);\n\n/**\n * All the NFTs allowed in the current price regime have already been minted\n */\nStatus.MaxNftsInPriceRegimeHaveBeenMinted = new Status(255);\n\n/**\n * The payer account has been marked as deleted\n */\nStatus.PayerAccountDeleted = new Status(256);\n\n/**\n * The reference chain of custom fees for a transferred token exceeded the maximum length of 2\n */\nStatus.CustomFeeChargingExceededMaxRecursionDepth = new Status(257);\n\n/**\n * More than 20 balance adjustments were to satisfy a CryptoTransfer and its implied custom fee payments\n */\nStatus.CustomFeeChargingExceededMaxAccountAmounts = new Status(258);\n\n/**\n * The sender account in the token transfer transaction could not afford a custom fee\n */\nStatus.InsufficientSenderAccountBalanceForCustomFee = new Status(259);\n\n/**\n * Currently no more than 4,294,967,295 NFTs may be minted for a given unique token type\n */\nStatus.SerialNumberLimitReached = new Status(260);\n\n/**\n * Only tokens of type NON_FUNGIBLE_UNIQUE can have royalty fees\n */\nStatus.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique = new Status(261);\n\n/**\n * The account has reached the limit on the automatic associations count.\n */\nStatus.NoRemainingAutomaticAssociations = new Status(262);\n\n/**\n * Already existing automatic associations are more than the new maximum automatic associations.\n */\nStatus.ExistingAutomaticAssociationsExceedGivenLimit = new Status(263);\n\n/**\n * Cannot set the number of automatic associations for an account more than the maximum allowed\n * token associations tokens.maxPerAccount.\n */\nStatus.RequestedNumAutomaticAssociationsExceedsAssociationLimit = new Status(\n 264\n);\n\n/**\n * Token is paused. This Token cannot be a part of any kind of Transaction until unpaused.\n */\nStatus.TokenIsPaused = new Status(265);\n\n/**\n * Pause key is not set on token\n */\nStatus.TokenHasNoPauseKey = new Status(266);\n\n/**\n * The provided pause key was invalid\n */\nStatus.InvalidPauseKey = new Status(267);\n\n/**\n * The update file in a freeze transaction body must exist.\n */\nStatus.FreezeUpdateFileDoesNotExist = new Status(268);\n\n/**\n * The hash of the update file in a freeze transaction body must match the in-memory hash.\n */\nStatus.FreezeUpdateFileHashDoesNotMatch = new Status(269);\n\n/**\n * A FREEZE_UPGRADE transaction was handled with no previous update prepared.\n */\nStatus.NoUpgradeHasBeenPrepared = new Status(270);\n\n/**\n * A FREEZE_ABORT transaction was handled with no scheduled freeze.\n */\nStatus.NoFreezeIsScheduled = new Status(271);\n\n/**\n * The update file hash when handling a FREEZE_UPGRADE transaction differs from the file\n * hash at the time of handling the PREPARE_UPGRADE transaction.\n */\nStatus.UpdateFileHashChangedSincePrepareUpgrade = new Status(272);\n\n/**\n * The given freeze start time was in the (consensus) past.\n */\nStatus.FreezeStartTimeMustBeFuture = new Status(273);\n\n/**\n * The prepared update file cannot be updated or appended until either the upgrade has\n * been completed, or a FREEZE_ABORT has been handled.\n */\nStatus.PreparedUpdateFileIsImmutable = new Status(274);\n\n/**\n * Once a freeze is scheduled, it must be aborted before any other type of freeze can\n * can be performed.\n */\nStatus.FreezeAlreadyScheduled = new Status(275);\n\n/**\n * If an NMT upgrade has been prepared, the following operation must be a FREEZE_UPGRADE.\n * (To issue a FREEZE_ONLY, submit a FREEZE_ABORT first.)\n */\nStatus.FreezeUpgradeInProgress = new Status(276);\n\n/**\n * If an NMT upgrade has been prepared, the subsequent FREEZE_UPGRADE transaction must\n * confirm the id of the file to be used in the upgrade.\n */\nStatus.UpdateFileIdDoesNotMatchPrepared = new Status(277);\n\n/**\n * If an NMT upgrade has been prepared, the subsequent FREEZE_UPGRADE transaction must\n * confirm the hash of the file to be used in the upgrade.\n */\nStatus.UpdateFileHashDoesNotMatchPrepared = new Status(278);\n\n/**\n * Consensus throttle did not allow execution of this transaction. System is throttled at\n * consensus level.\n */\nStatus.ConsensusGasExhausted = new Status(279);\n\n/**\n * A precompiled contract succeeded, but was later reverted.\n */\nStatus.RevertedSuccess = new Status(280);\n\n/**\n * All contract storage allocated to the current price regime has been consumed.\n */\nStatus.MaxStorageInPriceRegimeHasBeenUsed = new Status(281);\n\n/**\n * An alias used in a CryptoTransfer transaction is not the serialization of a primitive Key\n * message--that is, a Key with a single Ed25519 or ECDSA(secp256k1) public key and no\n * unknown protobuf fields.\n */\nStatus.InvalidAliasKey = new Status(282);\n\n/**\n * A fungible token transfer expected a different number of decimals than the involved\n * type actually has.\n */\nStatus.UnexpectedTokenDecimals = new Status(283);\n\n/**\n * The proxy account id is invalid or does not exist.\n */\nStatus.InvalidProxyAccountId = new Status(284);\n\n/**\n * The transfer account id in CryptoDelete transaction is invalid or does not exist.\n */\nStatus.InvalidTransferAccountId = new Status(285);\n\n/**\n * The fee collector account id in TokenFeeScheduleUpdate is invalid or does not exist.\n */\nStatus.InvalidFeeCollectorAccountId = new Status(286);\n\n/**\n * The alias already set on an account cannot be updated using CryptoUpdate transaction.\n */\nStatus.AliasIsImmutable = new Status(287);\n\n/**\n * An approved allowance specifies a spender account that is the same as the hbar/token\n * owner account.\n */\nStatus.SpenderAccountSameAsOwner = new Status(288);\n\n/**\n * The establishment or adjustment of an approved allowance cause the token allowance\n * to exceed the token maximum supply.\n */\nStatus.AmountExceedsTokenMaxSupply = new Status(289);\n\n/**\n * The specified amount for an approved allowance cannot be negative.\n */\nStatus.NegativeAllowanceAmount = new Status(290);\n\n/**\n * The approveForAll flag cannot be set for a fungible token.\n */\nStatus.CannotApproveForAllFungibleCommon = new Status(291);\n\n/**\n * The spender does not have an existing approved allowance with the hbar/token owner.\n */\nStatus.SpenderDoesNotHaveAllowance = new Status(292);\n\n/**\n * The transfer amount exceeds the current approved allowance for the spender account.\n */\nStatus.AmountExceedsAllowance = new Status(293);\n\n/**\n * The payer account of an approveAllowances or adjustAllowance transaction is attempting\n * to go beyond the maximum allowed number of allowances.\n */\nStatus.MaxAllowancesExceeded = new Status(294);\n\n/**\n * No allowances have been specified in the approval/adjust transaction.\n */\nStatus.EmptyAllowances = new Status(295);\n\n/**\n * Spender is repeated more than once in Crypto or Token or NFT allowance lists in a single\n * CryptoApproveAllowance or CryptoAdjustAllowance transaction.\n */\nStatus.SpenderAccountRepeatedInAllowances = new Status(296);\n\n/**\n * Serial numbers are repeated in nft allowance for a single spender account\n */\nStatus.RepeatedSerialNumsInNftAllowances = new Status(297);\n\n/**\n * Fungible common token used in NFT allowances\n */\nStatus.FungibleTokenInNftAllowances = new Status(298);\n\n/**\n * Non fungible token used in fungible token allowances\n */\nStatus.NftInFungibleTokenAllowances = new Status(299);\n\n/**\n * The account id specified as the owner is invalid or does not exist.\n */\nStatus.InvalidAllowanceOwnerId = new Status(300);\n\n/**\n * The account id specified as the spender is invalid or does not exist.\n */\nStatus.InvalidAllowanceSpenderId = new Status(301);\n\n/**\n * If the CryptoDeleteAllowance transaction has repeated crypto or token or Nft allowances to delete.\n */\nStatus.RepeatedAllowancesToDelete = new Status(302);\n\n/**\n * If the account Id specified as the delegating spender is invalid or does not exist.\n */\nStatus.InvalidDelegatingSpender = new Status(303);\n\n/**\n * The delegating Spender cannot grant approveForAll allowance on a NFT token type for another spender.\n */\nStatus.DelegatingSpenderCannotGrantApproveForAll = new Status(304);\n\n/**\n * The delegating Spender cannot grant allowance on a NFT serial for another spender as it doesnt not have approveForAll\n * granted on token-owner.\n */\nStatus.DelegatingSpenderDoesNotHaveApproveForAll = new Status(305);\n\n/**\n * The scheduled transaction could not be created because it's expiration_time was too far in the future.\n */\nStatus.ScheduleExpirationTimeTooFarInFuture = new Status(306);\n\n/**\n * The scheduled transaction could not be created because it's expiration_time was less than or equal to the consensus time.\n */\nStatus.ScheduleExpirationTimeMustBeHigherThanConsensusTime = new Status(307);\n\n/**\n * The scheduled transaction could not be created because it would cause throttles to be violated on the specified expiration_time.\n */\nStatus.ScheduleFutureThrottleExceeded = new Status(308);\n\n/**\n * The scheduled transaction could not be created because it would cause the gas limit to be violated on the specified expiration_time.\n */\nStatus.ScheduleFutureGasLimitExceeded = new Status(309);\n\n/**\n * The ethereum transaction either failed parsing or failed signature validation, or some other EthereumTransaction error not covered by another response code.\n */\nStatus.InvalidEthereumTransaction = new Status(310);\n\n/**\n * EthereumTransaction was signed against a chainId that this network does not support.\n */\nStatus.WrongChainId = new Status(311);\n\n/**\n * This transaction specified an ethereumNonce that is not the current ethereumNonce of the account.\n */\nStatus.WrongNonce = new Status(312);\n\n/**\n * The ethereum transaction specified an access list, which the network does not support.\n */\nStatus.AccessListUnsupported = new Status(313);\n\n/**\n * The scheduled transaction is pending expiration.\n */\nStatus.SchedulePendingExpiration = new Status(314);\n\n/**\n * A selfdestruct or ContractDelete targeted a contract that is a token treasury.\n */\nStatus.ContractIsTokenTreasury = new Status(315);\n\n/**\n * A selfdestruct or ContractDelete targeted a contract with non-zero token balances.\n */\nStatus.ContractHasNonZeroTokenBalances = new Status(316);\n\n/**\n * A contract referenced by a transaction is \"detached\"; that is, expired and lacking any\n * hbar funds for auto-renewal payment---but still within its post-expiry grace period.\n */\nStatus.ContractExpiredAndPendingRemoval = new Status(317);\n\n/**\n * A ContractUpdate requested removal of a contract's auto-renew account, but that contract has\n * no auto-renew account.\n */\nStatus.ContractHasNoAutoRenewAccount = new Status(318);\n\n/**\n * A delete transaction submitted via HAPI set permanent_removal=true\n */\nStatus.PermanentRemovalRequiresSystemInitiation = new Status(319);\n\n/*\n * A CryptoCreate or ContractCreate used the deprecated proxyAccountID field.\n */\nStatus.ProxyAccountIdFieldIsDeprecated = new Status(320);\n\n/**\n * An account set the staked_account_id to itself in CryptoUpdate or ContractUpdate transactions.\n */\nStatus.SelfStakingIsNotAllowed = new Status(321);\n\n/**\n * The staking account id or staking node id given is invalid or does not exist.\n */\nStatus.InvalidStakingId = new Status(322);\n\n/**\n * Native staking, while implemented, has not yet enabled by the council.\n */\nStatus.StakingNotEnabled = new Status(323);\n\n/**\n * The range provided in PRNG transaction is negative.\n */\nStatus.InvalidPrngRange = new Status(324);\n\n/**\n * The maximum number of entities allowed in the current price regime have been created.\n */\nStatus.MaxEntitiesInPriceRegimeHaveBeenCreated = new Status(325);\n\n/**\n * The full prefix signature for precompile is not valid\n */\nStatus.InvalidFullPrefixSignatureForPrecompile = new Status(326);\n\n/**\n * The combined balances of a contract and its auto-renew account (if any) did not cover\n * the rent charged for net new storage used in a transaction.\n */\nStatus.InsufficientBalancesForStorageRent = new Status(327);\n\n/**\n * A contract transaction tried to use more than the allowed number of child records, via\n * either system contract records or internal contract creations.\n */\nStatus.MaxChildRecordsExceeded = new Status(328);\n\n/**\n * The combined balances of a contract and its auto-renew account (if any) or balance of an account did not cover\n * the auto-renewal fees in a transaction.\n */\nStatus.InsufficientBalancesForRenewalFees = new Status(329);\n\n/**\n * A transaction's protobuf message includes unknown fields; could mean that a client\n * expects not-yet-released functionality to be available.\n */\nStatus.TransactionHasUnknownFields = new Status(330);\n\n/**\n * The account cannot be modified. Account's key is not set\n */\nStatus.AccountIsImmutable = new Status(331);\n\n/**\n * An alias that is assigned to an account or contract cannot be assigned to another account or contract.\n */\nStatus.AliasAlreadyAssigned = new Status(332);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Status.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/StatusError.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/StatusError.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ StatusError; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @typedef {import(\"./Status.js\").default} Status\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * @typedef {object} StatusErrorJSON\n * @property {string} name\n * @property {string} status\n * @property {string} transactionId\n * @property {string} message\n */\n\nclass StatusError extends Error {\n /**\n * @param {object} props\n * @param {Status} props.status\n * @param {TransactionId} props.transactionId\n * @param {string} message\n */\n constructor(props, message) {\n super(message);\n\n this.name = \"StatusError\";\n\n this.status = props.status;\n\n this.transactionId = props.transactionId;\n\n this.message = message;\n\n if (typeof Error.captureStackTrace !== \"undefined\") {\n Error.captureStackTrace(this, StatusError);\n }\n }\n\n /**\n * @returns {StatusErrorJSON}\n */\n toJSON() {\n return {\n name: this.name,\n status: this.status.toString(),\n transactionId: this.transactionId.toString(),\n message: this.message,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {StatusErrorJSON}\n */\n valueOf() {\n return this.toJSON();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/StatusError.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/Timestamp.js": -/*!******************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Timestamp.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +// eslint-disable-next-line @typescript-eslint/no-unused-vars -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Timestamp; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITimestamp} HashgraphProto.proto.ITimestamp\n */\n\nconst MAX_NS = long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(1000000000);\n\nclass Timestamp {\n /**\n * @param {Long | number} seconds\n * @param {Long | number} nanos\n */\n constructor(seconds, nanos) {\n /**\n * @readonly\n * @type {Long}\n */\n this.seconds =\n seconds instanceof long__WEBPACK_IMPORTED_MODULE_0__ ? seconds : long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(seconds);\n\n /**\n * @readonly\n * @type {Long}\n */\n this.nanos = nanos instanceof long__WEBPACK_IMPORTED_MODULE_0__ ? nanos : long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(nanos);\n\n Object.freeze(this);\n }\n\n /**\n * @returns {Timestamp}\n */\n static generate() {\n const jitter = Math.floor(Math.random() * 5000) + 8000;\n const now = Date.now() - jitter;\n const seconds = Math.floor(now / 1000) + _Cache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].timeDrift;\n const nanos =\n Math.floor(now % 1000) * 1000000 +\n Math.floor(Math.random() * 1000000);\n\n return new Timestamp(seconds, nanos);\n }\n\n /**\n * @param {string | number | Date} date\n * @returns {Timestamp}\n */\n static fromDate(date) {\n let nanos;\n\n if (typeof date === \"number\") {\n nanos = long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(date);\n } else if (typeof date === \"string\") {\n nanos = long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(Date.parse(date)).mul(1000000);\n } else if (date instanceof Date) {\n nanos = long__WEBPACK_IMPORTED_MODULE_0__.fromNumber(date.getTime()).mul(1000000);\n } else {\n throw new TypeError(\n `invalid type '${typeof date}' for 'data', expected 'Date'`\n );\n }\n\n return new Timestamp(0, 0).plusNanos(nanos);\n }\n\n /**\n * @returns {Date}\n */\n toDate() {\n return new Date(\n this.seconds.toInt() * 1000 +\n Math.floor(this.nanos.toInt() / 1000000)\n );\n }\n\n /**\n * @param {Long | number} nanos\n * @returns {Timestamp}\n */\n plusNanos(nanos) {\n const ns = this.nanos.add(nanos);\n\n return new Timestamp(this.seconds.add(ns.div(MAX_NS)), ns.mod(MAX_NS));\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ITimestamp}\n */\n _toProtobuf() {\n return {\n seconds: this.seconds,\n nanos: this.nanos.toInt(),\n };\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITimestamp} timestamp\n * @returns {Timestamp}\n */\n static _fromProtobuf(timestamp) {\n return new Timestamp(\n timestamp.seconds instanceof long__WEBPACK_IMPORTED_MODULE_0__\n ? timestamp.seconds.toInt()\n : timestamp.seconds != null\n ? timestamp.seconds\n : 0,\n\n timestamp.nanos != null ? timestamp.nanos : 0\n );\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.seconds.toString()}.${this.nanos.toString()}`;\n }\n\n /**\n * @param {Timestamp} other\n * @returns {number}\n */\n compare(other) {\n const comparison = this.seconds.compare(other.seconds);\n\n if (comparison != 0) {\n return comparison;\n }\n\n return this.nanos.compare(other.nanos);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Timestamp.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/TransactionFeeSchedule.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/TransactionFeeSchedule.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.ITokenNftInfo} HashgraphProto.proto.ITokenNftInfo + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.ITokenGetNftInfoQuery} HashgraphProto.proto.ITokenGetNftInfoQuery + * @typedef {import("@hashgraph/proto").proto.ITokenGetNftInfosQuery} HashgraphProto.proto.ITokenGetNftInfosQuery + * @typedef {import("@hashgraph/proto").proto.ITokenGetAccountNftInfosQuery} HashgraphProto.proto.ITokenGetAccountNftInfosQuery + * @typedef {import("@hashgraph/proto").proto.ITokenGetNftInfoResponse} HashgraphProto.proto.ITokenGetNftInfoResponse + * @typedef {import("@hashgraph/proto").proto.ITokenGetNftInfosResponse} HashgraphProto.proto.ITokenGetNftInfosResponse + * @typedef {import("@hashgraph/proto").proto.ITokenGetAccountNftInfosResponse} HashgraphProto.proto.ITokenGetAccountNftInfosResponse + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionFeeSchedule; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _RequestType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RequestType.js */ \"./node_modules/@hashgraph/sdk/src/RequestType.js\");\n/* harmony import */ var _FeeData_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FeeData.js */ \"./node_modules/@hashgraph/sdk/src/FeeData.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\nclass TransactionFeeSchedule {\n /**\n * @param {object} [props]\n * @param {RequestType} [props.hederaFunctionality]\n * @param {FeeData} [props.feeData]\n * @param {FeeData[]} [props.fees]\n */\n constructor(props = {}) {\n /*\n * A particular transaction or query\n *\n * @type {RequestType}\n */\n this.hederaFunctionality = props.hederaFunctionality;\n\n /*\n * Resource price coefficients\n *\n * @type {FeeData}\n */\n this.feeData = props.feeData;\n\n /*\n * Resource price coefficients\n *\n * @type {FeeData[]}\n */\n this.fees = props.fees;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TransactionFeeSchedule}\n */\n static fromBytes(bytes) {\n return TransactionFeeSchedule._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.TransactionFeeSchedule.decode(bytes)\n );\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransactionFeeSchedule} transactionFeeSchedule\n * @returns {TransactionFeeSchedule}\n */\n static _fromProtobuf(transactionFeeSchedule) {\n return new TransactionFeeSchedule({\n hederaFunctionality:\n transactionFeeSchedule.hederaFunctionality != null\n ? _RequestType_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromCode(\n transactionFeeSchedule.hederaFunctionality\n )\n : undefined,\n feeData:\n transactionFeeSchedule.feeData != null\n ? _FeeData_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(transactionFeeSchedule.feeData)\n : undefined,\n fees:\n transactionFeeSchedule.fees != null\n ? transactionFeeSchedule.fees.map((fee) =>\n _FeeData_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(fee)\n )\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ITransactionFeeSchedule}\n */\n _toProtobuf() {\n return {\n hederaFunctionality:\n this.hederaFunctionality != null\n ? this.hederaFunctionality.valueOf()\n : undefined,\n feeData:\n this.feeData != null ? this.feeData._toProtobuf() : undefined,\n fees:\n this.fees != null\n ? this.fees.map((fee) => fee._toProtobuf())\n : undefined,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.TransactionFeeSchedule.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/TransactionFeeSchedule.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + */ -/***/ }), +/** + * @augments {Query} + */ +class TokenNftInfoQuery extends Query_Query { + /** + * @param {object} properties + * @param {NftId | string} [properties.nftId] + * @param {AccountId | string} [properties.accountId] + * @param {TokenId | string} [properties.tokenId] + * @param {Long | number} [properties.start] + * @param {Long | number} [properties.end] + */ + constructor(properties = {}) { + super(); + + /** + * @private + * @type {?NftId} + */ + this._nftId = null; + if (properties.nftId != null) { + this.setNftId(properties.nftId); + } + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + if (properties.accountId != null) { + // eslint-disable-next-line deprecation/deprecation + this.setAccountId(properties.accountId); + } + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + if (properties.tokenId != null) { + // eslint-disable-next-line deprecation/deprecation + this.setTokenId(properties.tokenId); + } + + /** + * @private + * @type {?Long} + */ + this._start = null; + if (properties.start != null) { + // eslint-disable-next-line deprecation/deprecation + this.setStart(properties.start); + } + + /** + * @private + * @type {?Long} + */ + this._end = null; + if (properties.end != null) { + // eslint-disable-next-line deprecation/deprecation + this.setEnd(properties.end); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {TokenNftInfoQuery} + */ + static _fromProtobuf(query) { + if (query.tokenGetNftInfo != null) { + const info = + /** @type {HashgraphProto.proto.ITokenGetNftInfoQuery} */ ( + query.tokenGetNftInfo + ); + + return new TokenNftInfoQuery({ + nftId: + info.nftID != null + ? NftId_NftId._fromProtobuf(info.nftID) + : undefined, + }); + } else if (query.tokenGetAccountNftInfos != null) { + const info = + /** @type {HashgraphProto.proto.ITokenGetAccountNftInfosQuery} */ ( + query.tokenGetAccountNftInfos + ); + + return new TokenNftInfoQuery({ + accountId: + info.accountID != null + ? AccountId_AccountId._fromProtobuf(info.accountID) + : undefined, + start: info.start != null ? info.start : undefined, + end: info.end != null ? info.end : undefined, + }); + } else { + const info = + /** @type {HashgraphProto.proto.ITokenGetNftInfosQuery} */ ( + query.tokenGetNftInfos + ); + + return new TokenNftInfoQuery({ + tokenId: + info.tokenID != null + ? TokenId_TokenId._fromProtobuf(info.tokenID) + : undefined, + start: info.start != null ? info.start : undefined, + end: info.end != null ? info.end : undefined, + }); + } + } + + /** + * @returns {?NftId} + */ + get nftId() { + return this._nftId; + } + + /** + * Set the token ID for which the info is being requested. + * + * @param {NftId | string} nftId + * @returns {TokenNftInfoQuery} + */ + setNftId(nftId) { + this._nftId = + typeof nftId === "string" + ? NftId_NftId.fromString(nftId) + : NftId_NftId._fromProtobuf(nftId._toProtobuf()); + + return this; + } + + /** + * @deprecated with no replacement + * @returns {?AccountId} + */ + get accountId() { + console.warn( + "`TokenNftInfoQuery.accountId` is deprecated with no replacement", + ); + return this._accountId; + } + + /** + * @deprecated with no replacement + * Set the token ID for which the info is being requested. + * @param {AccountId | string} accountId + * @returns {TokenNftInfoQuery} + */ + setAccountId(accountId) { + console.warn( + "`TokenNftInfoQuery.setAccountId()` is deprecated with no replacement", + ); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : AccountId_AccountId._fromProtobuf(accountId._toProtobuf()); + + return this; + } + + /** + * @deprecated with no replacement + * @returns {?TokenId} + */ + get tokenId() { + console.warn( + "`TokenNftInfoQuery.tokenId` is deprecated with no replacement", + ); + return this._tokenId; + } + + /** + * @deprecated with no replacement + * Set the token ID for which the info is being requested. + * @param {TokenId | string} tokenId + * @returns {TokenNftInfoQuery} + */ + setTokenId(tokenId) { + console.warn( + "`TokenNftInfoQuery.setTokenId()` is deprecated with no replacement", + ); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : TokenId_TokenId._fromProtobuf(tokenId._toProtobuf()); + + return this; + } + + /** + * @deprecated with no replacement + * @returns {?Long} + */ + get start() { + console.warn( + "`TokenNftInfoQuery.start` is deprecated with no replacement", + ); + return this._start; + } + + /** + * @deprecated with no replacement + * Set the token ID for which the info is being requested. + * @param {Long | number} start + * @returns {TokenNftInfoQuery} + */ + setStart(start) { + console.warn( + "`TokenNftInfoQuery.setStart()` is deprecated with no replacement", + ); + this._start = + typeof start === "number" ? src_long.fromNumber(start) : start; + + return this; + } + + /** + * @deprecated with no replacement + * @returns {?Long} + */ + get end() { + console.warn( + "`TokenNftInfoQuery.end` is deprecated with no replacement", + ); + return this._end; + } + + /** + * @deprecated with no replacement + * Set the token ID for which the info is being requested. + * @param {Long | number} end + * @returns {TokenNftInfoQuery} + */ + setEnd(end) { + console.warn( + "`TokenNftInfoQuery.setEnd()` is deprecated with no replacement", + ); + this._end = typeof end === "number" ? src_long.fromNumber(end) : end; + + return this; + } + + /** + * @override + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + return super.getCost(client); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.getTokenNftInfo(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const infos = + /** @type {HashgraphProto.proto.ITokenGetNftInfoResponse} */ ( + response.tokenGetNftInfo + ); + + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + infos.header + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const nfts = [ + /** @type {HashgraphProto.proto.ITokenNftInfo} */ + ( + /** @type {HashgraphProto.proto.ITokenGetNftInfoResponse} */ ( + response.tokenGetNftInfo + ).nft + ), + ]; + + return Promise.resolve( + nfts.map((nft) => + TokenNftInfo._fromProtobuf( + /** @type {HashgraphProto.proto.ITokenNftInfo} */ (nft), + ), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + tokenGetNftInfo: { + header, + nftID: this._nftId != null ? this._nftId._toProtobuf() : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `TokenNftInfoQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("tokenGetNftInfo", TokenNftInfoQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenPauseTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/Transfer.js": -/*!*****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Transfer.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Transfer; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * An account, and the amount that it sends or receives during a cryptocurrency transfer.\n */\nclass Transfer {\n /**\n * @internal\n * @param {object} props\n * @param {AccountId | string} props.accountId\n * @param {number | string | Long | BigNumber | Hbar} props.amount\n * @param {boolean} props.isApproved\n */\n constructor(props) {\n /**\n * The Account ID that sends or receives cryptocurrency.\n *\n * @readonly\n */\n this.accountId =\n props.accountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? props.accountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(props.accountId);\n\n /**\n * The amount of tinybars that the account sends(negative) or receives(positive).\n */\n this.amount =\n props.amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? props.amount\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](props.amount);\n\n this.isApproved = props.isApproved;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IAccountAmount[]} accountAmounts\n * @returns {Transfer[]}\n */\n static _fromProtobuf(accountAmounts) {\n const transfers = [];\n\n for (const transfer of accountAmounts) {\n transfers.push(\n new Transfer({\n accountId: _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n transfer.accountID\n )\n ),\n amount: _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(\n transfer.amount != null ? transfer.amount : 0\n ),\n isApproved: /** @type {boolean} */ (transfer.isApproval),\n })\n );\n }\n\n return transfers;\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IAccountAmount}\n */\n _toProtobuf() {\n return {\n accountID: this.accountId._toProtobuf(),\n amount: this.amount.toTinybars(),\n isApproval: this.isApproved,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Transfer.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/Wallet.js": -/*!***************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/Wallet.js ***! - \***************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenPauseTransactionBody} HashgraphProto.proto.ITokenPauseTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Wallet; }\n/* harmony export */ });\n/* harmony import */ var _PrivateKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PrivateKey.js */ \"./node_modules/@hashgraph/sdk/src/PrivateKey.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _SignerSignature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SignerSignature.js */ \"./node_modules/@hashgraph/sdk/src/SignerSignature.js\");\n/* harmony import */ var _account_AccountBalanceQuery_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./account/AccountBalanceQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountBalanceQuery.js\");\n/* harmony import */ var _account_AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./account/AccountInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountInfoQuery.js\");\n/* harmony import */ var _account_AccountRecordsQuery_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./account/AccountRecordsQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountRecordsQuery.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n/**\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n * @typedef {import(\"./Executable.js\").default} Executable\n */\n\n/**\n * @typedef {import(\"./Signer.js\").Signer} Signer\n * @typedef {import(\"./Provider.js\").Provider} Provider\n * @typedef {import(\"./LedgerId.js\").default} LedgerId\n * @typedef {import(\"./Key.js\").default} Key\n * @typedef {import(\"./transaction/Transaction.js\").default} Transaction\n * @typedef {import(\"./transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"./transaction/TransactionReceipt.js\").default} TransactionReceipt\n * @typedef {import(\"./transaction/TransactionRecord.js\").default} TransactionRecord\n * @typedef {import(\"./account/AccountBalance.js\").default} AccountBalance\n * @typedef {import(\"./account/AccountInfo.js\").default} AccountInfo\n */\n\n/**\n * @template {any} O\n * @typedef {import(\"./query/Query.js\").default} Query\n */\n\n/**\n * @implements {Signer}\n */\nclass Wallet {\n /**\n * @param {AccountId | string} accountId\n * @param {PrivateKey | string} privateKey\n * @param {Provider=} provider\n */\n constructor(accountId, privateKey, provider) {\n const key =\n typeof privateKey === \"string\"\n ? _PrivateKey_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(privateKey)\n : privateKey;\n\n this.publicKey = key.publicKey;\n /**\n * @type {(message: Uint8Array) => Promise}\n */\n this.signer = (message) => Promise.resolve(key.sign(message));\n this.provider = provider;\n this.accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId;\n }\n\n /**\n * @returns {Promise}\n */\n static createRandomED25519() {\n const privateKey = _PrivateKey_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generateED25519();\n const publicKey = privateKey.publicKey;\n const accountId = publicKey.toAccountId(0, 0);\n return Promise.resolve(new Wallet(accountId, privateKey));\n }\n\n /**\n * @returns {Promise}\n */\n static createRandomECDSA() {\n const privateKey = _PrivateKey_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generateECDSA();\n const publicKey = privateKey.publicKey;\n const accountId = publicKey.toAccountId(0, 0);\n return Promise.resolve(new Wallet(accountId, privateKey));\n }\n\n /**\n * @returns {Provider=}\n */\n getProvider() {\n return this.provider;\n }\n\n /**\n * @abstract\n * @returns {AccountId}\n */\n getAccountId() {\n return this.accountId;\n }\n\n /**\n * @returns {Key}\n */\n getAccountKey() {\n return this.publicKey;\n }\n\n /**\n * @returns {LedgerId?}\n */\n getLedgerId() {\n return this.provider == null ? null : this.provider.getLedgerId();\n }\n\n /**\n * @abstract\n * @returns {{[key: string]: (string | AccountId)}}\n */\n getNetwork() {\n return this.provider == null ? {} : this.provider.getNetwork();\n }\n\n /**\n * @abstract\n * @returns {string[]}\n */\n getMirrorNetwork() {\n return this.provider == null ? [] : this.provider.getMirrorNetwork();\n }\n\n /**\n * @param {Uint8Array[]} messages\n * @returns {Promise}\n */\n async sign(messages) {\n const sigantures = [];\n\n for (const message of messages) {\n sigantures.push(\n new _SignerSignature_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({\n publicKey: this.publicKey,\n signature: await this.signer(message),\n accountId: this.accountId,\n })\n );\n }\n\n return sigantures;\n }\n\n /**\n * @returns {Promise}\n */\n getAccountBalance() {\n return this.call(\n new _account_AccountBalanceQuery_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]().setAccountId(this.accountId)\n );\n }\n\n /**\n * @abstract\n * @returns {Promise}\n */\n getAccountInfo() {\n return this.call(new _account_AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]().setAccountId(this.accountId));\n }\n\n /**\n * @abstract\n * @returns {Promise}\n */\n getAccountRecords() {\n return this.call(\n new _account_AccountRecordsQuery_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]().setAccountId(this.accountId)\n );\n }\n\n /**\n * @template {Transaction} T\n * @param {T} transaction\n * @returns {Promise}\n */\n signTransaction(transaction) {\n return transaction.signWith(this.publicKey, this.signer);\n }\n\n /**\n * @template {Transaction} T\n * @param {T} transaction\n * @returns {Promise}\n */\n checkTransaction(transaction) {\n const transactionId = transaction.transactionId;\n if (\n transactionId != null &&\n transactionId.accountId != null &&\n transactionId.accountId.compare(this.accountId) != 0\n ) {\n throw new Error(\n \"transaction's ID constructed with a different account ID\"\n );\n }\n\n if (this.provider == null) {\n return Promise.resolve(transaction);\n }\n\n const nodeAccountIds = (\n transaction.nodeAccountIds != null ? transaction.nodeAccountIds : []\n ).map((nodeAccountId) => nodeAccountId.toString());\n const network = Object.values(this.provider.getNetwork()).map(\n (nodeAccountId) => nodeAccountId.toString()\n );\n\n if (\n !nodeAccountIds.reduce(\n (previous, current) => previous && network.includes(current),\n true\n )\n ) {\n throw new Error(\n \"Transaction already set node account IDs to values not within the current network\"\n );\n }\n\n return Promise.resolve(transaction);\n }\n\n /**\n * @template {Transaction} T\n * @param {T} transaction\n * @returns {Promise}\n */\n populateTransaction(transaction) {\n transaction._freezeWithAccountId(this.accountId);\n\n if (transaction.transactionId == null) {\n transaction.setTransactionId(\n _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].generate(this.accountId)\n );\n }\n\n if (\n transaction.nodeAccountIds != null &&\n transaction.nodeAccountIds.length != 0\n ) {\n return Promise.resolve(transaction.freeze());\n }\n\n if (this.provider == null) {\n return Promise.resolve(transaction);\n }\n\n const nodeAccountIds = Object.values(this.provider.getNetwork()).map(\n (id) => (typeof id === \"string\" ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(id) : id)\n );\n _util_js__WEBPACK_IMPORTED_MODULE_7__.shuffle(nodeAccountIds);\n transaction.setNodeAccountIds(\n nodeAccountIds.slice(0, (nodeAccountIds.length + 3 - 1) / 3)\n );\n\n return Promise.resolve(transaction.freeze());\n }\n\n /**\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n * @param {Executable} request\n * @returns {Promise}\n */\n call(request) {\n if (this.provider == null) {\n throw new Error(\n \"cannot send request with an wallet that doesn't contain a provider\"\n );\n }\n\n return this.provider.call(\n request._setOperatorWith(\n this.accountId,\n this.publicKey,\n this.signer\n )\n );\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/Wallet.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +/** + * Pause a new Hedera™ crypto-currency token. + */ +class TokenPauseTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenPauseTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const pauseToken = + /** @type {HashgraphProto.proto.ITokenPauseTransactionBody} */ ( + body.tokenPause + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenPauseTransaction({ + tokenId: + pauseToken.token != null + ? TokenId_TokenId._fromProtobuf(pauseToken.token) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.pauseToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenPause"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenPauseTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenPauseTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenPause", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenPauseTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenRevokeKycTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountAllowanceAdjustTransaction.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountAllowanceAdjustTransaction.js ***! - \**************************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountAllowanceAdjustTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _token_NftId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../token/NftId.js */ \"./node_modules/@hashgraph/sdk/src/token/NftId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _HbarAllowance_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HbarAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/HbarAllowance.js\");\n/* harmony import */ var _TokenAllowance_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TokenAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenAllowance.js\");\n/* harmony import */ var _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TokenNftAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../long.js\").LongObject} LongObject\n */\n\n/**\n * @deprecated - No longer supported via Hedera Protobufs\n * Change properties for the given account.\n */\nclass AccountAllowanceAdjustTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {HbarAllowance[]} [props.hbarAllowances]\n * @param {TokenAllowance[]} [props.tokenAllowances]\n * @param {TokenNftAllowance[]} [props.nftAllowances]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {HbarAllowance[]}\n */\n this._hbarAllowances =\n props.hbarAllowances != null ? props.hbarAllowances : [];\n\n /**\n * @private\n * @type {TokenAllowance[]}\n */\n this._tokenAllowances =\n props.tokenAllowances != null ? props.tokenAllowances : [];\n\n /**\n * @private\n * @type {TokenNftAllowance[]}\n */\n this._nftAllowances =\n props.nftAllowances != null ? props.nftAllowances : [];\n }\n\n /**\n * @returns {HbarAllowance[]}\n */\n get hbarAllowances() {\n return this._hbarAllowances;\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} spenderAccountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n addHbarAllowance(spenderAccountId, amount) {\n const value = amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] ? amount : new _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](amount);\n return this._adjustHbarAllowance(\n null,\n spenderAccountId,\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(value)\n );\n }\n\n /**\n * @param {AccountId | string | null} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {Hbar} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n _adjustHbarAllowance(ownerAccountId, spenderAccountId, amount) {\n this._requireNotFrozen();\n\n this._hbarAllowances.push(\n new _HbarAllowance_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]({\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n ownerAccountId:\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId,\n amount: amount,\n })\n );\n\n return this;\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n grantHbarAllowance(ownerAccountId, spenderAccountId, amount) {\n const value = amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] ? amount : new _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](amount);\n return this._adjustHbarAllowance(\n ownerAccountId,\n spenderAccountId,\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(value)\n );\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n revokeHbarAllowance(ownerAccountId, spenderAccountId, amount) {\n const value = amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] ? amount : new _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](amount);\n return this._adjustHbarAllowance(\n ownerAccountId,\n spenderAccountId,\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(value).negated()\n );\n }\n\n /**\n * @returns {TokenAllowance[]}\n */\n get tokenAllowances() {\n return this._tokenAllowances;\n }\n\n /**\n * @deprecated\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} spenderAccountId\n * @param {Long | number} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n addTokenAllowance(tokenId, spenderAccountId, amount) {\n return this._adjustTokenAllowance(\n tokenId,\n null,\n spenderAccountId,\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(long__WEBPACK_IMPORTED_MODULE_4__.fromValue(amount))\n );\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string | null} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {Long | number} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n _adjustTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) {\n this._requireNotFrozen();\n\n this._tokenAllowances.push(\n new _TokenAllowance_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n tokenId:\n typeof tokenId === \"string\"\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(tokenId)\n : tokenId,\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n ownerAccountId:\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId,\n amount:\n typeof amount === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(amount)\n : amount,\n })\n );\n\n return this;\n }\n\n /**\n * @deprecated\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {Long | number} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n grantTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) {\n return this._adjustTokenAllowance(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(long__WEBPACK_IMPORTED_MODULE_4__.fromValue(amount))\n );\n }\n\n /**\n * @deprecated\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {Long | number} amount\n * @returns {AccountAllowanceAdjustTransaction}\n */\n revokeTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) {\n return this._adjustTokenAllowance(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(long__WEBPACK_IMPORTED_MODULE_4__.fromValue(amount))\n );\n }\n\n /**\n * @deprecated\n * @param {NftId | string} nftId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceAdjustTransaction}\n */\n addTokenNftAllowance(nftId, spenderAccountId) {\n const id = typeof nftId === \"string\" ? _token_NftId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(nftId) : nftId;\n return this._adjustTokenNftAllowance(id, null, spenderAccountId);\n }\n\n /**\n * @param {NftId} nftId\n * @param {AccountId | string | null} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceAdjustTransaction}\n */\n _adjustTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) {\n this._requireNotFrozen();\n\n const spender =\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId;\n const owner =\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId;\n let found = false;\n\n for (const allowance of this._nftAllowances) {\n if (\n allowance.tokenId.compare(nftId.tokenId) === 0 &&\n allowance.spenderAccountId != null &&\n allowance.spenderAccountId.compare(spender) === 0\n ) {\n if (allowance.serialNumbers != null) {\n allowance.serialNumbers.push(nftId.serial);\n }\n found = true;\n break;\n }\n }\n\n if (!found) {\n this._nftAllowances.push(\n new _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n tokenId: nftId.tokenId,\n spenderAccountId: spender,\n serialNumbers: [nftId.serial],\n ownerAccountId: owner,\n allSerials: false,\n delegatingSpender: null,\n })\n );\n }\n\n return this;\n }\n\n /**\n * @deprecated\n * @param {NftId | string} nftId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceAdjustTransaction}\n */\n grantTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) {\n const id = typeof nftId === \"string\" ? _token_NftId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(nftId) : nftId;\n\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(id.serial);\n\n return this._adjustTokenNftAllowance(\n id,\n ownerAccountId,\n spenderAccountId\n );\n }\n\n /**\n * @deprecated\n * @param {NftId | string} nftId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceAdjustTransaction}\n */\n revokeTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) {\n const id = typeof nftId === \"string\" ? _token_NftId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(nftId) : nftId;\n\n _util_js__WEBPACK_IMPORTED_MODULE_9__.requireNotNegative(id.serial);\n return this._adjustTokenNftAllowance(\n new _token_NftId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](id.tokenId, id.serial.negate()),\n ownerAccountId,\n spenderAccountId\n );\n }\n\n /**\n * @deprecated - use `grantTokenNftAllowanceAllSerials()` instead\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceAdjustTransaction}\n */\n addAllTokenNftAllowance(tokenId, spenderAccountId) {\n return this._adjustTokenNftAllowanceAllSerials(\n tokenId,\n null,\n spenderAccountId,\n true\n );\n }\n\n /**\n * @deprecated\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceAdjustTransaction}\n */\n grantTokenNftAllowanceAllSerials(\n tokenId,\n ownerAccountId,\n spenderAccountId\n ) {\n return this._adjustTokenNftAllowanceAllSerials(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n true\n );\n }\n\n /**\n * @deprecated\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceAdjustTransaction}\n */\n revokeTokenNftAllowanceAllSerials(\n tokenId,\n ownerAccountId,\n spenderAccountId\n ) {\n return this._adjustTokenNftAllowanceAllSerials(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n false\n );\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string | null} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {boolean} allSerials\n * @returns {AccountAllowanceAdjustTransaction}\n */\n _adjustTokenNftAllowanceAllSerials(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n allSerials\n ) {\n this._requireNotFrozen();\n\n this._nftAllowances.push(\n new _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n tokenId:\n typeof tokenId === \"string\"\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(tokenId)\n : tokenId,\n ownerAccountId:\n ownerAccountId != null\n ? typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId\n : null,\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n serialNumbers: null,\n allSerials,\n delegatingSpender: null,\n })\n );\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n this._hbarAllowances.map((allowance) =>\n allowance._validateChecksums(client)\n );\n this._tokenAllowances.map((allowance) =>\n allowance._validateChecksums(client)\n );\n this._nftAllowances.map((allowance) =>\n allowance._validateChecksums(client)\n );\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _execute(channel, request) {\n return Promise.reject(\n new Error(\"This feature has been deprecated for this class.\")\n );\n }\n\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * @deprecated\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n throw new Error(\"This feature has been deprecated for this class.\");\n }\n\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * @override\n * @protected\n * @returns {object}\n */\n _makeTransactionData() {\n throw new Error(\"This feature has been deprecated.\");\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `AccountAllowanceAdjustTransaction:${timestamp.toString()}`;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountAllowanceAdjustTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountAllowanceApproveTransaction.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountAllowanceApproveTransaction.js ***! - \***************************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountAllowanceApproveTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _token_NftId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../token/NftId.js */ \"./node_modules/@hashgraph/sdk/src/token/NftId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _HbarAllowance_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HbarAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/HbarAllowance.js\");\n/* harmony import */ var _TokenAllowance_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TokenAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenAllowance.js\");\n/* harmony import */ var _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TokenNftAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoApproveAllowanceTransactionBody} HashgraphProto.proto.ICryptoApproveAllowanceTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../long.js\").LongObject} LongObject\n */\n\n/**\n * Change properties for the given account.\n */\nclass AccountAllowanceApproveTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {HbarAllowance[]} [props.hbarApprovals]\n * @param {TokenAllowance[]} [props.tokenApprovals]\n * @param {TokenNftAllowance[]} [props.nftApprovals]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {HbarAllowance[]}\n */\n this._hbarApprovals =\n props.hbarApprovals != null ? props.hbarApprovals : [];\n\n /**\n * @private\n * @type {TokenAllowance[]}\n */\n this._tokenApprovals =\n props.tokenApprovals != null ? props.tokenApprovals : [];\n\n /**\n * @private\n * @type {TokenNftAllowance[]}\n */\n this._nftApprovals =\n props.nftApprovals != null ? props.nftApprovals : [];\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {AccountAllowanceApproveTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const allowanceApproval =\n /** @type {HashgraphProto.proto.ICryptoApproveAllowanceTransactionBody} */ (\n body.cryptoApproveAllowance\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new AccountAllowanceApproveTransaction({\n hbarApprovals: (allowanceApproval.cryptoAllowances != null\n ? allowanceApproval.cryptoAllowances\n : []\n ).map((approval) => _HbarAllowance_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobuf(approval)),\n tokenApprovals: (allowanceApproval.tokenAllowances != null\n ? allowanceApproval.tokenAllowances\n : []\n ).map((approval) => _TokenAllowance_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]._fromProtobuf(approval)),\n nftApprovals: (allowanceApproval.nftAllowances != null\n ? allowanceApproval.nftAllowances\n : []\n ).map((approval) => _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]._fromProtobuf(approval)),\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {HbarAllowance[]}\n */\n get hbarApprovals() {\n return this._hbarApprovals;\n }\n\n /**\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @returns {AccountAllowanceApproveTransaction}\n */\n approveHbarAllowance(ownerAccountId, spenderAccountId, amount) {\n this._requireNotFrozen();\n\n this._hbarApprovals.push(\n new _HbarAllowance_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]({\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n ownerAccountId:\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId,\n amount: amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] ? amount : new _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](amount),\n })\n );\n\n return this;\n }\n\n /**\n * @deprecated - Use `approveHbarAllowance()` instead\n * @param {AccountId | string} spenderAccountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @returns {AccountAllowanceApproveTransaction}\n */\n addHbarAllowance(spenderAccountId, amount) {\n this._requireNotFrozen();\n\n this._hbarApprovals.push(\n new _HbarAllowance_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]({\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n amount: amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] ? amount : new _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](amount),\n ownerAccountId: null,\n })\n );\n\n return this;\n }\n\n /**\n * @returns {TokenAllowance[]}\n */\n get tokenApprovals() {\n return this._tokenApprovals;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {Long | number} amount\n * @returns {AccountAllowanceApproveTransaction}\n */\n approveTokenAllowance(tokenId, ownerAccountId, spenderAccountId, amount) {\n this._requireNotFrozen();\n\n this._tokenApprovals.push(\n new _TokenAllowance_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n tokenId:\n typeof tokenId === \"string\"\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(tokenId)\n : tokenId,\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n ownerAccountId:\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId,\n amount:\n typeof amount === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(amount)\n : amount,\n })\n );\n\n return this;\n }\n\n /**\n * @deprecated - Use `approveTokenAllowance()` instead\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} spenderAccountId\n * @param {Long | number} amount\n * @returns {AccountAllowanceApproveTransaction}\n */\n addTokenAllowance(tokenId, spenderAccountId, amount) {\n this._requireNotFrozen();\n\n this._tokenApprovals.push(\n new _TokenAllowance_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n tokenId:\n typeof tokenId === \"string\"\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(tokenId)\n : tokenId,\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n amount:\n typeof amount === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(amount)\n : amount,\n ownerAccountId: null,\n })\n );\n\n return this;\n }\n\n /**\n * @deprecated - Use `approveTokenNftAllowance()` instead\n * @param {NftId | string} nftId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceApproveTransaction}\n */\n addTokenNftAllowance(nftId, spenderAccountId) {\n return this._approveTokenNftAllowance(\n nftId,\n null,\n spenderAccountId,\n null\n );\n }\n\n /**\n * @returns {TokenNftAllowance[]}\n */\n get tokenNftApprovals() {\n return this._nftApprovals;\n }\n\n /**\n * @param {NftId | string} nftId\n * @param {AccountId | string | null} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {AccountId | string | null} delegatingSpender\n * @returns {AccountAllowanceApproveTransaction}\n */\n _approveTokenNftAllowance(\n nftId,\n ownerAccountId,\n spenderAccountId,\n delegatingSpender\n ) {\n this._requireNotFrozen();\n\n const id = typeof nftId === \"string\" ? _token_NftId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(nftId) : nftId;\n const spender =\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId;\n let found = false;\n\n for (const allowance of this._nftApprovals) {\n if (\n allowance.tokenId.compare(id.tokenId) === 0 &&\n allowance.spenderAccountId != null &&\n allowance.spenderAccountId.compare(spender) === 0\n ) {\n if (allowance.serialNumbers != null) {\n allowance.serialNumbers.push(id.serial);\n }\n found = true;\n break;\n }\n }\n\n if (!found) {\n this._nftApprovals.push(\n new _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n tokenId: id.tokenId,\n spenderAccountId: spender,\n ownerAccountId:\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId,\n serialNumbers: [id.serial],\n allSerials: false,\n delegatingSpender:\n typeof delegatingSpender === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(delegatingSpender)\n : delegatingSpender,\n })\n );\n }\n\n return this;\n }\n\n /**\n * @param {NftId | string} nftId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceApproveTransaction}\n */\n approveTokenNftAllowance(nftId, ownerAccountId, spenderAccountId) {\n return this._approveTokenNftAllowance(\n nftId,\n ownerAccountId,\n spenderAccountId,\n null\n );\n }\n\n /**\n * @param {NftId | string} nftId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {AccountId | string} delegatingSpender\n * @returns {AccountAllowanceApproveTransaction}\n */\n approveTokenNftAllowanceWithDelegatingSpender(\n nftId,\n ownerAccountId,\n spenderAccountId,\n delegatingSpender\n ) {\n return this._approveTokenNftAllowance(\n nftId,\n ownerAccountId,\n spenderAccountId,\n delegatingSpender\n );\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string | null} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @param {boolean} allSerials\n * @returns {AccountAllowanceApproveTransaction}\n */\n _approveAllTokenNftAllowance(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n allSerials\n ) {\n this._requireNotFrozen();\n\n this._nftApprovals.push(\n new _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n tokenId:\n typeof tokenId === \"string\"\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(tokenId)\n : tokenId,\n spenderAccountId:\n typeof spenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(spenderAccountId)\n : spenderAccountId,\n ownerAccountId:\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId,\n serialNumbers: null,\n allSerials,\n delegatingSpender: null,\n })\n );\n\n return this;\n }\n\n /**\n * @deprecated - Use `approveTokenNftAllowanceAllSerials()` instead\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceApproveTransaction}\n */\n addAllTokenNftAllowance(tokenId, ownerAccountId, spenderAccountId) {\n return this._approveAllTokenNftAllowance(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n true\n );\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceApproveTransaction}\n */\n approveTokenNftAllowanceAllSerials(\n tokenId,\n ownerAccountId,\n spenderAccountId\n ) {\n return this._approveAllTokenNftAllowance(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n true\n );\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} ownerAccountId\n * @param {AccountId | string} spenderAccountId\n * @returns {AccountAllowanceApproveTransaction}\n */\n deleteTokenNftAllowanceAllSerials(\n tokenId,\n ownerAccountId,\n spenderAccountId\n ) {\n return this._approveAllTokenNftAllowance(\n tokenId,\n ownerAccountId,\n spenderAccountId,\n false\n );\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n this._hbarApprovals.map((approval) =>\n approval._validateChecksums(client)\n );\n this._tokenApprovals.map((approval) =>\n approval._validateChecksums(client)\n );\n this._nftApprovals.map((approval) =>\n approval._validateChecksums(client)\n );\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.approveAllowances(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoApproveAllowance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoApproveAllowanceTransactionBody}\n */\n _makeTransactionData() {\n return {\n cryptoAllowances: this._hbarApprovals.map((approval) =>\n approval._toProtobuf()\n ),\n tokenAllowances: this._tokenApprovals.map((approval) =>\n approval._toProtobuf()\n ),\n nftAllowances: this._nftApprovals.map((approval) =>\n approval._toProtobuf()\n ),\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `AccountAllowanceApproveTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"cryptoApproveAllowance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountAllowanceApproveTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountAllowanceApproveTransaction.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenRevokeKycTransactionBody} HashgraphProto.proto.ITokenRevokeKycTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountAllowanceDeleteTransaction.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountAllowanceDeleteTransaction.js ***! - \**************************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * RevokeKyc a new Hedera™ crypto-currency token. + */ +class TokenRevokeKycTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenRevokeKycTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const revokeKycToken = + /** @type {HashgraphProto.proto.ITokenRevokeKycTransactionBody} */ ( + body.tokenRevokeKyc + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenRevokeKycTransaction({ + tokenId: + revokeKycToken.token != null + ? TokenId_TokenId._fromProtobuf(revokeKycToken.token) + : undefined, + accountId: + revokeKycToken.account != null + ? AccountId_AccountId._fromProtobuf(revokeKycToken.account) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.revokeKycFromTokenAccount(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenRevokeKyc"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenRevokeKycTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + account: + this._accountId != null ? this._accountId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenRevokeKycTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenRevokeKyc", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenRevokeKycTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenUnfreezeTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountAllowanceDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _token_NftId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../token/NftId.js */ \"./node_modules/@hashgraph/sdk/src/token/NftId.js\");\n/* harmony import */ var _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TokenNftAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoDeleteAllowanceTransactionBody} HashgraphProto.proto.ICryptoDeleteAllowanceTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"./HbarAllowance.js\").default} HbarAllowance\n * @typedef {import(\"./TokenAllowance.js\").default} TokenAllowance\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../long.js\").LongObject} LongObject\n */\n\n/**\n * Change properties for the given account.\n */\nclass AccountAllowanceDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {HbarAllowance[]} [props.hbarAllowances]\n * @param {TokenAllowance[]} [props.tokenAllowances]\n * @param {TokenNftAllowance[]} [props.nftAllowances]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {TokenNftAllowance[]}\n */\n this._nftAllowances =\n props.nftAllowances != null ? props.nftAllowances : [];\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {AccountAllowanceDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const allowance =\n /** @type {HashgraphProto.proto.ICryptoDeleteAllowanceTransactionBody} */ (\n body.cryptoDeleteAllowance\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new AccountAllowanceDeleteTransaction({\n nftAllowances: (allowance.nftAllowances != null\n ? allowance.nftAllowances\n : []\n ).map((allowance) =>\n _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(allowance)\n ),\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {TokenNftAllowance[]}\n */\n get tokenNftAllowanceDeletions() {\n return this._nftAllowances;\n }\n\n /**\n * @description If you want to remove allowance for all serials of a NFT\n * - use AccountAllowanceApproveTransaction().deleteTokenNftAllowanceAllSerials()\n * @param {NftId | string} nftId\n * @param {AccountId | string} ownerAccountId\n * @returns {AccountAllowanceDeleteTransaction}\n */\n deleteAllTokenNftAllowances(nftId, ownerAccountId) {\n this._requireNotFrozen();\n\n const id = typeof nftId === \"string\" ? _token_NftId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(nftId) : nftId;\n\n const owner =\n typeof ownerAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(ownerAccountId)\n : ownerAccountId;\n let found = false;\n\n for (const allowance of this._nftAllowances) {\n if (allowance.tokenId.compare(id.tokenId) === 0) {\n if (allowance.serialNumbers != null) {\n allowance.serialNumbers.push(id.serial);\n }\n found = true;\n break;\n }\n }\n\n if (!found) {\n this._nftAllowances.push(\n new _TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]({\n tokenId: id.tokenId,\n spenderAccountId: null,\n serialNumbers: [id.serial],\n ownerAccountId: owner,\n allSerials: false,\n delegatingSpender: null,\n })\n );\n }\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n this._nftAllowances.map((allowance) =>\n allowance._validateChecksums(client)\n );\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.deleteAllowances(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoDeleteAllowance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoDeleteAllowanceTransactionBody}\n */\n _makeTransactionData() {\n return {\n nftAllowances: this._nftAllowances.map((allowance) =>\n allowance._toProtobuf()\n ),\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `AccountAllowanceDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"cryptoDeleteAllowance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountAllowanceDeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountAllowanceDeleteTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountBalance.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountBalance.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountBalance; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _TokenBalanceMap_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TokenBalanceMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenBalanceMap.js\");\n/* harmony import */ var _TokenDecimalMap_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TokenDecimalMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenDecimalMap.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @typedef {object} TokenBalanceJson\n * @property {string} tokenId\n * @property {string} balance\n * @property {number} decimals\n */\n\n/**\n * @typedef {object} AccountBalanceJson\n * @property {string} hbars\n * @property {TokenBalanceJson[]} tokens\n */\n\nclass AccountBalance {\n /**\n * @private\n * @param {object} props\n * @param {Hbar} props.hbars\n * @param {?TokenBalanceMap} props.tokens\n * @param {?TokenDecimalMap} props.tokenDecimals\n */\n constructor(props) {\n /**\n * The account ID for which this balancermation applies.\n *\n * @readonly\n */\n this.hbars = props.hbars;\n\n /**\n * @deprecated - Use the mirror node API https://docs.hedera.com/guides/docs/mirror-node-api/rest-api#api-v1-accounts instead\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.tokens = props.tokens;\n\n /**\n * @deprecated - Use the mirror node API https://docs.hedera.com/guides/docs/mirror-node-api/rest-api#api-v1-accounts instead\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.tokenDecimals = props.tokenDecimals;\n\n Object.freeze(this);\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {AccountBalance}\n */\n static fromBytes(bytes) {\n return AccountBalance._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.CryptoGetAccountBalanceResponse.decode(bytes)\n );\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ICryptoGetAccountBalanceResponse} accountBalance\n * @returns {AccountBalance}\n */\n static _fromProtobuf(accountBalance) {\n const tokenBalances = new _TokenBalanceMap_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n const tokenDecimals = new _TokenDecimalMap_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n\n if (accountBalance.tokenBalances != null) {\n for (const balance of accountBalance.tokenBalances) {\n const tokenId = _token_TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (\n balance.tokenId\n )\n );\n\n tokenDecimals._set(\n tokenId,\n balance.decimals != null ? balance.decimals : 0\n );\n tokenBalances._set(\n tokenId,\n long__WEBPACK_IMPORTED_MODULE_0__.fromValue(/** @type {Long} */ (balance.balance))\n );\n }\n }\n\n return new AccountBalance({\n hbars: _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(\n /** @type {Long} */ (accountBalance.balance)\n ),\n tokens: tokenBalances,\n tokenDecimals,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.ICryptoGetAccountBalanceResponse}\n */\n _toProtobuf() {\n /** @type {HashgraphProto.proto.ITokenBalance[]} */\n const list = [];\n\n // eslint-disable-next-line deprecation/deprecation\n for (const [key, value] of this.tokens != null ? this.tokens : []) {\n list.push({\n tokenId: key._toProtobuf(),\n balance: value,\n decimals:\n // eslint-disable-next-line deprecation/deprecation\n this.tokenDecimals != null\n ? // eslint-disable-next-line deprecation/deprecation\n this.tokenDecimals.get(key)\n : null,\n });\n }\n\n return {\n balance: this.hbars.toTinybars(),\n tokenBalances: list,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.CryptoGetAccountBalanceResponse.encode(\n this._toProtobuf()\n ).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {AccountBalanceJson}\n */\n toJSON() {\n const tokens = [];\n // eslint-disable-next-line deprecation/deprecation\n for (const [key, value] of this.tokens != null ? this.tokens : []) {\n const decimals =\n // eslint-disable-next-line deprecation/deprecation\n this.tokenDecimals != null ? this.tokenDecimals.get(key) : null;\n\n tokens.push({\n tokenId: key.toString(),\n balance: value.toString(),\n decimals: decimals != null ? decimals : 0,\n });\n }\n\n return {\n hbars: this.hbars.toString(),\n tokens,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountBalance.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenUnfreezeAccountTransactionBody} HashgraphProto.proto.ITokenUnfreezeAccountTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountBalanceQuery.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountBalanceQuery.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountBalanceQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../contract/ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _AccountBalance_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AccountBalance.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountBalance.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountBalanceQuery} HashgraphProto.proto.ICryptoGetAccountBalanceQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountBalanceResponse} HashgraphProto.proto.ICryptoGetAccountBalanceResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Get the balance of a Hedera™ crypto-currency account.\n *\n * This returns only the balance, so its a smaller and faster reply\n * than AccountInfoQuery.\n *\n * This query is free.\n *\n * @augments {Query}\n */\nclass AccountBalanceQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {AccountId | string} [props.accountId]\n * @param {ContractId | string} [props.contractId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?AccountId}\n * @private\n */\n this._accountId = null;\n\n /**\n * @type {?ContractId}\n * @private\n */\n this._contractId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {AccountBalanceQuery}\n */\n static _fromProtobuf(query) {\n const balance =\n /** @type {HashgraphProto.proto.ICryptoGetAccountBalanceQuery} */ (\n query.cryptogetAccountBalance\n );\n\n return new AccountBalanceQuery({\n accountId:\n balance.accountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(balance.accountID)\n : undefined,\n contractId:\n balance.contractID != null\n ? _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(balance.contractID)\n : undefined,\n });\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account ID for which the balance is being requested.\n *\n * This is mutually exclusive with `setContractId`.\n *\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Set the contract ID for which the balance is being requested.\n *\n * This is mutually exclusive with `setAccountId`.\n *\n * @param {ContractId | string} contractId\n * @returns {this}\n */\n setContractId(contractId) {\n this._contractId =\n typeof contractId === \"string\"\n ? _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @protected\n * @override\n * @returns {boolean}\n */\n _isPaymentRequired() {\n return false;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.cryptoGetBalance(request);\n }\n\n /**\n * @override\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptogetAccountBalance =\n /** @type {HashgraphProto.proto.ICryptoGetAccountBalanceResponse} */ (\n response.cryptogetAccountBalance\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n cryptogetAccountBalance.header\n );\n }\n\n /**\n * @override\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const cryptogetAccountBalance =\n /** @type {HashgraphProto.proto.ICryptoGetAccountBalanceResponse} */ (\n response.cryptogetAccountBalance\n );\n return Promise.resolve(\n _AccountBalance_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(cryptogetAccountBalance)\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n cryptogetAccountBalance: {\n header,\n accountID:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n return `AccountBalanceQuery:${this._timestamp.toString()}`;\n }\n}\n\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\n \"cryptogetAccountBalance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountBalanceQuery._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountBalanceQuery.js?"); +/** + * Unfreeze a new Hedera™ crypto-currency token. + */ +class TokenUnfreezeTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {AccountId | string} [props.accountId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenUnfreezeTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const unfreezeToken = + /** @type {HashgraphProto.proto.ITokenUnfreezeAccountTransactionBody} */ ( + body.tokenUnfreeze + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenUnfreezeTransaction({ + tokenId: + unfreezeToken.token != null + ? TokenId_TokenId._fromProtobuf(unfreezeToken.token) + : undefined, + accountId: + unfreezeToken.account != null + ? AccountId_AccountId._fromProtobuf(unfreezeToken.account) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.unfreezeTokenAccount(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenUnfreeze"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenUnfreezeAccountTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + account: + this._accountId != null ? this._accountId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenUnfreezeTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenUnfreeze", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenUnfreezeTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenUnpauseTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountCreateTransaction.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountCreateTransaction.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountCreateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../EvmAddress.js */ \"./node_modules/@hashgraph/sdk/src/EvmAddress.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../Timestamp.js\").default} Timestamp\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nclass AccountCreateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {Key} [props.key]\n * @param {number | string | Long | BigNumber | Hbar} [props.initialBalance]\n * @param {boolean} [props.receiverSignatureRequired]\n * @param {AccountId} [props.proxyAccountId]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {string} [props.accountMemo]\n * @param {Long | number} [props.maxAutomaticTokenAssociations]\n * @param {AccountId | string} [props.stakedAccountId]\n * @param {Long | number} [props.stakedNodeId]\n * @param {boolean} [props.declineStakingReward]\n * @param {PublicKey} [props.aliasKey]\n * @param {EvmAddress} [props.aliasEvmAddress]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Key}\n */\n this._key = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._initialBalance = null;\n\n /**\n * @private\n * @type {Hbar}\n */\n this._sendRecordThreshold = _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_RECORD_THRESHOLD;\n\n /**\n * @private\n * @type {Hbar}\n */\n this._receiveRecordThreshold = _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_RECORD_THRESHOLD;\n\n /**\n * @private\n * @type {boolean}\n */\n this._receiverSignatureRequired = false;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._proxyAccountId = null;\n\n /**\n * @private\n * @type {Duration}\n */\n this._autoRenewPeriod = new _Duration_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?string}\n */\n this._accountMemo = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._maxAutomaticTokenAssociations = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._stakedAccountId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._stakedNodeId = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this._declineStakingReward = false;\n\n /**\n * @private\n * @type {?PublicKey}\n */\n this._aliasKey = null;\n\n /**\n * @private\n * @type {?EvmAddress}\n */\n this._aliasEvmAddress = null;\n\n if (props.key != null) {\n this.setKey(props.key);\n }\n\n if (props.receiverSignatureRequired != null) {\n this.setReceiverSignatureRequired(props.receiverSignatureRequired);\n }\n\n if (props.initialBalance != null) {\n this.setInitialBalance(props.initialBalance);\n }\n\n if (props.proxyAccountId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setProxyAccountId(props.proxyAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.accountMemo != null) {\n this.setAccountMemo(props.accountMemo);\n }\n\n if (props.maxAutomaticTokenAssociations != null) {\n this.setMaxAutomaticTokenAssociations(\n props.maxAutomaticTokenAssociations\n );\n }\n\n if (props.stakedAccountId != null) {\n this.setStakedAccountId(props.stakedAccountId);\n }\n\n if (props.stakedNodeId != null) {\n this.setStakedNodeId(props.stakedNodeId);\n }\n\n if (props.declineStakingReward != null) {\n this.setDeclineStakingReward(props.declineStakingReward);\n }\n\n if (props.aliasKey != null) {\n this.setAliasKey(props.aliasKey);\n }\n\n if (props.aliasEvmAddress != null) {\n this.setAliasEvmAddress(props.aliasEvmAddress);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {AccountCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const create =\n /** @type {HashgraphProto.proto.ICryptoCreateTransactionBody} */ (\n body.cryptoCreateAccount\n );\n\n let aliasKey = undefined;\n let aliasEvmAddress = undefined;\n if (create.alias != null && create.alias.length > 0) {\n if (create.alias.length === 20) {\n aliasEvmAddress = _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromBytes(create.alias);\n } else {\n aliasKey = _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__.proto.Key.decode(create.alias)\n );\n }\n }\n\n if (!(aliasKey instanceof _PublicKey_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"])) {\n aliasKey = undefined;\n }\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new AccountCreateTransaction({\n key:\n create.key != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(create.key)\n : undefined,\n initialBalance:\n create.initialBalance != null\n ? create.initialBalance\n : undefined,\n receiverSignatureRequired:\n create.receiverSigRequired != null\n ? create.receiverSigRequired\n : undefined,\n proxyAccountId:\n create.proxyAccountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n create.proxyAccountID\n )\n )\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? create.autoRenewPeriod.seconds != null\n ? create.autoRenewPeriod.seconds\n : undefined\n : undefined,\n accountMemo: create.memo != null ? create.memo : undefined,\n maxAutomaticTokenAssociations:\n create.maxAutomaticTokenAssociations != null\n ? create.maxAutomaticTokenAssociations\n : undefined,\n stakedAccountId:\n create.stakedAccountId != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(create.stakedAccountId)\n : undefined,\n stakedNodeId:\n create.stakedNodeId != null\n ? create.stakedNodeId\n : undefined,\n declineStakingReward: create.declineReward == true,\n aliasKey,\n aliasEvmAddress,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?Key}\n */\n get key() {\n return this._key;\n }\n\n /**\n * Set the key for this account.\n *\n * This is the key that must sign each transfer out of the account.\n *\n * If `receiverSignatureRequired` is true, then the key must also sign\n * any transfer into the account.\n *\n * @param {Key} key\n * @returns {this}\n */\n setKey(key) {\n this._requireNotFrozen();\n this._key = key;\n\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get initialBalance() {\n return this._initialBalance;\n }\n\n /**\n * Set the initial amount to transfer into this account.\n *\n * @param {number | string | Long | BigNumber | Hbar} initialBalance\n * @returns {this}\n */\n setInitialBalance(initialBalance) {\n this._requireNotFrozen();\n this._initialBalance =\n initialBalance instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? initialBalance\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](initialBalance);\n\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get receiverSignatureRequired() {\n return this._receiverSignatureRequired;\n }\n\n /**\n * Set to true to require the key for this account to sign any transfer of\n * hbars to this account.\n *\n * @param {boolean} receiverSignatureRequired\n * @returns {this}\n */\n setReceiverSignatureRequired(receiverSignatureRequired) {\n this._requireNotFrozen();\n this._receiverSignatureRequired = receiverSignatureRequired;\n\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?AccountId}\n */\n get proxyAccountId() {\n return this._proxyAccountId;\n }\n\n /**\n * @deprecated\n *\n * Set the ID of the account to which this account is proxy staked.\n * @param {AccountId} proxyAccountId\n * @returns {this}\n */\n setProxyAccountId(proxyAccountId) {\n this._requireNotFrozen();\n this._proxyAccountId = proxyAccountId;\n\n return this;\n }\n\n /**\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * Set the auto renew period for this account.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get accountMemo() {\n return this._accountMemo;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setAccountMemo(memo) {\n this._requireNotFrozen();\n this._accountMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get maxAutomaticTokenAssociations() {\n return this._maxAutomaticTokenAssociations;\n }\n\n /**\n * @param {Long | number} maxAutomaticTokenAssociations\n * @returns {this}\n */\n setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) {\n this._requireNotFrozen();\n this._maxAutomaticTokenAssociations =\n typeof maxAutomaticTokenAssociations === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(maxAutomaticTokenAssociations)\n : maxAutomaticTokenAssociations;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get stakedAccountId() {\n return this._stakedAccountId;\n }\n\n /**\n * @param {AccountId | string} stakedAccountId\n * @returns {this}\n */\n setStakedAccountId(stakedAccountId) {\n this._requireNotFrozen();\n this._stakedAccountId =\n typeof stakedAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(stakedAccountId)\n : stakedAccountId;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stakedNodeId() {\n return this._stakedNodeId;\n }\n\n /**\n * @param {Long | number} stakedNodeId\n * @returns {this}\n */\n setStakedNodeId(stakedNodeId) {\n this._requireNotFrozen();\n this._stakedNodeId = long__WEBPACK_IMPORTED_MODULE_4__.fromValue(stakedNodeId);\n\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get declineStakingRewards() {\n return this._declineStakingReward;\n }\n\n /**\n * @param {boolean} declineStakingReward\n * @returns {this}\n */\n setDeclineStakingReward(declineStakingReward) {\n this._requireNotFrozen();\n this._declineStakingReward = declineStakingReward;\n\n return this;\n }\n\n /**\n * @beta - Please note this is a beta feature and it's implementation is subject to change\n * @returns {?PublicKey}\n */\n get aliasKey() {\n return this._aliasKey;\n }\n\n /**\n * @beta - Please note this is a beta feature and it's implementation is subject to change\n * @param {PublicKey} aliasKey\n * @returns {this}\n */\n setAliasKey(aliasKey) {\n this._aliasKey = aliasKey;\n return this;\n }\n\n /**\n * @beta - Please note this is a beta feature and it's implementation is subject to change\n * @returns {?EvmAddress}\n */\n get aliasEvmAddress() {\n return this._aliasEvmAddress;\n }\n\n /**\n * @beta - Please note this is a beta feature and it's implementation is subject to change\n * @param {Uint8Array | string | EvmAddress} aliasEvmAddress\n * @returns {this}\n */\n setAliasEvmAddress(aliasEvmAddress) {\n if (typeof aliasEvmAddress === \"string\") {\n this._aliasEvmAddress = _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromString(aliasEvmAddress);\n } else if (aliasEvmAddress instanceof Uint8Array) {\n this._aliasEvmAddress = _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromBytes(aliasEvmAddress);\n } else {\n this._aliasEvmAddress = aliasEvmAddress;\n }\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._proxyAccountId != null) {\n this._proxyAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.createAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoCreateAccount\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoCreateTransactionBody}\n */\n _makeTransactionData() {\n let alias = null;\n if (this._aliasKey != null) {\n alias = _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__.proto.Key.encode(\n this._aliasKey._toProtobufKey()\n ).finish();\n } else if (this._aliasEvmAddress != null) {\n alias = this._aliasEvmAddress.toBytes();\n }\n\n return {\n key: this._key != null ? this._key._toProtobufKey() : null,\n initialBalance:\n this._initialBalance != null\n ? this._initialBalance.toTinybars()\n : null,\n autoRenewPeriod: this._autoRenewPeriod._toProtobuf(),\n proxyAccountID:\n this._proxyAccountId != null\n ? this._proxyAccountId._toProtobuf()\n : null,\n receiveRecordThreshold: this._receiveRecordThreshold.toTinybars(),\n sendRecordThreshold: this._sendRecordThreshold.toTinybars(),\n receiverSigRequired: this._receiverSignatureRequired,\n memo: this._accountMemo,\n maxAutomaticTokenAssociations:\n this._maxAutomaticTokenAssociations != null\n ? this._maxAutomaticTokenAssociations.toInt()\n : null,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId._toProtobuf()\n : null,\n stakedNodeId: this.stakedNodeId,\n declineReward: this.declineStakingRewards,\n alias,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `AccountCreateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"cryptoCreateAccount\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountCreateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountCreateTransaction.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenUnpauseTransactionBody} HashgraphProto.proto.ITokenUnpauseTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountDeleteTransaction.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountDeleteTransaction.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoDeleteTransactionBody} HashgraphProto.proto.ICryptoDeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Marks an account as deleted, moving all its current hbars to another account.\n *\n * It will remain in the ledger, marked as deleted, until it expires.\n * Transfers into it a deleted account fail. But a deleted account can still have its\n * expiration extended in the normal way.\n */\nclass AccountDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} props\n * @param {AccountId} [props.accountId]\n * @param {AccountId} [props.transferAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._transferAccountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n if (props.transferAccountId != null) {\n this.setTransferAccountId(props.transferAccountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {AccountDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const accountDelete =\n /** @type {HashgraphProto.proto.ICryptoDeleteTransactionBody} */ (\n body.cryptoDelete\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new AccountDeleteTransaction({\n accountId:\n accountDelete.deleteAccountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n accountDelete.deleteAccountID\n )\n )\n : undefined,\n transferAccountId:\n accountDelete.transferAccountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n accountDelete.transferAccountID\n )\n )\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account ID which is being deleted in this transaction.\n *\n * @param {AccountId | string} accountId\n * @returns {AccountDeleteTransaction}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get transferAccountId() {\n return this._transferAccountId;\n }\n\n /**\n * Set the account ID which will receive all remaining hbars.\n *\n * @param {AccountId | string} transferAccountId\n * @returns {AccountDeleteTransaction}\n */\n setTransferAccountId(transferAccountId) {\n this._requireNotFrozen();\n this._transferAccountId =\n typeof transferAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(transferAccountId)\n : transferAccountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n\n if (this._transferAccountId != null) {\n this._transferAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.cryptoDelete(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoDelete\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n deleteAccountID:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n transferAccountID:\n this._transferAccountId != null\n ? this._transferAccountId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `AccountDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"cryptoDelete\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountDeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountDeleteTransaction.js?"); +/** + * Unpause a new Hedera™ crypto-currency token. + */ +class TokenUnpauseTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenUnpauseTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const unpauseToken = + /** @type {HashgraphProto.proto.ITokenUnpauseTransactionBody} */ ( + body.tokenUnpause + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenUnpauseTransaction({ + tokenId: + unpauseToken.token != null + ? TokenId_TokenId._fromProtobuf(unpauseToken.token) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.unpauseToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenUnpause"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenUnpauseTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenUnpauseTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenUnpause", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenUnpauseTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenKeyValidation.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.TokenKeyValidation} HashgraphProto.proto.TokenKeyValidation + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountId.js": -/*!**************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountId.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** Types of validation strategies for token keys. */ +class TokenKeyValidation { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case TokenKeyValidation.FullValidation: + return "FULL_VALIDATION"; + case TokenKeyValidation.NoValidation: + return "NO_VALIDATION"; + default: + return `UNKNOWN (${this._code})`; + } + } + + /** + * @internal + * @param {number} code + * @returns {TokenKeyValidation} + */ + static _fromCode(code) { + switch (code) { + case 0: + return TokenKeyValidation.FullValidation; + case 1: + return TokenKeyValidation.NoValidation; + } + + throw new Error( + `(BUG) TokenKeyValidation.fromCode() does not handle code: ${code}`, + ); + } + + /** + * @returns {HashgraphProto.proto.TokenKeyValidation} + */ + valueOf() { + return this._code; + } +} + +/** + * Currently the default behaviour. It will perform all token key validations. + */ +TokenKeyValidation.FullValidation = new TokenKeyValidation(0); -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountId; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../EntityIdHelper.js */ \"./node_modules/@hashgraph/sdk/src/EntityIdHelper.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/* harmony import */ var _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../EvmAddress.js */ \"./node_modules/@hashgraph/sdk/src/EvmAddress.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * The ID for a crypto-currency account on Hedera.\n */\nclass AccountId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n * @param {(PublicKey)=} aliasKey\n * @param {(EvmAddress)=} evmAddress\n */\n constructor(props, realm, num, aliasKey, evmAddress) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_1__.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n this.aliasKey = aliasKey != null ? aliasKey : null;\n this.evmAddress = evmAddress != null ? evmAddress : null;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @description Accepts the following formats as string:\n * - as stand alone nubmers\n * - as shard.realm.num\n * - as shard.realm.hex (wo 0x prefix)\n * - hex (w/wo 0x prefix)\n * @param {string} text\n * @returns {AccountId}\n */\n static fromString(text) {\n let shard = long__WEBPACK_IMPORTED_MODULE_0__.ZERO;\n let realm = long__WEBPACK_IMPORTED_MODULE_0__.ZERO;\n let num = long__WEBPACK_IMPORTED_MODULE_0__.ZERO;\n let aliasKey = undefined;\n let evmAddress = undefined;\n\n if ((text.startsWith(\"0x\") && text.length == 42) || text.length == 40) {\n evmAddress = _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromString(text);\n } else {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_1__.fromStringSplitter(text);\n\n if (Number.isNaN(result.shard) || Number.isNaN(result.realm)) {\n throw new Error(\"invalid format for entity ID\");\n }\n\n if (result.shard != null) shard = long__WEBPACK_IMPORTED_MODULE_0__.fromString(result.shard);\n if (result.realm != null) realm = long__WEBPACK_IMPORTED_MODULE_0__.fromString(result.realm);\n\n if (result.numOrHex.length < 20) {\n num = long__WEBPACK_IMPORTED_MODULE_0__.fromString(result.numOrHex);\n } else if (result.numOrHex.length == 40) {\n evmAddress = _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromString(result.numOrHex);\n } else {\n aliasKey = _PublicKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromString(result.numOrHex);\n }\n }\n\n return new AccountId(shard, realm, num, aliasKey, evmAddress);\n }\n\n /**\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @param {EvmAddress | string} evmAddress\n * @returns {AccountId}\n */\n static fromEvmAddress(shard, realm, evmAddress) {\n return new AccountId(\n shard,\n realm,\n 0,\n undefined,\n typeof evmAddress === \"string\"\n ? _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromString(evmAddress)\n : evmAddress\n );\n }\n\n /**\n * @summary Accepts an evm address only as `EvmAddress` type\n * @param {EvmAddress} evmAddress\n * @returns {AccountId}\n */\n static fromEvmPublicAddress(evmAddress) {\n return new AccountId(0, 0, 0, undefined, evmAddress);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IAccountID} id\n * @returns {AccountId}\n */\n static _fromProtobuf(id) {\n let aliasKey = undefined;\n let evmAddress = undefined;\n\n if (id.alias != null) {\n if (id.alias.length === 20) {\n evmAddress = _EvmAddress_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromBytes(id.alias);\n } else {\n aliasKey = _Key_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufKey(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.Key.decode(id.alias)\n );\n }\n }\n\n if (!(aliasKey instanceof _PublicKey_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])) {\n aliasKey = undefined;\n }\n\n return new AccountId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.accountNum != null ? id.accountNum : 0,\n aliasKey,\n evmAddress\n );\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @returns {?EvmAddress}\n */\n getEvmAddress() {\n return this.evmAddress;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n if (this.aliasKey != null) {\n throw new Error(\n \"cannot calculate checksum with an account ID that has a aliasKey\"\n );\n }\n\n _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_1__.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {AccountId}\n */\n static fromBytes(bytes) {\n return AccountId._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.AccountID.decode(bytes)\n );\n }\n\n /**\n * @param {string} address\n * @returns {AccountId}\n */\n static fromSolidityAddress(address) {\n return new AccountId(..._EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_1__.fromSolidityAddress(address));\n }\n\n /**\n * @returns {string}\n */\n toSolidityAddress() {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_1__.toSolidityAddress([this.shard, this.realm, this.num]);\n }\n\n //TODO remove the comments after we get to HIP-631\n /**\n * @internal\n * @returns {HashgraphProto.proto.IAccountID}\n */\n _toProtobuf() {\n let alias = null;\n //let evmAddress = null;\n\n if (this.aliasKey != null) {\n alias = _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.Key.encode(\n this.aliasKey._toProtobufKey()\n ).finish();\n } else if (this.evmAddress != null) {\n alias = this.evmAddress._bytes;\n }\n\n /* if (this.evmAddress != null) {\n evmAddress = this.evmAddress._bytes;\n } */\n\n return {\n alias,\n accountNum: this.aliasKey != null ? null : this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n //evmAddress,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.AccountID.encode(\n this._toProtobuf()\n ).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n let account = this.num.toString();\n\n if (this.aliasKey != null) {\n account = this.aliasKey.toString();\n } else if (this.evmAddress != null) {\n account = this.evmAddress.toString();\n }\n\n return `${this.shard.toString()}.${this.realm.toString()}.${account}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n if (this.aliasKey != null) {\n throw new Error(\n \"cannot calculate checksum with an account ID that has a aliasKey\"\n );\n }\n\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_1__.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @param {this} other\n * @returns {boolean}\n */\n equals(other) {\n let account = false;\n\n if (this.aliasKey != null && other.aliasKey != null) {\n account = this.aliasKey.equals(other.aliasKey);\n } else if (this.evmAddress != null && other.evmAddress != null) {\n account = this.evmAddress.equals(other.evmAddress);\n } else if (\n this.aliasKey == null &&\n other.aliasKey == null &&\n this.evmAddress == null &&\n other.evmAddress == null\n ) {\n account = this.num.eq(other.num);\n }\n\n return (\n this.shard.eq(other.shard) && this.realm.eq(other.realm) && account\n );\n }\n\n /**\n * @returns {AccountId}\n */\n clone() {\n const id = new AccountId(this);\n id._checksum = this._checksum;\n id.aliasKey = this.aliasKey;\n id.evmAddress = this.evmAddress;\n return id;\n }\n\n /**\n * @param {AccountId} other\n * @returns {number}\n */\n compare(other) {\n let comparison = this.shard.compare(other.shard);\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = this.realm.compare(other.realm);\n if (comparison != 0) {\n return comparison;\n }\n\n if (this.aliasKey != null && other.aliasKey != null) {\n const t = this.aliasKey.toString();\n const o = other.aliasKey.toString();\n\n if (t > o) {\n return 1;\n } else if (t < o) {\n return -1;\n } else {\n return 0;\n }\n } else if (this.evmAddress != null && other.evmAddress != null) {\n const t = this.evmAddress.toString();\n const o = other.evmAddress.toString();\n\n if (t > o) {\n return 1;\n } else if (t < o) {\n return -1;\n } else {\n return 0;\n }\n } else if (\n this.aliasKey == null &&\n other.aliasKey == null &&\n this.evmAddress == null &&\n other.evmAddress == null\n ) {\n return this.num.compare(other.num);\n } else {\n return 1;\n }\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].setAccountIdConstructor(\n (shard, realm, key) => new AccountId(shard, realm, long__WEBPACK_IMPORTED_MODULE_0__.ZERO, key)\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountId.js?"); +/** + * Perform no validations at all for all passed token keys. + */ +TokenKeyValidation.NoValidation = new TokenKeyValidation(1); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenUpdateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountInfo.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountInfo.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountInfo; }\n/* harmony export */ });\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _StakingInfo_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../StakingInfo.js */ \"./node_modules/@hashgraph/sdk/src/StakingInfo.js\");\n/* harmony import */ var _LiveHash_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LiveHash.js */ \"./node_modules/@hashgraph/sdk/src/account/LiveHash.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _TokenRelationshipMap_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TokenRelationshipMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenRelationshipMap.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./HbarAllowance.js\").default} HbarAllowance\n * @typedef {import(\"./TokenAllowance.js\").default} TokenAllowance\n * @typedef {import(\"./TokenNftAllowance.js\").default} TokenNftAllowance\n * @typedef {import(\"../StakingInfo.js\").StakingInfoJson} StakingInfoJson\n */\n\n/**\n * @typedef {object} AccountInfoJson\n * @property {string} accountId\n * @property {?string} contractAccountId\n * @property {boolean} isDeleted\n * @property {?string} proxyAccountId\n * @property {string} proxyReceived\n * @property {?string} key\n * @property {string} balance\n * @property {string} sendRecordThreshold\n * @property {string} receiveRecordThreshold\n * @property {boolean} isReceiverSignatureRequired\n * @property {string} expirationTime\n * @property {string} autoRenewPeriod\n * @property {string} accountMemo\n * @property {string} ownedNfts\n * @property {string} maxAutomaticTokenAssociations\n * @property {?string} aliasKey\n * @property {?string} ledgerId\n * @property {?string} ethereumNonce\n * @property {?StakingInfoJson} stakingInfo\n */\n\n/**\n * Current information about an account, including the balance.\n */\nclass AccountInfo {\n /**\n * @private\n * @param {object} props\n * @param {AccountId} props.accountId\n * @param {?string} props.contractAccountId\n * @param {boolean} props.isDeleted\n * @param {?AccountId} props.proxyAccountId\n * @param {Hbar} props.proxyReceived\n * @param {Key} props.key\n * @param {Hbar} props.balance\n * @param {Hbar} props.sendRecordThreshold\n * @param {Hbar} props.receiveRecordThreshold\n * @param {boolean} props.isReceiverSignatureRequired\n * @param {Timestamp} props.expirationTime\n * @param {Duration} props.autoRenewPeriod\n * @param {LiveHash[]} props.liveHashes\n * @param {TokenRelationshipMap} props.tokenRelationships\n * @param {string} props.accountMemo\n * @param {Long} props.ownedNfts\n * @param {Long} props.maxAutomaticTokenAssociations\n * @param {PublicKey | null} props.aliasKey\n * @param {LedgerId | null} props.ledgerId\n * @param {HbarAllowance[]} props.hbarAllowances\n * @param {TokenAllowance[]} props.tokenAllowances\n * @param {TokenNftAllowance[]} props.nftAllowances\n * @param {?Long} props.ethereumNonce\n * @param {?StakingInfo} props.stakingInfo\n */\n constructor(props) {\n /**\n * The account ID for which this information applies.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * The Contract Account ID comprising of both the contract instance and the cryptocurrency\n * account owned by the contract instance, in the format used by Solidity.\n *\n * @readonly\n */\n this.contractAccountId = props.contractAccountId;\n\n /**\n * If true, then this account has been deleted, it will disappear when it expires, and\n * all transactions for it will fail except the transaction to extend its expiration date.\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * @deprecated\n *\n * The Account ID of the account to which this is proxy staked. If proxyAccountID is null,\n * or is an invalid account, or is an account that isn't a node, then this account is\n * automatically proxy staked to a node chosen by the network, but without earning payments.\n * If the proxyAccountID account refuses to accept proxy staking , or if it is not currently\n * running a node, then it will behave as if proxyAccountID was null.\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId = props.proxyAccountId;\n\n /**\n * The total number of tinybars proxy staked to this account.\n *\n * @readonly\n */\n this.proxyReceived = props.proxyReceived;\n\n /**\n * The key for the account, which must sign in order to transfer out, or to modify the account\n * in any way other than extending its expiration date.\n *\n * @readonly\n */\n this.key = props.key;\n\n /**\n * The current balance of account.\n *\n * @readonly\n */\n this.balance = props.balance;\n\n /**\n * The threshold amount (in tinybars) for which an account record is created (and this account\n * charged for them) for any send/withdraw transaction.\n *\n * @readonly\n */\n this.sendRecordThreshold = props.sendRecordThreshold;\n\n /**\n * The threshold amount (in tinybars) for which an account record is created\n * (and this account charged for them) for any transaction above this amount.\n *\n * @readonly\n */\n this.receiveRecordThreshold = props.receiveRecordThreshold;\n\n /**\n * If true, no transaction can transfer to this account unless signed by this account's key.\n *\n * @readonly\n */\n this.isReceiverSignatureRequired = props.isReceiverSignatureRequired;\n\n /**\n * The TimeStamp time at which this account is set to expire.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * The duration for expiration time will extend every this many seconds. If there are\n * insufficient funds, then it extends as long as possible. If it is empty when it\n * expires, then it is deleted.\n *\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /** @readonly */\n this.liveHashes = props.liveHashes;\n\n /** @readonly */\n this.tokenRelationships = props.tokenRelationships;\n\n /** @readonly */\n this.accountMemo = props.accountMemo;\n\n /** @readonly */\n this.ownedNfts = props.ownedNfts;\n\n /** @readonly */\n this.maxAutomaticTokenAssociations =\n props.maxAutomaticTokenAssociations;\n\n this.aliasKey = props.aliasKey;\n\n this.ledgerId = props.ledgerId;\n /*\n * @deprecated - no longer supported\n */\n this.hbarAllowances = props.hbarAllowances;\n /*\n * @deprecated - no longer supported\n */\n this.tokenAllowances = props.tokenAllowances;\n /*\n * @deprecated - no longer supported\n */\n this.nftAllowances = props.nftAllowances;\n\n /**\n * The ethereum transaction nonce associated with this account.\n */\n this.ethereumNonce = props.ethereumNonce;\n\n /**\n * Staking metadata for this account.\n */\n this.stakingInfo = props.stakingInfo;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo} info\n * @returns {AccountInfo}\n */\n static _fromProtobuf(info) {\n let aliasKey =\n info.alias != null && info.alias.length > 0\n ? _Key_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]._fromProtobufKey(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__.proto.Key.decode(info.alias)\n )\n : null;\n\n if (!(aliasKey instanceof _PublicKey_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"])) {\n aliasKey = null;\n }\n\n const accountId = _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (info.accountID)\n );\n\n return new AccountInfo({\n accountId,\n contractAccountId:\n info.contractAccountID != null ? info.contractAccountID : null,\n isDeleted: info.deleted != null ? info.deleted : false,\n key: _Key_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]._fromProtobufKey(\n /** @type {HashgraphProto.proto.IKey} */ (info.key)\n ),\n balance: _Hbar_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromTinybars(info.balance != null ? info.balance : 0),\n sendRecordThreshold: _Hbar_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromTinybars(\n info.generateSendRecordThreshold != null\n ? info.generateSendRecordThreshold\n : 0\n ),\n receiveRecordThreshold: _Hbar_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromTinybars(\n info.generateReceiveRecordThreshold != null\n ? info.generateReceiveRecordThreshold\n : 0\n ),\n isReceiverSignatureRequired:\n info.receiverSigRequired != null\n ? info.receiverSigRequired\n : false,\n expirationTime: _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.expirationTime\n )\n ),\n autoRenewPeriod:\n info.autoRenewPeriod != null\n ? new _Duration_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"](\n /** @type {Long} */ (info.autoRenewPeriod.seconds)\n )\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"](0),\n proxyAccountId:\n info.proxyAccountID != null &&\n long__WEBPACK_IMPORTED_MODULE_5__.fromValue(\n /** @type {Long | number} */ (info.proxyAccountID.shardNum)\n ).toInt() !== 0 &&\n long__WEBPACK_IMPORTED_MODULE_5__.fromValue(\n /** @type {Long | number} */ (info.proxyAccountID.realmNum)\n ).toInt() !== 0 &&\n long__WEBPACK_IMPORTED_MODULE_5__.fromValue(\n /** @type {Long | number} */ (\n info.proxyAccountID.accountNum\n )\n ).toInt() !== 0\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(info.proxyAccountID)\n : null,\n proxyReceived: _Hbar_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromTinybars(\n info.proxyReceived != null ? info.proxyReceived : 0\n ),\n liveHashes: (info.liveHashes != null ? info.liveHashes : []).map(\n (hash) => _LiveHash_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(hash)\n ),\n tokenRelationships: _TokenRelationshipMap_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobuf(\n info.tokenRelationships != null ? info.tokenRelationships : []\n ),\n accountMemo: info.memo != null ? info.memo : \"\",\n ownedNfts: info.ownedNfts ? info.ownedNfts : long__WEBPACK_IMPORTED_MODULE_5__.ZERO,\n maxAutomaticTokenAssociations: info.maxAutomaticTokenAssociations\n ? long__WEBPACK_IMPORTED_MODULE_5__.fromNumber(info.maxAutomaticTokenAssociations)\n : long__WEBPACK_IMPORTED_MODULE_5__.ZERO,\n aliasKey,\n ledgerId:\n info.ledgerId != null\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"].fromBytes(info.ledgerId)\n : null,\n hbarAllowances: [],\n tokenAllowances: [],\n nftAllowances: [],\n ethereumNonce:\n info.ethereumNonce != null ? info.ethereumNonce : null,\n stakingInfo:\n info.stakingInfo != null\n ? _StakingInfo_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.stakingInfo)\n : null,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo}\n */\n _toProtobuf() {\n return {\n accountID: this.accountId._toProtobuf(),\n contractAccountID: this.contractAccountId,\n deleted: this.isDeleted,\n proxyAccountID:\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId != null\n ? // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId._toProtobuf()\n : null,\n proxyReceived: this.proxyReceived.toTinybars(),\n key: this.key._toProtobufKey(),\n balance: this.balance.toTinybars(),\n generateSendRecordThreshold: this.sendRecordThreshold.toTinybars(),\n generateReceiveRecordThreshold:\n this.receiveRecordThreshold.toTinybars(),\n receiverSigRequired: this.isReceiverSignatureRequired,\n expirationTime: this.expirationTime._toProtobuf(),\n autoRenewPeriod: this.autoRenewPeriod._toProtobuf(),\n liveHashes: this.liveHashes.map((hash) => hash._toProtobuf()),\n tokenRelationships:\n this.tokenRelationships != null\n ? this.tokenRelationships._toProtobuf()\n : null,\n memo: this.accountMemo,\n ownedNfts: this.ownedNfts,\n maxAutomaticTokenAssociations:\n this.maxAutomaticTokenAssociations.toInt(),\n alias:\n this.aliasKey != null\n ? _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__.proto.Key.encode(\n this.aliasKey._toProtobufKey()\n ).finish()\n : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n ethereumNonce: this.ethereumNonce,\n stakingInfo:\n this.stakingInfo != null\n ? this.stakingInfo._toProtobuf()\n : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {AccountInfo}\n */\n static fromBytes(bytes) {\n return AccountInfo._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__.proto.CryptoGetInfoResponse.AccountInfo.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__.proto.CryptoGetInfoResponse.AccountInfo.encode(\n this._toProtobuf()\n ).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {AccountInfoJson}\n */\n toJSON() {\n return {\n balance: this.balance.toString(),\n accountId: this.accountId.toString(),\n contractAccountId: this.contractAccountId,\n isDeleted: this.isDeleted,\n proxyAccountId:\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId != null\n ? // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId.toString()\n : null,\n proxyReceived: this.proxyReceived.toString(),\n key: this.key != null ? this.key.toString() : null,\n sendRecordThreshold: this.sendRecordThreshold.toString(),\n receiveRecordThreshold: this.receiveRecordThreshold.toString(),\n isReceiverSignatureRequired: this.isReceiverSignatureRequired,\n expirationTime: this.expirationTime.toString(),\n autoRenewPeriod: this.autoRenewPeriod.toString(),\n accountMemo: this.accountMemo,\n ownedNfts: this.ownedNfts.toString(),\n maxAutomaticTokenAssociations:\n this.maxAutomaticTokenAssociations.toString(),\n aliasKey: this.aliasKey != null ? this.aliasKey.toString() : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toString() : null,\n ethereumNonce:\n this.ethereumNonce != null\n ? this.ethereumNonce.toString()\n : null,\n stakingInfo:\n this.stakingInfo != null ? this.stakingInfo.toJSON() : null,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountInfo.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountInfoFlow.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountInfoFlow.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountInfoFlow; }\n/* harmony export */ });\n/* harmony import */ var _AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccountInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountInfoQuery.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/Transaction.js\").default} Transaction\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"./AccountId.js\").default} AccountId\n * @typedef {import(\"../Signer.js\").Signer} Signer\n */\n\nclass AccountInfoFlow {\n /**\n * @param {Client} client\n * @param {AccountId | string} accountId\n * @param {Uint8Array} message\n * @param {Uint8Array} signature\n * @returns {Promise}\n */\n static async verifySignature(client, accountId, message, signature) {\n const info = await new _AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]()\n .setAccountId(accountId)\n .execute(client);\n\n if (info.key instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]) {\n return false;\n }\n\n return /** @type {PublicKey} */ (info.key).verify(message, signature);\n }\n\n /**\n * @param {Client} client\n * @param {AccountId | string} accountId\n * @param {Transaction} transaction\n * @returns {Promise}\n */\n static async verifyTransaction(client, accountId, transaction) {\n const info = await new _AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]()\n .setAccountId(accountId)\n .execute(client);\n\n if (info.key instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]) {\n return false;\n }\n\n return /** @type {PublicKey} */ (info.key).verifyTransaction(\n transaction\n );\n }\n\n /**\n * @param {Signer} signer\n * @param {AccountId | string} accountId\n * @param {Uint8Array} message\n * @param {Uint8Array} signature\n * @returns {Promise}\n */\n static async verifySignatureWithSigner(\n signer,\n accountId,\n message,\n signature\n ) {\n const info = await new _AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]()\n .setAccountId(accountId)\n .executeWithSigner(signer);\n\n if (info.key instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]) {\n return false;\n }\n\n return /** @type {PublicKey} */ (info.key).verify(message, signature);\n }\n\n /**\n * @param {Signer} signer\n * @param {AccountId | string} accountId\n * @param {Transaction} transaction\n * @returns {Promise}\n */\n static async verifyTransactionWithSigner(signer, accountId, transaction) {\n const info = await new _AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]()\n .setAccountId(accountId)\n .executeWithSigner(signer);\n\n if (info.key instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]) {\n return false;\n }\n\n return /** @type {PublicKey} */ (info.key).verifyTransaction(\n transaction\n );\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountInfoFlow.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountInfoQuery.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountInfoQuery.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _AccountInfo_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AccountInfo.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountInfo.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.CryptoGetInfoResponse.IAccountInfo} HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetInfoQuery} HashgraphProto.proto.ICryptoGetInfoQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetInfoResponse} HashgraphProto.proto.ICryptoGetInfoResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @augments {Query}\n */\nclass AccountInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {AccountInfoQuery}\n */\n static _fromProtobuf(query) {\n const info = /** @type {HashgraphProto.proto.ICryptoGetInfoQuery} */ (\n query.cryptoGetInfo\n );\n\n return new AccountInfoQuery({\n accountId:\n info.accountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.accountID)\n : undefined,\n });\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account ID for which the info is being requested.\n *\n * @param {AccountId | string} accountId\n * @returns {AccountInfoQuery}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.getAccountInfo(request);\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptoGetInfo =\n /** @type {HashgraphProto.proto.ICryptoGetInfoResponse} */ (\n response.cryptoGetInfo\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n cryptoGetInfo.header\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const info =\n /** @type {HashgraphProto.proto.ICryptoGetInfoResponse} */ (\n response.cryptoGetInfo\n );\n\n return Promise.resolve(\n _AccountInfo_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.CryptoGetInfoResponse.IAccountInfo} */ (\n info.accountInfo\n )\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n cryptoGetInfo: {\n header,\n accountID:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n return `AccountInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"cryptoGetInfo\", AccountInfoQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountInfoQuery.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenUpdateTransactionBody} HashgraphProto.proto.ITokenUpdateTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -/***/ }), +/** + * @typedef {import("bignumber.js").default} BigNumber + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountRecordsQuery.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountRecordsQuery.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Update a new Hedera™ crypto-currency token. + */ +class TokenUpdateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {string} [props.tokenName] + * @param {string} [props.tokenSymbol] + * @param {AccountId | string} [props.treasuryAccountId] + * @param {Key} [props.adminKey] + * @param {Key} [props.kycKey] + * @param {Key} [props.freezeKey] + * @param {Key} [props.wipeKey] + * @param {Key} [props.supplyKey] + * @param {AccountId | string} [props.autoRenewAccountId] + * @param {Timestamp | Date} [props.expirationTime] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {string} [props.tokenMemo] + * @param {Key} [props.feeScheduleKey] + * @param {Key} [props.pauseKey] + * @param {Key} [props.metadataKey] + * @param {Uint8Array} [props.metadata] + * @param {TokenKeyValidation} [props.keyVerificationMode] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?string} + */ + this._tokenName = null; + + /** + * @private + * @type {?string} + */ + this._tokenSymbol = null; + + /** + * @private + * @type {?AccountId} + */ + this._treasuryAccountId = null; + + /** + * @private + * @type {?Key} + */ + this._adminKey = null; + + /** + * @private + * @type {?Key} + */ + this._kycKey = null; + + /** + * @private + * @type {?Key} + */ + this._freezeKey = null; + + /** + * @private + * @type {?Key} + */ + this._wipeKey = null; + + /** + * @private + * @type {?Key} + */ + this._supplyKey = null; + + /** + * @private + * @type {?AccountId} + */ + this._autoRenewAccountId = null; + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = null; + + /** + * @private + * @type {?Duration} + */ + this._autoRenewPeriod = null; + + /** + * @private + * @type {?string} + */ + this._tokenMemo = null; + + /** + * @private + * @type {?Key} + */ + this._feeScheduleKey = null; + + /** + * @private + * @type {?Key} + */ + this._pauseKey = null; + + /** + * @private + * @type {?Key} + */ + this._metadataKey = null; + + /** + * @private + * @type {?Uint8Array} + */ + this._metadata = null; + + /** + * @private + * @type {?TokenKeyValidation} + * Determines whether the system should check the validity of the passed keys for update. + * Defaults to FULL_VALIDATION + */ + this._keyVerificationMode = TokenKeyValidation.FullValidation; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.tokenName != null) { + this.setTokenName(props.tokenName); + } + + if (props.tokenSymbol != null) { + this.setTokenSymbol(props.tokenSymbol); + } + + if (props.treasuryAccountId != null) { + this.setTreasuryAccountId(props.treasuryAccountId); + } + + if (props.adminKey != null) { + this.setAdminKey(props.adminKey); + } + + if (props.kycKey != null) { + this.setKycKey(props.kycKey); + } + + if (props.freezeKey != null) { + this.setFreezeKey(props.freezeKey); + } + + if (props.wipeKey != null) { + this.setWipeKey(props.wipeKey); + } + + if (props.supplyKey != null) { + this.setSupplyKey(props.supplyKey); + } + + if (props.autoRenewAccountId != null) { + this.setAutoRenewAccountId(props.autoRenewAccountId); + } + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + if (props.tokenMemo != null) { + this.setTokenMemo(props.tokenMemo); + } + + if (props.feeScheduleKey != null) { + this.setFeeScheduleKey(props.feeScheduleKey); + } + + if (props.pauseKey != null) { + this.setPauseKey(props.pauseKey); + } + + if (props.metadataKey != null) { + this.setMetadataKey(props.metadataKey); + } + + if (props.metadata != null) { + this.setMetadata(props.metadata); + } + + if (props.keyVerificationMode != null) { + this.setKeyVerificationMode(props.keyVerificationMode); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenUpdateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const update = + /** @type {HashgraphProto.proto.ITokenUpdateTransactionBody} */ ( + body.tokenUpdate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenUpdateTransaction({ + tokenId: + update.token != null + ? TokenId_TokenId._fromProtobuf(update.token) + : undefined, + tokenName: update.name != null ? update.name : undefined, + tokenSymbol: update.symbol != null ? update.symbol : undefined, + treasuryAccountId: + update.treasury != null + ? AccountId_AccountId._fromProtobuf(update.treasury) + : undefined, + adminKey: + update.adminKey != null + ? src_Key_Key._fromProtobufKey(update.adminKey) + : undefined, + kycKey: + update.kycKey != null + ? src_Key_Key._fromProtobufKey(update.kycKey) + : undefined, + freezeKey: + update.freezeKey != null + ? src_Key_Key._fromProtobufKey(update.freezeKey) + : undefined, + wipeKey: + update.wipeKey != null + ? src_Key_Key._fromProtobufKey(update.wipeKey) + : undefined, + supplyKey: + update.supplyKey != null + ? src_Key_Key._fromProtobufKey(update.supplyKey) + : undefined, + autoRenewAccountId: + update.autoRenewAccount != null + ? AccountId_AccountId._fromProtobuf(update.autoRenewAccount) + : undefined, + expirationTime: + update.expiry != null + ? Timestamp_Timestamp._fromProtobuf(update.expiry) + : undefined, + autoRenewPeriod: + update.autoRenewPeriod != null + ? Duration_Duration._fromProtobuf(update.autoRenewPeriod) + : undefined, + tokenMemo: + update.memo != null + ? update.memo.value != null + ? update.memo.value + : undefined + : undefined, + feeScheduleKey: + update.feeScheduleKey != null + ? src_Key_Key._fromProtobufKey(update.feeScheduleKey) + : undefined, + pauseKey: + update.pauseKey != null + ? src_Key_Key._fromProtobufKey(update.pauseKey) + : undefined, + metadataKey: + update.metadataKey != null + ? src_Key_Key._fromProtobufKey(update.metadataKey) + : undefined, + metadata: + update.metadata != null + ? update.metadata.value != null + ? update.metadata.value + : undefined + : undefined, + keyVerificationMode: + update.keyVerificationMode != null + ? TokenKeyValidation._fromCode( + update.keyVerificationMode, + ) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?string} + */ + get tokenName() { + return this._tokenName; + } + + /** + * @param {string} name + * @returns {this} + */ + setTokenName(name) { + this._requireNotFrozen(); + this._tokenName = name; + + return this; + } + + /** + * @returns {?string} + */ + get tokenSymbol() { + return this._tokenSymbol; + } + + /** + * @param {string} symbol + * @returns {this} + */ + setTokenSymbol(symbol) { + this._requireNotFrozen(); + this._tokenSymbol = symbol; + + return this; + } + + /** + * @returns {?AccountId} + */ + get treasuryAccountId() { + return this._treasuryAccountId; + } + + /** + * @param {AccountId | string} id + * @returns {this} + */ + setTreasuryAccountId(id) { + this._requireNotFrozen(); + this._treasuryAccountId = + typeof id === "string" ? AccountId_AccountId.fromString(id) : id.clone(); + + return this; + } + + /** + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setAdminKey(key) { + this._requireNotFrozen(); + this._adminKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get kycKey() { + return this._kycKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setKycKey(key) { + this._requireNotFrozen(); + this._kycKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get freezeKey() { + return this._freezeKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setFreezeKey(key) { + this._requireNotFrozen(); + this._freezeKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get wipeKey() { + return this._wipeKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setWipeKey(key) { + this._requireNotFrozen(); + this._wipeKey = key; + + return this; + } + + /** + * @returns {?Key} + */ + get supplyKey() { + return this._supplyKey; + } + + /** + * @param {Key} key + * @returns {this} + */ + setSupplyKey(key) { + this._requireNotFrozen(); + this._supplyKey = key; + + return this; + } + + /** + * @deprecated + * @param {Key} key + * @returns {this} + */ + setsupplyKey(key) { + this._requireNotFrozen(); + this._supplyKey = key; + + return this; + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * @param {Timestamp | Date} time + * @returns {this} + */ + setExpirationTime(time) { + this._requireNotFrozen(); + this._expirationTime = + time instanceof Timestamp_Timestamp ? time : Timestamp_Timestamp.fromDate(time); + + return this; + } + + /** + * @returns {?AccountId} + */ + get autoRenewAccountId() { + return this._autoRenewAccountId; + } + + /** + * @param {AccountId | string} id + * @returns {this} + */ + setAutoRenewAccountId(id) { + this._requireNotFrozen(); + this._autoRenewAccountId = + id instanceof AccountId_AccountId ? id : AccountId_AccountId.fromString(id); + + return this; + } + + /** + * @returns {?Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * Set the auto renew period for this token. + * + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @returns {?string} + */ + get tokenMemo() { + return this._tokenMemo; + } + + /** + * @param {string} tokenMemo + * @returns {this} + */ + setTokenMemo(tokenMemo) { + this._requireNotFrozen(); + this._tokenMemo = tokenMemo; + + return this; + } + + /** + * @returns {?Key} + */ + get feeScheduleKey() { + return this._feeScheduleKey; + } + + /** + * @param {Key} feeScheduleKey + * @returns {this} + */ + setFeeScheduleKey(feeScheduleKey) { + this._requireNotFrozen(); + this._feeScheduleKey = feeScheduleKey; + + return this; + } + + /** + * @returns {?Key} + */ + get pauseKey() { + return this._pauseKey; + } + + /** + * @param {Key} pauseKey + * @returns {this} + */ + setPauseKey(pauseKey) { + this._requireNotFrozen(); + this._pauseKey = pauseKey; + return this; + } + + /** + * @returns {?Key} + */ + get metadataKey() { + return this._metadataKey; + } + + /** + * @param {Key} metadataKey + * @returns {this} + */ + setMetadataKey(metadataKey) { + this._requireNotFrozen(); + this._metadataKey = metadataKey; + + return this; + } + + /** + * @returns {?Uint8Array} + */ + get metadata() { + return this._metadata; + } + + /** + * @param {Uint8Array} metadata + * @returns {this} + */ + setMetadata(metadata) { + this._requireNotFrozen(); + this._metadata = metadata; + + return this; + } + + /** + * @returns {?TokenKeyValidation} + */ + get keyVerificationMode() { + return this._keyVerificationMode; + } + + /** + * @param {TokenKeyValidation} keyVerificationMode + * @returns {this} + */ + setKeyVerificationMode(keyVerificationMode) { + this._requireNotFrozen(); + this._keyVerificationMode = keyVerificationMode; + + return this; + } + + /** + * @returns {this} + */ + clearTokenMemo() { + this._requireNotFrozen(); + this._tokenMemo = null; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + + if (this._treasuryAccountId != null) { + this._treasuryAccountId.validateChecksum(client); + } + + if (this._autoRenewAccountId != null) { + this._autoRenewAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.updateToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenUpdate"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenUpdateTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + name: this.tokenName, + symbol: this.tokenSymbol, + treasury: + this._treasuryAccountId != null + ? this._treasuryAccountId._toProtobuf() + : null, + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + kycKey: this._kycKey != null ? this._kycKey._toProtobufKey() : null, + freezeKey: + this._freezeKey != null + ? this._freezeKey._toProtobufKey() + : null, + pauseKey: + this._pauseKey != null ? this._pauseKey._toProtobufKey() : null, + wipeKey: + this._wipeKey != null ? this._wipeKey._toProtobufKey() : null, + supplyKey: + this._supplyKey != null + ? this._supplyKey._toProtobufKey() + : null, + autoRenewAccount: + this._autoRenewAccountId != null + ? this._autoRenewAccountId._toProtobuf() + : null, + expiry: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + autoRenewPeriod: + this._autoRenewPeriod != null + ? this._autoRenewPeriod._toProtobuf() + : null, + memo: + this._tokenMemo != null + ? { + value: this._tokenMemo, + } + : null, + feeScheduleKey: + this._feeScheduleKey != null + ? this._feeScheduleKey._toProtobufKey() + : null, + metadataKey: + this._metadataKey != null + ? this._metadataKey._toProtobufKey() + : null, + metadata: + this._metadata != null + ? { + value: this._metadata, + } + : null, + keyVerificationMode: + this._keyVerificationMode != null + ? this._keyVerificationMode._code + : undefined, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenUpdateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenUpdate", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenUpdateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenWipeTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountRecordsQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_TransactionRecord_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/TransactionRecord.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionRecord.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountRecordsQuery} HashgraphProto.proto.ICryptoGetAccountRecordsQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountRecordsResponse} HashgraphProto.proto.ICryptoGetAccountRecordsResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionRecord} HashgraphProto.proto.ITransactionRecord\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Get all the records for an account for any transfers into it and out of it,\n * that were above the threshold, during the last 25 hours.\n *\n * @augments {Query}\n */\nclass AccountRecordsQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?AccountId}\n * @private\n */\n this._accountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {AccountRecordsQuery}\n */\n static _fromProtobuf(query) {\n const records =\n /** @type {HashgraphProto.proto.ICryptoGetAccountRecordsQuery} */ (\n query.cryptoGetAccountRecords\n );\n\n return new AccountRecordsQuery({\n accountId:\n records.accountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(records.accountID)\n : undefined,\n });\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account ID for which the records are being requested.\n *\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.getAccountRecords(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptoGetAccountRecords =\n /** @type {HashgraphProto.proto.ICryptoGetAccountRecordsResponse} */ (\n response.cryptoGetAccountRecords\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n cryptoGetAccountRecords.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const cryptoGetAccountRecords =\n /** @type {HashgraphProto.proto.ICryptoGetAccountRecordsResponse} */ (\n response.cryptoGetAccountRecords\n );\n const records =\n /** @type {HashgraphProto.proto.ITransactionRecord[]} */ (\n cryptoGetAccountRecords.records\n );\n\n return Promise.resolve(\n records.map((record) =>\n _transaction_TransactionRecord_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf({ transactionRecord: record })\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n cryptoGetAccountRecords: {\n header,\n accountID:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `AccountRecordsQuery:${timestamp.toString()}`;\n }\n}\n\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\n \"cryptoGetAccountRecords\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountRecordsQuery._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountRecordsQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountStakersQuery.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountStakersQuery.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountStakersQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _ProxyStaker_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ProxyStaker.js */ \"./node_modules/@hashgraph/sdk/src/account/ProxyStaker.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetStakersQuery} HashgraphProto.proto.ICryptoGetStakersQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetStakersResponse} HashgraphProto.proto.ICryptoGetStakersResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IAllProxyStakers} HashgraphProto.proto.IAllProxyStakers\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Get all the accounts that are proxy staking to this account.\n * For each of them, give the amount currently staked.\n *\n * This is not yet implemented, but will be in a future version of the API.\n *\n * @augments {Query}\n */\nclass AccountStakersQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {(AccountId | string)=} props.accountId\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?AccountId}\n * @private\n */\n this._accountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {AccountStakersQuery}\n */\n static _fromProtobuf(query) {\n const stakers =\n /** @type {HashgraphProto.proto.ICryptoGetStakersQuery} */ (\n query.cryptoGetProxyStakers\n );\n\n return new AccountStakersQuery({\n accountId:\n stakers.accountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(stakers.accountID)\n : undefined,\n });\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account ID for which the stakers are being requested.\n *\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.getStakersByAccountID(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptoGetProxyStakers =\n /** @type {HashgraphProto.proto.ICryptoGetStakersResponse} */ (\n response.cryptoGetProxyStakers\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n cryptoGetProxyStakers.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Promise}\n */\n _mapResponse(response) {\n const cryptoGetProxyStakers =\n /** @type {HashgraphProto.proto.ICryptoGetStakersResponse} */ (\n response.cryptoGetProxyStakers\n );\n const stakers = /** @type {HashgraphProto.proto.IAllProxyStakers} */ (\n cryptoGetProxyStakers.stakers\n );\n\n return Promise.resolve(\n (stakers.proxyStaker != null ? stakers.proxyStaker : []).map(\n (staker) => _ProxyStaker_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(staker)\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n cryptoGetProxyStakers: {\n header,\n accountID:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `AccountStakersQuery:${timestamp.toString()}`;\n }\n}\n\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"cryptoGetProxyStakers\", AccountStakersQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountStakersQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/AccountUpdateTransaction.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/AccountUpdateTransaction.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenWipeAccountTransactionBody} HashgraphProto.proto.ITokenWipeAccountTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AccountUpdateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoUpdateTransactionBody} HashgraphProto.proto.ICryptoUpdateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Change properties for the given account.\n */\nclass AccountUpdateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {AccountId} [props.accountId]\n * @param {Key} [props.key]\n * @param {boolean} [props.receiverSignatureRequired]\n * @param {AccountId} [props.proxyAccountId]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {string} [props.accountMemo]\n * @param {Long | number} [props.maxAutomaticTokenAssociations]\n * @param {Key} [props.aliasKey]\n * @param {AccountId | string} [props.stakedAccountId]\n * @param {Long | number} [props.stakedNodeId]\n * @param {boolean} [props.declineStakingReward]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._key = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this._receiverSignatureRequired = false;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._proxyAccountId = null;\n\n /**\n * @private\n * @type {?Duration}\n */\n this._autoRenewPeriod = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._accountMemo = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._maxAutomaticTokenAssociations = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._aliasKey = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._stakedAccountId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._stakedNodeId = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._declineStakingReward = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n if (props.key != null) {\n this.setKey(props.key);\n }\n\n if (props.receiverSignatureRequired != null) {\n this.setReceiverSignatureRequired(props.receiverSignatureRequired);\n }\n\n if (props.proxyAccountId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setProxyAccountId(props.proxyAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.accountMemo != null) {\n this.setAccountMemo(props.accountMemo);\n }\n\n if (props.maxAutomaticTokenAssociations != null) {\n this.setMaxAutomaticTokenAssociations(\n props.maxAutomaticTokenAssociations\n );\n }\n\n if (props.stakedAccountId != null) {\n this.setStakedAccountId(props.stakedAccountId);\n }\n\n if (props.stakedNodeId != null) {\n this.setStakedNodeId(props.stakedNodeId);\n }\n\n if (props.declineStakingReward != null) {\n this.setDeclineStakingReward(props.declineStakingReward);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {AccountUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const update =\n /** @type {HashgraphProto.proto.ICryptoUpdateTransactionBody} */ (\n body.cryptoUpdateAccount\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new AccountUpdateTransaction({\n accountId:\n update.accountIDToUpdate != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n update.accountIDToUpdate\n )\n )\n : undefined,\n key:\n update.key != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(update.key)\n : undefined,\n receiverSignatureRequired:\n update.receiverSigRequired != null\n ? update.receiverSigRequired\n : undefined,\n proxyAccountId:\n update.proxyAccountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n update.proxyAccountID\n )\n )\n : undefined,\n autoRenewPeriod:\n update.autoRenewPeriod != null\n ? update.autoRenewPeriod.seconds != null\n ? update.autoRenewPeriod.seconds\n : undefined\n : undefined,\n expirationTime:\n update.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(update.expirationTime)\n : undefined,\n accountMemo:\n update.memo != null\n ? update.memo.value != null\n ? update.memo.value\n : undefined\n : undefined,\n maxAutomaticTokenAssociations:\n update.maxAutomaticTokenAssociations != null &&\n update.maxAutomaticTokenAssociations.value != null\n ? long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(\n update.maxAutomaticTokenAssociations.value\n )\n : undefined,\n stakedAccountId:\n update.stakedAccountId != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(update.stakedAccountId)\n : undefined,\n stakedNodeId:\n update.stakedNodeId != null\n ? update.stakedNodeId\n : undefined,\n declineStakingReward:\n update.declineReward != null &&\n Boolean(update.declineReward) == true,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Sets the account ID which is being updated in this transaction.\n *\n * @param {AccountId | string} accountId\n * @returns {AccountUpdateTransaction}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get key() {\n return this._key;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setKey(key) {\n this._requireNotFrozen();\n this._key = key;\n\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get receiverSignatureRequired() {\n return this._receiverSignatureRequired;\n }\n\n /**\n * @param {boolean} receiverSignatureRequired\n * @returns {this}\n */\n setReceiverSignatureRequired(receiverSignatureRequired) {\n this._requireNotFrozen();\n this._receiverSignatureRequired = receiverSignatureRequired;\n\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?AccountId}\n */\n get proxyAccountId() {\n return this._proxyAccountId;\n }\n\n /**\n * @deprecated\n * @param {AccountId} proxyAccountId\n * @returns {this}\n */\n setProxyAccountId(proxyAccountId) {\n this._requireNotFrozen();\n this._proxyAccountId = proxyAccountId;\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * @param {Timestamp | Date} expirationTime\n * @returns {this}\n */\n setExpirationTime(expirationTime) {\n this._requireNotFrozen();\n this._expirationTime =\n expirationTime instanceof Date\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromDate(expirationTime)\n : expirationTime;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get accountMemo() {\n return this._accountMemo;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setAccountMemo(memo) {\n this._requireNotFrozen();\n this._accountMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {this}\n */\n clearAccountMemo() {\n this._requireNotFrozen();\n this._accountMemo = null;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get maxAutomaticTokenAssociations() {\n return this._maxAutomaticTokenAssociations;\n }\n\n /**\n * @param {Long | number} maxAutomaticTokenAssociations\n * @returns {this}\n */\n setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) {\n this._requireNotFrozen();\n this._maxAutomaticTokenAssociations =\n typeof maxAutomaticTokenAssociations === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(maxAutomaticTokenAssociations)\n : maxAutomaticTokenAssociations;\n\n return this;\n }\n\n /**\n * @deprecated - no longer supported\n * @returns {?Key}\n */\n get aliasKey() {\n return null;\n }\n\n /**\n * @deprecated - no longer supported\n * @param {Key} _\n * @returns {this}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setAliasKey(_) {\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get stakedAccountId() {\n return this._stakedAccountId;\n }\n\n /**\n * @param {AccountId | string} stakedAccountId\n * @returns {this}\n */\n setStakedAccountId(stakedAccountId) {\n this._requireNotFrozen();\n this._stakedAccountId =\n typeof stakedAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(stakedAccountId)\n : stakedAccountId;\n\n return this;\n }\n\n /**\n * @returns {this}\n */\n clearStakedAccountId() {\n this._requireNotFrozen();\n this._stakedAccountId = new _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](0, 0, 0);\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stakedNodeId() {\n return this._stakedNodeId;\n }\n\n /**\n * @param {Long | number} stakedNodeId\n * @returns {this}\n */\n setStakedNodeId(stakedNodeId) {\n this._requireNotFrozen();\n this._stakedNodeId = long__WEBPACK_IMPORTED_MODULE_4__.fromValue(stakedNodeId);\n\n return this;\n }\n\n /**\n * @returns {this}\n */\n clearStakedNodeId() {\n this._requireNotFrozen();\n this._stakedNodeId = long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(-1);\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get declineStakingRewards() {\n return this._declineStakingReward;\n }\n\n /**\n * @param {boolean} declineStakingReward\n * @returns {this}\n */\n setDeclineStakingReward(declineStakingReward) {\n this._requireNotFrozen();\n this._declineStakingReward = declineStakingReward;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n\n if (this._proxyAccountId != null) {\n this._proxyAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.updateAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoUpdateAccount\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoUpdateTransactionBody}\n */\n _makeTransactionData() {\n return {\n accountIDToUpdate:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n key: this._key != null ? this._key._toProtobufKey() : null,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n proxyAccountID:\n this._proxyAccountId != null\n ? this._proxyAccountId._toProtobuf()\n : null,\n autoRenewPeriod:\n this._autoRenewPeriod != null\n ? this._autoRenewPeriod._toProtobuf()\n : null,\n receiverSigRequiredWrapper:\n this._receiverSignatureRequired == null\n ? null\n : {\n value: this._receiverSignatureRequired,\n },\n memo:\n this._accountMemo != null\n ? {\n value: this._accountMemo,\n }\n : null,\n maxAutomaticTokenAssociations:\n this._maxAutomaticTokenAssociations != null\n ? { value: this._maxAutomaticTokenAssociations.toInt() }\n : null,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId._toProtobuf()\n : null,\n stakedNodeId: this.stakedNodeId,\n declineReward:\n this.declineStakingRewards != null\n ? { value: this.declineStakingRewards }\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `AccountUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"cryptoUpdateAccount\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountUpdateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/AccountUpdateTransaction.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ }), +/** + * Wipe a new Hedera™ crypto-currency token. + */ +class TokenWipeTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {AccountId | string} [props.accountId] + * @param {Long | number} [props.amount] + * @param {(Long | number)[]} [props.serials] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?AccountId} + */ + this._accountId = null; + + /** + * @private + * @type {?Long[]} + */ + this._serials = []; + + /** + * @private + * @type {?Long} + */ + this._amount = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.accountId != null) { + this.setAccountId(props.accountId); + } + + if (props.amount != null) { + this.setAmount(props.amount); + } + + if (props.serials != null) { + this.setSerials(props.serials); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenWipeTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const wipeToken = + /** @type {HashgraphProto.proto.ITokenWipeAccountTransactionBody} */ ( + body.tokenWipe + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenWipeTransaction({ + tokenId: + wipeToken.token != null + ? TokenId_TokenId._fromProtobuf(wipeToken.token) + : undefined, + accountId: + wipeToken.account != null + ? AccountId_AccountId._fromProtobuf(wipeToken.account) + : undefined, + amount: wipeToken.amount != null ? wipeToken.amount : undefined, + serials: + wipeToken.serialNumbers != null + ? wipeToken.serialNumbers + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TokenId} + */ + get tokenId() { + return this._tokenId; + } + + /** + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {AccountId | string} accountId + * @returns {this} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId.clone(); + + return this; + } + + /** + * @returns {?Long} + */ + get amount() { + return this._amount; + } + + /** + * @param {Long | number} amount + * @returns {this} + */ + setAmount(amount) { + this._requireNotFrozen(); + this._amount = amount instanceof src_long ? amount : src_long.fromValue(amount); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + + if (this._accountId != null) { + this._accountId.validateChecksum(client); + } + } + + /** + * @returns {?Long[]} + */ + get serials() { + return this._serials; + } + + /** + * @param {(Long | number)[]} serials + * @returns {this} + */ + setSerials(serials) { + this._requireNotFrozen(); + this._serials = serials.map((serial) => + typeof serial === "number" ? src_long.fromNumber(serial) : serial, + ); + + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.wipeTokenAccount(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenWipe"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenWipeAccountTransactionBody} + */ + _makeTransactionData() { + return { + amount: this._amount, + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + account: + this._accountId != null ? this._accountId._toProtobuf() : null, + serialNumbers: this.serials, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenWipeTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenWipe", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenWipeTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicCreateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/HbarAllowance.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/HbarAllowance.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ HbarAllowance; }\n/* harmony export */ });\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IGrantedCryptoAllowance} HashgraphProto.proto.IGrantedCryptoAllowance\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoAllowance} HashgraphProto.proto.ICryptoAllowance\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\nclass HbarAllowance {\n /**\n * @internal\n * @param {object} props\n * @param {AccountId | null} props.spenderAccountId\n * @param {AccountId | null} props.ownerAccountId\n * @param {Hbar | null} props.amount\n */\n constructor(props) {\n /**\n * The account ID of the hbar allowance spender.\n *\n * @readonly\n */\n this.spenderAccountId = props.spenderAccountId;\n\n /**\n * The account ID of the hbar allowance owner.\n *\n * @readonly\n */\n this.ownerAccountId = props.ownerAccountId;\n\n /**\n * The current balance of the spender's allowance in tinybars.\n *\n * @readonly\n */\n this.amount = props.amount;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ICryptoAllowance} allowance\n * @returns {HbarAllowance}\n */\n static _fromProtobuf(allowance) {\n return new HbarAllowance({\n spenderAccountId: _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n allowance.spender\n )\n ),\n ownerAccountId:\n allowance.owner != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /**@type {HashgraphProto.proto.IAccountID}*/ (\n allowance.owner\n )\n )\n : null,\n amount: _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(\n allowance.amount != null ? allowance.amount : 0\n ),\n });\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IGrantedCryptoAllowance} allowance\n * @param {AccountId} ownerAccountId\n * @returns {HbarAllowance}\n */\n static _fromGrantedProtobuf(allowance, ownerAccountId) {\n return new HbarAllowance({\n spenderAccountId: _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n allowance.spender\n )\n ),\n ownerAccountId,\n amount: _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(\n allowance.amount != null ? allowance.amount : 0\n ),\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ICryptoAllowance}\n */\n _toProtobuf() {\n return {\n owner:\n this.ownerAccountId != null\n ? this.ownerAccountId._toProtobuf()\n : null,\n spender:\n this.spenderAccountId != null\n ? this.spenderAccountId._toProtobuf()\n : null,\n amount: this.amount != null ? this.amount.toTinybars() : null,\n };\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this.spenderAccountId != null) {\n this.spenderAccountId.validateChecksum(client);\n }\n\n if (this.spenderAccountId != null) {\n this.spenderAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {object}\n */\n toJSON() {\n return {\n ownerAccountId:\n this.ownerAccountId != null\n ? this.ownerAccountId.toString()\n : null,\n spenderAccountId:\n this.spenderAccountId != null\n ? this.spenderAccountId.toString()\n : null,\n amount: this.amount != null ? this.amount.toString() : null,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/HbarAllowance.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/HbarTransferMap.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/HbarTransferMap.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ HbarTransferMap; }\n/* harmony export */ });\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransferList} HashgraphProto.proto.ITransferList\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../long.js\").LongObject} LongObject\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass HbarTransferMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n constructor() {\n super((s) => _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n\n /**\n * @param {HashgraphProto.proto.ITransferList} transfers\n * @returns {HbarTransferMap}\n */\n static _fromProtobuf(transfers) {\n const accountTransfers = new HbarTransferMap();\n\n for (const transfer of transfers.accountAmounts != null\n ? transfers.accountAmounts\n : []) {\n const account = _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n transfer.accountID\n )\n );\n\n accountTransfers._set(\n account,\n _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(/** @type {Long} */ (transfer.amount))\n );\n }\n\n return accountTransfers;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/HbarTransferMap.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IConsensusCreateTopicTransactionBody} HashgraphProto.proto.IConsensusCreateTopicTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/LiveHash.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/LiveHash.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ LiveHash; }\n/* harmony export */ });\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.ILiveHash} HashgraphProto.proto.ILiveHash\n * @typedef {import(\"@hashgraph/proto\").proto.IDuration} HashgraphProto.proto.IDuration\n */\n\n/**\n * Response when the client sends the node CryptoGetInfoQuery.\n */\nclass LiveHash {\n /**\n * @private\n * @param {object} props\n * @param {AccountId} props.accountId\n * @param {Uint8Array} props.hash\n * @param {KeyList} props.keys\n * @param {Duration} props.duration\n */\n constructor(props) {\n /** @readonly */\n this.accountId = props.accountId;\n\n /** @readonly */\n this.hash = props.hash;\n\n /** @readonly */\n this.keys = props.keys;\n\n /** @readonly */\n this.duration = props.duration;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ILiveHash} liveHash\n * @returns {LiveHash}\n */\n static _fromProtobuf(liveHash) {\n const liveHash_ = /** @type {HashgraphProto.proto.ILiveHash} */ (\n liveHash\n );\n\n return new LiveHash({\n accountId: _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n liveHash_.accountId\n )\n ),\n hash: liveHash_.hash != null ? liveHash_.hash : new Uint8Array(),\n keys:\n liveHash_.keys != null\n ? _KeyList_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].__fromProtobufKeyList(liveHash_.keys)\n : new _KeyList_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](),\n duration: _Duration_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IDuration} */ (\n liveHash_.duration\n )\n ),\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ILiveHash}\n */\n _toProtobuf() {\n return {\n accountId: this.accountId._toProtobuf(),\n hash: this.hash,\n keys: this.keys._toProtobufKey().keyList,\n duration: this.duration._toProtobuf(),\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/LiveHash.js?"); +/** + * Create a topic to be used for consensus. + */ +class TopicCreateTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {Key} [props.adminKey] + * @param {Key} [props.submitKey] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {AccountId | string} [props.autoRenewAccountId] + * @param {string} [props.topicMemo] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?Key} + */ + this._adminKey = null; + + /** + * @private + * @type {?Key} + */ + this._submitKey = null; + + /** + * @private + * @type {?AccountId} + */ + this._autoRenewAccountId = null; + + /** + * @private + * @type {Duration} + */ + this._autoRenewPeriod = new Duration_Duration(DEFAULT_AUTO_RENEW_PERIOD); + + /** + * @private + * @type {?string} + */ + this._topicMemo = null; + + if (props.adminKey != null) { + this.setAdminKey(props.adminKey); + } + + if (props.submitKey != null) { + this.setSubmitKey(props.submitKey); + } + + if (props.autoRenewAccountId != null) { + this.setAutoRenewAccountId(props.autoRenewAccountId); + } + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + if (props.topicMemo != null) { + this.setTopicMemo(props.topicMemo); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TopicCreateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const create = + /** @type {HashgraphProto.proto.IConsensusCreateTopicTransactionBody} */ ( + body.consensusCreateTopic + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TopicCreateTransaction({ + adminKey: + create.adminKey != null + ? src_Key_Key._fromProtobufKey(create.adminKey) + : undefined, + submitKey: + create.submitKey != null + ? src_Key_Key._fromProtobufKey(create.submitKey) + : undefined, + autoRenewAccountId: + create.autoRenewAccount != null + ? AccountId_AccountId._fromProtobuf(create.autoRenewAccount) + : undefined, + autoRenewPeriod: + create.autoRenewPeriod != null + ? create.autoRenewPeriod.seconds != null + ? create.autoRenewPeriod.seconds + : undefined + : undefined, + topicMemo: create.memo != null ? create.memo : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @deprecated - Use `getTopicMemo()` instead + * @returns {?string} + */ + get topicMemo() { + return this._topicMemo; + } + + /** + * @returns {?string} + */ + getTopicMemo() { + return this._topicMemo; + } + + /** + * @param {string} topicMemo + * @returns {this} + */ + setTopicMemo(topicMemo) { + this._requireNotFrozen(); + this._topicMemo = topicMemo; + + return this; + } + + /** + * @deprecated - Use `getAdminKey()` instead + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @returns {?Key} + */ + getAdminKey() { + return this._adminKey; + } + + /** + * @param {Key} adminKey + * @returns {this} + */ + setAdminKey(adminKey) { + this._requireNotFrozen(); + this._adminKey = adminKey; + + return this; + } + + /** + * @deprecated - Use `getSubmitKey()` instead + * @returns {?Key} + */ + get submitKey() { + return this._submitKey; + } + + /** + * @returns {?Key} + */ + getSubmitKey() { + return this._submitKey; + } + + /** + * @param {Key} submitKey + * @returns {this} + */ + setSubmitKey(submitKey) { + this._requireNotFrozen(); + this._submitKey = submitKey; + + return this; + } + + /** + * @deprecated - Use `getAutoRenewAccountId()` instead + * @returns {?AccountId} + */ + get autoRenewAccountId() { + return this._autoRenewAccountId; + } + + /** + * @returns {?AccountId} + */ + getAutoRenewAccountId() { + return this._autoRenewAccountId; + } + + /** + * @param {AccountId | string} autoRenewAccountId + * @returns {this} + */ + setAutoRenewAccountId(autoRenewAccountId) { + this._requireNotFrozen(); + this._autoRenewAccountId = + autoRenewAccountId instanceof AccountId_AccountId + ? autoRenewAccountId + : AccountId_AccountId.fromString(autoRenewAccountId); + + return this; + } + + /** + * @deprecated - Use `getAutoRenewPeriod()` instead + * @returns {Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * @returns {Duration} + */ + getAutoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * Set the auto renew period for this account. + * + * @param {Duration | Long | number} autoRenewPeriod + * @returns {this} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._autoRenewAccountId != null) { + this._autoRenewAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.consensus.createTopic(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "consensusCreateTopic"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IConsensusCreateTopicTransactionBody} + */ + _makeTransactionData() { + return { + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + submitKey: + this._submitKey != null + ? this._submitKey._toProtobufKey() + : null, + autoRenewAccount: + this._autoRenewAccountId != null + ? this._autoRenewAccountId._toProtobuf() + : null, + autoRenewPeriod: this._autoRenewPeriod._toProtobuf(), + memo: this._topicMemo, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TopicCreateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "consensusCreateTopic", + // eslint-disable-next-line @typescript-eslint/unbound-method + TopicCreateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/LiveHashAddTransaction.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/LiveHashAddTransaction.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ LiveHashAddTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoAddLiveHashTransactionBody} HashgraphProto.proto.ICryptoAddLiveHashTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ILiveHash} HashgraphProto.proto.ILiveHash\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\nclass LiveHashAddTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.hash]\n * @param {Key[]} [props.keys]\n * @param {Duration | Long | number} [props.duration]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._hash = null;\n\n /**\n * @private\n * @type {?Key[]}\n */\n this._keys = null;\n\n /**\n * @private\n * @type {?Duration}\n */\n this._duration = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.hash != null) {\n this.setHash(props.hash);\n }\n\n if (props.keys != null) {\n this.setKeys(props.keys);\n }\n\n if (props.duration != null) {\n this.setDuration(props.duration);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {LiveHashAddTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const hashes =\n /** @type {HashgraphProto.proto.ICryptoAddLiveHashTransactionBody} */ (\n body.cryptoAddLiveHash\n );\n const liveHash_ = /** @type {HashgraphProto.proto.ILiveHash} */ (\n hashes.liveHash\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new LiveHashAddTransaction({\n hash: liveHash_.hash != null ? liveHash_.hash : undefined,\n keys:\n liveHash_.keys != null\n ? liveHash_.keys.keys != null\n ? liveHash_.keys.keys.map((key) =>\n _Key_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufKey(key)\n )\n : undefined\n : undefined,\n duration:\n liveHash_.duration != null\n ? liveHash_.duration.seconds != null\n ? liveHash_.duration.seconds\n : undefined\n : undefined,\n accountId:\n liveHash_.accountId != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(liveHash_.accountId)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get hash() {\n return this._hash;\n }\n\n /**\n * @param {Uint8Array} hash\n * @returns {LiveHashAddTransaction}\n */\n setHash(hash) {\n this._requireNotFrozen();\n this._hash = hash;\n\n return this;\n }\n\n /**\n * @returns {?Key[]}\n */\n get keys() {\n return this._keys;\n }\n\n /**\n * @param {Key[] | KeyList} keys\n * @returns {LiveHashAddTransaction}\n */\n setKeys(keys) {\n this._requireNotFrozen();\n this._keys = keys instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"] ? keys.toArray() : keys;\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get duration() {\n return this._duration;\n }\n\n /**\n * @param {Duration | Long | number} duration\n * @returns {LiveHashAddTransaction}\n */\n setDuration(duration) {\n this._requireNotFrozen();\n this._duration =\n duration instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] ? duration : new _Duration_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](duration);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {LiveHashAddTransaction}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.addLiveHash(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoAddLiveHash\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoAddLiveHashTransactionBody}\n */\n _makeTransactionData() {\n return {\n liveHash: {\n hash: this._hash,\n keys:\n this._keys != null\n ? {\n keys: this._keys.map((key) =>\n key._toProtobufKey()\n ),\n }\n : undefined,\n duration:\n this._duration != null\n ? this._duration._toProtobuf()\n : null,\n accountId:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `LiveHashAddTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"cryptoAddLiveHash\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n LiveHashAddTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/LiveHashAddTransaction.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IConsensusDeleteTopicTransactionBody} HashgraphProto.proto.IConsensusDeleteTopicTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/LiveHashDeleteTransaction.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/LiveHashDeleteTransaction.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ LiveHashDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoDeleteLiveHashTransactionBody} HashgraphProto.proto.ICryptoDeleteLiveHashTransactionBody\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\nclass LiveHashDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.hash]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._hash = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.hash != null) {\n this.setHash(props.hash);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {LiveHashDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const hashes =\n /** @type {HashgraphProto.proto.ICryptoDeleteLiveHashTransactionBody} */ (\n body.cryptoDeleteLiveHash\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new LiveHashDeleteTransaction({\n hash:\n hashes.liveHashToDelete != null\n ? hashes.liveHashToDelete\n : undefined,\n accountId:\n hashes.accountOfLiveHash != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(hashes.accountOfLiveHash)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get hash() {\n return this._hash;\n }\n\n /**\n * @param {Uint8Array} hash\n * @returns {LiveHashDeleteTransaction}\n */\n setHash(hash) {\n this._requireNotFrozen();\n this._hash = hash;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {LiveHashDeleteTransaction}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.deleteLiveHash(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoDeleteLiveHash\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoDeleteLiveHashTransactionBody}\n */\n _makeTransactionData() {\n return {\n liveHashToDelete: this._hash,\n accountOfLiveHash:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `LiveHashDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"cryptoDeleteLiveHash\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n LiveHashDeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/LiveHashDeleteTransaction.js?"); +/** + * Delete a topic. + * + * No more transactions or queries on the topic will succeed. + * + * If an adminKey is set, this transaction must be signed by that key. + * If there is no adminKey, this transaction will fail with Status#Unautorized. + */ +class TopicDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {TopicId | string} [props.topicId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TopicId} + */ + this._topicId = null; + + if (props.topicId != null) { + this.setTopicId(props.topicId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TopicDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const topicDelete = + /** @type {HashgraphProto.proto.IConsensusDeleteTopicTransactionBody} */ ( + body.consensusDeleteTopic + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TopicDeleteTransaction({ + topicId: + topicDelete.topicID != null + ? TopicId_TopicId._fromProtobuf(topicDelete.topicID) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TopicId} + */ + get topicId() { + return this._topicId; + } + + /** + * Set the topic ID which is being deleted in this transaction. + * + * @param {TopicId | string} topicId + * @returns {TopicDeleteTransaction} + */ + setTopicId(topicId) { + this._requireNotFrozen(); + this._topicId = + typeof topicId === "string" + ? TopicId_TopicId.fromString(topicId) + : topicId.clone(); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._topicId != null) { + this._topicId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.consensus.deleteTopic(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "consensusDeleteTopic"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IConsensusDeleteTopicTransactionBody} + */ + _makeTransactionData() { + return { + topicID: this._topicId != null ? this._topicId._toProtobuf() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TopicDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "consensusDeleteTopic", + // eslint-disable-next-line @typescript-eslint/unbound-method + TopicDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicInfo.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/LiveHashQuery.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/LiveHashQuery.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ LiveHashQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _LiveHash_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LiveHash.js */ \"./node_modules/@hashgraph/sdk/src/account/LiveHash.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetLiveHashQuery} HashgraphProto.proto.ICryptoGetLiveHashQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetLiveHashResponse} HashgraphProto.proto.ICryptoGetLiveHashResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ILiveHash} HashgraphProto.proto.ILiveHash\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @augments {Query}\n */\nclass LiveHashQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {AccountId | string} [props.accountId]\n * @param {Uint8Array} [props.hash]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?AccountId}\n * @private\n */\n this._accountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n /**\n * @type {?Uint8Array}\n * @private\n */\n this._hash = null;\n\n if (props.hash != null) {\n this.setHash(props.hash);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {LiveHashQuery}\n */\n static _fromProtobuf(query) {\n const hash =\n /** @type {HashgraphProto.proto.ICryptoGetLiveHashQuery} */ (\n query.cryptoGetLiveHash\n );\n\n return new LiveHashQuery({\n accountId:\n hash.accountID != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(hash.accountID)\n : undefined,\n hash: hash.hash != null ? hash.hash : undefined,\n });\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account to which the livehash is associated.\n *\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n accountId instanceof _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? accountId\n : _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId);\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get liveHash() {\n return this._hash;\n }\n\n /**\n * Set the SHA-384 data in the livehash.\n *\n * @param {Uint8Array} hash\n * @returns {this}\n */\n setHash(hash) {\n this._hash = hash;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.getLiveHash(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptoGetLiveHash =\n /** @type {HashgraphProto.proto.ICryptoGetLiveHashResponse} */ (\n response.cryptoGetLiveHash\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n cryptoGetLiveHash.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Promise}\n */\n _mapResponse(response) {\n const hashes =\n /** @type {HashgraphProto.proto.ICryptoGetLiveHashResponse} */ (\n response.cryptoGetLiveHash\n );\n\n return Promise.resolve(\n _LiveHash_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ILiveHash} */ (hashes.liveHash)\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n cryptoGetLiveHash: {\n header,\n accountID:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n hash: this._hash,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `LiveHashQuery:${timestamp.toString()}`;\n }\n}\n\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"cryptoGetLiveHash\", LiveHashQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/LiveHashQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/NullableTokenDecimalMap.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/NullableTokenDecimalMap.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ NullableTokenDecimalMap; }\n/* harmony export */ });\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HashgraphProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass NullableTokenDecimalMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n constructor() {\n super((s) => _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/NullableTokenDecimalMap.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/ProxyStaker.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/ProxyStaker.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ProxyStaker; }\n/* harmony export */ });\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IProxyStaker} HashgraphProto.proto.IProxyStaker\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * An account, and the amount that it sends or receives during a cryptocurrency transfer.\n */\nclass ProxyStaker {\n /**\n * @private\n * @param {object} props\n * @param {AccountId} props.accountId\n * @param {number | string | Long | BigNumber | Hbar} props.amount\n */\n constructor(props) {\n /**\n * The Account ID that sends or receives cryptocurrency.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * The amount of tinybars that the account sends(negative)\n * or receives(positive).\n *\n * @readonly\n */\n this.amount =\n props.amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? props.amount\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](props.amount);\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IProxyStaker} transfer\n * @returns {ProxyStaker}\n */\n static _fromProtobuf(transfer) {\n return new ProxyStaker({\n accountId: _AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n transfer.accountID\n )\n ),\n amount: _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(\n transfer.amount != null ? transfer.amount : 0\n ),\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IProxyStaker}\n */\n _toProtobuf() {\n return {\n accountID: this.accountId._toProtobuf(),\n amount: this.amount.toTinybars(),\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/ProxyStaker.js?"); -/***/ }), +/** + * Current state of a topic. + */ +class TopicInfo { + /** + * @private + * @param {object} props + * @param {TopicId} props.topicId + * @param {string} props.topicMemo + * @param {Uint8Array} props.runningHash + * @param {Long} props.sequenceNumber + * @param {?Timestamp} props.expirationTime + * @param {?Key} props.adminKey + * @param {?Key} props.submitKey + * @param {?Duration} props.autoRenewPeriod + * @param {?AccountId} props.autoRenewAccountId + * @param {LedgerId|null} props.ledgerId + */ + constructor(props) { + /** + * The ID of the topic for which information is requested. + * + * @readonly + */ + this.topicId = props.topicId; + + /** + * Short publicly visible memo about the topic. No guarantee of uniqueness. + * + * @readonly + */ + this.topicMemo = props.topicMemo; + + /** + * SHA-384 running hash of (previousRunningHash, topicId, consensusTimestamp, sequenceNumber, message). + * + * @readonly + */ + this.runningHash = props.runningHash; + + /** + * Sequence number (starting at 1 for the first submitMessage) of messages on the topic. + * + * @readonly + */ + this.sequenceNumber = props.sequenceNumber; + + /** + * Effective consensus timestamp at (and after) which submitMessage calls will no longer succeed on the topic. + * + * @readonly + */ + this.expirationTime = props.expirationTime; + + /** + * Access control for update/delete of the topic. Null if there is no key. + * + * @readonly + */ + this.adminKey = props.adminKey; + + /** + * Access control for ConsensusService.submitMessage. Null if there is no key. + * + * @readonly + */ + this.submitKey = props.submitKey; + + /** + * @readonly + */ + this.autoRenewPeriod = props.autoRenewPeriod; + + /** + * @readonly + */ + this.autoRenewAccountId = props.autoRenewAccountId; + + this.ledgerId = props.ledgerId; + + Object.freeze(this); + } + + /** + * @internal + * @param {HashgraphProto.proto.IConsensusGetTopicInfoResponse} infoResponse + * @returns {TopicInfo} + */ + static _fromProtobuf(infoResponse) { + const info = /** @type {HashgraphProto.proto.IConsensusTopicInfo} */ ( + infoResponse.topicInfo + ); + + return new TopicInfo({ + topicId: TopicId_TopicId._fromProtobuf( + /** @type {HashgraphProto.proto.ITopicID} */ ( + infoResponse.topicID + ), + ), + topicMemo: info.memo != null ? info.memo : "", + runningHash: + info.runningHash != null ? info.runningHash : new Uint8Array(), + sequenceNumber: + info.sequenceNumber != null + ? info.sequenceNumber instanceof src_long + ? info.sequenceNumber + : src_long.fromValue(info.sequenceNumber) + : src_long.ZERO, + expirationTime: + info.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(info.expirationTime) + : null, + adminKey: + info.adminKey != null + ? src_Key_Key._fromProtobufKey(info.adminKey) + : null, + submitKey: + info.submitKey != null + ? src_Key_Key._fromProtobufKey(info.submitKey) + : null, + autoRenewPeriod: + info.autoRenewPeriod != null + ? new Duration_Duration( + /** @type {Long} */ (info.autoRenewPeriod.seconds), + ) + : null, + autoRenewAccountId: + info.autoRenewAccount != null + ? AccountId_AccountId._fromProtobuf(info.autoRenewAccount) + : null, + ledgerId: + info.ledgerId != null + ? LedgerId.fromBytes(info.ledgerId) + : null, + }); + } + + /** + * @internal + * @returns {HashgraphProto.proto.IConsensusGetTopicInfoResponse} + */ + _toProtobuf() { + return { + topicID: this.topicId._toProtobuf(), + topicInfo: { + memo: this.topicMemo, + runningHash: this.runningHash, + sequenceNumber: this.sequenceNumber, + expirationTime: + this.expirationTime != null + ? this.expirationTime._toProtobuf() + : null, + adminKey: + this.adminKey != null + ? this.adminKey._toProtobufKey() + : null, + submitKey: + this.submitKey != null + ? this.submitKey._toProtobufKey() + : null, + autoRenewPeriod: + this.autoRenewPeriod != null + ? this.autoRenewPeriod._toProtobuf() + : null, + autoRenewAccount: + this.autoRenewAccountId != null + ? this.autoRenewAccountId._toProtobuf() + : null, + }, + }; + } + + /** + * @param {Uint8Array} bytes + * @returns {TopicInfo} + */ + static fromBytes(bytes) { + return TopicInfo._fromProtobuf({ + topicInfo: lib.proto.ConsensusTopicInfo.decode(bytes), + }); + } + + /** + * @returns {Uint8Array} + */ + toBytes() { + return lib.proto.ConsensusTopicInfo.encode( + /** @type {HashgraphProto.proto.IConsensusTopicInfo} */ ( + this._toProtobuf().topicInfo + ), + ).finish(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicInfoQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenAllowance.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenAllowance.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenAllowance; }\n/* harmony export */ });\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IGrantedTokenAllowance} HashgraphProto.proto.IGrantedTokenAllowance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenAllowance} HashgraphProto.proto.ITokenAllowance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\nclass TokenAllowance {\n /**\n * @internal\n * @param {object} props\n * @param {TokenId} props.tokenId\n * @param {AccountId | null} props.spenderAccountId\n * @param {AccountId | null} props.ownerAccountId\n * @param {Long | null} props.amount\n */\n constructor(props) {\n /**\n * The token that the allowance pertains to.\n *\n * @readonly\n */\n this.tokenId = props.tokenId;\n\n /**\n * The account ID of the spender of the hbar allowance.\n *\n * @readonly\n */\n this.spenderAccountId = props.spenderAccountId;\n\n /**\n * The account ID of the owner of the hbar allowance.\n *\n * @readonly\n */\n this.ownerAccountId = props.ownerAccountId;\n\n /**\n * The current balance of the spender's token allowance.\n * **NOTE**: If `null`, the spender has access to all of the account owner's NFT instances\n * (currently owned and any in the future).\n *\n * @readonly\n */\n this.amount = props.amount;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITokenAllowance} allowance\n * @returns {TokenAllowance}\n */\n static _fromProtobuf(allowance) {\n return new TokenAllowance({\n tokenId: _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (allowance.tokenId)\n ),\n spenderAccountId: _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n allowance.spender\n )\n ),\n ownerAccountId:\n allowance.owner != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /**@type {HashgraphProto.proto.IAccountID}*/ (\n allowance.owner\n )\n )\n : null,\n amount:\n allowance.amount != null\n ? long__WEBPACK_IMPORTED_MODULE_2__.fromValue(/** @type {Long} */ (allowance.amount))\n : null,\n });\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IGrantedTokenAllowance} allowance\n * @param {AccountId} ownerAccountId\n * @returns {TokenAllowance}\n */\n static _fromGrantedProtobuf(allowance, ownerAccountId) {\n return new TokenAllowance({\n tokenId: _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (allowance.tokenId)\n ),\n spenderAccountId: _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n allowance.spender\n )\n ),\n ownerAccountId,\n amount:\n allowance.amount != null\n ? long__WEBPACK_IMPORTED_MODULE_2__.fromValue(/** @type {Long} */ (allowance.amount))\n : null,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ITokenAllowance}\n */\n _toProtobuf() {\n return {\n tokenId: this.tokenId._toProtobuf(),\n spender:\n this.spenderAccountId != null\n ? this.spenderAccountId._toProtobuf()\n : null,\n owner:\n this.ownerAccountId != null\n ? this.ownerAccountId._toProtobuf()\n : null,\n amount: this.amount,\n };\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n this.tokenId.validateChecksum(client);\n\n if (this.ownerAccountId != null) {\n this.ownerAccountId.validateChecksum(client);\n }\n\n if (this.spenderAccountId != null) {\n this.spenderAccountId.validateChecksum(client);\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenAllowance.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenBalanceMap.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenBalanceMap.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +// eslint-disable-next-line @typescript-eslint/no-unused-vars -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenBalanceMap; }\n/* harmony export */ });\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HashgraphProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass TokenBalanceMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n constructor() {\n super((s) => _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenBalanceMap.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IQuery} HashgraphProto.proto.IQuery + * @typedef {import("@hashgraph/proto").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader + * @typedef {import("@hashgraph/proto").proto.IResponse} HashgraphProto.proto.IResponse + * @typedef {import("@hashgraph/proto").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader + * @typedef {import("@hashgraph/proto").proto.IConsensusGetTopicInfoResponse} HashgraphProto.proto.IConsensusGetTopicInfoResponse + * @typedef {import("@hashgraph/proto").proto.IConsensusGetTopicInfoQuery} HashgraphProto.proto.IConsensusGetTopicInfoQuery + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenDecimalMap.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenDecimalMap.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace com + * @typedef {import("@hashgraph/proto").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenDecimalMap; }\n/* harmony export */ });\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HashgraphProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass TokenDecimalMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n constructor() {\n super((s) => _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenDecimalMap.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +/** + * Retrieve the latest state of a topic. + * + * @augments {Query} + */ +class TopicInfoQuery extends Query_Query { + /** + * @param {object} [props] + * @param {TopicId | string} [props.topicId] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TopicId} + */ + this._topicId = null; + + if (props.topicId != null) { + this.setTopicId(props.topicId); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.IQuery} query + * @returns {TopicInfoQuery} + */ + static _fromProtobuf(query) { + const info = + /** @type {HashgraphProto.proto.IConsensusGetTopicInfoQuery} */ ( + query.consensusGetTopicInfo + ); + + return new TopicInfoQuery({ + topicId: + info.topicID != null + ? TopicId_TopicId._fromProtobuf(info.topicID) + : undefined, + }); + } + + /** + * @returns {?TopicId} + */ + get topicId() { + return this._topicId; + } + + /** + * Set the topic ID for which the info is being requested. + * + * @param {TopicId | string} topicId + * @returns {TopicInfoQuery} + */ + setTopicId(topicId) { + this._topicId = + typeof topicId === "string" + ? TopicId_TopicId.fromString(topicId) + : topicId.clone(); + + return this; + } + + /** + * @override + * @param {import("../client/Client.js").default} client + * @returns {Promise} + */ + async getCost(client) { + return super.getCost(client); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._topicId != null) { + this._topicId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.consensus.getTopicInfo(request); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @returns {HashgraphProto.proto.IResponseHeader} + */ + _mapResponseHeader(response) { + const consensusGetTopicInfo = + /** @type {HashgraphProto.proto.IConsensusGetTopicInfoResponse} */ ( + response.consensusGetTopicInfo + ); + return /** @type {HashgraphProto.proto.IResponseHeader} */ ( + consensusGetTopicInfo.header + ); + } + + /** + * @protected + * @override + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + return Promise.resolve( + TopicInfo._fromProtobuf( + /** @type {HashgraphProto.proto.IConsensusGetTopicInfoResponse} */ ( + response.consensusGetTopicInfo + ), + ), + ); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IQueryHeader} header + * @returns {HashgraphProto.proto.IQuery} + */ + _onMakeRequest(header) { + return { + consensusGetTopicInfo: { + header, + topicID: + this._topicId != null ? this._topicId._toProtobuf() : null, + }, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = + this._paymentTransactionId != null && + this._paymentTransactionId.validStart != null + ? this._paymentTransactionId.validStart + : this._timestamp; + + return `TopicInfoQuery:${timestamp.toString()}`; + } +} + +// eslint-disable-next-line @typescript-eslint/unbound-method +QUERY_REGISTRY.set("consensusGetTopicInfo", TopicInfoQuery._fromProtobuf); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicMessageChunk.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenNftAllowance; }\n/* harmony export */ });\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IGrantedNftAllowance} HashgraphProto.proto.IGrantedNftAllowance\n * @typedef {import(\"@hashgraph/proto\").proto.INftRemoveAllowance} HashgraphProto.proto.INftRemoveAllowance\n * @typedef {import(\"@hashgraph/proto\").proto.INftAllowance} HashgraphProto.proto.INftAllowance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\nclass TokenNftAllowance {\n /**\n * @internal\n * @param {object} props\n * @param {TokenId} props.tokenId\n * @param {AccountId | null} props.spenderAccountId\n * @param {AccountId | null} props.ownerAccountId\n * @param {Long[] | null} props.serialNumbers\n * @param {boolean | null} props.allSerials\n * @param {AccountId | null} props.delegatingSpender\n */\n constructor(props) {\n /**\n * The token that the allowance pertains to.\n *\n * @readonly\n */\n this.tokenId = props.tokenId;\n\n /**\n * The account ID of the spender of the hbar allowance.\n *\n * @readonly\n */\n this.spenderAccountId = props.spenderAccountId;\n\n /**\n * The account ID of the owner of the hbar allowance.\n *\n * @readonly\n */\n this.ownerAccountId = props.ownerAccountId;\n\n /**\n * The current balance of the spender's token allowance.\n * **NOTE**: If `null`, the spender has access to all of the account owner's NFT instances\n * (currently owned and any in the future).\n *\n * @readonly\n */\n this.serialNumbers = props.serialNumbers;\n\n /**\n * @readonly\n */\n this.allSerials = props.allSerials;\n\n /**\n * The account ID of the spender who is granted approvedForAll allowance and granting\n * approval on an NFT serial to another spender.\n *\n * @readonly\n */\n this.delegatingSpender = props.delegatingSpender;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.INftAllowance} allowance\n * @returns {TokenNftAllowance}\n */\n static _fromProtobuf(allowance) {\n const allSerials =\n allowance.approvedForAll != null &&\n allowance.approvedForAll.value == true;\n return new TokenNftAllowance({\n tokenId: _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (allowance.tokenId)\n ),\n spenderAccountId:\n allowance.spender != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n allowance.spender\n )\n )\n : null,\n ownerAccountId:\n allowance.owner != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /**@type {HashgraphProto.proto.IAccountID}*/ (\n allowance.owner\n )\n )\n : null,\n serialNumbers: allSerials\n ? null\n : allowance.serialNumbers != null\n ? allowance.serialNumbers.map((serialNumber) =>\n long__WEBPACK_IMPORTED_MODULE_2__.fromValue(serialNumber)\n )\n : [],\n allSerials,\n delegatingSpender:\n allowance.delegatingSpender != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /**@type {HashgraphProto.proto.IAccountID}*/ (\n allowance.delegatingSpender\n )\n )\n : null,\n });\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IGrantedNftAllowance} allowance\n * @param {AccountId} ownerAccountId\n * @returns {TokenNftAllowance}\n */\n static _fromGrantedProtobuf(allowance, ownerAccountId) {\n return new TokenNftAllowance({\n tokenId: _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (allowance.tokenId)\n ),\n spenderAccountId: _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n allowance.spender\n )\n ),\n ownerAccountId,\n serialNumbers: [],\n allSerials: null,\n delegatingSpender: null,\n });\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.INftRemoveAllowance} allowance\n * @returns {TokenNftAllowance}\n */\n static _fromRemoveProtobuf(allowance) {\n return new TokenNftAllowance({\n tokenId: _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (allowance.tokenId)\n ),\n spenderAccountId: null,\n ownerAccountId:\n allowance.owner != null\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /**@type {HashgraphProto.proto.IAccountID}*/ (\n allowance.owner\n )\n )\n : null,\n serialNumbers:\n allowance.serialNumbers != null\n ? allowance.serialNumbers.map((serialNumber) =>\n long__WEBPACK_IMPORTED_MODULE_2__.fromValue(serialNumber)\n )\n : [],\n allSerials: null,\n delegatingSpender: null,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.INftAllowance}\n */\n _toProtobuf() {\n return {\n tokenId: this.tokenId._toProtobuf(),\n spender:\n this.spenderAccountId != null\n ? this.spenderAccountId._toProtobuf()\n : null,\n owner:\n this.ownerAccountId != null\n ? this.ownerAccountId._toProtobuf()\n : null,\n approvedForAll:\n this.serialNumbers == null ? { value: this.allSerials } : null,\n serialNumbers: this.serialNumbers,\n delegatingSpender:\n this.delegatingSpender != null\n ? this.delegatingSpender._toProtobuf()\n : null,\n };\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n this.tokenId.validateChecksum(client);\n\n if (this.ownerAccountId != null) {\n this.ownerAccountId.validateChecksum(client);\n }\n\n if (this.spenderAccountId != null) {\n this.spenderAccountId.validateChecksum(client);\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenNftTransferMap.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenNftTransferMap.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITimestamp} HashgraphProto.proto.ITimestamp + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenNftTransferMap; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList\n * @typedef {import(\"@hashgraph/proto\").proto.INftTransfer} HashgraphProto.proto.INftTransfer\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {object} NftTransfer\n * @property {AccountId} sender\n * @property {AccountId} recipient\n * @property {Long} serial\n * @property {boolean} isApproved\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass TokenNftTransferMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n constructor() {\n super((s) => _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(s));\n }\n\n /**\n * @internal\n * @param {TokenId} tokenId\n * @param {NftTransfer} nftTransfer\n */\n __set(tokenId, nftTransfer) {\n const token = tokenId.toString();\n\n let _map = this._map.get(token);\n if (_map == null) {\n _map = [];\n this._map.set(token, _map);\n this.__map.set(tokenId, _map);\n }\n\n _map.push(nftTransfer);\n }\n\n /**\n * @param {HashgraphProto.proto.ITokenTransferList[]} transfers\n * @returns {TokenNftTransferMap}\n */\n static _fromProtobuf(transfers) {\n const tokenTransfersMap = new TokenNftTransferMap();\n\n for (const transfer of transfers) {\n const token = _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (transfer.token)\n );\n\n for (const aa of transfer.nftTransfers != null\n ? transfer.nftTransfers\n : []) {\n const sender = _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n aa.senderAccountID\n )\n );\n const recipient = _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n aa.receiverAccountID\n )\n );\n\n tokenTransfersMap.__set(token, {\n sender,\n recipient,\n serial: long__WEBPACK_IMPORTED_MODULE_0__.fromValue(\n /** @type {Long} */ (aa.serialNumber)\n ),\n isApproved: false,\n });\n }\n }\n\n return tokenTransfersMap;\n }\n\n /**\n * @returns {HashgraphProto.proto.ITokenTransferList[]}\n */\n _toProtobuf() {\n /** @type {HashgraphProto.proto.ITokenTransferList[]} */\n const tokenTransferList = [];\n\n for (const [tokenId, value] of this) {\n /** @type {HashgraphProto.proto.INftTransfer[]} */\n const transfers = [];\n\n for (const transfer of value) {\n transfers.push({\n senderAccountID: transfer.sender._toProtobuf(),\n receiverAccountID: transfer.recipient._toProtobuf(),\n serialNumber: transfer.serial,\n });\n }\n\n tokenTransferList.push({\n token: tokenId._toProtobuf(),\n nftTransfers: transfers,\n });\n }\n\n return tokenTransferList;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenNftTransferMap.js?"); +/** + * @namespace com + * @typedef {import("@hashgraph/proto").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse + */ -/***/ }), +class TopicMessageChunk_TopicMessageChunk { + /** + * @private + * @param {object} props + * @param {Timestamp} props.consensusTimestamp + * @param {Uint8Array} props.contents + * @param {Uint8Array} props.runningHash + * @param {Long} props.sequenceNumber + */ + constructor(props) { + /** @readonly */ + this.consensusTimestamp = props.consensusTimestamp; + /** @readonly */ + this.contents = props.contents; + /** @readonly */ + this.runningHash = props.runningHash; + /** @readonly */ + this.sequenceNumber = props.sequenceNumber; + + Object.freeze(this); + } + + /** + * @internal + * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse} response + * @returns {TopicMessageChunk} + */ + static _fromProtobuf(response) { + return new TopicMessageChunk_TopicMessageChunk({ + consensusTimestamp: Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ + (response.consensusTimestamp), + ), + contents: + response.message != null ? response.message : new Uint8Array(), + runningHash: + response.runningHash != null + ? response.runningHash + : new Uint8Array(), + sequenceNumber: + response.sequenceNumber != null + ? response.sequenceNumber instanceof Long + ? response.sequenceNumber + : Long.fromValue(response.sequenceNumber) + : Long.ZERO, + }); + } + + /** + * @internal + * @returns {com.hedera.mirror.api.proto.IConsensusTopicResponse} + */ + _toProtobuf() { + return { + consensusTimestamp: this.consensusTimestamp._toProtobuf(), + message: this.contents, + runningHash: this.runningHash, + sequenceNumber: this.sequenceNumber, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicMessage.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenRelationship.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenRelationship.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenRelationship; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenRelationship} HashgraphProto.proto.ITokenRelationship\n * @typedef {import(\"@hashgraph/proto\").proto.TokenKycStatus} HashgraphProto.proto.TokenKycStatus\n * @typedef {import(\"@hashgraph/proto\").proto.TokenFreezeStatus} HashgraphProto.proto.TokenFreezeStatus\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * Token's information related to the given Account\n */\nclass TokenRelationship {\n /**\n * @param {object} props\n * @param {TokenId} props.tokenId\n * @param {string} props.symbol\n * @param {Long} props.balance\n * @param {boolean | null} props.isKycGranted\n * @param {boolean | null} props.isFrozen\n * @param {boolean | null} props.automaticAssociation\n */\n constructor(props) {\n /**\n * The ID of the token\n *\n * @readonly\n */\n this.tokenId = props.tokenId;\n\n /**\n * The Symbol of the token\n *\n * @readonly\n */\n this.symbol = props.symbol;\n\n /**\n * The balance that the Account holds in the smallest denomination\n *\n * @readonly\n */\n this.balance = props.balance;\n\n /**\n * The KYC status of the account (KycNotApplicable, Granted or Revoked). If the token does\n * not have KYC key, KycNotApplicable is returned\n *\n * @readonly\n */\n this.isKycGranted = props.isKycGranted;\n\n /**\n * The Freeze status of the account (FreezeNotApplicable, Frozen or Unfrozen). If the token\n * does not have Freeze key, FreezeNotApplicable is returned\n *\n * @readonly\n */\n this.isFrozen = props.isFrozen;\n\n /**\n * Specifies if the relationship is created implicitly. False : explicitly associated, True :\n * implicitly associated.\n *\n * @readonly\n */\n this.automaticAssociation = props.automaticAssociation;\n\n Object.freeze(this);\n }\n\n /**\n * @param {HashgraphProto.proto.ITokenRelationship} relationship\n * @returns {TokenRelationship}\n */\n static _fromProtobuf(relationship) {\n const tokenId = _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (relationship.tokenId)\n );\n const isKycGranted =\n relationship.kycStatus == null || relationship.kycStatus === 0\n ? null\n : relationship.kycStatus === 1;\n const isFrozen =\n relationship.freezeStatus == null || relationship.freezeStatus === 0\n ? null\n : relationship.freezeStatus === 1;\n\n return new TokenRelationship({\n tokenId,\n symbol: /** @type {string} */ (relationship.symbol),\n balance:\n relationship.balance != null\n ? relationship.balance instanceof long__WEBPACK_IMPORTED_MODULE_0__\n ? relationship.balance\n : long__WEBPACK_IMPORTED_MODULE_0__.fromValue(relationship.balance)\n : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n isKycGranted,\n isFrozen,\n automaticAssociation:\n relationship.automaticAssociation != null\n ? relationship.automaticAssociation\n : null,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.ITokenRelationship}\n */\n _toProtobuf() {\n return {\n tokenId: this.tokenId._toProtobuf(),\n symbol: this.symbol,\n balance: this.balance,\n kycStatus:\n this.isKycGranted == null ? 0 : this.isKycGranted ? 1 : 2,\n freezeStatus: this.isFrozen == null ? 0 : this.isFrozen ? 1 : 2,\n automaticAssociation: this.automaticAssociation,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenRelationship.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenRelationshipMap.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenRelationshipMap.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenRelationshipMap; }\n/* harmony export */ });\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _TokenRelationship_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TokenRelationship.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenRelationship.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenRelationship} HashgraphProto.proto.ITokenRelationship\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass TokenRelationshipMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n constructor() {\n super((s) => _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n\n /**\n * @param {HashgraphProto.proto.ITokenRelationship[]} relationships\n * @returns {TokenRelationshipMap}\n */\n static _fromProtobuf(relationships) {\n const tokenRelationships = new TokenRelationshipMap();\n\n for (const relationship of relationships) {\n const tokenId = _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (\n relationship.tokenId\n )\n );\n\n tokenRelationships._set(\n tokenId,\n _TokenRelationship_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(relationship)\n );\n }\n\n return tokenRelationships;\n }\n\n /**\n * @returns {HashgraphProto.proto.ITokenRelationship[]}\n */\n _toProtobuf() {\n const list = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const [_, relationship] of this) {\n list.push(relationship._toProtobuf());\n }\n\n return list;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenRelationshipMap.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITimestamp} HashgraphProto.proto.ITimestamp + */ -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenTransferAccountMap.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenTransferAccountMap.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace com + * @typedef {import("@hashgraph/proto").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenTransferAccountMap; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @augments {ObjectMap}\n */\nclass TokenTransferAccountMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n constructor() {\n super((s) => _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenTransferAccountMap.js?"); +class TopicMessage_TopicMessage { + /** + * @private + * @param {object} props + * @param {Timestamp} props.consensusTimestamp + * @param {Uint8Array} props.contents + * @param {Uint8Array} props.runningHash + * @param {Long} props.sequenceNumber + * @param {?TransactionId} props.initialTransactionId + * @param {TopicMessageChunk[]} props.chunks + */ + constructor(props) { + /** @readonly */ + this.consensusTimestamp = props.consensusTimestamp; + /** @readonly */ + this.contents = props.contents; + /** @readonly */ + this.runningHash = props.runningHash; + /** @readonly */ + this.sequenceNumber = props.sequenceNumber; + /** @readonly */ + this.chunks = props.chunks; + /** @readonly */ + this.initialTransactionId = props.initialTransactionId; + + Object.freeze(this); + } + + /** + * @internal + * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse} response + * @returns {TopicMessage} + */ + static _ofSingle(response) { + return new TopicMessage_TopicMessage({ + consensusTimestamp: Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ + (response.consensusTimestamp), + ), + contents: + response.message != null ? response.message : new Uint8Array(), + runningHash: + response.runningHash != null + ? response.runningHash + : new Uint8Array(), + sequenceNumber: + response.sequenceNumber != null + ? response.sequenceNumber instanceof Long + ? response.sequenceNumber + : Long.fromNumber(response.sequenceNumber) + : Long.ZERO, + initialTransactionId: + response.chunkInfo != null && + response.chunkInfo.initialTransactionID != null + ? TransactionId._fromProtobuf( + response.chunkInfo.initialTransactionID, + ) + : null, + chunks: [TopicMessageChunk._fromProtobuf(response)], + }); + } + + /** + * @internal + * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse[]} responses + * @returns {TopicMessage} + */ + static _ofMany(responses) { + const length = responses.length; + + const last = + /** @type {com.hedera.mirror.api.proto.IConsensusTopicResponse} */ ( + responses[length - 1] + ); + + const consensusTimestamp = Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ + (last.consensusTimestamp), + ); + + const runningHash = /** @type {Uint8Array} */ (last.runningHash); + + /** + * @type {Long} + */ + const sequenceNumber = + last.sequenceNumber != null + ? last.sequenceNumber instanceof Long + ? last.sequenceNumber + : Long.fromValue(last.sequenceNumber) + : Long.ZERO; + + responses.sort((a, b) => + (a != null + ? a.chunkInfo != null + ? a.chunkInfo.number != null + ? a.chunkInfo.number + : 0 + : 0 + : 0) < + (b != null + ? b.chunkInfo != null + ? b.chunkInfo.number != null + ? b.chunkInfo.number + : 0 + : 0 + : 0) + ? -1 + : 1, + ); + + /** + * @type {TopicMessageChunk[]} + */ + const chunks = responses.map( + /** + * @type {com.hedera.mirror.api.proto.IConsensusTopicResponse} + */ (m) => TopicMessageChunk._fromProtobuf(m), + ); + + const size = chunks + .map((chunk) => chunk.contents.length) + .reduce((sum, current) => sum + current, 0); + + const contents = new Uint8Array(size); + let offset = 0; + + responses.forEach((value) => { + contents.set(/** @type {Uint8Array} */ (value.message), offset); + offset += /** @type {Uint8Array} */ (value.message).length; + }); + + let initialTransactionId = null; + if ( + responses.length > 0 && + responses[0].chunkInfo != null && + responses[0].chunkInfo.initialTransactionID != null + ) { + initialTransactionId = TransactionId._fromProtobuf( + responses[0].chunkInfo.initialTransactionID, + ); + } + + return new TopicMessage_TopicMessage({ + consensusTimestamp, + contents, + runningHash, + sequenceNumber, + chunks, + initialTransactionId, + }); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicMessageQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/TokenTransferMap.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TokenTransferMap.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenTransferMap; }\n/* harmony export */ });\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _TokenTransferAccountMap_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TokenTransferAccountMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenTransferAccountMap.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass TokenTransferMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n constructor() {\n super((s) => _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n\n /**\n * @internal\n * @param {TokenId} tokenId\n * @param {AccountId} accountId\n * @param {Long} amount\n */\n __set(tokenId, accountId, amount) {\n const token = tokenId.toString();\n\n let _map = this._map.get(token);\n if (_map == null) {\n _map = new _TokenTransferAccountMap_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this._map.set(token, _map);\n this.__map.set(tokenId, _map);\n }\n\n _map._set(accountId, amount);\n }\n\n /**\n * @param {HashgraphProto.proto.ITokenTransferList[]} transfers\n * @returns {TokenTransferMap}\n */\n static _fromProtobuf(transfers) {\n const tokenTransfersMap = new TokenTransferMap();\n\n for (const transfer of transfers) {\n const token = _token_TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (transfer.token)\n );\n\n for (const aa of transfer.transfers != null\n ? transfer.transfers\n : []) {\n const account = _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n aa.accountID\n )\n );\n\n tokenTransfersMap.__set(\n token,\n account,\n /** @type {Long} */ (aa.amount)\n );\n }\n }\n\n return tokenTransfersMap;\n }\n\n /**\n * @returns {HashgraphProto.proto.ITokenTransferList[]}\n */\n _toProtobuf() {\n /** @type {HashgraphProto.proto.ITokenTransferList[]} */\n const tokenTransferList = [];\n\n for (const [tokenId, value] of this) {\n /** @type {HashgraphProto.proto.IAccountAmount[]} */\n const transfers = [];\n\n for (const [accountId, amount] of value) {\n transfers.push({\n accountID: accountId._toProtobuf(),\n amount: amount,\n });\n }\n\n tokenTransferList.push({\n token: tokenId._toProtobuf(),\n transfers: transfers,\n });\n }\n\n return tokenTransferList;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TokenTransferMap.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/account/TransferTransaction.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/account/TransferTransaction.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransferTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _NullableTokenDecimalMap_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NullableTokenDecimalMap.js */ \"./node_modules/@hashgraph/sdk/src/account/NullableTokenDecimalMap.js\");\n/* harmony import */ var _Transfer_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Transfer.js */ \"./node_modules/@hashgraph/sdk/src/Transfer.js\");\n/* harmony import */ var _token_TokenTransfer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../token/TokenTransfer.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenTransfer.js\");\n/* harmony import */ var _TokenTransferMap_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TokenTransferMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenTransferMap.js\");\n/* harmony import */ var _HbarTransferMap_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./HbarTransferMap.js */ \"./node_modules/@hashgraph/sdk/src/account/HbarTransferMap.js\");\n/* harmony import */ var _TokenNftTransferMap_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./TokenNftTransferMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenNftTransferMap.js\");\n/* harmony import */ var _TokenTransferAccountMap_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./TokenTransferAccountMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenTransferAccountMap.js\");\n/* harmony import */ var _token_TokenNftTransfer_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../token/TokenNftTransfer.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenNftTransfer.js\");\n/* harmony import */ var _token_NftId_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../token/NftId.js */ \"./node_modules/@hashgraph/sdk/src/token/NftId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../long.js\").LongObject} LongObject\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoTransferTransactionBody} HashgraphProto.proto.ICryptoTransferTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * @typedef {object} TransferTokensInput\n * @property {TokenId | string} tokenId\n * @property {AccountId | string} accountId\n * @property {Long | number} amount\n */\n\n/**\n * @typedef {object} TransferTokenObject\n * @property {TokenId} tokenId\n * @property {AccountId} accountId\n * @property {Long} amount\n */\n\n/**\n * @typedef {object} TransferHbarInput\n * @property {AccountId | string} accountId\n * @property {number | string | Long | BigNumber | Hbar} amount\n */\n\n/**\n * @typedef {object} TransferNftInput\n * @property {TokenId | string} tokenId\n * @property {AccountId | string} sender\n * @property {AccountId | string} recipient\n * @property {Long | number} serial\n */\n\n/**\n * Transfers a new Hedera™ crypto-currency token.\n */\nclass TransferTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {(TransferTokensInput)[]} [props.tokenTransfers]\n * @param {(TransferHbarInput)[]} [props.hbarTransfers]\n * @param {(TransferNftInput)[]} [props.nftTransfers]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {TokenTransfer[]}\n */\n this._tokenTransfers = [];\n\n /**\n * @private\n * @type {Transfer[]}\n */\n this._hbarTransfers = [];\n\n /**\n * @private\n * @type {TokenNftTransfer[]}\n */\n this._nftTransfers = [];\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](1);\n\n for (const transfer of props.tokenTransfers != null\n ? props.tokenTransfers\n : []) {\n this.addTokenTransfer(\n transfer.tokenId,\n transfer.accountId,\n transfer.amount\n );\n }\n\n for (const transfer of props.hbarTransfers != null\n ? props.hbarTransfers\n : []) {\n this.addHbarTransfer(transfer.accountId, transfer.amount);\n }\n\n for (const transfer of props.nftTransfers != null\n ? props.nftTransfers\n : []) {\n this.addNftTransfer(\n transfer.tokenId,\n transfer.serial,\n transfer.sender,\n transfer.recipient\n );\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TransferTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const cryptoTransfer =\n /** @type {HashgraphProto.proto.ICryptoTransferTransactionBody} */ (\n body.cryptoTransfer\n );\n\n const transfers = new TransferTransaction();\n\n transfers._tokenTransfers = _token_TokenTransfer_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]._fromProtobuf(\n cryptoTransfer.tokenTransfers != null\n ? cryptoTransfer.tokenTransfers\n : []\n );\n\n transfers._hbarTransfers = _Transfer_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobuf(\n cryptoTransfer.transfers != null\n ? cryptoTransfer.transfers.accountAmounts != null\n ? cryptoTransfer.transfers.accountAmounts\n : []\n : []\n );\n\n transfers._nftTransfers = _token_TokenNftTransfer_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"]._fromProtobuf(\n cryptoTransfer.tokenTransfers != null\n ? cryptoTransfer.tokenTransfers\n : []\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufTransactions(\n transfers,\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {TokenTransferMap}\n */\n get tokenTransfers() {\n const map = new _TokenTransferMap_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n\n for (const transfer of this._tokenTransfers) {\n let transferMap = map.get(transfer.tokenId);\n\n if (transferMap != null) {\n transferMap._set(transfer.accountId, transfer.amount);\n } else {\n transferMap = new _TokenTransferAccountMap_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]();\n transferMap._set(transfer.accountId, transfer.amount);\n map._set(transfer.tokenId, transferMap);\n }\n }\n\n return map;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} accountId\n * @param {number | Long} amount\n * @param {boolean} isApproved\n * @returns {this}\n */\n _addTokenTransfer(tokenId, accountId, amount, isApproved) {\n this._requireNotFrozen();\n\n const token =\n tokenId instanceof _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] ? tokenId : _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenId);\n const account =\n accountId instanceof _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? accountId\n : _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId);\n const value = amount instanceof long__WEBPACK_IMPORTED_MODULE_4__ ? amount : long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(amount);\n\n for (const tokenTransfer of this._tokenTransfers) {\n if (\n tokenTransfer.tokenId.compare(token) === 0 &&\n tokenTransfer.accountId.compare(account) === 0\n ) {\n tokenTransfer.amount = tokenTransfer.amount.add(value);\n tokenTransfer.expectedDecimals = null;\n return this;\n }\n }\n\n this._tokenTransfers.push(\n new _token_TokenTransfer_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n tokenId,\n accountId,\n expectedDecimals: null,\n amount,\n isApproved,\n })\n );\n\n return this;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} accountId\n * @param {number | Long} amount\n * @returns {this}\n */\n addTokenTransfer(tokenId, accountId, amount) {\n return this._addTokenTransfer(tokenId, accountId, amount, false);\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} accountId\n * @param {number | Long} amount\n * @returns {this}\n */\n addApprovedTokenTransfer(tokenId, accountId, amount) {\n return this._addTokenTransfer(tokenId, accountId, amount, true);\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} accountId\n * @param {number | Long} amount\n * @param {number} decimals\n * @returns {this}\n */\n addTokenTransferWithDecimals(tokenId, accountId, amount, decimals) {\n this._requireNotFrozen();\n\n const token =\n tokenId instanceof _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] ? tokenId : _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenId);\n const account =\n accountId instanceof _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? accountId\n : _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId);\n const value = amount instanceof long__WEBPACK_IMPORTED_MODULE_4__ ? amount : long__WEBPACK_IMPORTED_MODULE_4__.fromNumber(amount);\n\n let found = false;\n\n for (const tokenTransfer of this._tokenTransfers) {\n if (tokenTransfer.tokenId.compare(token) === 0) {\n if (\n tokenTransfer.expectedDecimals != null &&\n tokenTransfer.expectedDecimals !== decimals\n ) {\n throw new Error(\"expected decimals mis-match\");\n } else {\n tokenTransfer.expectedDecimals = decimals;\n }\n\n if (tokenTransfer.accountId.compare(account) === 0) {\n tokenTransfer.amount = tokenTransfer.amount.add(value);\n tokenTransfer.expectedDecimals = decimals;\n found = true;\n }\n }\n }\n\n if (found) {\n return this;\n }\n\n this._tokenTransfers.push(\n new _token_TokenTransfer_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n tokenId,\n accountId,\n expectedDecimals: decimals,\n amount,\n isApproved: false,\n })\n );\n\n return this;\n }\n\n /**\n * @returns {NullableTokenDecimalMap}\n */\n get tokenIdDecimals() {\n const map = new _NullableTokenDecimalMap_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]();\n\n for (const transfer of this._tokenTransfers) {\n map._set(transfer.tokenId, transfer.expectedDecimals);\n }\n\n return map;\n }\n\n /**\n * @returns {HbarTransferMap}\n */\n get hbarTransfers() {\n const map = new _HbarTransferMap_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]();\n\n for (const transfer of this._hbarTransfers) {\n map._set(transfer.accountId, transfer.amount);\n }\n\n return map;\n }\n\n /**\n * @internal\n * @param {AccountId | string} accountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @param {boolean} isApproved\n * @returns {TransferTransaction}\n */\n _addHbarTransfer(accountId, amount, isApproved) {\n this._requireNotFrozen();\n\n const account =\n accountId instanceof _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? accountId.clone()\n : _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId);\n const hbars = amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] ? amount : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](amount);\n\n for (const transfer of this._hbarTransfers) {\n if (transfer.accountId.compare(account) === 0) {\n transfer.amount = _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromTinybars(\n transfer.amount.toTinybars().add(hbars.toTinybars())\n );\n return this;\n }\n }\n\n this._hbarTransfers.push(\n new _Transfer_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]({\n accountId: account,\n amount: hbars,\n isApproved,\n })\n );\n\n return this;\n }\n\n /**\n * @internal\n * @param {AccountId | string} accountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @returns {TransferTransaction}\n */\n addHbarTransfer(accountId, amount) {\n return this._addHbarTransfer(accountId, amount, false);\n }\n\n /**\n * @internal\n * @param {AccountId | string} accountId\n * @param {number | string | Long | LongObject | BigNumber | Hbar} amount\n * @returns {TransferTransaction}\n */\n addApprovedHbarTransfer(accountId, amount) {\n return this._addHbarTransfer(accountId, amount, true);\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const transfer of this._hbarTransfers) {\n transfer.accountId.validateChecksum(client);\n }\n\n for (const transfer of this._tokenTransfers) {\n transfer.tokenId.validateChecksum(client);\n transfer.accountId.validateChecksum(client);\n }\n\n for (const transfer of this._nftTransfers) {\n transfer.tokenId.validateChecksum(client);\n transfer.senderAccountId.validateChecksum(client);\n transfer.receiverAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {TokenNftTransferMap}\n */\n get nftTransfers() {\n const map = new _TokenNftTransferMap_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]();\n\n for (const transfer of this._nftTransfers) {\n const transferList = map.get(transfer.tokenId);\n\n const nftTransfer = {\n sender: transfer.senderAccountId,\n recipient: transfer.receiverAccountId,\n serial: transfer.serialNumber,\n isApproved: transfer.isApproved,\n };\n\n if (transferList != null) {\n transferList.push(nftTransfer);\n } else {\n map._set(transfer.tokenId, [nftTransfer]);\n }\n }\n\n return map;\n }\n\n /**\n * @param {boolean} isApproved\n * @param {NftId | TokenId | string} tokenIdOrNftId\n * @param {AccountId | string | Long | number} senderAccountIdOrSerialNumber\n * @param {AccountId | string} receiverAccountIdOrSenderAccountId\n * @param {(AccountId | string)=} receiver\n * @returns {TransferTransaction}\n */\n _addNftTransfer(\n isApproved,\n tokenIdOrNftId,\n senderAccountIdOrSerialNumber,\n receiverAccountIdOrSenderAccountId,\n receiver\n ) {\n this._requireNotFrozen();\n\n let nftId;\n let senderAccountId;\n let receiverAccountId;\n\n if (tokenIdOrNftId instanceof _token_NftId_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"]) {\n nftId = tokenIdOrNftId;\n senderAccountId =\n typeof senderAccountIdOrSerialNumber === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(senderAccountIdOrSerialNumber)\n : /** @type {AccountId} */ (senderAccountIdOrSerialNumber);\n receiverAccountId =\n typeof receiverAccountIdOrSenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(receiverAccountIdOrSenderAccountId)\n : /** @type {AccountId} */ (\n receiverAccountIdOrSenderAccountId\n );\n } else if (tokenIdOrNftId instanceof _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]) {\n nftId = new _token_NftId_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"](\n tokenIdOrNftId,\n /** @type {Long} */ (senderAccountIdOrSerialNumber)\n );\n senderAccountId =\n typeof receiverAccountIdOrSenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(receiverAccountIdOrSenderAccountId)\n : /** @type {AccountId} */ (\n receiverAccountIdOrSenderAccountId\n );\n receiverAccountId =\n typeof receiver === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(receiver)\n : /** @type {AccountId} */ (receiver);\n } else {\n try {\n nftId = _token_NftId_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"].fromString(tokenIdOrNftId);\n senderAccountId =\n typeof senderAccountIdOrSerialNumber === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(senderAccountIdOrSerialNumber)\n : /** @type {AccountId} */ (\n senderAccountIdOrSerialNumber\n );\n receiverAccountId =\n typeof receiverAccountIdOrSenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(\n receiverAccountIdOrSenderAccountId\n )\n : /** @type {AccountId} */ (\n receiverAccountIdOrSenderAccountId\n );\n } catch (_) {\n const tokenId = _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenIdOrNftId);\n nftId = new _token_NftId_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"](\n tokenId,\n /** @type {Long} */ (senderAccountIdOrSerialNumber)\n );\n senderAccountId =\n typeof receiverAccountIdOrSenderAccountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(\n receiverAccountIdOrSenderAccountId\n )\n : /** @type {AccountId} */ (\n receiverAccountIdOrSenderAccountId\n );\n receiverAccountId =\n typeof receiver === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(receiver)\n : /** @type {AccountId} */ (receiver);\n }\n }\n\n for (const nftTransfer of this._nftTransfers) {\n if (\n nftTransfer.tokenId.compare(nftId.tokenId) === 0 &&\n nftTransfer.serialNumber.compare(nftId.serial) === 0\n ) {\n nftTransfer.senderAccountId = senderAccountId;\n nftTransfer.receiverAccountId = receiverAccountId;\n return this;\n }\n }\n\n this._nftTransfers.push(\n new _token_TokenNftTransfer_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"]({\n tokenId: nftId.tokenId,\n serialNumber: nftId.serial,\n senderAccountId,\n receiverAccountId,\n isApproved,\n })\n );\n\n return this;\n }\n\n /**\n * @param {NftId | TokenId | string} tokenIdOrNftId\n * @param {AccountId | string | Long | number} senderAccountIdOrSerialNumber\n * @param {AccountId | string} receiverAccountIdOrSenderAccountId\n * @param {(AccountId | string)=} receiver\n * @returns {TransferTransaction}\n */\n addNftTransfer(\n tokenIdOrNftId,\n senderAccountIdOrSerialNumber,\n receiverAccountIdOrSenderAccountId,\n receiver\n ) {\n return this._addNftTransfer(\n false,\n tokenIdOrNftId,\n senderAccountIdOrSerialNumber,\n receiverAccountIdOrSenderAccountId,\n receiver\n );\n }\n\n /**\n * @param {NftId | TokenId | string} tokenIdOrNftId\n * @param {AccountId | string | Long | number} senderAccountIdOrSerialNumber\n * @param {AccountId | string} receiverAccountIdOrSenderAccountId\n * @param {(AccountId | string)=} receiver\n * @returns {TransferTransaction}\n */\n addApprovedNftTransfer(\n tokenIdOrNftId,\n senderAccountIdOrSerialNumber,\n receiverAccountIdOrSenderAccountId,\n receiver\n ) {\n return this._addNftTransfer(\n true,\n tokenIdOrNftId,\n senderAccountIdOrSerialNumber,\n receiverAccountIdOrSenderAccountId,\n receiver\n );\n }\n\n /**\n * @deprecated - Use `addApprovedHbarTransfer()` instead\n * @param {AccountId | string} accountId\n * @param {boolean} isApproved\n * @returns {TransferTransaction}\n */\n setHbarTransferApproval(accountId, isApproved) {\n const account =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId)\n : accountId;\n\n for (const transfer of this._hbarTransfers) {\n if (transfer.accountId.compare(account) === 0) {\n transfer.isApproved = isApproved;\n }\n }\n\n return this;\n }\n\n /**\n * @deprecated - Use `addApprovedTokenTransfer()` instead\n * @param {TokenId | string} tokenId\n * @param {AccountId | string} accountId\n * @param {boolean} isApproved\n * @returns {TransferTransaction}\n */\n setTokenTransferApproval(tokenId, accountId, isApproved) {\n const token =\n typeof tokenId === \"string\" ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenId) : tokenId;\n const account =\n typeof accountId === \"string\"\n ? _AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId)\n : accountId;\n\n for (const tokenTransfer of this._tokenTransfers) {\n if (\n tokenTransfer.tokenId.compare(token) === 0 &&\n tokenTransfer.accountId.compare(account) === 0\n ) {\n tokenTransfer.isApproved = isApproved;\n }\n }\n\n return this;\n }\n\n /**\n * @deprecated - Use `addApprovedNftTransfer()` instead\n * @param {NftId | string} nftId\n * @param {boolean} isApproved\n * @returns {TransferTransaction}\n */\n setNftTransferApproval(nftId, isApproved) {\n const nft = typeof nftId === \"string\" ? _token_NftId_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"].fromString(nftId) : nftId;\n\n for (const transfer of this._nftTransfers) {\n if (\n transfer.tokenId.compare(nft.tokenId) === 0 &&\n transfer.serialNumber.compare(nft.serial) === 0\n ) {\n transfer.isApproved = isApproved;\n }\n }\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.cryptoTransfer(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"cryptoTransfer\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ICryptoTransferTransactionBody}\n */\n _makeTransactionData() {\n /** @type {{tokenId: TokenId; expectedDecimals: number | null; transfers: TokenTransfer[]; nftTransfers: TokenNftTransfer[];}[]} */\n const tokenTransferList = [];\n\n this._tokenTransfers.sort((a, b) => {\n const compare = a.tokenId.compare(b.tokenId);\n\n if (compare !== 0) {\n return compare;\n }\n\n return a.accountId.compare(b.accountId);\n });\n\n this._nftTransfers.sort((a, b) => {\n const senderComparision = a.senderAccountId.compare(\n b.senderAccountId\n );\n if (senderComparision != 0) {\n return senderComparision;\n }\n\n const recipientComparision = a.receiverAccountId.compare(\n b.receiverAccountId\n );\n if (recipientComparision != 0) {\n return recipientComparision;\n }\n\n return a.serialNumber.compare(b.serialNumber);\n });\n\n let i = 0;\n let j = 0;\n while (\n i < this._tokenTransfers.length ||\n j < this._nftTransfers.length\n ) {\n if (\n i < this._tokenTransfers.length &&\n j < this._nftTransfers.length\n ) {\n const iTokenId = this._tokenTransfers[i].tokenId;\n const jTokenId = this._nftTransfers[j].tokenId;\n\n const last =\n tokenTransferList.length > 0\n ? tokenTransferList[tokenTransferList.length - 1]\n : null;\n const lastTokenId = last != null ? last.tokenId : null;\n\n if (\n last != null &&\n lastTokenId != null &&\n lastTokenId.compare(iTokenId) === 0\n ) {\n last.transfers.push(this._tokenTransfers[i++]);\n continue;\n }\n\n if (\n last != null &&\n lastTokenId != null &&\n lastTokenId.compare(jTokenId) === 0\n ) {\n last.nftTransfers.push(this._nftTransfers[j++]);\n continue;\n }\n\n const result = iTokenId.compare(jTokenId);\n\n if (result === 0) {\n tokenTransferList.push({\n tokenId: iTokenId,\n expectedDecimals:\n this._tokenTransfers[i].expectedDecimals,\n transfers: [this._tokenTransfers[i++]],\n nftTransfers: [this._nftTransfers[j++]],\n });\n } else if (result < 0) {\n tokenTransferList.push({\n tokenId: iTokenId,\n expectedDecimals:\n this._tokenTransfers[i].expectedDecimals,\n transfers: [this._tokenTransfers[i++]],\n nftTransfers: [],\n });\n } else {\n tokenTransferList.push({\n tokenId: jTokenId,\n expectedDecimals: null,\n transfers: [],\n nftTransfers: [this._nftTransfers[j++]],\n });\n }\n } else if (i < this._tokenTransfers.length) {\n const iTokenId = this._tokenTransfers[i].tokenId;\n\n let last;\n for (const transfer of tokenTransferList) {\n if (transfer.tokenId.compare(iTokenId) === 0) {\n last = transfer;\n }\n }\n const lastTokenId = last != null ? last.tokenId : null;\n\n if (\n last != null &&\n lastTokenId != null &&\n lastTokenId.compare(iTokenId) === 0\n ) {\n last.transfers.push(this._tokenTransfers[i++]);\n continue;\n }\n\n tokenTransferList.push({\n tokenId: iTokenId,\n expectedDecimals: this._tokenTransfers[i].expectedDecimals,\n transfers: [this._tokenTransfers[i++]],\n nftTransfers: [],\n });\n } else if (j < this._nftTransfers.length) {\n const jTokenId = this._nftTransfers[j].tokenId;\n\n let last;\n for (const transfer of tokenTransferList) {\n if (transfer.tokenId.compare(jTokenId) === 0) {\n last = transfer;\n }\n }\n const lastTokenId = last != null ? last.tokenId : null;\n\n if (\n last != null &&\n lastTokenId != null &&\n lastTokenId.compare(jTokenId) === 0\n ) {\n last.nftTransfers.push(this._nftTransfers[j++]);\n continue;\n }\n\n tokenTransferList.push({\n tokenId: jTokenId,\n expectedDecimals: null,\n transfers: [],\n nftTransfers: [this._nftTransfers[j++]],\n });\n }\n }\n\n this._hbarTransfers.sort((a, b) => a.accountId.compare(b.accountId));\n\n return {\n transfers: {\n accountAmounts: this._hbarTransfers.map((transfer) => {\n return {\n accountID: transfer.accountId._toProtobuf(),\n amount: transfer.amount.toTinybars(),\n isApproval: transfer.isApproved,\n };\n }),\n },\n tokenTransfers: tokenTransferList.map((tokenTransfer) => {\n return {\n token: tokenTransfer.tokenId._toProtobuf(),\n expectedDecimals:\n tokenTransfer.expectedDecimals != null\n ? { value: tokenTransfer.expectedDecimals }\n : null,\n transfers: tokenTransfer.transfers.map((transfer) =>\n transfer._toProtobuf()\n ),\n nftTransfers: tokenTransfer.nftTransfers.map((transfer) =>\n transfer._toProtobuf()\n ),\n };\n }),\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TransferTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__.TRANSACTION_REGISTRY.set(\n \"cryptoTransfer\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TransferTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/account/TransferTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/address_book/AddressBooks.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/address_book/AddressBooks.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MAINNET_ADDRESS_BOOK\": function() { return /* binding */ MAINNET_ADDRESS_BOOK; },\n/* harmony export */ \"PREVIEWNET_ADDRESS_BOOK\": function() { return /* binding */ PREVIEWNET_ADDRESS_BOOK; },\n/* harmony export */ \"TESTNET_ADDRESS_BOOK\": function() { return /* binding */ TESTNET_ADDRESS_BOOK; }\n/* harmony export */ });\n/* harmony import */ var _NodeAddressBook_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeAddressBook.js */ \"./node_modules/@hashgraph/sdk/src/address_book/NodeAddressBook.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\nconst PREVIEWNET_ADDRESS_BOOK = _NodeAddressBook_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.NodeAddressBook.decode(\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(\n \"0ad0070a0e33352e3233312e3230382e31343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340acf070a0d332e3231312e3234382e31373210a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ace070a0c34302e3132312e36342e343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ad1070a0d33352e3139392e31352e31373710a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad1070a0d332e3133332e3231332e31343610a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad0070a0c34302e37302e31312e32303210a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad2070a0e33352e3232352e3230312e31393510a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d35322e31352e3130352e31333010a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d3130342e34332e3234382e363310a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad2070a0e33352e3234372e3130392e31333510a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b35342e3234312e33382e3110a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b31332e38382e32322e343710a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330ad0070a0c33352e3233352e36352e353110a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d35342e3137372e35312e31323710a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad0070a0c31332e36342e3137302e343010a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d33342e3130362e3234372e363510a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33352e38332e38392e31373110a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad1070a0d31332e37382e3233322e31393210a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33342e3132352e32332e343910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390acf070a0b35302e31382e31372e393310a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390ad1070a0d32302e3135302e3133362e383910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a60363465303938363135626634303566376564356134303133343436623839633438386366636436626232356134613637366463373765656131316433336437303236383266306136396138303330653863353737376430653432323033373939\"\n )\n )\n);\nconst TESTNET_ADDRESS_BOOK = _NodeAddressBook_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.NodeAddressBook.decode(\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(\n \"0a7f0a0c33342e39342e3130362e363110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a80010a0d35302e31382e3133322e32313110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a81010a0e3133382e39312e3134322e32313910a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a82010a0d33352e3233372e3131392e353510a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a7f0a0a332e3231322e362e313310a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d35322e3136382e37362e32343110a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d33352e3234352e32372e31393310a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a80010a0b35322e32302e31382e383610a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a81010a0c34302e37392e38332e31323410a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a82010a0d33342e38332e3131322e31313610a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35342e37302e3139322e333310a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35322e3138332e34352e363510a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a80010a0b33342e39342e3136302e3410a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e35342e3137362e3139392e31303910a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a82010a0d31332e36342e3138312e31333610a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e33342e3130362e3130322e32313810a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a82010a0d33352e3135352e34392e31343710a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a81010a0c31332e37382e3233382e333210a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a83010a0e33342e3133332e3139372e32333010a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e31342e3235322e32303710a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e3136352e31372e32333110a388031a05302e302e392806320218093a60363938333261373361333630326538643166626535616435386431633236333761316236373264373165653837616631306462363438656239316166623232383235336231663437653537643364346134346666353437623333393461613232\"\n )\n )\n);\nconst MAINNET_ADDRESS_BOOK = _NodeAddressBook_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.NodeAddressBook.decode(\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode(\n \"0ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633435363165336332373863643635306538306334313363613434343233633163336331336366313437356636663639373664353937616534333262343961623432303836623739623834313332363035346238623364636635376438666364373962666330353831383363613234636434633163626335373465643131313765326635623762336336336365376230366439623465666366373337353633376234316665366635336338313162396465363134336633613532393537636466393536373735313230623333373033666635373632313430376162393537356263326433356330643434663039383366633165663633613466663532303966303730633932616631303632393536303163393662636564303634656331393031393730313963363831316334633864643830636234663461633731663961643736653761633839343536666266346630313166393061626432643930353336653832333436353166366265663932376533643564386237626634353930353039383362656361336162656632613964393761663334353737326137373430653936393932373562303138656130646632383661646436636539323365663930386662653736326137356632313131363836326462343464336463613164343462346432653864633130363663353030366262356137643935346164323535643462363033323733343735653531316165623438356430363961303637633061623563323435333863393333633036623561366165666139343030356332393135323133653463636461653663393432663632373266396464353238326436623839306631663230656664323339396364363734393234666135373034366163366461333265373339353161373331313365393166633262376666323965343835316238336666333966383362613965633666303863656664626236636262626666616266646661613931643933306637323030646134383133376333393463626431336537303165636463323631366664323162616436383161613466303031303230333031303030312804320218073a603665396138616263646364653665313134396133656265313766643538643839303538333961383664623732623036613365613230616131373666383638623235343838353261653432336437613963366237636666396537313436323961320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613163343037373135343330336363373263346662373639326333663934323531626465633132333961316637613839373261626539316133353332336662656361363235613766666165363430366338353564633261663231313039303062306466306536653664623736333634646661316666653835656461353637393336653239383562383536333461333261613532613635393964643663333062653166376136633562386635656563616632363231643861343539363832666364326462616164313536316431316633336663636237663535303061633536386431363564626561616365333238366432383934663634313239643738316436633732666437643539396339653164336166346161343333633233623931306661653463343834313634316636313532366164373837656265613533393837343136376539643361373363633066623135363432396431356563373633613664306630363131356137396239616637383364373762393864383330393661613437343366393734303864396531346263663464646666653435393137363838343762343063623864613763613337353235366432623933356430393566653235326661653831666636653337663834643761393064376535373061346638656633633764373636656564613437326630393230313939303135613839303832353961383733633534353466636262646361643265353238646538353435356234303833633764633461646335613938386530636464666463313539643564373132616264353434616137336563303239303839383134633938613434663236666330363434363539633138336533313834616132373266386431646330626661336530613536303438346362303535626134646262356363333339656338306264313164363432646333613730326538633730336162323139333038346439626436336630646665313261343333633235373665616637383163666164383637656637306264613631373638623262656631346635306336633362386230393666303230333031303030312805320218083a606464336233653763643361323537643832373665343635333533363162303138623730303931663438363635653832303031306538316563303539326236396264346265316662643765636435303964303730313364643034313238343266640ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623263636163363561643066633736343561383137626661626334383761643765343133313165376133313938623337666238343264383463333935623366363764366264383438663130633666303363323930653866376461613864303031613834343164633335326131393136306133313933653638623832656466313961653637363933613961333364346362383765373839613130373037313535313565613737326361613862383661353639623931633534353038333564396333353466306461636563393766653737303931623435623134373639386237663836303134323264636432323631653932386465346461633963343264636261666466393663303732333362613330323730373666333763393639653865643330623662356438663530333462653764393263353936663862653836316535316663633361323432626639643862653965326139653865306631353565626366663233656666613763643537633130353432383131643830373736633935383535323666646230656161333465653139353564353131313933393066653837336534633034646564643239313635383834623938623436333038373838616537666334643461613461386663396263323637346261333231343933623632343435356164343130633164653731626339356431643931666130663230313431386137393565333039656166323937623639396266323763396661323736336364353963656230323165313662383230306331303630663238313766643833636663373637313833343839343631653335393932393162333830643665393339626161346231393233326136613237326464653635316638303436666463333464623237366137373764366662326265633332353562326363323434623461663536366231303566333063363530366464616530656233646564646366393437626362396336306530303039383466336234613863366334656434626639306263313933326237663934646333616536623336303030386562393032303430663962303230333031303030312802320218053a603561383634313561303861306138323566336232656237353031303135353230326533313234336665343161303333333834653738633138633131653565386632303964343933623062326664343565303662333734663262363964663564370ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613365333762373663366364356636363232643639323434343464313263363737633339356632623539303266336262393862386138623530353561373037373036636130323863643735303630613264383730326432643862303439343762646366653061386331343161613238343462316530366536363139303031326538623633323661623066613331373937336263376362346432393439663231303861613034633462306339316261613537323866356235363232656337356162663537386131663762343165646532613637656264363963313865353831666466396336303230616330646539636132633331663063363436393030333331316662623563653764623439633738376531613764323761613432356565376238346461376536363933396639633830643065383266636535356530326466633862356337383431386132366161343336353036393837313962616663656366306264343930303061646463666134303537303862646265666262313937343964323264616230303765343464343565613233623130366638383334633135326532353036326434636632346666323533353663376562333732393130353339336662343962616239303461303266306630626234313763643931396433353238393031323865366262666634666163396639306465313138613937346632613664643031653033326137396231373866363066613166636262643032623537303466623436323935633135313930383136333733656464363633356338353639373866316239353033663166373362346230626538616261326564316665656164353939353362663832656664653933613334373161626435356364613362613861363733666262333739393734396662303036643030336630653633663636356333343631643261376232396463386232303462613539613635363638613436616532383738663030643166393439306466396532383066656266343331356561303465616135363861336139666434386336326336336236656364613639303230333031303030312803320218063a606434363430333938303337393230373965636364356134343331316361306463323262353065633839356235366535336431326232396637326463366462613363616665326535623831303466626461303338616635623434376430666231320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393361323135636334613761373232636165396331336162643633366466393963636565633661663964623436623639666135313637313665663530636532343930613938316530396162303139636132636234363831316235623631396431626431643565653666343661343263373737636264656536343261313438346563646635646464333732393634326333386336643433613838353838373434373566353832343434333636346330346466656439623839303435666230383565323563336566636234383431373333656666376335323963313339653639333530633263643739623263386431393637396137313265346538636166643332363735343162383332623365313061303132353564656636396466316539643362386438656166303331316465363764356531326232366464303164626264396433653432643335643964653237313330326530663166363964383763626337616361396538383637653964343238643363616230363636656234393064356662616233306266663366373835643033663230373261343362623962356535343635366135393263623631656166643561356566323834633763616563363666376634373332356363306434633164323766363631643861373438636135303731633036656631333464666639366634303836363838333636643436386132343738303031376530623536616261376661623433623362376330623737393036666165353438326633323831316332393265366231343435346531346238393438303161383661303363633437373934646430643734353237613732653432346564336166613034383939656362396136336632613961653732626537666139383961646630643635613332633835316439383031666334313034386466333335363466633762333137303765633866623830313430666537623761316661313230626131636236363033323463656666623462636332643962623764653063663534633831396632646433626365616465633963323566356531396463396231303230333031303030312806320218093a603365303261363732306334343636353965383633303564353562666565383230623335653635306665636163633535333039373435356532633465303332636339646564313662316262343464336235393262626163623663326266663165360ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303930323539663465336439663066333934323536353438653963373330386231306237333430336363393039346439376164313531623737303631373062393737326365623634643636326563656639303161386437643135643331396135396338623731303731616363643839356237633933363130646336393736663637633465313732396261383337336162376535326133663363386632363534393164646536396436653039393934373065373434353938313133316264393663333665363836353230336662326562643564353065616461666237323633393664656331643931373438393862346539626530346337346433303466656164643963626433323334633362376633333036633939636230633333396663323539363962343164353861326237636663313833326532323664383163313936333939336532323535613038376431363938633033643432313062643634353830363434643039356361373661613137393465646434306331633837623566383261386533396636303365393731313662613034353738653765383033343634393564373835643465663763663737313462396562366635663965306239613934663462373338383436313962393237346434613935656631353735346138396439376566356331613838623664363933653061383065626435333766633963663063613931643163363264393135646537656438313862393532653634633230303239336565386532383461343136613732613365313266633764343233623135386639623439363630636263323436366662656430666564326532346531303266646539343265623463666439346265633436643364393066633038633339666563626130336530636132343634616536363462393739353135626132396531663730326333666537303262653739333739366438656462313761613438633039323930623032343534396630363131663561653233656437653136343432646637643164616432323836633262623039643535323264643365643639386332663032303330313030303128093202180c3a606339373462623938326338313931336237333236643561336639646363343836313261313566376161643032663230376230663130636432303137613666626666353830336537636139626662343730396162323862366230396435623133660ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303962646438653834666164616133353332666334636530316138613137643463336232333266353061393739306532363236383465646334383233653831356131626435623230656365613762663536653239663662623762383331666233626636656663643134373566306238656435666662306231333835623936643136366236323966303339366138666566356630366534626361323565653461313334306565323633613464396262303230643866343732333036663364383836313338646537613031396530353962643061666339303263636261316132313361653264616136306338613031333735356665306134386530333466356234303233613264616465616138386335343836383335336163376137613364663132623266623634313837373465396231346265366561623863633237623838303132616436313632646137346530656562313631333539303566343337333734646162383538366437353061323662626433616332346165643837386334643533653635313037326338373165393464376163633537356339363733383137333461353366656166346437626136626364643234316363363435386336303837643836333032616132353163303466366435366239633332643764393636323437353065643035353738356430373733663433646330393962323863393232383131343865366338316632393766663964313636653030306163303462333132343138363737356663656637356635656261306331303332626631333064663663643761343632313164306466336530353834643932656136373334396438343930353038656234656638386635346338633364343836646538373139663130666139366665623835636337393630373663613738313331386565326439656439303363613133333630343063353961643931613464326636393865393130386165306564623962316362393561643333623139376666623138626431626138623536636265653261616539353835656365323038613165313462343835363436333032303330313030303128083202180b3a603937303834333033333130373866353638326337663332343464383263336233653238316139313837393537386465656163646363326132656265353431616631383831313561643265383338363565356635643234376234613138633165650ab50722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039303938383635646566326632616233373663376630663733386331643837613237616330316166643030383632306333356362366562666362623063333330303331393361333838633334366433303233313732373031323139336262373666643330303462383634333132633638396566353231336362623930313130313530396465616239346632366137333265363337393239646134633463623332353137653361646262333831316435306163346337376331666365386236353136303632313566333437303766336537323635353435653538633839343630396532383337366264623737373566653330343339653065313539326664636230633365653163333035373733643037326136623839353765616663653161313162653936356564616666333834333336366362366134346563323561383930313036653632343735363766373662353530666461343832626165633633303764363938656338383834316664363666323366323130653437623861396463626136626134653166613731366462333363383065333038313934393664636235653536303966623665376336313533373962646465643432376539323331623932353463326261663934333630386138366436393861653961336338363339646638383764366636623561373133383564323433333864393131613231326266373166316532616363386231383662393665633865363963383662366430353832313737373661303963396336383935336564623539313635373862356132363362326634363965336230633037656164613731613434376565613766386663316262383037343235353536376237663062643165366166623033353837313863393862343239653234623232393835393666633736636636616633393663613934333464373932366563376433376434623932616635366434356665666638313936303935323234613931366331666665366236363765323535666333616338636363656639323064633034346232353030333133326238373830363734326630323033303130303031320218033a603333373339306438666561313434616663313265383132353461323864616336656138323839333833366163303732656666643835653061373734383538306566323830393636343863356137663864626234636538313437363831353133370ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130306335376564623966663237366530323362323830323163623164383763646631393636623639386366343865346561616137633639323037376365656538636362323339613463393231353937653865383966376363303564336633313331353738393736633465333134343035643461346530336137323431306335633039636135323761643561383562393938363337653732613332653166626330643535343662323436356539653830366332646435303965623035306162356662323730363366643932383135623164643236383965323131316361656236663534396539346139663030663038323164346361366336613631313766356135333363393236336266303734613330643563626566353064316338633233383762636139373265646564613039383362356430613662353764636230303230303036383238623430653430373662343837306232346261643834303536656535326235663432326538383430303238633235303036333832643865396336363132323566346637366561373265333430363037653966633666336332303433333037366131636138636231356564303361633839363664303530376263646536383165346530323331656539663837643131316537623438616338663934643264383432623532646637336635373363633534313439363437393763363236393638666661653734313866336236313039623561306630396533323233663461346435653335303964643235303133386636626331376266366365636531373539343433306466313830613338653930616466326166666266616430633662386331623837663137386130363164636662666638623932633931363664383734633166663561663466626364626665386539643039393337306464663630626537343736333364333665653465623563643531663665336333333965313531653431626462356135636532633863393761306134336233636434636330383138383463383739663964326633373438343238633835373366313763393066336362643032303330313030303128073202180a3a603734306166366266373339653838336338386633333434633961306638623330316533396463393831633531363365306465326133666634326239396534323665643765353662363766343231383530333834356466363266343963396662300ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393133316161333638663933343532323966393762363235396363636166666561323365303063643565616430326533663639366331653731346565333933396461643836306533386266393561323937346639656234386539333433663861616334303565613935356430353332336531313762336231633934383133613361663432666538303832633364343362616631626434643833363765393364623030616436393665363237613130333661653533346630313165616435653536663337613666666534346236623965303939343031313932616435363061303334366234316138313030393566356632643766643332643665656236353562613735386336623532366331323933383661663731393763376135336165363033643632323833323235343936316631366430656661383037396137363835363138383862653733333439323231373935366262636166616562623631333563356662623234383464356234613566646630333336616330326532366331363532633162643865616633306461653164366433656230306637623466616238643634373866653864393565623931316466393636613064656134653532326462373662383936363537306563633561663039353136343234663061663566386565363665333836643536353037313339393731363961633337353733626635326664303538646539356162326666363865363831313161623233343035656139363462326262383864303263306631636165643731656364643465346534303835393438373666646238353030626335356337626130323036366530356162393864396637653034363664393730326562353765653337323266386663633835613735353035666633323632313730323838623738383732336164623937653464653536323063633930656164313338326663643735373138383966656662313165363737316263336636663366656231396337616335343238373864303361393032373035323663336565643234393465666635346531353363613966363839303230333031303030312801320218043a603765616236393661623935343336363538626331346666366234626534643932356364353162323230646632613164356336656531363061646166323961353165363934646533656531383463653232656164386437646239333231383266330ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038326465373330363566333466666332393334306435393439643232323062316534333636656435636637633665626436313663663934313661353365613030313766366262313136626664336633646566636331356237613464646630653434643032666536393536383830353365373961373730653230316263663731393333393030333965653866303836643466613734366337653035363931383330316639623565383465333932363238323830383561373962333232626361306235643835666539373232316132366262646532353863363230663064636561303261623165646431366363343961336632616239323838653364643166333764633462366136663731333366663932653534316337316237306432613266363664353537323561623138626638366430303965633364323466356431326530623565363830326431313531333732643462373634656265636234616638326636343934383565633537623561303164633637393538663561303363636161623763626139333534613137333732633133313662613437633935336161663934393031623366386332346536613361666436373538653766336231343363653264643363623037316232613734633932316365653934396134623561366265383739663163373930613662386436336231393264376565323961393439316664643638396139386330613763336436303332306631623461633264363232396466643934653432663361363034386137366265316562393538633861313837336265386433333861656339666335396162376633373632363738393430326331666435393566313930383735373565306265383237666334633061346662336433393361643734613934396363393836626662363463616264646165353339333566366463353630373464623933643737656133623831366264643662653533343439373237323238393835396666333463653531383630616666623632316431303438376463333834336631663836643534303334613633653438613161306430323033303130303031280a3202180d3a606132656363316232616539386264323862633161303864386633373161306434663734356337363864306337373339363235363265333433623235643833343235656565613765663865613134323935333432623865623738643332656333660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039383735356134303862353332316532363330353230303064366437643461326333613535346435653133383461396362356562663437346165383832633633623438366264303864313434646466316139346365396137643632353139363330303661666461616334353838343666313736343031393566653235333961363536393330656661383534663231343865363865633161303863316334396432303063336633303435666537313437663036643533346334626432363231303063623164643339373339643736306438316130626432306638336632353564323530376434636362313130366235333631386336613934343039633838376361653236326434636565396338363233323134376365633134303465306335376262613733313731333065653339363433383838616633643539386564643832623863363165363561653831613465316135366263303664333937313433613938643431636138376433656634333365663061656162363830313139316233653338343830393638663636623665383836363261663435613965323132393934663638623238386562393637626562393834373863323433653231333663316131353931663036316635626330346232316666326261343862323966313834333130383838373362646665393966386135326539343038393731383536653830346465613630326133313137383663393835363532393633633361333737303332396234303966373466646663373436623232613566383431383931323037316334636538343663396234623332306665646636653962363465326362653338346639613832623661616164346232303930373433316466316133336636393230376135363536303062653831303730643038333239303039393538353961343439386435623539333135626365626566656538303765623061336139343266316364663333363764643434343466646232393838366566636464306265346162653961313838383033393533383735656461333364623732393839663736336230323033303130303031280b3202180e3a603139366237623132303739376364623361396430303362393833643537646131303331303662313733306531376636376532633762616161646234333738396166313639366461313031316232353362636263383630333333383566303332380ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061396462376638626161313236383938666162373839313135613362356438393734346631393765323830343161653039386633653838366336393837313732316531316262306164313166336365393132346161393631643661306463383435663439373635633366616231393935383430323637366635363434363262663238316462613535383837383066303365393035373938653138343236396161613630663761313437323333316532666231646561646438373763383463626362363431636139653563386164366534356263313539636230373966636230643434396364636438643932333963316130343765376234343864613063646361323636313061323566323936643936653734363962363736643461343434353136653761353965383532393361383038366638343063303532383534653032613863623230303264616433353832356265346438336235326661393165386337336666303439373436313438383632373837633131313866393234643331636261633162343466656666323264343336623339373965616466396234336134626661373265313562343735356663616232363065303661323739633362623733626337663136613036306434643532326664343930353830333838616135393564383034343733366535323266363432343931356637383033623735383365303935636466373863333235313936393764653831623839666235303035343735336231613137663961616662303634643834633939326639616231316363626338636231303831346463616635323634616134356632316264656661633832636361636161663335386533313337336565316261346537343032666438613730656130633238636135636337346463343235313063393639636432633435396231656333363838613031656133396139393237313063643232393763393861383462363334386135373738303466646332333464336665313930336532633231653137326461323862353961653665346337653865646438623731633439643730323033303130303031280c3202180f3a603538343661353366343437353239666439636462373830346364333136383865643665656265336236336461326635663231316666626337333731393763663366316366626664613631626537643135313066306539323339383131376637340ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061386365616333363765623166316465356630643965663365616630646639623938343438666532303830383437363536326130363063353163323839373730623463616366653932636236353536393832336539363263326132633966656435336264333663613361313232646531633532356135383266323561346437643632386331613364356264623839333661656365373531306537353534656537303333303235633039326338323865656235373338626530326564393633646138316135393230353633346365393435343537376162383266343066313366316565353565306165373237653233633330323834623166343462393961636534646463356639616337616438386439666132323535393335623234646362613834303036343265313663663235333263306230643638393239303436303837313563343037366634366438346130653066656433366537366363646339363335356537613236313630393435633262353461653236636330306664303832333236333436656565656137646437356639313931316539396462636239396561346163366261303536633333323238643838316438353833316439636338373935393364613137343664643065653935646332623936666539336261666366663263643764393239353864373864663333663230356437313135656439666163346462366634636336306535366135343431646135623562353566613539393939303265393538613662366334346438313064646335363138313234316238376632326630353961363838306538303231373336643031383937646236353434396365383137613233373564303335353163623064653530376336303961306338303330656366346266646562323133633033646161373634613138323162373234333334663731663736386437616563623237373035326137303333373635663037323138303536633738663261383761663138333836643866363161356366636233663262613464643539393135663133643338363334643136393537353730323033303130303031280d320218103a603030306162636435396133306135333838633530306265363832663663613239343034363239356339323735383831633230643334626230643639306564613762333862366262643037613364643166646662366137303434626230396366660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061663062393134323537626637613436353563346135306430636164356530613165343538316564363632336630653837333066373936623866323963353831373862636363363933326331666333316633396566343462383264336334336233393837333733373366656362313239353232386130346664353061313466333634366438346665316634363763616562393864343633653239373565393935623864326531653339663362663661646463323561653335643635643032363038653033343535333739363665326162636534396238313462656164336331623735373137346165333063303062306334336539396238303439366237326433633133316631633665346663646130356632383131376566396532386334333033626534643863376530343264353862383363633132313934356132633635653739363263616139313835393338663337353764663763636139356366303262356533313934346133613631396130616333663165333462396230313364346332323463346631653730666439666433363938336566383661646535313833363263633833323263306637623631613961633735666238326537623836643638626330663039396130396131346361633561316438643338663961386137306363333766663563633362626432373432666664313436323535633137316536613137383038333237316463653066646536383165643439326362353962303739366432373031373538333864633539303831303765336136656133663961343036623364313133306363656333623437393165343962626332333136303362343661623264306639336434336265373561623961346437313065613934306532383561376231353362306361376364646565366439646365306164383335306334316439306332313562393538383531356166613061633333363561653037653831663362626233366264626561633462333162636231616134653832353635623937376639646164383564363236656566396161613965663864376533666230323033303130303031280e320218113a603933653238313031303462326231376230303935326235613431303264333365646230343363623136646533616433643364363832363066353562623065353837333765613539343463333338663763386362383863373833336663383630630ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038633037626533303561643630623930626132646162333962306565373736306531613232663835373532323534306437306230336233663965343837356133613239616230383038386631343466353765623235326534366261353933383564306536643432373031313764613061626331623362383036393463396135303538623836643631646661303665373136373039633838653866656163376333613065316432356663306165626636613866373666636239396638343566653138313436316361623638353862393763336134303237666233373132623134653663303738396465313764343137363435373765353131343137656231363236393265623037616531653733353532333565396262343339303437623663303136313337383265376464366636303464616134363734363631643533393631663436633366616136623765373637363264333733623562353432623739656139363365666266333361633638313938626232623636316366663637363931366566333732616434633236633231366334626334373837633834656333326431383464373763373531383663303963663364396639313433336361393835333131396261623331666136616432366634353365353936643962646563613638613537363962633866656537613533356438306338633666336566623164666232383861623661393739383534623763653833313234656330643130326166663934633362373466396333373839353863323565623933336464353363316538303561313836353464366439313836393930663635373034323966393630663334653862346637666439393732646362666539323430653037346461326433353561356637656639633161663632656635393832613831373435373862396331356334396563353636626461636233306363666365663039636466653730386164343837343234653963316265363533663965653736363065376439343263316566613564613238366531616464616230366139613333663964653934363739356230323033303130303031280f320218123a603934383235313739643163333934303137306233356432363665346366613830643737386335653966356261653764653833666638636334373431663362653336616336336431653761653439373261656466366263316533636632303638390ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030626531376339393634376365633635613434343037623533353835366233633362616566356235346635363561663538623834353662613863376365353335643561633732633631633434633736623363353763386538363438343136333762653130613833636665333963303932343736643064626534643663646364636437323061333062356266656235316130316131386635383263343566366338363939336663663764663138323933356465316438363930363034346463663335313836393335643962643765656137393532333532626562623465663961653066373636316537306134323337616661393839393636383763613438666366633562303064333830376630353462653066613863336266613432353033386265366566323935313634663232663733623765383863393465613962653861613466336132343563383962396431666435313932663761353062393538623265663831303462333666316266386664326366623238633134323138303063316334376534656639386166313530303730636336643639643137653865623932663138613661613161363532363661343935323338643130336638663639356235376563663337333635306130353230303837343537323162656138313536323739363763383037363336356466386334633761376434646438663263333835306331386662613731656236306536653864666264313936653035333766643730623334346563626363353330646663383364613666656466343964353161393034313935303262613964373063643335663163663363303639346532333534663930363466646266353335656232336332376330613433643062373863316638363763363164393836393564386465663762633261313062623636373463323266363661616230613931383133646466323763646238353263353965663739653162396531613037356661366565323761376533373734646266346232363436353432376536643561623931666537663066336137313738346563613138326235303230333031303030312810320218133a603038393039376465663031623037633764393734613537353532353161366161613061666236623332613534353334336432393138653732626164303433323163313131633234643432373538306633626131653236616139643735653632360ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613561643262373634336130346330353564326638636432353131623135313339666334353537353632313338386534396331313962326633393861636131313066363133393662306338363664653530363335323262623835343032373365313366366439346365316536303433386636616662303061616136343631326637313435653962636538626331613533623934313931336161373663396633613238333366616437636632383563376163326433376639396633633263646234396465346431353165363136373835363466323831663534313432346234316661376335316232613936303232383363376433326565303065623833386461313563333861666339366530363164393763656465323231363566663161613935396631633432373562326430393863343035383661353537396662623363623930303732373034313230613861363661353237306634666366643130383663393233363930613335653766643434356533336163303366313339633638363835353635373063646334616166323231303761366331613434323435366137633663373965653034303930653765356434663636626361363063613166343762366466623534336461633363626631396137373139613866353562366638336234613362386136366436303235366430613436353531666137303234626430353633316238613535383038373732353463326632663236386364633333643264626263666237333365396662653233336262396362353961623331613031343862323365386334323638306666313061663463373961346430383334366662373961393364393632393534386561663162623132343639386661656661346364643732343432633033613034623733333433326637343839303361333235633238336434353661623961653932316165376564333339316535643137383765666463323335343061376238356336393161653837306130376639306231316331336233326365343365616564313562333639363835636534393137376363393835303230333031303030312811320218143a603939666162633461646534653636326336653238323366346139366562323134343034383465356136643064333132623730633036386432326236323936333830376332333361343964626239383361376562623330653737303637373261340ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030386434356332316330633935656636356130323964353263393537666430663835663230313233646130333465363136373164646565353437356630373338326136366336366362346463353035303464646664333735383130383364663864313735373733306564386436663336346466346333366132363531353931393535646132303161323430376661386162396232333133383131323235613064613233306662653338306530393061613536656661346632303265633962343832336636353031643936616336393865626632366161636633656532643166333261373231633934376531303736636633356233373364613164383761333661313532653030653731303131373932323832653832356666313731633538333362383835373062666336646138343439653666393566386231323635616235353531393430333135353364316435373666393363343263306361363061616261633463386464313632643831313466326232313531313538336337323533396665353663343939613932396465336134306130643435633137633538396332643739383863653236656166633932613364333762376561303034326434336530336166613632373162323632353561366363636661653533373138323164383165306230356332353062353966306139303734316130653065383861303965643536633562393738306430393566303930366630623831643531323633393832616165303131333663303732643834346131316436646134623261363163363434653161623137663136666634386565323366656465383435326631653432653264333061303739306332356434323036306531643434613637316132656232336431313466363863373165333366313736646235386136386234333030353462633164323938336132336133326561366666393566613763346438653338306562323936653938623739363865636638343534643831376337333765656135646439323165623836633136633762323933303461346137656362653561336131303230333031303030312812320218153a606537396165396337313933643164326263393433383436346338616135663632323461653835323936366134336239383235383833663766373432633533393562643330393935383761393638363662393233396431656666336165353037610ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623035616265326162303066646430366339353565383637313062306530366631613932363234613438616431636263386466633666323231323936326230633330666462643238346133376335613337363538623633633336656138313632353631613865346639343663626535373232633032383830316630663238316337306638643838633763303061326632653239663539376237393938363965643833353664663537633437626539393434613261616666363530663962346262613064626335336463383830666462623639656134353139303564323830323230326638653239633034613736643237616632656237633534383438356266336634363934633930633431383130383838383433373932383438383335663738313637303764336538643736663465363766353738306263663038383133633535656336333961396264363234313738663565623134376435303061663335316539656631623165333432343834636132363064623763636261653438366631336366323635623562316162363838303636303038303533623230633364656463653737316339613038613033323061613963653435316562396439383361376234396361613130393666386164633039383331386463333865306537636566306438653564353537613036373536383561316339653235366132626339646261333232623362623331373263663731343037376263333830663861306134333361386266613766626663353966366230393365633862663665393339376330396231386531383034306331623536363836343733376338666137653239373935663361343538386464613763326261623439353636356363346139623833366532656239306336326133666361663539316662356638313830346337363138306536323666613236343461376465333435313164366334363637643938393337653237373333663464316539313338383333353465353466643733353137323165373666376235366333343833333838663461366238376232386165626562303230333031303030312813320218163a603962343038383566313362366163316337353336393262613366313739303061333838333165363934613061663937343934623834333838323039636235656662646339386136646162623265316337313833393166633133356264616163330ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396463643863306135336539306333353539353734663636323034313137643362353033653530613336643330393766616338343239653663656364333762623534303731383038663265653938323033356638353161306339626532313736333833613232653338633161626131363866333266393035373063623332333363666536323539383736363661663637623531346361656632316662386466366430666364333363663236303662393264646561353533366236303638643836373832653339626435633338343435393931643431396237643165633038353939343132633039343964316332343062333563313464633535323734646261373166666165393336313235613566383139663534313332653234333964346163353539373939366563653835653133646666333336316639313331663536636561633562396635353262343963663666396139616336653564636532646233363934363266393361663830653562353662366538626566613136326130363162346137363839326264633834363437333036633630303835386664643237303332373663326337303434303139386566643766653335343563663261623538306337346366643634343561616637626437663734356363323532656162643236356561626565383632343137313034653639343861353537353666646332323264663061313031353234646531633363303863636630343330313165633766653936346564643834353161313330313437633037333633613335663131666465656638663261326237363137353762343335386666383962373561343864363762646336303930363933653062623836373965636262393366666462336633656439366265633933656634363536653337313661623837636534366361386531323539633866656464653866326631656130663365623263343865393635353164653132333330333435373235663435656436396338353735623531363833616661343732363231383236646232326262326431633466316533363436346139303230333031303030312814320218173a60346630613033333466393737363738313632663830643936376637323139313431333630633062376637663033316233376336396536323137333933336564616434366263626139373636376565373262666435613933346261313532326330\"\n )\n )\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/address_book/AddressBooks.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/address_book/Endpoint.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/address_book/Endpoint.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("../channel/MirrorChannel.js").MirrorError} MirrorError + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ EndPoint; }\n/* harmony export */ });\n/* harmony import */ var _IPv4Address_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IPv4Address.js */ \"./node_modules/@hashgraph/sdk/src/address_book/IPv4Address.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IServiceEndpoint} HashgraphProto.proto.IServiceEndpoint\n */\n\n/**\n * @typedef {object} EndPointJson\n * @property {string | null} address\n * @property {string | null} port\n */\n\nclass EndPoint {\n /**\n * @param {object} props\n * @param {IPv4Address} [props.address]\n * @param {number} [props.port]\n */\n constructor(props = {}) {\n /**\n * @type {IPv4Address | null}\n */\n this._address = null;\n\n if (props.address != null) {\n this.setAddress(props.address);\n }\n\n /**\n * @type {number | null}\n */\n this._port = null;\n\n if (props.port != null) {\n this.setPort(props.port);\n }\n }\n\n /**\n * @returns {?IPv4Address}\n */\n get address() {\n return this.address;\n }\n\n /**\n * @param {IPv4Address} address\n * @returns {this}\n */\n setAddress(address) {\n this._address = address;\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get port() {\n return this._port;\n }\n\n /**\n * @param {number} port\n * @returns {this}\n */\n setPort(port) {\n this._port = port;\n return this;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IServiceEndpoint} endpoint\n * @returns {EndPoint}\n */\n static _fromProtobuf(endpoint) {\n return new EndPoint({\n address:\n endpoint.ipAddressV4 != null\n ? _IPv4Address_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(endpoint.ipAddressV4)\n : undefined,\n port: endpoint.port != null ? endpoint.port : undefined,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.IServiceEndpoint}\n */\n _toProtobuf() {\n return {\n ipAddressV4:\n this._address != null ? this._address._toProtobuf() : null,\n port: this._port,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this._address != null ? this._address.toString() : \"\"}:${\n this._port != null ? this._port.toString() : \"\"\n }`;\n }\n\n /**\n * @returns {EndPointJson}\n */\n toJSON() {\n return {\n address: this._address != null ? this._address.toString() : null,\n port: this._port != null ? this._port.toString() : null,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/address_book/Endpoint.js?"); +/** + * @template {Channel} ChannelT + * @typedef {import("../client/Client.js").default} Client + */ -/***/ }), +/** + * @augments {Query} + */ +class TopicMessageQuery extends (/* unused pure expression or super */ null && (Query)) { + /** + * @param {object} props + * @param {TopicId | string} [props.topicId] + * @param {Timestamp} [props.startTime] + * @param {Timestamp} [props.endTime] + * @param {(message: TopicMessage | null, error: Error)=> void} [props.errorHandler] + * @param {() => void} [props.completionHandler] + * @param {(error: MirrorError | Error | null) => boolean} [props.retryHandler] + * @param {Long | number} [props.limit] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TopicId} + */ + this._topicId = null; + if (props.topicId != null) { + this.setTopicId(props.topicId); + } + + /** + * @private + * @type {?Timestamp} + */ + this._startTime = null; + if (props.startTime != null) { + this.setStartTime(props.startTime); + } + + /** + * @private + * @type {?Timestamp} + */ + this._endTime = null; + if (props.endTime != null) { + this.setEndTime(props.endTime); + } + + /** + * @private + * @type {?Long} + */ + this._limit = null; + if (props.limit != null) { + this.setLimit(props.limit); + } + + /** + * @private + * @type {(message: TopicMessage | null, error: Error) => void} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + this._errorHandler = (message, error) => { + console.error( + `Error attempting to subscribe to topic: ${ + this._topicId != null ? this._topicId.toString() : "" + }`, + ); + }; + + if (props.errorHandler != null) { + this._errorHandler = props.errorHandler; + } + + /* + * @private + * @type {((message: TopicMessage) => void) | null} + */ + this._listener = null; + + /** + * @private + * @type {() => void} + */ + this._completionHandler = () => { + if (this._logger) { + this._logger.info( + `Subscription to topic ${ + this._topicId != null ? this._topicId.toString() : "" + } complete`, + ); + } + }; + + if (props.completionHandler != null) { + this._completionHandler = props.completionHandler; + } + + /** + * @private + * @type {(error: MirrorError | Error | null) => boolean} + */ + this._retryHandler = (error) => { + if (error != null) { + if (error instanceof Error) { + // Retry on all errors which are not `MirrorError` because they're + // likely lower level HTTP/2 errors + return true; + } else { + // Retry on `NOT_FOUND`, `RESOURCE_EXHAUSTED`, `UNAVAILABLE`, and conditionally on `INTERNAL` + // if the message matches the right regex. + switch (error.code) { + // INTERNAL + // eslint-disable-next-line no-fallthrough + case 13: + return RST_STREAM.test(error.details.toString()); + // NOT_FOUND + // eslint-disable-next-line no-fallthrough + case 5: + // RESOURCE_EXHAUSTED + // eslint-disable-next-line no-fallthrough + case 8: + // UNAVAILABLE + // eslint-disable-next-line no-fallthrough + case 14: + case 17: + return true; + default: + return false; + } + } + } + + return false; + }; + + if (props.retryHandler != null) { + this._retryHandler = props.retryHandler; + } + + /** + * @private + * @type {number} + */ + this._attempt = 0; + + /** + * @private + * @type {SubscriptionHandle | null} + */ + this._handle = null; + + this.setMaxBackoff(8000); + } + + /** + * @returns {?TopicId} + */ + get topicId() { + return this._topicId; + } + + /** + * @param {TopicId | string} topicId + * @returns {TopicMessageQuery} + */ + setTopicId(topicId) { + this.requireNotSubscribed(); + + this._topicId = + typeof topicId === "string" + ? TopicId.fromString(topicId) + : topicId.clone(); + + return this; + } + + /** + * @returns {?Timestamp} + */ + get startTime() { + return this._startTime; + } + + /** + * @param {Timestamp | Date | number} startTime + * @returns {TopicMessageQuery} + */ + setStartTime(startTime) { + this.requireNotSubscribed(); + + this._startTime = + startTime instanceof Timestamp + ? startTime + : startTime instanceof Date + ? Timestamp.fromDate(startTime) + : new Timestamp(startTime, 0); + return this; + } + + /** + * @returns {?Timestamp} + */ + get endTime() { + return this._endTime; + } + + /** + * @param {Timestamp | Date | number} endTime + * @returns {TopicMessageQuery} + */ + setEndTime(endTime) { + this.requireNotSubscribed(); + + this._endTime = + endTime instanceof Timestamp + ? endTime + : endTime instanceof Date + ? Timestamp.fromDate(endTime) + : new Timestamp(endTime, 0); + return this; + } + + /** + * @returns {?Long} + */ + get limit() { + return this._limit; + } + + /** + * @param {Long | number} limit + * @returns {TopicMessageQuery} + */ + setLimit(limit) { + this.requireNotSubscribed(); + + this._limit = limit instanceof Long ? limit : Long.fromValue(limit); + + return this; + } + + /** + * @param {(message: TopicMessage | null, error: Error)=> void} errorHandler + * @returns {TopicMessageQuery} + */ + setErrorHandler(errorHandler) { + this._errorHandler = errorHandler; + + return this; + } + + /** + * @param {() => void} completionHandler + * @returns {TopicMessageQuery} + */ + setCompletionHandler(completionHandler) { + this.requireNotSubscribed(); + + this._completionHandler = completionHandler; + + return this; + } + + /** + * @param {number} attempts + * @returns {this} + */ + setMaxAttempts(attempts) { + this.requireNotSubscribed(); + this._maxAttempts = attempts; + return this; + } + + /** + * @param {number} backoff + * @returns {this} + */ + setMaxBackoff(backoff) { + this.requireNotSubscribed(); + this._maxBackoff = backoff; + return this; + } + + /** + * @param {Client} client + * @param {((message: TopicMessage | null, error: Error) => void) | null} errorHandler + * @param {(message: TopicMessage) => void} listener + * @returns {SubscriptionHandle} + */ + subscribe(client, errorHandler, listener) { + this._handle = new SubscriptionHandle(); + this._listener = listener; + + if (errorHandler != null) { + this._errorHandler = errorHandler; + } + + this._makeServerStreamRequest(client); + + return this._handle; + } + + /** + * @private + * @param {Client} client + * @returns {void} + */ + _makeServerStreamRequest(client) { + /** @type {Map} */ + + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const list = new Map(); + + const request = + HashgraphProto.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode( + { + topicID: + this._topicId != null + ? this._topicId._toProtobuf() + : null, + consensusStartTime: + this._startTime != null + ? this._startTime._toProtobuf() + : null, + consensusEndTime: + this._endTime != null + ? this._endTime._toProtobuf() + : null, + limit: this._limit, + }, + ).finish(); + + const cancel = client._mirrorNetwork + .getNextMirrorNode() + .getChannel() + .makeServerStreamRequest( + "ConsensusService", + "subscribeTopic", + request, + (data) => { + const message = + HashgraphProto.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode( + data, + ); + + if (this._limit != null && this._limit.gt(0)) { + this._limit = this._limit.sub(1); + } + + this._startTime = Timestamp._fromProtobuf( + /** @type {HashgraphProto.proto.ITimestamp} */ ( + message.consensusTimestamp + ), + ).plusNanos(1); + + if ( + message.chunkInfo == null || + (message.chunkInfo != null && + message.chunkInfo.total === 1) + ) { + this._passTopicMessage(TopicMessage._ofSingle(message)); + } else { + const chunkInfo = + /** @type {HashgraphProto.proto.IConsensusMessageChunkInfo} */ ( + message.chunkInfo + ); + const initialTransactionID = + /** @type {HashgraphProto.proto.ITransactionID} */ ( + chunkInfo.initialTransactionID + ); + const total = /** @type {number} */ (chunkInfo.total); + const transactionId = + TransactionId._fromProtobuf( + initialTransactionID, + ).toString(); + + /** @type {HashgraphProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]} */ + let responses = []; + + const temp = list.get(transactionId); + if (temp == null) { + list.set(transactionId, responses); + } else { + responses = temp; + } + + responses.push(message); + + if (responses.length === total) { + const topicMessage = + TopicMessage._ofMany(responses); + + list.delete(transactionId); + + this._passTopicMessage(topicMessage); + } + } + }, + (error) => { + const message = + error instanceof Error ? error.message : error.details; + + if ( + this._attempt < this._maxAttempts && + this._retryHandler(error) + ) { + const delay = Math.min( + 250 * 2 ** this._attempt, + this._maxBackoff, + ); + console.warn( + `Error subscribing to topic ${ + this._topicId != null + ? this._topicId.toString() + : "UNKNOWN" + } during attempt ${ + this._attempt + }. Waiting ${delay} ms before next attempt: ${message}`, + ); + + this._attempt += 1; + + setTimeout(() => { + this._makeServerStreamRequest(client); + }, delay); + } else { + this._errorHandler(null, new Error(message)); + } + }, + this._completionHandler, + ); + + if (this._handle != null) { + this._handle._setCall(() => cancel()); + } + } + + requireNotSubscribed() { + if (this._handle != null) { + throw new Error( + "Cannot change fields on an already subscribed query", + ); + } + } + + /** + * @private + * @param {TopicMessage} topicMessage + */ + _passTopicMessage(topicMessage) { + try { + if (this._listener != null) { + this._listener(topicMessage); + } else { + throw new Error("(BUG) listener is unexpectedly not set"); + } + } catch (error) { + this._errorHandler(topicMessage, /** @type {Error} */ (error)); + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicMessageSubmitTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/address_book/IPv4Address.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/address_book/IPv4Address.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ IPv4Address; }\n/* harmony export */ });\n/* harmony import */ var _IPv4AddressPart_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IPv4AddressPart.js */ \"./node_modules/@hashgraph/sdk/src/address_book/IPv4AddressPart.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\nclass IPv4Address {\n /**\n * @param {object} props\n * @param {IPv4AddressPart} [props.network]\n * @param {IPv4AddressPart} [props.host]\n */\n constructor(props = {}) {\n /**\n * @type {IPv4AddressPart | null}\n */\n this._network = null;\n\n if (props.network != null) {\n this.setNetwork(props.network);\n }\n\n /**\n * @type {IPv4AddressPart | null}\n */\n this._host = null;\n\n if (props.host != null) {\n this.setHost(props.host);\n }\n }\n\n /**\n * @returns {?IPv4AddressPart}\n */\n get newtork() {\n return this._network;\n }\n\n /**\n * @param {IPv4AddressPart} part\n * @returns {this}\n */\n setNetwork(part) {\n this._network = part;\n return this;\n }\n\n /**\n * @returns {?IPv4AddressPart}\n */\n get host() {\n return this._host;\n }\n\n /**\n * @param {IPv4AddressPart} part\n * @returns {this}\n */\n setHost(part) {\n this._host = part;\n return this;\n }\n\n /**\n * @internal\n * @param {Uint8Array} bytes\n * @returns {IPv4Address}\n */\n static _fromProtobuf(bytes) {\n return new IPv4Address({\n network: new _IPv4AddressPart_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]().setLeft(bytes[0]).setRight(bytes[1]),\n host: new _IPv4AddressPart_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]().setLeft(bytes[2]).setRight(bytes[3]),\n });\n }\n\n /**\n * @returns {Uint8Array}\n */\n _toProtobuf() {\n return Uint8Array.of(\n this._network != null && this._network._left != null\n ? this._network._left\n : 0,\n this._network != null && this._network.right != null\n ? this._network.right\n : 0,\n this._host != null && this._host.left != null ? this._host.left : 0,\n this._host != null && this._host.right != null\n ? this._host.right\n : 0\n );\n }\n\n /**\n * @returns {string}\n */\n toString() {\n if (this._network != null && this._host != null) {\n return `${this._network.toString()}.${this._host.toString()}`;\n } else {\n return \"\";\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/address_book/IPv4Address.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/address_book/IPv4AddressPart.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/address_book/IPv4AddressPart.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ IPv4AddressPart; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\nclass IPv4AddressPart {\n /**\n * @param {object} props\n * @param {number} [props.left]\n * @param {number} [props.right]\n */\n constructor(props = {}) {\n /**\n * @type {number | null}\n */\n this._left = null;\n\n if (props.left != null) {\n this.setLeft(props.left);\n }\n\n /**\n * @type {number | null}\n */\n this._right = null;\n\n if (props.right != null) {\n this.setRight(props.right);\n }\n }\n\n /**\n * @returns {?number}\n */\n get left() {\n return this._left;\n }\n\n /**\n * @param {number} part\n * @returns {this}\n */\n setLeft(part) {\n this._left = part;\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get right() {\n return this._right;\n }\n\n /**\n * @param {number} part\n * @returns {this}\n */\n setRight(part) {\n this._right = part;\n return this;\n }\n\n /**\n * @returns {string}\n */\n toString() {\n if (this._left != null && this._right != null) {\n return `${this._left.toString()}.${this._right.toString()}`;\n } else {\n return \"\";\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/address_book/IPv4AddressPart.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/address_book/NodeAddress.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/address_book/NodeAddress.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ NodeAddress; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Endpoint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Endpoint.js */ \"./node_modules/@hashgraph/sdk/src/address_book/Endpoint.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.INodeAddress} HashgraphProto.proto.INodeAddress\n */\n\n/**\n * @typedef {import(\"./Endpoint.js\").EndPointJson} EndpointJson\n * @typedef {import(\"long\").Long} Long\n */\n\n/**\n * @typedef {object} NodeAddressJson\n * @property {string | null} publicKey\n * @property {string | null} nodeId\n * @property {string | null} accountId\n * @property {string | null} certHash\n * @property {EndpointJson[] | null} addresses\n * @property {string | null} description\n * @property {string | null} stake\n */\n\nclass NodeAddress {\n /**\n * @param {object} props\n * @param {string} [props.publicKey]\n * @param {Long} [props.nodeId]\n * @param {AccountId | string} [props.accountId]\n * @param {Uint8Array} [props.certHash]\n * @param {Endpoint[]} [props.addresses]\n * @param {string} [props.description]\n * @param {Long} [props.stake]\n */\n constructor(props = {}) {\n /**\n * @type {string | null}\n */\n this._publicKey = null;\n\n if (props.publicKey != null) {\n this.setPublicKey(props.publicKey);\n }\n\n /**\n * @type {Long |null}\n */\n this._nodeId = null;\n\n if (props.nodeId != null) {\n this.setNodeId(props.nodeId);\n }\n\n /**\n * @type {AccountId | null}\n */\n this._accountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n /**\n * @type {Uint8Array | null}\n */\n this._certHash = null;\n\n if (props.certHash != null) {\n this.setCertHash(props.certHash);\n }\n\n /**\n * @type {Endpoint[]}\n */\n this._addresses = [];\n\n if (props.addresses != null) {\n this.setAddresses(props.addresses);\n }\n\n /**\n * @type {string | null}\n */\n this._description = null;\n\n if (props.description != null) {\n this.setDescription(props.description);\n }\n\n /**\n * @type {Long | null}\n */\n this._stake = null;\n\n if (props.stake != null) {\n this.setStake(props.stake);\n }\n }\n\n /**\n * @returns {?string}\n */\n get publicKey() {\n return this._publicKey;\n }\n\n /**\n * @param {string} publicKey\n * @returns {this}\n */\n setPublicKey(publicKey) {\n this._publicKey = publicKey;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get nodeId() {\n return this._nodeId;\n }\n\n /**\n * @param {Long} nodeId\n * @returns {this}\n */\n setNodeId(nodeId) {\n this._nodeId = nodeId;\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(accountId)\n : accountId.clone();\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get certHash() {\n return this._certHash;\n }\n\n /**\n * @param {Uint8Array} certHash\n * @returns {this}\n */\n setCertHash(certHash) {\n this._certHash = certHash;\n return this;\n }\n\n /**\n * @returns {Endpoint[]}\n */\n get addresses() {\n return this._addresses;\n }\n\n /**\n * @param {Endpoint[]} addresses\n * @returns {this}\n */\n setAddresses(addresses) {\n this._addresses = addresses;\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get description() {\n return this._description;\n }\n\n /**\n * @param {string} description\n * @returns {this}\n */\n setDescription(description) {\n this._description = description;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stake() {\n return this._stake;\n }\n\n /**\n * @param {Long} stake\n * @returns {this}\n */\n setStake(stake) {\n this._stake = stake;\n return this;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.INodeAddress} nodeAddress\n * @returns {NodeAddress}\n */\n static _fromProtobuf(nodeAddress) {\n return new NodeAddress({\n publicKey:\n nodeAddress.RSA_PubKey != null\n ? nodeAddress.RSA_PubKey\n : undefined,\n nodeId: nodeAddress.nodeId != null ? nodeAddress.nodeId : undefined,\n accountId:\n nodeAddress.nodeAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(nodeAddress.nodeAccountId)\n : undefined,\n certHash:\n nodeAddress.nodeCertHash != null\n ? nodeAddress.nodeCertHash\n : undefined,\n addresses:\n nodeAddress.serviceEndpoint != null\n ? nodeAddress.serviceEndpoint.map((address) =>\n _Endpoint_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(address)\n )\n : undefined,\n description:\n nodeAddress.description != null\n ? nodeAddress.description\n : undefined,\n stake: nodeAddress.stake != null ? nodeAddress.stake : undefined,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.INodeAddress}\n */\n _toProtobuf() {\n return {\n RSA_PubKey: this._publicKey,\n nodeId: this._nodeId,\n nodeAccountId:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n nodeCertHash: this._certHash,\n serviceEndpoint: this._addresses.map((address) =>\n address._toProtobuf()\n ),\n description: this._description,\n stake: this._stake,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {NodeAddressJson}\n */\n toJSON() {\n return {\n publicKey: this._publicKey,\n nodeId: this._nodeId != null ? this._nodeId.toString() : null,\n accountId:\n this._accountId != null ? this._accountId.toString() : null,\n certHash:\n this._certHash != null ? _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__.decode(this._certHash) : null,\n addresses: this._addresses.map((address) => address.toJSON()),\n description: this._description,\n stake: this._stake != null ? this._stake.toString() : null,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/address_book/NodeAddress.js?"); +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IConsensusSubmitMessageTransactionBody} HashgraphProto.proto.IConsensusSubmitMessageTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.IConsensusMessageChunkInfo} HashgraphProto.proto.IConsensusMessageChunkInfo + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../account/AccountId.js").default} AccountId + * @typedef {import("../transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("../schedule/ScheduleCreateTransaction.js").default} ScheduleCreateTransaction + */ -/***/ "./node_modules/@hashgraph/sdk/src/address_book/NodeAddressBook.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/address_book/NodeAddressBook.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +class TopicMessageSubmitTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {TopicId | string} [props.topicId] + * @param {Uint8Array | string} [props.message] + * @param {number} [props.maxChunks] + * @param {number} [props.chunkSize] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TopicId} + */ + this._topicId = null; + + if (props.topicId != null) { + this.setTopicId(props.topicId); + } + + /** + * @private + * @type {?Uint8Array} + */ + this._message = null; + + if (props.message != null) { + this.setMessage(props.message); + } + + /** + * @private + * @type {number} + */ + this._maxChunks = 20; + + /** + * @private + * @type {number} + */ + this._chunkSize = CHUNK_SIZE; + + if (props.maxChunks != null) { + this.setMaxChunks(props.maxChunks); + } + + if (props.chunkSize != null) { + this.setChunkSize(props.chunkSize); + } + + /** @type {HashgraphProto.proto.IConsensusMessageChunkInfo | null} */ + this._chunkInfo = null; + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TopicMessageSubmitTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const message = + /** @type {HashgraphProto.proto.IConsensusSubmitMessageTransactionBody} */ ( + body.consensusSubmitMessage + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TopicMessageSubmitTransaction({ + topicId: + message.topicID != null + ? TopicId_TopicId._fromProtobuf(message.topicID) + : undefined, + message: message.message != null ? message.message : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?TopicId} + */ + get topicId() { + return this._topicId; + } + + /** + * @param {TopicId | string} topicId + * @returns {this} + */ + setTopicId(topicId) { + this._requireNotFrozen(); + + this._topicId = + typeof topicId === "string" + ? TopicId_TopicId.fromString(topicId) + : topicId.clone(); + + return this; + } + + /** + * @deprecated - Use `getMessage()` instead + * @returns {?Uint8Array} + */ + get message() { + return this._message; + } + + /** + * @returns {?Uint8Array} + */ + getMessage() { + return this._message; + } + + /** + * @param {string | Uint8Array} message + * @returns {this} + */ + setMessage(message) { + this._requireNotFrozen(); + message = requireStringOrUint8Array(message); + this._message = + message instanceof Uint8Array ? message : encoding_utf8_browser_encode(message); + return this; + } + + /** + * @deprecated - Use `getMaxChunks()` instead + * @returns {?number} + */ + get maxChunks() { + return this._maxChunks; + } + + /** + * @returns {?number} + */ + getMaxChunks() { + return this._maxChunks; + } + + /** + * @param {number} maxChunks + * @returns {this} + */ + setMaxChunks(maxChunks) { + this._requireNotFrozen(); + this._maxChunks = maxChunks; + return this; + } + + /** + * @deprecated - Use `getChunkSize()` instead + * @returns {?number} + */ + get chunkSize() { + return this._chunkSize; + } + + /** + * @returns {?number} + */ + getChunkSize() { + return this._chunkSize; + } + + /** + * @param {number} chunkSize + * @returns {this} + */ + setChunkSize(chunkSize) { + this._chunkSize = chunkSize; + return this; + } + + /** + * Freeze this transaction from further modification to prepare for + * signing or serialization. + * + * Will use the `Client`, if available, to generate a default Transaction ID and select 1/3 + * nodes to prepare this transaction for. + * + * @param {?import("../client/Client.js").default} client + * @returns {this} + */ + freezeWith(client) { + super.freezeWith(client); + + if (this._message == null) { + return this; + } + + const chunks = Math.floor( + (this._message.length + (this._chunkSize - 1)) / this._chunkSize, + ); + + if (chunks > this._maxChunks) { + throw new Error( + `Message with size ${this._message.length} too long for ${this._maxChunks} chunks`, + ); + } + + const initialTransactionId = this._getTransactionId()._toProtobuf(); + let nextTransactionId = this._getTransactionId(); + + // Hack around the locked list. Should refactor a bit to remove such code + this._transactionIds.locked = false; + + this._transactions.clear(); + this._transactionIds.clear(); + this._signedTransactions.clear(); + + for (let chunk = 0; chunk < chunks; chunk++) { + this._chunkInfo = { + initialTransactionID: initialTransactionId, + total: chunks, + number: chunk + 1, + }; + + this._transactionIds.push(nextTransactionId); + this._transactionIds.advance(); + + for (const nodeAccountId of this._nodeAccountIds.list) { + this._signedTransactions.push( + this._makeSignedTransaction(nodeAccountId), + ); + } + + nextTransactionId = new TransactionId_TransactionId( + /** @type {AccountId} */ (nextTransactionId.accountId), + new Timestamp_Timestamp( + /** @type {Timestamp} */ ( + nextTransactionId.validStart + ).seconds, + /** @type {Timestamp} */ ( + nextTransactionId.validStart + ).nanos.add(1), + ), + ); + } + + this._transactionIds.advance(); + this._chunkInfo = null; + + return this; + } + + /** + * @returns {ScheduleCreateTransaction} + */ + schedule() { + this._requireNotFrozen(); + + if (this._message != null && this._message.length > this._chunkSize) { + throw new Error( + `cannot schedule \`TopicMessageSubmitTransaction\` with message over ${this._chunkSize} bytes`, + ); + } + + return super.schedule(); + } + + /** + * @param {import("../client/Client.js").default} client + * @param {number=} requestTimeout + * @returns {Promise} + */ + async execute(client, requestTimeout) { + return (await this.executeAll(client, requestTimeout))[0]; + } + + /** + * @param {import("../client/Client.js").default} client + * @param {number=} requestTimeout + * @returns {Promise} + */ + async executeAll(client, requestTimeout) { + if (!super._isFrozen()) { + this.freezeWith(client); + } + + // on execute, sign each transaction with the operator, if present + // and we are signing a transaction that used the default transaction ID + + const transactionId = this._getTransactionId(); + const operatorAccountId = client.operatorAccountId; + + if ( + operatorAccountId != null && + operatorAccountId.equals( + /** @type {AccountId} */ (transactionId.accountId), + ) + ) { + await super.signWithOperator(client); + } + + const responses = []; + let remainingTimeout = requestTimeout; + for (let i = 0; i < this._transactionIds.length; i++) { + const startTimestamp = Date.now(); + responses.push(await super.execute(client, remainingTimeout)); + + if (remainingTimeout != null) { + remainingTimeout = Date.now() - startTimestamp; + } + } + + return responses; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.consensus.submitMessage(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "consensusSubmitMessage"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IConsensusSubmitMessageTransactionBody} + */ + _makeTransactionData() { + if (this._chunkInfo != null && this._message != null) { + const num = /** @type {number} */ (this._chunkInfo.number); + const startIndex = (num - 1) * this._chunkSize; + let endIndex = startIndex + this._chunkSize; + + if (endIndex > this._message.length) { + endIndex = this._message.length; + } + + return { + topicID: + this._topicId != null ? this._topicId._toProtobuf() : null, + message: this._message.slice(startIndex, endIndex), + chunkInfo: this._chunkInfo, + }; + } else { + return { + topicID: + this._topicId != null ? this._topicId._toProtobuf() : null, + message: this._message, + }; + } + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TopicMessageSubmitTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "consensusSubmitMessage", + // eslint-disable-next-line @typescript-eslint/unbound-method + TopicMessageSubmitTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/topic/TopicUpdateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ NodeAddressBook; }\n/* harmony export */ });\n/* harmony import */ var _NodeAddress_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeAddress.js */ \"./node_modules/@hashgraph/sdk/src/address_book/NodeAddress.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"./NodeAddress.js\").NodeAddressJson} NodeAddressJson\n */\n\n/**\n * @typedef {object} NodeAddressBookJson\n * @property {NodeAddressJson[]} nodeAddresses\n */\n\nclass NodeAddressBook {\n /**\n * @param {object} props\n * @param {NodeAddress[]} [props.nodeAddresses]\n */\n constructor(props = {}) {\n /**\n * @type {NodeAddress[]}\n */\n this._nodeAddresses = [];\n\n if (props.nodeAddresses != null) {\n this.setNodeAddresses(props.nodeAddresses);\n }\n }\n\n /**\n * @returns {NodeAddress[]}\n */\n get nodeAddresses() {\n return this._nodeAddresses;\n }\n\n /**\n * @param {NodeAddress[]} nodeAddresses\n * @returns {this}\n */\n setNodeAddresses(nodeAddresses) {\n this._nodeAddresses = nodeAddresses;\n return this;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {NodeAddressBook}\n */\n static fromBytes(bytes) {\n return NodeAddressBook._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.NodeAddressBook.decode(bytes)\n );\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.INodeAddressBook} nodeAddressBook\n * @returns {NodeAddressBook}\n */\n static _fromProtobuf(nodeAddressBook) {\n return new NodeAddressBook({\n nodeAddresses:\n nodeAddressBook.nodeAddress != null\n ? nodeAddressBook.nodeAddress.map((nodeAddress) =>\n _NodeAddress_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(nodeAddress)\n )\n : undefined,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.INodeAddressBook}\n */\n _toProtobuf() {\n return {\n nodeAddress: this._nodeAddresses.map((nodeAddress) =>\n nodeAddress._toProtobuf()\n ),\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {NodeAddressBookJson}\n */\n toJSON() {\n return {\n nodeAddresses: this._nodeAddresses.map((nodeAddress) =>\n nodeAddress.toJSON()\n ),\n };\n }\n\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.NodeAddressBook.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/address_book/NodeAddressBook.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/array.js": -/*!**************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/array.js ***! - \**************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"arrayEqual\": function() { return /* binding */ arrayEqual; },\n/* harmony export */ \"arrayStartsWith\": function() { return /* binding */ arrayStartsWith; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * A simple efficient function for comparing byte arrays\n *\n * @param {Uint8Array} array1\n * @param {Uint8Array} array2\n * @returns {boolean}\n */\nfunction arrayEqual(array1, array2) {\n if (array1 === array2) {\n return true;\n }\n\n if (array1.byteLength !== array2.byteLength) {\n return false;\n }\n\n const view1 = new DataView(\n array1.buffer,\n array1.byteOffset,\n array1.byteLength\n );\n const view2 = new DataView(\n array2.buffer,\n array2.byteOffset,\n array2.byteLength\n );\n\n let i = array1.byteLength;\n\n while (i--) {\n if (view1.getUint8(i) !== view2.getUint8(i)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * @param {Uint8Array} array\n * @param {Uint8Array} arrayPrefix\n * @returns {boolean}\n */\nfunction arrayStartsWith(array, arrayPrefix) {\n if (array.byteLength < arrayPrefix.byteLength) {\n return false;\n }\n\n let i = arrayPrefix.byteLength;\n\n while (i--) {\n if (array[i] !== arrayPrefix[i]) {\n return false;\n }\n }\n\n return true;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/array.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/browser.js": -/*!****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/browser.js ***! - \****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AccountAllowanceAdjustTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountAllowanceAdjustTransaction; },\n/* harmony export */ \"AccountAllowanceApproveTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountAllowanceApproveTransaction; },\n/* harmony export */ \"AccountAllowanceDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountAllowanceDeleteTransaction; },\n/* harmony export */ \"AccountBalance\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountBalance; },\n/* harmony export */ \"AccountBalanceQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountBalanceQuery; },\n/* harmony export */ \"AccountCreateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountCreateTransaction; },\n/* harmony export */ \"AccountDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountDeleteTransaction; },\n/* harmony export */ \"AccountId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountId; },\n/* harmony export */ \"AccountInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountInfo; },\n/* harmony export */ \"AccountInfoFlow\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountInfoFlow; },\n/* harmony export */ \"AccountInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountInfoQuery; },\n/* harmony export */ \"AccountRecordsQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountRecordsQuery; },\n/* harmony export */ \"AccountStakersQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountStakersQuery; },\n/* harmony export */ \"AccountUpdateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AccountUpdateTransaction; },\n/* harmony export */ \"AddressBookQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AddressBookQuery; },\n/* harmony export */ \"AssessedCustomFee\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.AssessedCustomFee; },\n/* harmony export */ \"BadKeyError\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.BadKeyError; },\n/* harmony export */ \"BadMnemonicError\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.BadMnemonicError; },\n/* harmony export */ \"BadMnemonicReason\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.BadMnemonicReason; },\n/* harmony export */ \"Cache\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Cache; },\n/* harmony export */ \"Client\": function() { return /* reexport safe */ _client_WebClient_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]; },\n/* harmony export */ \"ContractByteCodeQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractByteCodeQuery; },\n/* harmony export */ \"ContractCallQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractCallQuery; },\n/* harmony export */ \"ContractCreateFlow\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractCreateFlow; },\n/* harmony export */ \"ContractCreateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractCreateTransaction; },\n/* harmony export */ \"ContractDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractDeleteTransaction; },\n/* harmony export */ \"ContractExecuteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractExecuteTransaction; },\n/* harmony export */ \"ContractFunctionParameters\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractFunctionParameters; },\n/* harmony export */ \"ContractFunctionResult\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractFunctionResult; },\n/* harmony export */ \"ContractFunctionSelector\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractFunctionSelector; },\n/* harmony export */ \"ContractId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractId; },\n/* harmony export */ \"ContractInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractInfo; },\n/* harmony export */ \"ContractInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractInfoQuery; },\n/* harmony export */ \"ContractLogInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractLogInfo; },\n/* harmony export */ \"ContractUpdateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ContractUpdateTransaction; },\n/* harmony export */ \"CustomFee\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.CustomFee; },\n/* harmony export */ \"CustomFixedFee\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.CustomFixedFee; },\n/* harmony export */ \"CustomFractionalFee\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.CustomFractionalFee; },\n/* harmony export */ \"CustomRoyaltyFee\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.CustomRoyaltyFee; },\n/* harmony export */ \"DelegateContractId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.DelegateContractId; },\n/* harmony export */ \"EthereumFlow\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.EthereumFlow; },\n/* harmony export */ \"EthereumTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.EthereumTransaction; },\n/* harmony export */ \"EthereumTransactionData\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.EthereumTransactionData; },\n/* harmony export */ \"EthereumTransactionDataEip1559\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.EthereumTransactionDataEip1559; },\n/* harmony export */ \"EthereumTransactionDataLegacy\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.EthereumTransactionDataLegacy; },\n/* harmony export */ \"ExchangeRate\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ExchangeRate; },\n/* harmony export */ \"ExchangeRates\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ExchangeRates; },\n/* harmony export */ \"Executable\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Executable; },\n/* harmony export */ \"FeeAssessmentMethod\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FeeAssessmentMethod; },\n/* harmony export */ \"FeeComponents\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FeeComponents; },\n/* harmony export */ \"FeeData\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FeeData; },\n/* harmony export */ \"FeeDataType\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FeeDataType; },\n/* harmony export */ \"FeeSchedule\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FeeSchedule; },\n/* harmony export */ \"FeeSchedules\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FeeSchedules; },\n/* harmony export */ \"FileAppendTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileAppendTransaction; },\n/* harmony export */ \"FileContentsQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileContentsQuery; },\n/* harmony export */ \"FileCreateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileCreateTransaction; },\n/* harmony export */ \"FileDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileDeleteTransaction; },\n/* harmony export */ \"FileId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileId; },\n/* harmony export */ \"FileInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileInfo; },\n/* harmony export */ \"FileInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileInfoQuery; },\n/* harmony export */ \"FileUpdateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FileUpdateTransaction; },\n/* harmony export */ \"FreezeTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.FreezeTransaction; },\n/* harmony export */ \"HEDERA_PATH\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.HEDERA_PATH; },\n/* harmony export */ \"Hbar\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Hbar; },\n/* harmony export */ \"HbarAllowance\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.HbarAllowance; },\n/* harmony export */ \"HbarUnit\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.HbarUnit; },\n/* harmony export */ \"Key\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Key; },\n/* harmony export */ \"KeyList\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.KeyList; },\n/* harmony export */ \"LedgerId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.LedgerId; },\n/* harmony export */ \"LiveHash\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.LiveHash; },\n/* harmony export */ \"LiveHashAddTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.LiveHashAddTransaction; },\n/* harmony export */ \"LiveHashDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.LiveHashDeleteTransaction; },\n/* harmony export */ \"LiveHashQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.LiveHashQuery; },\n/* harmony export */ \"Logger\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Logger; },\n/* harmony export */ \"MaxQueryPaymentExceeded\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.MaxQueryPaymentExceeded; },\n/* harmony export */ \"Mnemonic\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Mnemonic; },\n/* harmony export */ \"NetworkName\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.NetworkName; },\n/* harmony export */ \"NetworkVersionInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.NetworkVersionInfo; },\n/* harmony export */ \"NetworkVersionInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.NetworkVersionInfoQuery; },\n/* harmony export */ \"NftId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.NftId; },\n/* harmony export */ \"PrecheckStatusError\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.PrecheckStatusError; },\n/* harmony export */ \"PrivateKey\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.PrivateKey; },\n/* harmony export */ \"PrngTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.PrngTransaction; },\n/* harmony export */ \"Provider\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Provider; },\n/* harmony export */ \"ProxyStaker\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ProxyStaker; },\n/* harmony export */ \"PublicKey\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.PublicKey; },\n/* harmony export */ \"Query\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Query; },\n/* harmony export */ \"ReceiptStatusError\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ReceiptStatusError; },\n/* harmony export */ \"RequestType\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.RequestType; },\n/* harmony export */ \"SLIP44_ECDSA_ETH_PATH\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.SLIP44_ECDSA_ETH_PATH; },\n/* harmony export */ \"SLIP44_ECDSA_HEDERA_PATH\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.SLIP44_ECDSA_HEDERA_PATH; },\n/* harmony export */ \"ScheduleCreateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ScheduleCreateTransaction; },\n/* harmony export */ \"ScheduleDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ScheduleDeleteTransaction; },\n/* harmony export */ \"ScheduleId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ScheduleId; },\n/* harmony export */ \"ScheduleInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ScheduleInfo; },\n/* harmony export */ \"ScheduleInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ScheduleInfoQuery; },\n/* harmony export */ \"ScheduleSignTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.ScheduleSignTransaction; },\n/* harmony export */ \"SemanticVersion\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.SemanticVersion; },\n/* harmony export */ \"Signer\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Signer; },\n/* harmony export */ \"SignerSignature\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.SignerSignature; },\n/* harmony export */ \"Status\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Status; },\n/* harmony export */ \"StatusError\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.StatusError; },\n/* harmony export */ \"SubscriptionHandle\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.SubscriptionHandle; },\n/* harmony export */ \"SystemDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.SystemDeleteTransaction; },\n/* harmony export */ \"SystemUndeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.SystemUndeleteTransaction; },\n/* harmony export */ \"Timestamp\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Timestamp; },\n/* harmony export */ \"TokenAllowance\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenAllowance; },\n/* harmony export */ \"TokenAssociateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenAssociateTransaction; },\n/* harmony export */ \"TokenBurnTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenBurnTransaction; },\n/* harmony export */ \"TokenCreateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenCreateTransaction; },\n/* harmony export */ \"TokenDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenDeleteTransaction; },\n/* harmony export */ \"TokenDissociateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenDissociateTransaction; },\n/* harmony export */ \"TokenFeeScheduleUpdateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenFeeScheduleUpdateTransaction; },\n/* harmony export */ \"TokenFreezeTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenFreezeTransaction; },\n/* harmony export */ \"TokenGrantKycTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenGrantKycTransaction; },\n/* harmony export */ \"TokenId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenId; },\n/* harmony export */ \"TokenInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenInfo; },\n/* harmony export */ \"TokenInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenInfoQuery; },\n/* harmony export */ \"TokenMintTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenMintTransaction; },\n/* harmony export */ \"TokenNftAllowance\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenNftAllowance; },\n/* harmony export */ \"TokenNftInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenNftInfo; },\n/* harmony export */ \"TokenNftInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenNftInfoQuery; },\n/* harmony export */ \"TokenPauseTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenPauseTransaction; },\n/* harmony export */ \"TokenRevokeKycTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenRevokeKycTransaction; },\n/* harmony export */ \"TokenSupplyType\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenSupplyType; },\n/* harmony export */ \"TokenType\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenType; },\n/* harmony export */ \"TokenUnfreezeTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenUnfreezeTransaction; },\n/* harmony export */ \"TokenUnpauseTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenUnpauseTransaction; },\n/* harmony export */ \"TokenUpdateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenUpdateTransaction; },\n/* harmony export */ \"TokenWipeTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TokenWipeTransaction; },\n/* harmony export */ \"TopicCreateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicCreateTransaction; },\n/* harmony export */ \"TopicDeleteTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicDeleteTransaction; },\n/* harmony export */ \"TopicId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicId; },\n/* harmony export */ \"TopicInfo\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicInfo; },\n/* harmony export */ \"TopicInfoQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicInfoQuery; },\n/* harmony export */ \"TopicMessage\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicMessage; },\n/* harmony export */ \"TopicMessageChunk\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicMessageChunk; },\n/* harmony export */ \"TopicMessageQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicMessageQuery; },\n/* harmony export */ \"TopicMessageSubmitTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicMessageSubmitTransaction; },\n/* harmony export */ \"TopicUpdateTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TopicUpdateTransaction; },\n/* harmony export */ \"Transaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Transaction; },\n/* harmony export */ \"TransactionFeeSchedule\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransactionFeeSchedule; },\n/* harmony export */ \"TransactionId\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransactionId; },\n/* harmony export */ \"TransactionReceipt\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransactionReceipt; },\n/* harmony export */ \"TransactionReceiptQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransactionReceiptQuery; },\n/* harmony export */ \"TransactionRecord\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransactionRecord; },\n/* harmony export */ \"TransactionRecordQuery\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransactionRecordQuery; },\n/* harmony export */ \"TransactionResponse\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransactionResponse; },\n/* harmony export */ \"Transfer\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Transfer; },\n/* harmony export */ \"TransferTransaction\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.TransferTransaction; },\n/* harmony export */ \"Wallet\": function() { return /* reexport safe */ _exports_js__WEBPACK_IMPORTED_MODULE_0__.Wallet; }\n/* harmony export */ });\n/* harmony import */ var _exports_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./exports.js */ \"./node_modules/@hashgraph/sdk/src/exports.js\");\n/* harmony import */ var _client_WebClient_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./client/WebClient.js */ \"./node_modules/@hashgraph/sdk/src/client/WebClient.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * The entry point for Browser applications\n */\n\n\n\n\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/browser.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IConsensusUpdateTopicTransactionBody} HashgraphProto.proto.IConsensusUpdateTopicTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + */ -/***/ "./node_modules/@hashgraph/sdk/src/channel/Channel.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/channel/Channel.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -"use strict"; -eval("var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decodeUnaryResponse\": function() { return /* binding */ decodeUnaryResponse; },\n/* harmony export */ \"default\": function() { return /* binding */ Channel; },\n/* harmony export */ \"encodeRequest\": function() { return /* binding */ encodeRequest; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\nconst { proto } = /*#__PURE__*/ (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__, 2)));\n\n/**\n * @internal\n * @abstract\n */\nclass Channel {\n /**\n * @protected\n */\n constructor() {\n /**\n * @protected\n * @type {?HashgraphProto.proto.CryptoService}\n */\n this._crypto = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.SmartContractService}\n */\n this._smartContract = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.FileService}\n */\n this._file = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.ConsensusService}\n */\n this._consensus = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.FreezeService}\n */\n this._freeze = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.NetworkService}\n */\n this._network = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.TokenService}\n */\n this._token = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.ScheduleService}\n */\n this._schedule = null;\n\n /**\n * @protected\n * @type {?HashgraphProto.proto.UtilService}\n */\n this._util = null;\n }\n\n /**\n * @abstract\n * @returns {void}\n */\n close() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @returns {HashgraphProto.proto.CryptoService}\n */\n get crypto() {\n if (this._crypto != null) {\n return this._crypto;\n }\n\n this._crypto = proto.CryptoService.create(\n this._createUnaryClient(\"CryptoService\")\n );\n\n return this._crypto;\n }\n\n /**\n * @returns {HashgraphProto.proto.SmartContractService}\n */\n get smartContract() {\n if (this._smartContract != null) {\n return this._smartContract;\n }\n\n this._smartContract = proto.SmartContractService.create(\n this._createUnaryClient(\"SmartContractService\")\n );\n\n return this._smartContract;\n }\n\n /**\n * @returns {HashgraphProto.proto.FileService}\n */\n get file() {\n if (this._file != null) {\n return this._file;\n }\n\n this._file = proto.FileService.create(\n this._createUnaryClient(\"FileService\")\n );\n\n return this._file;\n }\n\n /**\n * @returns {HashgraphProto.proto.ConsensusService}\n */\n get consensus() {\n if (this._consensus != null) {\n return this._consensus;\n }\n\n this._consensus = proto.ConsensusService.create(\n this._createUnaryClient(\"ConsensusService\")\n );\n\n return this._consensus;\n }\n\n /**\n * @returns {HashgraphProto.proto.FreezeService}\n */\n get freeze() {\n if (this._freeze != null) {\n return this._freeze;\n }\n\n this._freeze = proto.FreezeService.create(\n this._createUnaryClient(\"FreezeService\")\n );\n\n return this._freeze;\n }\n\n /**\n * @returns {HashgraphProto.proto.NetworkService}\n */\n get network() {\n if (this._network != null) {\n return this._network;\n }\n\n this._network = proto.NetworkService.create(\n this._createUnaryClient(\"NetworkService\")\n );\n\n return this._network;\n }\n\n /**\n * @returns {HashgraphProto.proto.TokenService}\n */\n get token() {\n if (this._token != null) {\n return this._token;\n }\n\n this._token = proto.TokenService.create(\n this._createUnaryClient(\"TokenService\")\n );\n\n return this._token;\n }\n\n /**\n * @returns {HashgraphProto.proto.ScheduleService}\n */\n get schedule() {\n if (this._schedule != null) {\n return this._schedule;\n }\n\n this._schedule = proto.ScheduleService.create(\n this._createUnaryClient(\"ScheduleService\")\n );\n\n return this._schedule;\n }\n\n /**\n * @returns {HashgraphProto.proto.UtilService}\n */\n get util() {\n if (this._util != null) {\n return this._util;\n }\n\n this._util = proto.UtilService.create(\n this._createUnaryClient(\"UtilService\")\n );\n\n return this._util;\n }\n\n /**\n * @abstract\n * @protected\n * @param {string} serviceName\n * @returns {import(\"protobufjs\").RPCImpl}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _createUnaryClient(serviceName) {\n throw new Error(\"not implemented\");\n }\n}\n\n// grpc-web+proto is a series of data or trailer frames\n\n// a frame is identified by a single byte (0 = data or 1 = trailer) followed by 4 bytes for the\n// length of the frame, followed by the frame data\n\n/**\n * @param {Uint8Array} data\n * @returns {ArrayBuffer}\n */\nfunction encodeRequest(data) {\n // for our requests, we want to transfer a single data frame\n\n const frame = new ArrayBuffer(data.byteLength + 5);\n\n // the frame type (data) is zero and can be left default-initialized\n\n // the length of the frame data\n new DataView(frame, 1, 4).setUint32(0, data.length);\n\n // copy in the frame data\n new Uint8Array(frame, 5).set(data);\n\n return frame;\n}\n\n/**\n * @param {ArrayBuffer} data\n * @param {number} byteOffset\n * @param {number} byteLength\n * @returns {Uint8Array}\n */\nfunction decodeUnaryResponse(\n data,\n byteOffset = 0,\n byteLength = data.byteLength\n) {\n const dataView = new DataView(data, byteOffset, byteLength);\n let dataOffset = 0;\n\n /** @type {?Uint8Array} */\n let unaryResponse = null;\n\n // 0 = successful\n let status = 0;\n\n while (dataOffset < dataView.byteLength) {\n const frameByte = dataView.getUint8(dataOffset + 0);\n const frameType = frameByte >> 7;\n const frameByteLength = dataView.getUint32(dataOffset + 1);\n const frameOffset = dataOffset + 5; // offset from the start of the dataView\n if (frameOffset + frameByteLength > dataView.byteLength) {\n throw new Error(\"(BUG) unexpected frame length past the boundary\");\n }\n const frameData = new Uint8Array(\n data,\n dataView.byteOffset + frameOffset,\n frameByteLength\n );\n\n if (frameType === 0) {\n if (unaryResponse != null) {\n throw new Error(\n \"(BUG) unexpectedly received more than one data frame\"\n );\n }\n\n unaryResponse = frameData;\n } else if (frameType === 1) {\n const trailer = _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_1__.decode(frameData);\n const [trailerName, trailerValue] = trailer.split(\":\");\n\n if (trailerName === \"grpc-status\") {\n status = parseInt(trailerValue);\n } else {\n throw new Error(`(BUG) unhandled trailer, ${trailer}`);\n }\n } else {\n throw new Error(`(BUG) unexpected frame type: ${frameType}`);\n }\n\n dataOffset += frameByteLength + 5;\n }\n\n if (status !== 0) {\n throw new Error(`(BUG) unhandled grpc-status: ${status}`);\n }\n\n if (unaryResponse == null) {\n throw new Error(\"(BUG) unexpectedly received no response\");\n }\n\n return unaryResponse;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/channel/Channel.js?"); +/** + * Update a topic. + * + * If there is no adminKey, the only authorized update (available to anyone) is to extend the expirationTime. + * Otherwise transaction must be signed by the adminKey. + * + * If an adminKey is updated, the transaction must be signed by the pre-update adminKey and post-update adminKey. + * + * If a new autoRenewAccount is specified (not just being removed), that account must also sign the transaction. + */ +class TopicUpdateTransaction extends Transaction_Transaction { + /** + * @param {object} props + * @param {TopicId | string} [props.topicId] + * @param {Key} [props.adminKey] + * @param {Key} [props.submitKey] + * @param {Duration | Long | number} [props.autoRenewPeriod] + * @param {AccountId | string} [props.autoRenewAccountId] + * @param {string} [props.topicMemo] + * @param {Timestamp | Date} [props.expirationTime] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TopicId} + */ + this._topicId = null; + + if (props.topicId != null) { + this.setTopicId(props.topicId); + } + + /** + * @private + * @type {?string} + */ + this._topicMemo = null; + + if (props.topicMemo != null) { + this.setTopicMemo(props.topicMemo); + } + + /** + * @private + * @type {?Key} + */ + this._submitKey = null; + + if (props.submitKey != null) { + this.setSubmitKey(props.submitKey); + } + + /** + * @private + * @type {?Key} + */ + this._adminKey = null; + + if (props.adminKey != null) { + this.setAdminKey(props.adminKey); + } + + /** + * @private + * @type {?AccountId} + */ + this._autoRenewAccountId = null; + + if (props.autoRenewAccountId != null) { + this.setAutoRenewAccountId(props.autoRenewAccountId); + } + + /** + * @private + * @type {?Duration} + */ + this._autoRenewPeriod = null; + + if (props.autoRenewPeriod != null) { + this.setAutoRenewPeriod(props.autoRenewPeriod); + } + + /** + * @private + * @type {?Timestamp} + */ + this._expirationTime = null; + + if (props.expirationTime != null) { + this.setExpirationTime(props.expirationTime); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TopicUpdateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const update = + /** @type {HashgraphProto.proto.IConsensusUpdateTopicTransactionBody} */ ( + body.consensusUpdateTopic + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TopicUpdateTransaction({ + topicId: + update.topicID != null + ? TopicId_TopicId._fromProtobuf(update.topicID) + : undefined, + adminKey: + update.adminKey != null + ? src_Key_Key._fromProtobufKey(update.adminKey) + : undefined, + submitKey: + update.submitKey != null + ? src_Key_Key._fromProtobufKey(update.submitKey) + : undefined, + autoRenewAccountId: + update.autoRenewAccount != null + ? AccountId_AccountId._fromProtobuf(update.autoRenewAccount) + : undefined, + autoRenewPeriod: + update.autoRenewPeriod != null + ? update.autoRenewPeriod.seconds != null + ? update.autoRenewPeriod.seconds + : undefined + : undefined, + topicMemo: + update.memo != null + ? update.memo.value != null + ? update.memo.value + : undefined + : undefined, + expirationTime: + update.expirationTime != null + ? Timestamp_Timestamp._fromProtobuf(update.expirationTime) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {?Timestamp} + */ + get expirationTime() { + return this._expirationTime; + } + + /** + * @param {Timestamp | Date | null} expirationTime + * @returns {TopicUpdateTransaction} + */ + setExpirationTime(expirationTime) { + this._requireNotFrozen(); + + this._expirationTime = + expirationTime instanceof Date + ? Timestamp_Timestamp.fromDate(expirationTime) + : expirationTime; + + return this; + } + + /** + * @returns {?TopicId} + */ + get topicId() { + return this._topicId; + } + + /** + * @param {TopicId | string} topicId + * @returns {TopicUpdateTransaction} + */ + setTopicId(topicId) { + this._requireNotFrozen(); + this._topicId = + typeof topicId === "string" + ? TopicId_TopicId.fromString(topicId) + : topicId.clone(); + + return this; + } + + /** + * @returns {TopicUpdateTransaction} + */ + clearTopicId() { + this._requireNotFrozen(); + this._topicId = null; + + return this; + } + + /** + * @returns {?string} + */ + get topicMemo() { + return this._topicMemo; + } + + /** + * @param {string} topicMemo + * @returns {TopicUpdateTransaction} + */ + setTopicMemo(topicMemo) { + this._requireNotFrozen(); + this._topicMemo = topicMemo; + + return this; + } + + /** + * @returns {TopicUpdateTransaction} + */ + clearTopicMemo() { + this._requireNotFrozen(); + this._topicMemo = null; + + return this; + } + + /** + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @param {Key} adminKey + * @returns {TopicUpdateTransaction} + */ + setAdminKey(adminKey) { + this._requireNotFrozen(); + this._adminKey = adminKey; + + return this; + } + + /** + * @returns {TopicUpdateTransaction} + */ + clearAdminKey() { + this._requireNotFrozen(); + this._adminKey = null; + + return this; + } + + /** + * @returns {?Key} + */ + get submitKey() { + return this._submitKey; + } + + /** + * @param {Key} submitKey + * @returns {TopicUpdateTransaction} + */ + setSubmitKey(submitKey) { + this._requireNotFrozen(); + this._submitKey = submitKey; + + return this; + } + + /** + * @returns {TopicUpdateTransaction} + */ + clearSubmitKey() { + this._requireNotFrozen(); + this._submitKey = null; + + return this; + } + + /** + * @returns {?AccountId} + */ + get autoRenewAccountId() { + return this._autoRenewAccountId; + } + + /** + * @param {AccountId | string} autoRenewAccountId + * @returns {TopicUpdateTransaction} + */ + setAutoRenewAccountId(autoRenewAccountId) { + this._requireNotFrozen(); + this._autoRenewAccountId = + autoRenewAccountId instanceof AccountId_AccountId + ? autoRenewAccountId + : AccountId_AccountId.fromString(autoRenewAccountId); + + return this; + } + + /** + * @returns {TopicUpdateTransaction} + */ + clearAutoRenewAccountId() { + this._requireNotFrozen(); + this._autoRenewAccountId = null; + + return this; + } + + /** + * @returns {?Duration} + */ + get autoRenewPeriod() { + return this._autoRenewPeriod; + } + + /** + * Set the auto renew period for this account. + * + * @param {Duration | Long | number} autoRenewPeriod + * @returns {TopicUpdateTransaction} + */ + setAutoRenewPeriod(autoRenewPeriod) { + this._requireNotFrozen(); + this._autoRenewPeriod = + autoRenewPeriod instanceof Duration_Duration + ? autoRenewPeriod + : new Duration_Duration(autoRenewPeriod); + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._topicId != null) { + this._topicId.validateChecksum(client); + } + + if (this._autoRenewAccountId != null) { + this._autoRenewAccountId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.consensus.updateTopic(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "consensusUpdateTopic"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.IConsensusUpdateTopicTransactionBody} + */ + _makeTransactionData() { + return { + topicID: this._topicId != null ? this._topicId._toProtobuf() : null, + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + submitKey: + this._submitKey != null + ? this._submitKey._toProtobufKey() + : null, + memo: + this._topicMemo != null + ? { + value: this._topicMemo, + } + : null, + autoRenewAccount: + this._autoRenewAccountId != null + ? this._autoRenewAccountId._toProtobuf() + : null, + autoRenewPeriod: + this._autoRenewPeriod != null + ? this._autoRenewPeriod._toProtobuf() + : null, + expirationTime: + this._expirationTime != null + ? this._expirationTime._toProtobuf() + : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TopicUpdateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "consensusUpdateTopic", + // eslint-disable-next-line @typescript-eslint/unbound-method + TopicUpdateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/HbarTransferMap.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/channel/WebChannel.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/channel/WebChannel.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ WebChannel; }\n/* harmony export */ });\n/* harmony import */ var _grpc_GrpcServiceError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../grpc/GrpcServiceError.js */ \"./node_modules/@hashgraph/sdk/src/grpc/GrpcServiceError.js\");\n/* harmony import */ var _grpc_GrpcStatus_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../grpc/GrpcStatus.js */ \"./node_modules/@hashgraph/sdk/src/grpc/GrpcStatus.js\");\n/* harmony import */ var _http_HttpError_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../http/HttpError.js */ \"./node_modules/@hashgraph/sdk/src/http/HttpError.js\");\n/* harmony import */ var _http_HttpStatus_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../http/HttpStatus.js */ \"./node_modules/@hashgraph/sdk/src/http/HttpStatus.js\");\n/* harmony import */ var _Channel_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Channel.js */ \"./node_modules/@hashgraph/sdk/src/channel/Channel.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\nclass WebChannel extends _Channel_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"] {\n /**\n * @param {string} address\n */\n constructor(address) {\n super();\n\n /**\n * @type {string}\n * @private\n */\n this._address = address;\n }\n\n /**\n * @override\n * @returns {void}\n */\n close() {\n // do nothing\n }\n\n /**\n * @override\n * @protected\n * @param {string} serviceName\n * @returns {import(\"protobufjs\").RPCImpl}\n */\n _createUnaryClient(serviceName) {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n return async (method, requestData, callback) => {\n try {\n const response = await fetch(\n `${this._address}/proto.${serviceName}/${method.name}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/grpc-web+proto\",\n \"x-user-agent\": \"hedera-sdk-js/v2\",\n \"x-grpc-web\": \"1\",\n },\n body: (0,_Channel_js__WEBPACK_IMPORTED_MODULE_4__.encodeRequest)(requestData),\n }\n );\n\n if (!response.ok) {\n const error = new _http_HttpError_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\n _http_HttpStatus_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromValue(response.status)\n );\n callback(error, null);\n }\n\n // Check headers for gRPC errors\n const grpcStatus = response.headers.get(\"grpc-status\");\n const grpcMessage = response.headers.get(\"grpc-message\");\n\n if (grpcStatus != null && grpcMessage != null) {\n const error = new _grpc_GrpcServiceError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\n _grpc_GrpcStatus_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromValue(parseInt(grpcStatus))\n );\n error.message = grpcMessage;\n callback(error, null);\n }\n\n const responseBuffer = await response.arrayBuffer();\n const unaryResponse = (0,_Channel_js__WEBPACK_IMPORTED_MODULE_4__.decodeUnaryResponse)(responseBuffer);\n\n callback(null, unaryResponse);\n } catch (error) {\n callback(/** @type {Error} */ (error), null);\n }\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/channel/WebChannel.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/client/Client.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/client/Client.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransferList} HashgraphProto.proto.ITransferList + * @typedef {import("@hashgraph/proto").proto.IAccountID} HashgraphProto.proto.IAccountID + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Client; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _account_AccountBalanceQuery_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountBalanceQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountBalanceQuery.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _Network_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Network.js */ \"./node_modules/@hashgraph/sdk/src/client/Network.js\");\n/* harmony import */ var _MirrorNetwork_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./MirrorNetwork.js */ \"./node_modules/@hashgraph/sdk/src/client/MirrorNetwork.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/* harmony import */ var _PrivateKey_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../PrivateKey.js */ \"./node_modules/@hashgraph/sdk/src/PrivateKey.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../address_book/NodeAddressBook.js\").default} NodeAddressBook\n */\n\n/**\n * @typedef {object} Operator\n * @property {string | PrivateKey} privateKey\n * @property {string | AccountId} accountId\n */\n\n/**\n * @typedef {object} ClientOperator\n * @property {PublicKey} publicKey\n * @property {AccountId} accountId\n * @property {(message: Uint8Array) => Promise} transactionSigner\n */\n\n/**\n * @typedef {object} ClientConfiguration\n * @property {{[key: string]: (string | AccountId)} | string} network\n * @property {string[] | string} [mirrorNetwork]\n * @property {Operator} [operator]\n * @property {boolean} [scheduleNetworkUpdate]\n */\n\n/**\n * @typedef {\"mainnet\" | \"testnet\" | \"previewnet\"} NetworkName\n */\n\n/**\n * @abstract\n * @template {Channel} ChannelT\n * @template {MirrorChannel} MirrorChannelT\n */\nclass Client {\n /**\n * @protected\n * @hideconstructor\n * @param {ClientConfiguration} [props]\n */\n constructor(props) {\n /**\n * List of mirror network URLs.\n *\n * @internal\n * @type {MirrorNetwork}\n */\n this._mirrorNetwork = new _MirrorNetwork_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](\n this._createMirrorNetworkChannel()\n );\n\n /**\n * Map of node account ID (as a string)\n * to the node URL.\n *\n * @internal\n * @type {Network}\n */\n this._network = new _Network_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](this._createNetworkChannel());\n\n /**\n * @internal\n * @type {?ClientOperator}\n */\n this._operator = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._defaultMaxTransactionFee = null;\n\n /**\n * @private\n * @type {Hbar}\n */\n this._maxQueryPayment = new _Hbar_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](1);\n\n if (props != null) {\n if (props.operator != null) {\n this.setOperator(\n props.operator.accountId,\n props.operator.privateKey\n );\n }\n }\n\n /** @type {number | null} */\n this._maxAttempts = null;\n\n /** @private */\n this._signOnDemand = false;\n\n /** @private */\n this._autoValidateChecksums = false;\n\n /** @private */\n this._minBackoff = 250;\n\n /** @private */\n this._maxBackoff = 8000;\n\n /** @private */\n this._defaultRegenerateTransactionId = true;\n\n /** @private */\n this._requestTimeout = null;\n\n /** @private */\n this._networkUpdatePeriod = 24 * 60 * 60 * 1000;\n\n /** @private */\n this._isShutdown = false;\n\n if (props != null && props.scheduleNetworkUpdate !== false) {\n this._initialNetworkUpdate();\n this._scheduleNetworkUpdate();\n }\n\n /** @internal */\n /** @type {NodeJS.Timeout} */\n this._timer;\n }\n\n /**\n * @deprecated\n * @param {NetworkName} networkName\n * @returns {this}\n */\n setNetworkName(networkName) {\n // uses custom NetworkName type\n // remove if phasing out set|get NetworkName\n console.warn(\"Deprecated: Use `setLedgerId` instead\");\n return this.setLedgerId(networkName);\n }\n\n /**\n * @deprecated\n * @returns {string | null}\n */\n get networkName() {\n console.warn(\"Deprecated: Use `ledgerId` instead\");\n return this.ledgerId != null ? this.ledgerId.toString() : null;\n }\n\n /**\n * @param {string|LedgerId} ledgerId\n * @returns {this}\n */\n setLedgerId(ledgerId) {\n this._network.setLedgerId(\n typeof ledgerId === \"string\"\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"].fromString(ledgerId)\n : ledgerId\n );\n\n return this;\n }\n\n /**\n * @returns {LedgerId | null}\n */\n get ledgerId() {\n return this._network._ledgerId != null ? this._network.ledgerId : null;\n }\n\n /**\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setNetwork(network) {\n // TODO: This logic _can_ be de-duplicated and likely should\n throw new Error(\"not implemented\");\n }\n\n /**\n * @param {NodeAddressBook} addressBook\n * @returns {this}\n */\n setNetworkFromAddressBook(addressBook) {\n this._network.setNetworkFromAddressBook(addressBook);\n return this;\n }\n\n /**\n * @returns {{[key: string]: (string | AccountId)}}\n */\n get network() {\n return this._network.network;\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @returns {void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setMirrorNetwork(mirrorNetwork) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @returns {string[]}\n */\n get mirrorNetwork() {\n return this._mirrorNetwork.network;\n }\n\n /**\n * @returns {boolean}\n */\n get signOnDemand() {\n return this._signOnDemand;\n }\n\n /**\n * @param {boolean} signOnDemand\n */\n setSignOnDemand(signOnDemand) {\n this._signOnDemand = signOnDemand;\n }\n\n /**\n * @returns {boolean}\n */\n isTransportSecurity() {\n return this._network.isTransportSecurity();\n }\n\n /**\n * @param {boolean} transportSecurity\n * @returns {this}\n */\n setTransportSecurity(transportSecurity) {\n this._network.setTransportSecurity(transportSecurity);\n this._mirrorNetwork.setTransportSecurity(transportSecurity);\n return this;\n }\n\n /**\n * Set the account that will, by default, pay for transactions and queries built with this client.\n *\n * @param {AccountId | string} accountId\n * @param {PrivateKey | string} privateKey\n * @returns {this}\n */\n setOperator(accountId, privateKey) {\n const key =\n typeof privateKey === \"string\"\n ? _PrivateKey_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromString(privateKey)\n : privateKey;\n\n return this.setOperatorWith(accountId, key.publicKey, (message) =>\n Promise.resolve(key.sign(message))\n );\n }\n\n /**\n * Sets the account that will, by default, pay for transactions and queries built with\n * this client.\n *\n * @param {AccountId | string} accountId\n * @param {PublicKey | string} publicKey\n * @param {(message: Uint8Array) => Promise} transactionSigner\n * @returns {this}\n */\n setOperatorWith(accountId, publicKey, transactionSigner) {\n const accountId_ =\n accountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? accountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(accountId);\n\n if (this._network._ledgerId != null) {\n accountId_.validateChecksum(this);\n }\n\n this._operator = {\n transactionSigner,\n\n accountId: accountId_,\n\n publicKey:\n publicKey instanceof _PublicKey_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]\n ? publicKey\n : _PublicKey_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].fromString(publicKey),\n };\n\n return this;\n }\n\n /**\n * @param {boolean} value\n * @returns {this}\n */\n setAutoValidateChecksums(value) {\n this._autoValidateChecksums = value;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n isAutoValidateChecksumsEnabled() {\n return this._autoValidateChecksums;\n }\n\n /**\n * @returns {?AccountId}\n */\n get operatorAccountId() {\n return this._operator != null ? this._operator.accountId : null;\n }\n\n /**\n * @returns {?PublicKey}\n */\n get operatorPublicKey() {\n return this._operator != null ? this._operator.publicKey : null;\n }\n\n /**\n * @deprecated - Use `defaultMaxTransactionFee` instead\n * @returns {?Hbar}\n */\n get maxTransactionFee() {\n return this._defaultMaxTransactionFee;\n }\n\n /**\n * @deprecated - Use `setDefaultMaxTransactionFee()` instead\n * Set the maximum fee to be paid for transactions\n * executed by this client.\n * @param {Hbar} maxTransactionFee\n * @returns {this}\n */\n setMaxTransactionFee(maxTransactionFee) {\n this._defaultMaxTransactionFee = maxTransactionFee;\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get defaultMaxTransactionFee() {\n return this._defaultMaxTransactionFee;\n }\n\n /**\n * Set the defaultimum fee to be paid for transactions\n * executed by this client.\n *\n * @param {Hbar} defaultMaxTransactionFee\n * @returns {this}\n */\n setDefaultMaxTransactionFee(defaultMaxTransactionFee) {\n this._defaultMaxTransactionFee = defaultMaxTransactionFee;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get defaultRegenerateTransactionId() {\n return this._defaultRegenerateTransactionId;\n }\n\n /**\n * Set if a new transaction ID should be generated when a `TRANSACTION_EXPIRED` status\n * is returned.\n *\n * @param {boolean} defaultRegenerateTransactionId\n * @returns {this}\n */\n setDefaultRegenerateTransactionId(defaultRegenerateTransactionId) {\n this._defaultRegenerateTransactionId = defaultRegenerateTransactionId;\n return this;\n }\n\n /**\n * @returns {Hbar}\n */\n get maxQueryPayment() {\n return this._maxQueryPayment;\n }\n\n /**\n * Set the maximum payment allowable for queries.\n *\n * @param {Hbar} maxQueryPayment\n * @returns {Client}\n */\n setMaxQueryPayment(maxQueryPayment) {\n this._maxQueryPayment = maxQueryPayment;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxAttempts() {\n return this._maxAttempts != null ? this._maxAttempts : 10;\n }\n\n /**\n * @param {number} maxAttempts\n * @returns {this}\n */\n setMaxAttempts(maxAttempts) {\n this._maxAttempts = maxAttempts;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxNodeAttempts() {\n return this._network.maxNodeAttempts;\n }\n\n /**\n * @param {number} maxNodeAttempts\n * @returns {this}\n */\n setMaxNodeAttempts(maxNodeAttempts) {\n this._network.setMaxNodeAttempts(maxNodeAttempts);\n return this;\n }\n\n /**\n * @returns {number}\n */\n get nodeWaitTime() {\n return this._network.minBackoff;\n }\n\n /**\n * @param {number} nodeWaitTime\n * @returns {this}\n */\n setNodeWaitTime(nodeWaitTime) {\n this._network.setMinBackoff(nodeWaitTime);\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxNodesPerTransaction() {\n return this._network.maxNodesPerTransaction;\n }\n\n /**\n * @param {number} maxNodesPerTransaction\n * @returns {this}\n */\n setMaxNodesPerTransaction(maxNodesPerTransaction) {\n this._network.setMaxNodesPerTransaction(maxNodesPerTransaction);\n return this;\n }\n\n /**\n * @param {?number} minBackoff\n * @returns {this}\n */\n setMinBackoff(minBackoff) {\n if (minBackoff == null) {\n throw new Error(\"minBackoff cannot be null.\");\n }\n if (minBackoff > this._maxBackoff) {\n throw new Error(\"minBackoff cannot be larger than maxBackoff.\");\n }\n this._minBackoff = minBackoff;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get minBackoff() {\n return this._minBackoff;\n }\n\n /**\n * @param {?number} maxBackoff\n * @returns {this}\n */\n setMaxBackoff(maxBackoff) {\n if (maxBackoff == null) {\n throw new Error(\"maxBackoff cannot be null.\");\n } else if (maxBackoff < this._minBackoff) {\n throw new Error(\"maxBackoff cannot be smaller than minBackoff.\");\n }\n this._maxBackoff = maxBackoff;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxBackoff() {\n return this._maxBackoff;\n }\n\n /**\n * @param {number} nodeMinBackoff\n * @returns {this}\n */\n setNodeMinBackoff(nodeMinBackoff) {\n this._network.setMinBackoff(nodeMinBackoff);\n return this;\n }\n\n /**\n * @returns {number}\n */\n get nodeMinBackoff() {\n return this._network.minBackoff;\n }\n\n /**\n * @param {number} nodeMaxBackoff\n * @returns {this}\n */\n setNodeMaxBackoff(nodeMaxBackoff) {\n this._network.setMaxBackoff(nodeMaxBackoff);\n return this;\n }\n\n /**\n * @returns {number}\n */\n get nodeMaxBackoff() {\n return this._network.maxBackoff;\n }\n\n /**\n * @param {number} nodeMinReadmitPeriod\n * @returns {this}\n */\n setNodeMinReadmitPeriod(nodeMinReadmitPeriod) {\n this._network.setNodeMinReadmitPeriod(nodeMinReadmitPeriod);\n return this;\n }\n\n /**\n * @returns {number}\n */\n get nodeMinReadmitPeriod() {\n return this._network.nodeMinReadmitPeriod;\n }\n\n /**\n * @param {number} nodeMaxReadmitPeriod\n * @returns {this}\n */\n setNodeMaxReadmitPeriod(nodeMaxReadmitPeriod) {\n this._network.setNodeMaxReadmitPeriod(nodeMaxReadmitPeriod);\n return this;\n }\n\n /**\n * @returns {number}\n */\n get nodeMaxReadmitPeriod() {\n return this._network.nodeMaxReadmitPeriod;\n }\n\n /**\n * @param {number} requestTimeout - Number of milliseconds\n * @returns {this}\n */\n setRequestTimeout(requestTimeout) {\n this._requestTimeout = requestTimeout;\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get requestTimeout() {\n return this._requestTimeout;\n }\n\n /**\n * @returns {number}\n */\n get networkUpdatePeriod() {\n return this._networkUpdatePeriod;\n }\n\n /**\n * @param {number} networkUpdatePeriod\n * @returns {this}\n */\n setNetworkUpdatePeriod(networkUpdatePeriod) {\n clearTimeout(this._timer);\n this._networkUpdatePeriod = networkUpdatePeriod;\n this._scheduleNetworkUpdate();\n return this;\n }\n\n /**\n * @param {AccountId | string} accountId\n */\n async ping(accountId) {\n await new _account_AccountBalanceQuery_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]({ accountId })\n .setNodeAccountIds([\n accountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? accountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(accountId),\n ])\n .execute(this);\n }\n\n async pingAll() {\n for (const nodeAccountId of Object.values(this._network.network)) {\n await this.ping(nodeAccountId);\n }\n }\n\n /**\n * @returns {void}\n */\n close() {\n this._network.close();\n this._mirrorNetwork.close();\n this._isShutdown = true;\n clearTimeout(this._timer);\n }\n\n /**\n * @abstract\n * @returns {(address: string) => ChannelT}\n */\n _createNetworkChannel() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @abstract\n * @returns {(address: string) => MirrorChannelT}\n */\n _createMirrorNetworkChannel() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @private\n */\n _scheduleNetworkUpdate() {\n // This is the automatic network update promise that _eventually_ completes\n // eslint-disable-next-line @typescript-eslint/no-floating-promises,@typescript-eslint/no-misused-promises\n this._timer = setTimeout(async () => {\n try {\n const addressBook = await _Cache_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"].addressBookQueryConstructor()\n .setFileId(_file_FileId_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"].ADDRESS_BOOK)\n .execute(this);\n this.setNetworkFromAddressBook(addressBook);\n\n if (!this._isShutdown) {\n // Recall this method to continuously update the network\n // every `networkUpdatePeriod` amount of itme\n this._scheduleNetworkUpdate();\n }\n } catch (error) {\n js_logger__WEBPACK_IMPORTED_MODULE_10__.trace(\n `failed to update client address book: ${\n /** @type {Error} */ (error).toString()\n }`\n );\n }\n }, this._networkUpdatePeriod);\n }\n\n /**\n * @private\n */\n _initialNetworkUpdate() {\n // This is the automatic network update promise that _eventually_ completes\n // eslint-disable-next-line @typescript-eslint/no-floating-promises,@typescript-eslint/no-misused-promises\n setTimeout(async () => {\n try {\n const addressBook = await _Cache_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"].addressBookQueryConstructor()\n .setFileId(_file_FileId_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"].ADDRESS_BOOK)\n .execute(this);\n this.setNetworkFromAddressBook(addressBook);\n } catch (error) {\n js_logger__WEBPACK_IMPORTED_MODULE_10__.trace(\n `failed to update client address book: ${\n /** @type {Error} */ (error).toString()\n }`\n );\n }\n }, 1000);\n }\n\n /**\n * @returns {boolean}\n */\n get isClientShutDown() {\n return this._isShutdown;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/client/Client.js?"); +/** + * @typedef {import("../long.js").LongObject} LongObject + * @typedef {import("bignumber.js").default} BigNumber + */ -/***/ }), +/** + * @augments {ObjectMap} + */ +class HbarTransferMap extends ObjectMap { + constructor() { + super((s) => AccountId_AccountId.fromString(s)); + } + + /** + * @param {HashgraphProto.proto.ITransferList} transfers + * @returns {HbarTransferMap} + */ + static _fromProtobuf(transfers) { + const accountTransfers = new HbarTransferMap(); + + for (const transfer of transfers.accountAmounts != null + ? transfers.accountAmounts + : []) { + const account = AccountId_AccountId._fromProtobuf( + /** @type {HashgraphProto.proto.IAccountID} */ ( + transfer.accountID + ), + ); + + accountTransfers._set( + account, + Hbar_Hbar.fromTinybars(/** @type {Long} */ (transfer.amount)), + ); + } + + return accountTransfers; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/account/TransferTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/client/ManagedNetwork.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/client/ManagedNetwork.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ManagedNetwork; }\n/* harmony export */ });\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../Node.js\").default} Node\n * @typedef {import(\"../MirrorNode.js\").default} MirrorNode\n * @typedef {import(\"../address_book/NodeAddressBook.js\").default} NodeAddressBook\n */\n\n/**\n * @template {Channel | MirrorChannel} ChannelT\n * @typedef {import(\"../ManagedNode.js\").default} ManagedNode\n */\n\n/**\n * @template {Channel | MirrorChannel} ChannelT\n * @template {ManagedNode} NetworkNodeT\n * @template {{ toString: () => string }} KeyT\n */\nclass ManagedNetwork {\n /**\n * @param {(address: string) => ChannelT} createNetworkChannel\n */\n constructor(createNetworkChannel) {\n /**\n * Map of node account ID (as a string)\n * to the node URL.\n *\n * @internal\n * @type {Map}\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this._network = new Map();\n\n /**\n * List of node account IDs.\n *\n * @protected\n * @type {NetworkNodeT[]}\n */\n this._nodes = [];\n\n /**\n * List of node account IDs.\n *\n * @protected\n * @type {NetworkNodeT[]}\n */\n this._healthyNodes = [];\n\n /**\n * Count of unhealthy nodes.\n *\n * @protected\n * @type {number}\n */\n this._unhealthyNodesCount = 0;\n\n /** @type {(address: string, cert?: string) => ChannelT} */\n this._createNetworkChannel = createNetworkChannel;\n\n /** @type {LedgerId | null} */\n this._ledgerId = null;\n\n this._minBackoff = 8000;\n this._maxBackoff = 1000 * 60 * 60;\n\n /** @type {number} */\n this._maxNodeAttempts = -1;\n\n this._transportSecurity = false;\n\n this._nodeMinReadmitPeriod = this._minBackoff;\n this._nodeMaxReadmitPeriod = this._maxBackoff;\n\n this._earliestReadmitTime = Date.now() + this._nodeMinReadmitPeriod;\n }\n\n /**\n * @returns {boolean}\n */\n isTransportSecurity() {\n return this._transportSecurity;\n }\n\n /**\n * @param {boolean} transportSecurity\n * @returns {this}\n */\n setTransportSecurity(transportSecurity) {\n if (this._transportSecurity == transportSecurity) {\n return this;\n }\n\n this._network.clear();\n\n for (let i = 0; i < this._nodes.length; i++) {\n let node = this._nodes[i];\n node.close();\n\n node = /** @type {NetworkNodeT} */ (\n transportSecurity\n ? node\n .toSecure()\n .setCert(\n this._ledgerId != null\n ? this._ledgerId.toString()\n : \"\"\n )\n : node.toInsecure()\n );\n this._nodes[i] = node;\n\n const nodes =\n this._network.get(node.getKey()) != null\n ? /** @type {NetworkNodeT[]} */ (\n this._network.get(node.getKey())\n )\n : [];\n nodes.push(node);\n this._network.set(node.getKey(), nodes);\n }\n\n // Overwrite healthy node list since new ports might make the node work again\n this._healthyNodes = [...this._nodes];\n\n this._transportSecurity = transportSecurity;\n return this;\n }\n\n /**\n * @deprecated\n * @param {string} networkName\n * @returns {this}\n */\n setNetworkName(networkName) {\n console.warn(\"Deprecated: Use `setLedgerId` instead\");\n return this.setLedgerId(networkName);\n }\n\n /**\n * @deprecated\n * @returns {string | null}\n */\n get networkName() {\n console.warn(\"Deprecated: Use `ledgerId` instead\");\n return this.ledgerId != null ? this.ledgerId.toString() : null;\n }\n\n /**\n * @param {string|LedgerId} ledgerId\n * @returns {this}\n */\n setLedgerId(ledgerId) {\n this._ledgerId =\n typeof ledgerId === \"string\"\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(ledgerId)\n : ledgerId;\n return this;\n }\n\n /**\n * @returns {LedgerId | null}\n */\n get ledgerId() {\n return this._ledgerId != null ? this._ledgerId : null;\n }\n\n /**\n * @abstract\n * @param {[string, KeyT]} entry\n * @returns {NetworkNodeT}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _createNodeFromNetworkEntry(entry) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @abstract\n * @param {Map} network\n * @returns {number[]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _getNodesToRemove(network) {\n throw new Error(\"not implemented\");\n }\n\n _removeDeadNodes() {\n if (this._maxNodeAttempts > 0) {\n for (let i = this._nodes.length - 1; i >= 0; i--) {\n const node = this._nodes[i];\n\n if (node._badGrpcStatusCount < this._maxNodeAttempts) {\n continue;\n }\n\n this._closeNode(i);\n }\n }\n }\n\n _readmitNodes() {\n const now = Date.now();\n\n if (this._earliestReadmitTime <= now) {\n let nextEarliestReadmitTime = Number.MAX_SAFE_INTEGER;\n let searchForNextEarliestReadmitTime = true;\n\n outer: for (let i = 0; i < this._nodes.length; i++) {\n for (let j = 0; j < this._healthyNodes.length; j++) {\n if (\n searchForNextEarliestReadmitTime &&\n this._nodes[i]._readmitTime > now\n ) {\n nextEarliestReadmitTime = Math.min(\n this._nodes[i]._readmitTime,\n nextEarliestReadmitTime\n );\n }\n\n if (this._nodes[i] == this._healthyNodes[j]) {\n continue outer;\n }\n }\n\n searchForNextEarliestReadmitTime = false;\n\n if (this._nodes[i]._readmitTime <= now) {\n this._healthyNodes.push(this._nodes[i]);\n }\n }\n\n this._earliestReadmitTime = Math.min(\n Math.max(nextEarliestReadmitTime, this._nodeMinReadmitPeriod),\n this._nodeMaxReadmitPeriod\n );\n }\n }\n\n /**\n * @param {number} count\n * @returns {NetworkNodeT[]}\n */\n _getNumberOfMostHealthyNodes(count) {\n this._removeDeadNodes();\n\n /** @type {NetworkNodeT[]} */\n const nodes = [];\n const keys = new Set();\n const nodeAddresses = new Set();\n\n // `this.getNode()` uses `Math.random()` internally to fetch\n // nodes, this means _techically_ `this.getNode()` can return\n // the same exact node several times in a row, but we do not\n // want that. We want to get a random node that hasn't been\n // chosen before. We could use a while loop and just keep calling\n // `this.getNode()` until we get a list of `count` different nodes,\n // but a potential issue is if somehow the healthy list gets\n // corrupted or count is too large then the while loop would\n // run forever. To resolve this, instead of using a while, we use\n // a for loop where we call `this.getNode()` a max of\n // `this._healthyNodes.length` times. This can result in a shorter\n // list than `count`, but that is much better than running forever\n for (let i = 0; i < this._healthyNodes.length; i++) {\n if (nodes.length == count - this._unhealthyNodesCount) {\n break;\n }\n\n // Get a random node\n let node = this.getNode();\n if (\n !keys.has(node.getKey()) ||\n !nodeAddresses.has(node.address._address)\n ) {\n keys.add(node.getKey());\n nodeAddresses.add(node.address._address);\n nodes.push(node);\n } else {\n i--;\n }\n }\n\n return nodes;\n }\n\n /**\n * @param {number} i\n */\n _closeNode(i) {\n const node = this._nodes[i];\n\n node.close();\n this._removeNodeFromNetwork(node);\n this._nodes.splice(i, 1);\n }\n\n /**\n * @param {NetworkNodeT} node\n */\n _removeNodeFromNetwork(node) {\n const network = /** @type {NetworkNodeT[]} */ (\n this._network.get(node.getKey())\n );\n\n for (let j = 0; j < network.length; j++) {\n if (network[j] === node) {\n network.splice(j, 1);\n break;\n }\n }\n\n if (network.length === 0) {\n this._network.delete(node.getKey());\n }\n }\n\n /**\n * @param {Map} network\n * @returns {this}\n */\n _setNetwork(network) {\n /** @type {NetworkNodeT[]} */\n const newNodes = [];\n const newNodeKeys = new Set();\n const newNodeAddresses = new Set();\n\n /** @type {NetworkNodeT[]} */\n const newHealthyNodes = [];\n\n /** @type {Map} */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newNetwork = new Map();\n\n // Remove nodes that are not in the new network\n for (const i of this._getNodesToRemove(network)) {\n this._closeNode(i);\n }\n\n // Copy all the unclosed nodes\n for (const node of this._nodes) {\n newNodes.push(node);\n newNodeKeys.add(node.getKey());\n newNodeAddresses.add(node.address.toString());\n }\n\n // Add new nodes\n for (const [key, value] of network) {\n if (\n newNodeKeys.has(value.toString()) &&\n newNodeAddresses.has(key)\n ) {\n continue;\n }\n newNodes.push(this._createNodeFromNetworkEntry([key, value]));\n }\n\n // Shuffle the nodes so we don't immediately pick the first nodes\n _util_js__WEBPACK_IMPORTED_MODULE_1__.shuffle(newNodes);\n\n // Copy all the nodes into the healhty nodes list initially\n // and push the nodes into the network; this maintains the\n // shuffled state from `newNodes`\n for (const node of newNodes) {\n if (!node.isHealthy()) {\n continue;\n }\n\n newHealthyNodes.push(node);\n\n const newNetworkNodes = newNetwork.has(node.getKey())\n ? /** @type {NetworkNodeT[]} */ (newNetwork.get(node.getKey()))\n : [];\n newNetworkNodes.push(node);\n newNetwork.set(node.getKey(), newNetworkNodes);\n }\n\n // console.log(JSON.stringify(newNodes, null, 2));\n this._nodes = newNodes;\n this._healthyNodes = newHealthyNodes;\n this._network = newNetwork;\n this._ledgerId = null;\n\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxNodeAttempts() {\n return this._maxNodeAttempts;\n }\n\n /**\n * @param {number} maxNodeAttempts\n * @returns {this}\n */\n setMaxNodeAttempts(maxNodeAttempts) {\n this._maxNodeAttempts = maxNodeAttempts;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get minBackoff() {\n return this._minBackoff;\n }\n\n /**\n * @param {number} minBackoff\n * @returns {this}\n */\n setMinBackoff(minBackoff) {\n this._minBackoff = minBackoff;\n for (const node of this._nodes) {\n node.setMinBackoff(minBackoff);\n }\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxBackoff() {\n return this._maxBackoff;\n }\n\n /**\n * @param {number} maxBackoff\n * @returns {this}\n */\n setMaxBackoff(maxBackoff) {\n this._maxBackoff = maxBackoff;\n for (const node of this._nodes) {\n node.setMaxBackoff(maxBackoff);\n }\n return this;\n }\n\n /**\n * @returns {number}\n */\n get nodeMinReadmitPeriod() {\n return this._nodeMinReadmitPeriod;\n }\n\n /**\n * @param {number} nodeMinReadmitPeriod\n * @returns {this}\n */\n setNodeMinReadmitPeriod(nodeMinReadmitPeriod) {\n this._nodeMinReadmitPeriod = nodeMinReadmitPeriod;\n this._earliestReadmitTime = Date.now() + this._nodeMinReadmitPeriod;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get nodeMaxReadmitPeriod() {\n return this._nodeMaxReadmitPeriod;\n }\n\n /**\n * @param {number} nodeMaxReadmitPeriod\n * @returns {this}\n */\n setNodeMaxReadmitPeriod(nodeMaxReadmitPeriod) {\n this._nodeMaxReadmitPeriod = nodeMaxReadmitPeriod;\n return this;\n }\n\n /**\n * @param {KeyT=} key\n * @returns {NetworkNodeT}\n */\n getNode(key) {\n this._readmitNodes();\n if (key != null && key != undefined) {\n // return /** @type {NetworkNodeT[]} */ (\n // this._network.get(key.toString())\n // )[0];\n const lockedNodes = this._network.get(key.toString());\n if (lockedNodes) {\n return /** @type {NetworkNodeT[]} */ lockedNodes[\n Math.floor(Math.random() * lockedNodes.length)\n ];\n } else {\n return /** @type {NetworkNodeT[]} */ (\n this._network.get(key.toString())\n )[0];\n }\n } else {\n if (this._healthyNodes.length == 0) {\n throw new Error(\"failed to find a healthy working node\");\n }\n\n return this._healthyNodes[\n Math.floor(Math.random() * this._healthyNodes.length)\n ];\n }\n }\n\n /**\n * @param {NetworkNodeT} node\n */\n increaseBackoff(node) {\n node.increaseBackoff();\n\n for (let i = 0; i < this._healthyNodes.length; i++) {\n if (this._healthyNodes[i] == node) {\n this._healthyNodes.splice(i, 1);\n this._unhealthyNodesCount++;\n }\n }\n }\n\n /**\n * @param {NetworkNodeT} node\n */\n decreaseBackoff(node) {\n node.decreaseBackoff();\n }\n\n close() {\n for (const node of this._nodes) {\n node.close();\n }\n\n this._network.clear();\n this._nodes = [];\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/client/ManagedNetwork.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/client/MirrorNetwork.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/client/MirrorNetwork.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ MirrorNetwork; }\n/* harmony export */ });\n/* harmony import */ var _MirrorNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../MirrorNode.js */ \"./node_modules/@hashgraph/sdk/src/MirrorNode.js\");\n/* harmony import */ var _ManagedNetwork_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ManagedNetwork.js */ \"./node_modules/@hashgraph/sdk/src/client/ManagedNetwork.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n */\n\n/**\n * @augments {ManagedNetwork}\n */\nclass MirrorNetwork extends _ManagedNetwork_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {(address: string) => MirrorChannel} channelInitFunction\n */\n constructor(channelInitFunction) {\n super(channelInitFunction);\n }\n\n /**\n * @param {string[]} network\n */\n setNetwork(network) {\n // eslint-disable-next-line ie11/no-collection-args\n this._setNetwork(new Map(network.map((address) => [address, address])));\n }\n\n /**\n * @returns {string[]}\n */\n get network() {\n /**\n * @type {string[]}\n */\n var n = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const node of this._nodes) {\n n.push(node.address.toString());\n }\n\n return n;\n }\n\n /**\n * @abstract\n * @param {[string, string]} entry\n * @returns {MirrorNode}\n */\n _createNodeFromNetworkEntry(entry) {\n return new _MirrorNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n newNode: {\n address: entry[1],\n channelInitFunction: this._createNetworkChannel,\n },\n }).setMinBackoff(this._minBackoff);\n }\n\n /**\n * @abstract\n * @param {Map} network\n * @returns {number[]}\n */\n _getNodesToRemove(network) {\n const indexes = [];\n\n const values = Object.values(network);\n\n for (let i = this._nodes.length - 1; i >= 0; i--) {\n const node = this._nodes[i];\n\n if (!values.includes(node.address.toString())) {\n indexes.push(i);\n }\n }\n\n return indexes;\n }\n\n /**\n * @returns {MirrorNode}\n */\n getNextMirrorNode() {\n if (this._createNetworkChannel == null) {\n throw new Error(\"mirror network not supported on browser\");\n }\n\n return this._getNumberOfMostHealthyNodes(1)[0];\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/client/MirrorNetwork.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/client/Network.js": -/*!***********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/client/Network.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Network; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Node.js */ \"./node_modules/@hashgraph/sdk/src/Node.js\");\n/* harmony import */ var _address_book_AddressBooks_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../address_book/AddressBooks.js */ \"./node_modules/@hashgraph/sdk/src/address_book/AddressBooks.js\");\n/* harmony import */ var _ManagedNetwork_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ManagedNetwork.js */ \"./node_modules/@hashgraph/sdk/src/client/ManagedNetwork.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../address_book/NodeAddressBook.js\").default} NodeAddressBook\n */\n\n/**\n * @augments {ManagedNetwork}\n */\nclass Network extends _ManagedNetwork_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n /**\n * @param {(address: string) => Channel} createNetworkChannel\n */\n constructor(createNetworkChannel) {\n super(createNetworkChannel);\n\n this._maxNodesPerTransaction = -1;\n\n /** @type {NodeAddressBook | null} */\n this._addressBook = null;\n }\n\n /**\n * @param {{[key: string]: (string | AccountId)}} network\n */\n setNetwork(network) {\n this._setNetwork(\n // eslint-disable-next-line ie11/no-collection-args\n new Map(\n // eslint-disable-next-line ie11/no-collection-args\n Object.entries(network).map(([key, value]) => {\n return [\n key,\n typeof value === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(value)\n : value,\n ];\n })\n )\n );\n }\n\n /**\n * @param {NodeAddressBook} addressBook\n * @returns {this}\n */\n setNetworkFromAddressBook(addressBook) {\n /** @type {Record} */\n const network = {};\n const port = this.isTransportSecurity() ? 50212 : 50211;\n\n for (const nodeAddress of addressBook.nodeAddresses) {\n for (const endpoint of nodeAddress.addresses) {\n // TODO: We hard code ports too much, should fix\n if (endpoint.port === port && nodeAddress.accountId != null) {\n network[endpoint.toString()] = nodeAddress.accountId;\n }\n }\n }\n\n this.setNetwork(network);\n return this;\n }\n\n /**\n * @returns {{[key: string]: (string | AccountId)}}\n */\n get network() {\n /**\n * @type {{[key: string]: (string | AccountId)}}\n */\n var n = {};\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const node of this._nodes) {\n n[node.address.toString()] = node.accountId;\n }\n\n return n;\n }\n\n /**\n * @param {string} networkName\n * @returns {this}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setNetworkName(networkName) {\n super.setLedgerId(networkName);\n\n switch (networkName) {\n case \"mainnet\":\n this._addressBook = _address_book_AddressBooks_js__WEBPACK_IMPORTED_MODULE_2__.MAINNET_ADDRESS_BOOK;\n break;\n case \"testnet\":\n this._addressBook = _address_book_AddressBooks_js__WEBPACK_IMPORTED_MODULE_2__.TESTNET_ADDRESS_BOOK;\n break;\n case \"previewnet\":\n this._addressBook = _address_book_AddressBooks_js__WEBPACK_IMPORTED_MODULE_2__.PREVIEWNET_ADDRESS_BOOK;\n break;\n }\n\n if (this._addressBook != null) {\n for (const node of this._nodes) {\n for (const address of this._addressBook.nodeAddresses) {\n if (\n address.accountId != null &&\n address.accountId.toString() ===\n node.accountId.toString()\n ) {\n node.setNodeAddress(address);\n }\n }\n }\n }\n\n return this;\n }\n\n /**\n * @returns {string | null}\n */\n get networkName() {\n return this._ledgerId != null ? this._ledgerId.toString() : null;\n }\n\n /**\n * @abstract\n * @param {[string, (string | AccountId)]} entry\n * @returns {Node}\n */\n _createNodeFromNetworkEntry(entry) {\n const accountId =\n typeof entry[1] === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(entry[1])\n : entry[1];\n\n return new _Node_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]({\n newNode: {\n address: entry[0],\n accountId,\n channelInitFunction: this._createNetworkChannel,\n },\n }).setMinBackoff(this._minBackoff);\n }\n\n /**\n * @abstract\n * @param {Map} network\n * @returns {number[]}\n */\n _getNodesToRemove(network) {\n const indexes = [];\n\n for (let i = this._nodes.length - 1; i >= 0; i--) {\n const node = this._nodes[i];\n const accountId = network.get(node.address.toString());\n\n if (\n accountId == null ||\n accountId.toString() !== node.accountId.toString()\n ) {\n indexes.push(i);\n }\n }\n\n return indexes;\n }\n\n /**\n * @abstract\n * @param {[string, (string | AccountId)]} entry\n * @returns {boolean}\n */\n _checkNetworkContainsEntry(entry) {\n for (const node of this._nodes) {\n if (node.address.toString() === entry[0]) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * @returns {number}\n */\n get maxNodesPerTransaction() {\n return this._maxNodesPerTransaction;\n }\n\n /**\n * @param {number} maxNodesPerTransaction\n * @returns {this}\n */\n setMaxNodesPerTransaction(maxNodesPerTransaction) {\n this._maxNodesPerTransaction = maxNodesPerTransaction;\n return this;\n }\n\n /**\n * @returns {number}\n */\n get maxNodeAttempts() {\n return this._maxNodeAttempts;\n }\n\n /**\n * @param {number} maxNodeAttempts\n * @returns {this}\n */\n setMaxNodeAttempts(maxNodeAttempts) {\n this._maxNodeAttempts = maxNodeAttempts;\n return this;\n }\n\n /**\n * @internal\n * @returns {number}\n */\n getNumberOfNodesForTransaction() {\n if (this._maxNodesPerTransaction > 0) {\n return this._maxNodesPerTransaction;\n }\n // ultimately it does not matter if we round up or down\n // if we round up, we will eventually take one more healthy node for execution\n // and we would hit the 'nodes.length == count' check in _getNumberOfMostHealthyNodes() less often\n return this._nodes.length <= 9\n ? this._nodes.length\n : Math.floor((this._nodes.length + 3 - 1) / 3);\n }\n\n /**\n * @internal\n * @returns {AccountId[]}\n */\n getNodeAccountIdsForExecute() {\n return this._getNumberOfMostHealthyNodes(\n this.getNumberOfNodesForTransaction()\n ).map((node) => node.accountId);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/client/Network.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/client/WebClient.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/client/WebClient.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Network\": function() { return /* binding */ Network; },\n/* harmony export */ \"default\": function() { return /* binding */ WebClient; }\n/* harmony export */ });\n/* harmony import */ var _Client_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Client.js */ \"./node_modules/@hashgraph/sdk/src/client/Client.js\");\n/* harmony import */ var _channel_WebChannel_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../channel/WebChannel.js */ \"./node_modules/@hashgraph/sdk/src/channel/WebChannel.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/* harmony import */ var _constants_ClientConstants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants/ClientConstants.js */ \"./node_modules/@hashgraph/sdk/src/constants/ClientConstants.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n\n\n/**\n * @typedef {import(\"./Client.js\").ClientConfiguration} ClientConfiguration\n */\n\nconst Network = {\n /**\n * @param {string} name\n * @returns {{[key: string]: (string | AccountId)}}\n */\n fromName(name) {\n switch (name) {\n case \"mainnet\":\n return Network.MAINNET;\n\n case \"testnet\":\n return Network.TESTNET;\n\n case \"previewnet\":\n return Network.PREVIEWNET;\n\n default:\n throw new Error(`unknown network name: ${name}`);\n }\n },\n\n MAINNET: _constants_ClientConstants_js__WEBPACK_IMPORTED_MODULE_4__.MAINNET,\n TESTNET: _constants_ClientConstants_js__WEBPACK_IMPORTED_MODULE_4__.WEB_TESTNET,\n PREVIEWNET: _constants_ClientConstants_js__WEBPACK_IMPORTED_MODULE_4__.WEB_PREVIEWNET,\n};\n\n/**\n * @augments {Client}\n */\nclass WebClient extends _Client_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {ClientConfiguration} [props]\n */\n constructor(props) {\n super(props);\n if (props != null) {\n if (typeof props.network === \"string\") {\n switch (props.network) {\n case \"mainnet\":\n this.setNetwork(Network.MAINNET);\n this.setLedgerId(_LedgerId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].MAINNET);\n break;\n\n case \"testnet\":\n this.setNetwork(Network.TESTNET);\n this.setLedgerId(_LedgerId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].TESTNET);\n break;\n\n case \"previewnet\":\n this.setNetwork(Network.PREVIEWNET);\n this.setLedgerId(_LedgerId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].PREVIEWNET);\n break;\n\n default:\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `unknown network: ${props.network}`\n );\n }\n } else if (props.network != null) {\n this.setNetwork(props.network);\n }\n }\n }\n\n /**\n * @param {string | ClientConfiguration} data\n * @returns {WebClient}\n */\n static fromConfig(data) {\n return new WebClient(\n typeof data === \"string\"\n ? /** @type {ClientConfiguration | undefined} */ (\n JSON.parse(data)\n )\n : data\n );\n }\n\n /**\n * Construct a client for a specific network.\n *\n * It is the responsibility of the caller to ensure that all nodes in the map are part of the\n * same Hedera network. Failure to do so will result in undefined behavior.\n *\n * The client will load balance all requests to Hedera using a simple round-robin scheme to\n * chose nodes to send transactions to. For one transaction, at most 1/3 of the nodes will be\n * tried.\n *\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {WebClient}\n */\n static forNetwork(network) {\n return new WebClient({ network, scheduleNetworkUpdate: false });\n }\n\n /**\n * @param {string} network\n * @returns {WebClient}\n */\n static forName(network) {\n return new WebClient({ network, scheduleNetworkUpdate: false });\n }\n\n /**\n * Construct a Hedera client pre-configured for Mainnet access.\n *\n * @returns {WebClient}\n */\n static forMainnet() {\n return new WebClient({\n network: \"mainnet\",\n scheduleNetworkUpdate: false,\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Testnet access.\n *\n * @returns {WebClient}\n */\n static forTestnet() {\n return new WebClient({\n network: \"testnet\",\n scheduleNetworkUpdate: false,\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Previewnet access.\n *\n * @returns {WebClient}\n */\n static forPreviewnet() {\n return new WebClient({\n network: \"previewnet\",\n scheduleNetworkUpdate: false,\n });\n }\n\n /**\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {void}\n */\n setNetwork(network) {\n if (typeof network === \"string\") {\n switch (network) {\n case \"previewnet\":\n this._network.setNetwork(Network.PREVIEWNET);\n break;\n case \"testnet\":\n this._network.setNetwork(Network.TESTNET);\n break;\n case \"mainnet\":\n this._network.setNetwork(Network.MAINNET);\n }\n } else {\n this._network.setNetwork(network);\n }\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @returns {this}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setMirrorNetwork(mirrorNetwork) {\n if (typeof mirrorNetwork === \"string\") {\n this._mirrorNetwork.setNetwork([]);\n } else {\n this._mirrorNetwork.setNetwork(mirrorNetwork);\n }\n\n return this;\n }\n\n /**\n * @override\n * @returns {(address: string) => WebChannel}\n */\n _createNetworkChannel() {\n return (address) => new _channel_WebChannel_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](address);\n }\n\n /**\n * @override\n * @returns {(address: string) => *}\n */\n _createMirrorNetworkChannel() {\n return () => {\n throw new Error(\"mirror support is not supported in browsers\");\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/client/WebClient.js?"); -/***/ }), +/** + * @typedef {import("../long.js").LongObject} LongObject + * @typedef {import("bignumber.js").default} BigNumber + */ -/***/ "./node_modules/@hashgraph/sdk/src/constants/ClientConstants.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/constants/ClientConstants.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ICryptoTransferTransactionBody} HashgraphProto.proto.ICryptoTransferTransactionBody + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MAINNET\": function() { return /* binding */ MAINNET; },\n/* harmony export */ \"NATIVE_PREVIEWNET\": function() { return /* binding */ NATIVE_PREVIEWNET; },\n/* harmony export */ \"NATIVE_TESTNET\": function() { return /* binding */ NATIVE_TESTNET; },\n/* harmony export */ \"WEB_PREVIEWNET\": function() { return /* binding */ WEB_PREVIEWNET; },\n/* harmony export */ \"WEB_TESTNET\": function() { return /* binding */ WEB_TESTNET; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n\n\n// MAINNET node proxies are the same for both 'WebClient' and 'NativeClient'\nconst MAINNET = {\n \"https://grpc-web.myhbarwallet.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](3),\n \"https://node01-00-grpc.swirlds.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](4),\n \"https://node02.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](5),\n \"https://node03.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](6),\n \"https://node04.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](7),\n \"https://node05.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](8),\n \"https://node06.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](9),\n \"https://node07.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](10),\n \"https://node08.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](11),\n \"https://node09.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](12),\n \"https://node10.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](13),\n \"https://node11.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](14),\n \"https://node12.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](15),\n \"https://node13.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](16),\n \"https://node14.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](17),\n \"https://node16.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](19),\n \"https://node17.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](20),\n \"https://node18.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](21),\n \"https://node19.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](22),\n \"https://node20.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](23),\n \"https://node21.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](24),\n \"https://node22.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](25),\n \"https://node23.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](26),\n \"https://node24.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](27),\n \"https://node25.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](28),\n \"https://node26.swirldslabs.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](29),\n};\n\nconst WEB_TESTNET = {\n \"https://testnet-node00-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](3),\n \"https://testnet-node01-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](4),\n \"https://testnet-node02-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](5),\n \"https://testnet-node03-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](6),\n \"https://testnet-node04-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](7),\n \"https://testnet-node05-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](8),\n \"https://testnet-node06-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](9),\n};\n\nconst WEB_PREVIEWNET = {\n \"https://previewnet-node00-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](3),\n \"https://previewnet-node01-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](4),\n \"https://previewnet-node02-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](5),\n \"https://previewnet-node03-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](6),\n \"https://previewnet-node04-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](7),\n \"https://previewnet-node05-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](8),\n \"https://previewnet-node06-00-grpc.hedera.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](9),\n};\n\nconst NATIVE_TESTNET = {\n \"https://grpc-web.testnet.myhbarwallet.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](3),\n};\n\nconst NATIVE_PREVIEWNET = {\n \"https://grpc-web.previewnet.myhbarwallet.com:443\": new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](3),\n};\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/constants/ClientConstants.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + */ -/***/ }), +/** + * @typedef {object} TransferTokensInput + * @property {TokenId | string} tokenId + * @property {AccountId | string} accountId + * @property {Long | number} amount + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractByteCodeQuery.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractByteCodeQuery.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {object} TransferTokenObject + * @property {TokenId} tokenId + * @property {AccountId} accountId + * @property {Long} amount + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractByteCodeQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IContractGetBytecodeQuery} HashgraphProto.proto.IContractGetBytecodeQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IContractGetBytecodeResponse} HashgraphProto.proto.IContractGetBytecodeResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * @augments {Query}\n */\nclass ContractByteCodeQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {ContractId | string} [props.contractId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?ContractId}\n * @private\n */\n this._contractId = null;\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {ContractByteCodeQuery}\n */\n static _fromProtobuf(query) {\n const bytecode =\n /** @type {HashgraphProto.proto.IContractGetBytecodeQuery} */ (\n query.contractGetBytecode\n );\n\n return new ContractByteCodeQuery({\n contractId:\n bytecode.contractID != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(bytecode.contractID)\n : undefined,\n });\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Set the contract ID for which the info is being requested.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractByteCodeQuery}\n */\n setContractId(contractId) {\n this._contractId =\n typeof contractId === \"string\"\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.contractGetBytecode(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const contractGetBytecodeResponse =\n /** @type {HashgraphProto.proto.IContractGetBytecodeResponse} */ (\n response.contractGetBytecodeResponse\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n contractGetBytecodeResponse.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Promise}\n */\n _mapResponse(response) {\n const contractGetBytecodeResponse =\n /** @type {HashgraphProto.proto.IContractGetBytecodeResponse} */ (\n response.contractGetBytecodeResponse\n );\n\n return Promise.resolve(\n contractGetBytecodeResponse.bytecode != null\n ? contractGetBytecodeResponse.bytecode\n : new Uint8Array()\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n contractGetBytecode: {\n header,\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `ContractByteCodeQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"contractGetBytecode\", ContractByteCodeQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractByteCodeQuery.js?"); +/** + * @typedef {object} TransferHbarInput + * @property {AccountId | string} accountId + * @property {number | string | Long | BigNumber | Hbar} amount + */ -/***/ }), +/** + * @typedef {object} TransferNftInput + * @property {TokenId | string} tokenId + * @property {AccountId | string} sender + * @property {AccountId | string} recipient + * @property {Long | number} serial + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractCallQuery.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractCallQuery.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * Transfers a new Hedera™ crypto-currency token. + */ +class TransferTransaction extends AbstractTokenTransferTransaction { + /** + * @param {object} [props] + * @param {(TransferTokensInput)[]} [props.tokenTransfers] + * @param {(TransferHbarInput)[]} [props.hbarTransfers] + * @param {(TransferNftInput)[]} [props.nftTransfers] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {Transfer[]} + */ + this._hbarTransfers = []; + + this._defaultMaxTransactionFee = new Hbar_Hbar(1); + + for (const transfer of props.hbarTransfers != null + ? props.hbarTransfers + : []) { + this.addHbarTransfer(transfer.accountId, transfer.amount); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TransferTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const cryptoTransfer = + /** @type {HashgraphProto.proto.ICryptoTransferTransactionBody} */ ( + body.cryptoTransfer + ); + + const transfers = new TransferTransaction(); + + transfers._tokenTransfers = TokenTransfer._fromProtobuf( + cryptoTransfer.tokenTransfers != null + ? cryptoTransfer.tokenTransfers + : [], + ); + + transfers._hbarTransfers = Transfer._fromProtobuf( + cryptoTransfer.transfers != null + ? cryptoTransfer.transfers.accountAmounts != null + ? cryptoTransfer.transfers.accountAmounts + : [] + : [], + ); + + transfers._nftTransfers = TokenNftTransfer._fromProtobuf( + cryptoTransfer.tokenTransfers != null + ? cryptoTransfer.tokenTransfers + : [], + ); + + return Transaction_Transaction._fromProtobufTransactions( + transfers, + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @returns {HbarTransferMap} + */ + get hbarTransfers() { + const map = new HbarTransferMap(); + + for (const transfer of this._hbarTransfers) { + map._set(transfer.accountId, transfer.amount); + } + + return map; + } + + /** + * @returns {Transfer[]} + */ + get hbarTransfersList() { + return this._hbarTransfers; + } + + /** + * @internal + * @param {AccountId | string} accountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @param {boolean} isApproved + * @returns {TransferTransaction} + */ + _addHbarTransfer(accountId, amount, isApproved) { + this._requireNotFrozen(); + + const account = + accountId instanceof AccountId_AccountId + ? accountId.clone() + : AccountId_AccountId.fromString(accountId); + const hbars = amount instanceof Hbar_Hbar ? amount : new Hbar_Hbar(amount); + + for (const transfer of this._hbarTransfers) { + if (transfer.accountId.compare(account) === 0) { + transfer.amount = Hbar_Hbar.fromTinybars( + transfer.amount.toTinybars().add(hbars.toTinybars()), + ); + return this; + } + } + + this._hbarTransfers.push( + new Transfer({ + accountId: account, + amount: hbars, + isApproved, + }), + ); + + return this; + } + + /** + * @internal + * @param {AccountId | string} accountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @returns {TransferTransaction} + */ + addHbarTransfer(accountId, amount) { + return this._addHbarTransfer(accountId, amount, false); + } + + /** + * @internal + * @param {AccountId | string} accountId + * @param {number | string | Long | LongObject | BigNumber | Hbar} amount + * @returns {TransferTransaction} + */ + addApprovedHbarTransfer(accountId, amount) { + return this._addHbarTransfer(accountId, amount, true); + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const transfer of this._hbarTransfers) { + transfer.accountId.validateChecksum(client); + } + + for (const transfer of this._tokenTransfers) { + transfer.tokenId.validateChecksum(client); + transfer.accountId.validateChecksum(client); + } + + for (const transfer of this._nftTransfers) { + transfer.tokenId.validateChecksum(client); + transfer.senderAccountId.validateChecksum(client); + transfer.receiverAccountId.validateChecksum(client); + } + } + + /** + * @deprecated - Use `addApprovedHbarTransfer()` instead + * @param {AccountId | string} accountId + * @param {boolean} isApproved + * @returns {TransferTransaction} + */ + setHbarTransferApproval(accountId, isApproved) { + const account = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId; + + for (const transfer of this._hbarTransfers) { + if (transfer.accountId.compare(account) === 0) { + transfer.isApproved = isApproved; + } + } + + return this; + } + + /** + * @deprecated - Use `addApprovedTokenTransfer()` instead + * @param {TokenId | string} tokenId + * @param {AccountId | string} accountId + * @param {boolean} isApproved + * @returns {TransferTransaction} + */ + setTokenTransferApproval(tokenId, accountId, isApproved) { + const token = + typeof tokenId === "string" ? TokenId_TokenId.fromString(tokenId) : tokenId; + const account = + typeof accountId === "string" + ? AccountId_AccountId.fromString(accountId) + : accountId; + + for (const tokenTransfer of this._tokenTransfers) { + if ( + tokenTransfer.tokenId.compare(token) === 0 && + tokenTransfer.accountId.compare(account) === 0 + ) { + tokenTransfer.isApproved = isApproved; + } + } + + return this; + } + + /** + * @deprecated - Use `addApprovedNftTransfer()` instead + * @param {NftId | string} nftId + * @param {boolean} isApproved + * @returns {TransferTransaction} + */ + setNftTransferApproval(nftId, isApproved) { + const nft = typeof nftId === "string" ? NftId_NftId.fromString(nftId) : nftId; + + for (const transfer of this._nftTransfers) { + if ( + transfer.tokenId.compare(nft.tokenId) === 0 && + transfer.serialNumber.compare(nft.serial) === 0 + ) { + transfer.isApproved = isApproved; + } + } + + return this; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.crypto.cryptoTransfer(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "cryptoTransfer"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ICryptoTransferTransactionBody} + */ + _makeTransactionData() { + const { tokenTransfers } = super._makeTransactionData(); + + this._hbarTransfers.sort((a, b) => a.accountId.compare(b.accountId)); + + return { + transfers: { + accountAmounts: this._hbarTransfers.map((transfer) => { + return { + accountID: transfer.accountId._toProtobuf(), + amount: transfer.amount.toTinybars(), + isApproval: transfer.isApproved, + }; + }), + }, + tokenTransfers, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TransferTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "cryptoTransfer", + // eslint-disable-next-line @typescript-eslint/unbound-method + TransferTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Wallet.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractCallQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ContractFunctionParameters.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js\");\n/* harmony import */ var _ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ContractFunctionResult.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionResult.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../PrecheckStatusError.js */ \"./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js\");\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @typedef {object} FunctionParameters\n * @property {ContractFunctionParameters} parameters\n * @property {string} name\n */\n\n/**\n * @augments {Query}\n */\nclass ContractCallQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {ContractId | string} [props.contractId]\n * @param {number | Long} [props.gas]\n * @param {FunctionParameters | Uint8Array} [props.functionParameters]\n * @param {number | Long} [props.maxResultSize]\n * @param {AccountId | string} [props.senderAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n\n /**\n * @private\n * @type {?Long}\n */\n this._gas = null;\n if (props.gas != null) {\n this.setGas(props.gas);\n }\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._functionParameters = null;\n if (props.functionParameters != null) {\n if (props.functionParameters instanceof Uint8Array) {\n this.setFunctionParameters(props.functionParameters);\n } else {\n this.setFunction(\n props.functionParameters.name,\n props.functionParameters.parameters\n );\n }\n }\n\n /**\n * @private\n * @type {?Long}\n */\n this._maxResultSize = null;\n if (props.maxResultSize != null) {\n this.setMaxResultSize(props.maxResultSize);\n }\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._senderAccountId = null;\n if (props.senderAccountId != null) {\n this.setSenderAccountId(props.senderAccountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {ContractCallQuery}\n */\n static _fromProtobuf(query) {\n const call =\n /** @type {HashgraphProto.proto.IContractCallLocalQuery} */ (\n query.contractCallLocal\n );\n\n return new ContractCallQuery({\n contractId:\n call.contractID != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(call.contractID)\n : undefined,\n gas: call.gas != null ? call.gas : undefined,\n functionParameters:\n call.functionParameters != null\n ? call.functionParameters\n : undefined,\n maxResultSize:\n call.maxResultSize != null ? call.maxResultSize : undefined,\n });\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Set the contract ID for which the call is being requested.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractCallQuery}\n */\n setContractId(contractId) {\n this._contractId =\n typeof contractId === \"string\"\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get gas() {\n return this._gas;\n }\n\n /**\n * @param {number | Long} gas\n * @returns {ContractCallQuery}\n */\n setGas(gas) {\n this._gas = gas instanceof long__WEBPACK_IMPORTED_MODULE_5__ ? gas : long__WEBPACK_IMPORTED_MODULE_5__.fromValue(gas);\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get senderAccountId() {\n return this._senderAccountId;\n }\n\n /**\n * @param {AccountId | string} senderAccountId\n * @returns {ContractCallQuery}\n */\n setSenderAccountId(senderAccountId) {\n this._senderAccountId =\n typeof senderAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(senderAccountId)\n : senderAccountId;\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get functionParameters() {\n return this._functionParameters;\n }\n\n /**\n * @param {Uint8Array} params\n * @returns {ContractCallQuery}\n */\n setFunctionParameters(params) {\n this._functionParameters = params;\n return this;\n }\n\n /**\n * @param {string} name\n * @param {?ContractFunctionParameters} [params]\n * @returns {ContractCallQuery}\n */\n setFunction(name, params) {\n this._functionParameters = (\n params != null ? params : new _ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]()\n )._build(name);\n\n return this;\n }\n\n /**\n * @param {number | Long} size\n * @returns {ContractCallQuery}\n */\n setMaxResultSize(size) {\n this._maxResultSize =\n size instanceof long__WEBPACK_IMPORTED_MODULE_5__ ? size : long__WEBPACK_IMPORTED_MODULE_5__.fromValue(size);\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Error}\n */\n _mapStatusError(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n const status = _Status_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : _hashgraph_proto__WEBPACK_IMPORTED_MODULE_6__.proto.ResponseCodeEnum.OK\n );\n\n const call =\n /**\n *@type {HashgraphProto.proto.IContractCallLocalResponse}\n */\n (response.contractCallLocal);\n if (!call.functionResult) {\n return new _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult: null,\n });\n }\n\n const contractFunctionResult = this._mapResponseSync(response);\n\n return new _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult,\n });\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.contractCallLocalMethod(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const contractCallLocal =\n /** @type {HashgraphProto.proto.IContractCallLocalResponse} */ (\n response.contractCallLocal\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n contractCallLocal.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Promise}\n */\n _mapResponse(response) {\n const call =\n /**\n *@type {HashgraphProto.proto.IContractCallLocalResponse}\n */\n (response.contractCallLocal);\n\n return Promise.resolve(\n _ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(\n /**\n * @type {HashgraphProto.proto.IContractFunctionResult}\n */\n (call.functionResult),\n false\n )\n );\n }\n\n /**\n * @private\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {ContractFunctionResult}\n */\n _mapResponseSync(response) {\n const call =\n /**\n *@type {HashgraphProto.proto.IContractCallLocalResponse}\n */\n (response.contractCallLocal);\n\n return _ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(\n /**\n * @type {HashgraphProto.proto.IContractFunctionResult}\n */\n (call.functionResult),\n false\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n contractCallLocal: {\n header,\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n gas: this._gas,\n maxResultSize: this._maxResultSize,\n functionParameters: this._functionParameters,\n senderId:\n this._senderAccountId != null\n ? this._senderAccountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `ContractCallQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"contractCallLocal\", ContractCallQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractCallQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractCreateFlow.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractCreateFlow.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractCreateFlow; }\n/* harmony export */ });\n/* harmony import */ var _file_FileCreateTransaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../file/FileCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileCreateTransaction.js\");\n/* harmony import */ var _file_FileAppendTransaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../file/FileAppendTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileAppendTransaction.js\");\n/* harmony import */ var _file_FileDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../file/FileDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileDeleteTransaction.js\");\n/* harmony import */ var _ContractCreateTransaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ContractCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractCreateTransaction.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../file/FileId.js\").default} FileId\n * @typedef {import(\"../Key.js\").default} Key\n * @typedef {import(\"./ContractFunctionParameters.js\").default} ContractFunctionParameters\n * @typedef {import(\"../Hbar.js\").default} Hbar\n * @typedef {import(\"../Duration.js\").default} Duration\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"../transaction/TransactionReceipt.js\").default} TransactionReceipt\n * @typedef {import(\"../client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"../Signer.js\").Signer} Signer\n * @typedef {import(\"../PrivateKey.js\").default} PrivateKey\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../transaction/Transaction.js\").default} Transaction\n */\n\n/**\n * @typedef {import(\"bignumber.js\").BigNumber} BigNumber\n * @typedef {import(\"long\").Long} Long\n */\n\nclass ContractCreateFlow {\n constructor() {\n /** @type {Uint8Array | null} */\n this._bytecode = null;\n this._contractCreate = new _ContractCreateTransaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n\n /**\n * Read `Transaction._signerPublicKeys`\n *\n * @internal\n * @type {Set}\n */\n this._signerPublicKeys = new Set();\n\n /**\n * Read `Transaction._publicKeys`\n *\n * @private\n * @type {PublicKey[]}\n */\n this._publicKeys = [];\n\n /**\n * Read `Transaction._transactionSigners`\n *\n * @private\n * @type {((message: Uint8Array) => Promise)[]}\n */\n this._transactionSigners = [];\n\n this._maxChunks = null;\n }\n\n /**\n * @returns {number | null}\n */\n get maxChunks() {\n return this._maxChunks;\n }\n\n /**\n * @param {number} maxChunks\n * @returns {this}\n */\n setMaxChunks(maxChunks) {\n this._maxChunks = maxChunks;\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get bytecode() {\n return this._bytecode;\n }\n\n /**\n * @param {string | Uint8Array} bytecode\n * @returns {this}\n */\n setBytecode(bytecode) {\n this._bytecode =\n bytecode instanceof Uint8Array ? bytecode : _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_4__.encode(bytecode);\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._contractCreate.adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._contractCreate.setAdminKey(adminKey);\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get gas() {\n return this._contractCreate.gas;\n }\n\n /**\n * @param {number | Long} gas\n * @returns {this}\n */\n setGas(gas) {\n this._contractCreate.setGas(gas);\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get initialBalance() {\n return this._contractCreate.initialBalance;\n }\n\n /**\n * Set the initial amount to transfer into this contract.\n *\n * @param {number | string | Long | BigNumber | Hbar} initialBalance\n * @returns {this}\n */\n setInitialBalance(initialBalance) {\n this._contractCreate.setInitialBalance(initialBalance);\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?AccountId}\n */\n get proxyAccountId() {\n // eslint-disable-next-line deprecation/deprecation\n return this._contractCreate.proxyAccountId;\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} proxyAccountId\n * @returns {this}\n */\n setProxyAccountId(proxyAccountId) {\n // eslint-disable-next-line deprecation/deprecation\n this._contractCreate.setProxyAccountId(proxyAccountId);\n return this;\n }\n\n /**\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._contractCreate.autoRenewPeriod;\n }\n\n /**\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._contractCreate.setAutoRenewPeriod(autoRenewPeriod);\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get constructorParameters() {\n return this._contractCreate.constructorParameters;\n }\n\n /**\n * @param {Uint8Array | ContractFunctionParameters} constructorParameters\n * @returns {this}\n */\n setConstructorParameters(constructorParameters) {\n this._contractCreate.setConstructorParameters(constructorParameters);\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get contractMemo() {\n return this._contractCreate.contractMemo;\n }\n\n /**\n * @param {string} contractMemo\n * @returns {this}\n */\n setContractMemo(contractMemo) {\n this._contractCreate.setContractMemo(contractMemo);\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get maxAutomaticTokenAssociation() {\n return this._contractCreate.maxAutomaticTokenAssociations;\n }\n\n /**\n * @param {number} maxAutomaticTokenAssociation\n * @returns {this}\n */\n setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociation) {\n this._contractCreate.setMaxAutomaticTokenAssociations(\n maxAutomaticTokenAssociation\n );\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get stakedAccountId() {\n return this._contractCreate.stakedAccountId;\n }\n\n /**\n * @param {AccountId | string} stakedAccountId\n * @returns {this}\n */\n setStakedAccountId(stakedAccountId) {\n this._contractCreate.setStakedAccountId(stakedAccountId);\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stakedNodeId() {\n return this._contractCreate.stakedNodeId;\n }\n\n /**\n * @param {Long | number} stakedNodeId\n * @returns {this}\n */\n setStakedNodeId(stakedNodeId) {\n this._contractCreate.setStakedNodeId(stakedNodeId);\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get declineStakingRewards() {\n return this._contractCreate.declineStakingRewards;\n }\n\n /**\n * @param {boolean} declineStakingReward\n * @returns {this}\n */\n setDeclineStakingReward(declineStakingReward) {\n this._contractCreate.setDeclineStakingReward(declineStakingReward);\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._contractCreate.autoRenewAccountId;\n }\n\n /**\n * @param {string | AccountId} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._contractCreate.setAutoRenewAccountId(autoRenewAccountId);\n return this;\n }\n\n /**\n * Sign the transaction with the private key\n * **NOTE**: This is a thin wrapper around `.signWith()`\n *\n * @param {PrivateKey} privateKey\n * @returns {this}\n */\n sign(privateKey) {\n return this.signWith(privateKey.publicKey, (message) =>\n Promise.resolve(privateKey.sign(message))\n );\n }\n\n /**\n * Sign the transaction with the public key and signer function\n *\n * If sign on demand is enabled no signing will be done immediately, instead\n * the private key signing function and public key are saved to be used when\n * a user calls an exit condition method (not sure what a better name for this is)\n * such as `toBytes[Async]()`, `getTransactionHash[PerNode]()` or `execute()`.\n *\n * @param {PublicKey} publicKey\n * @param {(message: Uint8Array) => Promise} transactionSigner\n * @returns {this}\n */\n signWith(publicKey, transactionSigner) {\n const publicKeyData = publicKey.toBytesRaw();\n const publicKeyHex = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_5__.encode(publicKeyData);\n\n if (this._signerPublicKeys.has(publicKeyHex)) {\n // this public key has already signed this transaction\n return this;\n }\n\n this._publicKeys.push(publicKey);\n this._transactionSigners.push(transactionSigner);\n\n return this;\n }\n\n /**\n * @template {Channel} ChannelT\n * @template MirrorChannelT\n * @param {import(\"../client/Client.js\").default} client\n * @param {number=} requestTimeout\n * @returns {Promise}\n */\n async execute(client, requestTimeout) {\n if (this._bytecode == null) {\n throw new Error(\"cannot create contract with no bytecode\");\n }\n\n const key = client.operatorPublicKey;\n\n const fileCreateTransaction = new _file_FileCreateTransaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]()\n .setKeys(key != null ? [key] : [])\n .setContents(\n this._bytecode.subarray(\n 0,\n Math.min(this._bytecode.length, 2048)\n )\n )\n .freezeWith(client);\n await addSignersToTransaction(\n fileCreateTransaction,\n this._publicKeys,\n this._transactionSigners\n );\n\n let response = await fileCreateTransaction.execute(\n client,\n requestTimeout\n );\n const receipt = await response.getReceipt(client);\n\n const fileId = /** @type {FileId} */ (receipt.fileId);\n\n if (this._bytecode.length > 2048) {\n const fileAppendTransaction = new _file_FileAppendTransaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]()\n .setFileId(fileId)\n .setContents(this._bytecode.subarray(2048))\n .freezeWith(client);\n await addSignersToTransaction(\n fileAppendTransaction,\n this._publicKeys,\n this._transactionSigners\n );\n await fileAppendTransaction.execute(client, requestTimeout);\n }\n\n this._contractCreate.setBytecodeFileId(fileId).freezeWith(client);\n\n await addSignersToTransaction(\n this._contractCreate,\n this._publicKeys,\n this._transactionSigners\n );\n\n response = await this._contractCreate.execute(client, requestTimeout);\n await response.getReceipt(client);\n\n if (key != null) {\n const fileDeleteTransaction = new _file_FileDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]()\n .setFileId(fileId)\n .freezeWith(client);\n await addSignersToTransaction(\n fileDeleteTransaction,\n this._publicKeys,\n this._transactionSigners\n );\n await (\n await fileDeleteTransaction.execute(client, requestTimeout)\n ).getReceipt(client);\n }\n\n return response;\n }\n\n /**\n * @param {Signer} signer\n * @returns {Promise}\n */\n async executeWithSigner(signer) {\n if (this._bytecode == null) {\n throw new Error(\"cannot create contract with no bytecode\");\n }\n\n if (signer.getAccountKey == null) {\n throw new Error(\n \"`Signer.getAccountKey()` is not implemented, but is required for `ContractCreateFlow`\"\n );\n }\n\n const key = signer.getAccountKey();\n\n const fileCreateTransaction = await new _file_FileCreateTransaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]()\n .setKeys(key != null ? [key] : [])\n .setContents(\n this._bytecode.subarray(\n 0,\n Math.min(this._bytecode.length, 2048)\n )\n )\n .freezeWithSigner(signer);\n await fileCreateTransaction.signWithSigner(signer);\n await addSignersToTransaction(\n fileCreateTransaction,\n this._publicKeys,\n this._transactionSigners\n );\n\n let response = await fileCreateTransaction.executeWithSigner(signer);\n const receipt = await response.getReceiptWithSigner(signer);\n\n const fileId = /** @type {FileId} */ (receipt.fileId);\n\n if (this._bytecode.length > 2048) {\n let fileAppendTransaction = new _file_FileAppendTransaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]()\n .setFileId(fileId)\n .setContents(this._bytecode.subarray(2048));\n if (this._maxChunks != null) {\n fileAppendTransaction.setMaxChunks(this._maxChunks);\n }\n fileAppendTransaction =\n await fileAppendTransaction.freezeWithSigner(signer);\n await fileAppendTransaction.signWithSigner(signer);\n await addSignersToTransaction(\n fileAppendTransaction,\n this._publicKeys,\n this._transactionSigners\n );\n await fileAppendTransaction.executeWithSigner(signer);\n }\n\n this._contractCreate = await this._contractCreate\n .setBytecodeFileId(fileId)\n .freezeWithSigner(signer);\n this._contractCreate = await this._contractCreate.signWithSigner(\n signer\n );\n await addSignersToTransaction(\n this._contractCreate,\n this._publicKeys,\n this._transactionSigners\n );\n\n response = await this._contractCreate.executeWithSigner(signer);\n\n await response.getReceiptWithSigner(signer);\n\n if (key != null) {\n const fileDeleteTransaction = await new _file_FileDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]()\n .setFileId(fileId)\n .freezeWithSigner(signer);\n await fileDeleteTransaction.signWithSigner(signer);\n await addSignersToTransaction(\n fileDeleteTransaction,\n this._publicKeys,\n this._transactionSigners\n );\n await (\n await fileDeleteTransaction.executeWithSigner(signer)\n ).getReceiptWithSigner(signer);\n }\n\n return response;\n }\n}\n\n/**\n * @template {Transaction} T\n * @param {T} transaction\n * @param {PublicKey[]} publicKeys\n * @param {((message: Uint8Array) => Promise)[]} transactionSigners\n * @returns {Promise}\n */\nasync function addSignersToTransaction(\n transaction,\n publicKeys,\n transactionSigners\n) {\n for (let i = 0; i < publicKeys.length; i++) {\n await transaction.signWith(publicKeys[i], transactionSigners[i]);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractCreateFlow.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractCreateTransaction.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractCreateTransaction.js ***! - \*******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractCreateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ContractFunctionParameters.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractCreateTransactionBody} HashgraphProto.proto.IContractCreateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HashgraphProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\nclass ContractCreateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.bytecodeFileId]\n * @param {Uint8Array} [props.bytecode]\n * @param {Key} [props.adminKey]\n * @param {number | Long} [props.gas]\n * @param {number | string | Long | BigNumber | Hbar} [props.initialBalance]\n * @param {AccountId | string} [props.proxyAccountId]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {Uint8Array} [props.constructorParameters]\n * @param {string} [props.contractMemo]\n * @param {number} [props.maxAutomaticTokenAssociations]\n * @param {AccountId | string} [props.stakedAccountId]\n * @param {Long | number} [props.stakedNodeId]\n * @param {boolean} [props.declineStakingReward]\n * @param {AccountId} [props.autoRenewAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._bytecodeFileId = null;\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._bytecode = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._gas = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._initialBalance = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._proxyAccountId = null;\n\n /**\n * @private\n * @type {Duration}\n */\n this._autoRenewPeriod = new _Duration_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"](_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._constructorParameters = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._contractMemo = null;\n\n /**\n * @private\n * @type {?number}\n */\n this._maxAutomaticTokenAssociations = null;\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](20);\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._stakedAccountId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._stakedNodeId = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this._declineStakingReward = false;\n\n /**\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n if (props.bytecodeFileId != null) {\n this.setBytecodeFileId(props.bytecodeFileId);\n }\n\n if (props.bytecode != null) {\n this.setBytecode(props.bytecode);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.gas != null) {\n this.setGas(props.gas);\n }\n\n if (props.initialBalance != null) {\n this.setInitialBalance(props.initialBalance);\n }\n\n if (props.proxyAccountId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setProxyAccountId(props.proxyAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.constructorParameters != null) {\n this.setConstructorParameters(props.constructorParameters);\n }\n\n if (props.contractMemo != null) {\n this.setContractMemo(props.contractMemo);\n }\n\n if (props.maxAutomaticTokenAssociations != null) {\n this.setMaxAutomaticTokenAssociations(\n props.maxAutomaticTokenAssociations\n );\n }\n\n if (props.stakedAccountId != null) {\n this.setStakedAccountId(props.stakedAccountId);\n }\n\n if (props.stakedNodeId != null) {\n this.setStakedNodeId(props.stakedNodeId);\n }\n\n if (props.declineStakingReward != null) {\n this.setDeclineStakingReward(props.declineStakingReward);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {ContractCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const create =\n /** @type {HashgraphProto.proto.IContractCreateTransactionBody} */ (\n body.contractCreateInstance\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobufTransactions(\n new ContractCreateTransaction({\n bytecodeFileId:\n create.fileID != null\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IFileID} */ (\n create.fileID\n )\n )\n : undefined,\n adminKey:\n create.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]._fromProtobufKey(create.adminKey)\n : undefined,\n gas: create.gas != null ? create.gas : undefined,\n initialBalance:\n create.initialBalance != null\n ? create.initialBalance\n : undefined,\n proxyAccountId:\n create.proxyAccountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n create.proxyAccountID\n )\n )\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? create.autoRenewPeriod.seconds != null\n ? create.autoRenewPeriod.seconds\n : undefined\n : undefined,\n constructorParameters:\n create.constructorParameters != null\n ? create.constructorParameters\n : undefined,\n contractMemo: create.memo != null ? create.memo : undefined,\n maxAutomaticTokenAssociations:\n create.maxAutomaticTokenAssociations != null\n ? create.maxAutomaticTokenAssociations\n : undefined,\n stakedAccountId:\n create.stakedAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(create.stakedAccountId)\n : undefined,\n stakedNodeId:\n create.stakedNodeId != null\n ? create.stakedNodeId\n : undefined,\n declineStakingReward: create.declineReward == true,\n autoRenewAccountId:\n create.autoRenewAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(create.autoRenewAccountId)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get bytecodeFileId() {\n return this._bytecodeFileId;\n }\n\n /**\n * @param {FileId | string} bytecodeFileId\n * @returns {this}\n */\n setBytecodeFileId(bytecodeFileId) {\n this._requireNotFrozen();\n this._bytecodeFileId =\n typeof bytecodeFileId === \"string\"\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(bytecodeFileId)\n : bytecodeFileId.clone();\n this._bytecode = null;\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get bytecode() {\n return this._bytecode;\n }\n\n /**\n * @param {Uint8Array} bytecode\n * @returns {this}\n */\n setBytecode(bytecode) {\n this._requireNotFrozen();\n this._bytecode = bytecode;\n this._bytecodeFileId = null;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get gas() {\n return this._gas;\n }\n\n /**\n * @param {number | Long} gas\n * @returns {this}\n */\n setGas(gas) {\n this._requireNotFrozen();\n this._gas = gas instanceof long__WEBPACK_IMPORTED_MODULE_5__ ? gas : long__WEBPACK_IMPORTED_MODULE_5__.fromValue(gas);\n\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get initialBalance() {\n return this._initialBalance;\n }\n\n /**\n * Set the initial amount to transfer into this contract.\n *\n * @param {number | string | Long | BigNumber | Hbar} initialBalance\n * @returns {this}\n */\n setInitialBalance(initialBalance) {\n this._requireNotFrozen();\n this._initialBalance =\n initialBalance instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? initialBalance\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](initialBalance);\n\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?AccountId}\n */\n get proxyAccountId() {\n return this._proxyAccountId;\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} proxyAccountId\n * @returns {this}\n */\n setProxyAccountId(proxyAccountId) {\n this._requireNotFrozen();\n this._proxyAccountId =\n proxyAccountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? proxyAccountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(proxyAccountId);\n\n return this;\n }\n\n /**\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * An account to charge for auto-renewal of this contract. If not set, or set to an\n * account with zero hbar balance, the contract's own hbar balance will be used to\n * cover auto-renewal fees.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get constructorParameters() {\n return this._constructorParameters;\n }\n\n /**\n * @param {Uint8Array | ContractFunctionParameters} constructorParameters\n * @returns {this}\n */\n setConstructorParameters(constructorParameters) {\n this._requireNotFrozen();\n this._constructorParameters =\n constructorParameters instanceof _ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]\n ? constructorParameters._build()\n : constructorParameters;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get contractMemo() {\n return this._contractMemo;\n }\n\n /**\n * @param {string} contractMemo\n * @returns {this}\n */\n setContractMemo(contractMemo) {\n this._requireNotFrozen();\n this._contractMemo = contractMemo;\n\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get maxAutomaticTokenAssociations() {\n return this._maxAutomaticTokenAssociations;\n }\n\n /**\n * @param {number} maxAutomaticTokenAssociations\n * @returns {this}\n */\n setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) {\n this._maxAutomaticTokenAssociations = maxAutomaticTokenAssociations;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get stakedAccountId() {\n return this._stakedAccountId;\n }\n\n /**\n * @param {AccountId | string} stakedAccountId\n * @returns {this}\n */\n setStakedAccountId(stakedAccountId) {\n this._requireNotFrozen();\n this._stakedAccountId =\n typeof stakedAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(stakedAccountId)\n : stakedAccountId;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stakedNodeId() {\n return this._stakedNodeId;\n }\n\n /**\n * @param {Long | number} stakedNodeId\n * @returns {this}\n */\n setStakedNodeId(stakedNodeId) {\n this._requireNotFrozen();\n this._stakedNodeId = long__WEBPACK_IMPORTED_MODULE_5__.fromValue(stakedNodeId);\n\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get declineStakingRewards() {\n return this._declineStakingReward;\n }\n\n /**\n * @param {boolean} declineStakingReward\n * @returns {this}\n */\n setDeclineStakingReward(declineStakingReward) {\n this._requireNotFrozen();\n this._declineStakingReward = declineStakingReward;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {string | AccountId} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n typeof autoRenewAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(autoRenewAccountId)\n : autoRenewAccountId;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._bytecodeFileId != null) {\n this._bytecodeFileId.validateChecksum(client);\n }\n\n if (this._proxyAccountId != null) {\n this._proxyAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.createContract(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"contractCreateInstance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IContractCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n fileID:\n this._bytecodeFileId != null\n ? this._bytecodeFileId._toProtobuf()\n : null,\n initcode: this._bytecode,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n gas: this._gas,\n initialBalance:\n this._initialBalance != null\n ? this._initialBalance.toTinybars()\n : null,\n proxyAccountID:\n this._proxyAccountId != null\n ? this._proxyAccountId._toProtobuf()\n : null,\n autoRenewPeriod: this._autoRenewPeriod._toProtobuf(),\n constructorParameters: this._constructorParameters,\n memo: this._contractMemo,\n maxAutomaticTokenAssociations: this._maxAutomaticTokenAssociations,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId._toProtobuf()\n : null,\n stakedNodeId: this.stakedNodeId,\n declineReward: this.declineStakingRewards,\n autoRenewAccountId:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractCreateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_4__.TRANSACTION_REGISTRY.set(\n \"contractCreateInstance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractCreateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractCreateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractDeleteTransaction.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractDeleteTransaction.js ***! - \*******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractDeleteTransactionBody} HashgraphProto.proto.IContractDeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\nclass ContractDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {ContractId | string} [props.contractId]\n * @param {ContractId | string} [props.transferContractId]\n * @param {AccountId | string} [props.transferAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._transferAccountId = null;\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._transferContractId = null;\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n\n if (props.transferAccountId != null) {\n this.setTransferAccountId(props.transferAccountId);\n }\n\n if (props.transferContractId != null) {\n this.setTransferContractId(props.transferContractId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {ContractDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const contractDelete =\n /** @type {HashgraphProto.proto.IContractDeleteTransactionBody} */ (\n body.contractDeleteInstance\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new ContractDeleteTransaction({\n contractId:\n contractDelete.contractID != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n contractDelete.contractID\n )\n )\n : undefined,\n transferAccountId:\n contractDelete.transferAccountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n contractDelete.transferAccountID\n )\n )\n : undefined,\n transferContractId:\n contractDelete.transferContractID != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n contractDelete.transferContractID\n )\n )\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Sets the contract ID which is being deleted in this transaction.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractDeleteTransaction}\n */\n setContractId(contractId) {\n this._requireNotFrozen();\n this._contractId =\n typeof contractId === \"string\"\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @returns {?ContractId}\n */\n get transferContractId() {\n return this._transferContractId;\n }\n\n /**\n * Sets the contract ID which will receive all remaining hbars.\n *\n * @param {ContractId | string} transferContractId\n * @returns {ContractDeleteTransaction}\n */\n setTransferContractId(transferContractId) {\n this._requireNotFrozen();\n this._transferContractId =\n transferContractId instanceof _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? transferContractId\n : _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(transferContractId);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get transferAccountId() {\n return this._transferAccountId;\n }\n\n /**\n * Sets the account ID which will receive all remaining hbars.\n *\n * @param {AccountId | string} transferAccountId\n * @returns {ContractDeleteTransaction}\n */\n setTransferAccountId(transferAccountId) {\n this._requireNotFrozen();\n this._transferAccountId =\n transferAccountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? transferAccountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(transferAccountId);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n\n if (this._transferAccountId != null) {\n this._transferAccountId.validateChecksum(client);\n }\n\n if (this._transferContractId != null) {\n this._transferContractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.deleteContract(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"contractDeleteInstance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IContractDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n transferAccountID: this._transferAccountId\n ? this._transferAccountId._toProtobuf()\n : null,\n transferContractID:\n this._transferContractId != null\n ? this._transferContractId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"contractDeleteInstance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractDeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractDeleteTransaction.js?"); +/** + * @template RequestT + * @template ResponseT + * @template OutputT + * @typedef {import("./Executable.js").default} Executable + */ -/***/ }), +/** + * @typedef {import("./Signer.js").Signer} Signer + * @typedef {import("./Provider.js").Provider} Provider + * @typedef {import("./LedgerId.js").default} LedgerId + * @typedef {import("./Key.js").default} Key + * @typedef {import("./transaction/Transaction.js").default} Transaction + * @typedef {import("./transaction/TransactionResponse.js").default} TransactionResponse + * @typedef {import("./transaction/TransactionReceipt.js").default} TransactionReceipt + * @typedef {import("./transaction/TransactionRecord.js").default} TransactionRecord + * @typedef {import("./account/AccountBalance.js").default} AccountBalance + * @typedef {import("./account/AccountInfo.js").default} AccountInfo + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractExecuteTransaction.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractExecuteTransaction.js ***! - \********************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @template {any} O + * @typedef {import("./query/Query.js").default} Query + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractExecuteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ContractFunctionParameters.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractCallTransactionBody} HashgraphProto.proto.IContractCallTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HashgraphProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * @typedef {object} FunctionParameters\n * @property {string} name\n * @property {ContractFunctionParameters} parameters\n */\n\nclass ContractExecuteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {ContractId | string} [props.contractId]\n * @param {number | Long} [props.gas]\n * @param {number | string | Long | BigNumber | Hbar} [props.amount]\n * @param {Uint8Array} [props.functionParameters]\n * @param {FunctionParameters} [props.function]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._gas = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._amount = null;\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._functionParameters = null;\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n\n if (props.gas != null) {\n this.setGas(props.gas);\n }\n\n if (props.amount != null) {\n this.setPayableAmount(props.amount);\n }\n\n if (props.functionParameters != null) {\n this.setFunctionParameters(props.functionParameters);\n } else if (props.function != null) {\n this.setFunction(props.function.name, props.function.parameters);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {ContractExecuteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const call =\n /** @type {HashgraphProto.proto.IContractCallTransactionBody} */ (\n body.contractCall\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new ContractExecuteTransaction({\n contractId:\n call.contractID != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n call.contractID\n )\n )\n : undefined,\n gas: call.gas != null ? call.gas : undefined,\n amount:\n call.amount != null\n ? _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromTinybars(call.amount)\n : undefined,\n functionParameters:\n call.functionParameters != null\n ? call.functionParameters\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Sets the contract ID which is being executed in this transaction.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractExecuteTransaction}\n */\n setContractId(contractId) {\n this._requireNotFrozen();\n this._contractId =\n typeof contractId === \"string\"\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get gas() {\n return this._gas;\n }\n\n /**\n * Sets the contract ID which is being executed in this transaction.\n *\n * @param {number | Long} gas\n * @returns {ContractExecuteTransaction}\n */\n setGas(gas) {\n this._requireNotFrozen();\n this._gas = gas instanceof long__WEBPACK_IMPORTED_MODULE_4__ ? gas : long__WEBPACK_IMPORTED_MODULE_4__.fromValue(gas);\n\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get payableAmount() {\n return this._amount;\n }\n\n /**\n * Sets the contract ID which is being executed in this transaction.\n *\n * @param {number | string | Long | BigNumber | Hbar} amount\n * @returns {ContractExecuteTransaction}\n */\n setPayableAmount(amount) {\n this._requireNotFrozen();\n this._amount = amount instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] ? amount : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](amount);\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get functionParameters() {\n return this._functionParameters;\n }\n\n /**\n * @param {Uint8Array} functionParameters\n * @returns {this}\n */\n setFunctionParameters(functionParameters) {\n this._requireNotFrozen();\n this._functionParameters = functionParameters;\n\n return this;\n }\n\n /**\n * @param {string} name\n * @param {ContractFunctionParameters} [functionParameters]\n * @returns {this}\n */\n setFunction(name, functionParameters) {\n this._requireNotFrozen();\n this._functionParameters =\n functionParameters != null\n ? functionParameters._build(name)\n : new _ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]()._build(name);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.contractCallMethod(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"contractCall\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IContractCallTransactionBody}\n */\n _makeTransactionData() {\n return {\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n gas: this._gas,\n amount: this._amount != null ? this._amount.toTinybars() : null,\n functionParameters: this._functionParameters,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractExecuteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"contractCall\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractExecuteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractExecuteTransaction.js?"); +/** + * @implements {Signer} + */ +class Wallet { + /** + * NOTE: When using string for private key, the string needs to contain DER headers + * + * @param {AccountId | string} accountId + * @param {PrivateKey | string} privateKey + * @param {Provider=} provider + */ + constructor(accountId, privateKey, provider) { + const key = + typeof privateKey === "string" + ? PrivateKey.fromStringDer(privateKey) + : privateKey; + + this.publicKey = key.publicKey; + /** + * @type {(message: Uint8Array) => Promise} + */ + this.signer = (message) => Promise.resolve(key.sign(message)); + this.provider = provider; + this.accountId = + typeof accountId === "string" + ? AccountId.fromString(accountId) + : accountId; + } + + /** + * @returns {Promise} + */ + static createRandomED25519() { + const privateKey = PrivateKey.generateED25519(); + const publicKey = privateKey.publicKey; + const accountId = publicKey.toAccountId(0, 0); + return Promise.resolve(new Wallet(accountId, privateKey)); + } + + /** + * @returns {Promise} + */ + static createRandomECDSA() { + const privateKey = PrivateKey.generateECDSA(); + const publicKey = privateKey.publicKey; + const accountId = publicKey.toAccountId(0, 0); + return Promise.resolve(new Wallet(accountId, privateKey)); + } + + /** + * @returns {Provider=} + */ + getProvider() { + return this.provider; + } + + /** + * @abstract + * @returns {AccountId} + */ + getAccountId() { + return this.accountId; + } + + /** + * @returns {Key} + */ + getAccountKey() { + return this.publicKey; + } + + /** + * @returns {LedgerId?} + */ + getLedgerId() { + return this.provider == null ? null : this.provider.getLedgerId(); + } + + /** + * @abstract + * @returns {{[key: string]: (string | AccountId)}} + */ + getNetwork() { + return this.provider == null ? {} : this.provider.getNetwork(); + } + + /** + * @abstract + * @returns {string[]} + */ + getMirrorNetwork() { + return this.provider == null ? [] : this.provider.getMirrorNetwork(); + } + + /** + * @param {Uint8Array[]} messages + * @returns {Promise} + */ + async sign(messages) { + const sigantures = []; + + for (const message of messages) { + sigantures.push( + new SignerSignature({ + publicKey: this.publicKey, + signature: await this.signer(message), + accountId: this.accountId, + }), + ); + } + + return sigantures; + } + + /** + * @returns {Promise} + */ + getAccountBalance() { + return this.call( + new AccountBalanceQuery().setAccountId(this.accountId), + ); + } + + /** + * @abstract + * @returns {Promise} + */ + getAccountInfo() { + return this.call(new AccountInfoQuery().setAccountId(this.accountId)); + } + + /** + * @abstract + * @returns {Promise} + */ + getAccountRecords() { + return this.call( + new AccountRecordsQuery().setAccountId(this.accountId), + ); + } + + /** + * @template {Transaction} T + * @param {T} transaction + * @returns {Promise} + */ + signTransaction(transaction) { + return transaction.signWith(this.publicKey, this.signer); + } + + /** + * @template {Transaction} T + * @param {T} transaction + * @returns {Promise} + */ + checkTransaction(transaction) { + const transactionId = transaction.transactionId; + if ( + transactionId != null && + transactionId.accountId != null && + transactionId.accountId.compare(this.accountId) != 0 + ) { + throw new Error( + "transaction's ID constructed with a different account ID", + ); + } + + if (this.provider == null) { + return Promise.resolve(transaction); + } + + const nodeAccountIds = ( + transaction.nodeAccountIds != null ? transaction.nodeAccountIds : [] + ).map((nodeAccountId) => nodeAccountId.toString()); + const network = Object.values(this.provider.getNetwork()).map( + (nodeAccountId) => nodeAccountId.toString(), + ); + + if ( + !nodeAccountIds.reduce( + (previous, current) => previous && network.includes(current), + true, + ) + ) { + throw new Error( + "Transaction already set node account IDs to values not within the current network", + ); + } + + return Promise.resolve(transaction); + } + + /** + * @template {Transaction} T + * @param {T} transaction + * @returns {Promise} + */ + populateTransaction(transaction) { + transaction._freezeWithAccountId(this.accountId); + + if (transaction.transactionId == null) { + transaction.setTransactionId( + TransactionId.generate(this.accountId), + ); + } + + if ( + transaction.nodeAccountIds != null && + transaction.nodeAccountIds.length != 0 + ) { + return Promise.resolve(transaction.freeze()); + } + + if (this.provider == null) { + return Promise.resolve(transaction); + } + + const nodeAccountIds = Object.values(this.provider.getNetwork()).map( + (id) => (typeof id === "string" ? AccountId.fromString(id) : id), + ); + util.shuffle(nodeAccountIds); + transaction.setNodeAccountIds( + nodeAccountIds.slice(0, (nodeAccountIds.length + 3 - 1) / 3), + ); + + return Promise.resolve(transaction.freeze()); + } + + /** + * @template RequestT + * @template ResponseT + * @template OutputT + * @param {Executable} request + * @returns {Promise} + */ + call(request) { + if (this.provider == null) { + throw new Error( + "cannot send request with an wallet that doesn't contain a provider", + ); + } + + return this.provider.call( + request._setOperatorWith( + this.accountId, + this.publicKey, + this.signer, + ), + ); + } +} + +// EXTERNAL MODULE: ./node_modules/pino/browser.js +var pino_browser = __webpack_require__(6559); +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/logger/LogLevel.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), +class LogLevel_LogLevel { + /** + * @hideconstructor + * @internal + * @param {string} name + */ + constructor(name) { + /** @readonly */ + this._name = name; + + Object.freeze(this); + } + + /** + * @returns {string} + */ + toString() { + switch (this) { + case LogLevel_LogLevel.Silent: + return "silent"; + case LogLevel_LogLevel.Trace: + return "trace"; + case LogLevel_LogLevel.Debug: + return "debug"; + case LogLevel_LogLevel.Info: + return "info"; + case LogLevel_LogLevel.Warn: + return "warn"; + case LogLevel_LogLevel.Error: + return "error"; + case LogLevel_LogLevel.Fatal: + return "fatal"; + default: + return `Unknown log level (${this._name})`; + } + } + + /** + * @param {string} level + * @returns {LogLevel} + */ + static _fromString(level) { + switch (level) { + case "silent": + return LogLevel_LogLevel.Silent; + case "trace": + return LogLevel_LogLevel.Trace; + case "debug": + return LogLevel_LogLevel.Debug; + case "info": + return LogLevel_LogLevel.Info; + case "warn": + return LogLevel_LogLevel.Warn; + case "error": + return LogLevel_LogLevel.Error; + case "fatal": + return LogLevel_LogLevel.Fatal; + default: + throw new Error(`Unknown log level: ${level}`); + } + } +} + +LogLevel_LogLevel.Silent = new LogLevel_LogLevel("silent"); +LogLevel_LogLevel.Trace = new LogLevel_LogLevel("trace"); +LogLevel_LogLevel.Debug = new LogLevel_LogLevel("debug"); +LogLevel_LogLevel.Info = new LogLevel_LogLevel("info"); +LogLevel_LogLevel.Warn = new LogLevel_LogLevel("warn"); +LogLevel_LogLevel.Error = new LogLevel_LogLevel("error"); +LogLevel_LogLevel.Fatal = new LogLevel_LogLevel("fatal"); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/logger/Logger.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js ***! - \********************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractFunctionParameters; }\n/* harmony export */ });\n/* harmony import */ var _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ContractFunctionSelector.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionSelector.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! bignumber.js */ \"./node_modules/bignumber.js/bignumber.mjs\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\nclass ContractFunctionParameters {\n constructor() {\n /**\n * @type {ContractFunctionSelector}\n */\n this._selector = new _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n\n /**\n * @type {import(\"./ContractFunctionSelector.js\").Argument[]}\n */\n this._arguments = [];\n }\n\n /**\n * @param {string} value\n * @returns {ContractFunctionParameters}\n */\n addString(value) {\n this._selector.addString();\n return this._addParam(value, true);\n }\n\n /**\n * @param {string[]} value\n * @returns {ContractFunctionParameters}\n */\n addStringArray(value) {\n this._selector.addStringArray();\n return this._addParam(value, true);\n }\n\n /**\n * @param {Uint8Array} value\n * @returns {ContractFunctionParameters}\n */\n addBytes(value) {\n this._selector.addBytes();\n return this._addParam(value, true);\n }\n\n /**\n * @param {Uint8Array} value\n * @returns {ContractFunctionParameters}\n */\n addBytes32(value) {\n if (value.length !== 32) {\n throw new Error(\n `addBytes32 expected array to be of length 32, but received ${value.length}`\n );\n }\n\n this._selector.addBytes32();\n return this._addParam(value, false);\n }\n\n /**\n * @param {Uint8Array[]} value\n * @returns {ContractFunctionParameters}\n */\n addBytesArray(value) {\n this._selector.addBytesArray();\n return this._addParam(value, true);\n }\n\n /**\n * @param {Uint8Array[]} value\n * @returns {ContractFunctionParameters}\n */\n addBytes32Array(value) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const [_, entry] of value.entries()) {\n if (entry.length !== 32) {\n throw new Error(\n `addBytes32 expected array to be of length 32, but received ${entry.length}`\n );\n }\n }\n\n this._selector.addBytes32Array();\n return this._addParam(value, true);\n }\n\n /**\n * @param {boolean} value\n * @returns {ContractFunctionParameters}\n */\n addBool(value) {\n this._selector.addBool();\n return this._addParam(value, false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addInt8(value) {\n this._selector.addInt8();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addUint8(value) {\n this._selector.addUint8();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addInt16(value) {\n this._selector.addInt16();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addUint16(value) {\n this._selector.addUint16();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addInt24(value) {\n this._selector.addInt24();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addUint24(value) {\n this._selector.addUint24();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addInt32(value) {\n this._selector.addInt32();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addUint32(value) {\n this._selector.addUint32();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addInt40(value) {\n this._selector.addInt40();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addUint40(value) {\n this._selector.addUint40();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addInt48(value) {\n this._selector.addInt48();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addUint48(value) {\n this._selector.addUint48();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addInt56(value) {\n this._selector.addInt56();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number} value\n * @returns {ContractFunctionParameters}\n */\n addUint56(value) {\n this._selector.addUint56();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt64(value) {\n this._selector.addInt64();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint64(value) {\n this._selector.addUint64();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt72(value) {\n this._selector.addInt72();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint72(value) {\n this._selector.addUint72();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt80(value) {\n this._selector.addInt80();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint80(value) {\n this._selector.addUint80();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt88(value) {\n this._selector.addInt88();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint88(value) {\n this._selector.addUint88();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt96(value) {\n this._selector.addInt96();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint96(value) {\n this._selector.addUint96();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt104(value) {\n this._selector.addInt104();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint104(value) {\n this._selector.addUint104();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt112(value) {\n this._selector.addInt112();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint112(value) {\n this._selector.addUint112();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt120(value) {\n this._selector.addInt120();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint120(value) {\n this._selector.addUint120();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt128(value) {\n this._selector.addInt128();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint128(value) {\n this._selector.addUint128();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt136(value) {\n this._selector.addInt136();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint136(value) {\n this._selector.addUint136();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt144(value) {\n this._selector.addInt144();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint144(value) {\n this._selector.addUint144();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt152(value) {\n this._selector.addInt152();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint152(value) {\n this._selector.addUint152();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt160(value) {\n this._selector.addInt160();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint160(value) {\n this._selector.addUint160();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt168(value) {\n this._selector.addInt168();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint168(value) {\n this._selector.addUint168();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt176(value) {\n this._selector.addInt176();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint176(value) {\n this._selector.addUint176();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt184(value) {\n this._selector.addInt184();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint184(value) {\n this._selector.addUint184();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt192(value) {\n this._selector.addInt192();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint192(value) {\n this._selector.addUint192();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt200(value) {\n this._selector.addInt200();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint200(value) {\n this._selector.addUint200();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt208(value) {\n this._selector.addInt208();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint208(value) {\n this._selector.addUint208();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt216(value) {\n this._selector.addInt216();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint216(value) {\n this._selector.addUint216();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt224(value) {\n this._selector.addInt224();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint224(value) {\n this._selector.addUint224();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt232(value) {\n this._selector.addInt232();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint232(value) {\n this._selector.addUint232();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt240(value) {\n this._selector.addInt240();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint240(value) {\n this._selector.addUint240();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt248(value) {\n this._selector.addInt248();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addUint248(value) {\n this._selector.addUint248();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber} value\n * @returns {ContractFunctionParameters}\n */\n addInt256(value) {\n this._selector.addInt256();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {BigNumber | number} value\n * @returns {ContractFunctionParameters}\n */\n addUint256(value) {\n this._selector.addUint256();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumber(value), false);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt8Array(value) {\n this._selector.addInt8Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint8Array(value) {\n this._selector.addUint8Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt16Array(value) {\n this._selector.addInt16Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint16Array(value) {\n this._selector.addUint16Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt24Array(value) {\n this._selector.addInt24Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint24Array(value) {\n this._selector.addUint24Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt32Array(value) {\n this._selector.addInt32Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint32Array(value) {\n this._selector.addUint32Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt40Array(value) {\n this._selector.addInt40Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint40Array(value) {\n this._selector.addUint40Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt48Array(value) {\n this._selector.addInt48Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint48Array(value) {\n this._selector.addUint48Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt56Array(value) {\n this._selector.addInt56Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint56Array(value) {\n this._selector.addUint56Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt64Array(value) {\n this._selector.addInt64Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint64Array(value) {\n this._selector.addUint64Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt72Array(value) {\n this._selector.addInt72Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint72Array(value) {\n this._selector.addUint72Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt80Array(value) {\n this._selector.addInt80Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint80Array(value) {\n this._selector.addUint80Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt88Array(value) {\n this._selector.addInt88Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint88Array(value) {\n this._selector.addUint88Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt96Array(value) {\n this._selector.addInt96Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint96Array(value) {\n this._selector.addUint96Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt104Array(value) {\n this._selector.addInt104Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint104Array(value) {\n this._selector.addUint104Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt112Array(value) {\n this._selector.addInt112Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint112Array(value) {\n this._selector.addUint112Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt120Array(value) {\n this._selector.addInt120Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint120Array(value) {\n this._selector.addUint120Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt128Array(value) {\n this._selector.addInt128Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint128Array(value) {\n this._selector.addUint128Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt136Array(value) {\n this._selector.addInt136Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint136Array(value) {\n this._selector.addUint136Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt144Array(value) {\n this._selector.addInt144Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint144Array(value) {\n this._selector.addUint144Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt152Array(value) {\n this._selector.addInt152Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint152Array(value) {\n this._selector.addUint152Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt160Array(value) {\n this._selector.addInt160Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint160Array(value) {\n this._selector.addUint160Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt168Array(value) {\n this._selector.addInt168Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint168Array(value) {\n this._selector.addUint168Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt176Array(value) {\n this._selector.addInt176Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint176Array(value) {\n this._selector.addUint176Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt184Array(value) {\n this._selector.addInt184Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint184Array(value) {\n this._selector.addUint184Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt192Array(value) {\n this._selector.addInt192Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint192Array(value) {\n this._selector.addUint192Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt200Array(value) {\n this._selector.addInt200Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint200Array(value) {\n this._selector.addUint200Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt208Array(value) {\n this._selector.addInt208Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint208Array(value) {\n this._selector.addUint208Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt216Array(value) {\n this._selector.addInt216Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint216Array(value) {\n this._selector.addUint216Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt224Array(value) {\n this._selector.addInt224Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint224Array(value) {\n this._selector.addUint224Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt232Array(value) {\n this._selector.addInt232Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint232Array(value) {\n this._selector.addUint232Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt240Array(value) {\n this._selector.addInt240Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint240Array(value) {\n this._selector.addUint240Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt248Array(value) {\n this._selector.addInt248Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint248Array(value) {\n this._selector.addUint248Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addInt256Array(value) {\n this._selector.addInt256Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {number[]} value\n * @returns {ContractFunctionParameters}\n */\n addUint256Array(value) {\n this._selector.addUint256Array();\n return this._addParam(_util_js__WEBPACK_IMPORTED_MODULE_4__.convertToBigNumberArray(value), true);\n }\n\n /**\n * @param {string} value\n * @returns {ContractFunctionParameters}\n */\n addAddress(value) {\n // Allow `0x` prefix\n if (value.length !== 40 && value.length !== 42) {\n throw new Error(\n \"`address` type requires parameter to be 40 or 42 characters\"\n );\n }\n\n const par =\n value.length === 40\n ? _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(value)\n : _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(value.substring(2));\n\n this._selector.addAddress();\n\n return this._addParam(par, false);\n }\n\n /**\n * @param {string[]} value\n * @returns {ContractFunctionParameters}\n */\n addAddressArray(value) {\n /**\n * @type {Uint8Array[]}\n */\n const par = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const [_, entry] of value.entries()) {\n if (entry.length !== 40 && entry.length !== 42) {\n throw new Error(\n \"`address` type requires parameter to be 40 or 42 characters\"\n );\n }\n\n const buf =\n entry.length === 40\n ? _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(entry)\n : _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(entry.substring(2));\n\n par.push(buf);\n }\n\n this._selector.addAddressArray();\n\n return this._addParam(par, true);\n }\n\n /**\n * @param {string} address\n * @param {ContractFunctionSelector} selector\n * @returns {ContractFunctionParameters}\n */\n addFunction(address, selector) {\n const addressParam = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(address);\n const functionSelector = selector._build();\n\n if (addressParam.length !== 20) {\n throw new Error(\n \"`function` type requires parameter `address` to be exactly 20 bytes\"\n );\n }\n\n this._selector.addFunction();\n\n const proto = new Uint8Array(24);\n proto.set(addressParam, 0);\n proto.set(functionSelector, 20);\n\n return this._addParam(proto, false);\n }\n\n /**\n * @internal\n * @param {string | boolean | number | Uint8Array | BigNumber | string[] | boolean[] | number[] | Uint8Array[] | BigNumber[]} param\n * @param {boolean} dynamic\n * @returns {ContractFunctionParameters}\n */\n _addParam(param, dynamic) {\n const index = this._selector._paramTypes.length - 1;\n const value = argumentToBytes(param, this._selector._paramTypes[index]);\n\n this._arguments.push({ dynamic, value });\n return this;\n }\n\n /**\n * @internal\n * @param {string=} name\n * @returns {Uint8Array}\n */\n _build(name) {\n const includeId = name != null;\n const nameOffset = includeId ? 4 : 0;\n\n const length =\n this._arguments.length === 0\n ? nameOffset\n : this._arguments.length * 32 +\n this._arguments\n .map((arg) => (arg.dynamic ? arg.value.length : 0))\n .reduce((sum, value) => sum + value) +\n nameOffset;\n\n const func = new Uint8Array(length);\n\n if (includeId) {\n func.set(this._selector._build(name), 0);\n }\n\n let offset = 32 * this._arguments.length;\n\n for (const [i, { dynamic, value }] of this._arguments.entries()) {\n if (dynamic) {\n const view = _util_js__WEBPACK_IMPORTED_MODULE_4__.safeView(func, nameOffset + i * 32 + 28);\n view.setUint32(0, offset);\n func.set(value, view.getUint32(0) + nameOffset);\n offset += value.length;\n } else {\n func.set(value, nameOffset + i * 32);\n }\n }\n\n return func;\n }\n}\n\n/**\n * @param {string | boolean | number | Uint8Array | BigNumber | string[] | boolean[] | number[] | Uint8Array[] | BigNumber[]} param\n * @param {import(\"./ContractFunctionSelector.js\").SolidityType} ty\n * @returns {Uint8Array}\n */\nfunction argumentToBytes(param, ty) {\n let value = new Uint8Array(32);\n let valueView = _util_js__WEBPACK_IMPORTED_MODULE_4__.safeView(value);\n /** @type {Uint8Array} */\n let par;\n\n if (ty.array) {\n if (!Array.isArray(param)) {\n throw new TypeError(\n \"SolidityType indicates type is array, but parameter is not an array\"\n );\n }\n\n /**\n * @type {Uint8Array[]}\n */\n const values = [];\n\n // Generic over any type of array\n // Destructuring required so the first variable must be assigned\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const [_, p] of param.entries()) {\n const arg = argumentToBytes(p, { ty: ty.ty, array: false });\n values.push(arg);\n }\n\n const totalLengthOfValues = values\n .map((a) => a.length)\n .reduce((total, current) => total + current);\n\n switch (ty.ty) {\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint8:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int8:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint16:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int16:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint32:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int32:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint40:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int40:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint48:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int48:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint56:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int56:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint64:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int64:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint72:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int72:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint80:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int80:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint88:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int88:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint96:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int96:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint104:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int104:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint112:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int112:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint120:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int120:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint128:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int128:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint136:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int136:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint144:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int144:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint152:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int152:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint160:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int160:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint168:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int168:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint176:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int176:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint184:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int184:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint192:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int192:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint200:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int200:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint208:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int208:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint216:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int216:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint224:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int224:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint232:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int232:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint240:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int240:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint248:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int248:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint256:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int256:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bool:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bytes32:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.address:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.func:\n value = new Uint8Array(totalLengthOfValues + 32);\n break;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bytes:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.string:\n value = new Uint8Array(\n values.length * 32 + totalLengthOfValues + 32\n );\n break;\n default:\n throw new TypeError(\n `Expected param type to be ArgumentType, but received ${ty.ty}`\n );\n }\n\n valueView = _util_js__WEBPACK_IMPORTED_MODULE_4__.safeView(value, 28);\n valueView.setUint32(0, values.length);\n\n let offset = 32 * values.length;\n\n for (const [i, e] of values.entries()) {\n switch (ty.ty) {\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint8:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int8:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint16:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int16:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint24:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int24:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint32:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int32:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint40:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int40:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint48:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int48:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint56:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int56:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint64:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int64:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint72:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int72:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint80:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int80:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint88:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int88:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint96:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int96:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint104:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int104:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint112:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int112:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint120:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int120:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint128:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int128:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint136:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int136:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint144:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int144:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint152:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int152:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint160:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int160:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint168:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int168:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint176:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int176:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint184:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int184:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint192:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int192:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint200:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int200:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint208:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int208:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint216:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int216:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint224:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int224:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint232:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int232:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint240:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int240:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint248:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int248:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint256:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int256:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bool:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bytes32:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.address:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.func:\n value.set(e, i * 32 + 32);\n break;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bytes:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.string:\n // eslint-disable-next-line no-case-declarations\n const view = _util_js__WEBPACK_IMPORTED_MODULE_4__.safeView(value, (i + 1) * 32 + 28);\n view.setUint32(0, offset);\n value.set(e, view.getUint32(0) + 32);\n offset += e.length;\n break;\n default:\n throw new TypeError(\n `Expected param type to be ArgumentType, but received ${ty.ty}`\n );\n }\n }\n\n return value;\n }\n\n switch (ty.ty) {\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint8:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 31,\n valueView.setUint8.bind(valueView)\n );\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int8:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 31,\n valueView.setInt8.bind(valueView)\n );\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint16:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 30,\n valueView.setUint16.bind(valueView)\n );\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int16:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 30,\n valueView.setInt16.bind(valueView)\n );\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint24:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 28,\n valueView.setUint32.bind(valueView)\n );\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int24:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 28,\n valueView.setInt32.bind(valueView)\n );\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint32:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 28,\n valueView.setUint32.bind(valueView)\n );\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int32:\n numberToBytes(\n /** @type {number | BigNumber } */ (param),\n 28,\n valueView.setInt32.bind(valueView)\n );\n return value;\n // int64, uint64, and int256 both expect the parameter to be an Uint8Array instead of number\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint40:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int40:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint48:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int48:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint56:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int56:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint64:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int64:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint72:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int72:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint80:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int80:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint88:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int88:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint96:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int96:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint104:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int104:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint112:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int112:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint120:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int120:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint128:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int128:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint136:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int136:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint144:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int144:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint152:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int152:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint160:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int160:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint168:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int168:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint176:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int176:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint184:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int184:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint192:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int192:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint200:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int200:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint208:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int208:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint216:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int216:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint224:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int224:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint232:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int232:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint240:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int240:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint248:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int248:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.int256:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.uint256: {\n if (bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isBigNumber(param)) {\n let par = param.toString(16);\n if (par.length % 2 === 1) {\n par = `0${par}`;\n }\n\n const buf = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(par);\n value.set(buf, 32 - buf.length);\n }\n return value;\n }\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.address:\n value.set(/** @type {Uint8Array} */ (param), 32 - 20);\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bool:\n value[31] = /** @type {boolean} */ (param) ? 1 : 0;\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.func:\n value.set(/** @type {Uint8Array} */ (param), 32 - 24);\n return value;\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bytes32:\n value.set(/** @type {Uint8Array} */ (param), 0);\n return value;\n // Bytes should have not the length already encoded\n // JS String type is encoded as UTF-16 whilst Solidity `string` type is UTF-8 encoded.\n // So if will assume is already correctly updated to being a Uint8Array of UTF-8 string\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.bytes:\n case _ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_0__.ArgumentType.string: {\n // If value is of type string, encode it in UTF-8 format and conver it to Uint8Array\n // Required because JS Strings are UTF-16\n // eslint-disable-next-line no-case-declarations\n par =\n param instanceof Uint8Array\n ? param\n : _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_1__.encode(/** @type {string} */ (param));\n\n // Resize value to a 32 byte boundary if needed\n if (Math.floor(par.length / 32) >= 0) {\n if (Math.floor(par.length % 32) !== 0) {\n value = new Uint8Array(\n (Math.floor(par.length / 32) + 1) * 32 + 32\n );\n } else {\n value = new Uint8Array(\n Math.floor(par.length / 32) * 32 + 32\n );\n }\n } else {\n value = new Uint8Array(64);\n }\n\n value.set(par, 32);\n\n valueView = _util_js__WEBPACK_IMPORTED_MODULE_4__.safeView(value, 28);\n valueView.setUint32(0, par.length);\n return value;\n }\n default:\n throw new Error(`Unsupported argument type: ${ty.toString()}`);\n }\n}\n\n/**\n * @param {number | BigNumber} param\n * @param {number} byteoffset\n * @param {(byteOffset: number, value: number) => void} func\n * @returns {void}\n */\nfunction numberToBytes(param, byteoffset, func) {\n const value = bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isBigNumber(param) ? param.toNumber() : param;\n\n func(byteoffset, value);\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js?"); -/***/ }), +class Logger_Logger { + /** + * @param {LogLevel} level + * @param {string} logFile the file to log to, if empty, logs to console + * @param {boolean} sync perform writes synchronously (similar to console.log) + * @param {boolean} fsync perform a fsyncSync every time a write is completed + * @param {boolean} mkdir ensure directory for dest file exists when true (default false) + * @param {number} minLength the minimum length of the internal buffer that is required to be full before flushing + */ + constructor( + level, + logFile = "", + sync = true, + fsync = true, + mkdir = true, + minLength = 0, + ) { + const fileTransport = logFile + ? pino.destination({ + dest: logFile, + sync, + fsync, + mkdir, + minLength, + }) + : null; + + const loggerOptions = fileTransport + ? { + level: level.toString(), + timestamp: pino.stdTimeFunctions.isoTime, + formatters: { + bindings: () => { + return {}; + }, + // @ts-ignore + level: (label) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access + return { level: label.toUpperCase() }; + }, + }, + } + : { + level: level.toString(), + transport: { + target: "pino-pretty", + options: { + translateTime: "SYS:dd-mm-yyyy HH:MM:ss", + ignore: "pid,hostname", + }, + }, + }; + + /** + * @private + * @type {import("pino").Logger} + */ + this._logger = fileTransport + ? pino(loggerOptions, fileTransport) + : pino(loggerOptions); + + /** + * @private + * @type {LogLevel} + */ + this._previousLevel = level; + } + + /** + * Set logger + * + * @public + * @param {import("pino").Logger} logger + * @returns {this} + */ + setLogger(logger) { + this._logger = logger; + return this; + } + + /** + * Set log level + * + * @public + * @param {LogLevel} level + * @returns {this} + */ + setLevel(level) { + this._previousLevel = LogLevel._fromString(this._logger.level); + this._logger.level = level.toString(); + return this; + } + + /** + * Get logging level + * + * @public + * @returns {LogLevel} + */ + get level() { + return LogLevel._fromString(this._logger.level); + } + + /** + * Get logging level + * + * @public + * @returns {{[level: number]: string}} + */ + get levels() { + return this._logger.levels.labels; + } + + /** + * Set silent mode on/off + * + * @public + * @description If set to true, the logger will not display any log messages + * - This can also be achieved by calling `.setLevel(LogLevel.Silent)` + * @param {boolean} silent + * @returns {this} + */ + setSilent(silent) { + if (silent) { + this._logger.level = LogLevel.Silent.toString(); + } else { + // Here we are setting the level to the previous level, before silencing the logger + this._logger.level = this._previousLevel.toString(); + } + return this; + } + + /** + * Get silent mode + * + * @public + * @returns {boolean} + */ + get silent() { + return this._logger.level == LogLevel.Silent.toString(); + } + + /** + * Log trace + * + * @public + * @param {string} message + * @returns {void} + */ + trace(message) { + this._logger.trace(message); + } + + /** + * Log debug + * + * @public + * @param {string} message + * @returns {void} + */ + debug(message) { + this._logger.debug(message); + } + + /** + * Log info + * + * @public + * @param {string} message + * @returns {void} + */ + info(message) { + this._logger.info(message); + } + + /** + * Log warn + * + * @public + * @param {string} message + * @returns {void} + */ + warn(message) { + this._logger.warn(message); + } + + /** + * Log error + * + * @public + * @param {string} message + * @returns {void} + */ + error(message) { + this._logger.error(message); + } + + /** + * Log fatal + * + * @public + * @param {string} message + * @returns {void} + */ + fatal(message) { + this._logger.fatal(message); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/token/TokenUpdateNftsTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractFunctionResult.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractFunctionResult.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractFunctionResult; }\n/* harmony export */ });\n/* harmony import */ var _ContractLogInfo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ContractLogInfo.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractLogInfo.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! bignumber.js */ \"./node_modules/bignumber.js/bignumber.mjs\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./ContractStateChange.js\").default} ContractStateChange\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IContractFunctionResult} HashgraphProto.proto.IContractFunctionResult\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n */\n\n/**\n * The result returned by a call to a smart contract function. This is part of the response to\n * a ContractCallLocal query, and is in the record for a ContractCall or ContractCreateInstance\n * transaction. The ContractCreateInstance transaction record has the results of the call to\n * the constructor.\n */\nclass ContractFunctionResult {\n /**\n * Constructor isn't part of the stable API\n *\n * @param {object} result\n * @param {boolean} result._createResult\n * @param {?ContractId} result.contractId\n * @param {?string} result.errorMessage\n * @param {Uint8Array} result.bloom\n * @param {Long} result.gasUsed\n * @param {ContractLogInfo[]} result.logs\n * @param {ContractId[]} result.createdContractIds\n * @param {Uint8Array | null} result.evmAddress\n * @param {Uint8Array} result.bytes\n * @param {Long} result.gas\n * @param {Long} result.amount\n * @param {Uint8Array} result.functionParameters\n * @param {?AccountId} result.senderAccountId\n * @param {ContractStateChange[]} result.stateChanges\n */\n constructor(result) {\n /**\n * Determines if this result came from `record.contractCreateResult` if true\n * or `record.contractCallResult` if false\n */\n this._createResult = result._createResult;\n\n /**\n * The smart contract instance whose function was called.\n */\n this.contractId = result.contractId;\n\n this.bytes = result.bytes;\n\n /**\n * Message In case there was an error during smart contract execution.\n */\n this.errorMessage = result.errorMessage;\n\n /**\n * Bloom filter for record\n */\n this.bloom = result.bloom;\n\n /**\n * Units of gas used to execute contract.\n */\n this.gasUsed = result.gasUsed;\n\n /**\n * The log info for events returned by the function.\n */\n this.logs = result.logs;\n\n /**\n * @deprecated the list of smart contracts that were created by the function call.\n *\n * The created ids will now _also_ be externalized through internal transaction\n * records, where each record has its alias field populated with the new contract's\n * EVM address. (This is needed for contracts created with CREATE2, since\n * there is no longer a simple relationship between the new contract's 0.0.X id\n * and its Solidity address.)\n */\n // eslint-disable-next-line deprecation/deprecation\n this.createdContractIds = result.createdContractIds;\n\n this.evmAddress = result.evmAddress;\n\n /**\n * @deprecated - Use mirror node for contract traceability instead\n */\n // eslint-disable-next-line deprecation/deprecation\n this.stateChanges = result.stateChanges;\n\n /**\n * The amount of gas available for the call, aka the gasLimit.\n */\n this.gas = result.gas;\n\n /**\n * Number of tinybars sent (the function must be payable if this is nonzero).\n */\n this.amount = result.amount;\n\n /**\n * The parameters passed into the contract call.\n */\n this.functionParameters = result.functionParameters;\n\n /**\n * The account that is the \"sender.\" If not present it is the accountId from the transactionId.\n *\n * This field should only be populated when the paired TransactionBody in the record stream is not a\n * ContractCreateTransactionBody or a ContractCallTransactionBody.\n */\n this.senderAccountId = result.senderAccountId;\n }\n\n /**\n * @param {HashgraphProto.proto.IContractFunctionResult} result\n * @param {boolean} _createResult\n * @returns {ContractFunctionResult}\n */\n static _fromProtobuf(result, _createResult) {\n const contractId =\n /** @type {HashgraphProto.proto.IContractID | null} */ (\n result.contractID\n );\n const gasUsed = /** @type {Long} */ (result.gasUsed);\n const gas = /** @type {Long} */ (result.gas ? result.gas : -1);\n const amount = /** @type {Long} */ (result.amount ? result.amount : -1);\n\n return new ContractFunctionResult({\n _createResult,\n bytes: /** @type {Uint8Array} */ (result.contractCallResult),\n contractId:\n contractId != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(contractId)\n : null,\n errorMessage:\n result.errorMessage != null ? result.errorMessage : null,\n bloom: /** @type {Uint8Array} */ (result.bloom),\n gasUsed:\n gasUsed instanceof long__WEBPACK_IMPORTED_MODULE_7__ ? gasUsed : long__WEBPACK_IMPORTED_MODULE_7__.fromValue(gasUsed),\n logs: (result.logInfo != null ? result.logInfo : []).map((info) =>\n _ContractLogInfo_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(info)\n ),\n createdContractIds: (result.createdContractIDs != null\n ? result.createdContractIDs\n : []\n ).map((contractId) => _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(contractId)),\n evmAddress:\n result.evmAddress != null && result.evmAddress.value != null\n ? result.evmAddress.value\n : null,\n stateChanges: [],\n gas: gas instanceof long__WEBPACK_IMPORTED_MODULE_7__ ? gas : long__WEBPACK_IMPORTED_MODULE_7__.fromValue(gas),\n amount: amount instanceof long__WEBPACK_IMPORTED_MODULE_7__ ? amount : long__WEBPACK_IMPORTED_MODULE_7__.fromValue(amount),\n functionParameters: /** @type {Uint8Array} */ (\n result.functionParameters\n ),\n senderAccountId:\n result.senderId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(result.senderId)\n : null,\n });\n }\n\n /**\n * @returns {Uint8Array}\n */\n asBytes() {\n return this.bytes;\n }\n\n /**\n * @param {number} [index]\n * @returns {string}\n */\n getString(index) {\n return _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_5__.decode(this.getBytes(index));\n }\n\n /**\n * @private\n * @param {number} [index]\n * @returns {Uint8Array}\n */\n getBytes(index) {\n // Len should never be larger than Number.MAX\n // index * 32 is the position of the lenth\n // (index + 1) * 32 onward to (index + 1) * 32 + len will be the elements of the array\n // Arrays in solidity cannot be longer than 1024:\n // https://solidity.readthedocs.io/en/v0.4.21/introduction-to-smart-contracts.html\n const offset = this.getInt32(index);\n const len = _util_js__WEBPACK_IMPORTED_MODULE_6__.safeView(this.bytes).getInt32(offset + 28);\n\n return this.bytes.subarray(offset + 32, offset + 32 + len);\n }\n\n /**\n * @param {number} [index]\n * @returns {Uint8Array}\n */\n getBytes32(index) {\n return this.bytes.subarray(\n (index != null ? index : 0) * 32,\n (index != null ? index : 0) * 32 + 32\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {boolean}\n */\n getBool(index) {\n return this.bytes[(index != null ? index : 0) * 32 + 31] !== 0;\n }\n\n /**\n * @param {number} [index]\n * @returns {number}\n */\n getInt8(index) {\n return this.bytes[(index != null ? index : 0) * 32 + 31];\n }\n\n /**\n * @param {number} [index]\n * @returns {number}\n */\n getUint8(index) {\n return this.bytes[(index != null ? index : 0) * 32 + 31];\n }\n\n /**\n * @param {number} [index]\n * @returns {number}\n */\n getInt32(index) {\n // .getInt32() interprets as big-endian\n // Using DataView instead of Uint32Array because the latter interprets\n // using platform endianness which is little-endian on x86\n const position = (index != null ? index : 0) * 32 + 28;\n return _util_js__WEBPACK_IMPORTED_MODULE_6__.safeView(this.bytes).getInt32(position);\n }\n\n /**\n * @param {number} [index]\n * @returns {number}\n */\n getUint32(index) {\n // .getUint32() interprets as big-endian\n // Using DataView instead of Uint32Array because the latter interprets\n // using platform endianness which is little-endian on x86\n const position = (index != null ? index : 0) * 32 + 28;\n return _util_js__WEBPACK_IMPORTED_MODULE_6__.safeView(this.bytes).getUint32(position);\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt40(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(27, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint40(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(27, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt48(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(26, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint48(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(26, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt56(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(25, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint56(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(25, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt64(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(24, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint64(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(24, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt72(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(23, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint72(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(23, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt80(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(22, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint80(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(22, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt88(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(21, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint88(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(21, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt96(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(20, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint96(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(20, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt104(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(19, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint104(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(19, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt112(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(18, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint112(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(18, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt120(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(17, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint120(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(17, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt128(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(16, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint128(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(16, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt136(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(15, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint136(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(15, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt144(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(14, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint144(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(14, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt152(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(13, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint152(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(13, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt160(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(12, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint160(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(12, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt168(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(11, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint168(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(11, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt176(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(10, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint176(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(10, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt184(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(9, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint184(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(9, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt192(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(8, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint192(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(8, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt200(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(7, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint200(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(7, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt208(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(6, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint208(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(6, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt216(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(5, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint216(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(5, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt224(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(4, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint224(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(4, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt232(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(3, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint232(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(3, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt240(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(2, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint240(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(2, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt248(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this._getBytes32(index != null ? index : 0).subarray(1, 32)\n ),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint248(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index).subarray(1, 32)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getInt256(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index != null ? index : 0)),\n 16\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {BigNumber}\n */\n getUint256(index) {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this._getBytes32(index)), 16);\n }\n\n /**\n * @param {number} [index]\n * @returns {string}\n */\n getAddress(index) {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this.bytes.subarray(\n (index != null ? index : 0) * 32 + 12,\n (index != null ? index : 0) * 32 + 32\n )\n );\n }\n\n /**\n * @param {number} [index]\n * @returns {Uint8Array}\n */\n _getBytes32(index) {\n return this.bytes.subarray(\n (index != null ? index : 0) * 32,\n (index != null ? index : 0) * 32 + 32\n );\n }\n\n /**\n * @returns {HashgraphProto.proto.IContractFunctionResult}\n */\n _toProtobuf() {\n return {\n contractID:\n this.contractId != null ? this.contractId._toProtobuf() : null,\n contractCallResult: this.bytes,\n errorMessage: this.errorMessage,\n bloom: this.bloom,\n gasUsed: this.gasUsed,\n logInfo: this.logs.map((log) => log._toProtobuf()),\n // eslint-disable-next-line deprecation/deprecation\n createdContractIDs: this.createdContractIds.map((id) =>\n id._toProtobuf()\n ),\n evmAddress:\n this.evmAddress != null\n ? {\n value: this.evmAddress,\n }\n : null,\n gas: this.gas,\n amount: this.amount,\n functionParameters: this.functionParameters,\n senderId:\n this.senderAccountId != null\n ? this.senderAccountId._toProtobuf()\n : null,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractFunctionResult.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractFunctionSelector.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractFunctionSelector.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} HashgraphProto.proto.ITransaction + * @typedef {import("@hashgraph/proto").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} HashgraphProto.proto.TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse + * @typedef {import("@hashgraph/proto").proto.ITokenUpdateNftsTransactionBody} HashgraphProto.proto.ITokenUpdateNftsTransactionBody + * @typedef {import("@hashgraph/proto").proto.ITokenID} HashgraphProto.proto.ITokenID + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ArgumentType\": function() { return /* binding */ ArgumentType; },\n/* harmony export */ \"default\": function() { return /* binding */ ContractFunctionSelector; }\n/* harmony export */ });\n/* harmony import */ var _cryptography_keccak_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cryptography/keccak.js */ \"./node_modules/@hashgraph/sdk/src/cryptography/keccak.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @enum {number}\n */\nconst ArgumentType = {\n uint8: 0,\n int8: 1,\n uint16: 2,\n int16: 3,\n uint24: 4,\n int24: 5,\n uint32: 6,\n int32: 7,\n uint40: 8,\n int40: 9,\n uint48: 10,\n int48: 11,\n uint56: 12,\n int56: 13,\n uint64: 14,\n int64: 15,\n uint72: 16,\n int72: 17,\n uint80: 18,\n int80: 19,\n uint88: 20,\n int88: 21,\n uint96: 22,\n int96: 23,\n uint104: 24,\n int104: 25,\n uint112: 26,\n int112: 27,\n uint120: 28,\n int120: 29,\n uint128: 30,\n int128: 31,\n uint136: 32,\n int136: 33,\n uint144: 34,\n int144: 35,\n uint152: 36,\n int152: 37,\n uint160: 38,\n int160: 39,\n uint168: 40,\n int168: 41,\n uint176: 42,\n int176: 43,\n uint184: 44,\n int184: 45,\n uint192: 46,\n int192: 47,\n uint200: 48,\n int200: 49,\n uint208: 50,\n int208: 51,\n uint216: 52,\n int216: 53,\n uint224: 54,\n int224: 55,\n uint232: 56,\n int232: 57,\n uint240: 58,\n int240: 59,\n uint248: 60,\n int248: 61,\n uint256: 62,\n int256: 63,\n string: 64,\n bool: 65,\n bytes: 66,\n bytes32: 67,\n address: 68,\n func: 69,\n};\n\n/**\n * @typedef {object} Argument\n * @property {boolean} dynamic\n * @property {Uint8Array} value\n */\n\n/**\n * @typedef {object} SolidityType\n * @property {ArgumentType} ty\n * @property {boolean} array\n */\n\nclass ContractFunctionSelector {\n /**\n * @param {string} [name]\n */\n constructor(name) {\n /**\n * @type {?string}\n */\n this.name = null;\n\n /**\n * @type {string}\n */\n this._params = \"\";\n\n /**\n * @type {SolidityType[]}\n */\n this._paramTypes = [];\n\n if (name != null) {\n this._name = name;\n }\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addString() {\n return this._addParam({ ty: ArgumentType.string, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addStringArray() {\n return this._addParam({ ty: ArgumentType.string, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addBytes() {\n return this._addParam({ ty: ArgumentType.bytes, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addBytes32() {\n return this._addParam({ ty: ArgumentType.bytes32, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addBytesArray() {\n return this._addParam({ ty: ArgumentType.bytes, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addBytes32Array() {\n return this._addParam({ ty: ArgumentType.bytes32, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt8() {\n return this._addParam({ ty: ArgumentType.int8, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint8() {\n return this._addParam({ ty: ArgumentType.uint8, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt16() {\n return this._addParam({ ty: ArgumentType.int16, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint16() {\n return this._addParam({ ty: ArgumentType.uint16, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt24() {\n return this._addParam({ ty: ArgumentType.int24, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint24() {\n return this._addParam({ ty: ArgumentType.uint24, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt32() {\n return this._addParam({ ty: ArgumentType.int32, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint32() {\n return this._addParam({ ty: ArgumentType.uint32, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt40() {\n return this._addParam({ ty: ArgumentType.int40, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint40() {\n return this._addParam({ ty: ArgumentType.uint40, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt48() {\n return this._addParam({ ty: ArgumentType.int48, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint48() {\n return this._addParam({ ty: ArgumentType.uint48, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt56() {\n return this._addParam({ ty: ArgumentType.int56, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint56() {\n return this._addParam({ ty: ArgumentType.uint56, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt64() {\n return this._addParam({ ty: ArgumentType.int64, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint64() {\n return this._addParam({ ty: ArgumentType.uint64, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt72() {\n return this._addParam({ ty: ArgumentType.int72, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint72() {\n return this._addParam({ ty: ArgumentType.uint72, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt80() {\n return this._addParam({ ty: ArgumentType.int80, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint80() {\n return this._addParam({ ty: ArgumentType.uint80, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt88() {\n return this._addParam({ ty: ArgumentType.int88, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint88() {\n return this._addParam({ ty: ArgumentType.uint88, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt96() {\n return this._addParam({ ty: ArgumentType.int96, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint96() {\n return this._addParam({ ty: ArgumentType.uint96, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt104() {\n return this._addParam({ ty: ArgumentType.int104, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint104() {\n return this._addParam({ ty: ArgumentType.uint104, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt112() {\n return this._addParam({ ty: ArgumentType.int112, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint112() {\n return this._addParam({ ty: ArgumentType.uint112, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt120() {\n return this._addParam({ ty: ArgumentType.int120, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint120() {\n return this._addParam({ ty: ArgumentType.uint120, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt128() {\n return this._addParam({ ty: ArgumentType.int128, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint128() {\n return this._addParam({ ty: ArgumentType.uint128, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt136() {\n return this._addParam({ ty: ArgumentType.int136, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint136() {\n return this._addParam({ ty: ArgumentType.uint136, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt144() {\n return this._addParam({ ty: ArgumentType.int144, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint144() {\n return this._addParam({ ty: ArgumentType.uint144, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt152() {\n return this._addParam({ ty: ArgumentType.int152, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint152() {\n return this._addParam({ ty: ArgumentType.uint152, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt160() {\n return this._addParam({ ty: ArgumentType.int160, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint160() {\n return this._addParam({ ty: ArgumentType.uint160, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt168() {\n return this._addParam({ ty: ArgumentType.int168, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint168() {\n return this._addParam({ ty: ArgumentType.uint168, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt176() {\n return this._addParam({ ty: ArgumentType.int176, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint176() {\n return this._addParam({ ty: ArgumentType.uint176, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt184() {\n return this._addParam({ ty: ArgumentType.int184, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint184() {\n return this._addParam({ ty: ArgumentType.uint184, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt192() {\n return this._addParam({ ty: ArgumentType.int192, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint192() {\n return this._addParam({ ty: ArgumentType.uint192, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt200() {\n return this._addParam({ ty: ArgumentType.int200, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint200() {\n return this._addParam({ ty: ArgumentType.uint200, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt208() {\n return this._addParam({ ty: ArgumentType.int208, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint208() {\n return this._addParam({ ty: ArgumentType.uint208, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt216() {\n return this._addParam({ ty: ArgumentType.int216, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint216() {\n return this._addParam({ ty: ArgumentType.uint216, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt224() {\n return this._addParam({ ty: ArgumentType.int224, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint224() {\n return this._addParam({ ty: ArgumentType.uint224, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt232() {\n return this._addParam({ ty: ArgumentType.int232, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint232() {\n return this._addParam({ ty: ArgumentType.uint232, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt240() {\n return this._addParam({ ty: ArgumentType.int240, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint240() {\n return this._addParam({ ty: ArgumentType.uint240, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt248() {\n return this._addParam({ ty: ArgumentType.int248, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint248() {\n return this._addParam({ ty: ArgumentType.uint248, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt256() {\n return this._addParam({ ty: ArgumentType.int256, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint256() {\n return this._addParam({ ty: ArgumentType.uint256, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt8Array() {\n return this._addParam({ ty: ArgumentType.int8, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint8Array() {\n return this._addParam({ ty: ArgumentType.uint8, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt16Array() {\n return this._addParam({ ty: ArgumentType.int16, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint16Array() {\n return this._addParam({ ty: ArgumentType.uint16, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt24Array() {\n return this._addParam({ ty: ArgumentType.int24, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint24Array() {\n return this._addParam({ ty: ArgumentType.uint24, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt32Array() {\n return this._addParam({ ty: ArgumentType.int32, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint32Array() {\n return this._addParam({ ty: ArgumentType.uint32, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt40Array() {\n return this._addParam({ ty: ArgumentType.int40, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint40Array() {\n return this._addParam({ ty: ArgumentType.uint40, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt48Array() {\n return this._addParam({ ty: ArgumentType.int48, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint48Array() {\n return this._addParam({ ty: ArgumentType.uint48, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt56Array() {\n return this._addParam({ ty: ArgumentType.int56, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint56Array() {\n return this._addParam({ ty: ArgumentType.uint56, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt64Array() {\n return this._addParam({ ty: ArgumentType.int64, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint64Array() {\n return this._addParam({ ty: ArgumentType.uint64, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt72Array() {\n return this._addParam({ ty: ArgumentType.int72, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint72Array() {\n return this._addParam({ ty: ArgumentType.uint72, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt80Array() {\n return this._addParam({ ty: ArgumentType.int80, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint80Array() {\n return this._addParam({ ty: ArgumentType.uint80, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt88Array() {\n return this._addParam({ ty: ArgumentType.int88, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint88Array() {\n return this._addParam({ ty: ArgumentType.uint88, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt96Array() {\n return this._addParam({ ty: ArgumentType.int96, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint96Array() {\n return this._addParam({ ty: ArgumentType.uint96, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt104Array() {\n return this._addParam({ ty: ArgumentType.int104, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint104Array() {\n return this._addParam({ ty: ArgumentType.uint104, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt112Array() {\n return this._addParam({ ty: ArgumentType.int112, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint112Array() {\n return this._addParam({ ty: ArgumentType.uint112, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt120Array() {\n return this._addParam({ ty: ArgumentType.int120, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint120Array() {\n return this._addParam({ ty: ArgumentType.uint120, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt128Array() {\n return this._addParam({ ty: ArgumentType.int128, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint128Array() {\n return this._addParam({ ty: ArgumentType.uint128, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt136Array() {\n return this._addParam({ ty: ArgumentType.int136, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint136Array() {\n return this._addParam({ ty: ArgumentType.uint136, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt144Array() {\n return this._addParam({ ty: ArgumentType.int144, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint144Array() {\n return this._addParam({ ty: ArgumentType.uint144, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt152Array() {\n return this._addParam({ ty: ArgumentType.int152, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint152Array() {\n return this._addParam({ ty: ArgumentType.uint152, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt160Array() {\n return this._addParam({ ty: ArgumentType.int160, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint160Array() {\n return this._addParam({ ty: ArgumentType.uint160, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt168Array() {\n return this._addParam({ ty: ArgumentType.int168, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint168Array() {\n return this._addParam({ ty: ArgumentType.uint168, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt176Array() {\n return this._addParam({ ty: ArgumentType.int176, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint176Array() {\n return this._addParam({ ty: ArgumentType.uint176, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt184Array() {\n return this._addParam({ ty: ArgumentType.int184, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint184Array() {\n return this._addParam({ ty: ArgumentType.uint184, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt192Array() {\n return this._addParam({ ty: ArgumentType.int192, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint192Array() {\n return this._addParam({ ty: ArgumentType.uint192, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt200Array() {\n return this._addParam({ ty: ArgumentType.int200, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint200Array() {\n return this._addParam({ ty: ArgumentType.uint200, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt208Array() {\n return this._addParam({ ty: ArgumentType.int208, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint208Array() {\n return this._addParam({ ty: ArgumentType.uint208, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt216Array() {\n return this._addParam({ ty: ArgumentType.int216, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint216Array() {\n return this._addParam({ ty: ArgumentType.uint216, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt224Array() {\n return this._addParam({ ty: ArgumentType.int224, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint224Array() {\n return this._addParam({ ty: ArgumentType.uint224, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt232Array() {\n return this._addParam({ ty: ArgumentType.int232, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint232Array() {\n return this._addParam({ ty: ArgumentType.uint232, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt240Array() {\n return this._addParam({ ty: ArgumentType.int240, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint240Array() {\n return this._addParam({ ty: ArgumentType.uint240, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt248Array() {\n return this._addParam({ ty: ArgumentType.int248, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint248Array() {\n return this._addParam({ ty: ArgumentType.uint248, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addInt256Array() {\n return this._addParam({ ty: ArgumentType.int256, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addUint256Array() {\n return this._addParam({ ty: ArgumentType.uint256, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addBool() {\n return this._addParam({ ty: ArgumentType.bool, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addAddress() {\n return this._addParam({ ty: ArgumentType.address, array: false });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addAddressArray() {\n return this._addParam({ ty: ArgumentType.address, array: true });\n }\n\n /**\n * @returns {ContractFunctionSelector}\n */\n addFunction() {\n return this._addParam({ ty: ArgumentType.func, array: false });\n }\n\n /**\n * @param {SolidityType} ty\n * @returns {ContractFunctionSelector}\n */\n _addParam(ty) {\n if (this._paramTypes.length > 0) {\n this._params += \",\";\n }\n\n this._params += solidityTypeToString(ty);\n this._paramTypes.push(ty);\n\n return this;\n }\n\n /**\n * @param {string} [name]\n * @returns {Uint8Array}\n */\n _build(name) {\n if (name != null) {\n this._name = name;\n } else if (this._name == null) {\n throw new Error(\"`name` required for ContractFunctionSelector\");\n }\n\n const func = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.encode(_encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__.encode(this.toString()));\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_1__.decode((0,_cryptography_keccak_js__WEBPACK_IMPORTED_MODULE_0__.keccak256)(`0x${func}`)).slice(0, 4);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this._name != null ? this._name.toString() : \"\"}(${\n this._params\n })`;\n }\n}\n\n/**\n * @param {SolidityType} ty\n * @returns {string}\n */\nfunction solidityTypeToString(ty) {\n let s = \"\";\n switch (ty.ty) {\n case ArgumentType.uint8:\n s = \"uint8\";\n break;\n case ArgumentType.int8:\n s = \"int8\";\n break;\n case ArgumentType.uint16:\n s = \"uint16\";\n break;\n case ArgumentType.int16:\n s = \"int16\";\n break;\n case ArgumentType.uint24:\n s = \"uint24\";\n break;\n case ArgumentType.int24:\n s = \"int24\";\n break;\n case ArgumentType.uint32:\n s = \"uint32\";\n break;\n case ArgumentType.int32:\n s = \"int32\";\n break;\n case ArgumentType.uint40:\n s = \"uint40\";\n break;\n case ArgumentType.int40:\n s = \"int40\";\n break;\n case ArgumentType.uint48:\n s = \"uint48\";\n break;\n case ArgumentType.int48:\n s = \"int48\";\n break;\n case ArgumentType.uint56:\n s = \"uint56\";\n break;\n case ArgumentType.int56:\n s = \"int56\";\n break;\n case ArgumentType.uint64:\n s = \"uint64\";\n break;\n case ArgumentType.int64:\n s = \"int64\";\n break;\n case ArgumentType.uint72:\n s = \"uint72\";\n break;\n case ArgumentType.int72:\n s = \"int72\";\n break;\n case ArgumentType.uint80:\n s = \"uint80\";\n break;\n case ArgumentType.int80:\n s = \"int80\";\n break;\n case ArgumentType.uint88:\n s = \"uint88\";\n break;\n case ArgumentType.int88:\n s = \"int88\";\n break;\n case ArgumentType.uint96:\n s = \"uint96\";\n break;\n case ArgumentType.int96:\n s = \"int96\";\n break;\n case ArgumentType.uint104:\n s = \"uint104\";\n break;\n case ArgumentType.int104:\n s = \"int104\";\n break;\n case ArgumentType.uint112:\n s = \"uint112\";\n break;\n case ArgumentType.int112:\n s = \"int112\";\n break;\n case ArgumentType.uint120:\n s = \"uint120\";\n break;\n case ArgumentType.int120:\n s = \"int120\";\n break;\n case ArgumentType.uint128:\n s = \"uint128\";\n break;\n case ArgumentType.int128:\n s = \"int128\";\n break;\n case ArgumentType.uint136:\n s = \"uint136\";\n break;\n case ArgumentType.int136:\n s = \"int136\";\n break;\n case ArgumentType.uint144:\n s = \"uint144\";\n break;\n case ArgumentType.int144:\n s = \"int144\";\n break;\n case ArgumentType.uint152:\n s = \"uint152\";\n break;\n case ArgumentType.int152:\n s = \"int152\";\n break;\n case ArgumentType.uint160:\n s = \"uint160\";\n break;\n case ArgumentType.int160:\n s = \"int160\";\n break;\n case ArgumentType.uint168:\n s = \"uint168\";\n break;\n case ArgumentType.int168:\n s = \"int168\";\n break;\n case ArgumentType.uint176:\n s = \"uint176\";\n break;\n case ArgumentType.int176:\n s = \"int176\";\n break;\n case ArgumentType.uint184:\n s = \"uint184\";\n break;\n case ArgumentType.int184:\n s = \"int184\";\n break;\n case ArgumentType.uint192:\n s = \"uint192\";\n break;\n case ArgumentType.int192:\n s = \"int192\";\n break;\n case ArgumentType.uint200:\n s = \"uint200\";\n break;\n case ArgumentType.int200:\n s = \"int200\";\n break;\n case ArgumentType.uint208:\n s = \"uint208\";\n break;\n case ArgumentType.int208:\n s = \"int208\";\n break;\n case ArgumentType.uint216:\n s = \"uint216\";\n break;\n case ArgumentType.int216:\n s = \"int216\";\n break;\n case ArgumentType.uint224:\n s = \"uint224\";\n break;\n case ArgumentType.int224:\n s = \"int224\";\n break;\n case ArgumentType.uint232:\n s = \"uint232\";\n break;\n case ArgumentType.int232:\n s = \"int232\";\n break;\n case ArgumentType.uint240:\n s = \"uint240\";\n break;\n case ArgumentType.int240:\n s = \"int240\";\n break;\n case ArgumentType.uint248:\n s = \"uint248\";\n break;\n case ArgumentType.int248:\n s = \"int248\";\n break;\n case ArgumentType.uint256:\n s = \"uint256\";\n break;\n case ArgumentType.int256:\n s = \"int256\";\n break;\n case ArgumentType.string:\n s = \"string\";\n break;\n case ArgumentType.bool:\n s = \"bool\";\n break;\n case ArgumentType.bytes:\n s = \"bytes\";\n break;\n case ArgumentType.bytes32:\n s = \"bytes32\";\n break;\n case ArgumentType.address:\n s = \"address\";\n break;\n case ArgumentType.func:\n s = \"function\";\n break;\n default:\n s = \"\";\n break;\n }\n\n if (ty.array) {\n s += \"[]\";\n }\n\n return s;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractFunctionSelector.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +class TokenUpdateNftsTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {TokenId | string} [props.tokenId] + * @param {Long[]} [props.serialNumbers] + * @param {Uint8Array} [props.metadata] + */ + constructor(props = {}) { + super(); + + /** + * @private + * @type {?TokenId} + */ + this._tokenId = null; + + /** + * @private + * @type {?Long[]} + */ + this._serialNumbers = []; + + /** + * @private + * @type {?Uint8Array} + */ + this._metadata = null; + + if (props.tokenId != null) { + this.setTokenId(props.tokenId); + } + + if (props.serialNumbers != null) { + this.setSerialNumbers(props.serialNumbers); + } + + if (props.metadata != null) { + this.setMetadata(props.metadata); + } + } + + /** + * @internal + * @param {HashgraphProto.proto.ITransaction[]} transactions + * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {HashgraphProto.proto.ITransactionBody[]} bodies + * @returns {TokenUpdateNftsTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const tokenUpdate = + /** @type {HashgraphProto.proto.ITokenUpdateNftsTransactionBody} */ ( + body.tokenUpdate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new TokenUpdateNftsTransaction({ + tokenId: + tokenUpdate.token != null + ? TokenId_TokenId._fromProtobuf(tokenUpdate.token) + : undefined, + serialNumbers: + tokenUpdate.serialNumbers != null + ? tokenUpdate.serialNumbers + : [], + metadata: + tokenUpdate.metadata != null + ? tokenUpdate.metadata.value != null + ? tokenUpdate.metadata.value + : undefined + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @description Assign the token id. + * @param {TokenId | string} tokenId + * @returns {this} + */ + setTokenId(tokenId) { + this._requireNotFrozen(); + this._tokenId = + typeof tokenId === "string" + ? TokenId_TokenId.fromString(tokenId) + : tokenId.clone(); + + return this; + } + + /** + * @description Assign the list of serial numbers. + * @param {Long[]} serialNumbers + * @returns {this} + */ + setSerialNumbers(serialNumbers) { + this._requireNotFrozen(); + this._serialNumbers = serialNumbers; + + return this; + } + + /** + * @param {Uint8Array} metadata + * @returns {this} + */ + setMetadata(metadata) { + this._requireNotFrozen(); + this._metadata = metadata; + + return this; + } + + /** + * @param {Client} client + */ + _validateChecksums(client) { + if (this._tokenId != null) { + this._tokenId.validateChecksum(client); + } + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.token.pauseToken(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "tokenUpdateNfts"; + } + + /** + * @override + * @protected + * @returns {HashgraphProto.proto.ITokenUpdateNftsTransactionBody} + */ + _makeTransactionData() { + return { + token: this._tokenId != null ? this._tokenId._toProtobuf() : null, + serialNumbers: + this._serialNumbers != null ? this._serialNumbers : [], + ...(this._metadata != null + ? { + metadata: { + value: this._metadata, + }, + } + : null), + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `TokenUpdateNftsTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "tokenUpdateNfts", + // eslint-disable-next-line @typescript-eslint/unbound-method + TokenUpdateNftsTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/node/ServiceEndpoint.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractId.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractId.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.IServiceEndpoint} IServiceEndpoint + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractId; }\n/* harmony export */ });\n/* harmony import */ var _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../EntityIdHelper.js */ \"./node_modules/@hashgraph/sdk/src/EntityIdHelper.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * The ID for a crypto-currency contract on Hedera.\n */\nclass ContractId extends _Key_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n * @param {Uint8Array=} evmAddress\n */\n constructor(props, realm, num, evmAddress) {\n super();\n\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n\n this.evmAddress = evmAddress != null ? evmAddress : null;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @param {string} evmAddress\n * @returns {ContractId}\n */\n static fromEvmAddress(shard, realm, evmAddress) {\n return new ContractId(shard, realm, 0, _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(evmAddress));\n }\n\n /**\n * @param {string} text\n * @returns {ContractId}\n */\n static fromString(text) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromStringSplitter(text);\n\n if (Number.isNaN(result.shard) || Number.isNaN(result.realm)) {\n throw new Error(\"invalid format for entity ID\");\n }\n\n const shard =\n result.shard != null ? long__WEBPACK_IMPORTED_MODULE_5__.fromString(result.shard) : long__WEBPACK_IMPORTED_MODULE_5__.ZERO;\n const realm =\n result.realm != null ? long__WEBPACK_IMPORTED_MODULE_5__.fromString(result.realm) : long__WEBPACK_IMPORTED_MODULE_5__.ZERO;\n const [num, evmAddress] =\n result.numOrHex.length < 40\n ? [long__WEBPACK_IMPORTED_MODULE_5__.fromString(result.numOrHex), undefined]\n : [long__WEBPACK_IMPORTED_MODULE_5__.ZERO, _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.decode(result.numOrHex)];\n\n return new ContractId(shard, realm, num, evmAddress);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IContractID} id\n * @returns {ContractId}\n */\n static _fromProtobuf(id) {\n const contractId = new ContractId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.contractNum != null ? id.contractNum : 0\n );\n\n return contractId;\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ContractId}\n */\n static fromBytes(bytes) {\n return ContractId._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.ContractID.decode(bytes)\n );\n }\n\n /**\n * @param {string} address\n * @returns {ContractId}\n */\n static fromSolidityAddress(address) {\n const [shard, realm, contract] = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromSolidityAddress(address);\n return new ContractId(shard, realm, contract);\n }\n\n /**\n * @returns {string}\n */\n toSolidityAddress() {\n if (this.evmAddress != null) {\n return _encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(this.evmAddress);\n } else {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toSolidityAddress([\n this.shard,\n this.realm,\n this.num,\n ]);\n }\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IContractID}\n */\n _toProtobuf() {\n return {\n contractNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n evmAddress: this.evmAddress,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n if (this.evmAddress != null) {\n return `${this.shard.toString()}.${this.realm.toString()}.${_encoding_hex_js__WEBPACK_IMPORTED_MODULE_4__.encode(\n this.evmAddress\n )}`;\n } else {\n return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`;\n }\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.ContractID.encode(\n this._toProtobuf()\n ).finish();\n }\n\n /**\n * @returns {ContractId}\n */\n clone() {\n const id = new ContractId(this);\n id._checksum = this._checksum;\n id.evmAddress = this.evmAddress;\n return id;\n }\n\n /**\n * @param {ContractId} other\n * @returns {number}\n */\n compare(other) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.compare(\n [this.shard, this.realm, this.num],\n [other.shard, other.realm, other.num]\n );\n }\n\n /**\n * @returns {HashgraphProto.proto.IKey}\n */\n _toProtobufKey() {\n return {\n contractID: this._toProtobuf(),\n };\n }\n\n /**\n * @param {HashgraphProto.proto.IContractID} key\n * @returns {ContractId}\n */\n static __fromProtobufKey(key) {\n return ContractId._fromProtobuf(key);\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setContractId((key) => ContractId.__fromProtobufKey(key));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractId.js?"); +class ServiceEndpoint { + /** + * @param {object} [props] + * @param {?Uint8Array} [props.ipAddressV4] + * @param {?number} [props.port] + * @param {?string} [props.domainName] + */ + constructor(props) { + /** + * @type {?Uint8Array} + * @description The 4-byte IPv4 address of the endpoint + * encoded in left to right order + * (e.g. 127.0.0.1 has bytes [127, 0, 0, 1]). + */ + this._ipAddressV4 = + props?.ipAddressV4 != null ? props.ipAddressV4 : null; + + /** + * @type {?number} + * @description The port of the service endpoint. It's required. + */ + this._port = props?.port != null ? props.port : null; + + /** + * @type {?string} + * @description A node domain name. This MUST be the + * fully qualified domain(DNS) name of the node. This + * value MUST NOT be more than 253 characters. + * domain_name and ipAddressV4 are mutually exclusive. + * When the `domain_name` field is set, the `ipAddressV4` + * field MUST NOT be set. When the `ipAddressV4` field + * is set, the `domain_name` field MUST NOT be set. + */ + this._domainName = props?.domainName != null ? props.domainName : null; + } + + /** + * @param {Uint8Array} ipAddressV4 + * @description Set 4-byte IPv4 address of the endpoint. + * @returns {ServiceEndpoint} + * + */ + setIpAddressV4(ipAddressV4) { + if (this._domainName != null) { + throw new Error( + "Cannot set IP address when domain name is already set.", + ); + } + this._ipAddressV4 = ipAddressV4; + return this; + } + + /** + * @description Get 4-byte IPv4 address of the endpoint. + * @returns {?Uint8Array} + * + */ + get getIpAddressV4() { + return this._ipAddressV4; + } + + /** + * @param {number} port + * @description Set port of the endpoint. + * @returns {ServiceEndpoint} + * + */ + setPort(port) { + this._port = port; + return this; + } + + /** + * @description Get port of the endpoint. + * @returns {?number} + * + */ + get getPort() { + return this._port; + } + + /** + * @param {string} domainName + * @description Set domain name of the endpoint. + * @returns {ServiceEndpoint} + * + */ + setDomainName(domainName) { + if (this._ipAddressV4 != null) { + throw new Error( + "Cannot set domain name when IP address is already set.", + ); + } + this._domainName = domainName; + return this; + } + + /** + * @description Get domain name of the endpoint. + * @returns {?string} + * + */ + get getDomainName() { + return this._domainName; + } + + /** + * @internal + * @param {IServiceEndpoint} serviceEndpoint + * @returns {ServiceEndpoint} + */ + static _fromProtobuf(serviceEndpoint) { + return new ServiceEndpoint({ + ipAddressV4: + serviceEndpoint.ipAddressV4 != null + ? serviceEndpoint.ipAddressV4 + : undefined, + port: + serviceEndpoint.port != null ? serviceEndpoint.port : undefined, + domainName: + serviceEndpoint.domainName != null + ? serviceEndpoint.domainName + : undefined, + }); + } + + /** + * @internal + * @returns {IServiceEndpoint} + */ + _toProtobuf() { + return { + ipAddressV4: this._ipAddressV4, + port: this._port, + domainName: this._domainName, + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/node/NodeCreateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractInfo.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractInfo.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractInfo; }\n/* harmony export */ });\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _StakingInfo_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../StakingInfo.js */ \"./node_modules/@hashgraph/sdk/src/StakingInfo.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _account_TokenRelationshipMap_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../account/TokenRelationshipMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenRelationshipMap.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst { proto } = /*#__PURE__*/ (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_7___namespace_cache || (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_7___namespace_cache = __webpack_require__.t(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_7__, 2)));\n\n/**\n * @typedef {import(\"../StakingInfo.js\").StakingInfoJson} StakingInfoJson\n */\n\n/**\n * Response when the client sends the node CryptoGetInfoQuery.\n */\nclass ContractInfo {\n /**\n * @private\n * @param {object} props\n * @param {ContractId} props.contractId\n * @param {AccountId} props.accountId\n * @param {string} props.contractAccountId\n * @param {?Key} props.adminKey\n * @param {Timestamp} props.expirationTime\n * @param {Duration} props.autoRenewPeriod\n * @param {?AccountId} props.autoRenewAccountId\n * @param {Long} props.storage\n * @param {string} props.contractMemo\n * @param {Hbar} props.balance\n * @param {boolean} props.isDeleted\n * @param {TokenRelationshipMap} props.tokenRelationships\n * @param {LedgerId|null} props.ledgerId\n * @param {?StakingInfo} props.stakingInfo\n */\n constructor(props) {\n /**\n * ID of the contract instance, in the format used in transactions.\n *\n * @readonly\n */\n this.contractId = props.contractId;\n\n /**\n * ID of the cryptocurrency account owned by the contract instance,\n * in the format used in transactions.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * ID of both the contract instance and the cryptocurrency account owned by the contract\n * instance, in the format used by Solidity.\n *\n * @readonly\n */\n this.contractAccountId = props.contractAccountId;\n\n /**\n * The state of the instance and its fields can be modified arbitrarily if this key signs a\n * transaction to modify it. If this is null, then such modifications are not possible,\n * and there is no administrator that can override the normal operation of this smart\n * contract instance. Note that if it is created with no admin keys, then there is no\n * administrator to authorize changing the admin keys, so there can never be any admin keys\n * for that instance.\n *\n * @readonly\n */\n this.adminKey = props.adminKey != null ? props.adminKey : null;\n\n /**\n * The current time at which this contract instance (and its account) is set to expire.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * The expiration time will extend every this many seconds. If there are insufficient funds,\n * then it extends as long as possible. If the account is empty when it expires,\n * then it is deleted.\n *\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /**\n * ID of the an account to charge for auto-renewal of this contract. If not set, or set\n * to an account with zero hbar balance, the contract's own hbar balance will be used\n * to cover auto-renewal fees.\n *\n * @readonly\n */\n this.autoRenewAccountId = props.autoRenewAccountId;\n\n /**\n * Number of bytes of storage being used by this instance (which affects the cost to\n * extend the expiration time).\n *\n * @readonly\n */\n this.storage = props.storage;\n\n /**\n * The memo associated with the contract (max 100 bytes).\n *\n * @readonly\n */\n this.contractMemo = props.contractMemo;\n\n /**\n * The current balance of the contract.\n *\n * @readonly\n */\n this.balance = props.balance;\n\n /**\n * Whether the contract has been deleted\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * The tokens associated to the contract\n *\n * @readonly\n */\n this.tokenRelationships = props.tokenRelationships;\n\n /**\n * The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs.\n */\n this.ledgerId = props.ledgerId;\n\n /**\n * Staking metadata for this account.\n */\n this.stakingInfo = props.stakingInfo;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ContractGetInfoResponse.IContractInfo} info\n * @returns {ContractInfo}\n */\n static _fromProtobuf(info) {\n const autoRenewPeriod = /** @type {Long | number} */ (\n /** @type {HashgraphProto.proto.IDuration} */ (info.autoRenewPeriod)\n .seconds\n );\n\n return new ContractInfo({\n contractId: _ContractId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n info.contractID\n )\n ),\n accountId: _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (info.accountID)\n ),\n contractAccountId:\n info.contractAccountID != null ? info.contractAccountID : \"\",\n adminKey:\n info.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]._fromProtobufKey(info.adminKey)\n : null,\n expirationTime: _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.expirationTime\n )\n ),\n autoRenewPeriod: new _Duration_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](autoRenewPeriod),\n autoRenewAccountId:\n info.autoRenewAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.autoRenewAccountId)\n : null,\n storage:\n info.storage != null\n ? info.storage instanceof long__WEBPACK_IMPORTED_MODULE_6__\n ? info.storage\n : long__WEBPACK_IMPORTED_MODULE_6__.fromValue(info.storage)\n : long__WEBPACK_IMPORTED_MODULE_6__.ZERO,\n contractMemo: info.memo != null ? info.memo : \"\",\n balance: _Hbar_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].fromTinybars(info.balance != null ? info.balance : 0),\n isDeleted: /** @type {boolean} */ (info.deleted),\n tokenRelationships: _account_TokenRelationshipMap_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]._fromProtobuf(\n info.tokenRelationships != null ? info.tokenRelationships : []\n ),\n ledgerId:\n info.ledgerId != null\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"].fromBytes(info.ledgerId)\n : null,\n stakingInfo:\n info.stakingInfo != null\n ? _StakingInfo_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(info.stakingInfo)\n : null,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ContractGetInfoResponse.IContractInfo}\n */\n _toProtobuf() {\n return {\n contractID: this.contractId._toProtobuf(),\n accountID: this.accountId._toProtobuf(),\n contractAccountID: this.contractAccountId,\n adminKey:\n this.adminKey != null ? this.adminKey._toProtobufKey() : null,\n expirationTime: this.expirationTime._toProtobuf(),\n autoRenewPeriod:\n this.autoRenewPeriod != null\n ? this.autoRenewPeriod._toProtobuf()\n : null,\n autoRenewAccountId:\n this.autoRenewAccountId != null\n ? this.autoRenewAccountId._toProtobuf()\n : null,\n storage: this.storage,\n memo: this.contractMemo,\n balance: this.balance.toTinybars(),\n deleted: this.isDeleted,\n tokenRelationships:\n this.tokenRelationships != null\n ? this.tokenRelationships._toProtobuf()\n : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n stakingInfo:\n this.stakingInfo != null\n ? this.stakingInfo._toProtobuf()\n : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ContractInfo}\n */\n static fromBytes(bytes) {\n return ContractInfo._fromProtobuf(\n proto.ContractGetInfoResponse.ContractInfo.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return proto.ContractGetInfoResponse.ContractInfo.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractInfo.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractInfoQuery.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractInfoQuery.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _ContractInfo_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ContractInfo.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractInfo.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IContractGetInfoQuery} HashgraphProto.proto.IContractGetInfoQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IContractGetInfoResponse} HashgraphProto.proto.IContractGetInfoResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ContractGetInfoResponse.IContractInfo} HashgraphProto.proto.ContractGetInfoResponse.IContractInfo\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * @augments {Query}\n */\nclass ContractInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {ContractId | string} [props.contractId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?ContractId}\n * @private\n */\n this._contractId = null;\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {ContractInfoQuery}\n */\n static _fromProtobuf(query) {\n const info = /** @type {HashgraphProto.proto.IContractGetInfoQuery} */ (\n query.contractGetInfo\n );\n\n return new ContractInfoQuery({\n contractId:\n info.contractID != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.contractID)\n : undefined,\n });\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Set the contract ID for which the info is being requested.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractInfoQuery}\n */\n setContractId(contractId) {\n this._contractId =\n typeof contractId === \"string\"\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.getContractInfo(request);\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const contractGetInfo =\n /** @type {HashgraphProto.proto.IContractGetInfoResponse} */ (\n response.contractGetInfo\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n contractGetInfo.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const info =\n /** @type {HashgraphProto.proto.IContractGetInfoResponse} */ (\n response.contractGetInfo\n );\n\n return Promise.resolve(\n _ContractInfo_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ContractGetInfoResponse.IContractInfo} */ (\n info.contractInfo\n )\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n contractGetInfo: {\n header,\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `ContractInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"contractGetInfo\", ContractInfoQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractInfoQuery.js?"); +const DESCRIPTION_MAX_LENGTH = 100; +const GOSSIP_ENDPOINTS_MAX_LENGTH = 10; +const SERVICE_ENDPOINTS_MAX_LENGTH = 8; -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} ITransaction + * @typedef {import("@hashgraph/proto").proto.ITransaction} ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} ITransactionResponse + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractLogInfo.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractLogInfo.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace com.hedera.hapi.node.addressbook + * @typedef {import("@hashgraph/proto").com.hedera.hapi.node.addressbook.INodeCreateTransactionBody} INodeCreateTransactionBody + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractLogInfo; }\n/* harmony export */ });\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IContractLoginfo} HashgraphProto.proto.IContractLoginfo\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n */\n\n/**\n * The log information for an event returned by a smart contract function call. One function call\n * may return several such events.\n */\nclass ContractLogInfo {\n /**\n * @param {object} props\n * @param {ContractId} props.contractId\n * @param {Uint8Array} props.bloom\n * @param {Uint8Array[]} props.topics\n * @param {Uint8Array} props.data\n */\n constructor(props) {\n /**\n * Address of a contract that emitted the event.\n *\n * @readonly\n */\n this.contractId = props.contractId;\n\n /**\n * Bloom filter for a particular log.\n *\n * @readonly\n */\n this.bloom = props.bloom;\n\n /**\n * Topics of a particular event.\n *\n * @readonly\n */\n this.topics = props.topics;\n\n /**\n * Event data.\n *\n * @readonly\n */\n this.data = props.data;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IContractLoginfo} info\n * @returns {ContractLogInfo}\n */\n static _fromProtobuf(info) {\n return new ContractLogInfo({\n contractId: _ContractId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n info.contractID\n )\n ),\n bloom: info.bloom != null ? info.bloom : new Uint8Array(),\n topics: info.topic != null ? info.topic : [],\n data: info.data != null ? info.data : new Uint8Array(),\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IContractLoginfo}\n */\n _toProtobuf() {\n return {\n contractID: this.contractId._toProtobuf(),\n bloom: this.bloom,\n topic: this.topics,\n data: this.data,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractLogInfo.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../client/Client.js").default<*, *>} Client + */ -/***/ }), +/** + * A transaction to create a new consensus node in the network. + */ +class NodeCreateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {AccountId} [props.accountId] + * @param {?string} [props.description] + * @param {Array} [props.gossipEndpoints] + * @param {?Array} [props.serviceEndpoints] + * @param {Uint8Array} [props.gossipCaCertificate] + * @param {Uint8Array} [props.grpcCertificateHash] + * @param {Key} [props.adminKey] + */ + constructor(props) { + super(); + + /** + * @private + * @type {?AccountId} + * @description Node account identifier. It's required. + */ + this._accountId = props?.accountId != null ? props.accountId : null; + + /** + * @private + * @type {?string} + * @description Short description of the node. + */ + this._description = + props?.description != null ? props.description : null; + + /** + * @private + * @type {?Array} + * @description List of service endpoints for gossip. It's required. + */ + this._gossipEndpoints = + props?.gossipEndpoints != null ? props.gossipEndpoints : null; + + /** + * @private + * @type {?Array} + * @description List of service endpoints for gRPC calls. + */ + this._serviceEndpoints = + props?.serviceEndpoints != null ? props.serviceEndpoints : null; + + /** + * @private + * @type {?Uint8Array} + * @description Certificate used to sign gossip events. It's required. + */ + this._gossipCaCertificate = + props?.gossipCaCertificate != null + ? props.gossipCaCertificate + : null; + + /** + * @private + * @type {?Uint8Array} + * @description Hash of the node gRPC TLS certificate. + */ + this._grpcCertificateHash = + props?.grpcCertificateHash != null + ? props.grpcCertificateHash + : null; + + /** + * @private + * @type {?Key} + * @description Administrative key controlled by the node operator. It's required. + */ + this._adminKey = props?.adminKey != null ? props.adminKey : null; + } + + /** + * @internal + * @param {ITransaction[]} transactions + * @param {ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {ITransactionBody[]} bodies + * @returns {NodeCreateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const nodeCreate = /** @type {INodeCreateTransactionBody} */ ( + body.nodeCreate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new NodeCreateTransaction({ + accountId: + nodeCreate.accountId != null + ? AccountId_AccountId._fromProtobuf(nodeCreate.accountId) + : undefined, + description: + nodeCreate.description != null + ? nodeCreate.description + : undefined, + gossipEndpoints: + nodeCreate.gossipEndpoint != null + ? nodeCreate.gossipEndpoint.map((endpoint) => + ServiceEndpoint._fromProtobuf(endpoint), + ) + : undefined, + serviceEndpoints: + nodeCreate.serviceEndpoint != null + ? nodeCreate.serviceEndpoint.map((endpoint) => + ServiceEndpoint._fromProtobuf(endpoint), + ) + : undefined, + gossipCaCertificate: + nodeCreate.gossipCaCertificate != null + ? nodeCreate.gossipCaCertificate + : undefined, + grpcCertificateHash: + nodeCreate.grpcCertificateHash != null + ? nodeCreate.grpcCertificateHash + : undefined, + adminKey: + nodeCreate.adminKey != null + ? src_Key_Key._fromProtobufKey(nodeCreate.adminKey) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @param {AccountId | string} accountId + * @description Set node account identifier. + * @returns {NodeCreateTransaction} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + accountId instanceof AccountId_AccountId + ? accountId + : AccountId_AccountId.fromString(accountId); + + return this; + } + + /** + * @description Get node account identifier. + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {string} description + * @description Set description of the node. + * @returns {NodeCreateTransaction} + */ + setDescription(description) { + this._requireNotFrozen(); + if (description.length > DESCRIPTION_MAX_LENGTH) { + throw new Error( + `Description must be at most ${DESCRIPTION_MAX_LENGTH} characters.`, + ); + } + this._description = description; + + return this; + } + + /** + * @description Get description of the node. + * @returns {?string} + */ + get description() { + return this._description; + } + + /** + * @param {ServiceEndpoint[]} gossipEndpoints + * @description Set list of service endpoints for gossip. + * @returns {NodeCreateTransaction} + */ + setGossipEndpoints(gossipEndpoints) { + this._requireNotFrozen(); + if (gossipEndpoints.length == 0) { + throw new Error("GossipEndpoints list must not be empty."); + } + + if (gossipEndpoints.length > GOSSIP_ENDPOINTS_MAX_LENGTH) { + throw new Error( + `GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`, + ); + } + + this._gossipEndpoints = [...gossipEndpoints]; + + return this; + } + + /** + * @description Get list of service endpoints for gossip. + * @returns {?Array} + */ + get gossipEndpoints() { + return this._gossipEndpoints; + } + + /** + * @param {ServiceEndpoint} endpoint + * @description Add an endpoint to the list of service endpoints for gossip. + * @returns {NodeCreateTransaction} + */ + addGossipEndpoint(endpoint) { + if (this._gossipEndpoints != null) { + this._gossipEndpoints.push(endpoint); + } + return this; + } + + /** + * @param {ServiceEndpoint[]} serviceEndpoints + * @description Set list of service endpoints for gRPC calls. + * @returns {NodeCreateTransaction} + */ + setServiceEndpoints(serviceEndpoints) { + this._requireNotFrozen(); + if (serviceEndpoints.length == 0) { + throw new Error("ServiceEndpoints list must not be empty."); + } + + if (serviceEndpoints.length > SERVICE_ENDPOINTS_MAX_LENGTH) { + throw new Error( + `ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH} entries.`, + ); + } + + this._serviceEndpoints = [...serviceEndpoints]; + + return this; + } + + /** + * @description Get list of service endpoints for gRPC calls. + * @returns {?Array} + */ + get serviceEndpoints() { + return this._serviceEndpoints; + } + + /** + * @param {ServiceEndpoint} endpoint + * @description Add an endpoint to the list of service endpoints for gRPC calls. + * @returns {NodeCreateTransaction} + */ + addServiceEndpoint(endpoint) { + if (this._serviceEndpoints != null) { + this._serviceEndpoints.push(endpoint); + } + return this; + } + + /** + * @param {Uint8Array} bytes + * @description Set certificate used to sign gossip events. + * @returns {NodeCreateTransaction} + */ + setGossipCaCertificate(bytes) { + this._requireNotFrozen(); + if (bytes.length == 0) { + throw new Error("GossipCaCertificate must not be empty."); + } + + this._gossipCaCertificate = bytes; + + return this; + } + + /** + * @description Get certificate used to sign gossip events. + * @returns {?Uint8Array} + */ + get gossipCaCertificate() { + return this._gossipCaCertificate; + } + + /** + * @param {Uint8Array} bytes + * @description Set hash of the node gRPC TLS certificate. + * @returns {NodeCreateTransaction} + */ + setCertificateHash(bytes) { + this._requireNotFrozen(); + this._grpcCertificateHash = bytes; + + return this; + } + + /** + * @description Get hash of the node gRPC TLS certificate. + * @returns {?Uint8Array} + */ + get certificateHash() { + return this._grpcCertificateHash; + } + + /** + * @param {Key} adminKey + * @description Set administrative key controlled by the node operator. + * @returns {NodeCreateTransaction} + */ + setAdminKey(adminKey) { + this._requireNotFrozen(); + this._adminKey = adminKey; + + return this; + } + + /** + * @description Get administrative key controlled by the node operator. + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.addressBook.createNode(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "nodeCreate"; + } + + /** + * @override + * @protected + * @returns {INodeCreateTransactionBody} + */ + _makeTransactionData() { + return { + accountId: + this._accountId != null ? this._accountId._toProtobuf() : null, + description: this._description != null ? this._description : null, + gossipEndpoint: + this._gossipEndpoints != null + ? this._gossipEndpoints.map( + (/** @type {ServiceEndpoint} */ endpoint) => + endpoint._toProtobuf(), + ) + : null, + serviceEndpoint: + this._serviceEndpoints != null + ? this._serviceEndpoints.map( + (/** @type {ServiceEndpoint} */ endpoint) => + endpoint._toProtobuf(), + ) + : null, + gossipCaCertificate: + this._gossipCaCertificate != null + ? this._gossipCaCertificate + : null, + grpcCertificateHash: + this._grpcCertificateHash != null + ? this._grpcCertificateHash + : null, + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `NodeCreateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "nodeCreate", + // eslint-disable-next-line @typescript-eslint/unbound-method + NodeCreateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/node/NodeDeleteTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/ContractUpdateTransaction.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/ContractUpdateTransaction.js ***! - \*******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ContractUpdateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractUpdateTransactionBody} HashgraphProto.proto.IContractUpdateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HashgraphProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\nclass ContractUpdateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n /**\n * @param {object} props\n * @param {ContractId | string} [props.contractId]\n * @param {FileId | string} [props.bytecodeFileId]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {Key} [props.adminKey]\n * @param {AccountId | string} [props.proxyAccountId]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {string} [props.contractMemo]\n * @param {number} [props.maxAutomaticTokenAssociations]\n * @param {AccountId | string} [props.stakedAccountId]\n * @param {Long | number} [props.stakedNodeId]\n * @param {boolean} [props.declineStakingReward]\n * @param {AccountId} [props.autoRenewAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._proxyAccountId = null;\n\n /**\n * @private\n * @type {?Duration}\n */\n this._autoRenewPeriod = null;\n\n /**\n * @private\n * @type {?FileId}\n */\n this._bytecodeFileId = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._contractMemo = null;\n\n /**\n * @private\n * @type {?number}\n */\n this._maxAutomaticTokenAssociations = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._stakedAccountId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._stakedNodeId = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._declineStakingReward = null;\n\n /**\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.proxyAccountId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setProxyAccountId(props.proxyAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.bytecodeFileId != null) {\n this.setBytecodeFileId(props.bytecodeFileId);\n }\n\n if (props.contractMemo != null) {\n this.setContractMemo(props.contractMemo);\n }\n\n if (props.maxAutomaticTokenAssociations != null) {\n this.setMaxAutomaticTokenAssociations(\n props.maxAutomaticTokenAssociations\n );\n }\n\n if (props.stakedAccountId != null) {\n this.setStakedAccountId(props.stakedAccountId);\n }\n\n if (props.stakedNodeId != null) {\n this.setStakedNodeId(props.stakedNodeId);\n }\n\n if (props.declineStakingReward != null) {\n this.setDeclineStakingReward(props.declineStakingReward);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {ContractUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const update =\n /** @type {HashgraphProto.proto.IContractUpdateTransactionBody} */ (\n body.contractUpdateInstance\n );\n\n let autoRenewPeriod = undefined;\n if (\n update.autoRenewPeriod != null &&\n update.autoRenewPeriod.seconds != null\n ) {\n autoRenewPeriod = update.autoRenewPeriod.seconds;\n }\n\n let contractMemo = undefined;\n if (update.memoWrapper != null && update.memoWrapper.value != null) {\n contractMemo = update.memoWrapper.value;\n }\n\n let maxAutomaticTokenAssociations = undefined;\n if (\n update.maxAutomaticTokenAssociations != null &&\n update.maxAutomaticTokenAssociations.value != null\n ) {\n maxAutomaticTokenAssociations =\n update.maxAutomaticTokenAssociations.value;\n }\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufTransactions(\n new ContractUpdateTransaction({\n contractId:\n update.contractID != null\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n update.contractID\n )\n )\n : undefined,\n bytecodeFileId:\n update.fileID != null\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IFileID} */ (\n update.fileID\n )\n )\n : undefined,\n expirationTime:\n update.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobuf(update.expirationTime)\n : undefined,\n adminKey:\n update.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobufKey(update.adminKey)\n : undefined,\n proxyAccountId:\n update.proxyAccountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n update.proxyAccountID\n )\n )\n : undefined,\n autoRenewPeriod,\n contractMemo,\n maxAutomaticTokenAssociations,\n stakedAccountId:\n update.stakedAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(update.stakedAccountId)\n : undefined,\n stakedNodeId:\n update.stakedNodeId != null\n ? update.stakedNodeId\n : undefined,\n declineStakingReward:\n update.declineReward != null &&\n Boolean(update.declineReward) == true,\n autoRenewAccountId:\n update.autoRenewAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(update.autoRenewAccountId)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Sets the contract ID which is being deleted in this transaction.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractUpdateTransaction}\n */\n setContractId(contractId) {\n this._requireNotFrozen();\n this._contractId =\n typeof contractId === \"string\"\n ? _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * Sets the contract ID which is being deleted in this transaction.\n *\n * @param {Timestamp | Date} expirationTime\n * @returns {ContractUpdateTransaction}\n */\n setExpirationTime(expirationTime) {\n this._requireNotFrozen();\n this._expirationTime =\n expirationTime instanceof _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]\n ? expirationTime\n : _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].fromDate(expirationTime);\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?AccountId}\n */\n get proxyAccountId() {\n return this._proxyAccountId;\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} proxyAccountId\n * @returns {this}\n */\n setProxyAccountId(proxyAccountId) {\n this._requireNotFrozen();\n this._proxyAccountId =\n typeof proxyAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(proxyAccountId)\n : proxyAccountId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?FileId}\n */\n get bytecodeFileId() {\n return this._bytecodeFileId;\n }\n\n /**\n * @param {FileId | string} bytecodeFileId\n * @returns {this}\n */\n setBytecodeFileId(bytecodeFileId) {\n console.warn(\"Deprecated: there is no replacement\");\n this._requireNotFrozen();\n this._bytecodeFileId =\n typeof bytecodeFileId === \"string\"\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(bytecodeFileId)\n : bytecodeFileId.clone();\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get contractMemo() {\n return this._contractMemo;\n }\n\n /**\n * @param {string} contractMemo\n * @returns {this}\n */\n setContractMemo(contractMemo) {\n this._requireNotFrozen();\n this._contractMemo = contractMemo;\n\n return this;\n }\n\n /**\n * @returns {this}\n */\n clearContractMemo() {\n this._requireNotFrozen();\n this._contractMemo = null;\n\n return this;\n }\n\n /**\n * @returns {number | null}\n */\n get maxAutomaticTokenAssociations() {\n return this._maxAutomaticTokenAssociations;\n }\n\n /**\n * @param {number} maxAutomaticTokenAssociations\n * @returns {this}\n */\n setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) {\n this._requireNotFrozen();\n this._maxAutomaticTokenAssociations = maxAutomaticTokenAssociations;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get stakedAccountId() {\n return this._stakedAccountId;\n }\n\n /**\n * @param {AccountId | string} stakedAccountId\n * @returns {this}\n */\n setStakedAccountId(stakedAccountId) {\n this._requireNotFrozen();\n this._stakedAccountId =\n typeof stakedAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(stakedAccountId)\n : stakedAccountId;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stakedNodeId() {\n return this._stakedNodeId;\n }\n\n /**\n * @param {Long | number} stakedNodeId\n * @returns {this}\n */\n setStakedNodeId(stakedNodeId) {\n this._requireNotFrozen();\n this._stakedNodeId = long__WEBPACK_IMPORTED_MODULE_7__.fromValue(stakedNodeId);\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get declineStakingRewards() {\n return this._declineStakingReward;\n }\n\n /**\n * @param {boolean} declineStakingReward\n * @returns {this}\n */\n setDeclineStakingReward(declineStakingReward) {\n this._requireNotFrozen();\n this._declineStakingReward = declineStakingReward;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew\n * account. Otherwise it updates the contract's auto-renew account to the referenced account.\n *\n * @param {string | AccountId} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n typeof autoRenewAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(autoRenewAccountId)\n : autoRenewAccountId;\n\n return this;\n }\n\n /**\n * @returns {this}\n */\n clearAutoRenewAccountId() {\n this._autoRenewAccountId = new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](0);\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n\n if (this._bytecodeFileId != null) {\n this._bytecodeFileId.validateChecksum(client);\n }\n\n if (this._proxyAccountId != null) {\n this._proxyAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.smartContract.updateContract(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"contractUpdateInstance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IContractUpdateTransactionBody}\n */\n _makeTransactionData() {\n return {\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n proxyAccountID:\n this._proxyAccountId != null\n ? this._proxyAccountId._toProtobuf()\n : null,\n autoRenewPeriod:\n this._autoRenewPeriod != null\n ? this._autoRenewPeriod._toProtobuf()\n : null,\n fileID: this._bytecodeFileId\n ? this._bytecodeFileId._toProtobuf()\n : null,\n memoWrapper:\n this._contractMemo != null\n ? {\n value: this._contractMemo,\n }\n : null,\n maxAutomaticTokenAssociations:\n this._maxAutomaticTokenAssociations != null\n ? {\n value: this._maxAutomaticTokenAssociations,\n }\n : null,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId._toProtobuf()\n : null,\n stakedNodeId: this.stakedNodeId,\n declineReward:\n this.declineStakingRewards != null\n ? { value: this.declineStakingRewards }\n : null,\n autoRenewAccountId:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__.TRANSACTION_REGISTRY.set(\n \"contractUpdateInstance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractUpdateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/ContractUpdateTransaction.js?"); -/***/ }), +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} ITransaction + * @typedef {import("@hashgraph/proto").proto.ITransaction} ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} ITransactionResponse + */ -/***/ "./node_modules/@hashgraph/sdk/src/contract/DelegateContractId.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/contract/DelegateContractId.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace com.hedera.hapi.node.addressbook + * @typedef {import("@hashgraph/proto").com.hedera.hapi.node.addressbook.INodeDeleteTransactionBody} INodeDeleteTransactionBody + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ DelegateContractId; }\n/* harmony export */ });\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/* harmony import */ var _ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace {proto}\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n */\n\n/**\n * @typedef {import(\"long\").Long} Long\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\nclass DelegateContractId extends _ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n * @param {Uint8Array=} evmAddress\n */\n constructor(props, realm, num, evmAddress) {\n super(props, realm, num, evmAddress);\n }\n\n /**\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @param {string} evmAddress\n * @returns {ContractId}\n */\n static fromEvmAddress(shard, realm, evmAddress) {\n return new DelegateContractId(shard, realm, 0, _encoding_hex_js__WEBPACK_IMPORTED_MODULE_2__.decode(evmAddress));\n }\n\n /**\n * @param {string} text\n * @returns {DelegateContractId}\n */\n static fromString(text) {\n return new DelegateContractId(_ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(text));\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IContractID} id\n * @returns {DelegateContractId}\n */\n static _fromProtobuf(id) {\n return new DelegateContractId(_ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(id));\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {DelegateContractId}\n */\n static fromBytes(bytes) {\n return new DelegateContractId(_ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromBytes(bytes));\n }\n\n /**\n * @param {string} address\n * @returns {DelegateContractId}\n */\n static fromSolidityAddress(address) {\n // eslint-disable-next-line deprecation/deprecation\n return new DelegateContractId(_ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromSolidityAddress(address));\n }\n\n /**\n * @returns {DelegateContractId}\n */\n clone() {\n const id = new DelegateContractId(this);\n id._checksum = this._checksum;\n return id;\n }\n\n /**\n * @returns {HashgraphProto.proto.IKey}\n */\n _toProtobufKey() {\n return {\n delegatableContractId: this._toProtobuf(),\n };\n }\n\n /**\n * @param {HashgraphProto.proto.IContractID} key\n * @returns {DelegateContractId}\n */\n static __fromProtobufKey(key) {\n return DelegateContractId._fromProtobuf(key);\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].setDelegateContractId((key) => DelegateContractId.__fromProtobufKey(key));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/contract/DelegateContractId.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../client/Client.js").default<*, *>} Client + * @typedef {import("../account/AccountId.js").default} AccountId + */ -/***/ }), +/** + * A transaction to delete a consensus node in the network. + */ +class NodeDeleteTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Long} [props.nodeId] + */ + constructor(props) { + super(); + + /** + * @private + * @type {?Long} + * @description Consensus node identifier in the network state. It's required. + */ + this._nodeId = props?.nodeId != null ? props.nodeId : null; + } + + /** + * @internal + * @param {ITransaction[]} transactions + * @param {ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {ITransactionBody[]} bodies + * @returns {NodeDeleteTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const nodeDelete = /** @type {INodeDeleteTransactionBody} */ ( + body.nodeDelete + ); + + return Transaction_Transaction._fromProtobufTransactions( + new NodeDeleteTransaction({ + nodeId: + nodeDelete.nodeId != null ? nodeDelete.nodeId : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @param {Long} nodeId + * @description Set consensus node identifier. + * @returns {NodeDeleteTransaction} + */ + setNodeId(nodeId) { + this._nodeId = nodeId; + + return this; + } + + /** + * @description Get consensus node identifier. + * @returns {?Long} + */ + get nodeId() { + return this._nodeId; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.addressBook.deleteNode(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "nodeDelete"; + } + + /** + * @override + * @protected + * @returns {INodeDeleteTransactionBody} + */ + _makeTransactionData() { + return { + nodeId: this._nodeId != null ? this._nodeId : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `NodeDeleteTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "nodeDelete", + // eslint-disable-next-line @typescript-eslint/unbound-method + NodeDeleteTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/node/NodeUpdateTransaction.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/cryptography/keccak.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/cryptography/keccak.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"keccak256\": function() { return /* binding */ keccak256; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n// Originally sourced from:\n// https://github.com/MaiaVictor/eth-lib/blob/da0971f5b09964d9c8449975fa87933f0c9fef35/src/hash.js\n// - added type declarations\n// - switched to es6 module syntax\n//\n// Disable linting for entire file because it's nearly all pure JS\n// eslint-disable\n\nconst HEX_CHARS = \"0123456789abcdef\".split(\"\");\nconst KECCAK_PADDING = [1, 256, 65536, 16777216];\nconst SHIFT = [0, 8, 16, 24];\nconst RC = [\n 1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0,\n 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0,\n 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905,\n 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0,\n 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648,\n 2147483649, 0, 2147516424, 2147483648,\n];\n\n/**\n * @typedef {object} KeccakT\n * @property {number[]} blocks\n * @property {number} blockCount\n * @property {number} outputBlocks\n * @property {number[]} s\n * @property {number} start\n * @property {number} block\n * @property {boolean} reset\n * @property {number=} lastByteIndex\n */\n\n/** @type {(bits: number) => KeccakT} */\nconst Keccak = (bits) => ({\n blocks: [],\n reset: true,\n block: 0,\n start: 0,\n blockCount: (1600 - (bits << 1)) >> 5,\n outputBlocks: bits >> 5,\n // @ts-ignore\n s: ((s) => [].concat(s, s, s, s, s))([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),\n});\n\n/** @type {(state: KeccakT, message: string | number[]) => string} */\n//NOSONAR\nconst update = (state, /** @type {string | number[]} */ message) => {\n var length = message.length,\n blocks = state.blocks,\n byteCount = state.blockCount << 2,\n blockCount = state.blockCount,\n outputBlocks = state.outputBlocks,\n s = state.s,\n index = 0,\n i,\n code;\n\n // update\n while (index < length) {\n if (state.reset) {\n state.reset = false;\n blocks[0] = state.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (typeof message !== \"string\") {\n for (i = state.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = state.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |=\n (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code =\n 0x10000 +\n (((code & 0x3ff) << 10) |\n (message.charCodeAt(++index) & 0x3ff)); //NOSONAR\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |=\n (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |=\n (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n state.lastByteIndex = i;\n if (i >= byteCount) {\n state.start = i - byteCount;\n state.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n state.reset = true;\n } else {\n state.start = i;\n }\n }\n\n // finalize\n i = state.lastByteIndex;\n // @ts-ignore\n blocks[i >> 2] |= KECCAK_PADDING[i & 3];\n if (state.lastByteIndex === byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n\n // toString\n var hex = \"\";\n var block;\n var j = 0;\n i = 0; //NOSONAR\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex +=\n HEX_CHARS[(block >> 4) & 0x0f] +\n HEX_CHARS[block & 0x0f] +\n HEX_CHARS[(block >> 12) & 0x0f] +\n HEX_CHARS[(block >> 8) & 0x0f] +\n HEX_CHARS[(block >> 20) & 0x0f] +\n HEX_CHARS[(block >> 16) & 0x0f] +\n HEX_CHARS[(block >> 28) & 0x0f] +\n HEX_CHARS[(block >> 24) & 0x0f];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0; //NOSONAR\n }\n }\n // @ts-ignore\n return \"0x\" + hex;\n};\n\n/** @type {(s: number[]) => void} */\nconst f = (s) => {\n var h,\n l,\n n,\n c0,\n c1,\n c2,\n c3,\n c4,\n c5,\n c6,\n c7,\n c8,\n c9,\n b0,\n b1,\n b2,\n b3,\n b4,\n b5,\n b6,\n b7,\n b8,\n b9,\n b10,\n b11,\n b12,\n b13,\n b14,\n b15,\n b16,\n b17,\n b18,\n b19,\n b20,\n b21,\n b22,\n b23,\n b24,\n b25,\n b26,\n b27,\n b28,\n b29,\n b30,\n b31,\n b32,\n b33,\n b34,\n b35,\n b36,\n b37,\n b38,\n b39,\n b40,\n b41,\n b42,\n b43,\n b44,\n b45,\n b46,\n b47,\n b48,\n b49;\n\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n};\n\nconst keccak = (/** @type {number} */ bits) => (/** @type {string} */ str) => {\n var msg;\n if (str.slice(0, 2) === \"0x\") {\n msg = [];\n for (var i = 2, l = str.length; i < l; i += 2)\n msg.push(parseInt(str.slice(i, i + 2), 16));\n } else {\n msg = str;\n }\n // @ts-ignore\n return update(Keccak(bits), msg);\n};\n\n/**\n * @type {(message: string) => string}\n */\nconst keccak256 = keccak(256);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/cryptography/keccak.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/cryptography/sha384.browser.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/cryptography/sha384.browser.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"digest\": function() { return /* binding */ digest; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @param {Uint8Array} data\n * @returns {Promise}\n */\nasync function digest(data) {\n // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest\n return new Uint8Array(await window.crypto.subtle.digest(\"SHA-384\", data));\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/cryptography/sha384.browser.js?"); -/***/ }), +const NodeUpdateTransaction_DESCRIPTION_MAX_LENGTH = 100; +const NodeUpdateTransaction_GOSSIP_ENDPOINTS_MAX_LENGTH = 10; +const NodeUpdateTransaction_SERVICE_ENDPOINTS_MAX_LENGTH = 8; -/***/ "./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @namespace proto + * @typedef {import("@hashgraph/proto").proto.ITransaction} ITransaction + * @typedef {import("@hashgraph/proto").proto.ITransaction} ISignedTransaction + * @typedef {import("@hashgraph/proto").proto.TransactionBody} TransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionBody} ITransactionBody + * @typedef {import("@hashgraph/proto").proto.ITransactionResponse} ITransactionResponse + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; },\n/* harmony export */ \"encode\": function() { return /* binding */ encode; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @type {string[]}\n */\nconst byteToHex = [];\n\nfor (let n = 0; n <= 0xff; n += 1) {\n byteToHex.push(n.toString(16).padStart(2, \"0\"));\n}\n\n/**\n * @param {Uint8Array} data\n * @returns {string}\n */\nfunction encode(data) {\n let string = \"\";\n\n for (const byte of data) {\n string += byteToHex[byte];\n }\n\n return string;\n}\n\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nfunction decode(text) {\n const str = text.startsWith(\"0x\") ? text.substring(2) : text;\n const result = str.match(/.{1,2}/gu);\n\n return new Uint8Array(\n (result == null ? [] : result).map((byte) => parseInt(byte, 16))\n );\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js?"); +/** + * @namespace com.hedera.hapi.node.addressbook + * @typedef {import("@hashgraph/proto").com.hedera.hapi.node.addressbook.INodeUpdateTransactionBody} INodeUpdateTransactionBody + */ -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../transaction/TransactionId.js").default} TransactionId + * @typedef {import("../client/Client.js").default<*, *>} Client + */ -/***/ "./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @description A transaction to update a consensus node in the network. + */ +class NodeUpdateTransaction extends Transaction_Transaction { + /** + * @param {object} [props] + * @param {Long} [props.nodeId] + * @param {AccountId} [props.accountId] + * @param {?string} [props.description] + * @param {Array} [props.gossipEndpoints] + * @param {?Array} [props.serviceEndpoints] + * @param {Uint8Array} [props.gossipCaCertificate] + * @param {Uint8Array} [props.grpcCertificateHash] + * @param {Key} [props.adminKey] + */ + constructor(props) { + super(); + + /** + * @private + * @type {?Long} + * @description A consensus node identifier in the network state. It's required. + */ + this._nodeId = props?.nodeId != null ? props.nodeId : null; + + /** + * @private + * @type {?AccountId} + * @description Desired new account identifier of the node. + */ + this._accountId = props?.accountId != null ? props.accountId : null; + + /** + * @private + * @type {?string} + * @description Short description of the node. If set, this value SHALL replace the previous value. + */ + this._description = + props?.description != null ? props.description : null; + + /** + * @private + * @type {?Array} + * @description List of service endpoints for gossip. + */ + this._gossipEndpoints = + props?.gossipEndpoints != null ? props.gossipEndpoints : null; + + /** + * @private + * @type {?Array} + * @description List of service endpoints for gRPC calls. + */ + this._serviceEndpoints = + props?.serviceEndpoints != null ? props.serviceEndpoints : null; + + /** + * @private + * @type {?Uint8Array} + * @description Certificate used to sign gossip events. + */ + this._gossipCaCertificate = + props?.gossipCaCertificate != null + ? props.gossipCaCertificate + : null; + + /** + * @private + * @type {?Uint8Array} + * @description Hash of the node gRPC TLS certificate. + */ + this._grpcCertificateHash = + props?.grpcCertificateHash != null + ? props.grpcCertificateHash + : null; + + /** + * @private + * @type {?Key} + * @description Administrative key controlled by the node operator. + */ + this._adminKey = props?.adminKey != null ? props.adminKey : null; + } + + /** + * @internal + * @param {ITransaction[]} transactions + * @param {ISignedTransaction[]} signedTransactions + * @param {TransactionId[]} transactionIds + * @param {AccountId[]} nodeIds + * @param {ITransactionBody[]} bodies + * @returns {NodeUpdateTransaction} + */ + static _fromProtobuf( + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ) { + const body = bodies[0]; + const nodeUpdate = /** @type {INodeUpdateTransactionBody} */ ( + body.nodeUpdate + ); + + return Transaction_Transaction._fromProtobufTransactions( + new NodeUpdateTransaction({ + nodeId: + nodeUpdate.nodeId != null ? nodeUpdate.nodeId : undefined, + accountId: + nodeUpdate.accountId != null + ? AccountId_AccountId._fromProtobuf(nodeUpdate.accountId) + : undefined, + description: + nodeUpdate.description != null + ? nodeUpdate.description.value != null + ? nodeUpdate.description.value + : undefined + : undefined, + gossipEndpoints: + nodeUpdate.gossipEndpoint != null + ? nodeUpdate.gossipEndpoint.map((endpoint) => + ServiceEndpoint._fromProtobuf(endpoint), + ) + : undefined, + serviceEndpoints: + nodeUpdate.serviceEndpoint != null + ? nodeUpdate.serviceEndpoint.map((endpoint) => + ServiceEndpoint._fromProtobuf(endpoint), + ) + : undefined, + gossipCaCertificate: + nodeUpdate.gossipCaCertificate != null + ? nodeUpdate.gossipCaCertificate.value != null + ? nodeUpdate.gossipCaCertificate.value + : undefined + : undefined, + grpcCertificateHash: + nodeUpdate.grpcCertificateHash != null + ? nodeUpdate.grpcCertificateHash.value != null + ? nodeUpdate.grpcCertificateHash.value + : undefined + : undefined, + adminKey: + nodeUpdate.adminKey != null + ? src_Key_Key._fromProtobufKey(nodeUpdate.adminKey) + : undefined, + }), + transactions, + signedTransactions, + transactionIds, + nodeIds, + bodies, + ); + } + + /** + * @param {Long} nodeId + * @description Set consensus node identifier in the network state. + * @returns {NodeUpdateTransaction} + */ + setNodeId(nodeId) { + this._requireNotFrozen(); + this._nodeId = nodeId; + + return this; + } + + /** + * @description Get consensus node identifier in the network state. + * @returns {?Long} + */ + get nodeId() { + return this._nodeId; + } + + /** + * @param {AccountId | string} accountId + * @description Set desired new account identifier of the node. + * @returns {NodeUpdateTransaction} + */ + setAccountId(accountId) { + this._requireNotFrozen(); + this._accountId = + accountId instanceof AccountId_AccountId + ? accountId + : AccountId_AccountId.fromString(accountId); + + return this; + } + + /** + * @description Get desired new account identifier of the node. + * @returns {?AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @param {string} description + * @description Set description of the node. + * @returns {NodeUpdateTransaction} + */ + setDescription(description) { + this._requireNotFrozen(); + if (description.length > NodeUpdateTransaction_DESCRIPTION_MAX_LENGTH) { + throw new Error( + `Description must be at most ${NodeUpdateTransaction_DESCRIPTION_MAX_LENGTH} characters.`, + ); + } + this._description = description; + + return this; + } + + /** + * @description Clear description of the node. + * @returns {void} + */ + clearDescription() { + this._description = ""; + } + + /** + * @description Get description of the node. + * @returns {?string} + */ + get description() { + return this._description; + } + + /** + * @param {ServiceEndpoint[]} gossipEndpoints + * @description Set list of service endpoints for gossip. + * @returns {NodeUpdateTransaction} + */ + setGossipEndpoints(gossipEndpoints) { + this._requireNotFrozen(); + if (gossipEndpoints.length == 0) { + throw new Error("GossipEndpoints list must not be empty."); + } + + if (gossipEndpoints.length > NodeUpdateTransaction_GOSSIP_ENDPOINTS_MAX_LENGTH) { + throw new Error( + `GossipEndpoints list must not contain more than ${NodeUpdateTransaction_GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`, + ); + } + + this._gossipEndpoints = [...gossipEndpoints]; + + return this; + } + + /** + * @description Get list of service endpoints for gossip. + * @returns {?Array} + */ + get gossipEndpoints() { + return this._gossipEndpoints; + } + + /** + * @param {ServiceEndpoint} endpoint + * @description Add an endpoint to the list of service endpoints for gossip. + * @returns {NodeUpdateTransaction} + */ + addGossipEndpoint(endpoint) { + this._requireNotFrozen(); + if (this._gossipEndpoints != null) { + this._gossipEndpoints.push(endpoint); + } + return this; + } + + /** + * @param {ServiceEndpoint[]} serviceEndpoints + * @description Set list of service endpoints for gRPC calls. + * @returns {NodeUpdateTransaction} + */ + setServiceEndpoints(serviceEndpoints) { + this._requireNotFrozen(); + if (serviceEndpoints.length == 0) { + throw new Error("ServiceEndpoints list must not be empty."); + } + + if (serviceEndpoints.length > NodeUpdateTransaction_SERVICE_ENDPOINTS_MAX_LENGTH) { + throw new Error( + `ServiceEndpoints list must not contain more than ${NodeUpdateTransaction_SERVICE_ENDPOINTS_MAX_LENGTH} entries.`, + ); + } + + this._serviceEndpoints = [...serviceEndpoints]; + + return this; + } + + /** + * @description Get list of service endpoints for gRPC calls. + * @returns {?Array} + */ + get serviceEndpoints() { + return this._serviceEndpoints; + } + + /** + * @param {ServiceEndpoint} endpoint + * @description Add an endpoint to the list of service endpoints for gRPC calls. + * @returns {NodeUpdateTransaction} + */ + addServiceEndpoint(endpoint) { + this._requireNotFrozen(); + if (this._serviceEndpoints != null) { + this._serviceEndpoints.push(endpoint); + } + return this; + } + + /** + * @param {Uint8Array} bytes + * @description Set certificate used to sign gossip events. + * @returns {NodeUpdateTransaction} + */ + setGossipCaCertificate(bytes) { + this._requireNotFrozen(); + if (bytes.length == 0) { + throw new Error("GossipCaCertificate must not be empty."); + } + + this._gossipCaCertificate = bytes; + + return this; + } + + /** + * @description Get certificate used to sign gossip events. + * @returns {?Uint8Array} + */ + get gossipCaCertificate() { + return this._gossipCaCertificate; + } + + /** + * @param {Uint8Array} bytes + * @description Set hash of the node gRPC TLS certificate. + * @returns {NodeUpdateTransaction} + */ + setCertificateHash(bytes) { + this._requireNotFrozen(); + this._grpcCertificateHash = bytes; + + return this; + } + + /** + * @description Get hash of the node gRPC TLS certificate. + * @returns {?Uint8Array} + */ + get certificateHash() { + return this._grpcCertificateHash; + } + + /** + * @param {Key} adminKey + * @description Set administrative key controlled by the node operator. + * @returns {NodeUpdateTransaction} + */ + setAdminKey(adminKey) { + this._requireNotFrozen(); + this._adminKey = adminKey; + + return this; + } + + /** + * @description Get administrative key controlled by the node operator. + * @returns {?Key} + */ + get adminKey() { + return this._adminKey; + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {ITransaction} request + * @returns {Promise} + */ + _execute(channel, request) { + return channel.addressBook.updateNode(request); + } + + /** + * @override + * @protected + * @returns {NonNullable} + */ + _getTransactionDataCase() { + return "nodeUpdate"; + } + + /** + * @override + * @protected + * @returns {INodeUpdateTransactionBody} + */ + _makeTransactionData() { + return { + accountId: + this._accountId != null ? this._accountId._toProtobuf() : null, + description: { + value: this._description != null ? this._description : null, + }, + gossipEndpoint: + this._gossipEndpoints != null + ? this._gossipEndpoints.map( + (/** @type {ServiceEndpoint} */ endpoint) => + endpoint._toProtobuf(), + ) + : null, + serviceEndpoint: + this._serviceEndpoints != null + ? this._serviceEndpoints.map( + (/** @type {ServiceEndpoint} */ endpoint) => + endpoint._toProtobuf(), + ) + : null, + gossipCaCertificate: { + value: + this._gossipCaCertificate != null + ? this._gossipCaCertificate + : null, + }, + grpcCertificateHash: { + value: + this._grpcCertificateHash != null + ? this._grpcCertificateHash + : null, + }, + adminKey: + this._adminKey != null ? this._adminKey._toProtobufKey() : null, + nodeId: this._nodeId != null ? this._nodeId : null, + }; + } + + /** + * @returns {string} + */ + _getLogId() { + const timestamp = /** @type {import("../Timestamp.js").default} */ ( + this._transactionIds.current.validStart + ); + return `NodeUpdateTransaction:${timestamp.toString()}`; + } +} + +TRANSACTION_REGISTRY.set( + "nodeUpdate", + // eslint-disable-next-line @typescript-eslint/unbound-method + NodeUpdateTransaction._fromProtobuf, +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/query/CostQuery.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"decode\": function() { return /* binding */ decode; },\n/* harmony export */ \"encode\": function() { return /* binding */ encode; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @param {Uint8Array} data\n * @returns {string}\n */\nfunction decode(data) {\n // eslint-disable-next-line node/no-unsupported-features/node-builtins\n return new TextDecoder().decode(data);\n}\n\n/**\n * @param {string} text\n * @returns {Uint8Array}\n */\nfunction encode(text) {\n // eslint-disable-next-line node/no-unsupported-features/node-builtins\n return new TextEncoder().encode(text);\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/exports.js": -/*!****************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/exports.js ***! - \****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AccountAllowanceAdjustTransaction\": function() { return /* reexport safe */ _account_AccountAllowanceAdjustTransaction_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]; },\n/* harmony export */ \"AccountAllowanceApproveTransaction\": function() { return /* reexport safe */ _account_AccountAllowanceApproveTransaction_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]; },\n/* harmony export */ \"AccountAllowanceDeleteTransaction\": function() { return /* reexport safe */ _account_AccountAllowanceDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]; },\n/* harmony export */ \"AccountBalance\": function() { return /* reexport safe */ _account_AccountBalance_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]; },\n/* harmony export */ \"AccountBalanceQuery\": function() { return /* reexport safe */ _account_AccountBalanceQuery_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]; },\n/* harmony export */ \"AccountCreateTransaction\": function() { return /* reexport safe */ _account_AccountCreateTransaction_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"]; },\n/* harmony export */ \"AccountDeleteTransaction\": function() { return /* reexport safe */ _account_AccountDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"]; },\n/* harmony export */ \"AccountId\": function() { return /* reexport safe */ _account_AccountId_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]; },\n/* harmony export */ \"AccountInfo\": function() { return /* reexport safe */ _account_AccountInfo_js__WEBPACK_IMPORTED_MODULE_15__[\"default\"]; },\n/* harmony export */ \"AccountInfoFlow\": function() { return /* reexport safe */ _account_AccountInfoFlow_js__WEBPACK_IMPORTED_MODULE_16__[\"default\"]; },\n/* harmony export */ \"AccountInfoQuery\": function() { return /* reexport safe */ _account_AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_17__[\"default\"]; },\n/* harmony export */ \"AccountRecordsQuery\": function() { return /* reexport safe */ _account_AccountRecordsQuery_js__WEBPACK_IMPORTED_MODULE_18__[\"default\"]; },\n/* harmony export */ \"AccountStakersQuery\": function() { return /* reexport safe */ _account_AccountStakersQuery_js__WEBPACK_IMPORTED_MODULE_19__[\"default\"]; },\n/* harmony export */ \"AccountUpdateTransaction\": function() { return /* reexport safe */ _account_AccountUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_20__[\"default\"]; },\n/* harmony export */ \"AddressBookQuery\": function() { return /* reexport safe */ _network_AddressBookQuery_js__WEBPACK_IMPORTED_MODULE_21__[\"default\"]; },\n/* harmony export */ \"AssessedCustomFee\": function() { return /* reexport safe */ _token_AssessedCustomFee_js__WEBPACK_IMPORTED_MODULE_22__[\"default\"]; },\n/* harmony export */ \"BadKeyError\": function() { return /* reexport safe */ _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_1__.BadKeyError; },\n/* harmony export */ \"BadMnemonicError\": function() { return /* reexport safe */ _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_1__.BadMnemonicError; },\n/* harmony export */ \"BadMnemonicReason\": function() { return /* reexport safe */ _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_1__.BadMnemonicReason; },\n/* harmony export */ \"Cache\": function() { return /* reexport safe */ _Cache_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]; },\n/* harmony export */ \"ContractByteCodeQuery\": function() { return /* reexport safe */ _contract_ContractByteCodeQuery_js__WEBPACK_IMPORTED_MODULE_23__[\"default\"]; },\n/* harmony export */ \"ContractCallQuery\": function() { return /* reexport safe */ _contract_ContractCallQuery_js__WEBPACK_IMPORTED_MODULE_24__[\"default\"]; },\n/* harmony export */ \"ContractCreateFlow\": function() { return /* reexport safe */ _contract_ContractCreateFlow_js__WEBPACK_IMPORTED_MODULE_25__[\"default\"]; },\n/* harmony export */ \"ContractCreateTransaction\": function() { return /* reexport safe */ _contract_ContractCreateTransaction_js__WEBPACK_IMPORTED_MODULE_26__[\"default\"]; },\n/* harmony export */ \"ContractDeleteTransaction\": function() { return /* reexport safe */ _contract_ContractDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_27__[\"default\"]; },\n/* harmony export */ \"ContractExecuteTransaction\": function() { return /* reexport safe */ _contract_ContractExecuteTransaction_js__WEBPACK_IMPORTED_MODULE_28__[\"default\"]; },\n/* harmony export */ \"ContractFunctionParameters\": function() { return /* reexport safe */ _contract_ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_29__[\"default\"]; },\n/* harmony export */ \"ContractFunctionResult\": function() { return /* reexport safe */ _contract_ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_30__[\"default\"]; },\n/* harmony export */ \"ContractFunctionSelector\": function() { return /* reexport safe */ _contract_ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_31__[\"default\"]; },\n/* harmony export */ \"ContractId\": function() { return /* reexport safe */ _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_32__[\"default\"]; },\n/* harmony export */ \"ContractInfo\": function() { return /* reexport safe */ _contract_ContractInfo_js__WEBPACK_IMPORTED_MODULE_33__[\"default\"]; },\n/* harmony export */ \"ContractInfoQuery\": function() { return /* reexport safe */ _contract_ContractInfoQuery_js__WEBPACK_IMPORTED_MODULE_34__[\"default\"]; },\n/* harmony export */ \"ContractLogInfo\": function() { return /* reexport safe */ _contract_ContractLogInfo_js__WEBPACK_IMPORTED_MODULE_35__[\"default\"]; },\n/* harmony export */ \"ContractUpdateTransaction\": function() { return /* reexport safe */ _contract_ContractUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_36__[\"default\"]; },\n/* harmony export */ \"CustomFee\": function() { return /* reexport safe */ _token_CustomFee_js__WEBPACK_IMPORTED_MODULE_37__[\"default\"]; },\n/* harmony export */ \"CustomFixedFee\": function() { return /* reexport safe */ _token_CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_38__[\"default\"]; },\n/* harmony export */ \"CustomFractionalFee\": function() { return /* reexport safe */ _token_CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_39__[\"default\"]; },\n/* harmony export */ \"CustomRoyaltyFee\": function() { return /* reexport safe */ _token_CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_40__[\"default\"]; },\n/* harmony export */ \"DelegateContractId\": function() { return /* reexport safe */ _contract_DelegateContractId_js__WEBPACK_IMPORTED_MODULE_41__[\"default\"]; },\n/* harmony export */ \"EthereumFlow\": function() { return /* reexport safe */ _EthereumFlow_js__WEBPACK_IMPORTED_MODULE_46__[\"default\"]; },\n/* harmony export */ \"EthereumTransaction\": function() { return /* reexport safe */ _EthereumTransaction_js__WEBPACK_IMPORTED_MODULE_42__[\"default\"]; },\n/* harmony export */ \"EthereumTransactionData\": function() { return /* reexport safe */ _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_45__[\"default\"]; },\n/* harmony export */ \"EthereumTransactionDataEip1559\": function() { return /* reexport safe */ _EthereumTransactionDataEip1559_js__WEBPACK_IMPORTED_MODULE_44__[\"default\"]; },\n/* harmony export */ \"EthereumTransactionDataLegacy\": function() { return /* reexport safe */ _EthereumTransactionDataLegacy_js__WEBPACK_IMPORTED_MODULE_43__[\"default\"]; },\n/* harmony export */ \"ExchangeRate\": function() { return /* reexport safe */ _ExchangeRate_js__WEBPACK_IMPORTED_MODULE_47__[\"default\"]; },\n/* harmony export */ \"ExchangeRates\": function() { return /* reexport safe */ _ExchangeRates_js__WEBPACK_IMPORTED_MODULE_48__[\"default\"]; },\n/* harmony export */ \"Executable\": function() { return /* reexport safe */ _Executable_js__WEBPACK_IMPORTED_MODULE_49__[\"default\"]; },\n/* harmony export */ \"FeeAssessmentMethod\": function() { return /* reexport safe */ _token_FeeAssessmentMethod_js__WEBPACK_IMPORTED_MODULE_50__[\"default\"]; },\n/* harmony export */ \"FeeComponents\": function() { return /* reexport safe */ _FeeComponents_js__WEBPACK_IMPORTED_MODULE_51__[\"default\"]; },\n/* harmony export */ \"FeeData\": function() { return /* reexport safe */ _FeeData_js__WEBPACK_IMPORTED_MODULE_52__[\"default\"]; },\n/* harmony export */ \"FeeDataType\": function() { return /* reexport safe */ _FeeDataType_js__WEBPACK_IMPORTED_MODULE_53__[\"default\"]; },\n/* harmony export */ \"FeeSchedule\": function() { return /* reexport safe */ _FeeSchedule_js__WEBPACK_IMPORTED_MODULE_54__[\"default\"]; },\n/* harmony export */ \"FeeSchedules\": function() { return /* reexport safe */ _FeeSchedules_js__WEBPACK_IMPORTED_MODULE_55__[\"default\"]; },\n/* harmony export */ \"FileAppendTransaction\": function() { return /* reexport safe */ _file_FileAppendTransaction_js__WEBPACK_IMPORTED_MODULE_56__[\"default\"]; },\n/* harmony export */ \"FileContentsQuery\": function() { return /* reexport safe */ _file_FileContentsQuery_js__WEBPACK_IMPORTED_MODULE_57__[\"default\"]; },\n/* harmony export */ \"FileCreateTransaction\": function() { return /* reexport safe */ _file_FileCreateTransaction_js__WEBPACK_IMPORTED_MODULE_58__[\"default\"]; },\n/* harmony export */ \"FileDeleteTransaction\": function() { return /* reexport safe */ _file_FileDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_59__[\"default\"]; },\n/* harmony export */ \"FileId\": function() { return /* reexport safe */ _file_FileId_js__WEBPACK_IMPORTED_MODULE_60__[\"default\"]; },\n/* harmony export */ \"FileInfo\": function() { return /* reexport safe */ _file_FileInfo_js__WEBPACK_IMPORTED_MODULE_61__[\"default\"]; },\n/* harmony export */ \"FileInfoQuery\": function() { return /* reexport safe */ _file_FileInfoQuery_js__WEBPACK_IMPORTED_MODULE_62__[\"default\"]; },\n/* harmony export */ \"FileUpdateTransaction\": function() { return /* reexport safe */ _file_FileUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_63__[\"default\"]; },\n/* harmony export */ \"FreezeTransaction\": function() { return /* reexport safe */ _system_FreezeTransaction_js__WEBPACK_IMPORTED_MODULE_64__[\"default\"]; },\n/* harmony export */ \"HEDERA_PATH\": function() { return /* reexport safe */ _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_1__.HEDERA_PATH; },\n/* harmony export */ \"Hbar\": function() { return /* reexport safe */ _Hbar_js__WEBPACK_IMPORTED_MODULE_65__[\"default\"]; },\n/* harmony export */ \"HbarAllowance\": function() { return /* reexport safe */ _account_HbarAllowance_js__WEBPACK_IMPORTED_MODULE_66__[\"default\"]; },\n/* harmony export */ \"HbarUnit\": function() { return /* reexport safe */ _HbarUnit_js__WEBPACK_IMPORTED_MODULE_67__[\"default\"]; },\n/* harmony export */ \"Key\": function() { return /* reexport safe */ _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]; },\n/* harmony export */ \"KeyList\": function() { return /* reexport safe */ _KeyList_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]; },\n/* harmony export */ \"LedgerId\": function() { return /* reexport safe */ _LedgerId_js__WEBPACK_IMPORTED_MODULE_143__[\"default\"]; },\n/* harmony export */ \"LiveHash\": function() { return /* reexport safe */ _account_LiveHash_js__WEBPACK_IMPORTED_MODULE_68__[\"default\"]; },\n/* harmony export */ \"LiveHashAddTransaction\": function() { return /* reexport safe */ _account_LiveHashAddTransaction_js__WEBPACK_IMPORTED_MODULE_69__[\"default\"]; },\n/* harmony export */ \"LiveHashDeleteTransaction\": function() { return /* reexport safe */ _account_LiveHashDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_70__[\"default\"]; },\n/* harmony export */ \"LiveHashQuery\": function() { return /* reexport safe */ _account_LiveHashQuery_js__WEBPACK_IMPORTED_MODULE_71__[\"default\"]; },\n/* harmony export */ \"Logger\": function() { return /* reexport default export from named module */ js_logger__WEBPACK_IMPORTED_MODULE_144__; },\n/* harmony export */ \"MaxQueryPaymentExceeded\": function() { return /* reexport safe */ _MaxQueryPaymentExceeded_js__WEBPACK_IMPORTED_MODULE_72__[\"default\"]; },\n/* harmony export */ \"Mnemonic\": function() { return /* reexport safe */ _Mnemonic_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]; },\n/* harmony export */ \"NetworkName\": function() { return /* binding */ NetworkName; },\n/* harmony export */ \"NetworkVersionInfo\": function() { return /* reexport safe */ _network_NetworkVersionInfo_js__WEBPACK_IMPORTED_MODULE_73__[\"default\"]; },\n/* harmony export */ \"NetworkVersionInfoQuery\": function() { return /* reexport safe */ _network_NetworkVersionInfoQuery_js__WEBPACK_IMPORTED_MODULE_74__[\"default\"]; },\n/* harmony export */ \"NftId\": function() { return /* reexport safe */ _token_NftId_js__WEBPACK_IMPORTED_MODULE_75__[\"default\"]; },\n/* harmony export */ \"PrecheckStatusError\": function() { return /* reexport safe */ _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_141__[\"default\"]; },\n/* harmony export */ \"PrivateKey\": function() { return /* reexport safe */ _PrivateKey_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]; },\n/* harmony export */ \"PrngTransaction\": function() { return /* reexport safe */ _PrngTransaction_js__WEBPACK_IMPORTED_MODULE_77__[\"default\"]; },\n/* harmony export */ \"Provider\": function() { return /* reexport safe */ _Provider_js__WEBPACK_IMPORTED_MODULE_76__[\"default\"]; },\n/* harmony export */ \"ProxyStaker\": function() { return /* reexport safe */ _account_ProxyStaker_js__WEBPACK_IMPORTED_MODULE_78__[\"default\"]; },\n/* harmony export */ \"PublicKey\": function() { return /* reexport safe */ _PublicKey_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; },\n/* harmony export */ \"Query\": function() { return /* reexport safe */ _query_Query_js__WEBPACK_IMPORTED_MODULE_79__[\"default\"]; },\n/* harmony export */ \"ReceiptStatusError\": function() { return /* reexport safe */ _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_142__[\"default\"]; },\n/* harmony export */ \"RequestType\": function() { return /* reexport safe */ _RequestType_js__WEBPACK_IMPORTED_MODULE_80__[\"default\"]; },\n/* harmony export */ \"SLIP44_ECDSA_ETH_PATH\": function() { return /* reexport safe */ _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_1__.SLIP44_ECDSA_ETH_PATH; },\n/* harmony export */ \"SLIP44_ECDSA_HEDERA_PATH\": function() { return /* reexport safe */ _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_1__.SLIP44_ECDSA_HEDERA_PATH; },\n/* harmony export */ \"ScheduleCreateTransaction\": function() { return /* reexport safe */ _schedule_ScheduleCreateTransaction_js__WEBPACK_IMPORTED_MODULE_81__[\"default\"]; },\n/* harmony export */ \"ScheduleDeleteTransaction\": function() { return /* reexport safe */ _schedule_ScheduleDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_82__[\"default\"]; },\n/* harmony export */ \"ScheduleId\": function() { return /* reexport safe */ _schedule_ScheduleId_js__WEBPACK_IMPORTED_MODULE_83__[\"default\"]; },\n/* harmony export */ \"ScheduleInfo\": function() { return /* reexport safe */ _schedule_ScheduleInfo_js__WEBPACK_IMPORTED_MODULE_84__[\"default\"]; },\n/* harmony export */ \"ScheduleInfoQuery\": function() { return /* reexport safe */ _schedule_ScheduleInfoQuery_js__WEBPACK_IMPORTED_MODULE_85__[\"default\"]; },\n/* harmony export */ \"ScheduleSignTransaction\": function() { return /* reexport safe */ _schedule_ScheduleSignTransaction_js__WEBPACK_IMPORTED_MODULE_86__[\"default\"]; },\n/* harmony export */ \"SemanticVersion\": function() { return /* reexport safe */ _network_SemanticVersion_js__WEBPACK_IMPORTED_MODULE_87__[\"default\"]; },\n/* harmony export */ \"Signer\": function() { return /* reexport safe */ _Signer_js__WEBPACK_IMPORTED_MODULE_88__[\"default\"]; },\n/* harmony export */ \"SignerSignature\": function() { return /* reexport safe */ _SignerSignature_js__WEBPACK_IMPORTED_MODULE_89__[\"default\"]; },\n/* harmony export */ \"Status\": function() { return /* reexport safe */ _Status_js__WEBPACK_IMPORTED_MODULE_90__[\"default\"]; },\n/* harmony export */ \"StatusError\": function() { return /* reexport safe */ _StatusError_js__WEBPACK_IMPORTED_MODULE_140__[\"default\"]; },\n/* harmony export */ \"SubscriptionHandle\": function() { return /* reexport safe */ _topic_SubscriptionHandle_js__WEBPACK_IMPORTED_MODULE_91__[\"default\"]; },\n/* harmony export */ \"SystemDeleteTransaction\": function() { return /* reexport safe */ _system_SystemDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_92__[\"default\"]; },\n/* harmony export */ \"SystemUndeleteTransaction\": function() { return /* reexport safe */ _system_SystemUndeleteTransaction_js__WEBPACK_IMPORTED_MODULE_93__[\"default\"]; },\n/* harmony export */ \"Timestamp\": function() { return /* reexport safe */ _Timestamp_js__WEBPACK_IMPORTED_MODULE_94__[\"default\"]; },\n/* harmony export */ \"TokenAllowance\": function() { return /* reexport safe */ _account_TokenAllowance_js__WEBPACK_IMPORTED_MODULE_95__[\"default\"]; },\n/* harmony export */ \"TokenAssociateTransaction\": function() { return /* reexport safe */ _token_TokenAssociateTransaction_js__WEBPACK_IMPORTED_MODULE_96__[\"default\"]; },\n/* harmony export */ \"TokenBurnTransaction\": function() { return /* reexport safe */ _token_TokenBurnTransaction_js__WEBPACK_IMPORTED_MODULE_97__[\"default\"]; },\n/* harmony export */ \"TokenCreateTransaction\": function() { return /* reexport safe */ _token_TokenCreateTransaction_js__WEBPACK_IMPORTED_MODULE_98__[\"default\"]; },\n/* harmony export */ \"TokenDeleteTransaction\": function() { return /* reexport safe */ _token_TokenDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_99__[\"default\"]; },\n/* harmony export */ \"TokenDissociateTransaction\": function() { return /* reexport safe */ _token_TokenDissociateTransaction_js__WEBPACK_IMPORTED_MODULE_100__[\"default\"]; },\n/* harmony export */ \"TokenFeeScheduleUpdateTransaction\": function() { return /* reexport safe */ _token_TokenFeeScheduleUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_101__[\"default\"]; },\n/* harmony export */ \"TokenFreezeTransaction\": function() { return /* reexport safe */ _token_TokenFreezeTransaction_js__WEBPACK_IMPORTED_MODULE_102__[\"default\"]; },\n/* harmony export */ \"TokenGrantKycTransaction\": function() { return /* reexport safe */ _token_TokenGrantKycTransaction_js__WEBPACK_IMPORTED_MODULE_103__[\"default\"]; },\n/* harmony export */ \"TokenId\": function() { return /* reexport safe */ _token_TokenId_js__WEBPACK_IMPORTED_MODULE_104__[\"default\"]; },\n/* harmony export */ \"TokenInfo\": function() { return /* reexport safe */ _token_TokenInfo_js__WEBPACK_IMPORTED_MODULE_105__[\"default\"]; },\n/* harmony export */ \"TokenInfoQuery\": function() { return /* reexport safe */ _token_TokenInfoQuery_js__WEBPACK_IMPORTED_MODULE_106__[\"default\"]; },\n/* harmony export */ \"TokenMintTransaction\": function() { return /* reexport safe */ _token_TokenMintTransaction_js__WEBPACK_IMPORTED_MODULE_107__[\"default\"]; },\n/* harmony export */ \"TokenNftAllowance\": function() { return /* reexport safe */ _account_TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_108__[\"default\"]; },\n/* harmony export */ \"TokenNftInfo\": function() { return /* reexport safe */ _token_TokenNftInfo_js__WEBPACK_IMPORTED_MODULE_109__[\"default\"]; },\n/* harmony export */ \"TokenNftInfoQuery\": function() { return /* reexport safe */ _token_TokenNftInfoQuery_js__WEBPACK_IMPORTED_MODULE_110__[\"default\"]; },\n/* harmony export */ \"TokenPauseTransaction\": function() { return /* reexport safe */ _token_TokenPauseTransaction_js__WEBPACK_IMPORTED_MODULE_111__[\"default\"]; },\n/* harmony export */ \"TokenRevokeKycTransaction\": function() { return /* reexport safe */ _token_TokenRevokeKycTransaction_js__WEBPACK_IMPORTED_MODULE_112__[\"default\"]; },\n/* harmony export */ \"TokenSupplyType\": function() { return /* reexport safe */ _token_TokenSupplyType_js__WEBPACK_IMPORTED_MODULE_113__[\"default\"]; },\n/* harmony export */ \"TokenType\": function() { return /* reexport safe */ _token_TokenType_js__WEBPACK_IMPORTED_MODULE_114__[\"default\"]; },\n/* harmony export */ \"TokenUnfreezeTransaction\": function() { return /* reexport safe */ _token_TokenUnfreezeTransaction_js__WEBPACK_IMPORTED_MODULE_115__[\"default\"]; },\n/* harmony export */ \"TokenUnpauseTransaction\": function() { return /* reexport safe */ _token_TokenUnpauseTransaction_js__WEBPACK_IMPORTED_MODULE_116__[\"default\"]; },\n/* harmony export */ \"TokenUpdateTransaction\": function() { return /* reexport safe */ _token_TokenUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_117__[\"default\"]; },\n/* harmony export */ \"TokenWipeTransaction\": function() { return /* reexport safe */ _token_TokenWipeTransaction_js__WEBPACK_IMPORTED_MODULE_118__[\"default\"]; },\n/* harmony export */ \"TopicCreateTransaction\": function() { return /* reexport safe */ _topic_TopicCreateTransaction_js__WEBPACK_IMPORTED_MODULE_119__[\"default\"]; },\n/* harmony export */ \"TopicDeleteTransaction\": function() { return /* reexport safe */ _topic_TopicDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_120__[\"default\"]; },\n/* harmony export */ \"TopicId\": function() { return /* reexport safe */ _topic_TopicId_js__WEBPACK_IMPORTED_MODULE_121__[\"default\"]; },\n/* harmony export */ \"TopicInfo\": function() { return /* reexport safe */ _topic_TopicInfo_js__WEBPACK_IMPORTED_MODULE_122__[\"default\"]; },\n/* harmony export */ \"TopicInfoQuery\": function() { return /* reexport safe */ _topic_TopicInfoQuery_js__WEBPACK_IMPORTED_MODULE_123__[\"default\"]; },\n/* harmony export */ \"TopicMessage\": function() { return /* reexport safe */ _topic_TopicMessage_js__WEBPACK_IMPORTED_MODULE_124__[\"default\"]; },\n/* harmony export */ \"TopicMessageChunk\": function() { return /* reexport safe */ _topic_TopicMessageChunk_js__WEBPACK_IMPORTED_MODULE_125__[\"default\"]; },\n/* harmony export */ \"TopicMessageQuery\": function() { return /* reexport safe */ _topic_TopicMessageQuery_js__WEBPACK_IMPORTED_MODULE_126__[\"default\"]; },\n/* harmony export */ \"TopicMessageSubmitTransaction\": function() { return /* reexport safe */ _topic_TopicMessageSubmitTransaction_js__WEBPACK_IMPORTED_MODULE_127__[\"default\"]; },\n/* harmony export */ \"TopicUpdateTransaction\": function() { return /* reexport safe */ _topic_TopicUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_128__[\"default\"]; },\n/* harmony export */ \"Transaction\": function() { return /* reexport safe */ _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_129__[\"default\"]; },\n/* harmony export */ \"TransactionFeeSchedule\": function() { return /* reexport safe */ _TransactionFeeSchedule_js__WEBPACK_IMPORTED_MODULE_130__[\"default\"]; },\n/* harmony export */ \"TransactionId\": function() { return /* reexport safe */ _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_131__[\"default\"]; },\n/* harmony export */ \"TransactionReceipt\": function() { return /* reexport safe */ _transaction_TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_132__[\"default\"]; },\n/* harmony export */ \"TransactionReceiptQuery\": function() { return /* reexport safe */ _transaction_TransactionReceiptQuery_js__WEBPACK_IMPORTED_MODULE_133__[\"default\"]; },\n/* harmony export */ \"TransactionRecord\": function() { return /* reexport safe */ _transaction_TransactionRecord_js__WEBPACK_IMPORTED_MODULE_134__[\"default\"]; },\n/* harmony export */ \"TransactionRecordQuery\": function() { return /* reexport safe */ _transaction_TransactionRecordQuery_js__WEBPACK_IMPORTED_MODULE_135__[\"default\"]; },\n/* harmony export */ \"TransactionResponse\": function() { return /* reexport safe */ _transaction_TransactionResponse_js__WEBPACK_IMPORTED_MODULE_136__[\"default\"]; },\n/* harmony export */ \"Transfer\": function() { return /* reexport safe */ _Transfer_js__WEBPACK_IMPORTED_MODULE_137__[\"default\"]; },\n/* harmony export */ \"TransferTransaction\": function() { return /* reexport safe */ _account_TransferTransaction_js__WEBPACK_IMPORTED_MODULE_138__[\"default\"]; },\n/* harmony export */ \"Wallet\": function() { return /* reexport safe */ _Wallet_js__WEBPACK_IMPORTED_MODULE_139__[\"default\"]; }\n/* harmony export */ });\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/* harmony import */ var _hashgraph_cryptography__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/cryptography */ \"./node_modules/@hashgraph/cryptography/src/index.js\");\n/* harmony import */ var _PrivateKey_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PrivateKey.js */ \"./node_modules/@hashgraph/sdk/src/PrivateKey.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _Mnemonic_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Mnemonic.js */ \"./node_modules/@hashgraph/sdk/src/Mnemonic.js\");\n/* harmony import */ var _account_AccountAllowanceAdjustTransaction_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./account/AccountAllowanceAdjustTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountAllowanceAdjustTransaction.js\");\n/* harmony import */ var _account_AccountAllowanceApproveTransaction_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./account/AccountAllowanceApproveTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountAllowanceApproveTransaction.js\");\n/* harmony import */ var _account_AccountAllowanceDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./account/AccountAllowanceDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountAllowanceDeleteTransaction.js\");\n/* harmony import */ var _account_AccountBalance_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./account/AccountBalance.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountBalance.js\");\n/* harmony import */ var _account_AccountBalanceQuery_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./account/AccountBalanceQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountBalanceQuery.js\");\n/* harmony import */ var _account_AccountCreateTransaction_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./account/AccountCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountCreateTransaction.js\");\n/* harmony import */ var _account_AccountDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./account/AccountDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountDeleteTransaction.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _account_AccountInfo_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./account/AccountInfo.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountInfo.js\");\n/* harmony import */ var _account_AccountInfoFlow_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./account/AccountInfoFlow.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountInfoFlow.js\");\n/* harmony import */ var _account_AccountInfoQuery_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./account/AccountInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountInfoQuery.js\");\n/* harmony import */ var _account_AccountRecordsQuery_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./account/AccountRecordsQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountRecordsQuery.js\");\n/* harmony import */ var _account_AccountStakersQuery_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./account/AccountStakersQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountStakersQuery.js\");\n/* harmony import */ var _account_AccountUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./account/AccountUpdateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountUpdateTransaction.js\");\n/* harmony import */ var _network_AddressBookQuery_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./network/AddressBookQuery.js */ \"./node_modules/@hashgraph/sdk/src/network/AddressBookQuery.js\");\n/* harmony import */ var _token_AssessedCustomFee_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./token/AssessedCustomFee.js */ \"./node_modules/@hashgraph/sdk/src/token/AssessedCustomFee.js\");\n/* harmony import */ var _contract_ContractByteCodeQuery_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./contract/ContractByteCodeQuery.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractByteCodeQuery.js\");\n/* harmony import */ var _contract_ContractCallQuery_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./contract/ContractCallQuery.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractCallQuery.js\");\n/* harmony import */ var _contract_ContractCreateFlow_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./contract/ContractCreateFlow.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractCreateFlow.js\");\n/* harmony import */ var _contract_ContractCreateTransaction_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./contract/ContractCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractCreateTransaction.js\");\n/* harmony import */ var _contract_ContractDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./contract/ContractDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractDeleteTransaction.js\");\n/* harmony import */ var _contract_ContractExecuteTransaction_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./contract/ContractExecuteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractExecuteTransaction.js\");\n/* harmony import */ var _contract_ContractFunctionParameters_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./contract/ContractFunctionParameters.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionParameters.js\");\n/* harmony import */ var _contract_ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./contract/ContractFunctionResult.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionResult.js\");\n/* harmony import */ var _contract_ContractFunctionSelector_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./contract/ContractFunctionSelector.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionSelector.js\");\n/* harmony import */ var _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./contract/ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _contract_ContractInfo_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./contract/ContractInfo.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractInfo.js\");\n/* harmony import */ var _contract_ContractInfoQuery_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./contract/ContractInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractInfoQuery.js\");\n/* harmony import */ var _contract_ContractLogInfo_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./contract/ContractLogInfo.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractLogInfo.js\");\n/* harmony import */ var _contract_ContractUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./contract/ContractUpdateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractUpdateTransaction.js\");\n/* harmony import */ var _token_CustomFee_js__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./token/CustomFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFee.js\");\n/* harmony import */ var _token_CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./token/CustomFixedFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js\");\n/* harmony import */ var _token_CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./token/CustomFractionalFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js\");\n/* harmony import */ var _token_CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./token/CustomRoyaltyFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js\");\n/* harmony import */ var _contract_DelegateContractId_js__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./contract/DelegateContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/DelegateContractId.js\");\n/* harmony import */ var _EthereumTransaction_js__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./EthereumTransaction.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransaction.js\");\n/* harmony import */ var _EthereumTransactionDataLegacy_js__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./EthereumTransactionDataLegacy.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransactionDataLegacy.js\");\n/* harmony import */ var _EthereumTransactionDataEip1559_js__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./EthereumTransactionDataEip1559.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransactionDataEip1559.js\");\n/* harmony import */ var _EthereumTransactionData_js__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./EthereumTransactionData.js */ \"./node_modules/@hashgraph/sdk/src/EthereumTransactionData.js\");\n/* harmony import */ var _EthereumFlow_js__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./EthereumFlow.js */ \"./node_modules/@hashgraph/sdk/src/EthereumFlow.js\");\n/* harmony import */ var _ExchangeRate_js__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./ExchangeRate.js */ \"./node_modules/@hashgraph/sdk/src/ExchangeRate.js\");\n/* harmony import */ var _ExchangeRates_js__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./ExchangeRates.js */ \"./node_modules/@hashgraph/sdk/src/ExchangeRates.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var _token_FeeAssessmentMethod_js__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./token/FeeAssessmentMethod.js */ \"./node_modules/@hashgraph/sdk/src/token/FeeAssessmentMethod.js\");\n/* harmony import */ var _FeeComponents_js__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./FeeComponents.js */ \"./node_modules/@hashgraph/sdk/src/FeeComponents.js\");\n/* harmony import */ var _FeeData_js__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./FeeData.js */ \"./node_modules/@hashgraph/sdk/src/FeeData.js\");\n/* harmony import */ var _FeeDataType_js__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./FeeDataType.js */ \"./node_modules/@hashgraph/sdk/src/FeeDataType.js\");\n/* harmony import */ var _FeeSchedule_js__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./FeeSchedule.js */ \"./node_modules/@hashgraph/sdk/src/FeeSchedule.js\");\n/* harmony import */ var _FeeSchedules_js__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./FeeSchedules.js */ \"./node_modules/@hashgraph/sdk/src/FeeSchedules.js\");\n/* harmony import */ var _file_FileAppendTransaction_js__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./file/FileAppendTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileAppendTransaction.js\");\n/* harmony import */ var _file_FileContentsQuery_js__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./file/FileContentsQuery.js */ \"./node_modules/@hashgraph/sdk/src/file/FileContentsQuery.js\");\n/* harmony import */ var _file_FileCreateTransaction_js__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./file/FileCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileCreateTransaction.js\");\n/* harmony import */ var _file_FileDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./file/FileDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileDeleteTransaction.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _file_FileInfo_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./file/FileInfo.js */ \"./node_modules/@hashgraph/sdk/src/file/FileInfo.js\");\n/* harmony import */ var _file_FileInfoQuery_js__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./file/FileInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/file/FileInfoQuery.js\");\n/* harmony import */ var _file_FileUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./file/FileUpdateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/file/FileUpdateTransaction.js\");\n/* harmony import */ var _system_FreezeTransaction_js__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./system/FreezeTransaction.js */ \"./node_modules/@hashgraph/sdk/src/system/FreezeTransaction.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _account_HbarAllowance_js__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./account/HbarAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/HbarAllowance.js\");\n/* harmony import */ var _HbarUnit_js__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./HbarUnit.js */ \"./node_modules/@hashgraph/sdk/src/HbarUnit.js\");\n/* harmony import */ var _account_LiveHash_js__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./account/LiveHash.js */ \"./node_modules/@hashgraph/sdk/src/account/LiveHash.js\");\n/* harmony import */ var _account_LiveHashAddTransaction_js__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./account/LiveHashAddTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/LiveHashAddTransaction.js\");\n/* harmony import */ var _account_LiveHashDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./account/LiveHashDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/LiveHashDeleteTransaction.js\");\n/* harmony import */ var _account_LiveHashQuery_js__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./account/LiveHashQuery.js */ \"./node_modules/@hashgraph/sdk/src/account/LiveHashQuery.js\");\n/* harmony import */ var _MaxQueryPaymentExceeded_js__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./MaxQueryPaymentExceeded.js */ \"./node_modules/@hashgraph/sdk/src/MaxQueryPaymentExceeded.js\");\n/* harmony import */ var _network_NetworkVersionInfo_js__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./network/NetworkVersionInfo.js */ \"./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfo.js\");\n/* harmony import */ var _network_NetworkVersionInfoQuery_js__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./network/NetworkVersionInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfoQuery.js\");\n/* harmony import */ var _token_NftId_js__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./token/NftId.js */ \"./node_modules/@hashgraph/sdk/src/token/NftId.js\");\n/* harmony import */ var _Provider_js__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./Provider.js */ \"./node_modules/@hashgraph/sdk/src/Provider.js\");\n/* harmony import */ var _PrngTransaction_js__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ./PrngTransaction.js */ \"./node_modules/@hashgraph/sdk/src/PrngTransaction.js\");\n/* harmony import */ var _account_ProxyStaker_js__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ./account/ProxyStaker.js */ \"./node_modules/@hashgraph/sdk/src/account/ProxyStaker.js\");\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ./query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _RequestType_js__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ./RequestType.js */ \"./node_modules/@hashgraph/sdk/src/RequestType.js\");\n/* harmony import */ var _schedule_ScheduleCreateTransaction_js__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ./schedule/ScheduleCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleCreateTransaction.js\");\n/* harmony import */ var _schedule_ScheduleDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ./schedule/ScheduleDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleDeleteTransaction.js\");\n/* harmony import */ var _schedule_ScheduleId_js__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ./schedule/ScheduleId.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js\");\n/* harmony import */ var _schedule_ScheduleInfo_js__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(/*! ./schedule/ScheduleInfo.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfo.js\");\n/* harmony import */ var _schedule_ScheduleInfoQuery_js__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(/*! ./schedule/ScheduleInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfoQuery.js\");\n/* harmony import */ var _schedule_ScheduleSignTransaction_js__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(/*! ./schedule/ScheduleSignTransaction.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleSignTransaction.js\");\n/* harmony import */ var _network_SemanticVersion_js__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(/*! ./network/SemanticVersion.js */ \"./node_modules/@hashgraph/sdk/src/network/SemanticVersion.js\");\n/* harmony import */ var _Signer_js__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(/*! ./Signer.js */ \"./node_modules/@hashgraph/sdk/src/Signer.js\");\n/* harmony import */ var _SignerSignature_js__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(/*! ./SignerSignature.js */ \"./node_modules/@hashgraph/sdk/src/SignerSignature.js\");\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(/*! ./Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/* harmony import */ var _topic_SubscriptionHandle_js__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(/*! ./topic/SubscriptionHandle.js */ \"./node_modules/@hashgraph/sdk/src/topic/SubscriptionHandle.js\");\n/* harmony import */ var _system_SystemDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(/*! ./system/SystemDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/system/SystemDeleteTransaction.js\");\n/* harmony import */ var _system_SystemUndeleteTransaction_js__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(/*! ./system/SystemUndeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/system/SystemUndeleteTransaction.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(/*! ./Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _account_TokenAllowance_js__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(/*! ./account/TokenAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenAllowance.js\");\n/* harmony import */ var _token_TokenAssociateTransaction_js__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(/*! ./token/TokenAssociateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenAssociateTransaction.js\");\n/* harmony import */ var _token_TokenBurnTransaction_js__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(/*! ./token/TokenBurnTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenBurnTransaction.js\");\n/* harmony import */ var _token_TokenCreateTransaction_js__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(/*! ./token/TokenCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenCreateTransaction.js\");\n/* harmony import */ var _token_TokenDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(/*! ./token/TokenDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenDeleteTransaction.js\");\n/* harmony import */ var _token_TokenDissociateTransaction_js__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(/*! ./token/TokenDissociateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenDissociateTransaction.js\");\n/* harmony import */ var _token_TokenFeeScheduleUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(/*! ./token/TokenFeeScheduleUpdateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenFeeScheduleUpdateTransaction.js\");\n/* harmony import */ var _token_TokenFreezeTransaction_js__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(/*! ./token/TokenFreezeTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenFreezeTransaction.js\");\n/* harmony import */ var _token_TokenGrantKycTransaction_js__WEBPACK_IMPORTED_MODULE_103__ = __webpack_require__(/*! ./token/TokenGrantKycTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenGrantKycTransaction.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_104__ = __webpack_require__(/*! ./token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _token_TokenInfo_js__WEBPACK_IMPORTED_MODULE_105__ = __webpack_require__(/*! ./token/TokenInfo.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenInfo.js\");\n/* harmony import */ var _token_TokenInfoQuery_js__WEBPACK_IMPORTED_MODULE_106__ = __webpack_require__(/*! ./token/TokenInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenInfoQuery.js\");\n/* harmony import */ var _token_TokenMintTransaction_js__WEBPACK_IMPORTED_MODULE_107__ = __webpack_require__(/*! ./token/TokenMintTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenMintTransaction.js\");\n/* harmony import */ var _account_TokenNftAllowance_js__WEBPACK_IMPORTED_MODULE_108__ = __webpack_require__(/*! ./account/TokenNftAllowance.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenNftAllowance.js\");\n/* harmony import */ var _token_TokenNftInfo_js__WEBPACK_IMPORTED_MODULE_109__ = __webpack_require__(/*! ./token/TokenNftInfo.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenNftInfo.js\");\n/* harmony import */ var _token_TokenNftInfoQuery_js__WEBPACK_IMPORTED_MODULE_110__ = __webpack_require__(/*! ./token/TokenNftInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenNftInfoQuery.js\");\n/* harmony import */ var _token_TokenPauseTransaction_js__WEBPACK_IMPORTED_MODULE_111__ = __webpack_require__(/*! ./token/TokenPauseTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenPauseTransaction.js\");\n/* harmony import */ var _token_TokenRevokeKycTransaction_js__WEBPACK_IMPORTED_MODULE_112__ = __webpack_require__(/*! ./token/TokenRevokeKycTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenRevokeKycTransaction.js\");\n/* harmony import */ var _token_TokenSupplyType_js__WEBPACK_IMPORTED_MODULE_113__ = __webpack_require__(/*! ./token/TokenSupplyType.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenSupplyType.js\");\n/* harmony import */ var _token_TokenType_js__WEBPACK_IMPORTED_MODULE_114__ = __webpack_require__(/*! ./token/TokenType.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenType.js\");\n/* harmony import */ var _token_TokenUnfreezeTransaction_js__WEBPACK_IMPORTED_MODULE_115__ = __webpack_require__(/*! ./token/TokenUnfreezeTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenUnfreezeTransaction.js\");\n/* harmony import */ var _token_TokenUnpauseTransaction_js__WEBPACK_IMPORTED_MODULE_116__ = __webpack_require__(/*! ./token/TokenUnpauseTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenUnpauseTransaction.js\");\n/* harmony import */ var _token_TokenUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_117__ = __webpack_require__(/*! ./token/TokenUpdateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenUpdateTransaction.js\");\n/* harmony import */ var _token_TokenWipeTransaction_js__WEBPACK_IMPORTED_MODULE_118__ = __webpack_require__(/*! ./token/TokenWipeTransaction.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenWipeTransaction.js\");\n/* harmony import */ var _topic_TopicCreateTransaction_js__WEBPACK_IMPORTED_MODULE_119__ = __webpack_require__(/*! ./topic/TopicCreateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicCreateTransaction.js\");\n/* harmony import */ var _topic_TopicDeleteTransaction_js__WEBPACK_IMPORTED_MODULE_120__ = __webpack_require__(/*! ./topic/TopicDeleteTransaction.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicDeleteTransaction.js\");\n/* harmony import */ var _topic_TopicId_js__WEBPACK_IMPORTED_MODULE_121__ = __webpack_require__(/*! ./topic/TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/* harmony import */ var _topic_TopicInfo_js__WEBPACK_IMPORTED_MODULE_122__ = __webpack_require__(/*! ./topic/TopicInfo.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicInfo.js\");\n/* harmony import */ var _topic_TopicInfoQuery_js__WEBPACK_IMPORTED_MODULE_123__ = __webpack_require__(/*! ./topic/TopicInfoQuery.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicInfoQuery.js\");\n/* harmony import */ var _topic_TopicMessage_js__WEBPACK_IMPORTED_MODULE_124__ = __webpack_require__(/*! ./topic/TopicMessage.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicMessage.js\");\n/* harmony import */ var _topic_TopicMessageChunk_js__WEBPACK_IMPORTED_MODULE_125__ = __webpack_require__(/*! ./topic/TopicMessageChunk.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicMessageChunk.js\");\n/* harmony import */ var _topic_TopicMessageQuery_js__WEBPACK_IMPORTED_MODULE_126__ = __webpack_require__(/*! ./topic/TopicMessageQuery.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicMessageQuery.js\");\n/* harmony import */ var _topic_TopicMessageSubmitTransaction_js__WEBPACK_IMPORTED_MODULE_127__ = __webpack_require__(/*! ./topic/TopicMessageSubmitTransaction.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicMessageSubmitTransaction.js\");\n/* harmony import */ var _topic_TopicUpdateTransaction_js__WEBPACK_IMPORTED_MODULE_128__ = __webpack_require__(/*! ./topic/TopicUpdateTransaction.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicUpdateTransaction.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_129__ = __webpack_require__(/*! ./transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _TransactionFeeSchedule_js__WEBPACK_IMPORTED_MODULE_130__ = __webpack_require__(/*! ./TransactionFeeSchedule.js */ \"./node_modules/@hashgraph/sdk/src/TransactionFeeSchedule.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_131__ = __webpack_require__(/*! ./transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _transaction_TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_132__ = __webpack_require__(/*! ./transaction/TransactionReceipt.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js\");\n/* harmony import */ var _transaction_TransactionReceiptQuery_js__WEBPACK_IMPORTED_MODULE_133__ = __webpack_require__(/*! ./transaction/TransactionReceiptQuery.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionReceiptQuery.js\");\n/* harmony import */ var _transaction_TransactionRecord_js__WEBPACK_IMPORTED_MODULE_134__ = __webpack_require__(/*! ./transaction/TransactionRecord.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionRecord.js\");\n/* harmony import */ var _transaction_TransactionRecordQuery_js__WEBPACK_IMPORTED_MODULE_135__ = __webpack_require__(/*! ./transaction/TransactionRecordQuery.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionRecordQuery.js\");\n/* harmony import */ var _transaction_TransactionResponse_js__WEBPACK_IMPORTED_MODULE_136__ = __webpack_require__(/*! ./transaction/TransactionResponse.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js\");\n/* harmony import */ var _Transfer_js__WEBPACK_IMPORTED_MODULE_137__ = __webpack_require__(/*! ./Transfer.js */ \"./node_modules/@hashgraph/sdk/src/Transfer.js\");\n/* harmony import */ var _account_TransferTransaction_js__WEBPACK_IMPORTED_MODULE_138__ = __webpack_require__(/*! ./account/TransferTransaction.js */ \"./node_modules/@hashgraph/sdk/src/account/TransferTransaction.js\");\n/* harmony import */ var _Wallet_js__WEBPACK_IMPORTED_MODULE_139__ = __webpack_require__(/*! ./Wallet.js */ \"./node_modules/@hashgraph/sdk/src/Wallet.js\");\n/* harmony import */ var _StatusError_js__WEBPACK_IMPORTED_MODULE_140__ = __webpack_require__(/*! ./StatusError.js */ \"./node_modules/@hashgraph/sdk/src/StatusError.js\");\n/* harmony import */ var _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_141__ = __webpack_require__(/*! ./PrecheckStatusError.js */ \"./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js\");\n/* harmony import */ var _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_142__ = __webpack_require__(/*! ./ReceiptStatusError.js */ \"./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_143__ = __webpack_require__(/*! ./LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_144__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/* harmony import */ var _query_CostQuery_js__WEBPACK_IMPORTED_MODULE_145__ = __webpack_require__(/*! ./query/CostQuery.js */ \"./node_modules/@hashgraph/sdk/src/query/CostQuery.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n// eslint-disable-next-line deprecation/deprecation\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./client/Client.js\").NetworkName} ClientNetworkName\n * @typedef {import(\"./Provider.js\").Provider} Provider\n * @typedef {import(\"./Signer.js\").Signer} Signer\n * @typedef {import(\"./account/AccountBalance.js\").AccountBalanceJson} AccountBalanceJson\n * @typedef {import(\"./account/AccountBalance.js\").TokenBalanceJson} TokenBalanceJson\n * @typedef {import(\"./transaction/TransactionResponse.js\").TransactionResponseJSON} TransactionResponseJSON\n */\n\n/**\n * @typedef {object} NetworkNameType\n * @property {ClientNetworkName} Mainnet\n * @property {ClientNetworkName} Testnet\n * @property {ClientNetworkName} Previewnet\n */\n/**\n * @type {NetworkNameType}\n */\nconst NetworkName = {\n Mainnet: \"mainnet\",\n Testnet: \"testnet\",\n Previewnet: \"previewnet\",\n};\n\n\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/exports.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/file/FileAppendTransaction.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileAppendTransaction.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileAppendTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/* harmony import */ var _FileId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _transaction_List_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transaction/List.js */ \"./node_modules/@hashgraph/sdk/src/transaction/List.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IFileAppendTransactionBody} HashgraphProto.proto.IFileAppendTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HashgraphProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"../schedule/ScheduleCreateTransaction.js\").default} ScheduleCreateTransaction\n */\n\n/**\n * A transaction specifically to append data to a file on the network.\n *\n * If a file has multiple keys, all keys must sign to modify its contents.\n */\nclass FileAppendTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.fileId]\n * @param {Uint8Array | string} [props.contents]\n * @param {number} [props.maxChunks]\n * @param {number} [props.chunkSize]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._fileId = null;\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._contents = null;\n\n /**\n * @private\n * @type {number}\n */\n this._maxChunks = 20;\n\n /**\n * @private\n * @type {number}\n */\n this._chunkSize = 4096;\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](5);\n\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n\n if (props.contents != null) {\n this.setContents(props.contents);\n }\n\n if (props.maxChunks != null) {\n this.setMaxChunks(props.maxChunks);\n }\n\n if (props.chunkSize != null) {\n this.setChunkSize(props.chunkSize);\n }\n\n /** @type {List} */\n this._transactionIds = new _transaction_List_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]();\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {FileAppendTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const append =\n /** @type {HashgraphProto.proto.IFileAppendTransactionBody} */ (\n body.fileAppend\n );\n\n let contents;\n for (let i = 0; i < bodies.length; i += nodeIds.length) {\n const fileAppend =\n /** @type {HashgraphProto.proto.IFileAppendTransactionBody} */ (\n bodies[i].fileAppend\n );\n if (fileAppend.contents == null) {\n break;\n }\n\n if (contents == null) {\n contents = new Uint8Array(\n /** @type {Uint8Array} */ (fileAppend.contents)\n );\n continue;\n }\n\n /** @type {Uint8Array} */\n const concat = new Uint8Array(\n contents.length +\n /** @type {Uint8Array} */ (fileAppend.contents).length\n );\n concat.set(contents, 0);\n concat.set(\n /** @type {Uint8Array} */ (fileAppend.contents),\n contents.length\n );\n contents = concat;\n }\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new FileAppendTransaction({\n fileId:\n append.fileID != null\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IFileID} */ (\n append.fileID\n )\n )\n : undefined,\n contents: contents,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * Set the keys which must sign any transactions modifying this file. Required.\n *\n * All keys must sign to modify the file's contents or keys. No key is required\n * to sign for extending the expiration time (except the one for the operator account\n * paying for the transaction). Only one key must sign to delete the file, however.\n *\n * To require more than one key to sign to delete a file, add them to a\n * KeyList and pass that here.\n *\n * The network currently requires a file to have at least one key (or key list or threshold key)\n * but this requirement may be lifted in the future.\n *\n * @param {FileId | string} fileId\n * @returns {this}\n */\n setFileId(fileId) {\n this._requireNotFrozen();\n this._fileId =\n typeof fileId === \"string\"\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(fileId)\n : fileId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get contents() {\n return this._contents;\n }\n\n /**\n * Set the given byte array as the file's contents.\n *\n * This may be omitted to append an empty file.\n *\n * Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the\n * network; if you exceed this you may receive a HederaPreCheckStatusException\n * with Status#TransactionOversize.\n *\n * In this case, you will need to break the data into chunks of less than ~6KiB and execute this\n * transaction with the first chunk and then use FileAppendTransaction with\n * FileAppendTransaction#setContents(Uint8Array) for the remaining chunks.\n *\n * @param {Uint8Array | string} contents\n * @returns {this}\n */\n setContents(contents) {\n this._requireNotFrozen();\n this._contents =\n contents instanceof Uint8Array ? contents : _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__.encode(contents);\n\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get maxChunks() {\n return this._maxChunks;\n }\n\n /**\n * @param {number} maxChunks\n * @returns {this}\n */\n setMaxChunks(maxChunks) {\n this._requireNotFrozen();\n this._maxChunks = maxChunks;\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get chunkSize() {\n return this._chunkSize;\n }\n\n /**\n * @param {number} chunkSize\n * @returns {this}\n */\n setChunkSize(chunkSize) {\n this._chunkSize = chunkSize;\n return this;\n }\n\n /**\n * Freeze this transaction from further modification to prepare for\n * signing or serialization.\n *\n * Will use the `Client`, if available, to generate a default Transaction ID and select 1/3\n * nodes to prepare this transaction for.\n *\n * @param {?import(\"../client/Client.js\").default} client\n * @returns {this}\n */\n freezeWith(client) {\n super.freezeWith(client);\n\n if (this._contents == null) {\n return this;\n }\n\n const chunks = Math.floor(\n (this._contents.length + (this._chunkSize - 1)) / this._chunkSize\n );\n\n if (chunks > this._maxChunks) {\n throw new Error(\n `Contents with size ${this._contents.length} too long for ${this._maxChunks} chunks`\n );\n }\n\n let nextTransactionId = this._getTransactionId();\n\n // Hack around the locked list. Should refactor a bit to remove such code\n this._transactionIds.locked = false;\n\n this._transactions.clear();\n this._transactionIds.clear();\n this._signedTransactions.clear();\n\n for (let chunk = 0; chunk < chunks; chunk++) {\n this._transactionIds.push(nextTransactionId);\n this._transactionIds.advance();\n\n for (const nodeAccountId of this._nodeAccountIds.list) {\n this._signedTransactions.push(\n this._makeSignedTransaction(nodeAccountId)\n );\n }\n\n nextTransactionId = new _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](\n /** @type {AccountId} */ (nextTransactionId.accountId),\n new _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](\n /** @type {Timestamp} */ (\n nextTransactionId.validStart\n ).seconds,\n /** @type {Timestamp} */ (\n nextTransactionId.validStart\n ).nanos.add(1)\n )\n );\n }\n\n this._transactionIds.advance();\n this._transactionIds.setLocked();\n\n return this;\n }\n\n /**\n * @returns {ScheduleCreateTransaction}\n */\n schedule() {\n this._requireNotFrozen();\n\n if (this._contents != null && this._contents.length > this._chunkSize) {\n throw new Error(\n `cannot schedule \\`FileAppendTransaction\\` with message over ${this._chunkSize} bytes`\n );\n }\n\n return super.schedule();\n }\n\n /**\n * @param {import(\"../client/Client.js\").default} client\n * @param {number=} requestTimeout\n * @returns {Promise}\n */\n async execute(client, requestTimeout) {\n return (await this.executeAll(client, requestTimeout))[0];\n }\n\n /**\n * @param {import(\"../client/Client.js\").default} client\n * @param {number=} requestTimeout\n * @returns {Promise}\n */\n async executeAll(client, requestTimeout) {\n if (!super._isFrozen()) {\n this.freezeWith(client);\n }\n\n // on execute, sign each transaction with the operator, if present\n // and we are signing a transaction that used the default transaction ID\n\n const transactionId = this._getTransactionId();\n const operatorAccountId = client.operatorAccountId;\n\n if (\n operatorAccountId != null &&\n operatorAccountId.equals(\n /** @type {AccountId} */ (transactionId.accountId)\n )\n ) {\n await super.signWithOperator(client);\n }\n\n const responses = [];\n let remainingTimeout = requestTimeout;\n\n for (let i = 0; i < this._transactionIds.length; i++) {\n const startTimestamp = Date.now();\n const response = await super.execute(client, remainingTimeout);\n\n if (remainingTimeout != null) {\n remainingTimeout = Date.now() - startTimestamp;\n }\n\n await response.getReceipt(client);\n responses.push(response);\n }\n\n return responses;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._fileId != null) {\n this._fileId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.file.appendContent(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"fileAppend\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IFileAppendTransactionBody}\n */\n _makeTransactionData() {\n const length = this._contents != null ? this._contents.length : 0;\n const startIndex = this._transactionIds.index * this._chunkSize;\n const endIndex = Math.min(startIndex + this._chunkSize, length);\n\n return {\n fileID: this._fileId != null ? this._fileId._toProtobuf() : null,\n contents:\n this._contents != null\n ? this._contents.slice(startIndex, endIndex)\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `FileAppendTransaction:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\"fileAppend\", FileAppendTransaction._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileAppendTransaction.js?"); -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../Status.js").default} Status + * @typedef {import("../Executable.js").ExecutionState} ExecutionState + */ -/***/ "./node_modules/@hashgraph/sdk/src/file/FileContentsQuery.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileContentsQuery.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @template OutputT + * @augments {Executable} + */ +class CostQuery extends Executable { + /** + * @param {import("./Query.js").default} query + */ + constructor(query) { + super(); + + this._query = query; + this._grpcDeadline = query._grpcDeadline; + this._requestTimeout = query._requestTimeout; + this._nodeAccountIds = query._nodeAccountIds.clone(); + this._operator = query._operator; + + /** + * @type {HashgraphProto.proto.IQueryHeader | null} + */ + this._header = null; + } + + /** + * @returns {TransactionId} + */ + _getTransactionId() { + return this._query._getTransactionId(); + } + + /** + * @returns {string} + */ + _getLogId() { + return `CostQuery:${this._query._getLogId()}`; + } + + /** + * @abstract + * @protected + * @param {import("../client/Client.js").default<*, *>} client + * @returns {Promise} + */ + async _beforeExecute(client) { + if (client == null) { + throw new Error("Cannot do CostQuery without Client"); + } + + const operator = + this._operator != null ? this._operator : client._operator; + + if (operator == null) { + throw new Error( + "`client` must have an `operator` or an explicit payment transaction must be provided", + ); + } + + if (this._query._nodeAccountIds.isEmpty) { + this._query._nodeAccountIds.setList( + client._network.getNodeAccountIdsForExecute(), + ); + } + + // operator.accountId + const transactionId = TransactionId_TransactionId.generate(operator.accountId); + if (this._query.paymentTransactionId == null) { + this._query.setPaymentTransactionId(transactionId); + } + + const logId = this._getLogId(); + const nodeId = new AccountId_AccountId(0); + const paymentTransactionId = + /** @type {import("../transaction/TransactionId.js").default} */ + (TransactionId_TransactionId.generate(new AccountId_AccountId(0))); + const paymentAmount = new Hbar_Hbar(0); + if (this._logger) { + this._logger.debug( + `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`, + ); + } + + this._header = { + payment: await _makePaymentTransaction( + paymentTransactionId, + new AccountId_AccountId(0), + operator, + paymentAmount, + ), + responseType: lib.proto.ResponseType.COST_ANSWER, + }; + } + + /** + * @abstract + * @internal + * @returns {Promise} + */ + _makeRequestAsync() { + return Promise.resolve( + this._query._onMakeRequest( + /** @type {HashgraphProto.proto.IQueryHeader} */ (this._header), + ), + ); + } + + /** + * @abstract + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @returns {[Status, ExecutionState]} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _shouldRetry(request, response) { + return this._query._shouldRetry(request, response); + } + + /** + * @abstract + * @internal + * @param {HashgraphProto.proto.IQuery} request + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeId + * @returns {Error} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapStatusError(request, response, nodeId) { + return this._query._mapStatusError(request, response, nodeId); + } + + /** + * @override + * @internal + * @param {HashgraphProto.proto.IResponse} response + * @param {AccountId} nodeAccountId + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _mapResponse(response, nodeAccountId, request) { + const cost = this._query._mapResponseHeader(response).cost; + return Promise.resolve( + Hbar_Hbar.fromTinybars(/** @type {Long | number} */ (cost)), + ); + } + + /** + * @override + * @internal + * @param {Channel} channel + * @param {HashgraphProto.proto.IQuery} request + * @returns {Promise} + */ + _execute(channel, request) { + return this._query._execute(channel, request); + } + + /** + * @param {HashgraphProto.proto.Query} request + * @returns {Uint8Array} + */ + _requestToBytes(request) { + return this._query._requestToBytes(request); + } + + /** + * @param {HashgraphProto.proto.Response} response + * @returns {Uint8Array} + */ + _responseToBytes(response) { + return this._query._responseToBytes(response); + } +} + +COST_QUERY.push((query) => new CostQuery(query)); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/exports.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileContentsQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _FileId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IFileGetContentsQuery} HashgraphProto.proto.IFileGetContentsQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IFileGetContentsResponse} HashgraphProto.proto.IFileGetContentsResponse\n * @typedef {import(\"@hashgraph/proto\").proto.FileGetContentsResponse.IFileContents} HashgraphProto.proto.FileGetContentsResponse.IFileContents\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * @augments {Query}\n */\nclass FileContentsQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.fileId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?FileId}\n * @private\n */\n this._fileId = null;\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {FileContentsQuery}\n */\n static _fromProtobuf(query) {\n const contents =\n /** @type {HashgraphProto.proto.IFileGetContentsQuery} */ (\n query.fileGetContents\n );\n\n return new FileContentsQuery({\n fileId:\n contents.fileID != null\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(contents.fileID)\n : undefined,\n });\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._fileId != null) {\n this._fileId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.file.getFileContent(request);\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * Set the file ID for which the info is being requested.\n *\n * @param {FileId | string} fileId\n * @returns {FileContentsQuery}\n */\n setFileId(fileId) {\n this._fileId =\n typeof fileId === \"string\"\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(fileId)\n : fileId.clone();\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const fileGetContents =\n /** @type {HashgraphProto.proto.IFileGetContentsResponse} */ (\n response.fileGetContents\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n fileGetContents.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Promise}\n */\n _mapResponse(response) {\n const fileContentsResponse =\n /** @type {HashgraphProto.proto.IFileGetContentsResponse} */ (\n response.fileGetContents\n );\n const fileConents =\n /** @type {HashgraphProto.proto.FileGetContentsResponse.IFileContents} */ (\n fileContentsResponse.fileContents\n );\n const contents = /** @type {Uint8Array} */ (fileConents.contents);\n\n return Promise.resolve(contents);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n fileGetContents: {\n header,\n fileID:\n this._fileId != null ? this._fileId._toProtobuf() : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `FileContentsQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"fileGetContents\", FileContentsQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileContentsQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/file/FileCreateTransaction.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileCreateTransaction.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileCreateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IFileCreateTransactionBody} HashgraphProto.proto.IFileCreateTransactionBody\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Create a new Hedera™ crypto-currency file.\n */\nclass FileCreateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {Key[] | KeyList} [props.keys]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {Uint8Array | string} [props.contents]\n * @param {string} [props.fileMemo]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Key[]}\n */\n this._keys = null;\n\n /**\n * @private\n * @type {Timestamp}\n */\n this._expirationTime = new _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](0, 0).plusNanos(\n long__WEBPACK_IMPORTED_MODULE_6__.fromNumber(Date.now())\n .mul(1000000)\n .add(_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_AUTO_RENEW_PERIOD.mul(1000000000))\n );\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._contents = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._fileMemo = null;\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](5);\n\n if (props.keys != null) {\n this.setKeys(props.keys);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.contents != null) {\n this.setContents(props.contents);\n }\n\n if (props.fileMemo != null) {\n this.setFileMemo(props.fileMemo);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {FileCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const create =\n /** @type {HashgraphProto.proto.IFileCreateTransactionBody} */ (\n body.fileCreate\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new FileCreateTransaction({\n keys:\n create.keys != null\n ? create.keys.keys != null\n ? create.keys.keys.map((key) =>\n _Key_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobufKey(key)\n )\n : undefined\n : undefined,\n expirationTime:\n create.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(create.expirationTime)\n : undefined,\n contents: create.contents != null ? create.contents : undefined,\n fileMemo: create.memo != null ? create.memo : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?Key[]}\n */\n get keys() {\n return this._keys;\n }\n\n /**\n * Set the keys which must sign any transactions modifying this file. Required.\n *\n * All keys must sign to modify the file's contents or keys. No key is required\n * to sign for extending the expiration time (except the one for the operator account\n * paying for the transaction). Only one key must sign to delete the file, however.\n *\n * To require more than one key to sign to delete a file, add them to a\n * KeyList and pass that here.\n *\n * The network currently requires a file to have at least one key (or key list or threshold key)\n * but this requirement may be lifted in the future.\n *\n * @param {Key[] | KeyList} keys\n * @returns {this}\n */\n setKeys(keys) {\n this._requireNotFrozen();\n if (keys instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] && keys.threshold != null) {\n throw new Error(\"Cannot set threshold key as file key\");\n }\n\n this._keys = keys instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] ? keys.toArray() : keys;\n\n return this;\n }\n\n /**\n * @returns {Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * Set the instant at which this file will expire, after which its contents will no longer be\n * available.\n *\n * Defaults to 1/4 of a Julian year from the instant FileCreateTransaction\n * was invoked.\n *\n * May be extended using FileUpdateTransaction#setExpirationTime(Timestamp).\n *\n * @param {Timestamp | Date} expirationTime\n * @returns {this}\n */\n setExpirationTime(expirationTime) {\n this._requireNotFrozen();\n this._expirationTime =\n expirationTime instanceof _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]\n ? expirationTime\n : _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromDate(expirationTime);\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get contents() {\n return this._contents;\n }\n\n /**\n * Set the given byte array as the file's contents.\n *\n * This may be omitted to create an empty file.\n *\n * Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the\n * network; if you exceed this you may receive a HederaPreCheckStatusException\n * with Status#TransactionOversize.\n *\n * In this case, you will need to break the data into chunks of less than ~6KiB and execute this\n * transaction with the first chunk and then use FileAppendTransaction with\n * FileAppendTransaction#setContents(Uint8Array) for the remaining chunks.\n *\n * @param {Uint8Array | string} contents\n * @returns {this}\n */\n setContents(contents) {\n this._requireNotFrozen();\n this._contents =\n contents instanceof Uint8Array ? contents : _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__.encode(contents);\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get fileMemo() {\n return this._fileMemo;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setFileMemo(memo) {\n this._requireNotFrozen();\n this._fileMemo = memo;\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.file.createFile(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"fileCreate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IFileCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n keys:\n this._keys != null\n ? {\n keys: this._keys.map((key) => key._toProtobufKey()),\n }\n : null,\n expirationTime: this._expirationTime._toProtobuf(),\n contents: this._contents,\n memo: this._fileMemo,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `FileCreateTransaction:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\"fileCreate\", FileCreateTransaction._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileCreateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/file/FileDeleteTransaction.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileDeleteTransaction.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _FileId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IFileDeleteTransactionBody} HashgraphProto.proto.IFileDeleteTransactionBody\n */\n\n/**\n * @typedef {import(\"@hashgraph/cryptography\").Key} Key\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * A transaction to delete a file on the Hedera network.\n *\n * When deleted, a file's contents are truncated to zero length and it can no longer be updated\n * or appended to, or its expiration time extended. FileContentsQuery and FileInfoQuery\n * will throw HederaPreCheckStatusException with a status of Status#FileDeleted.\n *\n * Only one of the file's keys needs to sign to delete the file, unless the key you have is part\n * of a KeyList.\n */\nclass FileDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.fileId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._fileId = null;\n\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {FileDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const fileDelete =\n /** @type {HashgraphProto.proto.IFileDeleteTransactionBody} */ (\n body.fileDelete\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new FileDeleteTransaction({\n fileId:\n fileDelete.fileID != null\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(fileDelete.fileID)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * Set the file ID which is being deleted in this transaction.\n *\n * @param {FileId | string} fileId\n * @returns {FileDeleteTransaction}\n */\n setFileId(fileId) {\n this._requireNotFrozen();\n this._fileId =\n typeof fileId === \"string\"\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(fileId)\n : fileId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._fileId != null) {\n this._fileId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.file.deleteFile(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"fileDelete\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IFileDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n fileID: this._fileId != null ? this._fileId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `FileDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\"fileDelete\", FileDeleteTransaction._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileDeleteTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/file/FileId.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileId.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileId; }\n/* harmony export */ });\n/* harmony import */ var _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../EntityIdHelper.js */ \"./node_modules/@hashgraph/sdk/src/EntityIdHelper.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * The ID for a crypto-currency file on Hedera.\n */\nclass FileId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n */\n constructor(props, realm, num) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @param {string} text\n * @returns {FileId}\n */\n static fromString(text) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromString(text);\n const id = new FileId(result);\n id._checksum = result.checksum;\n return id;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IFileID} id\n * @returns {FileId}\n */\n static _fromProtobuf(id) {\n const fileId = new FileId(\n id.shardNum != null ? long__WEBPACK_IMPORTED_MODULE_2__.fromString(id.shardNum.toString()) : 0,\n id.realmNum != null ? long__WEBPACK_IMPORTED_MODULE_2__.fromString(id.realmNum.toString()) : 0,\n id.fileNum != null ? long__WEBPACK_IMPORTED_MODULE_2__.fromString(id.fileNum.toString()) : 0\n );\n\n return fileId;\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FileId}\n */\n static fromBytes(bytes) {\n return FileId._fromProtobuf(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.FileID.decode(bytes));\n }\n\n /**\n * @param {string} address\n * @returns {FileId}\n */\n static fromSolidityAddress(address) {\n const [shard, realm, file] = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromSolidityAddress(address);\n return new FileId(shard, realm, file);\n }\n\n /**\n * @returns {string} solidity address\n */\n toSolidityAddress() {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toSolidityAddress([this.shard, this.realm, this.num]);\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IFileID}\n */\n _toProtobuf() {\n return {\n fileNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.FileID.encode(this._toProtobuf()).finish();\n }\n\n /**\n * @returns {FileId}\n */\n clone() {\n const id = new FileId(this);\n id._checksum = this._checksum;\n return id;\n }\n\n /**\n * @param {FileId} other\n * @returns {number}\n */\n compare(other) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.compare(\n [this.shard, this.realm, this.num],\n [other.shard, other.realm, other.num]\n );\n }\n}\n\n/**\n * The public node address book for the current network.\n */\nFileId.ADDRESS_BOOK = new FileId(102);\n\n/**\n * The current fee schedule for the network.\n */\nFileId.FEE_SCHEDULE = new FileId(111);\n\n/**\n * The current exchange rate of HBAR to USD.\n */\nFileId.EXCHANGE_RATES = new FileId(112);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileId.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/file/FileInfo.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileInfo.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +// eslint-disable-next-line deprecation/deprecation -"use strict"; -eval("var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileInfo; }\n/* harmony export */ });\n/* harmony import */ var _FileId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\nconst { proto } = /*#__PURE__*/ (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_5___namespace_cache || (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_5___namespace_cache = __webpack_require__.t(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__, 2)));\n\n/**\n * Response when the client sends the node CryptoGetInfoQuery.\n */\nclass FileInfo {\n /**\n * @private\n * @param {object} props\n * @param {FileId} props.fileId\n * @param {Long} props.size\n * @param {Timestamp} props.expirationTime\n * @param {boolean} props.isDeleted\n * @param {KeyList} props.keys\n * @param {string} props.fileMemo\n * @param {LedgerId|null} props.ledgerId\n */\n constructor(props) {\n /**\n * The ID of the file for which information is requested.\n *\n * @readonly\n */\n this.fileId = props.fileId;\n\n /**\n * Number of bytes in contents.\n *\n * @readonly\n */\n this.size = props.size;\n\n /**\n * The current time at which this account is set to expire.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * True if deleted but not yet expired.\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * One of these keys must sign in order to delete the file.\n * All of these keys must sign in order to update the file.\n *\n * @readonly\n */\n this.keys = props.keys;\n\n this.fileMemo = props.fileMemo;\n\n this.ledgerId = props.ledgerId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.FileGetInfoResponse.IFileInfo} info\n * @returns {FileInfo}\n */\n static _fromProtobuf(info) {\n const size = /** @type {Long | number} */ (info.size);\n\n return new FileInfo({\n fileId: _FileId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IFileID} */ (info.fileID)\n ),\n size: size instanceof long__WEBPACK_IMPORTED_MODULE_2__ ? size : long__WEBPACK_IMPORTED_MODULE_2__.fromValue(size),\n expirationTime: _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.expirationTime\n )\n ),\n isDeleted: /** @type {boolean} */ (info.deleted),\n keys:\n info.keys != null\n ? _KeyList_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].__fromProtobufKeyList(info.keys)\n : new _KeyList_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](),\n fileMemo: info.memo != null ? info.memo : \"\",\n ledgerId:\n info.ledgerId != null\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromBytes(info.ledgerId)\n : null,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.FileGetInfoResponse.IFileInfo}\n */\n _toProtobuf() {\n return {\n fileID: this.fileId._toProtobuf(),\n size: this.size,\n expirationTime: this.expirationTime._toProtobuf(),\n deleted: this.isDeleted,\n keys: this.keys._toProtobufKey().keyList,\n memo: this.fileMemo,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FileInfo}\n */\n static fromBytes(bytes) {\n return FileInfo._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.FileGetInfoResponse.FileInfo.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return proto.FileGetInfoResponse.FileInfo.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileInfo.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/file/FileInfoQuery.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileInfoQuery.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _FileId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _FileInfo_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileInfo.js */ \"./node_modules/@hashgraph/sdk/src/file/FileInfo.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IFileGetInfoQuery} HashgraphProto.proto.IFileGetInfoQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IFileGetInfoResponse} HashgraphProto.proto.IFileGetInfoResponse\n * @typedef {import(\"@hashgraph/proto\").proto.FileGetInfoResponse.IFileInfo} HashgraphProto.proto.IFileInfo\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * @augments {Query}\n */\nclass FileInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.fileId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?FileId}\n * @private\n */\n this._fileId = null;\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {FileInfoQuery}\n */\n static _fromProtobuf(query) {\n const info = /** @type {HashgraphProto.proto.IFileGetInfoQuery} */ (\n query.fileGetInfo\n );\n\n return new FileInfoQuery({\n fileId:\n info.fileID != null\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.fileID)\n : undefined,\n });\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * Set the file ID for which the info is being requested.\n *\n * @param {FileId | string} fileId\n * @returns {FileInfoQuery}\n */\n setFileId(fileId) {\n this._fileId =\n typeof fileId === \"string\"\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(fileId)\n : fileId.clone();\n\n return this;\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._fileId != null) {\n this._fileId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.file.getFileInfo(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const fileGetInfo =\n /** @type {HashgraphProto.proto.IFileGetInfoResponse} */ (\n response.fileGetInfo\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n fileGetInfo.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const info = /** @type {HashgraphProto.proto.IFileGetInfoResponse} */ (\n response.fileGetInfo\n );\n\n return Promise.resolve(\n _FileInfo_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IFileInfo} */ (info.fileInfo)\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n fileGetInfo: {\n header,\n fileID:\n this._fileId != null ? this._fileId._toProtobuf() : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `FileInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"fileGetInfo\", FileInfoQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileInfoQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/file/FileUpdateTransaction.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/file/FileUpdateTransaction.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FileUpdateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/* harmony import */ var _FileId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IFileUpdateTransactionBody} HashgraphProto.proto.IFileUpdateTransactionBody\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Update a new Hedera™ crypto-currency file.\n */\nclass FileUpdateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {FileId | string} [props.fileId]\n * @param {Key[] | KeyList} [props.keys]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {Uint8Array | string} [props.contents]\n * @param {string} [props.fileMemo]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._fileId = null;\n\n /**\n * @private\n * @type {?Key[]}\n */\n this._keys = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._contents = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._fileMemo = null;\n\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n\n if (props.keys != null) {\n this.setKeys(props.keys);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.contents != null) {\n this.setContents(props.contents);\n }\n\n if (props.fileMemo != null) {\n this.setFileMemo(props.fileMemo);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {FileUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const update =\n /** @type {HashgraphProto.proto.IFileUpdateTransactionBody} */ (\n body.fileUpdate\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new FileUpdateTransaction({\n fileId:\n update.fileID != null\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(update.fileID)\n : undefined,\n keys:\n update.keys != null\n ? update.keys.keys != null\n ? update.keys.keys.map((key) =>\n _Key_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobufKey(key)\n )\n : undefined\n : undefined,\n expirationTime:\n update.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(update.expirationTime)\n : undefined,\n contents: update.contents != null ? update.contents : undefined,\n fileMemo:\n update.memo != null\n ? update.memo.value != null\n ? update.memo.value\n : undefined\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * Set the keys which must sign any transactions modifying this file. Required.\n *\n * All keys must sign to modify the file's contents or keys. No key is required\n * to sign for extending the expiration time (except the one for the operator account\n * paying for the transaction). Only one key must sign to delete the file, however.\n *\n * To require more than one key to sign to delete a file, add them to a\n * KeyList and pass that here.\n *\n * The network currently requires a file to have at least one key (or key list or threshold key)\n * but this requirement may be lifted in the future.\n *\n * @param {FileId | string} fileId\n * @returns {this}\n */\n setFileId(fileId) {\n this._requireNotFrozen();\n this._fileId =\n typeof fileId === \"string\"\n ? _FileId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(fileId)\n : fileId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Key[]}\n */\n get keys() {\n return this._keys;\n }\n\n /**\n * Set the keys which must sign any transactions modifying this file. Required.\n *\n * All keys must sign to modify the file's contents or keys. No key is required\n * to sign for extending the expiration time (except the one for the operator account\n * paying for the transaction). Only one key must sign to delete the file, however.\n *\n * To require more than one key to sign to delete a file, add them to a\n * KeyList and pass that here.\n *\n * The network currently requires a file to have at least one key (or key list or threshold key)\n * but this requirement may be lifted in the future.\n *\n * @param {Key[] | KeyList} keys\n * @returns {this}\n */\n setKeys(keys) {\n this._requireNotFrozen();\n if (keys instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] && keys.threshold != null) {\n throw new Error(\"Cannot set threshold key as file key\");\n }\n\n this._keys = keys instanceof _KeyList_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] ? keys.toArray() : keys;\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * Set the instant at which this file will expire, after which its contents will no longer be\n * available.\n *\n * Defaults to 1/4 of a Julian year from the instant FileUpdateTransaction\n * was invoked.\n *\n * May be extended using FileUpdateTransaction#setExpirationTime(Timestamp).\n *\n * @param {Timestamp | Date} expirationTime\n * @returns {this}\n */\n setExpirationTime(expirationTime) {\n this._requireNotFrozen();\n this._expirationTime =\n expirationTime instanceof _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? expirationTime\n : _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromDate(expirationTime);\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get contents() {\n return this._contents;\n }\n\n /**\n * Set the given byte array as the file's contents.\n *\n * This may be omitted to update an empty file.\n *\n * Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the\n * network; if you exceed this you may receive a HederaPreCheckStatusException\n * with Status#TransactionOversize.\n *\n * In this case, you will need to break the data into chunks of less than ~6KiB and execute this\n * transaction with the first chunk and then use FileAppendTransaction with\n * FileAppendTransaction#setContents(Uint8Array) for the remaining chunks.\n *\n * @param {Uint8Array | string} contents\n * @returns {this}\n */\n setContents(contents) {\n this._requireNotFrozen();\n this._contents =\n contents instanceof Uint8Array ? contents : _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__.encode(contents);\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get fileMemo() {\n return this._fileMemo;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setFileMemo(memo) {\n this._requireNotFrozen();\n this._fileMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {this}\n */\n clearFileMemo() {\n this._requireNotFrozen();\n this._fileMemo = null;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._fileId != null) {\n this._fileId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.file.updateFile(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"fileUpdate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IFileUpdateTransactionBody}\n */\n _makeTransactionData() {\n return {\n fileID: this._fileId != null ? this._fileId._toProtobuf() : null,\n keys:\n this._keys != null\n ? {\n keys: this._keys.map((key) => key._toProtobufKey()),\n }\n : null,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n contents: this._contents,\n memo:\n this._fileMemo != null\n ? {\n value: this._fileMemo,\n }\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `FileUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\"fileUpdate\", FileUpdateTransaction._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/file/FileUpdateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/grpc/GrpcServiceError.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/grpc/GrpcServiceError.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ GrpcServiceError; }\n/* harmony export */ });\n/* harmony import */ var _GrpcStatus_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GrpcStatus.js */ \"./node_modules/@hashgraph/sdk/src/grpc/GrpcStatus.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * Describes how the gRPC request failed.\n *\n * Exists in order for the Hedera JavaScript SDK to produce the same error type for gRPC errors regardless of\n * operating in node or the browser.\n *\n * Definition taken from .\n */\nclass GrpcServiceError extends Error {\n /**\n * @param {GrpcStatus} status\n */\n constructor(status) {\n super(`gRPC service failed with status: ${status.toString()}`);\n\n /**\n * @readonly\n */\n this.status = status;\n\n this.name = \"GrpcServiceError\";\n\n if (typeof Error.captureStackTrace !== \"undefined\") {\n Error.captureStackTrace(this, GrpcServiceError);\n }\n }\n\n /**\n * @param {Error & { code?: number; details?: string }} obj\n * @returns {Error}\n */\n static _fromResponse(obj) {\n if (obj.code != null && obj.details != null) {\n const status = _GrpcStatus_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromValue(obj.code);\n const err = new GrpcServiceError(status);\n err.message = obj.details;\n return err;\n } else {\n return /** @type {Error} */ (obj);\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/grpc/GrpcServiceError.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/grpc/GrpcStatus.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/grpc/GrpcStatus.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ GrpcStatus; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\nclass GrpcStatus {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {GrpcStatus}\n */\n static _fromValue(code) {\n switch (code) {\n case 0:\n return GrpcStatus.Ok;\n case 1:\n return GrpcStatus.Cancelled;\n case 2:\n return GrpcStatus.Unknown;\n case 3:\n return GrpcStatus.InvalidArgument;\n case 4:\n return GrpcStatus.DeadlineExceeded;\n case 5:\n return GrpcStatus.NotFound;\n case 6:\n return GrpcStatus.AlreadyExists;\n case 7:\n return GrpcStatus.PermissionDenied;\n case 8:\n return GrpcStatus.ResourceExhausted;\n case 9:\n return GrpcStatus.FailedPrecondition;\n case 10:\n return GrpcStatus.Aborted;\n case 11:\n return GrpcStatus.OutOfRange;\n case 12:\n return GrpcStatus.Unimplemented;\n case 13:\n return GrpcStatus.Internal;\n case 14:\n return GrpcStatus.Unavailable;\n case 15:\n return GrpcStatus.DataLoss;\n case 16:\n return GrpcStatus.Unauthenticated;\n case 17:\n return GrpcStatus.Timeout;\n default:\n throw new Error(\n \"(BUG) non-exhaustive GrpcStatus switch statement\"\n );\n }\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case GrpcStatus.Ok:\n return \"OK\";\n case GrpcStatus.Cancelled:\n return \"CANCELLED\";\n case GrpcStatus.Unknown:\n return \"UNKNOWN\";\n case GrpcStatus.InvalidArgument:\n return \"INVALID_ARGUMENT\";\n case GrpcStatus.DeadlineExceeded:\n return \"DEADLINE_EXCEEDED\";\n case GrpcStatus.NotFound:\n return \"NOT_FOUND\";\n case GrpcStatus.AlreadyExists:\n return \"ALREADY_EXISTS\";\n case GrpcStatus.PermissionDenied:\n return \"PERMISSION_DENIED\";\n case GrpcStatus.Unauthenticated:\n return \"UNAUTHENTICATED\";\n case GrpcStatus.ResourceExhausted:\n return \"RESOURCE_EXHAUSTED\";\n case GrpcStatus.FailedPrecondition:\n return \"FAILED_PRECONDITION\";\n case GrpcStatus.Aborted:\n return \"ABORTED\";\n case GrpcStatus.OutOfRange:\n return \"OUT_OF_RANGE\";\n case GrpcStatus.Unimplemented:\n return \"UNIMPLEMENTED\";\n case GrpcStatus.Internal:\n return \"INTERNAL\";\n case GrpcStatus.Unavailable:\n return \"UNAVAILABLE\";\n case GrpcStatus.DataLoss:\n return \"DATA_LOSS\";\n case GrpcStatus.Timeout:\n return \"TIMEOUT\";\n default:\n return `UNKNOWN (${this._code})`;\n }\n }\n\n /**\n * @returns {number}\n */\n valueOf() {\n return this._code;\n }\n}\n\nGrpcStatus.Ok = new GrpcStatus(0);\nGrpcStatus.Cancelled = new GrpcStatus(1);\nGrpcStatus.Unknown = new GrpcStatus(2);\nGrpcStatus.InvalidArgument = new GrpcStatus(3);\nGrpcStatus.DeadlineExceeded = new GrpcStatus(4);\nGrpcStatus.NotFound = new GrpcStatus(5);\nGrpcStatus.AlreadyExists = new GrpcStatus(6);\nGrpcStatus.PermissionDenied = new GrpcStatus(7);\nGrpcStatus.ResourceExhausted = new GrpcStatus(8);\nGrpcStatus.FailedPrecondition = new GrpcStatus(9);\nGrpcStatus.Aborted = new GrpcStatus(10);\nGrpcStatus.OutOfRange = new GrpcStatus(11);\nGrpcStatus.Unimplemented = new GrpcStatus(12);\nGrpcStatus.Internal = new GrpcStatus(13);\nGrpcStatus.Unavailable = new GrpcStatus(14);\nGrpcStatus.DataLoss = new GrpcStatus(15);\nGrpcStatus.Unauthenticated = new GrpcStatus(16);\nGrpcStatus.Timeout = new GrpcStatus(17);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/grpc/GrpcStatus.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/http/HttpError.js": -/*!***********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/http/HttpError.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ HttpError; }\n/* harmony export */ });\n/* harmony import */ var _HttpStatus_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HttpStatus.js */ \"./node_modules/@hashgraph/sdk/src/http/HttpStatus.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n/**\n * Describes how the http request failed.\n */\nclass HttpError extends Error {\n /**\n * @param {HttpStatus} status\n */\n constructor(status) {\n super(`failed with error code: ${status.toString()}`);\n\n /**\n * @readonly\n */\n this.status = status;\n\n this.name = \"HttpError\";\n\n if (typeof Error.captureStackTrace !== \"undefined\") {\n Error.captureStackTrace(this, HttpError);\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/http/HttpError.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/http/HttpStatus.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/http/HttpStatus.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ HttpStatus; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\nclass HttpStatus {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {HttpStatus}\n */\n static _fromValue(code) {\n return new HttpStatus(code);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._code.toString();\n }\n\n /**\n * @returns {number}\n */\n valueOf() {\n return this._code;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/http/HttpStatus.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/long.js": -/*!*************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/long.js ***! - \*************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"valueToLong\": function() { return /* binding */ valueToLong; }\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ \"./node_modules/bignumber.js/bignumber.mjs\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @typedef {{low: number, high: number, unsigned: boolean}} LongObject\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * @param {Long | number | string | LongObject | BigNumber} value\n * @returns {BigNumber}\n */\nfunction valueToLong(value) {\n if (bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isBigNumber(value)) {\n return value;\n } else {\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](value.toString());\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/long.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/network/AddressBookQuery.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/network/AddressBookQuery.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AddressBookQuery; }\n/* harmony export */ });\n/* harmony import */ var _address_book_NodeAddress_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../address_book/NodeAddress.js */ \"./node_modules/@hashgraph/sdk/src/address_book/NodeAddress.js\");\n/* harmony import */ var _address_book_NodeAddressBook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../address_book/NodeAddressBook.js */ \"./node_modules/@hashgraph/sdk/src/address_book/NodeAddressBook.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../channel/MirrorChannel.js\").MirrorError} MirrorError\n */\n\n/**\n * @template {Channel} ChannelT\n * @typedef {import(\"../client/Client.js\").default} Client\n */\n\nclass AddressBookQuery {\n /**\n * @param {object} props\n * @param {FileId | string} [props.fileId]\n * @param {number} [props.limit]\n */\n constructor(props = {}) {\n /**\n * @private\n * @type {?FileId}\n */\n this._fileId = null;\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n\n /**\n * @private\n * @type {?number}\n */\n this._limit = null;\n if (props.limit != null) {\n this.setLimit(props.limit);\n }\n\n /**\n * @private\n * @type {(error: MirrorError | Error | null) => boolean}\n */\n this._retryHandler = (error) => {\n if (error != null) {\n if (error instanceof Error) {\n // Retry on all errors which are not `MirrorError` because they're\n // likely lower level HTTP/2 errors\n return true;\n } else {\n // Retry on `NOT_FOUND`, `RESOURCE_EXHAUSTED`, `UNAVAILABLE`, and conditionally on `INTERNAL`\n // if the message matches the right regex.\n switch (error.code) {\n // INTERNAL\n // eslint-disable-next-line no-fallthrough\n case 13:\n return _Executable_js__WEBPACK_IMPORTED_MODULE_4__.RST_STREAM.test(error.details.toString());\n // NOT_FOUND\n // eslint-disable-next-line no-fallthrough\n case 5:\n // RESOURCE_EXHAUSTED\n // eslint-disable-next-line no-fallthrough\n case 8:\n // UNAVAILABLE\n // eslint-disable-next-line no-fallthrough\n case 14:\n case 17:\n return true;\n default:\n return false;\n }\n }\n }\n\n return false;\n };\n\n /** @type {NodeAddress[]} */\n this._addresses = [];\n\n /**\n * @private\n * @type {number}\n */\n this._maxAttempts = 10;\n\n /**\n * @private\n * @type {number}\n */\n this._maxBackoff = 8000;\n\n /**\n * @private\n * @type {number}\n */\n this._attempt = 0;\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * @param {FileId | string} fileId\n * @returns {AddressBookQuery}\n */\n setFileId(fileId) {\n this._fileId =\n typeof fileId === \"string\"\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(fileId)\n : fileId.clone();\n\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get limit() {\n return this._limit;\n }\n\n /**\n * @param {number} limit\n * @returns {AddressBookQuery}\n */\n setLimit(limit) {\n this._limit = limit;\n\n return this;\n }\n\n /**\n * @param {number} attempts\n */\n setMaxAttempts(attempts) {\n this._maxAttempts = attempts;\n }\n\n /**\n * @param {number} backoff\n */\n setMaxBackoff(backoff) {\n this._maxBackoff = backoff;\n }\n\n /**\n * @param {Client} client\n * @param {number=} requestTimeout\n * @returns {Promise}\n */\n execute(client, requestTimeout) {\n return new Promise((resolve, reject) => {\n this._makeServerStreamRequest(\n client,\n /** @type {(value: NodeAddressBook) => void} */ (resolve),\n reject,\n requestTimeout\n );\n });\n }\n\n /**\n * @private\n * @param {Client} client\n * @param {(value: NodeAddressBook) => void} resolve\n * @param {(error: Error) => void} reject\n * @param {number=} requestTimeout\n */\n _makeServerStreamRequest(client, resolve, reject, requestTimeout) {\n const request =\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.com.hedera.mirror.api.proto.AddressBookQuery.encode({\n fileId:\n this._fileId != null ? this._fileId._toProtobuf() : null,\n limit: this._limit,\n }).finish();\n\n client._mirrorNetwork\n .getNextMirrorNode()\n .getChannel()\n .makeServerStreamRequest(\n \"NetworkService\",\n \"getNodes\",\n request,\n (data) => {\n this._addresses.push(\n _address_book_NodeAddress_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.NodeAddress.decode(data)\n )\n );\n\n if (this._limit != null && this._limit > 0) {\n this._limit = this._limit - 1;\n }\n },\n (error) => {\n const message =\n error instanceof Error ? error.message : error.details;\n if (\n this._attempt < this._maxAttempts &&\n !client.isClientShutDown &&\n this._retryHandler(error)\n ) {\n const delay = Math.min(\n 250 * 2 ** this._attempt,\n this._maxBackoff\n );\n if (this._attempt >= this._maxAttempts) {\n console.warn(\n `Error getting nodes from mirror for file ${\n this._fileId != null\n ? this._fileId.toString()\n : \"UNKNOWN\"\n } during attempt ${\n this._attempt\n }. Waiting ${delay} ms before next attempt: ${message}`\n );\n }\n js_logger__WEBPACK_IMPORTED_MODULE_6__.debug(\n `Error getting nodes from mirror for file ${\n this._fileId != null\n ? this._fileId.toString()\n : \"UNKNOWN\"\n } during attempt ${\n this._attempt\n }. Waiting ${delay} ms before next attempt: ${message}`\n );\n this._attempt += 1;\n\n setTimeout(() => {\n this._makeServerStreamRequest(\n client,\n resolve,\n reject,\n requestTimeout\n );\n }, delay);\n } else {\n reject(new Error(\"failed to query address book\"));\n }\n },\n () => {\n resolve(\n new _address_book_NodeAddressBook_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]({ nodeAddresses: this._addresses })\n );\n }\n );\n }\n}\n\n_Cache_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].setAddressBookQueryConstructor(() => new AddressBookQuery());\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/network/AddressBookQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfo.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfo.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ NetworkVersionInfo; }\n/* harmony export */ });\n/* harmony import */ var _SemanticVersion_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SemanticVersion.js */ \"./node_modules/@hashgraph/sdk/src/network/SemanticVersion.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * Response when the client sends the node CryptoGetVersionInfoQuery.\n */\nclass NetworkVersionInfo {\n /**\n * @private\n * @param {object} props\n * @param {SemanticVersion} props.protobufVersion\n * @param {SemanticVersion} props.servicesVesion\n */\n constructor(props) {\n /**\n * The account ID for which this information applies.\n *\n * @readonly\n */\n this.protobufVersion = props.protobufVersion;\n\n /**\n * The account ID for which this information applies.\n *\n * @readonly\n */\n this.servicesVesion = props.servicesVesion;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.INetworkGetVersionInfoResponse} info\n * @returns {NetworkVersionInfo}\n */\n static _fromProtobuf(info) {\n return new NetworkVersionInfo({\n protobufVersion: _SemanticVersion_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ISemanticVersion} */\n (info.hapiProtoVersion)\n ),\n servicesVesion: _SemanticVersion_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ISemanticVersion} */\n (info.hederaServicesVersion)\n ),\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.INetworkGetVersionInfoResponse}\n */\n _toProtobuf() {\n return {\n hapiProtoVersion: this.protobufVersion._toProtobuf(),\n hederaServicesVersion: this.servicesVesion._toProtobuf(),\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {NetworkVersionInfo}\n */\n static fromBytes(bytes) {\n return NetworkVersionInfo._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.NetworkGetVersionInfoResponse.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.NetworkGetVersionInfoResponse.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfo.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfoQuery.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfoQuery.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ NetworkVersionInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _NetworkVersionInfo_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NetworkVersionInfo.js */ \"./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfo.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.INetworkGetVersionInfoQuery} HashgraphProto.proto.INetworkGetVersionInfoQuery\n * @typedef {import(\"@hashgraph/proto\").proto.INetworkGetVersionInfoResponse} HashgraphProto.proto.INetworkGetVersionInfoResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n */\n\n/**\n * @augments {Query}\n */\nclass NetworkVersionInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n constructor() {\n super();\n }\n\n /**\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {NetworkVersionInfoQuery}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _fromProtobuf(query) {\n return new NetworkVersionInfoQuery();\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.network.getVersionInfo(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const networkGetVersionInfo =\n /** @type {HashgraphProto.proto.INetworkGetVersionInfoResponse} */ (\n response.networkGetVersionInfo\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n networkGetVersionInfo.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Promise}\n */\n _mapResponse(response) {\n const info =\n /** @type {HashgraphProto.proto.INetworkGetVersionInfoResponse} */ (\n response.networkGetVersionInfo\n );\n return Promise.resolve(_NetworkVersionInfo_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info));\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n networkGetVersionInfo: {\n header,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `NetworkVersionInfoQuery:${timestamp.toString()}`;\n }\n}\n\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\n \"networkGetVersionInfo\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n NetworkVersionInfoQuery._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/network/NetworkVersionInfoQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/network/SemanticVersion.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/network/SemanticVersion.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SemanticVersion; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\nclass SemanticVersion {\n /**\n * @private\n * @param {object} props\n * @param {number} props.major\n * @param {number} props.minor\n * @param {number} props.patch\n */\n constructor(props) {\n /** @readonly */\n this.major = props.major;\n /** @readonly */\n this.minor = props.minor;\n /** @readonly */\n this.patch = props.patch;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ISemanticVersion} version\n * @returns {SemanticVersion}\n */\n static _fromProtobuf(version) {\n return new SemanticVersion({\n major: /** @type {number} */ (version.major),\n minor: /** @type {number} */ (version.minor),\n patch: /** @type {number} */ (version.patch),\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ISemanticVersion}\n */\n _toProtobuf() {\n return {\n major: this.major,\n minor: this.minor,\n patch: this.patch,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {SemanticVersion}\n */\n static fromBytes(bytes) {\n return SemanticVersion._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.SemanticVersion.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.SemanticVersion.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/network/SemanticVersion.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/query/CostQuery.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/query/CostQuery.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ CostQuery; }\n/* harmony export */ });\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Query_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../Status.js\").default} Status\n * @typedef {import(\"../Executable.js\").ExecutionState} ExecutionState\n */\n\n/**\n * @template OutputT\n * @augments {Executable}\n */\nclass CostQuery extends _Executable_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {import(\"./Query.js\").default} query\n */\n constructor(query) {\n super();\n\n this._query = query;\n this._grpcDeadline = query._grpcDeadline;\n this._requestTimeout = query._requestTimeout;\n this._nodeAccountIds = query._nodeAccountIds.clone();\n this._operator = query._operator;\n\n /**\n * @type {HashgraphProto.proto.IQueryHeader | null}\n */\n this._header = null;\n }\n\n /**\n * @returns {TransactionId}\n */\n _getTransactionId() {\n return this._query._getTransactionId();\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n return `CostQuery:${this._query._getLogId()}`;\n }\n\n /**\n * @abstract\n * @protected\n * @param {import(\"../client/Client.js\").default<*, *>} client\n * @returns {Promise}\n */\n async _beforeExecute(client) {\n if (client == null) {\n throw new Error(\"Cannot do CostQuery without Client\");\n }\n\n const operator =\n this._operator != null ? this._operator : client._operator;\n\n if (operator == null) {\n throw new Error(\n \"`client` must have an `operator` or an explicit payment transaction must be provided\"\n );\n }\n\n if (this._query._nodeAccountIds.isEmpty) {\n this._query._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute()\n );\n }\n\n // operator.accountId\n const transactionId = _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generate(operator.accountId);\n if (this._query.paymentTransactionId == null) {\n this._query.setPaymentTransactionId(transactionId);\n }\n\n this._header = {\n payment: await (0,_Query_js__WEBPACK_IMPORTED_MODULE_4__._makePaymentTransaction)(\n this._getLogId(),\n /** @type {import(\"../transaction/TransactionId.js\").default} */\n (_transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generate(new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](0))),\n new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](0),\n operator,\n new _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](0)\n ),\n responseType: _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ResponseType.COST_ANSWER,\n };\n }\n\n /**\n * @abstract\n * @internal\n * @returns {Promise}\n */\n _makeRequestAsync() {\n return Promise.resolve(\n this._query._onMakeRequest(\n /** @type {HashgraphProto.proto.IQueryHeader} */ (this._header)\n )\n );\n }\n\n /**\n * @abstract\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n return this._query._shouldRetry(request, response);\n }\n\n /**\n * @abstract\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response) {\n return this._query._mapStatusError(request, response);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const cost = this._query._mapResponseHeader(response).cost;\n return Promise.resolve(\n _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromTinybars(/** @type {Long | number} */ (cost))\n );\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return this._query._execute(channel, request);\n }\n\n /**\n * @param {HashgraphProto.proto.Query} request\n * @returns {Uint8Array}\n */\n _requestToBytes(request) {\n return this._query._requestToBytes(request);\n }\n\n /**\n * @param {HashgraphProto.proto.Response} response\n * @returns {Uint8Array}\n */\n _responseToBytes(response) {\n return this._query._responseToBytes(response);\n }\n}\n\n_Query_js__WEBPACK_IMPORTED_MODULE_4__.COST_QUERY.push((query) => new CostQuery(query));\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/query/CostQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/query/Query.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/query/Query.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"COST_QUERY\": function() { return /* binding */ COST_QUERY; },\n/* harmony export */ \"QUERY_REGISTRY\": function() { return /* binding */ QUERY_REGISTRY; },\n/* harmony export */ \"_makePaymentTransaction\": function() { return /* binding */ _makePaymentTransaction; },\n/* harmony export */ \"default\": function() { return /* binding */ Query; }\n/* harmony export */ });\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../PrecheckStatusError.js */ \"./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js\");\n/* harmony import */ var _MaxQueryPaymentExceeded_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../MaxQueryPaymentExceeded.js */ \"./node_modules/@hashgraph/sdk/src/MaxQueryPaymentExceeded.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n */\n\n/**\n * @typedef {import(\"../client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * This registry holds a bunch of callbacks for `fromProtobuf()` implementations\n * Since this is essentially aa cache, perhaps we should move this variable into the `Cache`\n * type for consistency?\n *\n * @type {Map Query<*>>}\n */\nconst QUERY_REGISTRY = new Map();\n\n/**\n * Base class for all queries that can be submitted to Hedera.\n *\n * @abstract\n * @template OutputT\n * @augments {Executable}\n */\nclass Query extends _Executable_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n constructor() {\n super();\n\n /**\n * The payment transaction ID\n *\n * @type {?TransactionId}\n */\n this._paymentTransactionId = null;\n\n /**\n * The payment transactions list where each index points to a different node\n *\n * @type {HashgraphProto.proto.ITransaction[]}\n */\n this._paymentTransactions = [];\n\n /**\n * The amount being paid to the node for this query.\n * A user can set this field explicitly, or we'll query the value during execution.\n *\n * @type {?Hbar}\n */\n this._queryPayment = null;\n\n /**\n * The maximum query payment a user is willing to pay. Unlike `Transaction.maxTransactionFee`\n * this field only exists in the SDK; there is no protobuf field equivalent. If and when\n * we query the actual cost of the query and the cost is greater than the max query payment\n * we'll throw a `MaxQueryPaymentExceeded` error.\n *\n * @type {?Hbar}\n */\n this._maxQueryPayment = null;\n\n /**\n * This is strictly used for `_getLogId()` which requires a timestamp. The timestamp it typically\n * uses comes from the payment transaction ID, but that field is not set if this query is free.\n * For those occasions we use this timestamp field generated at query construction instead.\n *\n * @type {number}\n */\n this._timestamp = Date.now();\n }\n\n /**\n * Deserialize a query from bytes. The bytes should be a `proto.Query`.\n *\n * @template T\n * @param {Uint8Array} bytes\n * @returns {Query}\n */\n static fromBytes(bytes) {\n const query = _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.Query.decode(bytes);\n\n if (query.query == null) {\n throw new Error(\"(BUG) query.query was not set in the protobuf\");\n }\n\n const fromProtobuf =\n /** @type {(query: HashgraphProto.proto.IQuery) => Query} */ (\n QUERY_REGISTRY.get(query.query)\n );\n\n if (fromProtobuf == null) {\n throw new Error(\n `(BUG) Query.fromBytes() not implemented for type ${query.query}`\n );\n }\n\n return fromProtobuf(query);\n }\n\n /**\n * Serialize the query into bytes.\n *\n * **NOTE**: Does not preserve payment transactions\n *\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.Query.encode(this._makeRequest()).finish();\n }\n\n /**\n * Set an explicit payment amount for this query.\n *\n * The client will submit exactly this amount for the payment of this query. Hedera\n * will not return any remainder.\n *\n * @param {Hbar} queryPayment\n * @returns {this}\n */\n setQueryPayment(queryPayment) {\n this._queryPayment = queryPayment;\n\n return this;\n }\n\n /**\n * Set the maximum payment allowable for this query.\n *\n * @param {Hbar} maxQueryPayment\n * @returns {this}\n */\n setMaxQueryPayment(maxQueryPayment) {\n this._maxQueryPayment = maxQueryPayment;\n\n return this;\n }\n\n /**\n * Fetch the cost of this query from a consensus node\n *\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n // The node account IDs must be set to execute a cost query\n if (this._nodeAccountIds.isEmpty) {\n this._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute()\n );\n }\n\n if (COST_QUERY.length != 1) {\n throw new Error(\"CostQuery has not been loaded yet\");\n }\n\n // Change the timestamp. Should we be doing this?\n this._timestamp = Date.now();\n const cost = await COST_QUERY[0](this).execute(client);\n return _Hbar_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromTinybars(\n cost._valueInTinybar.multipliedBy(1.1).toFixed(0)\n );\n }\n\n /**\n * Set he payment transaction explicitly\n *\n * @param {TransactionId} paymentTransactionId\n * @returns {this}\n */\n setPaymentTransactionId(paymentTransactionId) {\n this._paymentTransactionId = paymentTransactionId;\n return this;\n }\n\n /**\n * Get the payment transaction ID\n *\n * @returns {?TransactionId}\n */\n get paymentTransactionId() {\n return this._paymentTransactionId;\n }\n\n /**\n * Get the current transaction ID, and make sure it's not null\n *\n * @returns {TransactionId}\n */\n _getTransactionId() {\n if (this._paymentTransactionId == null) {\n throw new Error(\n \"Query.PaymentTransactionId was not set duration execution\"\n );\n }\n\n return this._paymentTransactionId;\n }\n\n /**\n * Is payment required for this query. By default most queries require payment\n * so the default implementation returns true.\n *\n * @protected\n * @returns {boolean}\n */\n _isPaymentRequired() {\n return true;\n }\n\n /**\n * Validate checksums of the query.\n *\n * @param {Client} client\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function\n _validateChecksums(client) {\n // Shouldn't we be checking `paymentTransactionId` here sine it contains an `accountId`?\n // Do nothing\n }\n\n /**\n * Before we proceed exeuction, we need to do a couple checks\n *\n * @template MirrorChannelT\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async _beforeExecute(client) {\n // If we're executing this query multiple times the the payment transaction ID list\n // will already be set\n if (this._paymentTransactions.length > 0) {\n return;\n }\n\n // Check checksums if enabled\n if (client.isAutoValidateChecksumsEnabled()) {\n this._validateChecksums(client);\n }\n\n // If the nodes aren't set, set them.\n if (this._nodeAccountIds.isEmpty) {\n this._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute()\n );\n }\n\n // Save the operator\n this._operator =\n this._operator != null ? this._operator : client._operator;\n\n // If the payment transaction ID is not set\n if (this._paymentTransactionId == null) {\n // And payment is required\n if (this._isPaymentRequired()) {\n // And the client has an operator\n if (this._operator != null) {\n // Generate the payment transaction ID\n this._paymentTransactionId = _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].generate(\n this._operator.accountId\n );\n } else {\n // If payment is required, but an operator did not exist, throw an error\n throw new Error(\n \"`client` must have an `operator` or an explicit payment transaction must be provided\"\n );\n }\n } else {\n // If the payment transaction ID is not set, but this query doesn't require a payment\n // set the payment transaction ID to an empty transaction ID.\n // FIXME: Should use `TransactionId.withValidStart()` instead\n this._paymentTransactionId = _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].generate(\n new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](0)\n );\n }\n }\n\n let cost = new _Hbar_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](0);\n\n const maxQueryPayment =\n this._maxQueryPayment != null\n ? this._maxQueryPayment\n : client.maxQueryPayment;\n\n if (this._queryPayment != null) {\n cost = this._queryPayment;\n } else if (\n this._paymentTransactions.length === 0 &&\n this._isPaymentRequired()\n ) {\n // If the query payment was not explictly set, fetch the actual cost.\n const actualCost = await this.getCost(client);\n\n // Confirm it's less than max query payment\n if (\n maxQueryPayment.toTinybars().toInt() <\n actualCost.toTinybars().toInt()\n ) {\n throw new _MaxQueryPaymentExceeded_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"](actualCost, maxQueryPayment);\n }\n\n cost = actualCost;\n js_logger__WEBPACK_IMPORTED_MODULE_9__.debug(\n `[${this._getLogId()}] received cost for query ${cost.toString()}`\n );\n }\n\n // Set the either queried cost, or the original value back into `queryPayment`\n // in case a user executes same query multiple times. However, users should\n // really not be executing the same query multiple times meaning this is\n // typically not needed.\n this._queryPayment = cost;\n\n // Not sure if we should be overwritting this field tbh.\n this._timestamp = Date.now();\n\n this._nodeAccountIds.setLocked();\n\n // Generate the payment transactions\n for (const node of this._nodeAccountIds.list) {\n this._paymentTransactions.push(\n await _makePaymentTransaction(\n this._getLogId(),\n /** @type {import(\"../transaction/TransactionId.js\").default} */ (\n this._paymentTransactionId\n ),\n node,\n this._isPaymentRequired() ? this._operator : null,\n /** @type {Hbar} */ (this._queryPayment)\n )\n );\n }\n }\n\n /**\n * @abstract\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponseHeader(response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @protected\n * @returns {HashgraphProto.proto.IQueryHeader}\n */\n _makeRequestHeader() {\n /** @type {HashgraphProto.proto.IQueryHeader} */\n let header = {};\n\n if (this._isPaymentRequired() && this._paymentTransactions.length > 0) {\n header = {\n responseType: _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ResponseType.ANSWER_ONLY,\n payment: this._paymentTransactions[this._nodeAccountIds.index],\n };\n }\n\n return header;\n }\n\n /**\n * @abstract\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _onMakeRequest(header) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IQuery}\n */\n _makeRequest() {\n /** @type {HashgraphProto.proto.IQueryHeader} */\n let header = {};\n\n if (this._isPaymentRequired() && this._paymentTransactions != null) {\n header = {\n payment: this._paymentTransactions[this._nodeAccountIds.index],\n responseType: _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ResponseType.ANSWER_ONLY,\n };\n }\n\n return this._onMakeRequest(header);\n }\n\n /**\n * @override\n * @internal\n * @returns {Promise}\n */\n async _makeRequestAsync() {\n /** @type {HashgraphProto.proto.IQueryHeader} */\n let header = {\n responseType: _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ResponseType.ANSWER_ONLY,\n };\n\n if (this._isPaymentRequired() && this._paymentTransactions != null) {\n if (this._nodeAccountIds.locked) {\n header.payment =\n this._paymentTransactions[this._nodeAccountIds.index];\n } else {\n header.payment = await _makePaymentTransaction(\n this._getLogId(),\n /** @type {import(\"../transaction/TransactionId.js\").default} */ (\n this._paymentTransactionId\n ),\n this._nodeAccountIds.current,\n this._isPaymentRequired() ? this._operator : null,\n /** @type {Hbar} */ (this._queryPayment)\n );\n }\n }\n\n return this._onMakeRequest(header);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n const status = _Status_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ResponseCodeEnum.OK\n );\n\n js_logger__WEBPACK_IMPORTED_MODULE_9__.debug(\n `[${this._getLogId()}] received status ${status.toString()}`\n );\n\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].Busy:\n case _Status_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].Unknown:\n case _Status_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].PlatformTransactionNotCreated:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_3__.ExecutionState.Retry];\n case _Status_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].Ok:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_3__.ExecutionState.Finished];\n default:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_3__.ExecutionState.Error];\n }\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n const status = _Status_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ResponseCodeEnum.OK\n );\n\n return new _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]({\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult: null,\n });\n }\n\n /**\n * @param {HashgraphProto.proto.Query} request\n * @returns {Uint8Array}\n */\n _requestToBytes(request) {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.Query.encode(request).finish();\n }\n\n /**\n * @param {HashgraphProto.proto.Response} response\n * @returns {Uint8Array}\n */\n _responseToBytes(response) {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.Response.encode(response).finish();\n }\n}\n\n/**\n * Generate a payment transaction given, aka. `TransferTransaction`\n *\n * @param {string} logId\n * @param {TransactionId} paymentTransactionId\n * @param {AccountId} nodeId\n * @param {?ClientOperator} operator\n * @param {Hbar} paymentAmount\n * @returns {Promise}\n */\nasync function _makePaymentTransaction(\n logId,\n paymentTransactionId,\n nodeId,\n operator,\n paymentAmount\n) {\n js_logger__WEBPACK_IMPORTED_MODULE_9__.debug(\n `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`\n );\n const accountAmounts = [];\n\n // If an operator is provided then we should make sure we transfer\n // from the operator to the node.\n // If an operator is not provided we simply create an effectively\n // empty account amounts\n if (operator != null) {\n accountAmounts.push({\n accountID: operator.accountId._toProtobuf(),\n amount: paymentAmount.negated().toTinybars(),\n });\n accountAmounts.push({\n accountID: nodeId._toProtobuf(),\n amount: paymentAmount.toTinybars(),\n });\n } else {\n accountAmounts.push({\n accountID: new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](0)._toProtobuf(),\n // If the account ID is 0, shouldn't we just hard\n // code this value to 0? Same for the latter.\n amount: paymentAmount.negated().toTinybars(),\n });\n accountAmounts.push({\n accountID: nodeId._toProtobuf(),\n amount: paymentAmount.toTinybars(),\n });\n }\n /**\n * @type {HashgraphProto.proto.ITransactionBody}\n */\n const body = {\n transactionID: paymentTransactionId._toProtobuf(),\n nodeAccountID: nodeId._toProtobuf(),\n transactionFee: new _Hbar_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](1).toTinybars(),\n transactionValidDuration: {\n seconds: long__WEBPACK_IMPORTED_MODULE_8__.fromNumber(120),\n },\n cryptoTransfer: {\n transfers: {\n accountAmounts,\n },\n },\n };\n\n /** @type {HashgraphProto.proto.ISignedTransaction} */\n const signedTransaction = {\n bodyBytes: _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.TransactionBody.encode(body).finish(),\n };\n\n // Sign the transaction if an operator is provided\n //\n // We have _several_ places where we build the transactions, maybe this is\n // something we can deduplicate?\n if (operator != null) {\n const signature = await operator.transactionSigner(\n /** @type {Uint8Array} */ (signedTransaction.bodyBytes)\n );\n\n signedTransaction.sigMap = {\n sigPair: [operator.publicKey._toProtobufSignature(signature)],\n };\n }\n\n // Create and return a `proto.Transaction`\n return {\n signedTransactionBytes:\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.SignedTransaction.encode(\n signedTransaction\n ).finish(),\n };\n}\n\n/**\n * Cache for the cost query constructor. This prevents cyclic dependencies.\n *\n * @type {((query: Query<*>) => import(\"./CostQuery.js\").default<*>)[]}\n */\nconst COST_QUERY = [];\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/query/Query.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/schedule/ScheduleCreateTransaction.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/schedule/ScheduleCreateTransaction.js ***! - \*******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ScheduleCreateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IScheduleCreateTransactionBody} HashgraphProto.proto.IScheduleCreateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.ISignatureMap} HashgraphProto.proto.ISignatureMap\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../PrivateKey.js\").default} PrivateKey\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nclass ScheduleCreateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {Key} [props.adminKey]\n * @param {AccountId} [props.payerAccountID]\n * @param {string} [props.scheduleMemo]\n * @param {Timestamp} [props.expirationTime]\n * @param {boolean} [props.waitForExpiry]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Transaction}\n */\n this._scheduledTransaction = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._payerAccountId = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._scheduleMemo = null;\n\n /**\n * @private\n * @type {Set}\n */\n this._scheduledSignerPublicKeys = new Set();\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._waitForExpiry = null;\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.payerAccountID != null) {\n this.setPayerAccountId(props.payerAccountID);\n }\n\n if (props.scheduleMemo != null) {\n this.setScheduleMemo(props.scheduleMemo);\n }\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](5);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {ScheduleCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const create =\n /** @type {HashgraphProto.proto.IScheduleCreateTransactionBody} */ (\n body.scheduleCreate\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new ScheduleCreateTransaction({\n adminKey:\n create.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufKey(create.adminKey)\n : undefined,\n payerAccountID:\n create.payerAccountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n create.payerAccountID\n )\n )\n : undefined,\n scheduleMemo: create.memo != null ? create.memo : undefined,\n waitForExpiry:\n create.waitForExpiry != null\n ? create.waitForExpiry\n : undefined,\n expirationTime:\n create.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(create.expirationTime)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @internal\n * @param {Transaction} tx\n * @returns {this}\n */\n _setScheduledTransaction(tx) {\n this._scheduledTransaction = tx;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * Set the key for this account.\n *\n * This is the key that must sign each transfer out of the account.\n *\n * If `receiverSignatureRequired` is true, then the key must also sign\n * any transfer into the account.\n *\n * @param {Key} key\n * @returns {this}\n */\n setAdminKey(key) {\n this._requireNotFrozen();\n this._adminKey = key;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get payerAccountId() {\n return this._payerAccountId;\n }\n\n /**\n * @param {AccountId} account\n * @returns {this}\n */\n setPayerAccountId(account) {\n this._requireNotFrozen();\n this._payerAccountId = account;\n\n return this;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setScheduleMemo(memo) {\n this._requireNotFrozen();\n this._scheduleMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get getScheduleMemo() {\n this._requireNotFrozen();\n return this._scheduleMemo;\n }\n\n /**\n * @param {Transaction} transaction\n * @returns {this}\n */\n setScheduledTransaction(transaction) {\n this._requireNotFrozen();\n transaction._requireNotFrozen();\n\n this._scheduledTransaction =\n transaction.schedule()._scheduledTransaction;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._payerAccountId != null) {\n this._payerAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.schedule.createSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"scheduleCreate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IScheduleCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n payerAccountID:\n this._payerAccountId != null\n ? this._payerAccountId._toProtobuf()\n : null,\n scheduledTransactionBody:\n this._scheduledTransaction != null\n ? this._scheduledTransaction._getScheduledTransactionBody()\n : null,\n memo: this._scheduleMemo,\n waitForExpiry: this._waitForExpiry,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ScheduleCreateTransaction:${timestamp.toString()}`;\n }\n\n /**\n * @param {?Timestamp} expirationTime\n * @returns {this}\n */\n setExpirationTime(expirationTime) {\n this._expirationTime = expirationTime;\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n this._requireNotFrozen();\n return this._expirationTime;\n }\n\n /**\n * @param {boolean} waitForExpiry\n * @returns {this}\n */\n setWaitForExpiry(waitForExpiry) {\n this._waitForExpiry = waitForExpiry;\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get waitForExpiry() {\n this._requireNotFrozen();\n return this._waitForExpiry;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"scheduleCreate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ScheduleCreateTransaction._fromProtobuf\n);\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.SCHEDULE_CREATE_TRANSACTION.push(() => new ScheduleCreateTransaction());\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/schedule/ScheduleCreateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/schedule/ScheduleDeleteTransaction.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/schedule/ScheduleDeleteTransaction.js ***! - \*******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ScheduleDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ScheduleId.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IScheduleDeleteTransactionBody} HashgraphProto.proto.IScheduleDeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IScheduleID} HashgraphProto.proto.IScheduleID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"@hashgraph/cryptography\").Key} Key\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../Timestamp.js\").default} Timestamp\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nclass ScheduleDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {ScheduleId | string} [props.scheduleId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ScheduleId}\n */\n this._scheduleId = null;\n\n if (props.scheduleId != null) {\n this.setScheduleId(props.scheduleId);\n }\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](5);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {ScheduleDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const scheduleDelete =\n /** @type {HashgraphProto.proto.IScheduleDeleteTransactionBody} */ (\n body.scheduleDelete\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new ScheduleDeleteTransaction({\n scheduleId:\n scheduleDelete.scheduleID != null\n ? _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IScheduleID} */ (\n scheduleDelete.scheduleID\n )\n )\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?ScheduleId}\n */\n get scheduleId() {\n return this._scheduleId;\n }\n\n /**\n * @param {ScheduleId | string} scheduleId\n * @returns {this}\n */\n setScheduleId(scheduleId) {\n this._requireNotFrozen();\n this._scheduleId =\n typeof scheduleId === \"string\"\n ? _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(scheduleId)\n : scheduleId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._scheduleId != null) {\n this._scheduleId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.schedule.deleteSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"scheduleDelete\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IScheduleDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n scheduleID:\n this._scheduleId != null\n ? this._scheduleId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ScheduleDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"scheduleDelete\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ScheduleDeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/schedule/ScheduleDeleteTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ScheduleId; }\n/* harmony export */ });\n/* harmony import */ var _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../EntityIdHelper.js */ \"./node_modules/@hashgraph/sdk/src/EntityIdHelper.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"long\").Long} Long\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n *\n * @augments {EntityId}\n */\n\nclass ScheduleId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n */\n constructor(props, realm, num) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @param {string} text\n * @returns {ScheduleId}\n */\n static fromString(text) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromString(text);\n const id = new ScheduleId(result);\n id._checksum = result.checksum;\n return id;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IScheduleID} id\n * @returns {ScheduleId}\n */\n static _fromProtobuf(id) {\n const scheduleId = new ScheduleId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.scheduleNum != null ? id.scheduleNum : 0\n );\n\n return scheduleId;\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ScheduleId}\n */\n static fromBytes(bytes) {\n return ScheduleId._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.ScheduleID.decode(bytes)\n );\n }\n\n /**\n * @param {string} address\n * @returns {ScheduleId}\n */\n static fromSolidityAddress(address) {\n return new ScheduleId(..._EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromSolidityAddress(address));\n }\n\n /**\n * @returns {string}\n */\n toSolidityAddress() {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toSolidityAddress([this.shard, this.realm, this.num]);\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ScheduleID}\n */\n _toProtobuf() {\n return {\n scheduleNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.ScheduleID.encode(\n this._toProtobuf()\n ).finish();\n }\n\n /**\n * @returns {ScheduleId}\n */\n clone() {\n const id = new ScheduleId(this);\n id._checksum = this._checksum;\n return id;\n }\n\n /**\n * @param {ScheduleId} other\n * @returns {number}\n */\n compare(other) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.compare(\n [this.shard, this.realm, this.num],\n [other.shard, other.realm, other.num]\n );\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfo.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfo.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_4___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ScheduleInfo; }\n/* harmony export */ });\n/* harmony import */ var _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ScheduleId.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _KeyList_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../KeyList.js */ \"./node_modules/@hashgraph/sdk/src/KeyList.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\nconst { proto } = /*#__PURE__*/ (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_4___namespace_cache || (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_4___namespace_cache = __webpack_require__.t(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_4__, 2)));\n\n/**\n * Response when the client sends the node ScheduleGetInfoQuery.\n */\nclass ScheduleInfo {\n /**\n * @private\n * @param {object} props\n * @param {ScheduleId} props.scheduleId;\n * @param {?AccountId} props.creatorAccountID;\n * @param {?AccountId} props.payerAccountID;\n * @param {?HashgraphProto.proto.ISchedulableTransactionBody} props.schedulableTransactionBody;\n * @param {?Key} props.adminKey\n * @param {?KeyList} props.signers;\n * @param {?string} props.scheduleMemo;\n * @param {?Timestamp} props.expirationTime;\n * @param {?Timestamp} props.executed;\n * @param {?Timestamp} props.deleted;\n * @param {?TransactionId} props.scheduledTransactionId;\n * @param {boolean} props.waitForExpiry;\n */\n constructor(props) {\n /**\n * @readonly\n */\n this.scheduleId = props.scheduleId;\n\n /**\n * @readonly\n */\n this.creatorAccountId = props.creatorAccountID;\n\n /**\n * @readonly\n */\n this.payerAccountId = props.payerAccountID;\n\n /**\n * @readonly\n */\n this.schedulableTransactionBody = props.schedulableTransactionBody;\n\n /**\n * @readonly\n */\n this.signers = props.signers;\n\n /**\n * @readonly\n */\n this.scheduleMemo = props.scheduleMemo;\n\n /**\n * @readonly\n */\n this.adminKey = props.adminKey != null ? props.adminKey : null;\n\n /**\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * @readonly\n */\n this.executed = props.executed;\n\n /**\n * @readonly\n */\n this.deleted = props.deleted;\n\n /**\n * @readonly\n */\n this.scheduledTransactionId = props.scheduledTransactionId;\n\n /**\n *\n * @readonly\n */\n this.waitForExpiry = props.waitForExpiry;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IScheduleInfo} info\n * @returns {ScheduleInfo}\n */\n static _fromProtobuf(info) {\n return new ScheduleInfo({\n scheduleId: _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IScheduleID} */ (\n info.scheduleID\n )\n ),\n creatorAccountID:\n info.creatorAccountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n info.creatorAccountID\n )\n )\n : null,\n payerAccountID:\n info.payerAccountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n info.payerAccountID\n )\n )\n : null,\n schedulableTransactionBody:\n info.scheduledTransactionBody != null\n ? info.scheduledTransactionBody\n : null,\n adminKey:\n info.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobufKey(info.adminKey)\n : null,\n signers:\n info.signers != null\n ? _KeyList_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"].__fromProtobufKeyList(info.signers)\n : null,\n scheduleMemo: info.memo != null ? info.memo : null,\n expirationTime:\n info.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.expirationTime\n )\n )\n : null,\n executed:\n info.executionTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.executionTime\n )\n )\n : null,\n deleted:\n info.deletionTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.deletionTime\n )\n )\n : null,\n scheduledTransactionId:\n info.scheduledTransactionID != null\n ? _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobuf(info.scheduledTransactionID)\n : null,\n waitForExpiry:\n info.waitForExpiry != null ? info.waitForExpiry : false,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.IScheduleInfo}\n */\n _toProtobuf() {\n return {\n scheduleID:\n this.scheduleId != null ? this.scheduleId._toProtobuf() : null,\n creatorAccountID:\n this.creatorAccountId != null\n ? this.creatorAccountId._toProtobuf()\n : null,\n payerAccountID:\n this.payerAccountId != null\n ? this.payerAccountId._toProtobuf()\n : null,\n scheduledTransactionBody:\n this.schedulableTransactionBody != null\n ? this.schedulableTransactionBody\n : null,\n adminKey:\n this.adminKey != null ? this.adminKey._toProtobufKey() : null,\n signers:\n this.signers != null\n ? this.signers._toProtobufKey().keyList\n : null,\n memo: this.scheduleMemo != null ? this.scheduleMemo : \"\",\n expirationTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : null,\n scheduledTransactionID:\n this.scheduledTransactionId != null\n ? this.scheduledTransactionId._toProtobuf()\n : null,\n waitForExpiry: this.waitForExpiry,\n };\n }\n\n /**\n * @returns {Transaction}\n */\n get scheduledTransaction() {\n if (this.schedulableTransactionBody == null) {\n throw new Error(\"Scheduled transaction body is empty\");\n }\n\n const scheduled = new proto.SchedulableTransactionBody(\n this.schedulableTransactionBody\n );\n const data =\n /** @type {NonNullable} */ (\n scheduled.data\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromBytes(\n proto.TransactionList.encode({\n transactionList: [\n {\n signedTransactionBytes: proto.SignedTransaction.encode({\n bodyBytes: proto.TransactionBody.encode({\n transactionFee:\n this.schedulableTransactionBody\n .transactionFee,\n memo: this.schedulableTransactionBody.memo,\n [data]: scheduled[data],\n }).finish(),\n }).finish(),\n },\n ],\n }).finish()\n );\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfo.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfoQuery.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfoQuery.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ScheduleInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _ScheduleId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ScheduleId.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js\");\n/* harmony import */ var _ScheduleInfo_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ScheduleInfo.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfo.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IScheduleInfo} HashgraphProto.proto.IScheduleInfo\n * @typedef {import(\"@hashgraph/proto\").proto.IScheduleGetInfoQuery} HashgraphProto.proto.IScheduleGetInfoQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IScheduleGetInfoResponse} HashgraphProto.proto.IScheduleGetInfoResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * @augments {Query}\n */\nclass ScheduleInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} properties\n * @param {ScheduleId | string} [properties.scheduleId]\n */\n constructor(properties = {}) {\n super();\n\n /**\n * @private\n * @type {?ScheduleId}\n */\n this._scheduleId = null;\n\n if (properties.scheduleId != null) {\n this.setScheduleId(properties.scheduleId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {ScheduleInfoQuery}\n */\n static _fromProtobuf(query) {\n const info = /** @type {HashgraphProto.proto.IScheduleGetInfoQuery} */ (\n query.scheduleGetInfo\n );\n\n return new ScheduleInfoQuery({\n scheduleId:\n info.scheduleID != null\n ? _ScheduleId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.scheduleID)\n : undefined,\n });\n }\n\n /**\n * @returns {?ScheduleId}\n */\n get scheduleId() {\n return this._scheduleId;\n }\n\n /**\n *\n * @param {ScheduleId | string} scheduleId\n * @returns {ScheduleInfoQuery}\n */\n setScheduleId(scheduleId) {\n this._scheduleId =\n typeof scheduleId === \"string\"\n ? _ScheduleId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(scheduleId)\n : scheduleId.clone();\n\n return this;\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._scheduleId != null) {\n this._scheduleId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.schedule.getScheduleInfo(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const scheduleGetInfo =\n /** @type {HashgraphProto.proto.IScheduleGetInfoResponse} */ (\n response.scheduleGetInfo\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n scheduleGetInfo.header\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const info =\n /** @type {HashgraphProto.proto.IScheduleGetInfoResponse} */ (\n response.scheduleGetInfo\n );\n\n return Promise.resolve(\n _ScheduleInfo_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IScheduleInfo} */ (\n info.scheduleInfo\n )\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n scheduleGetInfo: {\n header,\n scheduleID:\n this._scheduleId != null\n ? this._scheduleId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `ScheduleInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"scheduleGetInfo\", ScheduleInfoQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/schedule/ScheduleInfoQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/schedule/ScheduleSignTransaction.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/schedule/ScheduleSignTransaction.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ ScheduleSignTransaction; }\n/* harmony export */ });\n/* harmony import */ var _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ScheduleId.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @typedef {object} ProtoSignaturePair\n * @property {(Uint8Array | null)=} pubKeyPrefix\n * @property {(Uint8Array | null)=} ed25519\n */\n\n/**\n * @typedef {object} ProtoSigMap\n * @property {(ProtoSignaturePair[] | null)=} sigPair\n */\n\n/**\n * @typedef {object} ProtoSignedTransaction\n * @property {(Uint8Array | null)=} bodyBytes\n * @property {(ProtoSigMap | null)=} sigMap\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IScheduleSignTransactionBody} HashgraphProto.proto.IScheduleSignTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.ISignatureMap} HashgraphProto.proto.ISignatureMap\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"@hashgraph/cryptography\").Key} Key\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../Timestamp.js\").default} Timestamp\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"@hashgraph/cryptography\").PublicKey} PublicKey\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nclass ScheduleSignTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {ScheduleId | string} [props.scheduleId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ScheduleId}\n */\n this._scheduleId = null;\n\n if (props.scheduleId != null) {\n this.setScheduleId(props.scheduleId);\n }\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](5);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {ScheduleSignTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const sign =\n /** @type {HashgraphProto.proto.IScheduleSignTransactionBody} */ (\n body.scheduleSign\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new ScheduleSignTransaction({\n scheduleId:\n sign.scheduleID != null\n ? _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(sign.scheduleID)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?ScheduleId}\n */\n get scheduleId() {\n return this._scheduleId;\n }\n\n /**\n * @param {ScheduleId | string} scheduleId\n * @returns {this}\n */\n setScheduleId(scheduleId) {\n this._requireNotFrozen();\n this._scheduleId =\n typeof scheduleId === \"string\"\n ? _ScheduleId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(scheduleId)\n : scheduleId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._scheduleId != null) {\n this._scheduleId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.schedule.signSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"scheduleSign\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IScheduleSignTransactionBody}\n */\n _makeTransactionData() {\n return {\n scheduleID:\n this._scheduleId != null\n ? this._scheduleId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ScheduleSignTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"scheduleSign\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ScheduleSignTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/schedule/ScheduleSignTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/system/FreezeTransaction.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/system/FreezeTransaction.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FreezeTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _FreezeType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../FreezeType.js */ \"./node_modules/@hashgraph/sdk/src/FreezeType.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IFreezeTransactionBody} HashgraphProto.proto.IFreezeTransactionBody\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * @typedef {object} HourMinute\n * @property {number} hour\n * @property {number} minute\n */\n\nclass FreezeTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {HourMinute} [props.startTime]\n * @param {HourMinute} [props.endTime]\n * @param {Timestamp} [props.startTimestamp]\n * @param {FileId} [props.updateFileId]\n * @param {FileId} [props.fileId]\n * @param {Uint8Array | string} [props.fileHash]\n * @param { FreezeType } [props.freezeType]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?HourMinute}\n */\n this._startTime = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._startTimestamp = null;\n\n /**\n * @private\n * @type {?HourMinute}\n */\n this._endTime = null;\n\n /**\n * @private\n * @type {?FileId}\n */\n this._fileId = null;\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._fileHash = null;\n\n /**\n * @private\n * @type {?FreezeType}\n */\n this._freezeType = null;\n\n if (props.startTime != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setStartTime(props.startTime.hour, props.startTime.minute);\n }\n\n if (props.endTime != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setEndTime(props.endTime.hour, props.endTime.minute);\n }\n\n if (props.startTimestamp != null) {\n this.setStartTimestamp(props.startTimestamp);\n }\n\n if (props.updateFileId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setUpdateFileId(props.updateFileId);\n }\n\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n\n if (props.fileHash != null) {\n this.setFileHash(props.fileHash);\n }\n\n if (props.freezeType != null) {\n this.setFreezeType(props.freezeType);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {FreezeTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const freeze =\n /** @type {HashgraphProto.proto.IFreezeTransactionBody} */ (\n body.freeze\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new FreezeTransaction({\n startTime:\n freeze.startHour != null && freeze.startMin != null\n ? {\n hour: freeze.startHour,\n minute: freeze.startMin,\n }\n : undefined,\n endTime:\n freeze.endHour != null && freeze.endMin != null\n ? {\n hour: freeze.endHour,\n minute: freeze.endMin,\n }\n : undefined,\n startTimestamp:\n freeze.startTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(freeze.startTime)\n : undefined,\n updateFileId:\n freeze.updateFile != null\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(freeze.updateFile)\n : undefined,\n fileHash: freeze.fileHash != null ? freeze.fileHash : undefined,\n freezeType:\n freeze.freezeType != null\n ? _FreezeType_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromCode(freeze.freezeType)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @deprecated - Use `startTimestamp` instead\n * @returns {?HourMinute}\n */\n get startTime() {\n return null;\n }\n\n /**\n * @deprecated - Use `startTimestamp` instead\n * @param {number | string} startHourOrString\n * @param {?number} startMinute\n * @returns {FreezeTransaction}\n */\n setStartTime(startHourOrString, startMinute) {\n this._requireNotFrozen();\n if (typeof startHourOrString === \"string\") {\n const split = startHourOrString.split(\":\");\n this._startTime = {\n hour: Number(split[0]),\n minute: Number(split[1]),\n };\n } else {\n this._startTime = {\n hour: startHourOrString,\n minute: /** @type {number} */ (startMinute),\n };\n }\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get startTimestamp() {\n return this._startTimestamp;\n }\n\n /**\n * @param {Timestamp} startTimestamp\n * @returns {FreezeTransaction}\n */\n setStartTimestamp(startTimestamp) {\n this._requireNotFrozen();\n this._startTimestamp = startTimestamp;\n\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?HourMinute}\n */\n get endTime() {\n console.warn(\"`FreezeTransaction.endTime` is deprecated\");\n return this._endTime;\n }\n\n /**\n * @deprecated\n * @param {number | string} endHourOrString\n * @param {?number} endMinute\n * @returns {FreezeTransaction}\n */\n setEndTime(endHourOrString, endMinute) {\n console.warn(\"`FreezeTransaction.endTime` is deprecated\");\n this._requireNotFrozen();\n if (typeof endHourOrString === \"string\") {\n const split = endHourOrString.split(\":\");\n this._endTime = {\n hour: Number(split[0]),\n minute: Number(split[1]),\n };\n } else {\n this._endTime = {\n hour: endHourOrString,\n minute: /** @type {number} */ (endMinute),\n };\n }\n\n return this;\n }\n\n /**\n * @deprecated - Use `fileId` instead\n * @returns {?FileId}\n */\n get updateFileId() {\n return this.fileId;\n }\n\n /**\n * @deprecated - Use `setFileId()` instead\n * @param {FileId} updateFileId\n * @returns {FreezeTransaction}\n */\n setUpdateFileId(updateFileId) {\n return this.setFileId(updateFileId);\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * @param {FileId} fileId\n * @returns {FreezeTransaction}\n */\n setFileId(fileId) {\n this._requireNotFrozen();\n this._fileId = fileId;\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get fileHash() {\n return this._fileHash;\n }\n\n /**\n * @param {Uint8Array | string} fileHash\n * @returns {FreezeTransaction}\n */\n setFileHash(fileHash) {\n this._requireNotFrozen();\n this._fileHash =\n typeof fileHash === \"string\" ? _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.decode(fileHash) : fileHash;\n\n return this;\n }\n\n /**\n * @returns {?FreezeType}\n */\n get freezeType() {\n return this._freezeType;\n }\n\n /**\n * @param {FreezeType} freezeType\n * @returns {FreezeTransaction}\n */\n setFreezeType(freezeType) {\n this._requireNotFrozen();\n this._freezeType = freezeType;\n return this;\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"freeze\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IFreezeTransactionBody}\n */\n _makeTransactionData() {\n return {\n startTime:\n this._startTimestamp != null\n ? this._startTimestamp._toProtobuf()\n : null,\n updateFile:\n this._fileId != null ? this._fileId._toProtobuf() : null,\n fileHash: this._fileHash,\n freezeType:\n this._freezeType != null ? this._freezeType.valueOf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `FreezeTransaction:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\"freeze\", FreezeTransaction._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/system/FreezeTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/system/SystemDeleteTransaction.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/system/SystemDeleteTransaction.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SystemDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../contract/ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ISystemDeleteTransactionBody} HashgraphProto.proto.ISystemDeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HashgraphProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\nclass SystemDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.fileId]\n * @param {ContractId | string} [props.contractId]\n * @param {Timestamp} [props.expirationTime]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._fileId = null;\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {SystemDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const systemDelete =\n /** @type {HashgraphProto.proto.ISystemDeleteTransactionBody} */ (\n body.systemDelete\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new SystemDeleteTransaction({\n fileId:\n systemDelete.fileID != null\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IFileID} */ (\n systemDelete.fileID\n )\n )\n : undefined,\n contractId:\n systemDelete.contractID != null\n ? _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n systemDelete.contractID\n )\n )\n : undefined,\n expirationTime:\n systemDelete.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(systemDelete.expirationTime)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * @param {FileId | string} fileId\n * @returns {this}\n */\n setFileId(fileId) {\n this._requireNotFrozen();\n this._fileId =\n fileId instanceof _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] ? fileId : _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(fileId);\n\n return this;\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * @param {ContractId | string} contractId\n * @returns {this}\n */\n setContractId(contractId) {\n this._requireNotFrozen();\n this._contractId =\n contractId instanceof _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? contractId\n : _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(contractId);\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * @param {Timestamp} expirationTime\n * @returns {SystemDeleteTransaction}\n */\n setExpirationTime(expirationTime) {\n this._requireNotFrozen();\n this._expirationTime = expirationTime;\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n if (this._fileId != null) {\n return channel.file.systemDelete(request);\n } else {\n return channel.smartContract.systemDelete(request);\n }\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"systemDelete\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ISystemDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n fileID: this._fileId != null ? this._fileId._toProtobuf() : null,\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `SystemDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\"systemDelete\", SystemDeleteTransaction._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/system/SystemDeleteTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/system/SystemUndeleteTransaction.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/system/SystemUndeleteTransaction.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SystemUndeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../contract/ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ISystemUndeleteTransactionBody} HashgraphProto.proto.ISystemUndeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HashgraphProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HashgraphProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../Timestamp.js\").default} Timestamp\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\nclass SystemUndeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.fileId]\n * @param {ContractId | string} [props.contractId]\n * @param {Timestamp} [props.expirationTime]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._fileId = null;\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n\n if (props.fileId != null) {\n this.setFileId(props.fileId);\n }\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {SystemUndeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const systemUndelete =\n /** @type {HashgraphProto.proto.ISystemUndeleteTransactionBody} */ (\n body.systemUndelete\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new SystemUndeleteTransaction({\n fileId:\n systemUndelete.fileID != null\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IFileID} */ (\n systemUndelete.fileID\n )\n )\n : undefined,\n contractId:\n systemUndelete.contractID != null\n ? _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IContractID} */ (\n systemUndelete.contractID\n )\n )\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get fileId() {\n return this._fileId;\n }\n\n /**\n * @param {FileId | string} fileId\n * @returns {this}\n */\n setFileId(fileId) {\n this._requireNotFrozen();\n this._fileId =\n fileId instanceof _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] ? fileId : _file_FileId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(fileId);\n\n return this;\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * @param {ContractId | string} contractId\n * @returns {this}\n */\n setContractId(contractId) {\n this._requireNotFrozen();\n this._contractId =\n contractId instanceof _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? contractId\n : _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(contractId);\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n if (this._fileId != null) {\n return channel.file.systemUndelete(request);\n } else {\n return channel.smartContract.systemUndelete(request);\n }\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"systemUndelete\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ISystemUndeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n fileID: this._fileId != null ? this._fileId._toProtobuf() : null,\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `SystemUndeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"systemUndelete\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n SystemUndeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/system/SystemUndeleteTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/AssessedCustomFee.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/AssessedCustomFee.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ AssessedCustomFee; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IAssessedCustomFee} HashgraphProto.proto.IAssessedCustomFee\n */\n\nclass AssessedCustomFee {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.feeCollectorAccountId]\n * @param {TokenId | string} [props.tokenId]\n * @param {Long | number} [props.amount]\n * @param {AccountId[]} [props.payerAccountIds]\n */\n constructor(props = {}) {\n /**\n * @type {?AccountId}\n */\n this._feeCollectorAccountId = null;\n\n if (props.feeCollectorAccountId != null) {\n this.setFeeCollectorAccountId(props.feeCollectorAccountId);\n }\n\n /**\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n /**\n * @type {?Long}\n */\n this._amount = null;\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n /**\n * @type {?AccountId[]}\n */\n this._payerAccountIds = null;\n\n if (props.payerAccountIds != null) {\n this.setPayerAccountIds(props.payerAccountIds);\n }\n }\n\n /**\n * @returns {?AccountId}\n */\n get feeCollectorAccountId() {\n return this._feeCollectorAccountId;\n }\n\n /**\n * @param {AccountId | string} feeCollectorAccountId\n * @returns {this}\n */\n setFeeCollectorAccountId(feeCollectorAccountId) {\n this._feeCollectorAccountId =\n typeof feeCollectorAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(feeCollectorAccountId)\n : feeCollectorAccountId;\n return this;\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._tokenId =\n typeof tokenId === \"string\" ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId) : tokenId;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {AssessedCustomFee}\n */\n setAmount(amount) {\n this._amount =\n typeof amount === \"number\" ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(amount) : amount;\n return this;\n }\n\n /**\n * @returns {?AccountId[]}\n */\n get payerAccountIds() {\n return this._payerAccountIds;\n }\n\n /**\n * @param {AccountId[]} payerAccountIds\n * @returns {AssessedCustomFee}\n */\n setPayerAccountIds(payerAccountIds) {\n this._payerAccountIds = payerAccountIds;\n return this;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IAssessedCustomFee} fee\n * @returns {AssessedCustomFee}\n */\n static _fromProtobuf(fee) {\n return new AssessedCustomFee({\n feeCollectorAccountId:\n fee.feeCollectorAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(fee.feeCollectorAccountId)\n : undefined,\n tokenId:\n fee.tokenId != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(fee.tokenId)\n : undefined,\n amount: fee.amount != null ? fee.amount : undefined,\n payerAccountIds:\n fee.effectivePayerAccountId != null\n ? fee.effectivePayerAccountId.map((id) =>\n _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(id)\n )\n : undefined,\n });\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HashgraphProto.proto.IAssessedCustomFee}\n */\n _toProtobuf() {\n return {\n feeCollectorAccountId:\n this.feeCollectorAccountId != null\n ? this.feeCollectorAccountId._toProtobuf()\n : null,\n tokenId: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n amount: this._amount,\n effectivePayerAccountId:\n this._payerAccountIds != null\n ? this._payerAccountIds.map((id) => id._toProtobuf())\n : null,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/AssessedCustomFee.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/CustomFee.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/CustomFee.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ CustomFee; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ICustomFee} HashgraphProto.proto.ICustomFee\n */\n\nclass CustomFee {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.feeCollectorAccountId]\n * @param {boolean} [props.allCollectorsAreExempt]\n */\n constructor(props = {}) {\n /**\n * @type {?AccountId}\n */\n this._feeCollectorAccountId = null;\n\n this._allCollectorsAreExempt = false;\n\n if (props.feeCollectorAccountId != null) {\n this.setFeeCollectorAccountId(props.feeCollectorAccountId);\n }\n\n if (props.allCollectorsAreExempt != null) {\n this.setAllCollectorsAreExempt(props.allCollectorsAreExempt);\n }\n }\n\n /**\n * @returns {?AccountId}\n */\n get feeCollectorAccountId() {\n return this._feeCollectorAccountId;\n }\n\n /**\n * @param {AccountId | string} feeCollectorAccountId\n * @returns {this}\n */\n setFeeCollectorAccountId(feeCollectorAccountId) {\n this._feeCollectorAccountId =\n typeof feeCollectorAccountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(feeCollectorAccountId)\n : feeCollectorAccountId;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get allCollectorsAreExempt() {\n return this._allCollectorsAreExempt;\n }\n\n /**\n * @param {boolean} allCollectorsAreExempt\n * @returns {this}\n */\n setAllCollectorsAreExempt(allCollectorsAreExempt) {\n this._allCollectorsAreExempt = allCollectorsAreExempt;\n return this;\n }\n\n /**\n * @internal\n * @abstract\n * @param {HashgraphProto.proto.ICustomFee} info\n * @returns {CustomFee}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _fromProtobuf(info) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HashgraphProto.proto.ICustomFee}\n */\n _toProtobuf() {\n throw new Error(\"not implemented\");\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/CustomFee.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ CustomFixedFee; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _CustomFee_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CustomFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFee.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ICustomFee} HashgraphProto.proto.ICustomFee\n * @typedef {import(\"@hashgraph/proto\").proto.IFixedFee} HashgraphProto.proto.IFixedFee\n */\n\nclass CustomFixedFee extends _CustomFee_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.feeCollectorAccountId]\n * @param {boolean} [props.allCollectorsAreExempt]\n * @param {TokenId | string} [props.denominatingTokenId]\n * @param {Long | number} [props.amount]\n */\n constructor(props = {}) {\n super(props);\n\n /**\n * @type {?TokenId}\n */\n this._denominatingTokenId = null;\n\n if (props.denominatingTokenId != null) {\n this.setDenominatingTokenId(props.denominatingTokenId);\n }\n\n /**\n * @type {?Long}\n */\n this._amount = null;\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n }\n\n /**\n * @param {Hbar} amount\n * @returns {CustomFixedFee}\n */\n setHbarAmount(amount) {\n this._amount = amount.toTinybars();\n this._denominatingTokenId = null;\n return this;\n }\n\n /**\n * @returns {TokenId | Hbar | null}\n */\n get hbarAmount() {\n return this._denominatingTokenId != null\n ? null\n : _Hbar_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromTinybars(this._amount != null ? this._amount : 0);\n }\n\n /**\n * @returns {CustomFixedFee}\n */\n setDenominatingTokenToSameToken() {\n this._denominatingTokenId = new _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](0, 0, 0);\n return this;\n }\n\n /**\n * @returns {?TokenId}\n */\n get denominatingTokenId() {\n return this._denominatingTokenId;\n }\n\n /**\n * @param {TokenId | string} denominatingTokenId\n * @returns {CustomFixedFee}\n */\n setDenominatingTokenId(denominatingTokenId) {\n this._denominatingTokenId =\n typeof denominatingTokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(denominatingTokenId)\n : denominatingTokenId;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {CustomFixedFee}\n */\n setAmount(amount) {\n this._amount =\n typeof amount === \"number\" ? long__WEBPACK_IMPORTED_MODULE_3__.fromNumber(amount) : amount;\n return this;\n }\n\n /**\n * @internal\n * @override\n * @param {HashgraphProto.proto.ICustomFee} info\n * @returns {CustomFee}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _fromProtobuf(info) {\n const fee = /** @type {HashgraphProto.proto.IFixedFee} */ (\n info.fixedFee\n );\n\n return new CustomFixedFee({\n feeCollectorAccountId:\n info.feeCollectorAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(info.feeCollectorAccountId)\n : undefined,\n allCollectorsAreExempt:\n info.allCollectorsAreExempt != null\n ? info.allCollectorsAreExempt\n : undefined,\n denominatingTokenId:\n fee.denominatingTokenId != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(fee.denominatingTokenId)\n : undefined,\n amount: fee.amount != null ? fee.amount : undefined,\n });\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HashgraphProto.proto.ICustomFee}\n */\n _toProtobuf() {\n return {\n feeCollectorAccountId:\n this.feeCollectorAccountId != null\n ? this.feeCollectorAccountId._toProtobuf()\n : null,\n allCollectorsAreExempt: this.allCollectorsAreExempt,\n fixedFee: {\n denominatingTokenId:\n this._denominatingTokenId != null\n ? this._denominatingTokenId._toProtobuf()\n : null,\n amount: this._amount,\n },\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ CustomFractionalFee; }\n/* harmony export */ });\n/* harmony import */ var _CustomFee_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CustomFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFee.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @typedef {import(\"./FeeAssessmentMethod.js\").default} FeeAssessmentMethod\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ICustomFee} HashgraphProto.proto.ICustomFee\n * @typedef {import(\"@hashgraph/proto\").proto.IFractionalFee} HashgraphProto.proto.IFractionalFee\n * @typedef {import(\"@hashgraph/proto\").proto.IFraction} HashgraphProto.proto.IFraction\n */\n\nclass CustomFractionalFee extends _CustomFee_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.feeCollectorAccountId]\n * @param {boolean} [props.allCollectorsAreExempt]\n * @param {Long | number} [props.numerator]\n * @param {Long | number} [props.denominator]\n * @param {Long | number} [props.min]\n * @param {Long | number} [props.max]\n * @param {FeeAssessmentMethod} [props.assessmentMethod]\n */\n constructor(props = {}) {\n super(props);\n\n /**\n * @type {?Long}\n */\n this._numerator = null;\n\n if (props.numerator != null) {\n this.setNumerator(props.numerator);\n }\n\n /**\n * @type {?Long}\n */\n this._denominator = null;\n\n if (props.denominator != null) {\n this.setDenominator(props.denominator);\n }\n\n /**\n * @type {?Long}\n */\n this._min = null;\n\n if (props.min != null) {\n this.setMin(props.min);\n }\n\n /**\n * @type {?Long}\n */\n this._max;\n\n if (props.max != null) {\n this.setMax(props.max);\n }\n\n /**\n * @type {?FeeAssessmentMethod}\n */\n this._assessmentMethod;\n\n if (props.assessmentMethod != null) {\n this.setAssessmentMethod(props.assessmentMethod);\n }\n }\n\n /**\n * @returns {?Long}\n */\n get numerator() {\n return this._numerator;\n }\n\n /**\n * @param {Long | number} numerator\n * @returns {CustomFractionalFee}\n */\n setNumerator(numerator) {\n this._numerator =\n typeof numerator === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(numerator)\n : numerator;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get denominator() {\n return this._denominator;\n }\n\n /**\n * @param {Long | number} denominator\n * @returns {CustomFractionalFee}\n */\n setDenominator(denominator) {\n this._denominator =\n typeof denominator === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(denominator)\n : denominator;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get min() {\n return this._min;\n }\n\n /**\n * @param {Long | number} min\n * @returns {CustomFractionalFee}\n */\n setMin(min) {\n this._min = typeof min === \"number\" ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(min) : min;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get max() {\n return this._max;\n }\n\n /**\n * @param {Long | number} max\n * @returns {CustomFractionalFee}\n */\n setMax(max) {\n this._max = typeof max === \"number\" ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(max) : max;\n return this;\n }\n\n /**\n * @returns {?FeeAssessmentMethod}\n */\n get assessmentMethod() {\n return this._assessmentMethod;\n }\n\n /**\n * @param {FeeAssessmentMethod} assessmentMethod\n * @returns {CustomFractionalFee}\n */\n setAssessmentMethod(assessmentMethod) {\n this._assessmentMethod = assessmentMethod;\n return this;\n }\n\n /**\n * @internal\n * @override\n * @param {HashgraphProto.proto.ICustomFee} info\n * @returns {CustomFee}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _fromProtobuf(info) {\n const fee = /** @type {HashgraphProto.proto.IFractionalFee} */ (\n info.fractionalFee\n );\n const fractional = /** @type {HashgraphProto.proto.IFraction} */ (\n fee.fractionalAmount\n );\n\n return new CustomFractionalFee({\n feeCollectorAccountId:\n info.feeCollectorAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.feeCollectorAccountId)\n : undefined,\n allCollectorsAreExempt:\n info.allCollectorsAreExempt != null\n ? info.allCollectorsAreExempt\n : undefined,\n numerator:\n fractional.numerator != null ? fractional.numerator : undefined,\n denominator:\n fractional.denominator != null\n ? fractional.denominator\n : undefined,\n min: fee.minimumAmount != null ? fee.minimumAmount : undefined,\n max: fee.maximumAmount != null ? fee.maximumAmount : undefined,\n });\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HashgraphProto.proto.ICustomFee}\n */\n _toProtobuf() {\n return {\n feeCollectorAccountId:\n this.feeCollectorAccountId != null\n ? this.feeCollectorAccountId._toProtobuf()\n : null,\n allCollectorsAreExempt: this.allCollectorsAreExempt,\n fractionalFee: {\n fractionalAmount: {\n numerator: this._numerator,\n denominator: this._denominator,\n },\n minimumAmount: this._min,\n maximumAmount: this._max,\n },\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ CustomRoyalyFee; }\n/* harmony export */ });\n/* harmony import */ var _CustomFee_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CustomFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFee.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CustomFixedFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IFraction} HashgraphProto.proto.IFraction\n * @typedef {import(\"@hashgraph/proto\").proto.IRoyaltyFee} HashgraphProto.proto.IRoyaltyFee\n * @typedef {import(\"@hashgraph/proto\").proto.ICustomFee} HashgraphProto.proto.ICustomFee\n * @typedef {import(\"@hashgraph/proto\").proto.IFixedFee} HashgraphProto.proto.IFixedFee\n */\n\nclass CustomRoyalyFee extends _CustomFee_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.feeCollectorAccountId]\n * @param {boolean} [props.allCollectorsAreExempt]\n * @param {Long | number} [props.numerator]\n * @param {Long | number} [props.denominator]\n * @param {CustomFixedFee} [props.fallbackFee]\n */\n constructor(props = {}) {\n super(props);\n\n /**\n * @type {?CustomFixedFee}\n */\n this._fallbackFee = null;\n\n if (props.fallbackFee != null) {\n this.setFallbackFee(props.fallbackFee);\n }\n\n /**\n * @type {?Long}\n */\n this._numerator = null;\n\n if (props.numerator != null) {\n this.setNumerator(props.numerator);\n }\n\n /**\n * @type {?Long}\n */\n this._denominator = null;\n\n if (props.denominator != null) {\n this.setDenominator(props.denominator);\n }\n }\n\n /**\n * @returns {?CustomFixedFee}\n */\n get fallbackFee() {\n return this._fallbackFee;\n }\n\n /**\n * @param {CustomFixedFee} fallbackFee\n * @returns {CustomRoyalyFee}\n */\n setFallbackFee(fallbackFee) {\n this._fallbackFee = fallbackFee;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get numerator() {\n return this._numerator;\n }\n\n /**\n * @param {Long | number} numerator\n * @returns {CustomRoyalyFee}\n */\n setNumerator(numerator) {\n this._numerator =\n typeof numerator === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(numerator)\n : numerator;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get denominator() {\n return this._denominator;\n }\n\n /**\n * @param {Long | number} denominator\n * @returns {CustomRoyalyFee}\n */\n setDenominator(denominator) {\n this._denominator =\n typeof denominator === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(denominator)\n : denominator;\n return this;\n }\n\n /**\n * @internal\n * @override\n * @param {HashgraphProto.proto.ICustomFee} info\n * @returns {CustomFee}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _fromProtobuf(info) {\n const fee = /** @type {HashgraphProto.proto.IRoyaltyFee} */ (\n info.royaltyFee\n );\n const fraction = /** @type {HashgraphProto.proto.IFraction} */ (\n fee.exchangeValueFraction\n );\n\n return new CustomRoyalyFee({\n feeCollectorAccountId:\n info.feeCollectorAccountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.feeCollectorAccountId)\n : undefined,\n allCollectorsAreExempt:\n info.allCollectorsAreExempt != null\n ? info.allCollectorsAreExempt\n : undefined,\n fallbackFee:\n fee.fallbackFee != null\n ? /** @type {CustomFixedFee} */ (\n _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf({\n fixedFee: fee.fallbackFee,\n })\n )\n : undefined,\n numerator:\n fraction.numerator != null ? fraction.numerator : undefined,\n denominator:\n fraction.denominator != null ? fraction.denominator : undefined,\n });\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HashgraphProto.proto.ICustomFee}\n */\n _toProtobuf() {\n return {\n feeCollectorAccountId:\n this.feeCollectorAccountId != null\n ? this.feeCollectorAccountId._toProtobuf()\n : null,\n allCollectorsAreExempt: this.allCollectorsAreExempt,\n royaltyFee: {\n exchangeValueFraction: {\n numerator: this._numerator,\n denominator: this._denominator,\n },\n fallbackFee:\n this._fallbackFee != null\n ? this._fallbackFee._toProtobuf().fixedFee\n : null,\n },\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/FeeAssessmentMethod.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/FeeAssessmentMethod.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ FeeAssessmentMethod; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\nclass FeeAssessmentMethod {\n /**\n * @hideconstructor\n * @internal\n * @param {boolean} value\n */\n constructor(value) {\n /** @readonly */\n this._value = value;\n\n Object.freeze(this);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case FeeAssessmentMethod.Inclusive:\n return \"INCLUSIVE\";\n case FeeAssessmentMethod.Exclusive:\n return \"EXCLUSIVE\";\n default:\n return `UNKNOWN (${this._value.toString()})`;\n }\n }\n\n /**\n * @internal\n * @param {boolean} value\n * @returns {FeeAssessmentMethod}\n */\n static _fromValue(value) {\n switch (value) {\n case false:\n return FeeAssessmentMethod.Inclusive;\n case true:\n return FeeAssessmentMethod.Exclusive;\n }\n }\n\n /**\n * @returns {boolean}\n */\n valueOf() {\n return this._value;\n }\n}\n\nFeeAssessmentMethod.Inclusive = new FeeAssessmentMethod(false);\nFeeAssessmentMethod.Exclusive = new FeeAssessmentMethod(true);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/FeeAssessmentMethod.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/NftId.js": -/*!********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/NftId.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ NftId; }\n/* harmony export */ });\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * The ID for a crypto-currency token on Hedera.\n *\n * @augments {EntityId}\n */\nclass NftId {\n /**\n * @param {TokenId} token\n * @param {number | Long} serial\n */\n constructor(token, serial) {\n this.tokenId = token;\n this.serial =\n typeof serial === \"number\" ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(serial) : serial;\n\n Object.freeze(this);\n }\n\n /**\n * @param {string} text\n * @returns {NftId}\n */\n static fromString(text) {\n const strings =\n text.split(\"/\").length > 1 ? text.split(\"/\") : text.split(\"@\");\n\n for (const string of strings) {\n if (string === \"\") {\n throw new Error(\n \"invalid format for NftId: use [token]/[serial] or [token]@[serial]\"\n );\n }\n }\n\n const token = _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(strings[0]);\n const serial = long__WEBPACK_IMPORTED_MODULE_2__.fromString(strings[1]);\n\n return new NftId(token, serial);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.INftID} id\n * @returns {NftId}\n */\n static _fromProtobuf(id) {\n return new NftId(\n _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (id.tokenID)\n ),\n id.serialNumber != null ? id.serialNumber : long__WEBPACK_IMPORTED_MODULE_2__.ZERO\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {NftId}\n */\n static fromBytes(bytes) {\n return NftId._fromProtobuf(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.NftID.decode(bytes));\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.INftID}\n */\n _toProtobuf() {\n return {\n tokenID: this.tokenId._toProtobuf(),\n serialNumber: long__WEBPACK_IMPORTED_MODULE_2__.fromValue(\n this.serial !== undefined ? this.serial : 0\n ),\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.tokenId.toString()}/${this.serial.toString()}`;\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_0__.proto.NftID.encode(this._toProtobuf()).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/NftId.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenAssociateTransaction.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenAssociateTransaction.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenAssociateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenAssociateTransactionBody} HashgraphProto.proto.ITokenAssociateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Associate a new Hedera™ crypto-currency token.\n */\nclass TokenAssociateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {(TokenId | string)[]} [props.tokenIds]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId[]}\n */\n this._tokenIds = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](5);\n\n if (props.tokenIds != null) {\n this.setTokenIds(props.tokenIds);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenAssociateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const associateToken =\n /** @type {HashgraphProto.proto.ITokenAssociateTransactionBody} */ (\n body.tokenAssociate\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufTransactions(\n new TokenAssociateTransaction({\n tokenIds:\n associateToken.tokens != null\n ? associateToken.tokens.map((token) =>\n _TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(token)\n )\n : undefined,\n accountId:\n associateToken.account != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(associateToken.account)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId[]}\n */\n get tokenIds() {\n return this._tokenIds;\n }\n\n /**\n * @param {(TokenId | string)[]} tokenIds\n * @returns {this}\n */\n setTokenIds(tokenIds) {\n this._requireNotFrozen();\n this._tokenIds = tokenIds.map((tokenId) =>\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenId)\n : tokenId.clone()\n );\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n\n for (const tokenId of this._tokenIds != null ? this._tokenIds : []) {\n if (tokenId != null) {\n tokenId.validateChecksum(client);\n }\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.associateTokens(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenAssociate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenAssociateTransactionBody}\n */\n _makeTransactionData() {\n return {\n tokens:\n this._tokenIds != null\n ? this._tokenIds.map((tokenId) => tokenId._toProtobuf())\n : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenAssociateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__.TRANSACTION_REGISTRY.set(\n \"tokenAssociate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenAssociateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenAssociateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenAssociation.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenAssociation.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenAssociation; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenAssociation} HashgraphProto.proto.ITokenAssociation\n */\n\nclass TokenAssociation {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.accountId]\n * @param {TokenId | string} [props.tokenId]\n */\n constructor(props = {}) {\n /**\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n /**\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](5);\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(accountId)\n : accountId;\n return this;\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._tokenId =\n typeof tokenId === \"string\" ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenId) : tokenId;\n return this;\n }\n\n /**\n * @internal\n * @abstract\n * @param {HashgraphProto.proto.ITokenAssociation} association\n * @returns {TokenAssociation}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _fromProtobuf(association) {\n return new TokenAssociation({\n accountId:\n association.accountId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(association.accountId)\n : undefined,\n tokenId:\n association.tokenId != null\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(association.tokenId)\n : undefined,\n });\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HashgraphProto.proto.ITokenAssociation}\n */\n _toProtobuf() {\n return {\n accountId:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : undefined,\n tokenId:\n this._tokenId != null ? this._tokenId._toProtobuf() : undefined,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenAssociation.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenBurnTransaction.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenBurnTransaction.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenBurnTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBurnTransactionBody} HashgraphProto.proto.ITokenBurnTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Burn a new Hedera™ crypto-currency token.\n */\nclass TokenBurnTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {Long | number} [props.amount]\n * @param {(Long | number)[]} [props.serials]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._amount = null;\n\n /**\n * @private\n * @type {Long[]}\n */\n this._serials = [];\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n if (props.serials != null) {\n this.setSerials(props.serials);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenBurnTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const burnToken =\n /** @type {HashgraphProto.proto.ITokenBurnTransactionBody} */ (\n body.tokenBurn\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenBurnTransaction({\n tokenId:\n burnToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(burnToken.token)\n : undefined,\n amount: burnToken.amount != null ? burnToken.amount : undefined,\n serials:\n burnToken.serialNumbers != null\n ? burnToken.serialNumbers\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {this}\n */\n setAmount(amount) {\n this._requireNotFrozen();\n this._amount = amount instanceof long__WEBPACK_IMPORTED_MODULE_2__ ? amount : long__WEBPACK_IMPORTED_MODULE_2__.fromValue(amount);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {Long[]}\n */\n get serials() {\n return this._serials;\n }\n\n /**\n * @param {(Long | number)[]} serials\n * @returns {this}\n */\n setSerials(serials) {\n this._requireNotFrozen();\n this._serials = serials.map((serial) =>\n serial instanceof long__WEBPACK_IMPORTED_MODULE_2__ ? serial : long__WEBPACK_IMPORTED_MODULE_2__.fromValue(serial)\n );\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.burnToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenBurn\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenBurnTransactionBody}\n */\n _makeTransactionData() {\n return {\n amount: this._amount,\n serialNumbers: this._serials,\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenBurnTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenBurn\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenBurnTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenBurnTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenCreateTransaction.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenCreateTransaction.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenCreateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CustomFixedFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js\");\n/* harmony import */ var _CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./CustomFractionalFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js\");\n/* harmony import */ var _CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./CustomRoyaltyFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js\");\n/* harmony import */ var _TokenType_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TokenType.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenType.js\");\n/* harmony import */ var _TokenSupplyType_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./TokenSupplyType.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenSupplyType.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenCreateTransactionBody} HashgraphProto.proto.ITokenCreateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./CustomFee.js\").default} CustomFee\n */\n\n/**\n * Create a new Hedera™ crypto-currency token.\n */\nclass TokenCreateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {string} [props.tokenName]\n * @param {string} [props.tokenSymbol]\n * @param {Long | number} [props.decimals]\n * @param {Long | number} [props.initialSupply]\n * @param {AccountId | string} [props.treasuryAccountId]\n * @param {Key} [props.adminKey]\n * @param {Key} [props.kycKey]\n * @param {Key} [props.freezeKey]\n * @param {Key} [props.pauseKey]\n * @param {Key} [props.wipeKey]\n * @param {Key} [props.supplyKey]\n * @param {Key} [props.feeScheduleKey]\n * @param {boolean} [props.freezeDefault]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {string} [props.tokenMemo]\n * @param {CustomFee[]} [props.customFees]\n * @param {TokenType} [props.tokenType]\n * @param {TokenSupplyType} [props.supplyType]\n * @param {Long | number} [props.maxSupply]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenName = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenSymbol = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._decimals = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._initialSupply = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._treasuryAccountId = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._kycKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._freezeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._pauseKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._wipeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._supplyKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._feeScheduleKey = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._freezeDefault = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?Duration}\n */\n this._autoRenewPeriod = new _Duration_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenMemo = null;\n\n /**\n * @private\n * @type {CustomFee[]}\n */\n this._customFees = [];\n\n /**\n * @private\n * @type {?TokenType}\n */\n this._tokenType = null;\n\n /**\n * @private\n * @type {?TokenSupplyType}\n */\n this._supplyType = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._maxSupply = null;\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](30);\n\n if (props.tokenName != null) {\n this.setTokenName(props.tokenName);\n }\n\n if (props.tokenSymbol != null) {\n this.setTokenSymbol(props.tokenSymbol);\n }\n\n if (props.decimals != null) {\n this.setDecimals(props.decimals);\n }\n\n if (props.initialSupply != null) {\n this.setInitialSupply(props.initialSupply);\n }\n\n if (props.treasuryAccountId != null) {\n this.setTreasuryAccountId(props.treasuryAccountId);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.kycKey != null) {\n this.setKycKey(props.kycKey);\n }\n\n if (props.freezeKey != null) {\n this.setFreezeKey(props.freezeKey);\n }\n\n if (props.pauseKey != null) {\n this.setPauseKey(props.pauseKey);\n }\n\n if (props.wipeKey != null) {\n this.setWipeKey(props.wipeKey);\n }\n\n if (props.supplyKey != null) {\n this.setSupplyKey(props.supplyKey);\n }\n\n if (props.feeScheduleKey != null) {\n this.setFeeScheduleKey(props.feeScheduleKey);\n }\n\n if (props.freezeDefault != null) {\n this.setFreezeDefault(props.freezeDefault);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.tokenMemo != null) {\n this.setTokenMemo(props.tokenMemo);\n }\n\n if (props.customFees != null) {\n this.setCustomFees(props.customFees);\n }\n\n if (props.tokenType != null) {\n this.setTokenType(props.tokenType);\n }\n\n if (props.supplyType != null) {\n this.setSupplyType(props.supplyType);\n }\n\n if (props.maxSupply != null) {\n this.setMaxSupply(props.maxSupply);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const create =\n /** @type {HashgraphProto.proto.ITokenCreateTransactionBody} */ (\n body.tokenCreation\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenCreateTransaction({\n tokenName: create.name != null ? create.name : undefined,\n tokenSymbol: create.symbol != null ? create.symbol : undefined,\n decimals: create.decimals != null ? create.decimals : undefined,\n initialSupply:\n create.initialSupply != null\n ? create.initialSupply\n : undefined,\n treasuryAccountId:\n create.treasury != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(create.treasury)\n : undefined,\n adminKey:\n create.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(create.adminKey)\n : undefined,\n kycKey:\n create.kycKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(create.kycKey)\n : undefined,\n freezeKey:\n create.freezeKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(create.freezeKey)\n : undefined,\n pauseKey:\n create.pauseKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(create.pauseKey)\n : undefined,\n wipeKey:\n create.wipeKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(create.wipeKey)\n : undefined,\n supplyKey:\n create.supplyKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(create.supplyKey)\n : undefined,\n feeScheduleKey:\n create.feeScheduleKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(create.feeScheduleKey)\n : undefined,\n freezeDefault:\n create.freezeDefault != null\n ? create.freezeDefault\n : undefined,\n autoRenewAccountId:\n create.autoRenewAccount != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(create.autoRenewAccount)\n : undefined,\n expirationTime:\n create.expiry != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(create.expiry)\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? _Duration_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobuf(create.autoRenewPeriod)\n : undefined,\n tokenMemo: create.memo != null ? create.memo : undefined,\n customFees:\n create.customFees != null\n ? create.customFees.map((fee) => {\n if (fee.fixedFee != null) {\n return _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobuf(fee);\n } else if (fee.fractionalFee != null) {\n return _CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]._fromProtobuf(fee);\n } else {\n return _CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]._fromProtobuf(fee);\n }\n })\n : undefined,\n tokenType:\n create.tokenType != null\n ? _TokenType_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]._fromCode(create.tokenType)\n : undefined,\n supplyType:\n create.supplyType != null\n ? _TokenSupplyType_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]._fromCode(create.supplyType)\n : undefined,\n maxSupply:\n create.maxSupply != null ? create.maxSupply : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?string}\n */\n get tokenName() {\n return this._tokenName;\n }\n\n /**\n * @param {string} name\n * @returns {this}\n */\n setTokenName(name) {\n this._requireNotFrozen();\n this._tokenName = name;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get tokenSymbol() {\n return this._tokenSymbol;\n }\n\n /**\n * @param {string} symbol\n * @returns {this}\n */\n setTokenSymbol(symbol) {\n this._requireNotFrozen();\n this._tokenSymbol = symbol;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get decimals() {\n return this._decimals;\n }\n\n /**\n * @param {Long | number} decimals\n * @returns {this}\n */\n setDecimals(decimals) {\n this._requireNotFrozen();\n this._decimals =\n decimals instanceof long__WEBPACK_IMPORTED_MODULE_2__ ? decimals : long__WEBPACK_IMPORTED_MODULE_2__.fromValue(decimals);\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get initialSupply() {\n return this._initialSupply;\n }\n\n /**\n * @param {Long | number} initialSupply\n * @returns {this}\n */\n setInitialSupply(initialSupply) {\n this._requireNotFrozen();\n this._initialSupply = long__WEBPACK_IMPORTED_MODULE_2__.fromValue(initialSupply);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get treasuryAccountId() {\n return this._treasuryAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setTreasuryAccountId(id) {\n this._requireNotFrozen();\n this._treasuryAccountId =\n typeof id === \"string\" ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(id) : id.clone();\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setAdminKey(key) {\n this._requireNotFrozen();\n this._adminKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get kycKey() {\n return this._kycKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setKycKey(key) {\n this._requireNotFrozen();\n this._kycKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get freezeKey() {\n return this._freezeKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setFreezeKey(key) {\n this._requireNotFrozen();\n this._freezeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get pauseKey() {\n return this._pauseKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setPauseKey(key) {\n this._requireNotFrozen();\n this._pauseKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get wipeKey() {\n return this._wipeKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setWipeKey(key) {\n this._requireNotFrozen();\n this._wipeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get supplyKey() {\n return this._supplyKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setSupplyKey(key) {\n this._requireNotFrozen();\n this._supplyKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get feeScheduleKey() {\n return this._feeScheduleKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setFeeScheduleKey(key) {\n this._requireNotFrozen();\n this._feeScheduleKey = key;\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get freezeDefault() {\n return this._freezeDefault;\n }\n\n /**\n * @param {boolean} freeze\n * @returns {this}\n */\n setFreezeDefault(freeze) {\n this._requireNotFrozen();\n this._freezeDefault = freeze;\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * @param {Timestamp | Date} time\n * @returns {this}\n */\n setExpirationTime(time) {\n this._requireNotFrozen();\n this._autoRenewPeriod = null;\n this._expirationTime =\n time instanceof _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"] ? time : _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromDate(time);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setAutoRenewAccountId(id) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n id instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] ? id : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(id);\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * Set the auto renew period for this token.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get tokenMemo() {\n return this._tokenMemo;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setTokenMemo(memo) {\n this._requireNotFrozen();\n this._tokenMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {CustomFee[]}\n */\n get customFees() {\n return this._customFees;\n }\n\n /**\n * @param {CustomFee[]} customFees\n * @returns {this}\n */\n setCustomFees(customFees) {\n this._customFees = customFees;\n return this;\n }\n\n /**\n * @returns {?TokenType}\n */\n get tokenType() {\n return this._tokenType;\n }\n\n /**\n * @param {TokenType} tokenType\n * @returns {this}\n */\n setTokenType(tokenType) {\n this._tokenType = tokenType;\n return this;\n }\n\n /**\n * @returns {?TokenSupplyType}\n */\n get supplyType() {\n return this._supplyType;\n }\n\n /**\n * @param {TokenSupplyType} supplyType\n * @returns {this}\n */\n setSupplyType(supplyType) {\n this._supplyType = supplyType;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get maxSupply() {\n return this._maxSupply;\n }\n\n /**\n * @param {Long | number} maxSupply\n * @returns {this}\n */\n setMaxSupply(maxSupply) {\n this._maxSupply =\n typeof maxSupply === \"number\"\n ? long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(maxSupply)\n : maxSupply;\n return this;\n }\n\n /**\n * @override\n * @param {AccountId} accountId\n */\n _freezeWithAccountId(accountId) {\n super._freezeWithAccountId(accountId);\n\n if (this._autoRenewPeriod != null && accountId != null) {\n this._autoRenewAccountId = accountId;\n }\n }\n\n /**\n * @param {?import(\"../client/Client.js\").default} client\n * @returns {this}\n */\n freezeWith(client) {\n if (client != null && client.operatorAccountId != null) {\n this._freezeWithAccountId(client.operatorAccountId);\n }\n\n return super.freezeWith(client);\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._treasuryAccountId != null) {\n this._treasuryAccountId.validateChecksum(client);\n }\n\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.createToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenCreation\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n name: this._tokenName,\n symbol: this._tokenSymbol,\n decimals: this._decimals != null ? this._decimals.toInt() : null,\n initialSupply: this._initialSupply,\n treasury:\n this._treasuryAccountId != null\n ? this._treasuryAccountId._toProtobuf()\n : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n kycKey: this._kycKey != null ? this._kycKey._toProtobufKey() : null,\n freezeKey:\n this._freezeKey != null\n ? this._freezeKey._toProtobufKey()\n : null,\n pauseKey:\n this._pauseKey != null ? this._pauseKey._toProtobufKey() : null,\n wipeKey:\n this._wipeKey != null ? this._wipeKey._toProtobufKey() : null,\n supplyKey:\n this._supplyKey != null\n ? this._supplyKey._toProtobufKey()\n : null,\n feeScheduleKey:\n this._feeScheduleKey != null\n ? this._feeScheduleKey._toProtobufKey()\n : null,\n freezeDefault: this._freezeDefault,\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n expiry:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n autoRenewPeriod:\n this._autoRenewPeriod != null\n ? this._autoRenewPeriod._toProtobuf()\n : null,\n memo: this._tokenMemo,\n customFees: this.customFees.map((fee) => fee._toProtobuf()),\n tokenType: this._tokenType != null ? this._tokenType._code : null,\n supplyType:\n this._supplyType != null ? this._supplyType._code : null,\n maxSupply: this.maxSupply,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenCreateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenCreation\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenCreateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenCreateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenDeleteTransaction.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenDeleteTransaction.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenDeleteTransactionBody} HashgraphProto.proto.ITokenDeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Delete a new Hedera™ crypto-currency token.\n */\nclass TokenDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const deleteToken =\n /** @type {HashgraphProto.proto.ITokenDeleteTransactionBody} */ (\n body.tokenDeletion\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenDeleteTransaction({\n tokenId:\n deleteToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(deleteToken.token)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.deleteToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenDeletion\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenDeletion\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenDeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenDeleteTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenDissociateTransaction.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenDissociateTransaction.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenDissociateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenDissociateTransactionBody} HashgraphProto.proto.ITokenDissociateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Dissociate a new Hedera™ crypto-currency token.\n */\nclass TokenDissociateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {(TokenId | string)[]} [props.tokenIds]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId[]}\n */\n this._tokenIds = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](5);\n\n if (props.tokenIds != null) {\n this.setTokenIds(props.tokenIds);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenDissociateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const dissociateToken =\n /** @type {HashgraphProto.proto.ITokenDissociateTransactionBody} */ (\n body.tokenDissociate\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufTransactions(\n new TokenDissociateTransaction({\n tokenIds:\n dissociateToken.tokens != null\n ? dissociateToken.tokens.map((token) =>\n _TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(token)\n )\n : undefined,\n accountId:\n dissociateToken.account != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(dissociateToken.account)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId[]}\n */\n get tokenIds() {\n return this._tokenIds;\n }\n\n /**\n * @param {(TokenId | string)[]} tokenIds\n * @returns {this}\n */\n setTokenIds(tokenIds) {\n this._requireNotFrozen();\n this._tokenIds = tokenIds.map((tokenId) =>\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenId)\n : tokenId.clone()\n );\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n\n for (const tokenId of this._tokenIds != null ? this._tokenIds : []) {\n if (tokenId != null) {\n tokenId.validateChecksum(client);\n }\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.dissociateTokens(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenDissociate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenDissociateTransactionBody}\n */\n _makeTransactionData() {\n return {\n tokens:\n this._tokenIds != null\n ? this._tokenIds.map((tokenId) => tokenId._toProtobuf())\n : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenDissociateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_3__.TRANSACTION_REGISTRY.set(\n \"tokenDissociate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenDissociateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenDissociateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenFeeScheduleUpdateTransaction.js": -/*!************************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenFeeScheduleUpdateTransaction.js ***! - \************************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenFeeScheduleUpdateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CustomFixedFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js\");\n/* harmony import */ var _CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CustomFractionalFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js\");\n/* harmony import */ var _CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CustomRoyaltyFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenFeeScheduleUpdateTransactionBody} HashgraphProto.proto.ITokenFeeScheduleUpdateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./CustomFee.js\").default} CustomFee\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * FeeScheduleUpdate a new Hedera™ crypto-currency token.\n */\nclass TokenFeeScheduleUpdateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {CustomFee[]} [props.customFees]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {CustomFee[]}\n */\n this._customFees = [];\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.customFees != null) {\n this.setCustomFees(props.customFees);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenFeeScheduleUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const feeScheduleUpdate =\n /** @type {HashgraphProto.proto.ITokenFeeScheduleUpdateTransactionBody} */ (\n body.tokenFeeScheduleUpdate\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenFeeScheduleUpdateTransaction({\n tokenId:\n feeScheduleUpdate.tokenId != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(feeScheduleUpdate.tokenId)\n : undefined,\n customFees:\n feeScheduleUpdate.customFees != null\n ? feeScheduleUpdate.customFees.map((fee) => {\n if (fee.fixedFee != null) {\n return _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(fee);\n } else if (fee.fractionalFee != null) {\n return _CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(fee);\n } else {\n return _CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(fee);\n }\n })\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(tokenId._toProtobuf());\n\n return this;\n }\n\n /**\n * @returns {CustomFee[]}\n */\n get customFees() {\n return this._customFees;\n }\n\n /**\n * @param {CustomFee[]} fees\n * @returns {this}\n */\n setCustomFees(fees) {\n this._requireNotFrozen();\n this._customFees = fees;\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.updateTokenFeeSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenFeeScheduleUpdate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenFeeScheduleUpdateTransactionBody}\n */\n _makeTransactionData() {\n return {\n tokenId: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n customFees: this._customFees.map((fee) => fee._toProtobuf()),\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenFeeScheduleUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenFeeScheduleUpdate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenFeeScheduleUpdateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenFeeScheduleUpdateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenFreezeTransaction.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenFreezeTransaction.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenFreezeTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenFreezeAccountTransactionBody} HashgraphProto.proto.ITokenFreezeAccountTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Freeze a new Hedera™ crypto-currency token.\n */\nclass TokenFreezeTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenFreezeTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const freezeToken =\n /** @type {HashgraphProto.proto.ITokenFreezeAccountTransactionBody} */ (\n body.tokenFreeze\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new TokenFreezeTransaction({\n tokenId:\n freezeToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(freezeToken.token)\n : undefined,\n accountId:\n freezeToken.account != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(freezeToken.account)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.freezeTokenAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenFreeze\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenFreezeAccountTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenFreezeTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"tokenFreeze\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenFreezeTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenFreezeTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenGrantKycTransaction.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenGrantKycTransaction.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenGrantKycTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGrantKycTransactionBody} HashgraphProto.proto.ITokenGrantKycTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * GrantKyc a new Hedera™ crypto-currency token.\n */\nclass TokenGrantKycTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenGrantKycTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const grantKycToken =\n /** @type {HashgraphProto.proto.ITokenGrantKycTransactionBody} */ (\n body.tokenGrantKyc\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new TokenGrantKycTransaction({\n tokenId:\n grantKycToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(grantKycToken.token)\n : undefined,\n accountId:\n grantKycToken.account != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(grantKycToken.account)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.grantKycToTokenAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenGrantKyc\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenGrantKycTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenGrantKycTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"tokenGrantKyc\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenGrantKycTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenGrantKycTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenId.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenId.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenId; }\n/* harmony export */ });\n/* harmony import */ var _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../EntityIdHelper.js */ \"./node_modules/@hashgraph/sdk/src/EntityIdHelper.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"long\").Long} Long\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * The ID for a crypto-currency token on Hedera.\n */\nclass TokenId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n */\n constructor(props, realm, num) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @param {string} text\n * @returns {TokenId}\n */\n static fromString(text) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromString(text);\n const id = new TokenId(result);\n id._checksum = result.checksum;\n return id;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITokenID} id\n * @returns {TokenId}\n */\n static _fromProtobuf(id) {\n const tokenId = new TokenId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.tokenNum != null ? id.tokenNum : 0\n );\n\n return tokenId;\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TokenId}\n */\n static fromBytes(bytes) {\n return TokenId._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.TokenID.decode(bytes)\n );\n }\n\n /**\n * @param {string} address\n * @returns {TokenId}\n */\n static fromSolidityAddress(address) {\n return new TokenId(..._EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromSolidityAddress(address));\n }\n\n /**\n * @returns {string}\n */\n toSolidityAddress() {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toSolidityAddress([this.shard, this.realm, this.num]);\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ITokenID}\n */\n _toProtobuf() {\n return {\n tokenNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.TokenID.encode(this._toProtobuf()).finish();\n }\n\n /**\n * @returns {TokenId}\n */\n clone() {\n const id = new TokenId(this);\n id._checksum = this._checksum;\n return id;\n }\n\n /**\n * @param {TokenId} other\n * @returns {number}\n */\n compare(other) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.compare(\n [this.shard, this.realm, this.num],\n [other.shard, other.realm, other.num]\n );\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenId.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenInfo.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenInfo.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenInfo; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _TokenType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TokenType.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenType.js\");\n/* harmony import */ var _TokenSupplyType_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TokenSupplyType.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenSupplyType.js\");\n/* harmony import */ var _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./CustomFixedFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFixedFee.js\");\n/* harmony import */ var _CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./CustomFractionalFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomFractionalFee.js\");\n/* harmony import */ var _CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CustomRoyaltyFee.js */ \"./node_modules/@hashgraph/sdk/src/token/CustomRoyaltyFee.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"./CustomFee.js\").default} CustomFee\n */\n\n/**\n * Response when the client sends the node TokenGetInfoQuery.\n */\nclass TokenInfo {\n /**\n * @private\n * @param {object} props\n * @param {TokenId} props.tokenId;\n * @param {string} props.name;\n * @param {string} props.symbol;\n * @param {number} props.decimals;\n * @param {Long} props.totalSupply;\n * @param {AccountId | null} props.treasuryAccountId;\n * @param {Key | null} props.adminKey;\n * @param {Key | null} props.kycKey;\n * @param {Key | null} props.freezeKey;\n * @param {Key | null} props.pauseKey;\n * @param {Key | null} props.wipeKey;\n * @param {Key | null} props.supplyKey;\n * @param {Key | null} props.feeScheduleKey;\n * @param {boolean | null} props.defaultFreezeStatus;\n * @param {boolean | null} props.defaultKycStatus;\n * @param {boolean | null} props.pauseStatus;\n * @param {boolean} props.isDeleted;\n * @param {AccountId | null} props.autoRenewAccountId;\n * @param {Duration | null} props.autoRenewPeriod;\n * @param {Timestamp | null} props.expirationTime;\n * @param {string} props.tokenMemo;\n * @param {CustomFee[]} props.customFees;\n * @param {TokenType | null} props.tokenType;\n * @param {TokenSupplyType | null} props.supplyType;\n * @param {Long | null} props.maxSupply;\n * @param {LedgerId|null} props.ledgerId\n */\n constructor(props) {\n /**\n * ID of the token instance\n *\n * @readonly\n */\n this.tokenId = props.tokenId;\n\n /**\n * The name of the token. It is a string of ASCII only characters\n *\n * @readonly\n */\n this.name = props.name;\n\n /**\n * The symbol of the token. It is a UTF-8 capitalized alphabetical string\n *\n * @readonly\n */\n this.symbol = props.symbol;\n\n /**\n * The number of decimal places a token is divisible by\n *\n * @readonly\n */\n this.decimals = props.decimals;\n\n /**\n * The total supply of tokens that are currently in circulation\n *\n * @readonly\n */\n this.totalSupply = props.totalSupply;\n\n /**\n * The ID of the account which is set as treasuryAccountId\n *\n * @readonly\n */\n this.treasuryAccountId = props.treasuryAccountId;\n\n /**\n * The key which can perform update/delete operations on the token. If empty, the token can be perceived as\n * immutable (not being able to be updated/deleted)\n *\n * @readonly\n */\n this.adminKey = props.adminKey;\n\n /**\n * The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required,\n * and KYC grant or revoke operations are not possible.\n *\n * @readonly\n */\n this.kycKey = props.kycKey;\n\n /**\n * The key which can freeze or unfreeze an account for token transactions. If empty, freezing is not possible\n *\n * @readonly\n */\n this.freezeKey = props.freezeKey;\n\n /**\n * The Key which can pause and unpause the Token.\n *\n * @readonly\n */\n this.pauseKey = props.pauseKey;\n\n /**\n * The key which can wipe token balance of an account. If empty, wipe is not possible\n *\n * @readonly\n */\n this.wipeKey = props.wipeKey;\n\n /**\n * The key which can change the supply of a token. The key is used to sign Token Mint/Burn operations\n *\n * @readonly\n */\n this.supplyKey = props.supplyKey;\n\n this.feeScheduleKey = props.feeScheduleKey;\n\n /**\n * The default Freeze status (not applicable = null, frozen = false, or unfrozen = true) of Hedera accounts relative to this token.\n * FreezeNotApplicable is returned if Token Freeze Key is empty. Frozen is returned if Token Freeze Key is set and\n * defaultFreeze is set to true. Unfrozen is returned if Token Freeze Key is set and defaultFreeze is set to false\n * FreezeNotApplicable = null;\n * Frozen = true;\n * Unfrozen = false;\n *\n * @readonly\n */\n this.defaultFreezeStatus = props.defaultFreezeStatus;\n\n /**\n * The default KYC status (KycNotApplicable or Revoked) of Hedera accounts relative to this token. KycNotApplicable\n * is returned if KYC key is not set, otherwise Revoked\n * KycNotApplicable = null;\n * Granted = true;\n * Revoked = false;\n *\n * @readonly\n */\n this.defaultKycStatus = props.defaultKycStatus;\n\n /**\n * The default pause status of Hedera accounts relative to this token.\n * PauseNotApplicable is returned if pauseKey is not set\n * PauseNotApplicable = null;\n * Paused = true;\n * Unpaused = false;\n *\n * @readonly\n */\n this.pauseStatus = props.pauseStatus;\n\n /**\n * Specifies whether the token was deleted or not\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * An account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval\n *\n * @readonly\n */\n this.autoRenewAccountId = props.autoRenewAccountId;\n\n /**\n * The interval at which the auto-renew account will be charged to extend the token's expiry\n *\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /**\n * The epoch second at which the token expire: will; if an auto-renew account and period are specified,\n * this is coerced to the current epoch second plus the autoRenewPeriod\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * The memo associated with the token.\n *\n * @readonly\n */\n this.tokenMemo = props.tokenMemo;\n\n this.customFees = props.customFees;\n\n this.tokenType = props.tokenType;\n\n this.supplyType = props.supplyType;\n\n this.maxSupply = props.maxSupply;\n\n this.ledgerId = props.ledgerId;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITokenInfo} info\n * @returns {TokenInfo}\n */\n static _fromProtobuf(info) {\n const defaultFreezeStatus =\n /** @type {HashgraphProto.proto.TokenFreezeStatus} */ (\n info.defaultFreezeStatus\n );\n const defaultKycStatus =\n /** @type {HashgraphProto.proto.TokenKycStatus} */ (\n info.defaultKycStatus\n );\n const pauseStatus =\n /**@type {HashgraphProto.proto.TokenPauseStatus} */ (\n info.pauseStatus\n );\n\n const autoRenewAccountId =\n info.autoRenewAccount != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.autoRenewAccount)\n : new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](0);\n\n return new TokenInfo({\n tokenId: _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (info.tokenId)\n ),\n name: /** @type {string} */ (info.name),\n symbol: /** @type {string} */ (info.symbol),\n decimals: /** @type {number} */ (info.decimals),\n totalSupply: long__WEBPACK_IMPORTED_MODULE_4__.fromValue(/** @type {Long} */ (info.totalSupply)),\n treasuryAccountId:\n info.treasury != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n info.treasury\n )\n )\n : null,\n adminKey:\n info.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(info.adminKey)\n : null,\n kycKey:\n info.kycKey != null ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(info.kycKey) : null,\n freezeKey:\n info.freezeKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(info.freezeKey)\n : null,\n pauseKey:\n info.pauseKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(info.pauseKey)\n : null,\n wipeKey:\n info.wipeKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(info.wipeKey)\n : null,\n supplyKey:\n info.supplyKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(info.supplyKey)\n : null,\n feeScheduleKey:\n info.feeScheduleKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobufKey(info.feeScheduleKey)\n : null,\n defaultFreezeStatus:\n defaultFreezeStatus === 0 ? null : defaultFreezeStatus == 1,\n defaultKycStatus:\n defaultKycStatus === 0 ? null : defaultKycStatus == 1,\n pauseStatus: pauseStatus === 0 ? null : pauseStatus == 1,\n isDeleted: /** @type {boolean} */ (info.deleted),\n autoRenewAccountId: !(\n autoRenewAccountId.shard.toInt() == 0 &&\n autoRenewAccountId.realm.toInt() == 0 &&\n autoRenewAccountId.num.toInt() == 0\n )\n ? autoRenewAccountId\n : null,\n autoRenewPeriod:\n info.autoRenewPeriod != null\n ? _Duration_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IDuration} */ (\n info.autoRenewPeriod\n )\n )\n : null,\n expirationTime:\n info.expiry != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.expiry\n )\n )\n : null,\n tokenMemo: info.memo != null ? info.memo : \"\",\n customFees:\n info.customFees != null\n ? info.customFees.map((fee) => {\n if (fee.fixedFee != null) {\n return _CustomFixedFee_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]._fromProtobuf(fee);\n } else if (fee.fractionalFee != null) {\n return _CustomFractionalFee_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]._fromProtobuf(fee);\n } else {\n return _CustomRoyaltyFee_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]._fromProtobuf(fee);\n }\n })\n : [],\n tokenType:\n info.tokenType != null\n ? _TokenType_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromCode(info.tokenType)\n : null,\n supplyType:\n info.supplyType != null\n ? _TokenSupplyType_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]._fromCode(info.supplyType)\n : null,\n maxSupply: info.maxSupply != null ? info.maxSupply : null,\n ledgerId:\n info.ledgerId != null\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"].fromBytes(info.ledgerId)\n : null,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.ITokenInfo}\n */\n _toProtobuf() {\n return {\n tokenId: this.tokenId._toProtobuf(),\n name: this.name,\n symbol: this.symbol,\n decimals: this.decimals,\n totalSupply: this.totalSupply,\n treasury:\n this.treasuryAccountId != null\n ? this.treasuryAccountId._toProtobuf()\n : null,\n adminKey:\n this.adminKey != null ? this.adminKey._toProtobufKey() : null,\n kycKey: this.kycKey != null ? this.kycKey._toProtobufKey() : null,\n freezeKey:\n this.freezeKey != null ? this.freezeKey._toProtobufKey() : null,\n pauseKey:\n this.pauseKey != null ? this.pauseKey._toProtobufKey() : null,\n wipeKey:\n this.wipeKey != null ? this.wipeKey._toProtobufKey() : null,\n supplyKey:\n this.supplyKey != null ? this.supplyKey._toProtobufKey() : null,\n feeScheduleKey:\n this.feeScheduleKey != null\n ? this.feeScheduleKey._toProtobufKey()\n : null,\n defaultFreezeStatus:\n this.defaultFreezeStatus == null\n ? 0\n : this.defaultFreezeStatus\n ? 1\n : 2,\n defaultKycStatus:\n this.defaultKycStatus == null\n ? 0\n : this.defaultKycStatus\n ? 1\n : 2,\n pauseStatus:\n this.pauseStatus == null ? 0 : this.pauseStatus ? 1 : 2,\n deleted: this.isDeleted,\n autoRenewAccount:\n this.autoRenewAccountId != null\n ? this.autoRenewAccountId._toProtobuf()\n : undefined,\n autoRenewPeriod:\n this.autoRenewPeriod != null\n ? this.autoRenewPeriod._toProtobuf()\n : null,\n expiry:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : null,\n memo: this.tokenMemo,\n customFees: this.customFees.map((fee) => fee._toProtobuf()),\n tokenType: this.tokenType != null ? this.tokenType._code : null,\n supplyType: this.supplyType != null ? this.supplyType._code : null,\n maxSupply: this.maxSupply,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TokenInfo}\n */\n static fromBytes(bytes) {\n return TokenInfo._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.TokenInfo.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.TokenInfo.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenInfo.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenInfoQuery.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenInfoQuery.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _TokenInfo_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TokenInfo.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenInfo.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenInfo} HashgraphProto.proto.ITokenInfo\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetInfoQuery} HashgraphProto.proto.ITokenGetInfoQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetInfoResponse} HashgraphProto.proto.ITokenGetInfoResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * @augments {Query}\n */\nclass TokenInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} properties\n * @param {TokenId | string} [properties.tokenId]\n */\n constructor(properties = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n if (properties.tokenId != null) {\n this.setTokenId(properties.tokenId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {TokenInfoQuery}\n */\n static _fromProtobuf(query) {\n const info = /** @type {HashgraphProto.proto.ITokenGetInfoQuery} */ (\n query.tokenGetInfo\n );\n\n return new TokenInfoQuery({\n tokenId:\n info.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.token)\n : undefined,\n });\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * Set the token ID for which the info is being requested.\n *\n * @param {TokenId | string} tokenId\n * @returns {TokenInfoQuery}\n */\n setTokenId(tokenId) {\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.getTokenInfo(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const tokenGetInfo =\n /** @type {HashgraphProto.proto.ITokenGetInfoResponse} */ (\n response.tokenGetInfo\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n tokenGetInfo.header\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const info = /** @type {HashgraphProto.proto.ITokenGetInfoResponse} */ (\n response.tokenGetInfo\n );\n\n return Promise.resolve(\n _TokenInfo_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenInfo} */ (info.tokenInfo)\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n tokenGetInfo: {\n header,\n token:\n this._tokenId != null ? this._tokenId._toProtobuf() : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `TokenInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"tokenGetInfo\", TokenInfoQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenInfoQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenMintTransaction.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenMintTransaction.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenMintTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenMintTransactionBody} HashgraphProto.proto.ITokenMintTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Mint a new Hedera™ crypto-currency token.\n */\nclass TokenMintTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {Long | number} [props.amount]\n * @param {Uint8Array[]} [props.metadata]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._amount = null;\n\n /**\n * @private\n * @type {Uint8Array[]}\n */\n this._metadata = [];\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n if (props.metadata != null) {\n this.setMetadata(props.metadata);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenMintTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const mintToken =\n /** @type {HashgraphProto.proto.ITokenMintTransactionBody} */ (\n body.tokenMint\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenMintTransaction({\n tokenId:\n mintToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(mintToken.token)\n : undefined,\n amount: mintToken.amount != null ? mintToken.amount : undefined,\n metadata:\n mintToken.metadata != null ? mintToken.metadata : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {this}\n */\n setAmount(amount) {\n this._requireNotFrozen();\n this._amount = amount instanceof long__WEBPACK_IMPORTED_MODULE_2__ ? amount : long__WEBPACK_IMPORTED_MODULE_2__.fromValue(amount);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {Uint8Array[]}\n */\n get metadata() {\n return this._metadata;\n }\n\n /**\n * @param {Uint8Array | string} metadata\n * @returns {this}\n */\n addMetadata(metadata) {\n this._requireNotFrozen();\n\n if (typeof metadata === \"string\") {\n console.warn(\n \"Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.\"\n );\n }\n\n this._metadata.push(\n typeof metadata === \"string\" ? _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.decode(metadata) : metadata\n );\n\n return this;\n }\n\n /**\n * @param {Uint8Array[]} metadata\n * @returns {this}\n */\n setMetadata(metadata) {\n this._requireNotFrozen();\n\n for (const data of metadata) {\n if (typeof data === \"string\") {\n console.warn(\n \"Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.\"\n );\n break;\n }\n }\n\n this._metadata = metadata.map((data) =>\n typeof data === \"string\" ? _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.decode(data) : data\n );\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.mintToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenMint\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenMintTransactionBody}\n */\n _makeTransactionData() {\n return {\n amount: this._amount,\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n metadata: this._metadata,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenMintTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenMint\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenMintTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenMintTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenNftInfo.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenNftInfo.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenNftInfo; }\n/* harmony export */ });\n/* harmony import */ var _NftId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NftId.js */ \"./node_modules/@hashgraph/sdk/src/token/NftId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.TokenFreezeStatus} HashgraphProto.proto.TokenFreezeStatus\n * @typedef {import(\"@hashgraph/proto\").proto.TokenKycStatus} HashgraphProto.proto.TokenKycStatus\n * @typedef {import(\"@hashgraph/proto\").proto.TokenPauseStatus} HashgraphProto.proto.TokenPauseStatus\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenNftInfo} HashgraphProto.proto.ITokenNftInfo\n * @typedef {import(\"@hashgraph/proto\").proto.INftID} HashgraphProto.proto.INftID\n * @typedef {import(\"@hashgraph/proto\").proto.ITimestamp} HashgraphProto.proto.ITimestamp\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HashgraphProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.IDuration} HashgraphProto.proto.IDuration\n */\n\nclass TokenNftInfo {\n /**\n * @private\n * @param {object} props\n * @param {NftId} props.nftId\n * @param {AccountId} props.accountId\n * @param {Timestamp} props.creationTime\n * @param {Uint8Array | null} props.metadata\n * @param {LedgerId|null} props.ledgerId\n * @param {AccountId|null} props.spenderId\n */\n constructor(props) {\n /**\n * ID of the nft instance\n *\n * @readonly\n */\n this.nftId = props.nftId;\n\n /**\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * @readonly\n */\n this.creationTime = props.creationTime;\n\n /**\n * @readonly\n */\n this.metadata = props.metadata;\n\n this.ledgerId = props.ledgerId;\n\n this.spenderId = props.spenderId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITokenNftInfo} info\n * @returns {TokenNftInfo}\n */\n static _fromProtobuf(info) {\n return new TokenNftInfo({\n nftId: _NftId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.INftID} */ (info.nftID)\n ),\n accountId: _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (info.accountID)\n ),\n creationTime: _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n info.creationTime\n )\n ),\n metadata: info.metadata !== undefined ? info.metadata : null,\n ledgerId:\n info.ledgerId != null\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromBytes(info.ledgerId)\n : null,\n spenderId:\n info.spenderId != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.spenderId)\n : null,\n });\n }\n\n /**\n * @returns {HashgraphProto.proto.ITokenNftInfo}\n */\n _toProtobuf() {\n return {\n nftID: this.nftId._toProtobuf(),\n accountID: this.accountId._toProtobuf(),\n creationTime: this.creationTime._toProtobuf(),\n metadata: this.metadata,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n spenderId:\n this.spenderId != null ? this.spenderId._toProtobuf() : null,\n };\n }\n\n /**\n * @typedef {object} TokenNftInfoJson\n * @property {string} nftId\n * @property {string} accountId\n * @property {string} creationTime\n * @property {string | null} metadata\n * @property {string | null} ledgerId\n * @property {string | null} spenderId\n * @returns {TokenNftInfoJson}\n */\n toJson() {\n return {\n nftId: this.nftId.toString(),\n accountId: this.accountId.toString(),\n creationTime: this.creationTime.toString(),\n metadata: this.metadata != null ? _encoding_hex_js__WEBPACK_IMPORTED_MODULE_3__.encode(this.metadata) : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toString() : null,\n spenderId:\n this.spenderId != null ? this.spenderId.toString() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJson());\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenNftInfo.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenNftInfoQuery.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenNftInfoQuery.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenNftInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _NftId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NftId.js */ \"./node_modules/@hashgraph/sdk/src/token/NftId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _TokenNftInfo_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TokenNftInfo.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenNftInfo.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenNftInfo} HashgraphProto.proto.ITokenNftInfo\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetNftInfoQuery} HashgraphProto.proto.ITokenGetNftInfoQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetNftInfosQuery} HashgraphProto.proto.ITokenGetNftInfosQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetAccountNftInfosQuery} HashgraphProto.proto.ITokenGetAccountNftInfosQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetNftInfoResponse} HashgraphProto.proto.ITokenGetNftInfoResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetNftInfosResponse} HashgraphProto.proto.ITokenGetNftInfosResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenGetAccountNftInfosResponse} HashgraphProto.proto.ITokenGetAccountNftInfosResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n */\n\n/**\n * @augments {Query}\n */\nclass TokenNftInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} properties\n * @param {NftId | string} [properties.nftId]\n * @param {AccountId | string} [properties.accountId]\n * @param {TokenId | string} [properties.tokenId]\n * @param {Long | number} [properties.start]\n * @param {Long | number} [properties.end]\n */\n constructor(properties = {}) {\n super();\n\n /**\n * @private\n * @type {?NftId}\n */\n this._nftId = null;\n if (properties.nftId != null) {\n this.setNftId(properties.nftId);\n }\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n if (properties.accountId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setAccountId(properties.accountId);\n }\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n if (properties.tokenId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setTokenId(properties.tokenId);\n }\n\n /**\n * @private\n * @type {?Long}\n */\n this._start = null;\n if (properties.start != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setStart(properties.start);\n }\n\n /**\n * @private\n * @type {?Long}\n */\n this._end = null;\n if (properties.end != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setEnd(properties.end);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {TokenNftInfoQuery}\n */\n static _fromProtobuf(query) {\n if (query.tokenGetNftInfo != null) {\n const info =\n /** @type {HashgraphProto.proto.ITokenGetNftInfoQuery} */ (\n query.tokenGetNftInfo\n );\n\n return new TokenNftInfoQuery({\n nftId:\n info.nftID != null\n ? _NftId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.nftID)\n : undefined,\n });\n } else if (query.tokenGetAccountNftInfos != null) {\n const info =\n /** @type {HashgraphProto.proto.ITokenGetAccountNftInfosQuery} */ (\n query.tokenGetAccountNftInfos\n );\n\n return new TokenNftInfoQuery({\n accountId:\n info.accountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(info.accountID)\n : undefined,\n start: info.start != null ? info.start : undefined,\n end: info.end != null ? info.end : undefined,\n });\n } else {\n const info =\n /** @type {HashgraphProto.proto.ITokenGetNftInfosQuery} */ (\n query.tokenGetNftInfos\n );\n\n return new TokenNftInfoQuery({\n tokenId:\n info.tokenID != null\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(info.tokenID)\n : undefined,\n start: info.start != null ? info.start : undefined,\n end: info.end != null ? info.end : undefined,\n });\n }\n }\n\n /**\n * @returns {?NftId}\n */\n get nftId() {\n return this._nftId;\n }\n\n /**\n * Set the token ID for which the info is being requested.\n *\n * @param {NftId | string} nftId\n * @returns {TokenNftInfoQuery}\n */\n setNftId(nftId) {\n this._nftId =\n typeof nftId === \"string\"\n ? _NftId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(nftId)\n : _NftId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(nftId._toProtobuf());\n\n return this;\n }\n\n /**\n * @deprecated with no replacement\n * @returns {?AccountId}\n */\n get accountId() {\n console.warn(\n \"`TokenNftInfoQuery.accountId` is deprecated with no replacement\"\n );\n return this._accountId;\n }\n\n /**\n * @deprecated with no replacement\n * Set the token ID for which the info is being requested.\n * @param {AccountId | string} accountId\n * @returns {TokenNftInfoQuery}\n */\n setAccountId(accountId) {\n console.warn(\n \"`TokenNftInfoQuery.setAccountId()` is deprecated with no replacement\"\n );\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(accountId)\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(accountId._toProtobuf());\n\n return this;\n }\n\n /**\n * @deprecated with no replacement\n * @returns {?TokenId}\n */\n get tokenId() {\n console.warn(\n \"`TokenNftInfoQuery.tokenId` is deprecated with no replacement\"\n );\n return this._tokenId;\n }\n\n /**\n * @deprecated with no replacement\n * Set the token ID for which the info is being requested.\n * @param {TokenId | string} tokenId\n * @returns {TokenNftInfoQuery}\n */\n setTokenId(tokenId) {\n console.warn(\n \"`TokenNftInfoQuery.setTokenId()` is deprecated with no replacement\"\n );\n this._tokenId =\n typeof tokenId === \"string\"\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(tokenId)\n : _token_TokenId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(tokenId._toProtobuf());\n\n return this;\n }\n\n /**\n * @deprecated with no replacement\n * @returns {?Long}\n */\n get start() {\n console.warn(\n \"`TokenNftInfoQuery.start` is deprecated with no replacement\"\n );\n return this._start;\n }\n\n /**\n * @deprecated with no replacement\n * Set the token ID for which the info is being requested.\n * @param {Long | number} start\n * @returns {TokenNftInfoQuery}\n */\n setStart(start) {\n console.warn(\n \"`TokenNftInfoQuery.setStart()` is deprecated with no replacement\"\n );\n this._start =\n typeof start === \"number\" ? long__WEBPACK_IMPORTED_MODULE_6__.fromNumber(start) : start;\n\n return this;\n }\n\n /**\n * @deprecated with no replacement\n * @returns {?Long}\n */\n get end() {\n console.warn(\n \"`TokenNftInfoQuery.end` is deprecated with no replacement\"\n );\n return this._end;\n }\n\n /**\n * @deprecated with no replacement\n * Set the token ID for which the info is being requested.\n * @param {Long | number} end\n * @returns {TokenNftInfoQuery}\n */\n setEnd(end) {\n console.warn(\n \"`TokenNftInfoQuery.setEnd()` is deprecated with no replacement\"\n );\n this._end = typeof end === \"number\" ? long__WEBPACK_IMPORTED_MODULE_6__.fromNumber(end) : end;\n\n return this;\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.getTokenNftInfo(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const infos =\n /** @type {HashgraphProto.proto.ITokenGetNftInfoResponse} */ (\n response.tokenGetNftInfo\n );\n\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n infos.header\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const nfts = [\n /** @type {HashgraphProto.proto.ITokenNftInfo} */\n (\n /** @type {HashgraphProto.proto.ITokenGetNftInfoResponse} */ (\n response.tokenGetNftInfo\n ).nft\n ),\n ];\n\n return Promise.resolve(\n nfts.map((nft) =>\n _TokenNftInfo_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenNftInfo} */ (nft)\n )\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n tokenGetNftInfo: {\n header,\n nftID: this._nftId != null ? this._nftId._toProtobuf() : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `TokenNftInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"tokenGetNftInfo\", TokenNftInfoQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenNftInfoQuery.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenNftTransfer.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenNftTransfer.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenNftTransfer; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount\n * @typedef {import(\"@hashgraph/proto\").proto.INftTransfer} HashgraphProto.proto.INftTransfer\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * An account, and the amount that it sends or receives during a cryptocurrency tokentransfer.\n */\nclass TokenNftTransfer {\n /**\n * @internal\n * @param {object} props\n * @param {TokenId | string} props.tokenId\n * @param {AccountId | string} props.senderAccountId\n * @param {AccountId | string} props.receiverAccountId\n * @param {Long | number} props.serialNumber\n * @param {boolean} props.isApproved\n */\n constructor(props) {\n /**\n * The Token ID that sends or receives cryptocurrency.\n */\n this.tokenId =\n props.tokenId instanceof _TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? props.tokenId\n : _TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(props.tokenId);\n\n /**\n * The Account ID that sends or receives cryptocurrency.\n */\n this.senderAccountId =\n props.senderAccountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? props.senderAccountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(props.senderAccountId);\n\n /**\n * The Account ID that sends or receives cryptocurrency.\n */\n this.receiverAccountId =\n props.receiverAccountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? props.receiverAccountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(props.receiverAccountId);\n\n this.serialNumber = long__WEBPACK_IMPORTED_MODULE_0__.fromValue(props.serialNumber);\n this.isApproved = props.isApproved;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITokenTransferList[]} tokenTransfers\n * @returns {TokenNftTransfer[]}\n */\n static _fromProtobuf(tokenTransfers) {\n const transfers = [];\n\n for (const tokenTransfer of tokenTransfers) {\n const tokenId = _TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (\n tokenTransfer.token\n )\n );\n\n for (const transfer of tokenTransfer.nftTransfers != null\n ? tokenTransfer.nftTransfers\n : []) {\n transfers.push(\n new TokenNftTransfer({\n tokenId,\n senderAccountId: _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n transfer.senderAccountID\n )\n ),\n receiverAccountId: _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n transfer.receiverAccountID\n )\n ),\n serialNumber:\n transfer.serialNumber != null\n ? transfer.serialNumber\n : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n isApproved: transfer.isApproval == true,\n })\n );\n }\n }\n\n return transfers;\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.INftTransfer}\n */\n _toProtobuf() {\n return {\n senderAccountID: this.senderAccountId._toProtobuf(),\n receiverAccountID: this.receiverAccountId._toProtobuf(),\n serialNumber: this.serialNumber,\n isApproval: this.isApproved,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenNftTransfer.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenPauseTransaction.js": -/*!************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenPauseTransaction.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenPauseTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenPauseTransactionBody} HashgraphProto.proto.ITokenPauseTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * Pause a new Hedera™ crypto-currency token.\n */\nclass TokenPauseTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenPauseTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const pauseToken =\n /** @type {HashgraphProto.proto.ITokenPauseTransactionBody} */ (\n body.tokenPause\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenPauseTransaction({\n tokenId:\n pauseToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(pauseToken.token)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.pauseToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenPause\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenPauseTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenPauseTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenPause\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenPauseTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenPauseTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenRevokeKycTransaction.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenRevokeKycTransaction.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenRevokeKycTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenRevokeKycTransactionBody} HashgraphProto.proto.ITokenRevokeKycTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * RevokeKyc a new Hedera™ crypto-currency token.\n */\nclass TokenRevokeKycTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenRevokeKycTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const revokeKycToken =\n /** @type {HashgraphProto.proto.ITokenRevokeKycTransactionBody} */ (\n body.tokenRevokeKyc\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new TokenRevokeKycTransaction({\n tokenId:\n revokeKycToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(revokeKycToken.token)\n : undefined,\n accountId:\n revokeKycToken.account != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(revokeKycToken.account)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.revokeKycFromTokenAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenRevokeKyc\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenRevokeKycTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenRevokeKycTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"tokenRevokeKyc\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenRevokeKycTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenRevokeKycTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenSupplyType.js": -/*!******************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenSupplyType.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenSupplyType; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.TokenSupplyType} HashgraphProto.proto.TokenSupplyType\n */\n\nclass TokenSupplyType {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case TokenSupplyType.Infinite:\n return \"INFINITE\";\n case TokenSupplyType.Finite:\n return \"FINITE\";\n default:\n return `UNKNOWN (${this._code})`;\n }\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {TokenSupplyType}\n */\n static _fromCode(code) {\n switch (code) {\n case 0:\n return TokenSupplyType.Infinite;\n case 1:\n return TokenSupplyType.Finite;\n }\n\n throw new Error(\n `(BUG) TokenSupplyType.fromCode() does not handle code: ${code}`\n );\n }\n\n /**\n * @returns {HashgraphProto.proto.TokenSupplyType}\n */\n valueOf() {\n return this._code;\n }\n}\n\n/**\n * Interchangeable value with one another, where any quantity of them has the\n * same value as another equal quantity if they are in the same class. Share\n * a single set of properties, not distinct from one another. Simply represented\n * as a balance or quantity to a given Hedera account.\n */\nTokenSupplyType.Infinite = new TokenSupplyType(0);\n\n/**\n * Unique, not interchangeable with other tokens of the same type as they\n * typically have different values. Individually traced and can carry unique\n * properties (e.g. serial number).\n */\nTokenSupplyType.Finite = new TokenSupplyType(1);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenSupplyType.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenTransfer.js": -/*!****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenTransfer.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenTransfer; }\n/* harmony export */ });\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenTransferList} HashgraphProto.proto.ITokenTransferList\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountAmount} HashgraphProto.proto.IAccountAmount\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HashgraphProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * An account, and the amount that it sends or receives during a cryptocurrency tokentransfer.\n */\nclass TokenTransfer {\n /**\n * @internal\n * @param {object} props\n * @param {TokenId | string} props.tokenId\n * @param {AccountId | string} props.accountId\n * @param {number | null} props.expectedDecimals\n * @param {Long | number} props.amount\n * @param {boolean} props.isApproved\n */\n constructor(props) {\n /**\n * The Token ID that sends or receives cryptocurrency.\n *\n * @readonly\n */\n this.tokenId =\n props.tokenId instanceof _TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? props.tokenId\n : _TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(props.tokenId);\n\n /**\n * The Account ID that sends or receives cryptocurrency.\n *\n * @readonly\n */\n this.accountId =\n props.accountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? props.accountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(props.accountId);\n\n this.expectedDecimals = props.expectedDecimals;\n this.amount = long__WEBPACK_IMPORTED_MODULE_0__.fromValue(props.amount);\n this.isApproved = props.isApproved;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITokenTransferList[]} tokenTransfers\n * @returns {TokenTransfer[]}\n */\n static _fromProtobuf(tokenTransfers) {\n const transfers = [];\n\n for (const tokenTransfer of tokenTransfers) {\n const tokenId = _TokenId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITokenID} */ (\n tokenTransfer.token\n )\n );\n const expectedDecimals =\n tokenTransfer.expectedDecimals != null\n ? /** @type {number | null } */ (\n tokenTransfer.expectedDecimals.value\n )\n : null;\n\n for (const transfer of tokenTransfer.transfers != null\n ? tokenTransfer.transfers\n : []) {\n transfers.push(\n new TokenTransfer({\n tokenId,\n accountId: _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n transfer.accountID\n )\n ),\n expectedDecimals,\n amount:\n transfer.amount != null\n ? transfer.amount\n : long__WEBPACK_IMPORTED_MODULE_0__.ZERO,\n isApproved: transfer.isApproval == true,\n })\n );\n }\n }\n\n return transfers;\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IAccountAmount}\n */\n _toProtobuf() {\n return {\n accountID: this.accountId._toProtobuf(),\n amount: this.amount,\n isApproval: this.isApproved,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenTransfer.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenType.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenType.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenType; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.TokenType} HashgraphProto.proto.TokenType\n */\n\nclass TokenType {\n /**\n * @hideconstructor\n * @internal\n * @param {number} code\n */\n constructor(code) {\n /** @readonly */\n this._code = code;\n\n Object.freeze(this);\n }\n\n /**\n * @returns {string}\n */\n toString() {\n switch (this) {\n case TokenType.FungibleCommon:\n return \"FUNGIBLE_COMMON\";\n case TokenType.NonFungibleUnique:\n return \"NON_FUNGIBLE_UNIQUE\";\n default:\n return `UNKNOWN (${this._code})`;\n }\n }\n\n /**\n * @internal\n * @param {number} code\n * @returns {TokenType}\n */\n static _fromCode(code) {\n switch (code) {\n case 0:\n return TokenType.FungibleCommon;\n case 1:\n return TokenType.NonFungibleUnique;\n }\n\n throw new Error(\n `(BUG) TokenType.fromCode() does not handle code: ${code}`\n );\n }\n\n /**\n * @returns {HashgraphProto.proto.TokenType}\n */\n valueOf() {\n return this._code;\n }\n}\n\n/**\n * Interchangeable value with one another, where any quantity of them has the\n * same value as another equal quantity if they are in the same class. Share\n * a single set of properties, not distinct from one another. Simply represented\n * as a balance or quantity to a given Hedera account.\n */\nTokenType.FungibleCommon = new TokenType(0);\n\n/**\n * Unique, not interchangeable with other tokens of the same type as they\n * typically have different values. Individually traced and can carry unique\n * properties (e.g. serial number).\n */\nTokenType.NonFungibleUnique = new TokenType(1);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenType.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenUnfreezeTransaction.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenUnfreezeTransaction.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenUnfreezeTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenUnfreezeAccountTransactionBody} HashgraphProto.proto.ITokenUnfreezeAccountTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Unfreeze a new Hedera™ crypto-currency token.\n */\nclass TokenUnfreezeTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenUnfreezeTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const unfreezeToken =\n /** @type {HashgraphProto.proto.ITokenUnfreezeAccountTransactionBody} */ (\n body.tokenUnfreeze\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new TokenUnfreezeTransaction({\n tokenId:\n unfreezeToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(unfreezeToken.token)\n : undefined,\n accountId:\n unfreezeToken.account != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(unfreezeToken.account)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.unfreezeTokenAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenUnfreeze\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenUnfreezeAccountTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenUnfreezeTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"tokenUnfreeze\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenUnfreezeTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenUnfreezeTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenUnpauseTransaction.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenUnpauseTransaction.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("./client/Client.js").NetworkName} ClientNetworkName + * @typedef {import("./Provider.js").Provider} Provider + * @typedef {import("./Signer.js").Signer} Signer + * @typedef {import("./account/AccountBalance.js").AccountBalanceJson} AccountBalanceJson + * @typedef {import("./account/AccountBalance.js").TokenBalanceJson} TokenBalanceJson + * @typedef {import("./transaction/TransactionResponse.js").TransactionResponseJSON} TransactionResponseJSON + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenUnpauseTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenUnpauseTransactionBody} HashgraphProto.proto.ITokenUnpauseTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * Unpause a new Hedera™ crypto-currency token.\n */\nclass TokenUnpauseTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenUnpauseTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const unpauseToken =\n /** @type {HashgraphProto.proto.ITokenUnpauseTransactionBody} */ (\n body.tokenUnpause\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenUnpauseTransaction({\n tokenId:\n unpauseToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(unpauseToken.token)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.unpauseToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenUnpause\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenUnpauseTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenUnpauseTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenUnpause\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenUnpauseTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenUnpauseTransaction.js?"); +/** + * @typedef {object} NetworkNameType + * @property {ClientNetworkName} Mainnet + * @property {ClientNetworkName} Testnet + * @property {ClientNetworkName} Previewnet + */ +/** + * @type {NetworkNameType} + */ +const NetworkName = { + Mainnet: "mainnet", + Testnet: "testnet", + Previewnet: "previewnet", +}; + + + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/ManagedNodeAddress.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), +/** + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./channel/Channel.js").default} Channel + * @typedef {import("./channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("./address_book/NodeAddress.js").default} NodeAddress + */ -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenUpdateTransaction.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenUpdateTransaction.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +const HOST_AND_PORT = /^(\S+):(\d+)$/; + +class ManagedNodeAddress { + /** + * @param {object} props + * @param {string} [props.address] + * @param {string} [props.host] + * @param {number | null} [props.port] + */ + constructor(props = {}) { + if (props.address != null) { + const hostAndPortResult = HOST_AND_PORT.exec(props.address); + + if (hostAndPortResult == null) { + throw new Error(`failed to parse address: ${props.address}`); + } + + /** @type {string} */ + this._address = /** @type {string} */ (hostAndPortResult[1]); + + /** @type {number | null} */ + this._port = + hostAndPortResult[2] != null + ? parseInt(/** @type {string }*/ (hostAndPortResult[2])) + : null; + } else if (props.host != null && props.port != null) { + /** @type {string} */ + this._address = props.host; + + /** @type {number | null} */ + this._port = props.port; + } else { + throw new Error( + `failed to create a managed node address: ${JSON.stringify( + props, + )}`, + ); + } + + Object.freeze(this); + } + + /** + * @param {string} address + * @returns {ManagedNodeAddress}; + */ + static fromString(address) { + return new ManagedNodeAddress({ address }); + } + + toInsecure() { + let port = this.port === 50212 ? 50211 : this.port; + return new ManagedNodeAddress({ host: this.address, port }); + } + + toSecure() { + let port = this.port === 50211 ? 50212 : this.port; + return new ManagedNodeAddress({ host: this.address, port }); + } + + /** + * @returns {string} + */ + get address() { + return this._address; + } + + /** + * @returns {number | null} + */ + get port() { + return this._port; + } + + /** + * @returns {boolean} + */ + isTransportSecurity() { + return this._port == 50212 || this._port == 443; + } + + /** + * @returns {string} + */ + toString() { + if (this.port == null) { + return this.address; + } else { + return `${this.address}:${this.port}`; + } + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/ManagedNode.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenUpdateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenUpdateTransactionBody} HashgraphProto.proto.ITokenUpdateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Update a new Hedera™ crypto-currency token.\n */\nclass TokenUpdateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {string} [props.tokenName]\n * @param {string} [props.tokenSymbol]\n * @param {AccountId | string} [props.treasuryAccountId]\n * @param {Key} [props.adminKey]\n * @param {Key} [props.kycKey]\n * @param {Key} [props.freezeKey]\n * @param {Key} [props.wipeKey]\n * @param {Key} [props.supplyKey]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {string} [props.tokenMemo]\n * @param {Key} [props.feeScheduleKey]\n * @param {Key} [props.pauseKey]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenName = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenSymbol = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._treasuryAccountId = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._kycKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._freezeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._wipeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._supplyKey = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?Duration}\n */\n this._autoRenewPeriod = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenMemo = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._feeScheduleKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._pauseKey = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.tokenName != null) {\n this.setTokenName(props.tokenName);\n }\n\n if (props.tokenSymbol != null) {\n this.setTokenSymbol(props.tokenSymbol);\n }\n\n if (props.treasuryAccountId != null) {\n this.setTreasuryAccountId(props.treasuryAccountId);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.kycKey != null) {\n this.setKycKey(props.kycKey);\n }\n\n if (props.freezeKey != null) {\n this.setFreezeKey(props.freezeKey);\n }\n\n if (props.wipeKey != null) {\n this.setWipeKey(props.wipeKey);\n }\n\n if (props.supplyKey != null) {\n this.setSupplyKey(props.supplyKey);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.tokenMemo != null) {\n this.setTokenMemo(props.tokenMemo);\n }\n\n if (props.feeScheduleKey != null) {\n this.setFeeScheduleKey(props.feeScheduleKey);\n }\n\n if (props.pauseKey != null) {\n this.setPauseKey(props.pauseKey);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const update =\n /** @type {HashgraphProto.proto.ITokenUpdateTransactionBody} */ (\n body.tokenUpdate\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TokenUpdateTransaction({\n tokenId:\n update.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(update.token)\n : undefined,\n tokenName: update.name != null ? update.name : undefined,\n tokenSymbol: update.symbol != null ? update.symbol : undefined,\n treasuryAccountId:\n update.treasury != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(update.treasury)\n : undefined,\n adminKey:\n update.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(update.adminKey)\n : undefined,\n kycKey:\n update.kycKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(update.kycKey)\n : undefined,\n freezeKey:\n update.freezeKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(update.freezeKey)\n : undefined,\n wipeKey:\n update.wipeKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(update.wipeKey)\n : undefined,\n supplyKey:\n update.supplyKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(update.supplyKey)\n : undefined,\n autoRenewAccountId:\n update.autoRenewAccount != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(update.autoRenewAccount)\n : undefined,\n expirationTime:\n update.expiry != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(update.expiry)\n : undefined,\n autoRenewPeriod:\n update.autoRenewPeriod != null\n ? _Duration_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(update.autoRenewPeriod)\n : undefined,\n tokenMemo:\n update.memo != null\n ? update.memo.value != null\n ? update.memo.value\n : undefined\n : undefined,\n feeScheduleKey:\n update.feeScheduleKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobufKey(update.feeScheduleKey)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get tokenName() {\n return this._tokenName;\n }\n\n /**\n * @param {string} name\n * @returns {this}\n */\n setTokenName(name) {\n this._requireNotFrozen();\n this._tokenName = name;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get tokenSymbol() {\n return this._tokenSymbol;\n }\n\n /**\n * @param {string} symbol\n * @returns {this}\n */\n setTokenSymbol(symbol) {\n this._requireNotFrozen();\n this._tokenSymbol = symbol;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get treasuryAccountId() {\n return this._treasuryAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setTreasuryAccountId(id) {\n this._requireNotFrozen();\n this._treasuryAccountId =\n typeof id === \"string\" ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(id) : id.clone();\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setAdminKey(key) {\n this._requireNotFrozen();\n this._adminKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get kycKey() {\n return this._kycKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setKycKey(key) {\n this._requireNotFrozen();\n this._kycKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get freezeKey() {\n return this._freezeKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setFreezeKey(key) {\n this._requireNotFrozen();\n this._freezeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get wipeKey() {\n return this._wipeKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setWipeKey(key) {\n this._requireNotFrozen();\n this._wipeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get supplyKey() {\n return this._supplyKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setSupplyKey(key) {\n this._requireNotFrozen();\n this._supplyKey = key;\n\n return this;\n }\n\n /**\n * @deprecated\n * @param {Key} key\n * @returns {this}\n */\n setsupplyKey(key) {\n this._requireNotFrozen();\n this._supplyKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * @param {Timestamp | Date} time\n * @returns {this}\n */\n setExpirationTime(time) {\n this._requireNotFrozen();\n this._expirationTime =\n time instanceof _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] ? time : _Timestamp_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromDate(time);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setAutoRenewAccountId(id) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n id instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] ? id : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(id);\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * Set the auto renew period for this token.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get tokenMemo() {\n return this._tokenMemo;\n }\n\n /**\n * @param {string} tokenMemo\n * @returns {this}\n */\n setTokenMemo(tokenMemo) {\n this._requireNotFrozen();\n this._tokenMemo = tokenMemo;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get feeScheduleKey() {\n return this._feeScheduleKey;\n }\n\n /**\n * @param {Key} feeScheduleKey\n * @returns {this}\n */\n setFeeScheduleKey(feeScheduleKey) {\n this._requireNotFrozen();\n this._feeScheduleKey = feeScheduleKey;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get pauseKey() {\n return this._pauseKey;\n }\n\n /**\n * @param {Key} pauseKey\n * @returns {this}\n */\n setPauseKey(pauseKey) {\n this._requireNotFrozen();\n this._pauseKey = pauseKey;\n return this;\n }\n\n /**\n * @returns {this}\n */\n clearTokenMemo() {\n this._requireNotFrozen();\n this._tokenMemo = null;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._treasuryAccountId != null) {\n this._treasuryAccountId.validateChecksum(client);\n }\n\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.updateToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenUpdate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenUpdateTransactionBody}\n */\n _makeTransactionData() {\n return {\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n name: this.tokenName,\n symbol: this.tokenSymbol,\n treasury:\n this._treasuryAccountId != null\n ? this._treasuryAccountId._toProtobuf()\n : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n kycKey: this._kycKey != null ? this._kycKey._toProtobufKey() : null,\n freezeKey:\n this._freezeKey != null\n ? this._freezeKey._toProtobufKey()\n : null,\n pauseKey:\n this._pauseKey != null ? this._pauseKey._toProtobufKey() : null,\n wipeKey:\n this._wipeKey != null ? this._wipeKey._toProtobufKey() : null,\n supplyKey:\n this._supplyKey != null\n ? this._supplyKey._toProtobufKey()\n : null,\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n expiry:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n autoRenewPeriod:\n this._autoRenewPeriod != null\n ? this._autoRenewPeriod._toProtobuf()\n : null,\n memo:\n this._tokenMemo != null\n ? {\n value: this._tokenMemo,\n }\n : null,\n feeScheduleKey:\n this._feeScheduleKey != null\n ? this._feeScheduleKey._toProtobufKey()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"tokenUpdate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenUpdateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenUpdateTransaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/token/TokenWipeTransaction.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/token/TokenWipeTransaction.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./channel/Channel.js").default} Channel + * @typedef {import("./channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("./address_book/NodeAddress.js").default} NodeAddress + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TokenWipeTransaction; }\n/* harmony export */ });\n/* harmony import */ var _TokenId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenWipeAccountTransactionBody} HashgraphProto.proto.ITokenWipeAccountTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HashgraphProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Wipe a new Hedera™ crypto-currency token.\n */\nclass TokenWipeTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {AccountId | string} [props.accountId]\n * @param {Long | number} [props.amount]\n * @param {(Long | number)[]} [props.serials]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n /**\n * @private\n * @type {Long[]}\n */\n this._serials = [];\n\n /**\n * @private\n * @type {?Long}\n */\n this._amount = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n if (props.serials != null) {\n this.setSerials(props.serials);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TokenWipeTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const wipeToken =\n /** @type {HashgraphProto.proto.ITokenWipeAccountTransactionBody} */ (\n body.tokenWipe\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobufTransactions(\n new TokenWipeTransaction({\n tokenId:\n wipeToken.token != null\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(wipeToken.token)\n : undefined,\n accountId:\n wipeToken.account != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(wipeToken.account)\n : undefined,\n amount: wipeToken.amount != null ? wipeToken.amount : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? _TokenId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {this}\n */\n setAmount(amount) {\n this._requireNotFrozen();\n this._amount = amount instanceof long__WEBPACK_IMPORTED_MODULE_3__ ? amount : long__WEBPACK_IMPORTED_MODULE_3__.fromValue(amount);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {Long[]}\n */\n get serials() {\n return this._serials;\n }\n\n /**\n * @param {(Long | number)[]} serials\n * @returns {this}\n */\n setSerials(serials) {\n this._requireNotFrozen();\n this._serials = serials.map((serial) =>\n typeof serial === \"number\" ? long__WEBPACK_IMPORTED_MODULE_3__.fromNumber(serial) : serial\n );\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.token.wipeTokenAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"tokenWipe\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.ITokenWipeAccountTransactionBody}\n */\n _makeTransactionData() {\n return {\n amount: this._amount,\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n serialNumbers: this.serials,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenWipeTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_2__.TRANSACTION_REGISTRY.set(\n \"tokenWipe\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenWipeTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/token/TokenWipeTransaction.js?"); +/** + * @template {Channel | MirrorChannel} ChannelT + * @typedef {object} NewNode + * @property {string | ManagedNodeAddress} address + * @property {(address: string, cert?: string) => ChannelT} channelInitFunction + */ -/***/ }), +/** + * @template {Channel | MirrorChannel} ChannelT + * @typedef {object} CloneNode + * @property {ManagedNode} node + * @property {ManagedNodeAddress} address + */ -/***/ "./node_modules/@hashgraph/sdk/src/topic/SubscriptionHandle.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/SubscriptionHandle.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @abstract + * @template {Channel | MirrorChannel} ChannelT + */ +class ManagedNode { + /** + * @param {object} props + * @param {NewNode=} [props.newNode] + * @param {CloneNode=} [props.cloneNode] + */ + constructor(props = {}) { + if (props.newNode != null) { + this._address = + typeof props.newNode.address === "string" + ? ManagedNodeAddress.fromString(props.newNode.address) + : props.newNode.address; + + /** @type {string=} */ + this._cert = undefined; + + /** @type {ChannelT | null} */ + this._channel = null; + + /** @type {(address: string, cert?: string) => ChannelT} */ + this._channelInitFunction = props.newNode.channelInitFunction; + + this._lastUsed = Date.now(); + this._readmitTime = Date.now(); + this._useCount = 0; + this._badGrpcStatusCount = 0; + this._minBackoff = 8000; + this._maxBackoff = 1000 * 60 * 60; + this._currentBackoff = this._minBackoff; + } else if (props.cloneNode != null) { + /** @type {ManagedNodeAddress} */ + this._address = props.cloneNode.address; + + /** @type {string=} */ + this._cert = props.cloneNode.node._cert; + + /** @type {ChannelT | null} */ + this._channel = props.cloneNode.node._channel; + + /** @type {(address: string, cert?: string) => ChannelT} */ + this._channelInitFunction = + props.cloneNode.node._channelInitFunction; + + /** @type {number} */ + this._currentBackoff = props.cloneNode.node._currentBackoff; + + /** @type {number} */ + this._lastUsed = props.cloneNode.node._lastUsed; + + /** @type {number} */ + this._readmitTime = props.cloneNode.node._readmitTime; + + /** @type {number} */ + this._useCount = props.cloneNode.node._useCount; + + /** @type {number} */ + this._badGrpcStatusCount = props.cloneNode.node._badGrpcStatusCount; + + /** @type {number} */ + this._minBackoff = props.cloneNode.node._minBackoff; + + /** @type {number} */ + this._maxBackoff = props.cloneNode.node._minBackoff; + } else { + throw new Error( + `failed to create ManagedNode: ${JSON.stringify(props)}`, + ); + } + } + + /** + * @abstract + * @returns {string} + */ + // eslint-disable-next-line jsdoc/require-returns-check + getKey() { + throw new Error("not implemented"); + } + + /** + * @param {string} ledgerId + * @returns {this} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setCert(ledgerId) { + return this; + } + + /** + * @returns {ManagedNodeAddress} + */ + get address() { + return this._address; + } + + /** + * @returns {number} + */ + get attempts() { + return this._badGrpcStatusCount; + } + + /** + * @returns {number} + */ + get minBackoff() { + return this._minBackoff; + } + + /** + * @param {number} minBackoff + * @returns {this} + */ + setMinBackoff(minBackoff) { + if (this._currentBackoff <= minBackoff) { + this._currentBackoff = minBackoff; + } + + this._minBackoff = minBackoff; + return this; + } + + /** + * @returns {number} + */ + get maxBackoff() { + return this._maxBackoff; + } + + /** + * @param {number} maxBackoff + * @returns {this} + */ + setMaxBackoff(maxBackoff) { + if (this._currentBackoff <= maxBackoff) { + this._currentBackoff = maxBackoff; + } + + this._maxBackoff = maxBackoff; + return this; + } + + getChannel() { + this._useCount++; + this.__lastUsed = Date.now(); + + if (this._channel != null) { + return this._channel; + } + + this._channel = this._channelInitFunction( + this.address.toString(), + this._cert, + ); + return this._channel; + } + + /** + * Determines if this node is healthy by checking if this node hasn't been + * in use for a the required `_currentBackoff` period. Since this looks at `this._lastUsed` + * and that value is only set in the `wait()` method, any node that has not + * returned a bad gRPC status will always be considered healthy. + * + * @returns {boolean} + */ + isHealthy() { + return this._readmitTime <= Date.now(); + } + + increaseBackoff() { + this._currentBackoff = Math.min( + this._currentBackoff * 2, + this._maxBackoff, + ); + this._readmitTime = Date.now() + this._currentBackoff; + } + + decreaseBackoff() { + this._currentBackoff = Math.max( + this._currentBackoff / 2, + this._minBackoff, + ); + } + + /** + * @returns {number} + */ + getRemainingTime() { + return this._readmitTime - this._lastUsed; + } + + /** + * This is only ever called if the node itself is down. + * A node returning a transaction with a bad status code does not indicate + * the node is down, and hence this method will not be called. + * + * @returns {Promise} + */ + backoff() { + return new Promise((resolve) => + setTimeout(resolve, this.getRemainingTime()), + ); + } + + /** + * @param {ManagedNode<*>} node + * @returns {number} + */ + compare(node) { + let comparison = this.getRemainingTime() - node.getRemainingTime(); + if (comparison != 0) { + return comparison; + } + + comparison = this._currentBackoff - node._currentBackoff; + if (comparison != 0) { + return comparison; + } + + comparison = this._badGrpcStatusCount - node._badGrpcStatusCount; + if (comparison != 0) { + return comparison; + } + + comparison = this._useCount - node._useCount; + if (comparison != 0) { + return comparison; + } + + return this._lastUsed - node._lastUsed; + } + + close() { + if (this._channel != null) { + this._channel.close(); + } + + this._channel = null; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/NodeCerts.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SubscriptionHandle; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\nclass SubscriptionHandle {\n constructor() {\n /** @type {{(): void} | null} */\n this._call = null;\n }\n\n /**\n * @param {() => void} call\n * @returns {void}\n */\n _setCall(call) {\n this._call = call;\n }\n\n unsubscribe() {\n if (this._call != null) {\n this._call();\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/SubscriptionHandle.js?"); +/** @type {{[key: string]: string}} */ +const PREVIEWNET_CERTS = { + "0.0.3": `-----BEGIN CERTIFICATE----- +MIICnzCCAiWgAwIBAgIUenyqJ4UaFBbwokatcUqAwW3o3rswCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDAxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMTU4WhgPMjI5NTA2MDcyMjIxNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAwMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEm5b1+oG9R0qt +zM7UZnS5l/xxUNHIHq5+NAvtlviCpJL19jrW9+/UOy00Qqc6vS6tS1hS+dNJmpiZ +FN0EHew4VDR7ACnL4LDJKmIHWjQ0iwvZo5kCpO0r9BtPN5FvaSxyo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUeciBviJtjeuue0GPf1xllNw7qvYwCgYIKoZIzj0EAwMDaAAwZQIw +JeG0H2HdsI1VhOYmJmYlNeKCNgAk+LMorzPmsIInVBO2HK2IrKfpReWDS/m5j51V +AjEAxKBxDezJDqAZHTkTXCg+X9Q9V6J6M5yDy5IS90aCWEo+W8C1Hc6hkn2/NrvT +PhwK +-----END CERTIFICATE----- +`, + "0.0.4": `-----BEGIN CERTIFICATE----- +MIICnjCCAiWgAwIBAgIUUfjO8LyXBdzrzbAe1Yl+d34IDsIwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDExHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMTU5WhgPMjI5NTA2MDcyMjIxNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAxMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAERwfj4ZtD/wRb +f8h9NEMu2sQoLFK9Gc4SQ8o6j4ccLYGdgOoVoq4zzy4Jr7ZtCTuACfCfhp7wy8ra ++6cugccaSd6AzOKRSVZvQvkUTFKIoAOKwp6IhlU48rmi80MT07eyo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUCGhfVMP72Y0G5XUksE3dPgFHrzkwCgYIKoZIzj0EAwMDZwAwZAIw +cpX7irZWyuujWRYUs9kLNgB2YLQK+n8r1fH+tJg3+zkcZ2pzhGWmpUUZWOzsDqGC +AjBUbhlmrTc4LrEBN0EMiRYzfPD2kBZxusLBDIg/aDYERCMcsFvF1T9SsuasF/B+ +cI8= +-----END CERTIFICATE----- +`, + "0.0.5": `-----BEGIN CERTIFICATE----- +MIICnjCCAiWgAwIBAgIUIo4L+7xe/mUmpKy4qOAQEIxz8UMwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDIxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMTU5WhgPMjI5NTA2MDcyMjIxNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAyMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEoFgCjb1/7BUJ +EXKIPJLlsOSp/39G8l92wOSr7h+Py7iwVwu68H2ykftMOq3tRwDRXZHz7ViqcIZ9 +lfMcS8sbRtVm9tBbNciVUqTLWX9nHr/c4PhKEi+LdgtSUr2+hHiWo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUMR89BHC3yKC4YwUgyBVQUGBCprQwCgYIKoZIzj0EAwMDZwAwZAIw +Us2BdslcScIwcmxoB60K7/1BPfQI8ccDZIMosas6U2zhinTnRKik1T0i+uHhLl8e +AjA5apAwSPTnP7j3Bo/FOCkfjTqOjwp2lUqzDJYKolKsHX2sy8hX9MkYiY46SaJ1 +P+0= +-----END CERTIFICATE----- +`, + "0.0.6": `-----BEGIN CERTIFICATE----- +MIICnzCCAiWgAwIBAgIUWpji03mJsR/16MP8BrOfpNz7aQMwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDMxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMTU5WhgPMjI5NTA2MDcyMjIxNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAzMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE+KDMC99Q1rWi ++FwlytGMS5qzTDytCvk+PzdONnDZ/weNSv4j3BXSo588IwhIxLtfcBlyo/+PmE1c +5qGFXuMoZjGr22VpvogkRgPejD+Gawb4A2XHkMCD8NmO66uPw97po1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUN1qEI4eQ+WHavb9ypGV417NvhGowCgYIKoZIzj0EAwMDaAAwZQIw +L0khkiDOiFRa3wx9l5JNjaSRePPc3ZaTaJQkPYeauMaLWEvmC/0e2/e9gPm5qJ8E +AjEAgXQMko3vNB8VRN4XjyFJa8p/muZ/tLA15wPnb/boUmiZ+njDDSaiu8tIQrTB +gHW6 +-----END CERTIFICATE----- +`, + "0.0.7": `-----BEGIN CERTIFICATE----- +MIICnjCCAiWgAwIBAgIUEJ7AJvrqDUBNKbssGoJtww3v+WowCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDQxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMjAwWhgPMjI5NTA2MDcyMjIyMDBaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA0MR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEfgJ8w9GUWM3y +yusedZOFQrgXFVsdtRsMSHbqyVCN6+Wow6SIjy29GRMSP5R2aswupFgh6lXJRqnr +tY+hpRumFKsmSo+5+l8DBcql4rzs4utESTehM+Cq9LYc4A1z0UIRo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUMCm3UqSbT01Zr23hLzCGnXbDa+MwCgYIKoZIzj0EAwMDZwAwZAIw +FNcN7mKJo/bwpRT+y/KbYkCJsvljdbXzJOXXQ3e6J6R+0vLqcT25J/ry6pBZMUwR +AjAswu29z8KJCSxnWwnPpHDmkRT15zG/xS+pAmx3oeQSqp6ZD7qpdJE8zzhbfe5x +wAc= +-----END CERTIFICATE----- +`, +}; + +/** @type {{[key: string]: string}} */ +const TESTNET_CERTS = { + "0.0.3": `-----BEGIN CERTIFICATE----- +MIICoDCCAiWgAwIBAgIUMkNeM6Sbk9ZFYmRWZmSgTQHHWyUwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDAxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMjU4WhgPMjI5NTA2MDcyMjIyNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAwMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETLLoIMZjEhDP +KLHS7bJT4OTYGgR/8mB65yfx3KqMLYFF+q2SpWkIrYgUQLVEUEibVSnLlxRUzH7R +szcKynpTwh0W0yfWanZKQg+RWoKkEYlu2GvkUtJb8cRVM9NLmJUeo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUSrIepwFx8gZ8/G+WGaxs6GgkMtQwCgYIKoZIzj0EAwMDaQAwZgIx +AJxC0fjB1OrF9vkCKsfnPS3Z+1hscrZhEDG38NxdLEAfPQ5VmyrSBgJy11FBp8yB +0QIxAKzbge3Lf7iBMwYwm+2M/GiVgmHNMLdtrYuerWpdbYOHgRNAkyt57JoThn0u +Tzkd5Q== +-----END CERTIFICATE----- +`, + "0.0.4": `-----BEGIN CERTIFICATE----- +MIICnzCCAiWgAwIBAgIUGLriiLPacglp6U+BtJcF9TI7xEUwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDExHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMjU4WhgPMjI5NTA2MDcyMjIyNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAxMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEXhR9cb6mH9AE +GNSGk3OkxN1C/JW49ddYZ/XWD4InjS8D1kXmB1Y39v1mF0L1loG6lDT8Zp46zrj7 +5zMONXZeD2b0mx5hHhtllPTpJ10Tlt9FDoyFbKwPRQ/SAPNADfuzo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUCaKtx8RZ1XJO9rmZMbIcFJZkcv4wCgYIKoZIzj0EAwMDaAAwZQIx +APhDW0VrNSmq8hODdhIVV4GyvpYhp3Fksg+sZr3DmUatwn+ptj+X+9IzgPl9QYE3 +kAIwcy2ixgNkjC/DYVmgT4MpUnLneLK0gA23Vj2QwACaTH99H/ybqUH7srj0POB9 +5wvV +-----END CERTIFICATE----- +`, + "0.0.5": `-----BEGIN CERTIFICATE----- +MIICoDCCAiWgAwIBAgIUEMduome38hvAuIKoGjg/tHatQZMwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDIxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMjU4WhgPMjI5NTA2MDcyMjIyNThaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAyMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEl1olzP1L4WgX +d7aujOXmTQZt3tEOGzkMa3S6qJwISLBI7Tb9KaW8zYIe9xWBVAwphCbD0wn9xpPV +wMr4uTn+JocugYBbe2YoUGzWTkxWnOEKXbh/nQJCe3XE/C0FY8fAo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQULfw7LVtTiUDVIvZwhhWW0soQtSQwCgYIKoZIzj0EAwMDaQAwZgIx +AID5v3Lo2zlnpFzTdJFqBpw6fV+vmpI+JBj61f264J/uHMbELiu2dwxhwWaMElX7 +wQIxAJxccFr7Bf1KjaMyT2dq75zQzFuKDMj9x92yAqM2Gas/Yay+Ccpm8FBn7BFl +ke1Qwg== +-----END CERTIFICATE----- +`, + "0.0.6": `-----BEGIN CERTIFICATE----- +MIICnzCCAiWgAwIBAgIUcCg/gZGxk/UjYkhW1jg4Zki+jfwwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDMxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMjU5WhgPMjI5NTA2MDcyMjIyNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAzMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEOSsXBZicyrxy +tHJHKh04Mvu6SKM49IC7rAXw5CjlOod5OTeHg0fa5vVoBME4mlWP+LsMMqf8welC +20b4wMwUC1Hnd66v8crX8L1wvZ9EmKLTvhTd65bS5zloMiSbpdF2o1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUgMMwqaGuUT6JCH0gsbqullaW6/QwCgYIKoZIzj0EAwMDaAAwZQIx +AMggJ1eMmT7C14z7wHCsOdDOgmzg733+a5dsuAcxknoz/sQLN8wqy1JxShWgEIA/ +xwIweTDAX/4JZnr3mlSC57lYXbHk/c319VfN9Ybxg0FaDXa8tOqg7Ml6Uu3IGujQ +a3eY +-----END CERTIFICATE----- +`, + "0.0.7": `-----BEGIN CERTIFICATE----- +MIICoDCCAiWgAwIBAgIUXADwhiD5acpA66GPoXuAevBfZBIwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDQxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjIyMjU5WhgPMjI5NTA2MDcyMjIyNTlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA0MR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEBgLhLiGz8qWu +50vzxSyQkrmhpxuHBJhpGzA0WaUJdAUlaUOL1753ZxxA08wUmcozILNEnMaQ+ROn ++fuGctv90ZcrSekODjxjbKH2ntVLP8xwkBRCTJ0WRBNenxxBD438o1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUhYOOD/z3ty9O5GuSTXnyujIqBRgwCgYIKoZIzj0EAwMDaQAwZgIx +AMxbZ4gvkXaORauQFUPRYwOJrihWIA+3ttGDua//YfEbshytQ8b4L65W/1Xs8eOd +DwIxAImwTzRam8tScdOzmuGgPcML2lkETMpMA2rZYVyEL/VNktIxvB2oE+4M0v5l +r8IbTA== +-----END CERTIFICATE----- +`, +}; + +/** @type {{[key: string]: string}} */ +const MAINNET_CERTS = { + "0.0.3": `-----BEGIN CERTIFICATE----- +MIICnjCCAiWgAwIBAgIUZWoT9TlgbZy+syLbqZhO5++1cVgwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDAxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjQ3WhgPMjI5NTA2MDcyMjQyNDdaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAwMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8NhDGK/dgWvD +RHEJ8af7CBDdhvujH5XIrLen33GTLY8DbJwJW2jdsLGx3+DRVVmeNQZxCbcGj0e2 +IyypkG6s0mtnmeymD8mI3JU8m1aZiuIptZSH3Bw1BNn2hKU4x42co1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUbYGliiNtMkGaroQxXWCl+kYHDBwwCgYIKoZIzj0EAwMDZwAwZAIw +ImTOEYu0y73Ggt4NAjFFsN2sV7CsEL3NoJqJ7MZ6U+b3Ax1hnc1eE0oei6xH4VNF +AjBB4iZNvAn6Esiu4k+JPlYuMesplgMv33fU5GsfvLIovN8pOJDe0c+CUmsnfGbP +OsQ= +-----END CERTIFICATE----- +`, + "0.0.4": `-----BEGIN CERTIFICATE----- +MIICnjCCAiWgAwIBAgIUEGWU0F4aKffY+le55ahQaScDYDwwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDExHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjQ3WhgPMjI5NTA2MDcyMjQyNDdaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAxMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEqW6TqxMmjL3h +9AVBgfVaFRZlXUcyWa+QYhzxr8sksgJqfDbmGtdaHIdiL1qCPuC4v4G3qrAbXZRm +TYNo5Lz0X2ic5pES6DbacdjOgHH7TAY4BVKkuVrydln2jjhh7SmBo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUcBlY5a1rV0H1iQuJMwWxrTEWQ6MwCgYIKoZIzj0EAwMDZwAwZAIw +R+mY9B2U26yD44s03hjz4TlpkyXbVfmgL3Elqo3lrWDJtvT4zpjGjxg3Q1P3SpZQ +AjAy9DRVrZPzq8iq5Ir7B8XgLQH5QL7SQ3tUL1HzXJYOukvn9Ofr+QADhpb0oJLB +Kug= +-----END CERTIFICATE----- +`, + "0.0.5": `-----BEGIN CERTIFICATE----- +MIICnjCCAiWgAwIBAgIUbxzfD3ihIK5snumqqKtqtcBPSSQwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDIxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjQ3WhgPMjI5NTA2MDcyMjQyNDdaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAyMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEWoAjWmW7vpUr +U69wRbK9Firons4kRoin6N8lMjCD+xzsrsT6/wycpzC0F8fxfIvOYSMWRtinhOKl +ZAxp60OWYP87iH7RqWBAnHIJZj/znKTGd+8Sqp/RVQmButFHg/+Go1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUTMtwuDzI4Hun7SPp2Nb3scjUUXkwCgYIKoZIzj0EAwMDZwAwZAIw +HKAgaX39Lgc+4/xHXzZR9mi2p3pf6CDO85Xm56UR/t48HnBkRorR3TFCBXACeIIs +AjBtXglpDnRf6M+nVBlxLdwCQXiwr6vQJ9+dUo+suNkZ1JBmtHypyIqkG2yT4z9C +Lcs= +-----END CERTIFICATE----- +`, + "0.0.6": `-----BEGIN CERTIFICATE----- +MIICoDCCAiWgAwIBAgIUPwXdJvpCJYO9lm6uQN3S1aBi3PswCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDMxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjQ4WhgPMjI5NTA2MDcyMjQyNDhaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDAzMR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8PwBQ0ywu+0t +eIYbaiKwzGEScQMOYFYAMw49++6bGRiH/XZjsypqlJWy3F/mB3+HNVZsqgB61Jpj +2p98Afkl57MYWhWM29t/x5qAQ8LhKGu2k+BOnCcvHDU2pR+fmFSOo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUgI4r3/iwzFN2wh76y/4XDBk7wgkwCgYIKoZIzj0EAwMDaQAwZgIx +ANAjwHdTWYMCCjrtb2NWzDpsKjf3m6ZcaxbEcM1ta/Zji/4x0+VRZa917CkfaEsr +LAIxAK/erPvIXRU9eNaK/TAQqppSRaF35G6iNnYjQZzfjTU2DczhT4oCjKzGoCHT +kI1zOg== +-----END CERTIFICATE----- +`, + "0.0.7": `-----BEGIN CERTIFICATE----- +MIICnzCCAiWgAwIBAgIUXUGzJj13Ck2Cp0BKauLOdzgCPwIwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDQxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjQ4WhgPMjI5NTA2MDcyMjQyNDhaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA0MR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8Ee64Tbu53i/ +KsuLOJG3GQ4e9gQ+9BtEy7U8kfFzRHh6Ejn7LOW38ZdKX1HP4zXuUusjNvytqDvr +7eclitqnegcEOkIeFK3wQwBoNILuq+r4LRVi19V+AIcl5w3qkJvIo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQU2tbfu7hd7USgbS2WsG/6BduKEAMwCgYIKoZIzj0EAwMDaAAwZQIw +Rw/BOLoScmU7P/1JnNPsGarmnvcuJrokAv1wk6j8s5LGuQHReX+d+O3RPLggwcAY +AjEAjoZnt9simul4cVcVy4G/0f39atanUva17gyzlYXEYx7B6UloxLeEcZhlbBf8 +GjRf +-----END CERTIFICATE----- +`, + "0.0.8": ``, + "0.0.9": ``, + "0.0.10": `-----BEGIN CERTIFICATE----- +MIICnzCCAiWgAwIBAgIUNauEDBCmP9igXLWtRpzkQqIGo/wwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDcxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjQ5WhgPMjI5NTA2MDcyMjQyNDlaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA3MR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEjbkoJBshQXUy +qm5K8ldpTDR94Wk8iEM7QwHfceIxK5pPgaVGRkoJyVLSK5LMH4jyaIHUrtA0lIBQ +o0MsYkq7TOOm7+vo1Yrd8EMbu5StMb3gsXUrj7E/SBKIxULak6hCo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUyKHMzIBPRV/mrgG7tIjzOiw2xbUwCgYIKoZIzj0EAwMDaAAwZQIx +ANsigVtLgTdKWBPVJPstWA0H8yihf0/dmM3GO4qp5keGTWz/O3tnom4iDB6eSrcA +jwIwU82Dh+Wxl3kAD3YJH5VhlfHTm1rPlJETBHZgvPBOYqippao6+WZFEpn2/IDC +NTjn +-----END CERTIFICATE----- +`, + "0.0.11": `-----BEGIN CERTIFICATE----- +MIICnjCCAiWgAwIBAgIUWtnJm2kswnXYu7/S5BnnTQiDRcUwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDgxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjUwWhgPMjI5NTA2MDcyMjQyNTBaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA4MR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEjY9Rl+s00xFV +tdTpAixLR4kJIGLfSLOdm+ofU/KuKMRSz5x1ORhIicppKZK24U5WLGXQU1fKLvxX +OmqwqL+6oAONmiHszqVdhWne4QPUba0yw7rf1/OI+IFF1HRK3shQo1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUb/htoTodbq5hjP5RNlQ0rkKwWB0wCgYIKoZIzj0EAwMDZwAwZAIw +bO+9yArr21XKXjYHPadEAYINDxgXEC3W8e3X6MJsHCIZITddWWOyXRNFhz504vN0 +AjB8aBuhrKcg1b4CrQDZQcosyVPUGIZKkXdQFfbVdivKrGZvqLS+GdPLd3v2MmHY +orA= +-----END CERTIFICATE----- +`, + "0.0.12": `-----BEGIN CERTIFICATE----- +MIICoDCCAiWgAwIBAgIUHBsegV0bKtwpHRoOnnhbK7CTHxMwCgYIKoZIzj0EAwMw +gYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExEDAOBgNVBAMMBzAw +MDAwMDkxHzAdBgkqhkiG9w0BCQEWEGFkbWluQGhlZGVyYS5jb20wIBcNMjEwODIz +MjI0MjUwWhgPMjI5NTA2MDcyMjQyNTBaMIGEMQswCQYDVQQGEwJVUzELMAkGA1UE +CAwCVFgxEzARBgNVBAcMClJpY2hhcmRzb24xDzANBgNVBAoMBkhlZGVyYTEPMA0G +A1UECwwGSGVkZXJhMRAwDgYDVQQDDAcwMDAwMDA5MR8wHQYJKoZIhvcNAQkBFhBh +ZG1pbkBoZWRlcmEuY29tMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEK+ZAs/00RXaj +buQJJy4zwr/YTj9h5V+vbY7sq9Z1RByEwTRRQOI3OuzzMq1EWKkVJKF/QF5b4yda +x6W9O/NT4EjBXH5XR5X1V6h7aT01YBqsxgMxuUP7kw9K+fW4k6Zao1QwUjAPBgNV +HREECDAGhwR/AAABMAsGA1UdDwQEAwIEsDATBgNVHSUEDDAKBggrBgEFBQcDATAd +BgNVHQ4EFgQUKbecoYirLjf2O2oPkoggEE2P7FcwCgYIKoZIzj0EAwMDaQAwZgIx +AP67wsVOkeFo/9QRo+PnZhzEvjOZ/+IUoUhimdljcVwn79tzNP+obf7VW3Oq1wH7 +4wIxAL65+WmMTMoI2cN7TCiL7G/W2ChDsASeHfaP/4e4ZViNONWotlY9i9aS3Kwt +LTea1Q== +-----END CERTIFICATE----- +`, + "0.0.13": `-----BEGIN CERTIFICATE----- +MIICoDCCAiegAwIBAgIUBNxMZRKru9jzFA8zsOAI4xkMFCMwCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDEwMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1MFoYDzIyOTUwNjA3MjI0MjUwWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTAxHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAShUi9sglwb +0U8QUrGOXJuHRXA9HP8RypkgNBwNRs1YcmPLcuwK70unWlkB81M44IQ7z/dG/0cW +hfFdRI5x4jAeiUFivmWmMLT6lJMPxJ0BkWTGVFVwI3SKcgSvHP9pNS2jVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBSqIMCDzCKKwJJLCXhu9YJYPw6lsDAKBggqhkjOPQQDAwNnADBk +AjBl0bJG2A3443ybvrkKjWu8do6nDSR08/M49+19QfA1aDw0nb2sdCOE+xNitpQ9 +7ngCMGuQHmnKA2EyOIVpNl2EtRoG+vdmLJQaoukhmCWjkGrQHkai473tGa9cRZ/8 ++RZFzw== +-----END CERTIFICATE----- +`, + "0.0.14": `-----BEGIN CERTIFICATE----- +MIICoTCCAiegAwIBAgIUJcQrEmPlIh0KWwiC2X6lZ/OdNs8wCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDExMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1MVoYDzIyOTUwNjA3MjI0MjUxWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTExHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASxRizKJSbB +HmG2amvTHLCyExJngCh42agaFkv5Ab9mZYbqZPe0nUn/8RlVAvEiRNggCMYXC6MU +e4J6D1aeLhYaa0UY8Fmxd20NUjAOWhJgUXds4ILMMVG+pevofeC8AsujVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBS2Ic+LU/6Wssns4Yyf3N6E666xDzAKBggqhkjOPQQDAwNoADBl +AjAH0JMX48GD6vThA6FUsVnJmBID376PRZgxhuZvn9C0HawvNjZVQTkpzpYCwmia +dO4CMQCotakNxyiOxu/BbnPx6ld5+dqVCugsfqClhUhy8ROpNHfKxp3rW7HopowT +WiMlIyI= +-----END CERTIFICATE----- +`, + "0.0.15": `-----BEGIN CERTIFICATE----- +MIICoDCCAiegAwIBAgIUSFFNFv1iquxd5txlWA3PlkNju2EwCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDEyMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1MVoYDzIyOTUwNjA3MjI0MjUxWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTIxHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQus3nAPZkb +ja4Efo7iD4s8NLsFwEwQXQBgBGIJwtA2JRgLyXeWpuu125ib6qJzT8CHvQZhel3b +cwYWi4f2JpabMDepHELLxwZ9fILnAQ8GiHlzhrVq2NI15DI84dXVe4OjVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBSEO/JFC5/fDcT2gtipDMYMMTd96DAKBggqhkjOPQQDAwNnADBk +AjBalAU47XQL4ziHD8lj21pcp3+R5FKzn96HclMT/vraknCT1Sl+vCf6EYsqmi6Z ++RwCMDpxL6P6OMqyE+HzAeYQ4Fa7MYEQfZGMjka4zxetBLvIpwUCT4EAO8gv9GoU +wCBUzQ== +-----END CERTIFICATE----- +`, + "0.0.16": `-----BEGIN CERTIFICATE----- +MIICoDCCAiegAwIBAgIUdnkil4P+VthVMnqygVwGKLt7VfAwCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDEzMR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1MVoYDzIyOTUwNjA3MjI0MjUxWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTMxHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARUdz9ig/iA +hEAth2YinHKY6WM63BAxUVItzgk65l1T4wTzwoK4XEwclY5vIeFmZy2e0s95lWgq +SI68VS9gmJ3xp8Q9wOel/bvuF2tvNZmF393TeoNQQVHrQM1yJAx+nPyjVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBTBFdNwHKSRDo6CxfA1aglY0N8joTAKBggqhkjOPQQDAwNnADBk +AjAqPIel58Rcl2kDxZxJPD9mK9xW4TU+d2NuP3n140TQ6nPlw1OwCPI7a4i3wfEe +08ICMBbrpNRdFZcvy76KoLPfTPvqbtWWaR/0tLZg4Rjj3x7SYgUg3vrVDmodHGkb +4T2Raw== +-----END CERTIFICATE----- +`, + "0.0.17": `-----BEGIN CERTIFICATE----- +MIICoDCCAiegAwIBAgIUDg+G4Ep+KEmIo+nCOY8DjFX60swwCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDE0MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1MloYDzIyOTUwNjA3MjI0MjUyWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTQxHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASCQRL5xUUh +1bsTXRPAf/qVFWEOxsJTiMlF3+UJ4MajWE5zmc2QNIzqj7NE24z3fNxgjViNK/8+ +oBNQeqXfyJ/4etNMzTyG4JTsvWRAQ3aR1J4WDbfwpcgw6AIOKq9OLP6jVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBQB9V2fygf48zyyVL3bnAxCLDUV9zAKBggqhkjOPQQDAwNnADBk +AjBonlThjjvi3fg7ODQcatPHBkp8Yon/p1ukm3YzYA3kitqroXU7BkmwRae2fbqD +TTICMHI+fAy+xWGwXAFNcvNTop11IIoszcgJJY+1Mc2Q/USk3pP6iezta+rvnaWu +7JySHg== +-----END CERTIFICATE----- +`, + "0.0.18": `-----BEGIN CERTIFICATE----- +MIICojCCAiegAwIBAgIUBvI2Vq6O8yXNzbQlj6uQOdpd1lIwCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDE1MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1MloYDzIyOTUwNjA3MjI0MjUyWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTUxHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR+jFDSzCdn +mMQpgz/vrmD/xioMioumUmyLAkB+voTNsMAOtiaDVbvJty3b4SJETv5tuZyaF5Gb +QAYuKsP7X8siCCVLZC9i9nCg46NHtuQkEmw1pzUUDmYFDfSV2tWedNqjVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBSqvCmoaVEp2d9WPctby+ooPMGmvTAKBggqhkjOPQQDAwNpADBm +AjEA9fQ2OFZa7fAQGGYydfVaUF0ObxKj3T+hyl0jiCKLe+hyxJSrXCFS2BM71UiG +ZMVxAjEAmCzESBzTVvl4Uv3TyActGTijTCqTNpN3gJmQbZYjKVtqf8Wxj9WeH0pM +E8BlA/qE +-----END CERTIFICATE----- +`, + "0.0.19": `-----BEGIN CERTIFICATE----- +MIICojCCAiegAwIBAgIUZBwp7UPLJkDgngbUIx5xjbAn+7YwCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDE2MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1M1oYDzIyOTUwNjA3MjI0MjUzWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTYxHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASCVYu2uF3T +kCkyRP0FfXVyyTA1z8DFqCKGrcODgGJuVAk59H6u8FIRsNipkb3BXFI0xGccok5X +T+t5bMaGDHYJ4fjU78UtPNmankQ5HoiMRJpy7Vn8mzizUzUqGpnhu6GjVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBQzE6RGn4YlIbdrl0niKWTtJzfXoTAKBggqhkjOPQQDAwNpADBm +AjEAobnXnwlNGNWoHscbl/ytUBSyjC7V11sLYJqtORSRX3k2+bFGsg4ltmOVjTdd +lXatAjEA/Ja3jufmdruqfLa6qigXuYI00YaI96sOwNhdHlnksYfqF41nDe4BsSW6 +eQ6N5M9d +-----END CERTIFICATE----- +`, + "0.0.20": `-----BEGIN CERTIFICATE----- +MIICoTCCAiegAwIBAgIUE1ZRB5n+Yby+Mwgb2xAcVfTZ53kwCgYIKoZIzj0EAwMw +gYUxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJUWDETMBEGA1UEBwwKUmljaGFyZHNv +bjEPMA0GA1UECgwGSGVkZXJhMQ8wDQYDVQQLDAZIZWRlcmExETAPBgNVBAMMCDAw +MDAwMDE3MR8wHQYJKoZIhvcNAQkBFhBhZG1pbkBoZWRlcmEuY29tMCAXDTIxMDgy +MzIyNDI1M1oYDzIyOTUwNjA3MjI0MjUzWjCBhTELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAlRYMRMwEQYDVQQHDApSaWNoYXJkc29uMQ8wDQYDVQQKDAZIZWRlcmExDzAN +BgNVBAsMBkhlZGVyYTERMA8GA1UEAwwIMDAwMDAwMTcxHzAdBgkqhkiG9w0BCQEW +EGFkbWluQGhlZGVyYS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR0OfTmHjxT +kBiU3GMa/bTvlTswCDAuFQGIIpMWHaf6V4ighzmn20jCg0AVFStb2q7YLRr4HUx8 +ToMzsd7/yjl74BwJgfZnL75T/JInwyMgOBiCTXEf6qVDvhNzL4QJuVujVDBSMA8G +A1UdEQQIMAaHBH8AAAEwCwYDVR0PBAQDAgSwMBMGA1UdJQQMMAoGCCsGAQUFBwMB +MB0GA1UdDgQWBBQFKRUUmdFcDFQzBN9XqMvLgPd7NzAKBggqhkjOPQQDAwNoADBl +AjEA5MUUXSehY3KVIv/2LMgrqo1kPiV39fwYuLSnsMJ67wK8yN1NAkkycg6q2K6g +rBIvAjB3J3a40TINOZTYG+eQs+MSWyfANJLRuJTEOorXzMWM6+05+JYhPnLA8hke +CRfzmSw= +-----END CERTIFICATE----- +`, +}; + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/Node.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicCreateTransaction.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicCreateTransaction.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicCreateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusCreateTopicTransactionBody} HashgraphProto.proto.IConsensusCreateTopicTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Create a topic to be used for consensus.\n */\nclass TopicCreateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * @param {object} props\n * @param {Key} [props.adminKey]\n * @param {Key} [props.submitKey]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {string} [props.topicMemo]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._submitKey = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n /**\n * @private\n * @type {Duration}\n */\n this._autoRenewPeriod = new _Duration_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?string}\n */\n this._topicMemo = null;\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.submitKey != null) {\n this.setSubmitKey(props.submitKey);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.topicMemo != null) {\n this.setTopicMemo(props.topicMemo);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TopicCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const create =\n /** @type {HashgraphProto.proto.IConsensusCreateTopicTransactionBody} */ (\n body.consensusCreateTopic\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobufTransactions(\n new TopicCreateTransaction({\n adminKey:\n create.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufKey(create.adminKey)\n : undefined,\n submitKey:\n create.submitKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobufKey(create.submitKey)\n : undefined,\n autoRenewAccountId:\n create.autoRenewAccount != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(create.autoRenewAccount)\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? create.autoRenewPeriod.seconds != null\n ? create.autoRenewPeriod.seconds\n : undefined\n : undefined,\n topicMemo: create.memo != null ? create.memo : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @deprecated - Use `getTopicMemo()` instead\n * @returns {?string}\n */\n get topicMemo() {\n return this._topicMemo;\n }\n\n /**\n * @returns {?string}\n */\n getTopicMemo() {\n return this._topicMemo;\n }\n\n /**\n * @param {string} topicMemo\n * @returns {this}\n */\n setTopicMemo(topicMemo) {\n this._requireNotFrozen();\n this._topicMemo = topicMemo;\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAdminKey()` instead\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @returns {?Key}\n */\n getAdminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @deprecated - Use `getSubmitKey()` instead\n * @returns {?Key}\n */\n get submitKey() {\n return this._submitKey;\n }\n\n /**\n * @returns {?Key}\n */\n getSubmitKey() {\n return this._submitKey;\n }\n\n /**\n * @param {Key} submitKey\n * @returns {this}\n */\n setSubmitKey(submitKey) {\n this._requireNotFrozen();\n this._submitKey = submitKey;\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAutoRenewAccountId()` instead\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @returns {?AccountId}\n */\n getAutoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n autoRenewAccountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? autoRenewAccountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(autoRenewAccountId);\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAutoRenewPeriod()` instead\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * @returns {Duration}\n */\n getAutoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * Set the auto renew period for this account.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.consensus.createTopic(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"consensusCreateTopic\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IConsensusCreateTopicTransactionBody}\n */\n _makeTransactionData() {\n return {\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n submitKey:\n this._submitKey != null\n ? this._submitKey._toProtobufKey()\n : null,\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n autoRenewPeriod: this._autoRenewPeriod._toProtobuf(),\n memo: this._topicMemo,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TopicCreateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_1__.TRANSACTION_REGISTRY.set(\n \"consensusCreateTopic\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TopicCreateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicCreateTransaction.js?"); -/***/ }), +/** + * @typedef {import("./account/AccountId.js").default} AccountId + * @typedef {import("./address_book/NodeAddress.js").default} NodeAddress + * @typedef {import("./channel/Channel.js").default} Channel + * @typedef {import("./ManagedNodeAddress.js").default} ManagedNodeAddress + * @typedef {import("./LedgerId.js").default} LedgerId + */ -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicDeleteTransaction.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicDeleteTransaction.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {object} NewNode + * @property {AccountId} accountId + * @property {string} address + * @property {(address: string, cert?: string) => Channel} channelInitFunction + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicDeleteTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _TopicId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusDeleteTopicTransactionBody} HashgraphProto.proto.IConsensusDeleteTopicTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Delete a topic.\n *\n * No more transactions or queries on the topic will succeed.\n *\n * If an adminKey is set, this transaction must be signed by that key.\n * If there is no adminKey, this transaction will fail with Status#Unautorized.\n */\nclass TopicDeleteTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {TopicId | string} [props.topicId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TopicId}\n */\n this._topicId = null;\n\n if (props.topicId != null) {\n this.setTopicId(props.topicId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TopicDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const topicDelete =\n /** @type {HashgraphProto.proto.IConsensusDeleteTopicTransactionBody} */ (\n body.consensusDeleteTopic\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new TopicDeleteTransaction({\n topicId:\n topicDelete.topicID != null\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(topicDelete.topicID)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TopicId}\n */\n get topicId() {\n return this._topicId;\n }\n\n /**\n * Set the topic ID which is being deleted in this transaction.\n *\n * @param {TopicId | string} topicId\n * @returns {TopicDeleteTransaction}\n */\n setTopicId(topicId) {\n this._requireNotFrozen();\n this._topicId =\n typeof topicId === \"string\"\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(topicId)\n : topicId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._topicId != null) {\n this._topicId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.consensus.deleteTopic(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"consensusDeleteTopic\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IConsensusDeleteTopicTransactionBody}\n */\n _makeTransactionData() {\n return {\n topicID: this._topicId != null ? this._topicId._toProtobuf() : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TopicDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"consensusDeleteTopic\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TopicDeleteTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicDeleteTransaction.js?"); +/** + * @typedef {object} CloneNode + * @property {Node} node + * @property {ManagedNodeAddress} address + */ -/***/ }), +/** + * @augments {ManagedNode} + */ +class Node extends ManagedNode { + /** + * @param {object} props + * @param {NewNode=} [props.newNode] + * @param {CloneNode=} [props.cloneNode] + */ + constructor(props = {}) { + super(props); + + if (props.newNode != null) { + /** @type {AccountId} */ + this._accountId = props.newNode.accountId; + + /** @type {NodeAddress | null} */ + this._nodeAddress = null; + } else if (props.cloneNode != null) { + /** @type {AccountId} */ + this._accountId = props.cloneNode.node._accountId; + + /** @type {NodeAddress | null} */ + this._nodeAddress = props.cloneNode.node._nodeAddress; + } else { + throw new Error(`failed to create node: ${JSON.stringify(props)}`); + } + } + + /** + * @returns {string} + */ + getKey() { + return this._accountId.toString(); + } + + /** + * @returns {ManagedNode} + */ + toInsecure() { + return /** @type {this} */ ( + new Node({ + cloneNode: { node: this, address: this._address.toInsecure() }, + }) + ); + } + + /** + * @returns {ManagedNode} + */ + toSecure() { + return /** @type {this} */ ( + new Node({ + cloneNode: { node: this, address: this._address.toSecure() }, + }) + ); + } + + /** + * @param {LedgerId|string} ledgerId + * @returns {this} + */ + setCert(ledgerId) { + switch (ledgerId.toString()) { + case "previewnet": + this._cert = PREVIEWNET_CERTS[this._accountId.toString()]; + break; + case "testnet": + this._cert = TESTNET_CERTS[this._accountId.toString()]; + break; + case "mainnet": + this._cert = MAINNET_CERTS[this._accountId.toString()]; + break; + } + + return this; + } + + /** + * @returns {AccountId} + */ + get accountId() { + return this._accountId; + } + + /** + * @returns {NodeAddress | null} + */ + get nodeAddress() { + return this._nodeAddress; + } + + /** + * @param {NodeAddress} nodeAddress + * @returns {this} + */ + setNodeAddress(nodeAddress) { + this._nodeAddress = nodeAddress; + return this; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/address_book/AddressBooks.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicId.js": -/*!**********************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicId.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicId; }\n/* harmony export */ });\n/* harmony import */ var _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../EntityIdHelper.js */ \"./node_modules/@hashgraph/sdk/src/EntityIdHelper.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"long\").Long} Long\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Unique identifier for a topic (used by the consensus service).\n */\nclass TopicId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n */\n constructor(props, realm, num) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @param {string} text\n * @returns {TopicId}\n */\n static fromString(text) {\n const result = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromString(text);\n const id = new TopicId(result);\n id._checksum = result.checksum;\n return id;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITopicID} id\n * @returns {TopicId}\n */\n static _fromProtobuf(id) {\n const topicId = new TopicId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.topicNum != null ? id.topicNum : 0\n );\n\n return topicId;\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TopicId}\n */\n static fromBytes(bytes) {\n return TopicId._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.TopicID.decode(bytes)\n );\n }\n\n /**\n * @param {string} address\n * @returns {TopicId}\n */\n static fromSolidityAddress(address) {\n const [shard, realm, topic] = _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.fromSolidityAddress(address);\n return new TopicId(shard, realm, topic);\n }\n\n /**\n * @returns {string}\n */\n toSolidityAddress() {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toSolidityAddress([this.shard, this.realm, this.num]);\n }\n\n /**\n * @returns {HashgraphProto.proto.ITopicID}\n */\n _toProtobuf() {\n return {\n topicNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_1__.proto.TopicID.encode(this._toProtobuf()).finish();\n }\n\n /**\n * @returns {TopicId}\n */\n clone() {\n const id = new TopicId(this);\n id._checksum = this._checksum;\n return id;\n }\n\n /**\n * @param {TopicId} other\n * @returns {number}\n */\n compare(other) {\n return _EntityIdHelper_js__WEBPACK_IMPORTED_MODULE_0__.compare(\n [this.shard, this.realm, this.num],\n [other.shard, other.realm, other.num]\n );\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicId.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicInfo.js": -/*!************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicInfo.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicInfo; }\n/* harmony export */ });\n/* harmony import */ var _TopicId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _LedgerId_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../LedgerId.js */ \"./node_modules/@hashgraph/sdk/src/LedgerId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n/**\n * Current state of a topic.\n */\nclass TopicInfo {\n /**\n * @private\n * @param {object} props\n * @param {TopicId} props.topicId\n * @param {string} props.topicMemo\n * @param {Uint8Array} props.runningHash\n * @param {Long} props.sequenceNumber\n * @param {?Timestamp} props.expirationTime\n * @param {?Key} props.adminKey\n * @param {?Key} props.submitKey\n * @param {?Duration} props.autoRenewPeriod\n * @param {?AccountId} props.autoRenewAccountId\n * @param {LedgerId|null} props.ledgerId\n */\n constructor(props) {\n /**\n * The ID of the topic for which information is requested.\n *\n * @readonly\n */\n this.topicId = props.topicId;\n\n /**\n * Short publicly visible memo about the topic. No guarantee of uniqueness.\n *\n * @readonly\n */\n this.topicMemo = props.topicMemo;\n\n /**\n * SHA-384 running hash of (previousRunningHash, topicId, consensusTimestamp, sequenceNumber, message).\n *\n * @readonly\n */\n this.runningHash = props.runningHash;\n\n /**\n * Sequence number (starting at 1 for the first submitMessage) of messages on the topic.\n *\n * @readonly\n */\n this.sequenceNumber = props.sequenceNumber;\n\n /**\n * Effective consensus timestamp at (and after) which submitMessage calls will no longer succeed on the topic.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * Access control for update/delete of the topic. Null if there is no key.\n *\n * @readonly\n */\n this.adminKey = props.adminKey;\n\n /**\n * Access control for ConsensusService.submitMessage. Null if there is no key.\n *\n * @readonly\n */\n this.submitKey = props.submitKey;\n\n /**\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /**\n * @readonly\n */\n this.autoRenewAccountId = props.autoRenewAccountId;\n\n this.ledgerId = props.ledgerId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IConsensusGetTopicInfoResponse} infoResponse\n * @returns {TopicInfo}\n */\n static _fromProtobuf(infoResponse) {\n const info = /** @type {HashgraphProto.proto.IConsensusTopicInfo} */ (\n infoResponse.topicInfo\n );\n\n return new TopicInfo({\n topicId: _TopicId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITopicID} */ (\n infoResponse.topicID\n )\n ),\n topicMemo: info.memo != null ? info.memo : \"\",\n runningHash:\n info.runningHash != null ? info.runningHash : new Uint8Array(),\n sequenceNumber:\n info.sequenceNumber != null\n ? info.sequenceNumber instanceof long__WEBPACK_IMPORTED_MODULE_3__\n ? info.sequenceNumber\n : long__WEBPACK_IMPORTED_MODULE_3__.fromValue(info.sequenceNumber)\n : long__WEBPACK_IMPORTED_MODULE_3__.ZERO,\n expirationTime:\n info.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(info.expirationTime)\n : null,\n adminKey:\n info.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobufKey(info.adminKey)\n : null,\n submitKey:\n info.submitKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobufKey(info.submitKey)\n : null,\n autoRenewPeriod:\n info.autoRenewPeriod != null\n ? new _Duration_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](\n /** @type {Long} */ (info.autoRenewPeriod.seconds)\n )\n : null,\n autoRenewAccountId:\n info.autoRenewAccount != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.autoRenewAccount)\n : null,\n ledgerId:\n info.ledgerId != null\n ? _LedgerId_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"].fromBytes(info.ledgerId)\n : null,\n });\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.IConsensusGetTopicInfoResponse}\n */\n _toProtobuf() {\n return {\n topicID: this.topicId._toProtobuf(),\n topicInfo: {\n memo: this.topicMemo,\n runningHash: this.runningHash,\n sequenceNumber: this.sequenceNumber,\n expirationTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : null,\n adminKey:\n this.adminKey != null\n ? this.adminKey._toProtobufKey()\n : null,\n submitKey:\n this.submitKey != null\n ? this.submitKey._toProtobufKey()\n : null,\n autoRenewPeriod:\n this.autoRenewPeriod != null\n ? this.autoRenewPeriod._toProtobuf()\n : null,\n autoRenewAccount:\n this.autoRenewAccountId != null\n ? this.autoRenewAccountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TopicInfo}\n */\n static fromBytes(bytes) {\n return TopicInfo._fromProtobuf({\n topicInfo: _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ConsensusTopicInfo.decode(bytes),\n });\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_5__.proto.ConsensusTopicInfo.encode(\n /** @type {HashgraphProto.proto.IConsensusTopicInfo} */ (\n this._toProtobuf().topicInfo\n )\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicInfo.js?"); +const PREVIEWNET_ADDRESS_BOOK = NodeAddressBook._fromProtobuf( + lib.proto.NodeAddressBook.decode( + decode( + "0ad0070a0e33352e3233312e3230382e31343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340acf070a0d332e3231312e3234382e31373210a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ace070a0c34302e3132312e36342e343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ad1070a0d33352e3139392e31352e31373710a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad1070a0d332e3133332e3231332e31343610a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad0070a0c34302e37302e31312e32303210a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad2070a0e33352e3232352e3230312e31393510a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d35322e31352e3130352e31333010a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d3130342e34332e3234382e363310a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad2070a0e33352e3234372e3130392e31333510a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b35342e3234312e33382e3110a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b31332e38382e32322e343710a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330ad0070a0c33352e3233352e36352e353110a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d35342e3137372e35312e31323710a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad0070a0c31332e36342e3137302e343010a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d33342e3130362e3234372e363510a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33352e38332e38392e31373110a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad1070a0d31332e37382e3233322e31393210a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33342e3132352e32332e343910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390acf070a0b35302e31382e31372e393310a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390ad1070a0d32302e3135302e3133362e383910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a60363465303938363135626634303566376564356134303133343436623839633438386366636436626232356134613637366463373765656131316433336437303236383266306136396138303330653863353737376430653432323033373939", + ), + ), +); +const TESTNET_ADDRESS_BOOK = NodeAddressBook._fromProtobuf( + lib.proto.NodeAddressBook.decode( + decode( + "0a7f0a0c33342e39342e3130362e363110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a80010a0d35302e31382e3133322e32313110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a81010a0e3133382e39312e3134322e32313910a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a82010a0d33352e3233372e3131392e353510a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a7f0a0a332e3231322e362e313310a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d35322e3136382e37362e32343110a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d33352e3234352e32372e31393310a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a80010a0b35322e32302e31382e383610a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a81010a0c34302e37392e38332e31323410a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a82010a0d33342e38332e3131322e31313610a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35342e37302e3139322e333310a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35322e3138332e34352e363510a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a80010a0b33342e39342e3136302e3410a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e35342e3137362e3139392e31303910a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a82010a0d31332e36342e3138312e31333610a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e33342e3130362e3130322e32313810a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a82010a0d33352e3135352e34392e31343710a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a81010a0c31332e37382e3233382e333210a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a83010a0e33342e3133332e3139372e32333010a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e31342e3235322e32303710a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e3136352e31372e32333110a388031a05302e302e392806320218093a60363938333261373361333630326538643166626535616435386431633236333761316236373264373165653837616631306462363438656239316166623232383235336231663437653537643364346134346666353437623333393461613232", + ), + ), +); +const MAINNET_ADDRESS_BOOK = NodeAddressBook._fromProtobuf( + lib.proto.NodeAddressBook.decode( + decode( + "0ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633435363165336332373863643635306538306334313363613434343233633163336331336366313437356636663639373664353937616534333262343961623432303836623739623834313332363035346238623364636635376438666364373962666330353831383363613234636434633163626335373465643131313765326635623762336336336365376230366439623465666366373337353633376234316665366635336338313162396465363134336633613532393537636466393536373735313230623333373033666635373632313430376162393537356263326433356330643434663039383366633165663633613466663532303966303730633932616631303632393536303163393662636564303634656331393031393730313963363831316334633864643830636234663461633731663961643736653761633839343536666266346630313166393061626432643930353336653832333436353166366265663932376533643564386237626634353930353039383362656361336162656632613964393761663334353737326137373430653936393932373562303138656130646632383661646436636539323365663930386662653736326137356632313131363836326462343464336463613164343462346432653864633130363663353030366262356137643935346164323535643462363033323733343735653531316165623438356430363961303637633061623563323435333863393333633036623561366165666139343030356332393135323133653463636461653663393432663632373266396464353238326436623839306631663230656664323339396364363734393234666135373034366163366461333265373339353161373331313365393166633262376666323965343835316238336666333966383362613965633666303863656664626236636262626666616266646661613931643933306637323030646134383133376333393463626431336537303165636463323631366664323162616436383161613466303031303230333031303030312804320218073a603665396138616263646364653665313134396133656265313766643538643839303538333961383664623732623036613365613230616131373666383638623235343838353261653432336437613963366237636666396537313436323961320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613163343037373135343330336363373263346662373639326333663934323531626465633132333961316637613839373261626539316133353332336662656361363235613766666165363430366338353564633261663231313039303062306466306536653664623736333634646661316666653835656461353637393336653239383562383536333461333261613532613635393964643663333062653166376136633562386635656563616632363231643861343539363832666364326462616164313536316431316633336663636237663535303061633536386431363564626561616365333238366432383934663634313239643738316436633732666437643539396339653164336166346161343333633233623931306661653463343834313634316636313532366164373837656265613533393837343136376539643361373363633066623135363432396431356563373633613664306630363131356137396239616637383364373762393864383330393661613437343366393734303864396531346263663464646666653435393137363838343762343063623864613763613337353235366432623933356430393566653235326661653831666636653337663834643761393064376535373061346638656633633764373636656564613437326630393230313939303135613839303832353961383733633534353466636262646361643265353238646538353435356234303833633764633461646335613938386530636464666463313539643564373132616264353434616137336563303239303839383134633938613434663236666330363434363539633138336533313834616132373266386431646330626661336530613536303438346362303535626134646262356363333339656338306264313164363432646333613730326538633730336162323139333038346439626436336630646665313261343333633235373665616637383163666164383637656637306264613631373638623262656631346635306336633362386230393666303230333031303030312805320218083a606464336233653763643361323537643832373665343635333533363162303138623730303931663438363635653832303031306538316563303539326236396264346265316662643765636435303964303730313364643034313238343266640ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623263636163363561643066633736343561383137626661626334383761643765343133313165376133313938623337666238343264383463333935623366363764366264383438663130633666303363323930653866376461613864303031613834343164633335326131393136306133313933653638623832656466313961653637363933613961333364346362383765373839613130373037313535313565613737326361613862383661353639623931633534353038333564396333353466306461636563393766653737303931623435623134373639386237663836303134323264636432323631653932386465346461633963343264636261666466393663303732333362613330323730373666333763393639653865643330623662356438663530333462653764393263353936663862653836316535316663633361323432626639643862653965326139653865306631353565626366663233656666613763643537633130353432383131643830373736633935383535323666646230656161333465653139353564353131313933393066653837336534633034646564643239313635383834623938623436333038373838616537666334643461613461386663396263323637346261333231343933623632343435356164343130633164653731626339356431643931666130663230313431386137393565333039656166323937623639396266323763396661323736336364353963656230323165313662383230306331303630663238313766643833636663373637313833343839343631653335393932393162333830643665393339626161346231393233326136613237326464653635316638303436666463333464623237366137373764366662326265633332353562326363323434623461663536366231303566333063363530366464616530656233646564646366393437626362396336306530303039383466336234613863366334656434626639306263313933326237663934646333616536623336303030386562393032303430663962303230333031303030312802320218053a603561383634313561303861306138323566336232656237353031303135353230326533313234336665343161303333333834653738633138633131653565386632303964343933623062326664343565303662333734663262363964663564370ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613365333762373663366364356636363232643639323434343464313263363737633339356632623539303266336262393862386138623530353561373037373036636130323863643735303630613264383730326432643862303439343762646366653061386331343161613238343462316530366536363139303031326538623633323661623066613331373937336263376362346432393439663231303861613034633462306339316261613537323866356235363232656337356162663537386131663762343165646532613637656264363963313865353831666466396336303230616330646539636132633331663063363436393030333331316662623563653764623439633738376531613764323761613432356565376238346461376536363933396639633830643065383266636535356530326466633862356337383431386132366161343336353036393837313962616663656366306264343930303061646463666134303537303862646265666262313937343964323264616230303765343464343565613233623130366638383334633135326532353036326434636632346666323533353663376562333732393130353339336662343962616239303461303266306630626234313763643931396433353238393031323865366262666634666163396639306465313138613937346632613664643031653033326137396231373866363066613166636262643032623537303466623436323935633135313930383136333733656464363633356338353639373866316239353033663166373362346230626538616261326564316665656164353939353362663832656664653933613334373161626435356364613362613861363733666262333739393734396662303036643030336630653633663636356333343631643261376232396463386232303462613539613635363638613436616532383738663030643166393439306466396532383066656266343331356561303465616135363861336139666434386336326336336236656364613639303230333031303030312803320218063a606434363430333938303337393230373965636364356134343331316361306463323262353065633839356235366535336431326232396637326463366462613363616665326535623831303466626461303338616635623434376430666231320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393361323135636334613761373232636165396331336162643633366466393963636565633661663964623436623639666135313637313665663530636532343930613938316530396162303139636132636234363831316235623631396431626431643565653666343661343263373737636264656536343261313438346563646635646464333732393634326333386336643433613838353838373434373566353832343434333636346330346466656439623839303435666230383565323563336566636234383431373333656666376335323963313339653639333530633263643739623263386431393637396137313265346538636166643332363735343162383332623365313061303132353564656636396466316539643362386438656166303331316465363764356531326232366464303164626264396433653432643335643964653237313330326530663166363964383763626337616361396538383637653964343238643363616230363636656234393064356662616233306266663366373835643033663230373261343362623962356535343635366135393263623631656166643561356566323834633763616563363666376634373332356363306434633164323766363631643861373438636135303731633036656631333464666639366634303836363838333636643436386132343738303031376530623536616261376661623433623362376330623737393036666165353438326633323831316332393265366231343435346531346238393438303161383661303363633437373934646430643734353237613732653432346564336166613034383939656362396136336632613961653732626537666139383961646630643635613332633835316439383031666334313034386466333335363466633762333137303765633866623830313430666537623761316661313230626131636236363033323463656666623462636332643962623764653063663534633831396632646433626365616465633963323566356531396463396231303230333031303030312806320218093a603365303261363732306334343636353965383633303564353562666565383230623335653635306665636163633535333039373435356532633465303332636339646564313662316262343464336235393262626163623663326266663165360ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303930323539663465336439663066333934323536353438653963373330386231306237333430336363393039346439376164313531623737303631373062393737326365623634643636326563656639303161386437643135643331396135396338623731303731616363643839356237633933363130646336393736663637633465313732396261383337336162376535326133663363386632363534393164646536396436653039393934373065373434353938313133316264393663333665363836353230336662326562643564353065616461666237323633393664656331643931373438393862346539626530346337346433303466656164643963626433323334633362376633333036633939636230633333396663323539363962343164353861326237636663313833326532323664383163313936333939336532323535613038376431363938633033643432313062643634353830363434643039356361373661613137393465646434306331633837623566383261386533396636303365393731313662613034353738653765383033343634393564373835643465663763663737313462396562366635663965306239613934663462373338383436313962393237346434613935656631353735346138396439376566356331613838623664363933653061383065626435333766633963663063613931643163363264393135646537656438313862393532653634633230303239336565386532383461343136613732613365313266633764343233623135386639623439363630636263323436366662656430666564326532346531303266646539343265623463666439346265633436643364393066633038633339666563626130336530636132343634616536363462393739353135626132396531663730326333666537303262653739333739366438656462313761613438633039323930623032343534396630363131663561653233656437653136343432646637643164616432323836633262623039643535323264643365643639386332663032303330313030303128093202180c3a606339373462623938326338313931336237333236643561336639646363343836313261313566376161643032663230376230663130636432303137613666626666353830336537636139626662343730396162323862366230396435623133660ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303962646438653834666164616133353332666334636530316138613137643463336232333266353061393739306532363236383465646334383233653831356131626435623230656365613762663536653239663662623762383331666233626636656663643134373566306238656435666662306231333835623936643136366236323966303339366138666566356630366534626361323565653461313334306565323633613464396262303230643866343732333036663364383836313338646537613031396530353962643061666339303263636261316132313361653264616136306338613031333735356665306134386530333466356234303233613264616465616138386335343836383335336163376137613364663132623266623634313837373465396231346265366561623863633237623838303132616436313632646137346530656562313631333539303566343337333734646162383538366437353061323662626433616332346165643837386334643533653635313037326338373165393464376163633537356339363733383137333461353366656166346437626136626364643234316363363435386336303837643836333032616132353163303466366435366239633332643764393636323437353065643035353738356430373733663433646330393962323863393232383131343865366338316632393766663964313636653030306163303462333132343138363737356663656637356635656261306331303332626631333064663663643761343632313164306466336530353834643932656136373334396438343930353038656234656638386635346338633364343836646538373139663130666139366665623835636337393630373663613738313331386565326439656439303363613133333630343063353961643931613464326636393865393130386165306564623962316362393561643333623139376666623138626431626138623536636265653261616539353835656365323038613165313462343835363436333032303330313030303128083202180b3a603937303834333033333130373866353638326337663332343464383263336233653238316139313837393537386465656163646363326132656265353431616631383831313561643265383338363565356635643234376234613138633165650ab50722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039303938383635646566326632616233373663376630663733386331643837613237616330316166643030383632306333356362366562666362623063333330303331393361333838633334366433303233313732373031323139336262373666643330303462383634333132633638396566353231336362623930313130313530396465616239346632366137333265363337393239646134633463623332353137653361646262333831316435306163346337376331666365386236353136303632313566333437303766336537323635353435653538633839343630396532383337366264623737373566653330343339653065313539326664636230633365653163333035373733643037326136623839353765616663653161313162653936356564616666333834333336366362366134346563323561383930313036653632343735363766373662353530666461343832626165633633303764363938656338383834316664363666323366323130653437623861396463626136626134653166613731366462333363383065333038313934393664636235653536303966623665376336313533373962646465643432376539323331623932353463326261663934333630386138366436393861653961336338363339646638383764366636623561373133383564323433333864393131613231326266373166316532616363386231383662393665633865363963383662366430353832313737373661303963396336383935336564623539313635373862356132363362326634363965336230633037656164613731613434376565613766386663316262383037343235353536376237663062643165366166623033353837313863393862343239653234623232393835393666633736636636616633393663613934333464373932366563376433376434623932616635366434356665666638313936303935323234613931366331666665366236363765323535666333616338636363656639323064633034346232353030333133326238373830363734326630323033303130303031320218033a603333373339306438666561313434616663313265383132353461323864616336656138323839333833366163303732656666643835653061373734383538306566323830393636343863356137663864626234636538313437363831353133370ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130306335376564623966663237366530323362323830323163623164383763646631393636623639386366343865346561616137633639323037376365656538636362323339613463393231353937653865383966376363303564336633313331353738393736633465333134343035643461346530336137323431306335633039636135323761643561383562393938363337653732613332653166626330643535343662323436356539653830366332646435303965623035306162356662323730363366643932383135623164643236383965323131316361656236663534396539346139663030663038323164346361366336613631313766356135333363393236336266303734613330643563626566353064316338633233383762636139373265646564613039383362356430613662353764636230303230303036383238623430653430373662343837306232346261643834303536656535326235663432326538383430303238633235303036333832643865396336363132323566346637366561373265333430363037653966633666336332303433333037366131636138636231356564303361633839363664303530376263646536383165346530323331656539663837643131316537623438616338663934643264383432623532646637336635373363633534313439363437393763363236393638666661653734313866336236313039623561306630396533323233663461346435653335303964643235303133386636626331376266366365636531373539343433306466313830613338653930616466326166666266616430633662386331623837663137386130363164636662666638623932633931363664383734633166663561663466626364626665386539643039393337306464663630626537343736333364333665653465623563643531663665336333333965313531653431626462356135636532633863393761306134336233636434636330383138383463383739663964326633373438343238633835373366313763393066336362643032303330313030303128073202180a3a603734306166366266373339653838336338386633333434633961306638623330316533396463393831633531363365306465326133666634326239396534323665643765353662363766343231383530333834356466363266343963396662300ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393133316161333638663933343532323966393762363235396363636166666561323365303063643565616430326533663639366331653731346565333933396461643836306533386266393561323937346639656234386539333433663861616334303565613935356430353332336531313762336231633934383133613361663432666538303832633364343362616631626434643833363765393364623030616436393665363237613130333661653533346630313165616435653536663337613666666534346236623965303939343031313932616435363061303334366234316138313030393566356632643766643332643665656236353562613735386336623532366331323933383661663731393763376135336165363033643632323833323235343936316631366430656661383037396137363835363138383862653733333439323231373935366262636166616562623631333563356662623234383464356234613566646630333336616330326532366331363532633162643865616633306461653164366433656230306637623466616238643634373866653864393565623931316466393636613064656134653532326462373662383936363537306563633561663039353136343234663061663566386565363665333836643536353037313339393731363961633337353733626635326664303538646539356162326666363865363831313161623233343035656139363462326262383864303263306631636165643731656364643465346534303835393438373666646238353030626335356337626130323036366530356162393864396637653034363664393730326562353765653337323266386663633835613735353035666633323632313730323838623738383732336164623937653464653536323063633930656164313338326663643735373138383966656662313165363737316263336636663366656231396337616335343238373864303361393032373035323663336565643234393465666635346531353363613966363839303230333031303030312801320218043a603765616236393661623935343336363538626331346666366234626534643932356364353162323230646632613164356336656531363061646166323961353165363934646533656531383463653232656164386437646239333231383266330ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038326465373330363566333466666332393334306435393439643232323062316534333636656435636637633665626436313663663934313661353365613030313766366262313136626664336633646566636331356237613464646630653434643032666536393536383830353365373961373730653230316263663731393333393030333965653866303836643466613734366337653035363931383330316639623565383465333932363238323830383561373962333232626361306235643835666539373232316132366262646532353863363230663064636561303261623165646431366363343961336632616239323838653364643166333764633462366136663731333366663932653534316337316237306432613266363664353537323561623138626638366430303965633364323466356431326530623565363830326431313531333732643462373634656265636234616638326636343934383565633537623561303164633637393538663561303363636161623763626139333534613137333732633133313662613437633935336161663934393031623366386332346536613361666436373538653766336231343363653264643363623037316232613734633932316365653934396134623561366265383739663163373930613662386436336231393264376565323961393439316664643638396139386330613763336436303332306631623461633264363232396466643934653432663361363034386137366265316562393538633861313837336265386433333861656339666335396162376633373632363738393430326331666435393566313930383735373565306265383237666334633061346662336433393361643734613934396363393836626662363463616264646165353339333566366463353630373464623933643737656133623831366264643662653533343439373237323238393835396666333463653531383630616666623632316431303438376463333834336631663836643534303334613633653438613161306430323033303130303031280a3202180d3a606132656363316232616539386264323862633161303864386633373161306434663734356337363864306337373339363235363265333433623235643833343235656565613765663865613134323935333432623865623738643332656333660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039383735356134303862353332316532363330353230303064366437643461326333613535346435653133383461396362356562663437346165383832633633623438366264303864313434646466316139346365396137643632353139363330303661666461616334353838343666313736343031393566653235333961363536393330656661383534663231343865363865633161303863316334396432303063336633303435666537313437663036643533346334626432363231303063623164643339373339643736306438316130626432306638336632353564323530376434636362313130366235333631386336613934343039633838376361653236326434636565396338363233323134376365633134303465306335376262613733313731333065653339363433383838616633643539386564643832623863363165363561653831613465316135366263303664333937313433613938643431636138376433656634333365663061656162363830313139316233653338343830393638663636623665383836363261663435613965323132393934663638623238386562393637626562393834373863323433653231333663316131353931663036316635626330346232316666326261343862323966313834333130383838373362646665393966386135326539343038393731383536653830346465613630326133313137383663393835363532393633633361333737303332396234303966373466646663373436623232613566383431383931323037316334636538343663396234623332306665646636653962363465326362653338346639613832623661616164346232303930373433316466316133336636393230376135363536303062653831303730643038333239303039393538353961343439386435623539333135626365626566656538303765623061336139343266316364663333363764643434343466646232393838366566636464306265346162653961313838383033393533383735656461333364623732393839663736336230323033303130303031280b3202180e3a603139366237623132303739376364623361396430303362393833643537646131303331303662313733306531376636376532633762616161646234333738396166313639366461313031316232353362636263383630333333383566303332380ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061396462376638626161313236383938666162373839313135613362356438393734346631393765323830343161653039386633653838366336393837313732316531316262306164313166336365393132346161393631643661306463383435663439373635633366616231393935383430323637366635363434363262663238316462613535383837383066303365393035373938653138343236396161613630663761313437323333316532666231646561646438373763383463626362363431636139653563386164366534356263313539636230373966636230643434396364636438643932333963316130343765376234343864613063646361323636313061323566323936643936653734363962363736643461343434353136653761353965383532393361383038366638343063303532383534653032613863623230303264616433353832356265346438336235326661393165386337336666303439373436313438383632373837633131313866393234643331636261633162343466656666323264343336623339373965616466396234336134626661373265313562343735356663616232363065303661323739633362623733626337663136613036306434643532326664343930353830333838616135393564383034343733366535323266363432343931356637383033623735383365303935636466373863333235313936393764653831623839666235303035343735336231613137663961616662303634643834633939326639616231316363626338636231303831346463616635323634616134356632316264656661633832636361636161663335386533313337336565316261346537343032666438613730656130633238636135636337346463343235313063393639636432633435396231656333363838613031656133396139393237313063643232393763393861383462363334386135373738303466646332333464336665313930336532633231653137326461323862353961653665346337653865646438623731633439643730323033303130303031280c3202180f3a603538343661353366343437353239666439636462373830346364333136383865643665656265336236336461326635663231316666626337333731393763663366316366626664613631626537643135313066306539323339383131376637340ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061386365616333363765623166316465356630643965663365616630646639623938343438666532303830383437363536326130363063353163323839373730623463616366653932636236353536393832336539363263326132633966656435336264333663613361313232646531633532356135383266323561346437643632386331613364356264623839333661656365373531306537353534656537303333303235633039326338323865656235373338626530326564393633646138316135393230353633346365393435343537376162383266343066313366316565353565306165373237653233633330323834623166343462393961636534646463356639616337616438386439666132323535393335623234646362613834303036343265313663663235333263306230643638393239303436303837313563343037366634366438346130653066656433366537366363646339363335356537613236313630393435633262353461653236636330306664303832333236333436656565656137646437356639313931316539396462636239396561346163366261303536633333323238643838316438353833316439636338373935393364613137343664643065653935646332623936666539336261666366663263643764393239353864373864663333663230356437313135656439666163346462366634636336306535366135343431646135623562353566613539393939303265393538613662366334346438313064646335363138313234316238376632326630353961363838306538303231373336643031383937646236353434396365383137613233373564303335353163623064653530376336303961306338303330656366346266646562323133633033646161373634613138323162373234333334663731663736386437616563623237373035326137303333373635663037323138303536633738663261383761663138333836643866363161356366636233663262613464643539393135663133643338363334643136393537353730323033303130303031280d320218103a603030306162636435396133306135333838633530306265363832663663613239343034363239356339323735383831633230643334626230643639306564613762333862366262643037613364643166646662366137303434626230396366660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061663062393134323537626637613436353563346135306430636164356530613165343538316564363632336630653837333066373936623866323963353831373862636363363933326331666333316633396566343462383264336334336233393837333733373366656362313239353232386130346664353061313466333634366438346665316634363763616562393864343633653239373565393935623864326531653339663362663661646463323561653335643635643032363038653033343535333739363665326162636534396238313462656164336331623735373137346165333063303062306334336539396238303439366237326433633133316631633665346663646130356632383131376566396532386334333033626534643863376530343264353862383363633132313934356132633635653739363263616139313835393338663337353764663763636139356366303262356533313934346133613631396130616333663165333462396230313364346332323463346631653730666439666433363938336566383661646535313833363263633833323263306637623631613961633735666238326537623836643638626330663039396130396131346361633561316438643338663961386137306363333766663563633362626432373432666664313436323535633137316536613137383038333237316463653066646536383165643439326362353962303739366432373031373538333864633539303831303765336136656133663961343036623364313133306363656333623437393165343962626332333136303362343661623264306639336434336265373561623961346437313065613934306532383561376231353362306361376364646565366439646365306164383335306334316439306332313562393538383531356166613061633333363561653037653831663362626233366264626561633462333162636231616134653832353635623937376639646164383564363236656566396161613965663864376533666230323033303130303031280e320218113a603933653238313031303462326231376230303935326235613431303264333365646230343363623136646533616433643364363832363066353562623065353837333765613539343463333338663763386362383863373833336663383630630ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038633037626533303561643630623930626132646162333962306565373736306531613232663835373532323534306437306230336233663965343837356133613239616230383038386631343466353765623235326534366261353933383564306536643432373031313764613061626331623362383036393463396135303538623836643631646661303665373136373039633838653866656163376333613065316432356663306165626636613866373666636239396638343566653138313436316361623638353862393763336134303237666233373132623134653663303738396465313764343137363435373765353131343137656231363236393265623037616531653733353532333565396262343339303437623663303136313337383265376464366636303464616134363734363631643533393631663436633366616136623765373637363264333733623562353432623739656139363365666266333361633638313938626232623636316366663637363931366566333732616434633236633231366334626334373837633834656333326431383464373763373531383663303963663364396639313433336361393835333131396261623331666136616432366634353365353936643962646563613638613537363962633866656537613533356438306338633666336566623164666232383861623661393739383534623763653833313234656330643130326166663934633362373466396333373839353863323565623933336464353363316538303561313836353464366439313836393930663635373034323966393630663334653862346637666439393732646362666539323430653037346461326433353561356637656639633161663632656635393832613831373435373862396331356334396563353636626461636233306363666365663039636466653730386164343837343234653963316265363533663965653736363065376439343263316566613564613238366531616464616230366139613333663964653934363739356230323033303130303031280f320218123a603934383235313739643163333934303137306233356432363665346366613830643737386335653966356261653764653833666638636334373431663362653336616336336431653761653439373261656466366263316533636632303638390ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030626531376339393634376365633635613434343037623533353835366233633362616566356235346635363561663538623834353662613863376365353335643561633732633631633434633736623363353763386538363438343136333762653130613833636665333963303932343736643064626534643663646364636437323061333062356266656235316130316131386635383263343566366338363939336663663764663138323933356465316438363930363034346463663335313836393335643962643765656137393532333532626562623465663961653066373636316537306134323337616661393839393636383763613438666366633562303064333830376630353462653066613863336266613432353033386265366566323935313634663232663733623765383863393465613962653861613466336132343563383962396431666435313932663761353062393538623265663831303462333666316266386664326366623238633134323138303063316334376534656639386166313530303730636336643639643137653865623932663138613661613161363532363661343935323338643130336638663639356235376563663337333635306130353230303837343537323162656138313536323739363763383037363336356466386334633761376434646438663263333835306331386662613731656236306536653864666264313936653035333766643730623334346563626363353330646663383364613666656466343964353161393034313935303262613964373063643335663163663363303639346532333534663930363466646266353335656232336332376330613433643062373863316638363763363164393836393564386465663762633261313062623636373463323266363661616230613931383133646466323763646238353263353965663739653162396531613037356661366565323761376533373734646266346232363436353432376536643561623931666537663066336137313738346563613138326235303230333031303030312810320218133a603038393039376465663031623037633764393734613537353532353161366161613061666236623332613534353334336432393138653732626164303433323163313131633234643432373538306633626131653236616139643735653632360ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613561643262373634336130346330353564326638636432353131623135313339666334353537353632313338386534396331313962326633393861636131313066363133393662306338363664653530363335323262623835343032373365313366366439346365316536303433386636616662303061616136343631326637313435653962636538626331613533623934313931336161373663396633613238333366616437636632383563376163326433376639396633633263646234396465346431353165363136373835363466323831663534313432346234316661376335316232613936303232383363376433326565303065623833386461313563333861666339366530363164393763656465323231363566663161613935396631633432373562326430393863343035383661353537396662623363623930303732373034313230613861363661353237306634666366643130383663393233363930613335653766643434356533336163303366313339633638363835353635373063646334616166323231303761366331613434323435366137633663373965653034303930653765356434663636626361363063613166343762366466623534336461633363626631396137373139613866353562366638336234613362386136366436303235366430613436353531666137303234626430353633316238613535383038373732353463326632663236386364633333643264626263666237333365396662653233336262396362353961623331613031343862323365386334323638306666313061663463373961346430383334366662373961393364393632393534386561663162623132343639386661656661346364643732343432633033613034623733333433326637343839303361333235633238336434353661623961653932316165376564333339316535643137383765666463323335343061376238356336393161653837306130376639306231316331336233326365343365616564313562333639363835636534393137376363393835303230333031303030312811320218143a603939666162633461646534653636326336653238323366346139366562323134343034383465356136643064333132623730633036386432326236323936333830376332333361343964626239383361376562623330653737303637373261340ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030386434356332316330633935656636356130323964353263393537666430663835663230313233646130333465363136373164646565353437356630373338326136366336366362346463353035303464646664333735383130383364663864313735373733306564386436663336346466346333366132363531353931393535646132303161323430376661386162396232333133383131323235613064613233306662653338306530393061613536656661346632303265633962343832336636353031643936616336393865626632366161636633656532643166333261373231633934376531303736636633356233373364613164383761333661313532653030653731303131373932323832653832356666313731633538333362383835373062666336646138343439653666393566386231323635616235353531393430333135353364316435373666393363343263306361363061616261633463386464313632643831313466326232313531313538336337323533396665353663343939613932396465336134306130643435633137633538396332643739383863653236656166633932613364333762376561303034326434336530336166613632373162323632353561366363636661653533373138323164383165306230356332353062353966306139303734316130653065383861303965643536633562393738306430393566303930366630623831643531323633393832616165303131333663303732643834346131316436646134623261363163363434653161623137663136666634386565323366656465383435326631653432653264333061303739306332356434323036306531643434613637316132656232336431313466363863373165333366313736646235386136386234333030353462633164323938336132336133326561366666393566613763346438653338306562323936653938623739363865636638343534643831376337333765656135646439323165623836633136633762323933303461346137656362653561336131303230333031303030312812320218153a606537396165396337313933643164326263393433383436346338616135663632323461653835323936366134336239383235383833663766373432633533393562643330393935383761393638363662393233396431656666336165353037610ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623035616265326162303066646430366339353565383637313062306530366631613932363234613438616431636263386466633666323231323936326230633330666462643238346133376335613337363538623633633336656138313632353631613865346639343663626535373232633032383830316630663238316337306638643838633763303061326632653239663539376237393938363965643833353664663537633437626539393434613261616666363530663962346262613064626335336463383830666462623639656134353139303564323830323230326638653239633034613736643237616632656237633534383438356266336634363934633930633431383130383838383433373932383438383335663738313637303764336538643736663465363766353738306263663038383133633535656336333961396264363234313738663565623134376435303061663335316539656631623165333432343834636132363064623763636261653438366631336366323635623562316162363838303636303038303533623230633364656463653737316339613038613033323061613963653435316562396439383361376234396361613130393666386164633039383331386463333865306537636566306438653564353537613036373536383561316339653235366132626339646261333232623362623331373263663731343037376263333830663861306134333361386266613766626663353966366230393365633862663665393339376330396231386531383034306331623536363836343733376338666137653239373935663361343538386464613763326261623439353636356363346139623833366532656239306336326133666361663539316662356638313830346337363138306536323666613236343461376465333435313164366334363637643938393337653237373333663464316539313338383333353465353466643733353137323165373666376235366333343833333838663461366238376232386165626562303230333031303030312813320218163a603962343038383566313362366163316337353336393262613366313739303061333838333165363934613061663937343934623834333838323039636235656662646339386136646162623265316337313833393166633133356264616163330ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396463643863306135336539306333353539353734663636323034313137643362353033653530613336643330393766616338343239653663656364333762623534303731383038663265653938323033356638353161306339626532313736333833613232653338633161626131363866333266393035373063623332333363666536323539383736363661663637623531346361656632316662386466366430666364333363663236303662393264646561353533366236303638643836373832653339626435633338343435393931643431396237643165633038353939343132633039343964316332343062333563313464633535323734646261373166666165393336313235613566383139663534313332653234333964346163353539373939366563653835653133646666333336316639313331663536636561633562396635353262343963663666396139616336653564636532646233363934363266393361663830653562353662366538626566613136326130363162346137363839326264633834363437333036633630303835386664643237303332373663326337303434303139386566643766653335343563663261623538306337346366643634343561616637626437663734356363323532656162643236356561626565383632343137313034653639343861353537353666646332323264663061313031353234646531633363303863636630343330313165633766653936346564643834353161313330313437633037333633613335663131666465656638663261326237363137353762343335386666383962373561343864363762646336303930363933653062623836373965636262393366666462336633656439366265633933656634363536653337313661623837636534366361386531323539633866656464653866326631656130663365623263343865393635353164653132333330333435373235663435656436396338353735623531363833616661343732363231383236646232326262326431633466316533363436346139303230333031303030312814320218173a60346630613033333466393737363738313632663830643936376637323139313431333630633062376637663033316233376336396536323137333933336564616434366263626139373636376565373262666435613933346261313532326330", + ), + ), +); + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/client/ManagedNetwork.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicInfoQuery.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicInfoQuery.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicInfoQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _TopicId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/* harmony import */ var _TopicInfo_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TopicInfo.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicInfo.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HashgraphProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HashgraphProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HashgraphProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HashgraphProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusGetTopicInfoResponse} HashgraphProto.proto.IConsensusGetTopicInfoResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusGetTopicInfoQuery} HashgraphProto.proto.IConsensusGetTopicInfoQuery\n */\n\n/**\n * @namespace com\n * @typedef {import(\"@hashgraph/proto\").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * Retrieve the latest state of a topic.\n *\n * @augments {Query}\n */\nclass TopicInfoQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TopicId | string} [props.topicId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TopicId}\n */\n this._topicId = null;\n\n if (props.topicId != null) {\n this.setTopicId(props.topicId);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {TopicInfoQuery}\n */\n static _fromProtobuf(query) {\n const info =\n /** @type {HashgraphProto.proto.IConsensusGetTopicInfoQuery} */ (\n query.consensusGetTopicInfo\n );\n\n return new TopicInfoQuery({\n topicId:\n info.topicID != null\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(info.topicID)\n : undefined,\n });\n }\n\n /**\n * @returns {?TopicId}\n */\n get topicId() {\n return this._topicId;\n }\n\n /**\n * Set the topic ID for which the info is being requested.\n *\n * @param {TopicId | string} topicId\n * @returns {TopicInfoQuery}\n */\n setTopicId(topicId) {\n this._topicId =\n typeof topicId === \"string\"\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(topicId)\n : topicId.clone();\n\n return this;\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._topicId != null) {\n this._topicId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.consensus.getTopicInfo(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const consensusGetTopicInfo =\n /** @type {HashgraphProto.proto.IConsensusGetTopicInfoResponse} */ (\n response.consensusGetTopicInfo\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n consensusGetTopicInfo.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n return Promise.resolve(\n _TopicInfo_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IConsensusGetTopicInfoResponse} */ (\n response.consensusGetTopicInfo\n )\n )\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n consensusGetTopicInfo: {\n header,\n topicID:\n this._topicId != null ? this._topicId._toProtobuf() : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `TopicInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\"consensusGetTopicInfo\", TopicInfoQuery._fromProtobuf);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicInfoQuery.js?"); -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("../Node.js").default} Node + * @typedef {import("../MirrorNode.js").default} MirrorNode + * @typedef {import("../address_book/NodeAddressBook.js").default} NodeAddressBook + */ -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicMessage.js": -/*!***************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicMessage.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @template {Channel | MirrorChannel} ChannelT + * @typedef {import("../ManagedNode.js").default} ManagedNode + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicMessage; }\n/* harmony export */ });\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _TopicMessageChunk_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TopicMessageChunk.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicMessageChunk.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITimestamp} HashgraphProto.proto.ITimestamp\n */\n\n/**\n * @namespace com\n * @typedef {import(\"@hashgraph/proto\").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse\n */\n\nclass TopicMessage {\n /**\n * @private\n * @param {object} props\n * @param {Timestamp} props.consensusTimestamp\n * @param {Uint8Array} props.contents\n * @param {Uint8Array} props.runningHash\n * @param {Long} props.sequenceNumber\n * @param {?TransactionId} props.initialTransactionId\n * @param {TopicMessageChunk[]} props.chunks\n */\n constructor(props) {\n /** @readonly */\n this.consensusTimestamp = props.consensusTimestamp;\n /** @readonly */\n this.contents = props.contents;\n /** @readonly */\n this.runningHash = props.runningHash;\n /** @readonly */\n this.sequenceNumber = props.sequenceNumber;\n /** @readonly */\n this.chunks = props.chunks;\n /** @readonly */\n this.initialTransactionId = props.initialTransactionId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse} response\n * @returns {TopicMessage}\n */\n static _ofSingle(response) {\n return new TopicMessage({\n consensusTimestamp: _Timestamp_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */\n (response.consensusTimestamp)\n ),\n contents:\n response.message != null ? response.message : new Uint8Array(),\n runningHash:\n response.runningHash != null\n ? response.runningHash\n : new Uint8Array(),\n sequenceNumber:\n response.sequenceNumber != null\n ? response.sequenceNumber instanceof long__WEBPACK_IMPORTED_MODULE_2__\n ? response.sequenceNumber\n : long__WEBPACK_IMPORTED_MODULE_2__.fromNumber(response.sequenceNumber)\n : long__WEBPACK_IMPORTED_MODULE_2__.ZERO,\n initialTransactionId:\n response.chunkInfo != null &&\n response.chunkInfo.initialTransactionID != null\n ? _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(\n response.chunkInfo.initialTransactionID\n )\n : null,\n chunks: [_TopicMessageChunk_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(response)],\n });\n }\n\n /**\n * @internal\n * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse[]} responses\n * @returns {TopicMessage}\n */\n static _ofMany(responses) {\n const length = responses.length;\n\n const last =\n /** @type {com.hedera.mirror.api.proto.IConsensusTopicResponse} */ (\n responses[length - 1]\n );\n\n const consensusTimestamp = _Timestamp_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */\n (last.consensusTimestamp)\n );\n\n const runningHash = /** @type {Uint8Array} */ (last.runningHash);\n\n /**\n * @type {Long}\n */\n const sequenceNumber =\n last.sequenceNumber != null\n ? last.sequenceNumber instanceof long__WEBPACK_IMPORTED_MODULE_2__\n ? last.sequenceNumber\n : long__WEBPACK_IMPORTED_MODULE_2__.fromValue(last.sequenceNumber)\n : long__WEBPACK_IMPORTED_MODULE_2__.ZERO;\n\n responses.sort((a, b) =>\n (a != null\n ? a.chunkInfo != null\n ? a.chunkInfo.number != null\n ? a.chunkInfo.number\n : 0\n : 0\n : 0) <\n (b != null\n ? b.chunkInfo != null\n ? b.chunkInfo.number != null\n ? b.chunkInfo.number\n : 0\n : 0\n : 0)\n ? -1\n : 1\n );\n\n /**\n * @type {TopicMessageChunk[]}\n */\n const chunks = responses.map(\n /**\n * @type {com.hedera.mirror.api.proto.IConsensusTopicResponse}\n */ (m) => _TopicMessageChunk_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(m)\n );\n\n const size = chunks\n .map((chunk) => chunk.contents.length)\n .reduce((sum, current) => sum + current, 0);\n\n const contents = new Uint8Array(size);\n let offset = 0;\n\n responses.forEach((value) => {\n contents.set(/** @type {Uint8Array} */ (value.message), offset);\n offset += /** @type {Uint8Array} */ (value.message).length;\n });\n\n let initialTransactionId = null;\n if (\n responses.length > 0 &&\n responses[0].chunkInfo != null &&\n responses[0].chunkInfo.initialTransactionID != null\n ) {\n initialTransactionId = _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(\n responses[0].chunkInfo.initialTransactionID\n );\n }\n\n return new TopicMessage({\n consensusTimestamp,\n contents,\n runningHash,\n sequenceNumber,\n chunks,\n initialTransactionId,\n });\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicMessage.js?"); +/** + * @template {Channel | MirrorChannel} ChannelT + * @template {ManagedNode} NetworkNodeT + * @template {{ toString: () => string }} KeyT + */ +class ManagedNetwork { + /** + * @param {(address: string) => ChannelT} createNetworkChannel + */ + constructor(createNetworkChannel) { + /** + * Map of node account ID (as a string) + * to the node URL. + * + * @internal + * @type {Map} + */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + this._network = new Map(); + + /** + * List of node account IDs. + * + * @protected + * @type {NetworkNodeT[]} + */ + this._nodes = []; + + /** + * List of node account IDs. + * + * @protected + * @type {NetworkNodeT[]} + */ + this._healthyNodes = []; + + /** @type {(address: string, cert?: string) => ChannelT} */ + this._createNetworkChannel = createNetworkChannel; + + /** @type {LedgerId | null} */ + this._ledgerId = null; + + this._minBackoff = 8000; + this._maxBackoff = 1000 * 60 * 60; + + /** @type {number} */ + this._maxNodeAttempts = -1; + + this._nodeMinReadmitPeriod = this._minBackoff; + this._nodeMaxReadmitPeriod = this._maxBackoff; + + this._earliestReadmitTime = Date.now() + this._nodeMinReadmitPeriod; + } + + /** + * @deprecated + * @param {string} networkName + * @returns {this} + */ + setNetworkName(networkName) { + console.warn("Deprecated: Use `setLedgerId` instead"); + return this.setLedgerId(networkName); + } + + /** + * @deprecated + * @returns {string | null} + */ + get networkName() { + console.warn("Deprecated: Use `ledgerId` instead"); + return this.ledgerId != null ? this.ledgerId.toString() : null; + } + + /** + * @param {string|LedgerId} ledgerId + * @returns {this} + */ + setLedgerId(ledgerId) { + this._ledgerId = + typeof ledgerId === "string" + ? LedgerId.fromString(ledgerId) + : ledgerId; + return this; + } + + /** + * @returns {LedgerId | null} + */ + get ledgerId() { + return this._ledgerId != null ? this._ledgerId : null; + } + + /** + * @abstract + * @param {[string, KeyT]} entry + * @returns {NetworkNodeT} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _createNodeFromNetworkEntry(entry) { + throw new Error("not implemented"); + } + + /** + * @abstract + * @param {Map} network + * @returns {number[]} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _getNodesToRemove(network) { + throw new Error("not implemented"); + } + + _removeDeadNodes() { + if (this._maxNodeAttempts > 0) { + for (let i = this._nodes.length - 1; i >= 0; i--) { + const node = this._nodes[i]; + + if (node._badGrpcStatusCount < this._maxNodeAttempts) { + continue; + } + + this._closeNode(i); + } + } + } + + _readmitNodes() { + const now = Date.now(); + + if (this._earliestReadmitTime <= now) { + let nextEarliestReadmitTime = Number.MAX_SAFE_INTEGER; + let searchForNextEarliestReadmitTime = true; + + outer: for (let i = 0; i < this._nodes.length; i++) { + for (let j = 0; j < this._healthyNodes.length; j++) { + if ( + searchForNextEarliestReadmitTime && + this._nodes[i]._readmitTime > now + ) { + nextEarliestReadmitTime = Math.min( + this._nodes[i]._readmitTime, + nextEarliestReadmitTime, + ); + } + + if (this._nodes[i] == this._healthyNodes[j]) { + continue outer; + } + } + + searchForNextEarliestReadmitTime = false; + + if (this._nodes[i]._readmitTime <= now) { + this._healthyNodes.push(this._nodes[i]); + } + } + + this._earliestReadmitTime = Math.min( + Math.max(nextEarliestReadmitTime, this._nodeMinReadmitPeriod), + this._nodeMaxReadmitPeriod, + ); + } + } + + /** + * @param {number} count + * @returns {NetworkNodeT[]} + */ + _getNumberOfMostHealthyNodes(count) { + this._removeDeadNodes(); + this._readmitNodes(); + + const nodes = []; + // Create a shallow for safe iteration + let healthyNodes = this._healthyNodes.slice(); + count = Math.min(count, healthyNodes.length); + + for (let i = 0; i < count; i++) { + // Select a random index + const nodeIndex = Math.floor(Math.random() * healthyNodes.length); + const selectedNode = healthyNodes[nodeIndex]; + + // Check if the node exists + if (!selectedNode) { + break; // Break out of the loop if undefined node is selected + } + + // Add the selected node in array for execution + nodes.push(selectedNode); + // Remove all nodes with the same account id as + // the selected node account id from the array + healthyNodes = healthyNodes.filter( + // eslint-disable-next-line ie11/no-loop-func + (node) => node.getKey() !== selectedNode.getKey(), + ); + } + + return nodes; + } + + /** + * @param {number} i + */ + _closeNode(i) { + const node = this._nodes[i]; + + node.close(); + this._removeNodeFromNetwork(node); + this._nodes.splice(i, 1); + } + + /** + * @param {NetworkNodeT} node + */ + _removeNodeFromNetwork(node) { + const network = /** @type {NetworkNodeT[]} */ ( + this._network.get(node.getKey()) + ); + + for (let j = 0; j < network.length; j++) { + if (network[j] === node) { + network.splice(j, 1); + break; + } + } + + if (network.length === 0) { + this._network.delete(node.getKey()); + } + } + + /** + * @param {Map} network + * @returns {this} + */ + _setNetwork(network) { + /** @type {NetworkNodeT[]} */ + const newNodes = []; + const newNodeKeys = new Set(); + const newNodeAddresses = new Set(); + + /** @type {NetworkNodeT[]} */ + const newHealthyNodes = []; + + /** @type {Map} */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const newNetwork = new Map(); + + // Remove nodes that are not in the new network + for (const i of this._getNodesToRemove(network)) { + this._closeNode(i); + } + + // Copy all the unclosed nodes + for (const node of this._nodes) { + newNodes.push(node); + newNodeKeys.add(node.getKey()); + newNodeAddresses.add(node.address.toString()); + } + + // Add new nodes + for (const [key, value] of network) { + if ( + newNodeKeys.has(value.toString()) && + newNodeAddresses.has(key) + ) { + continue; + } + newNodes.push(this._createNodeFromNetworkEntry([key, value])); + } + + // Shuffle the nodes so we don't immediately pick the first nodes + shuffle(newNodes); + + // Copy all the nodes into the healhty nodes list initially + // and push the nodes into the network; this maintains the + // shuffled state from `newNodes` + for (const node of newNodes) { + if (!node.isHealthy()) { + continue; + } + + newHealthyNodes.push(node); + + const newNetworkNodes = newNetwork.has(node.getKey()) + ? /** @type {NetworkNodeT[]} */ (newNetwork.get(node.getKey())) + : []; + newNetworkNodes.push(node); + newNetwork.set(node.getKey(), newNetworkNodes); + } + + // console.log(JSON.stringify(newNodes, null, 2)); + this._nodes = newNodes; + this._healthyNodes = newHealthyNodes; + this._network = newNetwork; + this._ledgerId = null; + + return this; + } + + /** + * @returns {number} + */ + get maxNodeAttempts() { + return this._maxNodeAttempts; + } + + /** + * @param {number} maxNodeAttempts + * @returns {this} + */ + setMaxNodeAttempts(maxNodeAttempts) { + this._maxNodeAttempts = maxNodeAttempts; + return this; + } + + /** + * @returns {number} + */ + get minBackoff() { + return this._minBackoff; + } + + /** + * @param {number} minBackoff + * @returns {this} + */ + setMinBackoff(minBackoff) { + this._minBackoff = minBackoff; + for (const node of this._nodes) { + node.setMinBackoff(minBackoff); + } + return this; + } + + /** + * @returns {number} + */ + get maxBackoff() { + return this._maxBackoff; + } + + /** + * @param {number} maxBackoff + * @returns {this} + */ + setMaxBackoff(maxBackoff) { + this._maxBackoff = maxBackoff; + for (const node of this._nodes) { + node.setMaxBackoff(maxBackoff); + } + return this; + } + + /** + * @returns {number} + */ + get nodeMinReadmitPeriod() { + return this._nodeMinReadmitPeriod; + } + + /** + * @param {number} nodeMinReadmitPeriod + * @returns {this} + */ + setNodeMinReadmitPeriod(nodeMinReadmitPeriod) { + this._nodeMinReadmitPeriod = nodeMinReadmitPeriod; + this._earliestReadmitTime = Date.now() + this._nodeMinReadmitPeriod; + return this; + } + + /** + * @returns {number} + */ + get nodeMaxReadmitPeriod() { + return this._nodeMaxReadmitPeriod; + } + + /** + * @param {number} nodeMaxReadmitPeriod + * @returns {this} + */ + setNodeMaxReadmitPeriod(nodeMaxReadmitPeriod) { + this._nodeMaxReadmitPeriod = nodeMaxReadmitPeriod; + return this; + } + + /** + * @param {KeyT=} key + * @returns {NetworkNodeT} + */ + getNode(key) { + this._readmitNodes(); + if (key != null && key != undefined) { + const lockedNodes = this._network.get(key.toString()); + if (lockedNodes) { + const randomNodeAddress = Math.floor( + Math.random() * lockedNodes.length, + ); + return /** @type {NetworkNodeT[]} */ (lockedNodes)[ + randomNodeAddress + ]; + } else { + const nodes = Array.from(this._network.keys()); + const randomNodeAccountId = + nodes[Math.floor(Math.random() * nodes.length)]; + + const randomNode = this._network.get(randomNodeAccountId); + // We get the `randomNodeAccountId` from the network mapping, + // so it cannot be `undefined` + const randomNodeAddress = Math.floor( + // @ts-ignore + Math.random() * randomNode.length, + ); + // @ts-ignore + return randomNode[randomNodeAddress]; + } + } else { + if (this._healthyNodes.length == 0) { + throw new Error("failed to find a healthy working node"); + } + + return this._healthyNodes[ + Math.floor(Math.random() * this._healthyNodes.length) + ]; + } + } + + /** + * @param {NetworkNodeT} node + */ + increaseBackoff(node) { + node.increaseBackoff(); + + for (let i = 0; i < this._healthyNodes.length; i++) { + if (this._healthyNodes[i] == node) { + this._healthyNodes.splice(i, 1); + } + } + } + + /** + * @param {NetworkNodeT} node + */ + decreaseBackoff(node) { + node.decreaseBackoff(); + } + + close() { + for (const node of this._nodes) { + node.close(); + } + + this._network.clear(); + this._nodes = []; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/client/Network.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicMessageChunk.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicMessageChunk.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicMessageChunk; }\n/* harmony export */ });\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITimestamp} HashgraphProto.proto.ITimestamp\n */\n\n/**\n * @namespace com\n * @typedef {import(\"@hashgraph/proto\").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse\n */\n\nclass TopicMessageChunk {\n /**\n * @private\n * @param {object} props\n * @param {Timestamp} props.consensusTimestamp\n * @param {Uint8Array} props.contents\n * @param {Uint8Array} props.runningHash\n * @param {Long} props.sequenceNumber\n */\n constructor(props) {\n /** @readonly */\n this.consensusTimestamp = props.consensusTimestamp;\n /** @readonly */\n this.contents = props.contents;\n /** @readonly */\n this.runningHash = props.runningHash;\n /** @readonly */\n this.sequenceNumber = props.sequenceNumber;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse} response\n * @returns {TopicMessageChunk}\n */\n static _fromProtobuf(response) {\n return new TopicMessageChunk({\n consensusTimestamp: _Timestamp_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */\n (response.consensusTimestamp)\n ),\n contents:\n response.message != null ? response.message : new Uint8Array(),\n runningHash:\n response.runningHash != null\n ? response.runningHash\n : new Uint8Array(),\n sequenceNumber:\n response.sequenceNumber != null\n ? response.sequenceNumber instanceof long__WEBPACK_IMPORTED_MODULE_1__\n ? response.sequenceNumber\n : long__WEBPACK_IMPORTED_MODULE_1__.fromValue(response.sequenceNumber)\n : long__WEBPACK_IMPORTED_MODULE_1__.ZERO,\n });\n }\n\n /**\n * @internal\n * @returns {com.hedera.mirror.api.proto.IConsensusTopicResponse}\n */\n _toProtobuf() {\n return {\n consensusTimestamp: this.consensusTimestamp._toProtobuf(),\n message: this.contents,\n runningHash: this.runningHash,\n sequenceNumber: this.sequenceNumber,\n };\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicMessageChunk.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicMessageQuery.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicMessageQuery.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicMessageQuery; }\n/* harmony export */ });\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _SubscriptionHandle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SubscriptionHandle.js */ \"./node_modules/@hashgraph/sdk/src/topic/SubscriptionHandle.js\");\n/* harmony import */ var _TopicMessage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TopicMessage.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicMessage.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _TopicId_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../channel/MirrorChannel.js\").MirrorError} MirrorError\n */\n\n/**\n * @template {Channel} ChannelT\n * @typedef {import(\"../client/Client.js\").default} Client\n */\n\nclass TopicMessageQuery {\n /**\n * @param {object} props\n * @param {TopicId | string} [props.topicId]\n * @param {Timestamp} [props.startTime]\n * @param {Timestamp} [props.endTime]\n * @param {(message: TopicMessage, error: Error)=> void} [props.errorHandler]\n * @param {() => void} [props.completionHandler]\n * @param {(error: MirrorError | Error | null) => boolean} [props.retryHandler]\n * @param {Long | number} [props.limit]\n */\n constructor(props = {}) {\n /**\n * @private\n * @type {?TopicId}\n */\n this._topicId = null;\n if (props.topicId != null) {\n this.setTopicId(props.topicId);\n }\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._startTime = null;\n if (props.startTime != null) {\n this.setStartTime(props.startTime);\n }\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._endTime = null;\n if (props.endTime != null) {\n this.setEndTime(props.endTime);\n }\n\n /**\n * @private\n * @type {?Long}\n */\n this._limit = null;\n if (props.limit != null) {\n this.setLimit(props.limit);\n }\n\n /**\n * @private\n * @type {(message: TopicMessage, error: Error) => void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._errorHandler = (message, error) => {\n console.error(\n `Error attempting to subscribe to topic: ${\n this._topicId != null ? this._topicId.toString() : \"\"\n }`\n );\n };\n\n if (props.errorHandler != null) {\n this._errorHandler = props.errorHandler;\n }\n\n /*\n * @private\n * @type {((message: TopicMessage) => void) | null}\n */\n this._listener = null;\n\n /**\n * @private\n * @type {() => void}\n */\n this._completionHandler = () => {\n js_logger__WEBPACK_IMPORTED_MODULE_8__.log(\n `Subscription to topic ${\n this._topicId != null ? this._topicId.toString() : \"\"\n } complete`\n );\n };\n\n if (props.completionHandler != null) {\n this._completionHandler = props.completionHandler;\n }\n\n /**\n * @private\n * @type {(error: MirrorError | Error | null) => boolean}\n */\n this._retryHandler = (error) => {\n if (error != null) {\n if (error instanceof Error) {\n // Retry on all errors which are not `MirrorError` because they're\n // likely lower level HTTP/2 errors\n return true;\n } else {\n // Retry on `NOT_FOUND`, `RESOURCE_EXHAUSTED`, `UNAVAILABLE`, and conditionally on `INTERNAL`\n // if the message matches the right regex.\n switch (error.code) {\n // INTERNAL\n // eslint-disable-next-line no-fallthrough\n case 13:\n return _Executable_js__WEBPACK_IMPORTED_MODULE_7__.RST_STREAM.test(error.details.toString());\n // NOT_FOUND\n // eslint-disable-next-line no-fallthrough\n case 5:\n // RESOURCE_EXHAUSTED\n // eslint-disable-next-line no-fallthrough\n case 8:\n // UNAVAILABLE\n // eslint-disable-next-line no-fallthrough\n case 14:\n case 17:\n return true;\n default:\n return false;\n }\n }\n }\n\n return false;\n };\n\n if (props.retryHandler != null) {\n this._retryHandler = props.retryHandler;\n }\n\n /**\n * @private\n * @type {number}\n */\n this._maxAttempts = 10;\n\n /**\n * @private\n * @type {number}\n */\n this._maxBackoff = 8000;\n\n /**\n * @private\n * @type {number}\n */\n this._attempt = 0;\n\n /**\n * @private\n * @type {SubscriptionHandle | null}\n */\n this._handle = null;\n }\n\n /**\n * @returns {?TopicId}\n */\n get topicId() {\n return this._topicId;\n }\n\n /**\n * @param {TopicId | string} topicId\n * @returns {TopicMessageQuery}\n */\n setTopicId(topicId) {\n this.requireNotSubscribed();\n\n this._topicId =\n typeof topicId === \"string\"\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromString(topicId)\n : topicId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get startTime() {\n return this._startTime;\n }\n\n /**\n * @param {Timestamp | Date | number} startTime\n * @returns {TopicMessageQuery}\n */\n setStartTime(startTime) {\n this.requireNotSubscribed();\n\n this._startTime =\n startTime instanceof _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]\n ? startTime\n : startTime instanceof Date\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromDate(startTime)\n : new _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"](startTime, 0);\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get endTime() {\n return this._endTime;\n }\n\n /**\n * @param {Timestamp | Date | number} endTime\n * @returns {TopicMessageQuery}\n */\n setEndTime(endTime) {\n this.requireNotSubscribed();\n\n this._endTime =\n endTime instanceof _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]\n ? endTime\n : endTime instanceof Date\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].fromDate(endTime)\n : new _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"](endTime, 0);\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get limit() {\n return this._limit;\n }\n\n /**\n * @param {Long | number} limit\n * @returns {TopicMessageQuery}\n */\n setLimit(limit) {\n this.requireNotSubscribed();\n\n this._limit = limit instanceof long__WEBPACK_IMPORTED_MODULE_5__ ? limit : long__WEBPACK_IMPORTED_MODULE_5__.fromValue(limit);\n\n return this;\n }\n\n /**\n * @param {(message: TopicMessage, error: Error)=> void} errorHandler\n * @returns {TopicMessageQuery}\n */\n setErrorHandler(errorHandler) {\n this._errorHandler = errorHandler;\n\n return this;\n }\n\n /**\n * @param {() => void} completionHandler\n * @returns {TopicMessageQuery}\n */\n setCompletionHandler(completionHandler) {\n this.requireNotSubscribed();\n\n this._completionHandler = completionHandler;\n\n return this;\n }\n\n /**\n * @param {number} attempts\n */\n setMaxAttempts(attempts) {\n this.requireNotSubscribed();\n\n this._maxAttempts = attempts;\n }\n\n /**\n * @param {number} backoff\n */\n setMaxBackoff(backoff) {\n this.requireNotSubscribed();\n\n this._maxBackoff = backoff;\n }\n\n /**\n * @param {Client} client\n * @param {((message: TopicMessage, error: Error) => void) | null} errorHandler\n * @param {(message: TopicMessage) => void} listener\n * @returns {SubscriptionHandle}\n */\n subscribe(client, errorHandler, listener) {\n this._handle = new _SubscriptionHandle_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this._listener = listener;\n\n if (errorHandler != null) {\n this._errorHandler = errorHandler;\n }\n\n this._makeServerStreamRequest(client);\n\n return this._handle;\n }\n\n /**\n * @private\n * @param {Client} client\n * @returns {void}\n */\n _makeServerStreamRequest(client) {\n /** @type {Map} */\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const list = new Map();\n\n const request =\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_3__.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode(\n {\n topicID:\n this._topicId != null\n ? this._topicId._toProtobuf()\n : null,\n consensusStartTime:\n this._startTime != null\n ? this._startTime._toProtobuf()\n : null,\n consensusEndTime:\n this._endTime != null\n ? this._endTime._toProtobuf()\n : null,\n limit: this._limit,\n }\n ).finish();\n\n const cancel = client._mirrorNetwork\n .getNextMirrorNode()\n .getChannel()\n .makeServerStreamRequest(\n \"ConsensusService\",\n \"subscribeTopic\",\n request,\n (data) => {\n const message =\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_3__.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(\n data\n );\n\n if (this._limit != null && this._limit.gt(0)) {\n this._limit = this._limit.sub(1);\n }\n\n this._startTime = _Timestamp_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */ (\n message.consensusTimestamp\n )\n ).plusNanos(1);\n\n if (\n message.chunkInfo == null ||\n (message.chunkInfo != null &&\n message.chunkInfo.total === 1)\n ) {\n this._passTopicMessage(_TopicMessage_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._ofSingle(message));\n } else {\n const chunkInfo =\n /** @type {HashgraphProto.proto.IConsensusMessageChunkInfo} */ (\n message.chunkInfo\n );\n const initialTransactionID =\n /** @type {HashgraphProto.proto.ITransactionID} */ (\n chunkInfo.initialTransactionID\n );\n const total = /** @type {number} */ (chunkInfo.total);\n const transactionId =\n _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(\n initialTransactionID\n ).toString();\n\n /** @type {HashgraphProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]} */\n let responses = [];\n\n const temp = list.get(transactionId);\n if (temp == null) {\n list.set(transactionId, responses);\n } else {\n responses = temp;\n }\n\n responses.push(message);\n\n if (responses.length === total) {\n const topicMessage =\n _TopicMessage_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._ofMany(responses);\n\n list.delete(transactionId);\n\n this._passTopicMessage(topicMessage);\n }\n }\n },\n (error) => {\n const message =\n error instanceof Error ? error.message : error.details;\n\n if (\n this._attempt < this._maxAttempts &&\n this._retryHandler(error)\n ) {\n const delay = Math.min(\n 250 * 2 ** this._attempt,\n this._maxBackoff\n );\n console.warn(\n `Error subscribing to topic ${\n this._topicId != null\n ? this._topicId.toString()\n : \"UNKNOWN\"\n } during attempt ${\n this._attempt\n }. Waiting ${delay} ms before next attempt: ${message}`\n );\n\n this._attempt += 1;\n\n setTimeout(() => {\n this._makeServerStreamRequest(client);\n }, delay);\n }\n },\n this._completionHandler\n );\n\n if (this._handle != null) {\n this._handle._setCall(() => cancel());\n }\n }\n\n requireNotSubscribed() {\n if (this._handle != null) {\n throw new Error(\n \"Cannot change fields on an already subscribed query\"\n );\n }\n }\n\n /**\n * @private\n * @param {TopicMessage} topicMessage\n */\n _passTopicMessage(topicMessage) {\n try {\n if (this._listener != null) {\n this._listener(topicMessage);\n } else {\n throw new Error(\"(BUG) listener is unexpectedly not set\");\n }\n } catch (error) {\n this._errorHandler(topicMessage, /** @type {Error} */ (error));\n }\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicMessageQuery.js?"); +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../address_book/NodeAddressBook.js").default} NodeAddressBook + */ -/***/ }), +/** + * @augments {ManagedNetwork} + */ +class Network extends ManagedNetwork { + /** + * @param {(address: string) => Channel} createNetworkChannel + */ + constructor(createNetworkChannel) { + super(createNetworkChannel); + + this._maxNodesPerTransaction = -1; + + /** @type {NodeAddressBook | null} */ + this._addressBook = null; + + /** @type {boolean} */ + this._transportSecurity = false; + } + + /** + * @param {{[key: string]: (string | AccountId)}} network + */ + setNetwork(network) { + this._setNetwork( + // eslint-disable-next-line ie11/no-collection-args + new Map( + // eslint-disable-next-line ie11/no-collection-args + Object.entries(network).map(([key, value]) => { + return [ + key, + typeof value === "string" + ? AccountId_AccountId.fromString(value) + : value, + ]; + }), + ), + ); + } + + /** + * @param {NodeAddressBook} addressBook + * @returns {this} + */ + setNetworkFromAddressBook(addressBook) { + /** @type {Record} */ + const network = {}; + const port = this.isTransportSecurity() ? 50212 : 50211; + + for (const nodeAddress of addressBook.nodeAddresses) { + for (const endpoint of nodeAddress.addresses) { + // TODO: We hard code ports too much, should fix + if (endpoint.port === port && nodeAddress.accountId != null) { + network[endpoint.toString()] = nodeAddress.accountId; + } + } + } + + this.setNetwork(network); + return this; + } + + /** + * @returns {{[key: string]: (string | AccountId)}} + */ + get network() { + /** + * @type {{[key: string]: (string | AccountId)}} + */ + var n = {}; + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const node of this._nodes) { + n[node.address.toString()] = node.accountId; + } + + return n; + } + + /** + * @param {string} networkName + * @returns {this} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setNetworkName(networkName) { + super.setLedgerId(networkName); + + switch (networkName) { + case "mainnet": + this._addressBook = MAINNET_ADDRESS_BOOK; + break; + case "testnet": + this._addressBook = TESTNET_ADDRESS_BOOK; + break; + case "previewnet": + this._addressBook = PREVIEWNET_ADDRESS_BOOK; + break; + } + + if (this._addressBook != null) { + for (const node of this._nodes) { + for (const address of this._addressBook.nodeAddresses) { + if ( + address.accountId != null && + address.accountId.toString() === + node.accountId.toString() + ) { + node.setNodeAddress(address); + } + } + } + } + + return this; + } + + /** + * @returns {string | null} + */ + get networkName() { + return this._ledgerId != null ? this._ledgerId.toString() : null; + } + + /** + * @abstract + * @param {[string, (string | AccountId)]} entry + * @returns {Node} + */ + _createNodeFromNetworkEntry(entry) { + const accountId = + typeof entry[1] === "string" + ? AccountId_AccountId.fromString(entry[1]) + : entry[1]; + + return new Node({ + newNode: { + address: entry[0], + accountId, + channelInitFunction: this._createNetworkChannel, + }, + }).setMinBackoff(this._minBackoff); + } + + /** + * @abstract + * @param {Map} network + * @returns {number[]} + */ + _getNodesToRemove(network) { + const indexes = []; + + for (let i = this._nodes.length - 1; i >= 0; i--) { + const node = this._nodes[i]; + const accountId = network.get(node.address.toString()); + + if ( + accountId == null || + accountId.toString() !== node.accountId.toString() + ) { + indexes.push(i); + } + } + + return indexes; + } + + /** + * @abstract + * @param {[string, (string | AccountId)]} entry + * @returns {boolean} + */ + _checkNetworkContainsEntry(entry) { + for (const node of this._nodes) { + if (node.address.toString() === entry[0]) { + return true; + } + } + + return false; + } + + /** + * @returns {number} + */ + get maxNodesPerTransaction() { + return this._maxNodesPerTransaction; + } + + /** + * @param {number} maxNodesPerTransaction + * @returns {this} + */ + setMaxNodesPerTransaction(maxNodesPerTransaction) { + this._maxNodesPerTransaction = maxNodesPerTransaction; + return this; + } + + /** + * @returns {number} + */ + get maxNodeAttempts() { + return this._maxNodeAttempts; + } + + /** + * @param {number} maxNodeAttempts + * @returns {this} + */ + setMaxNodeAttempts(maxNodeAttempts) { + this._maxNodeAttempts = maxNodeAttempts; + return this; + } + + /** + * @returns {boolean} + */ + isTransportSecurity() { + return this._transportSecurity; + } + + /** + * @param {boolean} transportSecurity + * @returns {this} + */ + setTransportSecurity(transportSecurity) { + if (this._transportSecurity == transportSecurity) { + return this; + } + + this._network.clear(); + + for (let i = 0; i < this._nodes.length; i++) { + let node = this._nodes[i]; + node.close(); + + node = /** @type {Node} */ ( + transportSecurity + ? node + .toSecure() + .setCert( + this._ledgerId != null + ? this._ledgerId.toString() + : "", + ) + : node.toInsecure() + ); + this._nodes[i] = node; + + const nodes = + this._network.get(node.getKey()) != null + ? /** @type {Node[]} */ (this._network.get(node.getKey())) + : []; + nodes.push(node); + this._network.set(node.getKey(), nodes); + } + + // Overwrite healthy node list since new ports might make the node work again + this._healthyNodes = [...this._nodes]; + + this._transportSecurity = transportSecurity; + return this; + } + + /** + * @internal + * @returns {number} + */ + getNumberOfNodesForTransaction() { + if (this._maxNodesPerTransaction > 0) { + return this._maxNodesPerTransaction; + } + // ultimately it does not matter if we round up or down + // if we round up, we will eventually take one more healthy node for execution + // and we would hit the 'nodes.length == count' check in _getNumberOfMostHealthyNodes() less often + return this._nodes.length <= 9 + ? this._nodes.length + : Math.floor((this._nodes.length + 3 - 1) / 3); + } + + /** + * @internal + * @returns {AccountId[]} + */ + getNodeAccountIdsForExecute() { + return this._getNumberOfMostHealthyNodes( + this.getNumberOfNodesForTransaction(), + ).map((node) => node.accountId); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/MirrorNode.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicMessageSubmitTransaction.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicMessageSubmitTransaction.js ***! - \********************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicMessageSubmitTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _TopicId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/* harmony import */ var _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/utf8.js */ \"./node_modules/@hashgraph/sdk/src/encoding/utf8.browser.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusSubmitMessageTransactionBody} HashgraphProto.proto.IConsensusSubmitMessageTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusMessageChunkInfo} HashgraphProto.proto.IConsensusMessageChunkInfo\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"../schedule/ScheduleCreateTransaction.js\").default} ScheduleCreateTransaction\n */\n\nclass TopicMessageSubmitTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {TopicId | string} [props.topicId]\n * @param {Uint8Array | string} [props.message]\n * @param {number} [props.maxChunks]\n * @param {number} [props.chunkSize]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TopicId}\n */\n this._topicId = null;\n\n if (props.topicId != null) {\n this.setTopicId(props.topicId);\n }\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._message = null;\n\n if (props.message != null) {\n this.setMessage(props.message);\n }\n\n /**\n * @private\n * @type {number}\n */\n this._maxChunks = 20;\n\n /**\n * @private\n * @type {number}\n */\n this._chunkSize = _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.CHUNK_SIZE;\n\n if (props.maxChunks != null) {\n this.setMaxChunks(props.maxChunks);\n }\n\n if (props.chunkSize != null) {\n this.setChunkSize(props.chunkSize);\n }\n\n /** @type {HashgraphProto.proto.IConsensusMessageChunkInfo | null} */\n this._chunkInfo = null;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TopicMessageSubmitTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const message =\n /** @type {HashgraphProto.proto.IConsensusSubmitMessageTransactionBody} */ (\n body.consensusSubmitMessage\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new TopicMessageSubmitTransaction({\n topicId:\n message.topicID != null\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(message.topicID)\n : undefined,\n message: message.message != null ? message.message : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?TopicId}\n */\n get topicId() {\n return this._topicId;\n }\n\n /**\n * @param {TopicId | string} topicId\n * @returns {this}\n */\n setTopicId(topicId) {\n this._requireNotFrozen();\n\n this._topicId =\n typeof topicId === \"string\"\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(topicId)\n : topicId.clone();\n\n return this;\n }\n\n /**\n * @deprecated - Use `getMessage()` instead\n * @returns {?Uint8Array}\n */\n get message() {\n return this._message;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n getMessage() {\n return this._message;\n }\n\n /**\n * @param {string | Uint8Array} message\n * @returns {this}\n */\n setMessage(message) {\n this._requireNotFrozen();\n message = _util_js__WEBPACK_IMPORTED_MODULE_5__.requireStringOrUint8Array(message);\n this._message =\n message instanceof Uint8Array ? message : _encoding_utf8_js__WEBPACK_IMPORTED_MODULE_2__.encode(message);\n return this;\n }\n\n /**\n * @deprecated - Use `getMaxChunks()` instead\n * @returns {?number}\n */\n get maxChunks() {\n return this._maxChunks;\n }\n\n /**\n * @returns {?number}\n */\n getMaxChunks() {\n return this._maxChunks;\n }\n\n /**\n * @param {number} maxChunks\n * @returns {this}\n */\n setMaxChunks(maxChunks) {\n this._requireNotFrozen();\n this._maxChunks = maxChunks;\n return this;\n }\n\n /**\n * @deprecated - Use `getChunkSize()` instead\n * @returns {?number}\n */\n get chunkSize() {\n return this._chunkSize;\n }\n\n /**\n * @returns {?number}\n */\n getChunkSize() {\n return this._chunkSize;\n }\n\n /**\n * @param {number} chunkSize\n * @returns {this}\n */\n setChunkSize(chunkSize) {\n this._chunkSize = chunkSize;\n return this;\n }\n\n /**\n * Freeze this transaction from further modification to prepare for\n * signing or serialization.\n *\n * Will use the `Client`, if available, to generate a default Transaction ID and select 1/3\n * nodes to prepare this transaction for.\n *\n * @param {?import(\"../client/Client.js\").default} client\n * @returns {this}\n */\n freezeWith(client) {\n super.freezeWith(client);\n\n if (this._message == null) {\n return this;\n }\n\n const chunks = Math.floor(\n (this._message.length + (this._chunkSize - 1)) / this._chunkSize\n );\n\n if (chunks > this._maxChunks) {\n throw new Error(\n `Message with size ${this._message.length} too long for ${this._maxChunks} chunks`\n );\n }\n\n const initialTransactionId = this._getTransactionId()._toProtobuf();\n let nextTransactionId = this._getTransactionId();\n\n // Hack around the locked list. Should refactor a bit to remove such code\n this._transactionIds.locked = false;\n\n this._transactions.clear();\n this._transactionIds.clear();\n this._signedTransactions.clear();\n\n for (let chunk = 0; chunk < chunks; chunk++) {\n this._chunkInfo = {\n initialTransactionID: initialTransactionId,\n total: chunks,\n number: chunk + 1,\n };\n\n this._transactionIds.push(nextTransactionId);\n this._transactionIds.advance();\n\n for (const nodeAccountId of this._nodeAccountIds.list) {\n this._signedTransactions.push(\n this._makeSignedTransaction(nodeAccountId)\n );\n }\n\n nextTransactionId = new _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](\n /** @type {AccountId} */ (nextTransactionId.accountId),\n new _Timestamp_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"](\n /** @type {Timestamp} */ (\n nextTransactionId.validStart\n ).seconds,\n /** @type {Timestamp} */ (\n nextTransactionId.validStart\n ).nanos.add(1)\n )\n );\n }\n\n this._transactionIds.advance();\n this._chunkInfo = null;\n\n return this;\n }\n\n /**\n * @returns {ScheduleCreateTransaction}\n */\n schedule() {\n this._requireNotFrozen();\n\n if (this._message != null && this._message.length > this._chunkSize) {\n throw new Error(\n `cannot schedule \\`TopicMessageSubmitTransaction\\` with message over ${this._chunkSize} bytes`\n );\n }\n\n return super.schedule();\n }\n\n /**\n * @param {import(\"../client/Client.js\").default} client\n * @param {number=} requestTimeout\n * @returns {Promise}\n */\n async execute(client, requestTimeout) {\n return (await this.executeAll(client, requestTimeout))[0];\n }\n\n /**\n * @param {import(\"../client/Client.js\").default} client\n * @param {number=} requestTimeout\n * @returns {Promise}\n */\n async executeAll(client, requestTimeout) {\n if (!super._isFrozen()) {\n this.freezeWith(client);\n }\n\n // on execute, sign each transaction with the operator, if present\n // and we are signing a transaction that used the default transaction ID\n\n const transactionId = this._getTransactionId();\n const operatorAccountId = client.operatorAccountId;\n\n if (\n operatorAccountId != null &&\n operatorAccountId.equals(\n /** @type {AccountId} */ (transactionId.accountId)\n )\n ) {\n await super.signWithOperator(client);\n }\n\n const responses = [];\n let remainingTimeout = requestTimeout;\n for (let i = 0; i < this._transactionIds.length; i++) {\n const startTimestamp = Date.now();\n responses.push(await super.execute(client, remainingTimeout));\n\n if (remainingTimeout != null) {\n remainingTimeout = Date.now() - startTimestamp;\n }\n }\n\n return responses;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.consensus.submitMessage(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"consensusSubmitMessage\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IConsensusSubmitMessageTransactionBody}\n */\n _makeTransactionData() {\n if (this._chunkInfo != null && this._message != null) {\n const num = /** @type {number} */ (this._chunkInfo.number);\n const startIndex = (num - 1) * this._chunkSize;\n let endIndex = startIndex + this._chunkSize;\n\n if (endIndex > this._message.length) {\n endIndex = this._message.length;\n }\n\n return {\n topicID:\n this._topicId != null ? this._topicId._toProtobuf() : null,\n message: this._message.slice(startIndex, endIndex),\n chunkInfo: this._chunkInfo,\n };\n } else {\n return {\n topicID:\n this._topicId != null ? this._topicId._toProtobuf() : null,\n message: this._message,\n };\n }\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TopicMessageSubmitTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"consensusSubmitMessage\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TopicMessageSubmitTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicMessageSubmitTransaction.js?"); -/***/ }), +/** + * @typedef {import("./channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("./ManagedNodeAddress.js").default} ManagedNodeAddress + */ -/***/ "./node_modules/@hashgraph/sdk/src/topic/TopicUpdateTransaction.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/topic/TopicUpdateTransaction.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {object} NewNode + * @property {string} address + * @property {(address: string, cert?: string) => MirrorChannel} channelInitFunction + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TopicUpdateTransaction; }\n/* harmony export */ });\n/* harmony import */ var _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transaction/Transaction.js */ \"./node_modules/@hashgraph/sdk/src/transaction/Transaction.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _TopicId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/* harmony import */ var _Duration_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Duration.js */ \"./node_modules/@hashgraph/sdk/src/Duration.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusUpdateTopicTransactionBody} HashgraphProto.proto.IConsensusUpdateTopicTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HashgraphProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HashgraphProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HashgraphProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HashgraphProto.proto.ITransactionResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Update a topic.\n *\n * If there is no adminKey, the only authorized update (available to anyone) is to extend the expirationTime.\n * Otherwise transaction must be signed by the adminKey.\n *\n * If an adminKey is updated, the transaction must be signed by the pre-update adminKey and post-update adminKey.\n *\n * If a new autoRenewAccount is specified (not just being removed), that account must also sign the transaction.\n */\nclass TopicUpdateTransaction extends _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} props\n * @param {TopicId | string} [props.topicId]\n * @param {Key} [props.adminKey]\n * @param {Key} [props.submitKey]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {string} [props.topicMemo]\n * @param {Timestamp | Date} [props.expirationTime]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TopicId}\n */\n this._topicId = null;\n\n if (props.topicId != null) {\n this.setTopicId(props.topicId);\n }\n\n /**\n * @private\n * @type {?string}\n */\n this._topicMemo = null;\n\n if (props.topicMemo != null) {\n this.setTopicMemo(props.topicMemo);\n }\n\n /**\n * @private\n * @type {?Key}\n */\n this._submitKey = null;\n\n if (props.submitKey != null) {\n this.setSubmitKey(props.submitKey);\n }\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n /**\n * @private\n * @type {?Duration}\n */\n this._autoRenewPeriod = null;\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TopicUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n const update =\n /** @type {HashgraphProto.proto.IConsensusUpdateTopicTransactionBody} */ (\n body.consensusUpdateTopic\n );\n\n return _transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobufTransactions(\n new TopicUpdateTransaction({\n topicId:\n update.topicID != null\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(update.topicID)\n : undefined,\n adminKey:\n update.adminKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobufKey(update.adminKey)\n : undefined,\n submitKey:\n update.submitKey != null\n ? _Key_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobufKey(update.submitKey)\n : undefined,\n autoRenewAccountId:\n update.autoRenewAccount != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(update.autoRenewAccount)\n : undefined,\n autoRenewPeriod:\n update.autoRenewPeriod != null\n ? update.autoRenewPeriod.seconds != null\n ? update.autoRenewPeriod.seconds\n : undefined\n : undefined,\n topicMemo:\n update.memo != null\n ? update.memo.value != null\n ? update.memo.value\n : undefined\n : undefined,\n expirationTime:\n update.expirationTime != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobuf(update.expirationTime)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * @param {Timestamp | Date | null} expirationTime\n * @returns {TopicUpdateTransaction}\n */\n setExpirationTime(expirationTime) {\n this._requireNotFrozen();\n\n this._expirationTime =\n expirationTime instanceof Date\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].fromDate(expirationTime)\n : expirationTime;\n\n return this;\n }\n\n /**\n * @returns {?TopicId}\n */\n get topicId() {\n return this._topicId;\n }\n\n /**\n * @param {TopicId | string} topicId\n * @returns {TopicUpdateTransaction}\n */\n setTopicId(topicId) {\n this._requireNotFrozen();\n this._topicId =\n typeof topicId === \"string\"\n ? _TopicId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(topicId)\n : topicId.clone();\n\n return this;\n }\n\n /**\n * @returns {TopicUpdateTransaction}\n */\n clearTopicId() {\n this._requireNotFrozen();\n this._topicId = null;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get topicMemo() {\n return this._topicMemo;\n }\n\n /**\n * @param {string} topicMemo\n * @returns {TopicUpdateTransaction}\n */\n setTopicMemo(topicMemo) {\n this._requireNotFrozen();\n this._topicMemo = topicMemo;\n\n return this;\n }\n\n /**\n * @returns {TopicUpdateTransaction}\n */\n clearTopicMemo() {\n this._requireNotFrozen();\n this._topicMemo = null;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {TopicUpdateTransaction}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @returns {TopicUpdateTransaction}\n */\n clearAdminKey() {\n this._requireNotFrozen();\n this._adminKey = null;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get submitKey() {\n return this._submitKey;\n }\n\n /**\n * @param {Key} submitKey\n * @returns {TopicUpdateTransaction}\n */\n setSubmitKey(submitKey) {\n this._requireNotFrozen();\n this._submitKey = submitKey;\n\n return this;\n }\n\n /**\n * @returns {TopicUpdateTransaction}\n */\n clearSubmitKey() {\n this._requireNotFrozen();\n this._submitKey = null;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} autoRenewAccountId\n * @returns {TopicUpdateTransaction}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n autoRenewAccountId instanceof _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n ? autoRenewAccountId\n : _account_AccountId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(autoRenewAccountId);\n\n return this;\n }\n\n /**\n * @returns {TopicUpdateTransaction}\n */\n clearAutoRenewAccountId() {\n this._requireNotFrozen();\n this._autoRenewAccountId = null;\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * Set the auto renew period for this account.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {TopicUpdateTransaction}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof _Duration_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]\n ? autoRenewPeriod\n : new _Duration_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"](autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._topicId != null) {\n this._topicId.validateChecksum(client);\n }\n\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.consensus.updateTopic(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n return \"consensusUpdateTopic\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HashgraphProto.proto.IConsensusUpdateTopicTransactionBody}\n */\n _makeTransactionData() {\n return {\n topicID: this._topicId != null ? this._topicId._toProtobuf() : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n submitKey:\n this._submitKey != null\n ? this._submitKey._toProtobufKey()\n : null,\n memo:\n this._topicMemo != null\n ? {\n value: this._topicMemo,\n }\n : null,\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n autoRenewPeriod:\n this._autoRenewPeriod != null\n ? this._autoRenewPeriod._toProtobuf()\n : null,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TopicUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\n_transaction_Transaction_js__WEBPACK_IMPORTED_MODULE_0__.TRANSACTION_REGISTRY.set(\n \"consensusUpdateTopic\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TopicUpdateTransaction._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/topic/TopicUpdateTransaction.js?"); +/** + * @typedef {object} CloneNode + * @property {MirrorNode} node + * @property {ManagedNodeAddress} address + */ -/***/ }), +/** + * @augments {ManagedNode} + */ +class MirrorNode extends ManagedNode { + /** + * @param {object} props + * @param {NewNode=} [props.newNode] + * @param {CloneNode=} [props.cloneNode] + */ + constructor(props = {}) { + super(props); + } + + /** + * @returns {string} + */ + getKey() { + return this._address.toString(); + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/client/MirrorNetwork.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/transaction/List.js": -/*!*************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/List.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ List; }\n/* harmony export */ });\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n/**\n * A custom list type which round robins, supports locking, and as additional\n * QoL improvements.\n *\n * @template {any} T\n */\nclass List {\n constructor() {\n /** @type {T[]} */\n this.list = [];\n this.locked = false;\n this.index = 0;\n }\n\n /**\n * Overwrite the entire list.\n *\n * @throws if the list is locked\n * @param {T[]} list\n * @returns {this}\n */\n setList(list) {\n if (this.locked) {\n throw new Error(\"list is locked\");\n }\n\n this.list = list;\n this.index = 0;\n\n return this;\n }\n\n /**\n * Push items to the end of the list.\n *\n * @throws if the list is locked\n * @param {T[]} items\n * @returns {this}\n */\n push(...items) {\n if (this.locked) {\n throw new Error(\"list is locked\");\n }\n\n this.list.push(...items);\n return this;\n }\n\n /**\n * Locks the list.\n *\n * @returns {this}\n */\n setLocked() {\n this.locked = true;\n return this;\n }\n\n /**\n * Clear the list\n *\n * @throws if the list is locked\n */\n clear() {\n if (this.locked) {\n throw new Error(\"list is locked\");\n }\n\n this.list = [];\n this.index = 0;\n }\n\n /**\n * The get value at a particular index.\n *\n * @param {number} index\n * @returns {T}\n */\n get(index) {\n return this.list[index];\n }\n\n /**\n * Set value at index\n *\n * @throws if the list is locked\n * @param {number} index\n * @param {T} item\n * @returns {this}\n */\n set(index, item) {\n if (this.locked) {\n throw new Error(\"list is locked\");\n }\n\n // QoL: If the index is at the end simply push the element to the end\n if (index === this.length) {\n this.list.push(item);\n } else {\n this.list[index] = item;\n }\n\n return this;\n }\n\n /**\n * Set value at index if it's not already set\n *\n * @throws if the list is locked\n * @param {number} index\n * @param {() => T} lambda\n * @returns {this}\n */\n setIfAbsent(index, lambda) {\n if (index == this.length || this.list[index] == null) {\n this.set(index, lambda());\n }\n\n return this;\n }\n\n /**\n * Get the current value, and advance the index\n *\n * @returns {T}\n */\n get next() {\n return this.get(this.advance());\n }\n\n /**\n * Get the current value.\n *\n * @returns {T}\n */\n get current() {\n return this.get(this.index);\n }\n\n /**\n * Advance the index to the next element in a round robin fashion\n *\n * @returns {number}\n */\n advance() {\n const index = this.index;\n this.index = (this.index + 1) % this.list.length;\n return index;\n }\n\n /**\n * Is the list empty\n *\n * @returns {boolean}\n */\n get isEmpty() {\n return this.length === 0;\n }\n\n /**\n * Get the length of the list\n *\n * @returns {number}\n */\n get length() {\n return this.list.length;\n }\n\n /**\n * Shallow clone this list.\n * Perhaps we should explicitly call this `shallowClone()` since it doesn't\n * clone the list inside?\n *\n * @returns {List}\n */\n clone() {\n /** @type {List} */\n const list = new List();\n list.list = this.list;\n list.locked = this.locked;\n return list;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/List.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/transaction/NodeAccountIdSignatureMap.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/NodeAccountIdSignatureMap.js ***! - \**********************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ NodeAccountIdSignatureMap; }\n/* harmony export */ });\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @augments {ObjectMap}\n */\nclass NodeAccountIdSignatureMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n constructor() {\n super((s) => _PublicKey_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromString(s));\n }\n\n /**\n * @param {import(\"@hashgraph/proto\").proto.ISignatureMap} sigMap\n * @returns {NodeAccountIdSignatureMap}\n */\n static _fromTransactionSigMap(sigMap) {\n const signatures = new NodeAccountIdSignatureMap();\n\n const sigPairs = sigMap.sigPair != null ? sigMap.sigPair : [];\n\n for (const sigPair of sigPairs) {\n if (sigPair.pubKeyPrefix != null) {\n if (sigPair.ed25519 != null) {\n signatures._set(\n _PublicKey_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromBytesED25519(sigPair.pubKeyPrefix),\n sigPair.ed25519\n );\n } else if (sigPair.ECDSASecp256k1 != null) {\n signatures._set(\n _PublicKey_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].fromBytesECDSA(sigPair.pubKeyPrefix),\n sigPair.ECDSASecp256k1\n );\n }\n }\n }\n\n return signatures;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/NodeAccountIdSignatureMap.js?"); +/** + * @augments {ManagedNetwork} + */ +class MirrorNetwork extends ManagedNetwork { + /** + * @param {(address: string) => MirrorChannel} channelInitFunction + */ + constructor(channelInitFunction) { + super(channelInitFunction); + } + + /** + * @param {string[]} network + */ + setNetwork(network) { + // eslint-disable-next-line ie11/no-collection-args + this._setNetwork(new Map(network.map((address) => [address, address]))); + } + + /** + * @returns {string[]} + */ + get network() { + /** + * @type {string[]} + */ + var n = []; + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const node of this._nodes) { + n.push(node.address.toString()); + } + + return n; + } + + /** + * @abstract + * @param {[string, string]} entry + * @returns {MirrorNode} + */ + _createNodeFromNetworkEntry(entry) { + return new MirrorNode({ + newNode: { + address: entry[1], + channelInitFunction: this._createNetworkChannel, + }, + }).setMinBackoff(this._minBackoff); + } + + /** + * @abstract + * @param {Map} network + * @returns {number[]} + */ + _getNodesToRemove(network) { + const indexes = []; + + const values = Object.values(network); + + for (let i = this._nodes.length - 1; i >= 0; i--) { + const node = this._nodes[i]; + + if (!values.includes(node.address.toString())) { + indexes.push(i); + } + } + + return indexes; + } + + /** + * @returns {MirrorNode} + */ + getNextMirrorNode() { + if (this._createNetworkChannel == null) { + throw new Error("mirror network not supported on browser"); + } + + return this._getNumberOfMostHealthyNodes(1)[0]; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/client/Client.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/transaction/SignatureMap.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/SignatureMap.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ SignatureMap; }\n/* harmony export */ });\n/* harmony import */ var _NodeAccountIdSignatureMap_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeAccountIdSignatureMap.js */ \"./node_modules/@hashgraph/sdk/src/transaction/NodeAccountIdSignatureMap.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @augments {ObjectMap}\n */\nclass SignatureMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n constructor() {\n super((s) => _account_AccountId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].fromString(s));\n }\n\n /**\n * @param {import(\"./Transaction.js\").default} transaction\n * @returns {SignatureMap}\n */\n static _fromTransaction(transaction) {\n const signatures = new SignatureMap();\n\n for (let i = 0; i < transaction._nodeAccountIds.length; i++) {\n const sigMap = transaction._signedTransactions.get(i).sigMap;\n\n if (sigMap != null) {\n signatures._set(\n transaction._nodeAccountIds.list[i],\n _NodeAccountIdSignatureMap_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromTransactionSigMap(sigMap)\n );\n }\n }\n\n return signatures;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/SignatureMap.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/transaction/Transaction.js": -/*!********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/Transaction.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CHUNK_SIZE\": function() { return /* binding */ CHUNK_SIZE; },\n/* harmony export */ \"DEFAULT_AUTO_RENEW_PERIOD\": function() { return /* binding */ DEFAULT_AUTO_RENEW_PERIOD; },\n/* harmony export */ \"DEFAULT_RECORD_THRESHOLD\": function() { return /* binding */ DEFAULT_RECORD_THRESHOLD; },\n/* harmony export */ \"SCHEDULE_CREATE_TRANSACTION\": function() { return /* binding */ SCHEDULE_CREATE_TRANSACTION; },\n/* harmony export */ \"TRANSACTION_REGISTRY\": function() { return /* binding */ TRANSACTION_REGISTRY; },\n/* harmony export */ \"default\": function() { return /* binding */ Transaction; }\n/* harmony export */ });\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _TransactionResponse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransactionResponse.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js\");\n/* harmony import */ var _TransactionId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _TransactionHashMap_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TransactionHashMap.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionHashMap.js\");\n/* harmony import */ var _SignatureMap_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SignatureMap.js */ \"./node_modules/@hashgraph/sdk/src/transaction/SignatureMap.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _cryptography_sha384_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../cryptography/sha384.js */ \"./node_modules/@hashgraph/sdk/src/cryptography/sha384.browser.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../PrecheckStatusError.js */ \"./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/* harmony import */ var _List_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./List.js */ \"./node_modules/@hashgraph/sdk/src/transaction/List.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../util.js */ \"./node_modules/@hashgraph/sdk/src/util.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * @typedef {import(\"../schedule/ScheduleCreateTransaction.js\").default} ScheduleCreateTransaction\n * @typedef {import(\"../PrivateKey.js\").default} PrivateKey\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../Signer.js\").Signer} Signer\n */\n\n// 90 days (in seconds)\nconst DEFAULT_AUTO_RENEW_PERIOD = long__WEBPACK_IMPORTED_MODULE_7__.fromValue(7776000);\n\n// maximum value of i64 (so there is never a record generated)\nconst DEFAULT_RECORD_THRESHOLD = _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromTinybars(\n long__WEBPACK_IMPORTED_MODULE_7__.fromString(\"9223372036854775807\")\n);\n\n// 120 seconds\nconst DEFAULT_TRANSACTION_VALID_DURATION = 120;\n\nconst CHUNK_SIZE = 1024;\n\n/**\n * @type {Map, (transactions: HashgraphProto.proto.ITransaction[], signedTransactions: HashgraphProto.proto.ISignedTransaction[], transactionIds: TransactionId[], nodeIds: AccountId[], bodies: HashgraphProto.proto.TransactionBody[]) => Transaction>}\n */\nconst TRANSACTION_REGISTRY = new Map();\n\n/**\n * Base class for all transactions that may be submitted to Hedera.\n *\n * @abstract\n * @augments {Executable}\n */\nclass Transaction extends _Executable_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] {\n // A SDK transaction is composed of multiple, raw protobuf transactions.\n // These should be functionally identical, with the exception of pointing to\n // different nodes.\n\n // When retrying a transaction after a network error or retry-able\n // status response, we try a different transaction and thus a different node.\n\n constructor() {\n super();\n\n /**\n * List of proto transactions that have been built from this SDK\n * transaction.\n *\n * This is a 2-D array built into one, meaning to\n * get to the next row you'd index into this array `row * rowLength + column`\n * where `rowLength` is `nodeAccountIds.length`\n *\n * @internal\n * @type {List}\n */\n this._transactions = new _List_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]();\n\n /**\n * List of proto transactions that have been built from this SDK\n * transaction.\n *\n * This is a 2-D array built into one, meaning to\n * get to the next row you'd index into this array `row * rowLength + column`\n * where `rowLength` is `nodeAccountIds.length`\n *\n * @internal\n * @type {List}\n */\n this._signedTransactions = new _List_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]();\n\n /**\n * Set of public keys (as string) who have signed this transaction so\n * we do not allow them to sign it again.\n *\n * @internal\n * @type {Set}\n */\n this._signerPublicKeys = new Set();\n\n /**\n * The transaction valid duration\n *\n * @private\n * @type {number}\n */\n this._transactionValidDuration = DEFAULT_TRANSACTION_VALID_DURATION;\n\n /**\n * The default max transaction fee for this particular transaction type.\n * Most transactions use the default of 2 Hbars, but some requests such\n * as `TokenCreateTransaction` need to use a different default value.\n *\n * @protected\n * @type {Hbar}\n */\n this._defaultMaxTransactionFee = new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](2);\n\n /**\n * The max transaction fee on the request. This field is what users are able\n * to set, not the `defaultMaxTransactionFee`. The purpose of this field is\n * to allow us to determine if the user set the field explicitly, or if we're\n * using the default max transation fee for the request.\n *\n * @private\n * @type {Hbar | null}\n */\n this._maxTransactionFee = null;\n\n /**\n * The transaction's memo\n *\n * @private\n * @type {string}\n */\n this._transactionMemo = \"\";\n\n /**\n * The list of transaction IDs. This list will almost always be of length 1.\n * The only time this list will be a different length is for chunked transactions.\n * The only two chunked transactions supported right now are `FileAppendTransaction`\n * and `TopicMessageSubmitTransaction`\n *\n * @protected\n * @type {List}\n */\n this._transactionIds = new _List_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]();\n\n /**\n * A list of public keys that will be added to the requests signatures\n *\n * @private\n * @type {PublicKey[]}\n */\n this._publicKeys = [];\n\n /**\n * The list of signing function 1-1 with `_publicKeys` which sign the request.\n * The reason this list allows `null` is because if we go from bytes into\n * a transaction, then we know the public key, but we don't have the signing function.\n *\n * @private\n * @type {(((message: Uint8Array) => Promise) | null)[]}\n */\n this._transactionSigners = [];\n\n /**\n * Determine if we should regenerate transaction IDs when we receive `TRANSACITON_EXPIRED`\n *\n * @private\n * @type {?boolean}\n */\n this._regenerateTransactionId = null;\n }\n\n /**\n * Deserialize a transaction from bytes. The bytes can either be a `proto.Transaction` or\n * `proto.TransactionList`.\n *\n * @param {Uint8Array} bytes\n * @returns {Transaction}\n */\n static fromBytes(bytes) {\n const signedTransactions = [];\n const transactionIds = [];\n const nodeIds = [];\n\n /** @type {string[]} */\n const transactionIdStrings = [];\n\n /** @type {string[]} */\n const nodeIdStrings = [];\n\n const bodies = [];\n\n const list =\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.TransactionList.decode(bytes).transactionList;\n\n // If the list is of length 0, then teh bytes provided were not a\n // `proto.TransactionList`\n //\n // FIXME: We should also check to make sure the bytes length is greater than\n // 0 otherwise this check is wrong?\n if (list.length === 0) {\n const transaction = _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.Transaction.decode(bytes);\n\n // We support `Transaction.signedTransactionBytes` and\n // `Transaction.bodyBytes` + `Transaction.sigMap`. If the bytes represent the\n // latter, convert them into `signedTransactionBytes`\n if (transaction.signedTransactionBytes.length !== 0) {\n list.push(transaction);\n } else {\n list.push({\n signedTransactionBytes:\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.SignedTransaction.encode({\n bodyBytes: transaction.bodyBytes,\n sigMap: transaction.sigMap,\n }).finish(),\n });\n }\n }\n\n // This loop is responsible for fill out the `signedTransactions`, `transactionIds`,\n // `nodeIds`, and `bodies` variables.\n for (const transaction of list) {\n // The `signedTransactionBytes` should not be null\n if (transaction.signedTransactionBytes == null) {\n throw new Error(\"Transaction.signedTransactionBytes are null\");\n }\n\n // Decode a signed transaction\n const signedTransaction =\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.SignedTransaction.decode(\n transaction.signedTransactionBytes\n );\n signedTransactions.push(signedTransaction);\n\n // Decode a transaction body\n const body = _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.TransactionBody.decode(\n signedTransaction.bodyBytes\n );\n\n // Make sure the body is set\n if (body.data == null) {\n throw new Error(\"(BUG) body.data was not set in the protobuf\");\n }\n\n bodies.push(body);\n\n // Make sure the transaction ID within the body is set\n if (body.transactionID != null) {\n const transactionId = _TransactionId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITransactionID} */ (\n body.transactionID\n )\n );\n\n // If we haven't already seen this transaction ID in the list, add it\n if (!transactionIdStrings.includes(transactionId.toString())) {\n transactionIds.push(transactionId);\n transactionIdStrings.push(transactionId.toString());\n }\n }\n\n // Make sure the node account ID within the body is set\n if (body.nodeAccountID != null) {\n const nodeAccountId = _account_AccountId_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IAccountID} */ (\n body.nodeAccountID\n )\n );\n\n // If we haven't already seen this node account ID in the list, add it\n if (!nodeIdStrings.includes(nodeAccountId.toString())) {\n nodeIds.push(nodeAccountId);\n nodeIdStrings.push(nodeAccountId.toString());\n }\n }\n }\n\n // FIXME: We should have a length check before we access `0` since that would error\n const body = bodies[0];\n\n // We should have at least more than one body\n if (body == null || body.data == null) {\n throw new Error(\n \"No transaction found in bytes or failed to decode TransactionBody\"\n );\n }\n\n // Use the registry to call the right transaction's `fromProtobuf` method based\n // on the `body.data` string\n const fromProtobuf = TRANSACTION_REGISTRY.get(body.data); //NOSONAR\n\n // If we forgot to update the registry we should error\n if (fromProtobuf == null) {\n throw new Error(\n `(BUG) Transaction.fromBytes() not implemented for type ${body.data}`\n );\n }\n\n // That the specific transaction type from protobuf implementation and pass in all the\n // information we've gathered.\n return fromProtobuf(\n list,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n );\n }\n\n /**\n * Convert this transaction a `ScheduleCreateTransaction`\n *\n * @returns {ScheduleCreateTransaction}\n */\n schedule() {\n this._requireNotFrozen();\n\n if (SCHEDULE_CREATE_TRANSACTION.length != 1) {\n throw new Error(\n \"ScheduleCreateTransaction has not been loaded yet\"\n );\n }\n\n return SCHEDULE_CREATE_TRANSACTION[0]()._setScheduledTransaction(this);\n }\n\n /**\n * This method is called by each `*Transaction._fromProtobuf()` method. It does\n * all the finalization before the user gets hold of a complete `Transaction`\n *\n * @template {Transaction} TransactionT\n * @param {TransactionT} transaction\n * @param {HashgraphProto.proto.ITransaction[]} transactions\n * @param {HashgraphProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HashgraphProto.proto.ITransactionBody[]} bodies\n * @returns {TransactionT}\n */\n static _fromProtobufTransactions(\n transaction,\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies\n ) {\n const body = bodies[0];\n\n // \"row\" of the 2-D `bodies` array has all the same contents except for `nodeAccountID`\n for (let i = 0; i < transactionIds.length; i++) {\n for (let j = 0; j < nodeIds.length - 1; j++) {\n if (\n !_util_js__WEBPACK_IMPORTED_MODULE_17__.compare(\n bodies[i * nodeIds.length + j],\n bodies[i * nodeIds.length + j + 1],\n // eslint-disable-next-line ie11/no-collection-args\n new Set([\"nodeAccountID\"])\n )\n ) {\n throw new Error(\"failed to validate transaction bodies\");\n }\n }\n }\n\n // Remove node account IDs of 0\n // _IIRC_ this was initial due to some funny behavior with `ScheduleCreateTransaction`\n // We may be able to remove this.\n const zero = new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"](0);\n for (let i = 0; i < nodeIds.length; i++) {\n if (nodeIds[i].equals(zero)) {\n nodeIds.splice(i--, 1);\n }\n }\n\n // Set the transactions accordingly, but don't lock the list because transactions can\n // be regenerated if more signatures are added\n transaction._transactions.setList(transactions);\n\n // Set the signed transactions accordingly, and lock the list since signed transaction\n // will not be regenerated. Although, they can be manipulated if for instance more\n // signatures are added\n transaction._signedTransactions.setList(signedTransactions).setLocked();\n\n // Set the transaction IDs accordingly, and lock the list. Transaction IDs should not\n // be regenerated if we're deserializing a request from bytes\n transaction._transactionIds.setList(transactionIds).setLocked();\n\n // Set the node account IDs accordingly, and lock the list. Node account IDs should\n // never be changed if we're deserializing a request from bytes\n transaction._nodeAccountIds.setList(nodeIds).setLocked();\n\n // Make sure to update the rest of the fields\n transaction._transactionValidDuration =\n body.transactionValidDuration != null &&\n body.transactionValidDuration.seconds != null\n ? long__WEBPACK_IMPORTED_MODULE_7__.fromValue(body.transactionValidDuration.seconds).toInt()\n : DEFAULT_TRANSACTION_VALID_DURATION;\n transaction._maxTransactionFee =\n body.transactionFee != null\n ? _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromTinybars(body.transactionFee)\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](0);\n transaction._transactionMemo = body.memo != null ? body.memo : \"\";\n\n // Loop over a single row of `signedTransactions` and add all the public\n // keys to the `signerPublicKeys` set, and `publicKeys` list with\n // `null` in the `transactionSigners` at the same index.\n for (let i = 0; i < nodeIds.length; i++) {\n const signedTransaction = signedTransactions[i];\n if (\n signedTransaction.sigMap != null &&\n signedTransaction.sigMap.sigPair != null\n ) {\n for (const sigPair of signedTransaction.sigMap.sigPair) {\n transaction._signerPublicKeys.add(\n _encoding_hex_js__WEBPACK_IMPORTED_MODULE_9__.encode(\n /** @type {Uint8Array} */ (sigPair.pubKeyPrefix)\n )\n );\n\n transaction._publicKeys.push(\n _PublicKey_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"].fromBytes(\n /** @type {Uint8Array} */ (sigPair.pubKeyPrefix)\n )\n );\n transaction._transactionSigners.push(null);\n }\n }\n }\n\n return transaction;\n }\n\n /**\n * Set the node account IDs\n *\n * @override\n * @param {AccountId[]} nodeIds\n * @returns {this}\n */\n setNodeAccountIds(nodeIds) {\n // The reason we overwrite this method is simply because we need to call `requireNotFrozen()`\n // Now that I think of it, we could just add an abstract method `setterPrerequiest()` which\n // by default does nothing, and `Executable` can call. Then we'd only need to overwrite that\n // method once.\n this._requireNotFrozen();\n super.setNodeAccountIds(nodeIds);\n return this;\n }\n\n /**\n * Get the transaction valid duration\n *\n * @returns {number}\n */\n get transactionValidDuration() {\n return this._transactionValidDuration;\n }\n\n /**\n * Sets the duration (in seconds) that this transaction is valid for.\n *\n * This is defaulted to 120 seconds (from the time its executed).\n *\n * @param {number} validDuration\n * @returns {this}\n */\n setTransactionValidDuration(validDuration) {\n this._requireNotFrozen();\n this._transactionValidDuration = validDuration;\n\n return this;\n }\n\n /**\n * Get the max transaction fee\n *\n * @returns {?Hbar}\n */\n get maxTransactionFee() {\n return this._maxTransactionFee;\n }\n\n /**\n * Set the maximum transaction fee the operator (paying account)\n * is willing to pay.\n *\n * @param {number | string | Long | BigNumber | Hbar} maxTransactionFee\n * @returns {this}\n */\n setMaxTransactionFee(maxTransactionFee) {\n this._requireNotFrozen();\n this._maxTransactionFee =\n maxTransactionFee instanceof _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n ? maxTransactionFee\n : new _Hbar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](maxTransactionFee);\n\n return this;\n }\n\n /**\n * Is transaction ID regeneration enabled\n *\n * @returns {?boolean}\n */\n get regenerateTransactionId() {\n return this._regenerateTransactionId;\n }\n\n /**\n * Set the maximum transaction fee the operator (paying account)\n * is willing to pay.\n *\n * @param {boolean} regenerateTransactionId\n * @returns {this}\n */\n setRegenerateTransactionId(regenerateTransactionId) {\n this._requireNotFrozen();\n this._regenerateTransactionId = regenerateTransactionId;\n\n return this;\n }\n\n /**\n * Get the transaction memo\n *\n * @returns {string}\n */\n get transactionMemo() {\n return this._transactionMemo;\n }\n\n /**\n * Set a note or description to be recorded in the transaction\n * record (maximum length of 100 bytes).\n *\n * @param {string} transactionMemo\n * @returns {this}\n */\n setTransactionMemo(transactionMemo) {\n this._requireNotFrozen();\n this._transactionMemo = transactionMemo;\n\n return this;\n }\n\n /**\n * Get the curent transaction ID\n *\n * @returns {?TransactionId}\n */\n get transactionId() {\n if (this._transactionIds.isEmpty) {\n return null;\n }\n\n // If a user calls `.transactionId` that means we need to use that transaction ID\n // and **not** regenerate it. To do this, we simply lock the transaction ID list.\n //\n // This may be a little conffusing since a user can enable transaction ID regenration\n // explicity, but if they call `.transactionId` then we will not regenerate transaction\n // IDs.\n this._transactionIds.setLocked();\n\n return this._transactionIds.current;\n }\n\n /**\n * Set the ID for this transaction.\n *\n * The transaction ID includes the operator's account ( the account paying the transaction\n * fee). If two transactions have the same transaction ID, they won't both have an effect. One\n * will complete normally and the other will fail with a duplicate transaction status.\n *\n * Normally, you should not use this method. Just before a transaction is executed, a\n * transaction ID will be generated from the operator on the client.\n *\n * @param {TransactionId} transactionId\n * @returns {this}\n */\n setTransactionId(transactionId) {\n this._requireNotFrozen();\n this._transactionIds.setList([transactionId]).setLocked();\n\n return this;\n }\n\n /**\n * Sign the transaction with the private key\n * **NOTE**: This is a thin wrapper around `.signWith()`\n *\n * @param {PrivateKey} privateKey\n * @returns {Promise}\n */\n sign(privateKey) {\n return this.signWith(privateKey.publicKey, (message) =>\n Promise.resolve(privateKey.sign(message))\n );\n }\n\n /**\n * Sign the transaction with the public key and signer function\n *\n * If sign on demand is enabled no signing will be done immediately, instead\n * the private key signing function and public key are saved to be used when\n * a user calls an exit condition method (not sure what a better name for this is)\n * such as `toBytes[Async]()`, `getTransactionHash[PerNode]()` or `execute()`.\n *\n * @param {PublicKey} publicKey\n * @param {(message: Uint8Array) => Promise} transactionSigner\n * @returns {Promise}\n */\n async signWith(publicKey, transactionSigner) {\n // If signing on demand is disabled, we need to make sure\n // the request is frozen\n if (!this._signOnDemand) {\n this._requireFrozen();\n }\n\n const publicKeyData = publicKey.toBytesRaw();\n\n // note: this omits the DER prefix on purpose because Hedera doesn't\n // support that in the protobuf. this means that we would fail\n // to re-inflate [this._signerPublicKeys] during [fromBytes] if we used DER\n // prefixes here\n const publicKeyHex = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_9__.encode(publicKeyData);\n\n if (this._signerPublicKeys.has(publicKeyHex)) {\n // this public key has already signed this transaction\n return this;\n }\n\n // If we add a new signer, then we need to re-create all transactions\n this._transactions.clear();\n\n // Save the current public key so we don't attempt to sign twice\n this._signerPublicKeys.add(publicKeyHex);\n\n // If signing on demand is enabled we will save the public key and signer and return\n if (this._signOnDemand) {\n this._publicKeys.push(publicKey);\n this._transactionSigners.push(transactionSigner);\n\n return this;\n }\n\n // If we get here, signing on demand is disabled, this means the transaction\n // is frozen and we need to sign all the transactions immediately. If we're\n // signing all the transactions immediately, we need to lock the node account IDs\n // and transaction IDs.\n // Now that I think of it, this code should likely exist in `freezeWith()`?\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n\n // Sign each signed transatcion\n for (const signedTransaction of this._signedTransactions.list) {\n const bodyBytes = /** @type {Uint8Array} */ (\n signedTransaction.bodyBytes\n );\n const signature = await transactionSigner(bodyBytes);\n\n if (signedTransaction.sigMap == null) {\n signedTransaction.sigMap = {};\n }\n\n if (signedTransaction.sigMap.sigPair == null) {\n signedTransaction.sigMap.sigPair = [];\n }\n\n signedTransaction.sigMap.sigPair.push(\n publicKey._toProtobufSignature(signature)\n );\n }\n\n return this;\n }\n\n /**\n * Sign the transaction with the client operator. This is a thin wrapper\n * around `.signWith()`\n *\n * **NOTE**: If client does not have an operator set, this method will throw\n *\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n signWithOperator(client) {\n const operator = client._operator;\n\n if (operator == null) {\n throw new Error(\n \"`client` must have an operator to sign with the operator\"\n );\n }\n\n if (!this._isFrozen()) {\n this.freezeWith(client);\n }\n\n return this.signWith(operator.publicKey, operator.transactionSigner);\n }\n\n /**\n * Add a signature explicitly\n *\n * This method requires the transaction to have exactly 1 node account ID set\n * since different node account IDs have different byte representations and\n * hence the same signature would not work for all transactions that are the same\n * except for node account ID being different.\n *\n * @param {PublicKey} publicKey\n * @param {Uint8Array} signature\n * @returns {this}\n */\n addSignature(publicKey, signature) {\n // Require that only one node is set on this transaction\n // FIXME: This doesn't consider if we have one node account ID set, but we're\n // also a chunked transaction. We should also check transaction IDs is of length 1\n this._requireOneNodeAccountId();\n\n // If the transaction isn't frozen, freeze it.\n if (!this.isFrozen()) {\n this.freeze();\n }\n\n const publicKeyData = publicKey.toBytesRaw();\n const publicKeyHex = _encoding_hex_js__WEBPACK_IMPORTED_MODULE_9__.encode(publicKeyData);\n\n if (this._signerPublicKeys.has(publicKeyHex)) {\n // this public key has already signed this transaction\n return this;\n }\n\n // Transactions will have to be regenerated\n this._transactions.clear();\n\n // Locking the transaction IDs and node account IDs is necessary for consistency\n // between before and after execution\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n this._signedTransactions.setLocked();\n\n // Add the signature to the signed transaction list. This is a copy paste\n // of `.signWith()`, but it really shouldn't be if `_signedTransactions.list`\n // must be a length of one.\n // FIXME: Remove unnecessary for loop.\n for (const transaction of this._signedTransactions.list) {\n if (transaction.sigMap == null) {\n transaction.sigMap = {};\n }\n\n if (transaction.sigMap.sigPair == null) {\n transaction.sigMap.sigPair = [];\n }\n\n transaction.sigMap.sigPair.push(\n publicKey._toProtobufSignature(signature)\n );\n }\n\n this._signerPublicKeys.add(publicKeyHex);\n this._publicKeys.push(publicKey);\n this._transactionSigners.push(null);\n\n return this;\n }\n\n /**\n * Get the current signatures on the request\n *\n * **NOTE**: Does NOT support sign on demand\n *\n * @returns {SignatureMap}\n */\n getSignatures() {\n // If a user is attempting to get signatures for a transaction, then the\n // transaction must be frozen.\n this._requireFrozen();\n\n // Sign on demand must be disabled because this is the non-async version and\n // signing requires awaiting callbacks.\n this._requireNotSignOnDemand();\n\n // Build all the transactions\n this._buildAllTransactions();\n\n // Lock transaction IDs, and node account IDs\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n\n // Construct a signature map from this transaction\n return _SignatureMap_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromTransaction(this);\n }\n\n /**\n * Get the current signatures on the request\n *\n * **NOTE**: Supports sign on demand\n *\n * @returns {Promise}\n */\n async getSignaturesAsync() {\n // If sign on demand is enabled, we don't need to care about being frozen\n // since we can just regenerate and resign later if some field of the transaction\n // changes.\n\n // Locking the transaction IDs and node account IDs is necessary for consistency\n // between before and after execution\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n\n // Build all transactions, and sign them\n await this._buildAllTransactionsAsync();\n\n // Lock transaction IDs, and node account IDs\n this._transactions.setLocked();\n this._signedTransactions.setLocked();\n\n // Construct a signature map from this transaction\n return _SignatureMap_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromTransaction(this);\n }\n\n /**\n * Not sure why this is called `setTransactionId()` when it doesn't set anything...\n * FIXME: Remove this?\n */\n _setTransactionId() {\n if (this._operatorAccountId == null && this._transactionIds.isEmpty) {\n throw new Error(\n \"`transactionId` must be set or `client` must be provided with `freezeWith`\"\n );\n }\n }\n\n /**\n * Set the node account IDs using the client\n *\n * @param {?import(\"../client/Client.js\").default} client\n */\n _setNodeAccountIds(client) {\n if (!this._nodeAccountIds.isEmpty) {\n return;\n }\n\n if (client == null) {\n throw new Error(\n \"`nodeAccountId` must be set or `client` must be provided with `freezeWith`\"\n );\n }\n\n this._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute()\n );\n }\n\n /**\n * Build all the signed transactions from the node account IDs\n *\n * @private\n */\n _buildSignedTransactions() {\n if (this._signedTransactions.locked) {\n return;\n }\n\n this._signedTransactions.setList(\n this._nodeAccountIds.list.map((nodeId) =>\n this._makeSignedTransaction(nodeId)\n )\n );\n }\n\n /**\n * Freeze this transaction from future modification to prepare for\n * signing or serialization.\n *\n * @returns {this}\n */\n freeze() {\n return this.freezeWith(null);\n }\n\n /**\n * @param {?AccountId} accountId\n */\n _freezeWithAccountId(accountId) {\n if (this._operatorAccountId == null) {\n this._operatorAccountId = accountId;\n }\n }\n\n /**\n * Freeze this transaction from further modification to prepare for\n * signing or serialization.\n *\n * Will use the `Client`, if available, to generate a default Transaction ID and select 1/3\n * nodes to prepare this transaction for.\n *\n * @param {?import(\"../client/Client.js\").default} client\n * @returns {this}\n */\n freezeWith(client) {\n // Set sign on demand based on client\n this._signOnDemand = client != null ? client.signOnDemand : false;\n\n // Save the operator\n this._operator = client != null ? client._operator : null;\n this._freezeWithAccountId(\n client != null ? client.operatorAccountId : null\n );\n\n // Set max transaction fee to either `this._maxTransactionFee`,\n // `client._defaultMaxTransactionFee`, or `this._defaultMaxTransactionFee`\n // in that priority order depending on if `this._maxTransactionFee` has\n // been set or if `client._defaultMaxTransactionFee` has been set.\n this._maxTransactionFee =\n this._maxTransactionFee == null\n ? client != null && client.defaultMaxTransactionFee != null\n ? client.defaultMaxTransactionFee\n : this._defaultMaxTransactionFee\n : this._maxTransactionFee;\n\n // Determine if transaction ID generation should be enabled.\n this._regenerateTransactionId =\n client != null && this._regenerateTransactionId == null\n ? client.defaultRegenerateTransactionId\n : this._regenerateTransactionId;\n\n // Set the node account IDs via client\n this._setNodeAccountIds(client);\n\n // Make sure a transaction ID or operator is set.\n this._setTransactionId();\n\n // If a client was not provided, we need to make sure the transaction ID already set\n // validates aginst the client.\n if (client != null) {\n for (const transactionId of this._transactionIds.list) {\n if (transactionId.accountId != null) {\n transactionId.accountId.validateChecksum(client);\n }\n }\n }\n\n // Build a list of transaction IDs so that if a user calls `.transactionId` they'll\n // get a value, but if they dont' we'll just regenerate transaction IDs during execution\n this._buildNewTransactionIdList();\n\n // If sign on demand is disabled we need to build out all the signed transactions\n if (!this._signOnDemand) {\n this._buildSignedTransactions();\n }\n\n return this;\n }\n\n /**\n * Sign the transaction using a signer\n *\n * This is part of the signature provider feature\n *\n * @param {Signer} signer\n * @returns {Promise}\n */\n async signWithSigner(signer) {\n await signer.signTransaction(this);\n return this;\n }\n\n /**\n * Freeze the transaction using a signer\n *\n * This is part of the signature provider feature.\n *\n * @param {Signer} signer\n * @returns {Promise}\n */\n async freezeWithSigner(signer) {\n await signer.populateTransaction(this);\n this.freeze();\n return this;\n }\n\n /**\n * Serialize the request into bytes. This will encode all the transactions\n * into a `proto.TransactionList` and return the encoded protobuf.\n *\n * **NOTE**: Does not support sign on demand\n *\n * @returns {Uint8Array}\n */\n toBytes() {\n // If a user is attempting to serialize a transaction into bytes, then the\n // transaction must be frozen.\n this._requireFrozen();\n\n // Sign on demand must be disabled because this is the non-async version and\n // signing requires awaiting callbacks.\n this._requireNotSignOnDemand();\n\n // Locking the transaction IDs and node account IDs is necessary for consistency\n // between before and after execution\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n\n // Build all the transactions withot signing\n this._buildAllTransactions();\n\n // Construct and encode the transaction list\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.TransactionList.encode({\n transactionList:\n /** @type {HashgraphProto.proto.ITransaction[]} */ (\n this._transactions.list\n ),\n }).finish();\n }\n\n /**\n * Serialize the transaction into bytes\n *\n * **NOTE**: Supports sign on demand\n *\n * @returns {Promise}\n */\n async toBytesAsync() {\n // If sign on demand is enabled, we don't need to care about being frozen\n // since we can just regenerate and resign later if some field of the transaction\n // changes.\n\n // Locking the transaction IDs and node account IDs is necessary for consistency\n // between before and after execution\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n\n // Build all transactions, and sign them\n await this._buildAllTransactionsAsync();\n\n // Lock transaction IDs, and node account IDs\n this._transactions.setLocked();\n this._signedTransactions.setLocked();\n\n // Construct and encode the transaction list\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.TransactionList.encode({\n transactionList:\n /** @type {HashgraphProto.proto.ITransaction[]} */ (\n this._transactions.list\n ),\n }).finish();\n }\n\n /**\n * Get the transaction hash\n *\n * @returns {Promise}\n */\n async getTransactionHash() {\n this._requireFrozen();\n\n // Locking the transaction IDs and node account IDs is necessary for consistency\n // between before and after execution\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n\n await this._buildAllTransactionsAsync();\n\n this._transactions.setLocked();\n this._signedTransactions.setLocked();\n\n return _cryptography_sha384_js__WEBPACK_IMPORTED_MODULE_8__.digest(\n /** @type {Uint8Array} */ (\n /** @type {HashgraphProto.proto.ITransaction} */ (\n this._transactions.get(0)\n ).signedTransactionBytes\n )\n );\n }\n\n /**\n * Get all the transaction hashes\n *\n * @returns {Promise}\n */\n async getTransactionHashPerNode() {\n this._requireFrozen();\n\n // Locking the transaction IDs and node account IDs is necessary for consistency\n // between before and after execution\n this._transactionIds.setLocked();\n this._nodeAccountIds.setLocked();\n\n await this._buildAllTransactionsAsync();\n\n return await _TransactionHashMap_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromTransaction(this);\n }\n\n /**\n * Is transaction frozen\n *\n * @returns {boolean}\n */\n isFrozen() {\n return this._signedTransactions.length > 0;\n }\n\n /**\n * Get the current transaction ID, and make sure it's not null\n *\n * @protected\n * @returns {TransactionId}\n */\n _getTransactionId() {\n const transactionId = this.transactionId;\n if (transactionId == null) {\n throw new Error(\n \"transaction must have been frozen before getting the transaction ID, try calling `freeze`\"\n );\n }\n return transactionId;\n }\n\n /**\n * @param {Client} client\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function\n _validateChecksums(client) {\n // Do nothing\n }\n\n /**\n * Before we proceed exeuction, we need to do a couple checks\n *\n * @override\n * @protected\n * @param {import(\"../client/Client.js\").default} client\n * @returns {Promise}\n */\n async _beforeExecute(client) {\n // Makes ure we're frozen\n if (!this._isFrozen()) {\n this.freezeWith(client);\n }\n\n // Valid checksums if the option is enabled\n if (client.isAutoValidateChecksumsEnabled()) {\n this._validateChecksums(client);\n }\n\n // Set the operator if the client has one\n this._operator = client != null ? client._operator : null;\n this._operatorAccountId =\n client != null && client._operator != null\n ? client._operator.accountId\n : null;\n\n // If the client has an operaator, sign this request with the operator\n if (this._operator != null) {\n await this.signWith(\n this._operator.publicKey,\n this._operator.transactionSigner\n );\n }\n }\n\n /**\n * Construct a protobuf transaction\n *\n * @override\n * @internal\n * @returns {Promise}\n */\n async _makeRequestAsync() {\n // The index for the transaction\n const index =\n this._transactionIds.index * this._nodeAccountIds.length +\n this._nodeAccountIds.index;\n\n // If sign on demand is disabled we need to simply build that transaction\n // and return the result, without signing\n if (!this._signOnDemand) {\n this._buildTransaction(index);\n return /** @type {HashgraphProto.proto.ITransaction} */ (\n this._transactions.get(index)\n );\n }\n\n // Build and sign a transaction\n return await this._buildTransactionAsync();\n }\n\n /**\n * Sign a `proto.SignedTransaction` with all the keys\n *\n * @private\n * @returns {Promise}\n */\n async _signTransaction() {\n const signedTransaction = this._makeSignedTransaction(\n this._nodeAccountIds.next\n );\n\n const bodyBytes = /** @type {Uint8Array} */ (\n signedTransaction.bodyBytes\n );\n\n for (let j = 0; j < this._publicKeys.length; j++) {\n const publicKey = this._publicKeys[j];\n const transactionSigner = this._transactionSigners[j];\n\n if (transactionSigner == null) {\n continue;\n }\n\n const signature = await transactionSigner(bodyBytes);\n\n if (signedTransaction.sigMap == null) {\n signedTransaction.sigMap = {};\n }\n\n if (signedTransaction.sigMap.sigPair == null) {\n signedTransaction.sigMap.sigPair = [];\n }\n\n signedTransaction.sigMap.sigPair.push(\n publicKey._toProtobufSignature(signature)\n );\n }\n\n return signedTransaction;\n }\n\n /**\n * Construct a new transaction ID at the current index\n *\n * @private\n */\n _buildNewTransactionIdList() {\n if (this._transactionIds.locked || this._operatorAccountId == null) {\n return;\n }\n\n const transactionId = _TransactionId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].withValidStart(\n this._operatorAccountId,\n _Timestamp_js__WEBPACK_IMPORTED_MODULE_15__[\"default\"].generate()\n );\n\n this._transactionIds.set(this._transactionIds.index, transactionId);\n }\n\n /**\n * Build each transaction in a loop\n *\n * @private\n */\n _buildAllTransactions() {\n for (let i = 0; i < this._signedTransactions.length; i++) {\n this._buildTransaction(i);\n }\n }\n\n /**\n * Build and and sign each transaction in a loop\n *\n * This method is primary used in the exist condition methods\n * which are not `execute()`, e.g. `toBytesAsync()` and `getSignaturesAsync()`\n *\n * @private\n */\n async _buildAllTransactionsAsync() {\n if (!this._signOnDemand) {\n this._buildAllTransactions();\n return;\n }\n\n this._buildSignedTransactions();\n\n if (this._transactions.locked) {\n return;\n }\n\n for (let i = 0; i < this._signedTransactions.length; i++) {\n this._transactions.push(await this._buildTransactionAsync());\n }\n }\n\n /**\n * Build a transaction at a particular index\n *\n * @private\n * @param {number} index\n */\n _buildTransaction(index) {\n if (this._transactions.length < index) {\n for (let i = this._transactions.length; i < index; i++) {\n this._transactions.push(null);\n }\n }\n\n this._transactions.setIfAbsent(index, () => {\n return {\n signedTransactionBytes:\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.SignedTransaction.encode(\n this._signedTransactions.get(index)\n ).finish(),\n };\n });\n }\n\n /**\n * Build a trransaction using the current index, where the current\n * index is determined by `this._nodeAccountIds.index` and\n * `this._transactionIds.index`\n *\n * @private\n * @returns {Promise}\n */\n async _buildTransactionAsync() {\n return {\n signedTransactionBytes:\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.SignedTransaction.encode(\n await this._signTransaction()\n ).finish(),\n };\n }\n\n /**\n * Determine what execution state we're in.\n *\n * @override\n * @internal\n * @param {HashgraphProto.proto.ITransaction} request\n * @param {HashgraphProto.proto.ITransactionResponse} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n const { nodeTransactionPrecheckCode } = response;\n\n // Get the node precheck code, and convert it into an SDK `Status`\n const status = _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.ResponseCodeEnum.OK\n );\n\n js_logger__WEBPACK_IMPORTED_MODULE_16__.debug(\n `[${this._getLogId()}] received status ${status.toString()}`\n );\n\n // Based on the status what execution state are we in\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Busy:\n case _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Unknown:\n case _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].PlatformTransactionNotCreated:\n case _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].PlatformNotActive:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_5__.ExecutionState.Retry];\n case _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Ok:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_5__.ExecutionState.Finished];\n case _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].TransactionExpired:\n if (\n this._regenerateTransactionId == null ||\n this._regenerateTransactionId\n ) {\n this._buildNewTransactionIdList();\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_5__.ExecutionState.Retry];\n } else {\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_5__.ExecutionState.Error];\n }\n default:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_5__.ExecutionState.Error];\n }\n }\n\n /**\n * Map the request and response into a precheck status error\n *\n * @override\n * @internal\n * @param {HashgraphProto.proto.ITransaction} request\n * @param {HashgraphProto.proto.ITransactionResponse} response\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response) {\n const { nodeTransactionPrecheckCode } = response;\n\n const status = _Status_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.ResponseCodeEnum.OK\n );\n\n return new _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]({\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult: null,\n });\n }\n\n /**\n * Map the request, response, and node account ID into a `TransactionResponse`\n *\n * @override\n * @protected\n * @param {HashgraphProto.proto.ITransactionResponse} response\n * @param {AccountId} nodeId\n * @param {HashgraphProto.proto.ITransaction} request\n * @returns {Promise}\n */\n async _mapResponse(response, nodeId, request) {\n const transactionHash = await _cryptography_sha384_js__WEBPACK_IMPORTED_MODULE_8__.digest(\n /** @type {Uint8Array} */ (request.signedTransactionBytes)\n );\n const transactionId = this._getTransactionId();\n\n this._transactionIds.advance();\n\n return new _TransactionResponse_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]({\n nodeId,\n transactionHash,\n transactionId,\n });\n }\n\n /**\n * Make a signed tranaction given a node account ID\n *\n * @internal\n * @param {?AccountId} nodeId\n * @returns {HashgraphProto.proto.ISignedTransaction}\n */\n _makeSignedTransaction(nodeId) {\n const body = this._makeTransactionBody(nodeId);\n const bodyBytes =\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.TransactionBody.encode(body).finish();\n\n return {\n bodyBytes,\n sigMap: {\n sigPair: [],\n },\n };\n }\n\n /**\n * Make a protobuf transaction body\n *\n * @private\n * @param {?AccountId} nodeId\n * @returns {HashgraphProto.proto.ITransactionBody}\n */\n _makeTransactionBody(nodeId) {\n return {\n [this._getTransactionDataCase()]: this._makeTransactionData(),\n transactionFee:\n this._maxTransactionFee != null\n ? this._maxTransactionFee.toTinybars()\n : null,\n memo: this._transactionMemo,\n transactionID: this._transactionIds.current._toProtobuf(),\n nodeAccountID: nodeId != null ? nodeId._toProtobuf() : null,\n transactionValidDuration: {\n seconds: long__WEBPACK_IMPORTED_MODULE_7__.fromNumber(this._transactionValidDuration),\n },\n };\n }\n\n /**\n * This method returns a key for the `data` field in a transaction body.\n * Each transaction overwrite this to make sure when we build the transaction body\n * we set the right data field.\n *\n * @abstract\n * @protected\n * @returns {NonNullable}\n */\n _getTransactionDataCase() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Make a scheduled transaction body\n * FIXME: Should really call this `makeScheduledTransactionBody` to be consistent\n *\n * @internal\n * @returns {HashgraphProto.proto.ISchedulableTransactionBody}\n */\n _getScheduledTransactionBody() {\n return {\n memo: this.transactionMemo,\n transactionFee:\n this._maxTransactionFee == null\n ? this._defaultMaxTransactionFee.toTinybars()\n : this._maxTransactionFee.toTinybars(),\n [this._getTransactionDataCase()]: this._makeTransactionData(),\n };\n }\n\n /**\n * Make the transaction body data.\n *\n * @abstract\n * @protected\n * @returns {object}\n */\n _makeTransactionData() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * FIXME: Why do we have `isFrozen` and `_isFrozen()`?\n *\n * @protected\n * @returns {boolean}\n */\n _isFrozen() {\n return (\n this._signOnDemand ||\n this._signedTransactions.length > 0 ||\n this._transactions.length > 0\n );\n }\n\n /**\n * Require the transaction to NOT be frozen\n *\n * @internal\n */\n _requireNotFrozen() {\n if (this._isFrozen()) {\n throw new Error(\n \"transaction is immutable; it has at least one signature or has been explicitly frozen\"\n );\n }\n }\n\n /**\n * Require the transaction to have sign on demand disabled\n *\n * @internal\n */\n _requireNotSignOnDemand() {\n if (this._signOnDemand) {\n throw new Error(\n \"Please use `toBytesAsync()` if `signOnDemand` is enabled\"\n );\n }\n }\n\n /**\n * Require the transaction to be frozen\n *\n * @internal\n */\n _requireFrozen() {\n if (!this._isFrozen()) {\n throw new Error(\n \"transaction must have been frozen before calculating the hash will be stable, try calling `freeze`\"\n );\n }\n }\n\n /**\n * Require the transaction to have a single node account ID set\n *\n * @internal\n * @protected\n */\n _requireOneNodeAccountId() {\n if (this._nodeAccountIds.length != 1) {\n throw \"transaction did not have exactly one node ID set\";\n }\n }\n\n /**\n * @param {HashgraphProto.proto.Transaction} request\n * @returns {Uint8Array}\n */\n _requestToBytes(request) {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.Transaction.encode(request).finish();\n }\n\n /**\n * @param {HashgraphProto.proto.TransactionResponse} response\n * @returns {Uint8Array}\n */\n _responseToBytes(response) {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_10__.proto.TransactionResponse.encode(\n response\n ).finish();\n }\n}\n\n/**\n * This is essentially a registry/cache for a callback that creates a `ScheduleCreateTransaction`\n *\n * @type {(() => ScheduleCreateTransaction)[]}\n */\nconst SCHEDULE_CREATE_TRANSACTION = [];\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/Transaction.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/transaction/TransactionHashMap.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/TransactionHashMap.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionHashMap; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _cryptography_sha384_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../cryptography/sha384.js */ \"./node_modules/@hashgraph/sdk/src/cryptography/sha384.browser.js\");\n/* harmony import */ var _ObjectMap_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ObjectMap.js */ \"./node_modules/@hashgraph/sdk/src/ObjectMap.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HashgraphProto.proto.ITransaction\n */\n\n/**\n * @augments {ObjectMap}\n */\nclass TransactionHashMap extends _ObjectMap_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n constructor() {\n super((s) => _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(s));\n }\n\n /**\n * @param {import(\"./Transaction.js\").default} transaction\n * @returns {Promise}\n */\n static async _fromTransaction(transaction) {\n const hashes = new TransactionHashMap();\n\n for (let i = 0; i < transaction._nodeAccountIds.length; i++) {\n const nodeAccountId = transaction._nodeAccountIds.list[i];\n const tx = /** @type {HashgraphProto.proto.ITransaction} */ (\n transaction._transactions.get(i)\n );\n const hash = await _cryptography_sha384_js__WEBPACK_IMPORTED_MODULE_1__.digest(\n /** @type {Uint8Array} */ (tx.signedTransactionBytes)\n );\n\n hashes._set(nodeAccountId, hash);\n }\n\n return hashes;\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/TransactionHashMap.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + // eslint-disable-line -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionId; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _Cache_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Cache.js */ \"./node_modules/@hashgraph/sdk/src/Cache.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./TransactionReceipt.js\").default} TransactionReceipt\n * @typedef {import(\"./TransactionRecord.js\").default} TransactionRecord\n */\n\n/**\n * The client-generated ID for a transaction.\n *\n * This is used for retrieving receipts and records for a transaction, for appending to a file\n * right after creating it, for instantiating a smart contract with bytecode in a file just created,\n * and internally by the network for detecting when duplicate transactions are submitted.\n */\nclass TransactionId {\n /**\n * Don't use this method directly.\n * Use `TransactionId.[generate|withNonce|withValidStart]()` instead.\n *\n * @param {?AccountId} accountId\n * @param {?Timestamp} validStart\n * @param {?boolean} scheduled\n * @param {?Long | number} nonce\n */\n constructor(accountId, validStart, scheduled = false, nonce = null) {\n /**\n * The Account ID that paid for this transaction.\n *\n * @readonly\n */\n this.accountId = accountId;\n\n /**\n * The time from when this transaction is valid.\n *\n * When a transaction is submitted there is additionally a validDuration (defaults to 120s)\n * and together they define a time window that a transaction may be processed in.\n *\n * @readonly\n */\n this.validStart = validStart;\n\n this.scheduled = scheduled;\n\n this.nonce = null;\n if (nonce != null && nonce != 0) {\n this.setNonce(nonce);\n }\n\n Object.seal(this);\n }\n\n /**\n * @param {Long | number} nonce\n * @returns {TransactionId}\n */\n setNonce(nonce) {\n this.nonce = typeof nonce === \"number\" ? long__WEBPACK_IMPORTED_MODULE_3__.fromNumber(nonce) : nonce;\n return this;\n }\n\n /**\n * @param {AccountId} accountId\n * @param {Timestamp} validStart\n * @returns {TransactionId}\n */\n static withValidStart(accountId, validStart) {\n return new TransactionId(accountId, validStart);\n }\n\n /**\n * Generates a new transaction ID for the given account ID.\n *\n * Note that transaction IDs are made of the valid start of the transaction and the account\n * that will be charged the transaction fees for the transaction.\n *\n * @param {AccountId | string} id\n * @returns {TransactionId}\n */\n static generate(id) {\n return new TransactionId(\n typeof id === \"string\"\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(id)\n : new _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](id),\n _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].generate()\n );\n }\n\n /**\n * @param {string} wholeId\n * @returns {TransactionId}\n */\n static fromString(wholeId) {\n let account, seconds, nanos, isScheduled, nonce;\n let rest;\n // 1.1.1@5.4?scheduled/117\n\n [account, rest] = wholeId.split(\"@\");\n [seconds, rest] = rest.split(\".\");\n if (rest.includes(\"?\")) {\n [nanos, rest] = rest.split(\"?scheduled\");\n isScheduled = true;\n if (rest.includes(\"/\")) {\n nonce = rest.replace(\"/\", \"\");\n } else {\n nonce = null;\n }\n } else if (rest.includes(\"/\")) {\n [nanos, nonce] = rest.split(\"/\");\n isScheduled = false;\n } else {\n nanos = rest;\n }\n\n return new TransactionId(\n _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromString(account),\n new _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](long__WEBPACK_IMPORTED_MODULE_3__.fromValue(seconds), long__WEBPACK_IMPORTED_MODULE_3__.fromValue(nanos)),\n isScheduled,\n nonce != null ? long__WEBPACK_IMPORTED_MODULE_3__.fromString(nonce) : null\n );\n }\n\n /**\n * @param {boolean} scheduled\n * @returns {this}\n */\n setScheduled(scheduled) {\n this.scheduled = scheduled;\n return this;\n }\n\n /**\n * @returns {string}\n */\n toString() {\n if (this.accountId != null && this.validStart != null) {\n const nonce =\n this.nonce != null ? \"/\".concat(this.nonce.toString()) : \"\";\n const scheduled = this.scheduled ? \"?scheduled\" : \"\";\n return `${this.accountId.toString()}@${this.validStart.seconds.toString()}.${this.validStart.nanos.toString()}${scheduled}${nonce}`;\n } else {\n throw new Error(\"neither `accountId` nor `validStart` are set\");\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransactionID} id\n * @returns {TransactionId}\n */\n static _fromProtobuf(id) {\n if (id.accountID != null && id.transactionValidStart != null) {\n return new TransactionId(\n _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(id.accountID),\n _Timestamp_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(id.transactionValidStart),\n id.scheduled != null ? id.scheduled : undefined,\n id.nonce != null ? id.nonce : undefined\n );\n } else {\n throw new Error(\n \"Neither `nonce` or `accountID` and `transactionValidStart` are set\"\n );\n }\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ITransactionID}\n */\n _toProtobuf() {\n return {\n accountID:\n this.accountId != null ? this.accountId._toProtobuf() : null,\n transactionValidStart:\n this.validStart != null ? this.validStart._toProtobuf() : null,\n scheduled: this.scheduled,\n nonce: this.nonce != null ? this.nonce.toInt() : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TransactionId}\n */\n static fromBytes(bytes) {\n return TransactionId._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.TransactionID.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_2__.proto.TransactionID.encode(\n this._toProtobuf()\n ).finish();\n }\n\n /**\n * @returns {TransactionId}\n */\n clone() {\n return new TransactionId(\n this.accountId,\n this.validStart,\n this.scheduled,\n this.nonce\n );\n }\n\n /**\n * @param {TransactionId} other\n * @returns {number}\n */\n compare(other) {\n const comparison = /** @type {AccountId} */ (this.accountId).compare(\n /** @type {AccountId} */ (other.accountId)\n );\n\n if (comparison != 0) {\n return comparison;\n }\n\n return /** @type {Timestamp} */ (this.validStart).compare(\n /** @type {Timestamp} */ (other.validStart)\n );\n }\n\n /**\n * @param {Client} client\n * @returns {Promise}\n */\n getReceipt(client) {\n return _Cache_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].transactionReceiptQueryConstructor()\n .setTransactionId(this)\n .execute(client);\n }\n\n /**\n * @param {Client} client\n * @returns {Promise}\n */\n async getRecord(client) {\n await this.getReceipt(client);\n\n return _Cache_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].transactionRecordQueryConstructor()\n .setTransactionId(this)\n .execute(client);\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js?"); -/***/ }), +/** + * @typedef {import("../channel/Channel.js").default} Channel + * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel + * @typedef {import("../address_book/NodeAddressBook.js").default} NodeAddressBook + */ -/***/ "./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {object} Operator + * @property {string | PrivateKey} privateKey + * @property {string | AccountId} accountId + */ -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionReceipt; }\n/* harmony export */ });\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../contract/ContractId.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractId.js\");\n/* harmony import */ var _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../file/FileId.js */ \"./node_modules/@hashgraph/sdk/src/file/FileId.js\");\n/* harmony import */ var _topic_TopicId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../topic/TopicId.js */ \"./node_modules/@hashgraph/sdk/src/topic/TopicId.js\");\n/* harmony import */ var _token_TokenId_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../token/TokenId.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenId.js\");\n/* harmony import */ var _schedule_ScheduleId_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../schedule/ScheduleId.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js\");\n/* harmony import */ var _ExchangeRate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../ExchangeRate.js */ \"./node_modules/@hashgraph/sdk/src/ExchangeRate.js\");\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../transaction/TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * The consensus result for a transaction, which might not be currently known,\n * or may succeed or fail.\n */\nclass TransactionReceipt {\n /**\n * @private\n * @param {object} props\n * @param {Status} props.status\n * @param {?AccountId} props.accountId\n * @param {?FileId} props.fileId\n * @param {?ContractId} props.contractId\n * @param {?TopicId} props.topicId\n * @param {?TokenId} props.tokenId\n * @param {?ScheduleId} props.scheduleId\n * @param {?ExchangeRate} props.exchangeRate\n * @param {?Long} props.topicSequenceNumber\n * @param {?Uint8Array} props.topicRunningHash\n * @param {?Long} props.totalSupply\n * @param {?TransactionId} props.scheduledTransactionId\n * @param {Long[]} props.serials\n * @param {TransactionReceipt[]} props.duplicates\n * @param {TransactionReceipt[]} props.children\n */\n constructor(props) {\n /**\n * Whether the transaction succeeded or failed (or is unknown).\n *\n * @readonly\n */\n this.status = props.status;\n\n /**\n * The account ID, if a new account was created.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * The file ID, if a new file was created.\n *\n * @readonly\n */\n this.fileId = props.fileId;\n\n /**\n * The contract ID, if a new contract was created.\n *\n * @readonly\n */\n this.contractId = props.contractId;\n\n /**\n * The topic ID, if a new topic was created.\n *\n * @readonly\n */\n this.topicId = props.topicId;\n\n /**\n * The token ID, if a new token was created.\n *\n * @readonly\n */\n this.tokenId = props.tokenId;\n\n /**\n * The schedule ID, if a new schedule was created.\n *\n * @readonly\n */\n this.scheduleId = props.scheduleId;\n\n /**\n * The exchange rate of Hbars to cents (USD).\n *\n * @readonly\n */\n this.exchangeRate = props.exchangeRate;\n\n /**\n * Updated sequence number for a consensus service topic.\n *\n * @readonly\n */\n this.topicSequenceNumber = props.topicSequenceNumber;\n\n /**\n * Updated running hash for a consensus service topic.\n *\n * @readonly\n */\n this.topicRunningHash = props.topicRunningHash;\n\n /**\n * Updated total supply for a token\n *\n * @readonly\n */\n this.totalSupply = props.totalSupply;\n\n this.scheduledTransactionId = props.scheduledTransactionId;\n\n this.serials = props.serials;\n\n /**\n * @readonly\n */\n this.duplicates = props.duplicates;\n\n /**\n * @readonly\n */\n this.children = props.children;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ITransactionGetReceiptResponse}\n */\n _toProtobuf() {\n const duplicates = this.duplicates.map(\n (receipt) =>\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n receipt._toProtobuf().receipt\n )\n );\n const children = this.children.map(\n (receipt) =>\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n receipt._toProtobuf().receipt\n )\n );\n\n return {\n duplicateTransactionReceipts: duplicates,\n childTransactionReceipts: children,\n receipt: {\n status: this.status.valueOf(),\n\n accountID:\n this.accountId != null\n ? this.accountId._toProtobuf()\n : null,\n fileID: this.fileId != null ? this.fileId._toProtobuf() : null,\n contractID:\n this.contractId != null\n ? this.contractId._toProtobuf()\n : null,\n topicID:\n this.topicId != null ? this.topicId._toProtobuf() : null,\n tokenID:\n this.tokenId != null ? this.tokenId._toProtobuf() : null,\n scheduleID:\n this.scheduleId != null\n ? this.scheduleId._toProtobuf()\n : null,\n\n topicRunningHash:\n this.topicRunningHash == null\n ? null\n : this.topicRunningHash,\n\n topicSequenceNumber: this.topicSequenceNumber,\n\n exchangeRate: {\n nextRate: null,\n currentRate:\n this.exchangeRate != null\n ? this.exchangeRate._toProtobuf()\n : null,\n },\n\n scheduledTransactionID:\n this.scheduledTransactionId != null\n ? this.scheduledTransactionId._toProtobuf()\n : null,\n\n serialNumbers: this.serials,\n newTotalSupply: this.totalSupply,\n },\n };\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransactionGetReceiptResponse} response\n * @returns {TransactionReceipt}\n */\n static _fromProtobuf(response) {\n const receipt =\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n response.receipt\n );\n\n const exchangeRateSet =\n /** @type {HashgraphProto.proto.IExchangeRateSet} */ (\n receipt.exchangeRate\n );\n\n const children =\n response.childTransactionReceipts != null\n ? response.childTransactionReceipts.map((child) =>\n TransactionReceipt._fromProtobuf({ receipt: child })\n )\n : [];\n\n const duplicates =\n response.duplicateTransactionReceipts != null\n ? response.duplicateTransactionReceipts.map((duplicate) =>\n TransactionReceipt._fromProtobuf({ receipt: duplicate })\n )\n : [];\n\n return new TransactionReceipt({\n status: _Status_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]._fromCode(\n receipt.status != null ? receipt.status : 0\n ),\n\n accountId:\n receipt.accountID != null\n ? _account_AccountId_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf(receipt.accountID)\n : null,\n\n fileId:\n receipt.fileID != null\n ? _file_FileId_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(receipt.fileID)\n : null,\n\n contractId:\n receipt.contractID != null\n ? _contract_ContractId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(receipt.contractID)\n : null,\n\n topicId:\n receipt.topicID != null\n ? _topic_TopicId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(receipt.topicID)\n : null,\n\n tokenId:\n receipt.tokenID != null\n ? _token_TokenId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(receipt.tokenID)\n : null,\n\n scheduleId:\n receipt.scheduleID != null\n ? _schedule_ScheduleId_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobuf(receipt.scheduleID)\n : null,\n\n exchangeRate:\n receipt.exchangeRate != null\n ? _ExchangeRate_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.IExchangeRate} */\n (exchangeRateSet.currentRate)\n )\n : null,\n\n topicSequenceNumber:\n receipt.topicSequenceNumber == null\n ? null\n : long__WEBPACK_IMPORTED_MODULE_8__.fromString(receipt.topicSequenceNumber.toString()),\n\n topicRunningHash:\n receipt.topicRunningHash != null\n ? new Uint8Array(receipt.topicRunningHash)\n : null,\n\n totalSupply:\n receipt.newTotalSupply != null\n ? long__WEBPACK_IMPORTED_MODULE_8__.fromString(receipt.newTotalSupply.toString())\n : null,\n\n scheduledTransactionId:\n receipt.scheduledTransactionID != null\n ? _transaction_TransactionId_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]._fromProtobuf(\n receipt.scheduledTransactionID\n )\n : null,\n serials:\n receipt.serialNumbers != null\n ? receipt.serialNumbers.map((serial) =>\n long__WEBPACK_IMPORTED_MODULE_8__.fromValue(serial)\n )\n : [],\n children,\n duplicates,\n });\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TransactionReceipt}\n */\n static fromBytes(bytes) {\n return TransactionReceipt._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_9__.proto.TransactionGetReceiptResponse.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_9__.proto.TransactionGetReceiptResponse.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js?"); +/** + * @typedef {object} ClientOperator + * @property {PublicKey} publicKey + * @property {AccountId} accountId + * @property {(message: Uint8Array) => Promise} transactionSigner + */ -/***/ }), +/** + * @typedef {object} ClientConfiguration + * @property {{[key: string]: (string | AccountId)} | string} network + * @property {string[] | string} [mirrorNetwork] + * @property {Operator} [operator] + * @property {boolean} [scheduleNetworkUpdate] + */ -/***/ "./node_modules/@hashgraph/sdk/src/transaction/TransactionReceiptQuery.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/TransactionReceiptQuery.js ***! - \********************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/** + * @typedef {"mainnet" | "testnet" | "previewnet"} NetworkName + */ -"use strict"; -eval("var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_8___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionReceiptQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/* harmony import */ var _TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TransactionReceipt.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js\");\n/* harmony import */ var _TransactionId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../PrecheckStatusError.js */ \"./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js\");\n/* harmony import */ var _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ReceiptStatusError.js */ \"./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\nconst { proto } = /*#__PURE__*/ (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_8___namespace_cache || (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_8___namespace_cache = __webpack_require__.t(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_8__, 2)));\n\n/**\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @augments {Query}\n */\nclass TransactionReceiptQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TransactionId | string} [props.transactionId]\n * @param {boolean} [props.includeDuplicates]\n * @param {boolean} [props.includeChildren]\n * @param {boolean} [props.validateStatus]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TransactionId}\n */\n this._transactionId = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._includeChildren = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._includeDuplicates = null;\n\n this._validateStatus = true;\n\n if (props.transactionId != null) {\n this.setTransactionId(props.transactionId);\n }\n\n if (props.includeChildren != null) {\n this.setIncludeChildren(props.includeChildren);\n }\n\n if (props.includeDuplicates != null) {\n this.setIncludeDuplicates(props.includeDuplicates);\n }\n\n if (props.validateStatus != null) {\n this.setValidateStatus(props.validateStatus);\n }\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {TransactionReceiptQuery}\n */\n static _fromProtobuf(query) {\n const receipt =\n /** @type {HashgraphProto.proto.ITransactionGetReceiptQuery} */ (\n query.transactionGetReceipt\n );\n\n return new TransactionReceiptQuery({\n transactionId: receipt.transactionID\n ? _TransactionId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(receipt.transactionID)\n : undefined,\n includeDuplicates:\n receipt.includeDuplicates != null\n ? receipt.includeDuplicates\n : undefined,\n includeChildren:\n receipt.includeChildReceipts != null\n ? receipt.includeChildReceipts\n : undefined,\n });\n }\n\n /**\n * @returns {?TransactionId}\n */\n get transactionId() {\n return this._transactionId;\n }\n\n /**\n * Set the transaction ID for which the receipt is being requested.\n *\n * @param {TransactionId | string} transactionId\n * @returns {this}\n */\n setTransactionId(transactionId) {\n this._transactionId =\n typeof transactionId === \"string\"\n ? _TransactionId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(transactionId)\n : transactionId.clone();\n\n return this;\n }\n\n /**\n * @param {boolean} includeDuplicates\n * @returns {TransactionReceiptQuery}\n */\n setIncludeDuplicates(includeDuplicates) {\n this._includeDuplicates = includeDuplicates;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get includeDuplicates() {\n return this._includeDuplicates != null\n ? this._includeDuplicates\n : false;\n }\n\n /**\n * @param {boolean} includeChildren\n * @returns {TransactionReceiptQuery}\n */\n setIncludeChildren(includeChildren) {\n this._includeChildren = includeChildren;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get includeChildren() {\n return this._includeChildren != null ? this._includeChildren : false;\n }\n\n /**\n * @param {boolean} validateStatus\n * @returns {this}\n */\n setValidateStatus(validateStatus) {\n this._validateStatus = validateStatus;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get validateStatus() {\n return this._validateStatus;\n }\n\n /**\n * @override\n * @protected\n * @returns {boolean}\n */\n _isPaymentRequired() {\n return false;\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n let status = _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : proto.ResponseCodeEnum.OK\n );\n\n js_logger__WEBPACK_IMPORTED_MODULE_7__.debug(\n `[${this._getLogId()}] received node precheck status ${status.toString()}`\n );\n\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Busy:\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Unknown:\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].ReceiptNotFound:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_6__.ExecutionState.Retry];\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Ok:\n break;\n default:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_6__.ExecutionState.Error];\n }\n\n const transactionGetReceipt =\n /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ (\n response.transactionGetReceipt\n );\n const receipt =\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n transactionGetReceipt.receipt\n );\n const receiptStatusCode =\n /** @type {HashgraphProto.proto.ResponseCodeEnum} */ (\n receipt.status\n );\n\n status = _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromCode(receiptStatusCode);\n\n js_logger__WEBPACK_IMPORTED_MODULE_7__.debug(\n `[${this._getLogId()}] received receipt status ${status.toString()}`\n );\n\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Busy:\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Unknown:\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].ReceiptNotFound:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_6__.ExecutionState.Retry];\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Success:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_6__.ExecutionState.Finished];\n default:\n return [\n status,\n this._validateStatus\n ? _Executable_js__WEBPACK_IMPORTED_MODULE_6__.ExecutionState.Error\n : _Executable_js__WEBPACK_IMPORTED_MODULE_6__.ExecutionState.Finished,\n ];\n }\n }\n\n /**\n * @returns {TransactionId}\n */\n _getTransactionId() {\n if (this._transactionId != null) {\n return this._transactionId;\n }\n\n return super._getTransactionId();\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n let status = _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : proto.ResponseCodeEnum.OK\n );\n\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Ok:\n // Do nothing\n break;\n\n default:\n return new _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]({\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult: null,\n });\n }\n\n const transactionGetReceipt =\n /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ (\n response.transactionGetReceipt\n );\n const receipt =\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n transactionGetReceipt.receipt\n );\n const receiptStatusCode =\n /** @type {HashgraphProto.proto.ResponseCodeEnum} */ (\n receipt.status\n );\n\n status = _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromCode(receiptStatusCode);\n\n if (this._transactionId == null) {\n throw new Error(\n \"Failed to construct `ReceiptStatusError` because `transactionId` is `null`\"\n );\n }\n\n return new _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]({\n status,\n transactionId: this._transactionId,\n transactionReceipt: _TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n transactionGetReceipt\n ),\n });\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (\n this._transactionId != null &&\n this._transactionId.accountId != null\n ) {\n this._transactionId.accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.getTransactionReceipts(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const transactionGetReceipt =\n /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ (\n response.transactionGetReceipt\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n transactionGetReceipt.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const transactionGetReceipt =\n /** @type {HashgraphProto.proto.ITransactionGetReceiptResponse} */ (\n response.transactionGetReceipt\n );\n\n return Promise.resolve(\n _TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(transactionGetReceipt)\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n transactionGetReceipt: {\n header,\n transactionID:\n this._transactionId != null\n ? this._transactionId._toProtobuf()\n : null,\n includeDuplicates: this._includeDuplicates,\n includeChildReceipts: this._includeChildren,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n return `TransactionReceiptQuery:${this._timestamp.toString()}`;\n }\n}\n\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\n \"transactionGetReceipt\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TransactionReceiptQuery._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/TransactionReceiptQuery.js?"); +/** + * @abstract + * @template {Channel} ChannelT + * @template {MirrorChannel} MirrorChannelT + */ +class Client { + /** + * @protected + * @hideconstructor + * @param {ClientConfiguration} [props] + */ + constructor(props) { + /** + * List of mirror network URLs. + * + * @internal + * @type {MirrorNetwork} + */ + this._mirrorNetwork = new MirrorNetwork( + this._createMirrorNetworkChannel(), + ); + + /** + * Map of node account ID (as a string) + * to the node URL. + * + * @internal + * @type {Network} + */ + this._network = new Network(this._createNetworkChannel()); + + /** + * @internal + * @type {?ClientOperator} + */ + this._operator = null; + + /** + * @private + * @type {?Hbar} + */ + this._defaultMaxTransactionFee = null; + + /** + * @private + * @type {Hbar} + */ + this._defaultMaxQueryPayment = new Hbar_Hbar(1); + + if (props != null) { + if (props.operator != null) { + this.setOperator( + props.operator.accountId, + props.operator.privateKey, + ); + } + } + + /** @type {number | null} */ + this._maxAttempts = null; + + /** @private */ + this._signOnDemand = false; + + /** @private */ + this._autoValidateChecksums = false; + + /** @private */ + this._minBackoff = 250; + + /** @private */ + this._maxBackoff = 8000; + + /** @private */ + this._defaultRegenerateTransactionId = true; + + /** @private */ + this._requestTimeout = null; + + /** @private */ + this._networkUpdatePeriod = 24 * 60 * 60 * 1000; + + /** @private */ + this._isShutdown = false; + + if (props != null && props.scheduleNetworkUpdate !== false) { + this._scheduleNetworkUpdate(); + } + + /** @internal */ + /** @type {NodeJS.Timeout} */ + this._timer; + + /** + * Logger + * + * @external + * @type {Logger | null} + */ + this._logger = null; + } + + /** + * @deprecated + * @param {NetworkName} networkName + * @returns {this} + */ + setNetworkName(networkName) { + // uses custom NetworkName type + // remove if phasing out set|get NetworkName + console.warn("Deprecated: Use `setLedgerId` instead"); + return this.setLedgerId(networkName); + } + + /** + * @deprecated + * @returns {string | null} + */ + get networkName() { + console.warn("Deprecated: Use `ledgerId` instead"); + return this.ledgerId != null ? this.ledgerId.toString() : null; + } + + /** + * @param {string|LedgerId} ledgerId + * @returns {this} + */ + setLedgerId(ledgerId) { + this._network.setLedgerId( + typeof ledgerId === "string" + ? LedgerId.fromString(ledgerId) + : ledgerId, + ); + + return this; + } + + /** + * @returns {LedgerId | null} + */ + get ledgerId() { + return this._network._ledgerId != null ? this._network.ledgerId : null; + } + + /** + * @param {{[key: string]: (string | AccountId)} | string} network + * @returns {void} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setNetwork(network) { + // TODO: This logic _can_ be de-duplicated and likely should + throw new Error("not implemented"); + } + + /** + * @param {NodeAddressBook} addressBook + * @returns {this} + */ + setNetworkFromAddressBook(addressBook) { + this._network.setNetworkFromAddressBook(addressBook); + return this; + } + + /** + * @returns {{[key: string]: (string | AccountId)}} + */ + get network() { + return this._network.network; + } + + /** + * @param {string[] | string} mirrorNetwork + * @returns {void} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setMirrorNetwork(mirrorNetwork) { + throw new Error("not implemented"); + } + + /** + * @returns {string[]} + */ + get mirrorNetwork() { + return this._mirrorNetwork.network; + } + + /** + * @returns {boolean} + */ + get signOnDemand() { + return this._signOnDemand; + } + + /** + * @param {boolean} signOnDemand + */ + setSignOnDemand(signOnDemand) { + this._signOnDemand = signOnDemand; + } + + /** + * @returns {boolean} + */ + isTransportSecurity() { + return this._network.isTransportSecurity(); + } + + /** + * @param {boolean} transportSecurity + * @returns {this} + */ + setTransportSecurity(transportSecurity) { + this._network.setTransportSecurity(transportSecurity); + return this; + } + + /** + * Set the account that will, by default, pay for transactions and queries built with this client. + * NOTE: When using string for private key, the string needs to contain DER headers + * + * @param {AccountId | string} accountId + * @param {PrivateKey | string} privateKey + * @returns {this} + */ + setOperator(accountId, privateKey) { + const key = + typeof privateKey === "string" + ? src_PrivateKey_PrivateKey.fromStringDer(privateKey) + : privateKey; + + return this.setOperatorWith(accountId, key.publicKey, (message) => + Promise.resolve(key.sign(message)), + ); + } + + /** + * @returns {?ClientOperator} + */ + getOperator() { + return this._operator; + } + + /** + * Sets the account that will, by default, pay for transactions and queries built with + * this client. + * + * @param {AccountId | string} accountId + * @param {PublicKey | string} publicKey + * @param {(message: Uint8Array) => Promise} transactionSigner + * @returns {this} + */ + setOperatorWith(accountId, publicKey, transactionSigner) { + const accountId_ = + accountId instanceof AccountId_AccountId + ? accountId + : AccountId_AccountId.fromString(accountId); + + if (this._network._ledgerId != null) { + accountId_.validateChecksum(this); + } + + this._operator = { + transactionSigner, + + accountId: accountId_, + + publicKey: + publicKey instanceof src_PublicKey_PublicKey + ? publicKey + : src_PublicKey_PublicKey.fromString(publicKey), + }; + + return this; + } + + /** + * @param {boolean} value + * @returns {this} + */ + setAutoValidateChecksums(value) { + this._autoValidateChecksums = value; + return this; + } + + /** + * @returns {boolean} + */ + isAutoValidateChecksumsEnabled() { + return this._autoValidateChecksums; + } + + /** + * @returns {?AccountId} + */ + get operatorAccountId() { + return this._operator != null ? this._operator.accountId : null; + } + + /** + * @returns {?PublicKey} + */ + get operatorPublicKey() { + return this._operator != null ? this._operator.publicKey : null; + } + + /** + * @returns {?Hbar} + */ + get defaultMaxTransactionFee() { + return this._defaultMaxTransactionFee; + } + + /** + * @deprecated - Use `defaultMaxTransactionFee` instead + * @returns {?Hbar} + */ + get maxTransactionFee() { + return this.defaultMaxTransactionFee; + } + + /** + * Set the defaultimum fee to be paid for transactions + * executed by this client. + * + * @param {Hbar} defaultMaxTransactionFee + * @returns {this} + */ + setDefaultMaxTransactionFee(defaultMaxTransactionFee) { + if (defaultMaxTransactionFee.toTinybars().toInt() < 0) { + throw new Error("defaultMaxTransactionFee must be non-negative"); + } + this._defaultMaxTransactionFee = defaultMaxTransactionFee; + return this; + } + + /** + * @deprecated - Use `setDefaultMaxTransactionFee()` instead + * Set the maximum fee to be paid for transactions + * executed by this client. + * @param {Hbar} maxTransactionFee + * @returns {this} + */ + setMaxTransactionFee(maxTransactionFee) { + return this.setDefaultMaxTransactionFee(maxTransactionFee); + } + + /** + * @returns {boolean} + */ + get defaultRegenerateTransactionId() { + return this._defaultRegenerateTransactionId; + } + + /** + * Set if a new transaction ID should be generated when a `TRANSACTION_EXPIRED` status + * is returned. + * + * @param {boolean} defaultRegenerateTransactionId + * @returns {this} + */ + setDefaultRegenerateTransactionId(defaultRegenerateTransactionId) { + this._defaultRegenerateTransactionId = defaultRegenerateTransactionId; + return this; + } + + /** + * @returns {Hbar} + */ + get defaultMaxQueryPayment() { + return this._defaultMaxQueryPayment; + } + + /** + * @deprecated in a favor of defaultMaxQueryPayment + * @returns {Hbar} + */ + get maxQueryPayment() { + return this.defaultMaxQueryPayment; + } + + /** + * Set the maximum payment allowable for queries. + * + * @param {Hbar} defaultMaxQueryPayment + * @returns {Client} + */ + setDefaultMaxQueryPayment(defaultMaxQueryPayment) { + const isMaxQueryPaymentNegative = + convertToNumber(defaultMaxQueryPayment.toTinybars()) < 0; + if (isMaxQueryPaymentNegative) { + throw new Error("defaultMaxQueryPayment must be non-negative"); + } + this._defaultMaxQueryPayment = defaultMaxQueryPayment; + return this; + } + /** + * @deprecated in a favor of setDefaultMaxQueryPayment() + * Set the maximum payment allowable for queries. + * @param {Hbar} maxQueryPayment + * @returns {Client} + */ + setMaxQueryPayment(maxQueryPayment) { + return this.setDefaultMaxQueryPayment(maxQueryPayment); + } + + /** + * @returns {number} + */ + get maxAttempts() { + return this._maxAttempts != null ? this._maxAttempts : 10; + } + + /** + * @param {number} maxAttempts + * @returns {this} + */ + setMaxAttempts(maxAttempts) { + this._maxAttempts = maxAttempts; + return this; + } + + /** + * @returns {number} + */ + get maxNodeAttempts() { + return this._network.maxNodeAttempts; + } + + /** + * @param {number} maxNodeAttempts + * @returns {this} + */ + setMaxNodeAttempts(maxNodeAttempts) { + this._network.setMaxNodeAttempts(maxNodeAttempts); + return this; + } + + /** + * @returns {number} + */ + get nodeWaitTime() { + return this._network.minBackoff; + } + + /** + * @param {number} nodeWaitTime + * @returns {this} + */ + setNodeWaitTime(nodeWaitTime) { + this._network.setMinBackoff(nodeWaitTime); + return this; + } + + /** + * @returns {number} + */ + get maxNodesPerTransaction() { + return this._network.maxNodesPerTransaction; + } + + /** + * @param {number} maxNodesPerTransaction + * @returns {this} + */ + setMaxNodesPerTransaction(maxNodesPerTransaction) { + this._network.setMaxNodesPerTransaction(maxNodesPerTransaction); + return this; + } + + /** + * @param {?number} minBackoff + * @returns {this} + */ + setMinBackoff(minBackoff) { + if (minBackoff == null) { + throw new Error("minBackoff cannot be null."); + } + if (minBackoff > this._maxBackoff) { + throw new Error("minBackoff cannot be larger than maxBackoff."); + } + this._minBackoff = minBackoff; + return this; + } + + /** + * @returns {number} + */ + get minBackoff() { + return this._minBackoff; + } + + /** + * @param {?number} maxBackoff + * @returns {this} + */ + setMaxBackoff(maxBackoff) { + if (maxBackoff == null) { + throw new Error("maxBackoff cannot be null."); + } else if (maxBackoff < this._minBackoff) { + throw new Error("maxBackoff cannot be smaller than minBackoff."); + } + this._maxBackoff = maxBackoff; + return this; + } + + /** + * @returns {number} + */ + get maxBackoff() { + return this._maxBackoff; + } + + /** + * @param {number} nodeMinBackoff + * @returns {this} + */ + setNodeMinBackoff(nodeMinBackoff) { + this._network.setMinBackoff(nodeMinBackoff); + return this; + } + + /** + * @returns {number} + */ + get nodeMinBackoff() { + return this._network.minBackoff; + } + + /** + * @param {number} nodeMaxBackoff + * @returns {this} + */ + setNodeMaxBackoff(nodeMaxBackoff) { + this._network.setMaxBackoff(nodeMaxBackoff); + return this; + } + + /** + * @returns {number} + */ + get nodeMaxBackoff() { + return this._network.maxBackoff; + } + + /** + * @param {number} nodeMinReadmitPeriod + * @returns {this} + */ + setNodeMinReadmitPeriod(nodeMinReadmitPeriod) { + this._network.setNodeMinReadmitPeriod(nodeMinReadmitPeriod); + return this; + } + + /** + * @returns {number} + */ + get nodeMinReadmitPeriod() { + return this._network.nodeMinReadmitPeriod; + } + + /** + * @param {number} nodeMaxReadmitPeriod + * @returns {this} + */ + setNodeMaxReadmitPeriod(nodeMaxReadmitPeriod) { + this._network.setNodeMaxReadmitPeriod(nodeMaxReadmitPeriod); + return this; + } + + /** + * @returns {number} + */ + get nodeMaxReadmitPeriod() { + return this._network.nodeMaxReadmitPeriod; + } + + /** + * @param {number} requestTimeout - Number of milliseconds + * @returns {this} + */ + setRequestTimeout(requestTimeout) { + this._requestTimeout = requestTimeout; + return this; + } + + /** + * @returns {?number} + */ + get requestTimeout() { + return this._requestTimeout; + } + + /** + * @returns {number} + */ + get networkUpdatePeriod() { + return this._networkUpdatePeriod; + } + + /** + * @param {number} networkUpdatePeriod + * @returns {this} + */ + setNetworkUpdatePeriod(networkUpdatePeriod) { + clearTimeout(this._timer); + this._networkUpdatePeriod = networkUpdatePeriod; + this._scheduleNetworkUpdate(); + return this; + } + /** + * Set logger + * + * @param {Logger} logger + * @returns {this} + */ + setLogger(logger) { + this._logger = logger; + return this; + } + + /** + * Get logger if set + * + * @returns {?Logger} + */ + get logger() { + return this._logger; + } + + /** + * @param {AccountId | string} accountId + */ + async ping(accountId) { + await new AccountBalanceQuery_AccountBalanceQuery({ accountId }) + .setNodeAccountIds([ + accountId instanceof AccountId_AccountId + ? accountId + : AccountId_AccountId.fromString(accountId), + ]) + .execute(this); + } + + async pingAll() { + for (const nodeAccountId of Object.values(this._network.network)) { + await this.ping(nodeAccountId); + } + } + + /** + * @returns {void} + */ + close() { + this._network.close(); + this._mirrorNetwork.close(); + this._isShutdown = true; + clearTimeout(this._timer); + } + + /** + * @abstract + * @returns {(address: string) => ChannelT} + */ + _createNetworkChannel() { + throw new Error("not implemented"); + } + + /** + * @abstract + * @returns {(address: string) => MirrorChannelT} + */ + _createMirrorNetworkChannel() { + throw new Error("not implemented"); + } + + /** + * @private + */ + _scheduleNetworkUpdate() { + // This is the automatic network update promise that _eventually_ completes + // eslint-disable-next-line @typescript-eslint/no-floating-promises,@typescript-eslint/no-misused-promises + this._timer = setTimeout(async () => { + try { + const addressBook = await src_Cache.addressBookQueryConstructor() + .setFileId(FileId.ADDRESS_BOOK) + .execute(this); + this.setNetworkFromAddressBook(addressBook); + + if (!this._isShutdown) { + // Recall this method to continuously update the network + // every `networkUpdatePeriod` amount of itme + this._scheduleNetworkUpdate(); + } + } catch (error) { + if (this._logger) { + this._logger.trace( + `failed to update client address book: ${ + /** @type {Error} */ (error).toString() + }`, + ); + } + } + }, this._networkUpdatePeriod); + } + + /** + * @returns {boolean} + */ + get isClientShutDown() { + return this._isShutdown; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/http/HttpStatus.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), +class HttpStatus { + /** + * @hideconstructor + * @internal + * @param {number} code + */ + constructor(code) { + /** @readonly */ + this._code = code; + + Object.freeze(this); + } + + /** + * @internal + * @param {number} code + * @returns {HttpStatus} + */ + static _fromValue(code) { + return new HttpStatus(code); + } + + /** + * @returns {string} + */ + toString() { + return this._code.toString(); + } + + /** + * @returns {number} + */ + valueOf() { + return this._code; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/channel/Channel.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/@hashgraph/sdk/src/transaction/TransactionRecord.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/TransactionRecord.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionRecord; }\n/* harmony export */ });\n/* harmony import */ var _TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TransactionReceipt.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js\");\n/* harmony import */ var _TransactionId_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Timestamp.js */ \"./node_modules/@hashgraph/sdk/src/Timestamp.js\");\n/* harmony import */ var _Hbar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Hbar.js */ \"./node_modules/@hashgraph/sdk/src/Hbar.js\");\n/* harmony import */ var _Transfer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Transfer.js */ \"./node_modules/@hashgraph/sdk/src/Transfer.js\");\n/* harmony import */ var _contract_ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../contract/ContractFunctionResult.js */ \"./node_modules/@hashgraph/sdk/src/contract/ContractFunctionResult.js\");\n/* harmony import */ var _account_TokenTransferMap_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../account/TokenTransferMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenTransferMap.js\");\n/* harmony import */ var _account_TokenNftTransferMap_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../account/TokenNftTransferMap.js */ \"./node_modules/@hashgraph/sdk/src/account/TokenNftTransferMap.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/* harmony import */ var _schedule_ScheduleId_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../schedule/ScheduleId.js */ \"./node_modules/@hashgraph/sdk/src/schedule/ScheduleId.js\");\n/* harmony import */ var _token_AssessedCustomFee_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../token/AssessedCustomFee.js */ \"./node_modules/@hashgraph/sdk/src/token/AssessedCustomFee.js\");\n/* harmony import */ var _token_TokenAssociation_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../token/TokenAssociation.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenAssociation.js\");\n/* harmony import */ var _Key_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Key.js */ \"./node_modules/@hashgraph/sdk/src/Key.js\");\n/* harmony import */ var _PublicKey_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../PublicKey.js */ \"./node_modules/@hashgraph/sdk/src/PublicKey.js\");\n/* harmony import */ var _token_TokenTransfer_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../token/TokenTransfer.js */ \"./node_modules/@hashgraph/sdk/src/token/TokenTransfer.js\");\n/* harmony import */ var _EvmAddress_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../EvmAddress.js */ \"./node_modules/@hashgraph/sdk/src/EvmAddress.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../token/TokenId.js\").default} TokenId\n * @typedef {import(\"../account/HbarAllowance.js\").default} HbarAllowance\n * @typedef {import(\"../account/TokenAllowance.js\").default} TokenAllowance\n * @typedef {import(\"../account/TokenNftAllowance.js\").default} TokenNftAllowance\n */\n\n/**\n * Either the record of processing the first consensus transaction with the given id whose\n * status was neither INVALID_NODE_ACCOUNT nor INVALID_PAYER_SIGNATURE;\n * or, if no such record exists, the record of processing the first transaction to reach\n * consensus with the given transaction id.\n */\nclass TransactionRecord {\n /**\n * @private\n * @param {object} props\n * @param {ContractFunctionResult} [props.contractFunctionResult]\n * @param {TransactionReceipt} props.receipt\n * @param {Uint8Array} props.transactionHash\n * @param {Timestamp} props.consensusTimestamp\n * @param {TransactionId} props.transactionId\n * @param {string} props.transactionMemo\n * @param {Hbar} props.transactionFee\n * @param {Transfer[]} props.transfers\n * @param {TokenTransferMap} props.tokenTransfers\n * @param {TokenTransfer[]} props.tokenTransfersList\n * @param {?ScheduleId} props.scheduleRef\n * @param {AssessedCustomFee[]} props.assessedCustomFees\n * @param {TokenNftTransferMap} props.nftTransfers\n * @param {TokenAssocation[]} props.automaticTokenAssociations\n * @param {Timestamp | null} props.parentConsensusTimestamp\n * @param {PublicKey | null} props.aliasKey\n * @param {TransactionRecord[]} props.duplicates\n * @param {TransactionRecord[]} props.children\n * @param {HbarAllowance[]} props.hbarAllowanceAdjustments\n * @param {TokenAllowance[]} props.tokenAllowanceAdjustments\n * @param {TokenNftAllowance[]} props.nftAllowanceAdjustments\n * @param {?Uint8Array} props.ethereumHash\n * @param {Transfer[]} props.paidStakingRewards\n * @param {?Uint8Array} props.prngBytes\n * @param {?number} props.prngNumber\n * @param {?EvmAddress} props.evmAddress\n */\n constructor(props) {\n /**\n * The status (reach consensus, or failed, or is unknown) and the ID of\n * any new account/file/instance created.\n *\n * @readonly\n */\n this.receipt = props.receipt;\n\n /**\n * The hash of the Transaction that executed (not the hash of any Transaction that failed\n * for having a duplicate TransactionID).\n *\n * @readonly\n */\n this.transactionHash = props.transactionHash;\n\n /**\n * The consensus timestamp (or null if didn't reach consensus yet).\n *\n * @readonly\n */\n this.consensusTimestamp = props.consensusTimestamp;\n\n /**\n * The ID of the transaction this record represents.\n *\n * @readonly\n */\n this.transactionId = props.transactionId;\n\n /**\n * The memo that was submitted as part of the transaction (max 100 bytes).\n *\n * @readonly\n */\n this.transactionMemo = props.transactionMemo;\n\n /**\n * The actual transaction fee charged,\n * not the original transactionFee value from TransactionBody.\n *\n * @readonly\n */\n this.transactionFee = props.transactionFee;\n\n /**\n * All hbar transfers as a result of this transaction, such as fees, or transfers performed\n * by the transaction, or by a smart contract it calls, or by the creation of threshold\n * records that it triggers.\n *\n * @readonly\n */\n this.transfers = props.transfers;\n\n /**\n * Record of the value returned by the smart contract function or constructor.\n *\n * @readonly\n */\n this.contractFunctionResult =\n props.contractFunctionResult != null\n ? props.contractFunctionResult\n : null;\n\n /**\n * All the token transfers from this account\n *\n * @readonly\n */\n this.tokenTransfers = props.tokenTransfers;\n\n /**\n * All the token transfers from this account\n *\n * @readonly\n */\n this.tokenTransfersList = props.tokenTransfersList;\n\n /**\n * Reference to the scheduled transaction ID that this transaction record represent\n *\n * @readonly\n */\n this.scheduleRef = props.scheduleRef;\n\n /**\n * All custom fees that were assessed during a CryptoTransfer, and must be paid if the\n * transaction status resolved to SUCCESS\n *\n * @readonly\n */\n this.assessedCustomFees = props.assessedCustomFees;\n\n /** @readonly */\n this.nftTransfers = props.nftTransfers;\n\n /**\n * All token associations implicitly created while handling this transaction\n *\n * @readonly\n */\n this.automaticTokenAssociations = props.automaticTokenAssociations;\n\n /**\n * In the record of an internal transaction, the consensus timestamp of the user\n * transaction that spawned it.\n *\n * @readonly\n */\n this.parentConsensusTimestamp = props.parentConsensusTimestamp;\n\n /**\n * In the record of an internal CryptoCreate transaction triggered by a user\n * transaction with a (previously unused) alias, the new account's alias.\n *\n * @readonly\n */\n this.aliasKey = props.aliasKey;\n\n /**\n * The records of processing all consensus transaction with the same id as the distinguished\n * record above, in chronological order.\n *\n * @readonly\n */\n this.duplicates = props.duplicates;\n\n /**\n * The records of processing all child transaction spawned by the transaction with the given\n * top-level id, in consensus order. Always empty if the top-level status is UNKNOWN.\n *\n * @readonly\n */\n this.children = props.children;\n\n /**\n * @deprecated\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.hbarAllowanceAdjustments = props.hbarAllowanceAdjustments;\n\n /**\n * @deprecated\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.tokenAllowanceAdjustments = props.tokenAllowanceAdjustments;\n\n /**\n * @deprecated\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.nftAllowanceAdjustments = props.nftAllowanceAdjustments;\n\n /**\n * The keccak256 hash of the ethereumData. This field will only be populated for\n * EthereumTransaction.\n *\n * @readonly\n */\n this.ethereumHash = props.ethereumHash;\n\n /**\n * List of accounts with the corresponding staking rewards paid as a result of a transaction.\n *\n * @readonly\n */\n this.paidStakingRewards = props.paidStakingRewards;\n\n /**\n * In the record of a PRNG transaction with no output range, a pseudorandom 384-bit string.\n *\n * @readonly\n */\n this.prngBytes = props.prngBytes;\n\n /**\n * In the record of a PRNG transaction with an output range, the output of a PRNG whose input was a 384-bit string.\n *\n * @readonly\n */\n this.prngNumber = props.prngNumber;\n\n /**\n * The new default EVM address of the account created by this transaction.\n * This field is populated only when the EVM address is not specified in the related transaction body.\n *\n * @readonly\n */\n this.evmAddress = props.evmAddress;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @returns {HashgraphProto.proto.ITransactionGetRecordResponse}\n */\n _toProtobuf() {\n const tokenTransfers = this.tokenTransfers._toProtobuf();\n const nftTransfers = this.nftTransfers._toProtobuf();\n\n const tokenTransferLists = [];\n\n for (const tokenTransfer of tokenTransfers) {\n for (const nftTransfer of nftTransfers) {\n if (\n tokenTransfer.token != null &&\n nftTransfer.token != null &&\n tokenTransfer.token.shardNum ===\n nftTransfer.token.shardNum &&\n tokenTransfer.token.realmNum ===\n nftTransfer.token.realmNum &&\n tokenTransfer.token.tokenNum === nftTransfer.token.tokenNum\n ) {\n tokenTransferLists.push({\n token: tokenTransfer.token,\n transfers: tokenTransfer.transfers,\n nftTransfers: tokenTransfer.nftTransfers,\n });\n } else {\n tokenTransferLists.push(tokenTransfer);\n tokenTransferLists.push(nftTransfer);\n }\n }\n }\n\n const duplicates = this.duplicates.map(\n (record) =>\n /** @type {HashgraphProto.proto.ITransactionRecord} */ (\n record._toProtobuf().transactionRecord\n )\n );\n const children = this.children.map(\n (record) =>\n /** @type {HashgraphProto.proto.ITransactionRecord} */ (\n record._toProtobuf().transactionRecord\n )\n );\n\n return {\n duplicateTransactionRecords: duplicates,\n childTransactionRecords: children,\n transactionRecord: {\n receipt: this.receipt._toProtobuf().receipt,\n\n transactionHash:\n this.transactionHash != null ? this.transactionHash : null,\n consensusTimestamp:\n this.consensusTimestamp != null\n ? this.consensusTimestamp._toProtobuf()\n : null,\n transactionID:\n this.transactionId != null\n ? this.transactionId._toProtobuf()\n : null,\n memo:\n this.transactionMemo != null ? this.transactionMemo : null,\n\n transactionFee:\n this.transactionFee != null\n ? this.transactionFee.toTinybars()\n : null,\n\n contractCallResult:\n this.contractFunctionResult != null &&\n !this.contractFunctionResult._createResult\n ? this.contractFunctionResult._toProtobuf()\n : null,\n\n contractCreateResult:\n this.contractFunctionResult != null &&\n this.contractFunctionResult._createResult\n ? this.contractFunctionResult._toProtobuf()\n : null,\n\n transferList:\n this.transfers != null\n ? {\n accountAmounts: this.transfers.map((transfer) =>\n transfer._toProtobuf()\n ),\n }\n : null,\n tokenTransferLists,\n scheduleRef:\n this.scheduleRef != null\n ? this.scheduleRef._toProtobuf()\n : null,\n assessedCustomFees: this.assessedCustomFees.map((fee) =>\n fee._toProtobuf()\n ),\n automaticTokenAssociations: this.automaticTokenAssociations.map(\n (association) => association._toProtobuf()\n ),\n parentConsensusTimestamp:\n this.parentConsensusTimestamp != null\n ? this.parentConsensusTimestamp._toProtobuf()\n : null,\n alias:\n this.aliasKey != null\n ? _hashgraph_proto__WEBPACK_IMPORTED_MODULE_8__.proto.Key.encode(\n this.aliasKey._toProtobufKey()\n ).finish()\n : null,\n ethereumHash: this.ethereumHash,\n\n paidStakingRewards: this.paidStakingRewards.map((transfer) =>\n transfer._toProtobuf()\n ),\n\n prngBytes: this.prngBytes,\n prngNumber: this.prngNumber != null ? this.prngNumber : null,\n evmAddress:\n this.evmAddress != null ? this.evmAddress.toBytes() : null,\n },\n };\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.ITransactionGetRecordResponse} response\n * @returns {TransactionRecord}\n */\n static _fromProtobuf(response) {\n const record = /** @type {HashgraphProto.proto.ITransactionRecord} */ (\n response.transactionRecord\n );\n\n let aliasKey =\n record.alias != null && record.alias.length > 0\n ? _Key_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"]._fromProtobufKey(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_8__.proto.Key.decode(record.alias)\n )\n : null;\n\n if (!(aliasKey instanceof _PublicKey_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"])) {\n aliasKey = null;\n }\n\n const children =\n response.childTransactionRecords != null\n ? response.childTransactionRecords.map((child) =>\n TransactionRecord._fromProtobuf({\n transactionRecord: child,\n })\n )\n : [];\n\n const duplicates =\n response.duplicateTransactionRecords != null\n ? response.duplicateTransactionRecords.map((duplicate) =>\n TransactionRecord._fromProtobuf({\n transactionRecord: duplicate,\n })\n )\n : [];\n\n const contractFunctionResult =\n record.contractCallResult != null\n ? _contract_ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobuf(\n record.contractCallResult,\n false\n )\n : record.contractCreateResult != null\n ? _contract_ContractFunctionResult_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]._fromProtobuf(\n record.contractCreateResult,\n true\n )\n : undefined;\n\n return new TransactionRecord({\n receipt: _TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]._fromProtobuf({\n receipt:\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n record.receipt\n ),\n }),\n transactionHash:\n record.transactionHash != null\n ? record.transactionHash\n : new Uint8Array(),\n consensusTimestamp: _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITimestamp} */\n (record.consensusTimestamp)\n ),\n transactionId: _TransactionId_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(\n /** @type {HashgraphProto.proto.ITransactionID} */ (\n record.transactionID\n )\n ),\n transactionMemo: record.memo != null ? record.memo : \"\",\n transactionFee: _Hbar_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromTinybars(\n record.transactionFee != null ? record.transactionFee : 0\n ),\n transfers: _Transfer_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(\n record.transferList != null\n ? record.transferList.accountAmounts != null\n ? record.transferList.accountAmounts\n : []\n : []\n ),\n contractFunctionResult,\n tokenTransfers: _account_TokenTransferMap_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]._fromProtobuf(\n record.tokenTransferLists != null\n ? record.tokenTransferLists\n : []\n ),\n tokenTransfersList: _token_TokenTransfer_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]._fromProtobuf(\n record.tokenTransferLists != null\n ? record.tokenTransferLists\n : []\n ),\n scheduleRef:\n record.scheduleRef != null\n ? _schedule_ScheduleId_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]._fromProtobuf(record.scheduleRef)\n : null,\n assessedCustomFees:\n record.assessedCustomFees != null\n ? record.assessedCustomFees.map((fee) =>\n _token_AssessedCustomFee_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]._fromProtobuf(fee)\n )\n : [],\n nftTransfers: _account_TokenNftTransferMap_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]._fromProtobuf(\n record.tokenTransferLists != null\n ? record.tokenTransferLists\n : []\n ),\n automaticTokenAssociations:\n record.automaticTokenAssociations != null\n ? record.automaticTokenAssociations.map((association) =>\n _token_TokenAssociation_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]._fromProtobuf(association)\n )\n : [],\n parentConsensusTimestamp:\n record.parentConsensusTimestamp != null\n ? _Timestamp_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf(record.parentConsensusTimestamp)\n : null,\n aliasKey,\n duplicates,\n children,\n hbarAllowanceAdjustments: [],\n tokenAllowanceAdjustments: [],\n nftAllowanceAdjustments: [],\n ethereumHash:\n record.ethereumHash != null ? record.ethereumHash : null,\n paidStakingRewards:\n record.paidStakingRewards != null\n ? _Transfer_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromProtobuf(record.paidStakingRewards)\n : [],\n prngBytes: record.prngBytes != null ? record.prngBytes : null,\n prngNumber: record.prngNumber != null ? record.prngNumber : null,\n evmAddress:\n record.evmAddress != null\n ? _EvmAddress_js__WEBPACK_IMPORTED_MODULE_15__[\"default\"].fromBytes(record.evmAddress)\n : null,\n });\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TransactionRecord}\n */\n static fromBytes(bytes) {\n return TransactionRecord._fromProtobuf(\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_8__.proto.TransactionGetRecordResponse.decode(bytes)\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return _hashgraph_proto__WEBPACK_IMPORTED_MODULE_8__.proto.TransactionGetRecordResponse.encode(\n this._toProtobuf()\n ).finish();\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/TransactionRecord.js?"); -/***/ }), -/***/ "./node_modules/@hashgraph/sdk/src/transaction/TransactionRecordQuery.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/TransactionRecordQuery.js ***! - \*******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +const { proto: Channel_proto } = lib_namespaceObject; -"use strict"; -eval("var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_9___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionRecordQuery; }\n/* harmony export */ });\n/* harmony import */ var _query_Query_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../query/Query.js */ \"./node_modules/@hashgraph/sdk/src/query/Query.js\");\n/* harmony import */ var _TransactionRecord_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransactionRecord.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionRecord.js\");\n/* harmony import */ var _TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TransactionReceipt.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionReceipt.js\");\n/* harmony import */ var _TransactionId_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/* harmony import */ var _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../PrecheckStatusError.js */ \"./node_modules/@hashgraph/sdk/src/PrecheckStatusError.js\");\n/* harmony import */ var _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../ReceiptStatusError.js */ \"./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js\");\n/* harmony import */ var _Executable_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Executable.js */ \"./node_modules/@hashgraph/sdk/src/Executable.js\");\n/* harmony import */ var js_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! js-logger */ \"./node_modules/js-logger/src/logger.js\");\n/* harmony import */ var _hashgraph_proto__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @hashgraph/proto */ \"./node_modules/@hashgraph/sdk/node_modules/@hashgraph/proto/lib/index.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n\n\n\nconst { proto } = /*#__PURE__*/ (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_9___namespace_cache || (_hashgraph_proto__WEBPACK_IMPORTED_MODULE_9___namespace_cache = __webpack_require__.t(_hashgraph_proto__WEBPACK_IMPORTED_MODULE_9__, 2)));\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * @augments {Query}\n */\nclass TransactionRecordQuery extends _query_Query_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n /**\n * @param {object} [props]\n * @param {TransactionId} [props.transactionId]\n * @param {boolean} [props.includeChildren]\n * @param {boolean} [props.includeDuplicates]\n * @param {boolean} [props.validateReceiptStatus]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TransactionId}\n */\n this._transactionId = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._includeChildren = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._includeDuplicates = null;\n\n this._validateReceiptStatus = true;\n\n if (props.transactionId != null) {\n this.setTransactionId(props.transactionId);\n }\n\n if (props.includeChildren != null) {\n this.setIncludeChildren(props.includeChildren);\n }\n\n if (props.includeDuplicates != null) {\n this.setIncludeDuplicates(props.includeDuplicates);\n }\n\n if (props.validateReceiptStatus != null) {\n this.setValidateReceiptStatus(props.validateReceiptStatus);\n }\n }\n\n /**\n * @returns {?TransactionId}\n */\n get transactionId() {\n return this._transactionId;\n }\n\n /**\n * @internal\n * @param {HashgraphProto.proto.IQuery} query\n * @returns {TransactionRecordQuery}\n */\n static _fromProtobuf(query) {\n const record =\n /** @type {HashgraphProto.proto.ITransactionGetRecordQuery} */ (\n query.transactionGetRecord\n );\n\n return new TransactionRecordQuery({\n transactionId: record.transactionID\n ? _TransactionId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]._fromProtobuf(record.transactionID)\n : undefined,\n includeChildren:\n record.includeChildRecords != null\n ? record.includeChildRecords\n : undefined,\n includeDuplicates:\n record.includeDuplicates != null\n ? record.includeDuplicates\n : undefined,\n });\n }\n\n /**\n * Set the transaction ID for which the record is being requested.\n *\n * @param {TransactionId | string} transactionId\n * @returns {TransactionRecordQuery}\n */\n setTransactionId(transactionId) {\n this._transactionId =\n typeof transactionId === \"string\"\n ? _TransactionId_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].fromString(transactionId)\n : transactionId.clone();\n\n return this;\n }\n\n /**\n * @param {boolean} includeChildren\n * @returns {TransactionRecordQuery}\n */\n setIncludeChildren(includeChildren) {\n this._includeChildren = includeChildren;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get includeChildren() {\n return this._includeChildren != null ? this._includeChildren : false;\n }\n\n /**\n * @param {boolean} includeDuplicates\n * @returns {TransactionRecordQuery}\n */\n setIncludeDuplicates(includeDuplicates) {\n this._duplicates = includeDuplicates;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get includeDuplicates() {\n return this._duplicates != null ? this._duplicates : false;\n }\n\n /**\n * @param {boolean} validateReceiptStatus\n * @returns {this}\n */\n setValidateReceiptStatus(validateReceiptStatus) {\n this._validateReceiptStatus = validateReceiptStatus;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get validateReceiptStatus() {\n return this._validateReceiptStatus;\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {[Status, ExecutionState]}\n */\n _shouldRetry(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n let status = _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : proto.ResponseCodeEnum.OK\n );\n\n js_logger__WEBPACK_IMPORTED_MODULE_8__.debug(\n `[${this._getLogId()}] received node precheck status ${status.toString()}`\n );\n\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Busy:\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Unknown:\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].ReceiptNotFound:\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].RecordNotFound:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_7__.ExecutionState.Retry];\n\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Ok:\n break;\n\n default:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_7__.ExecutionState.Error];\n }\n\n const transactionGetRecord =\n /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ (\n response.transactionGetRecord\n );\n const header = /** @type {HashgraphProto.proto.IResponseHeader} */ (\n transactionGetRecord.header\n );\n\n if (\n header.responseType ===\n _hashgraph_proto__WEBPACK_IMPORTED_MODULE_9__.proto.ResponseType.COST_ANSWER\n ) {\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_7__.ExecutionState.Finished];\n }\n\n const record = /** @type {HashgraphProto.proto.ITransactionRecord} */ (\n transactionGetRecord.transactionRecord\n );\n const receipt =\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n record.receipt\n );\n const receiptStatusCode =\n /** @type {HashgraphProto.proto.ResponseCodeEnum} */ (\n receipt.status\n );\n status = _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromCode(receiptStatusCode);\n\n js_logger__WEBPACK_IMPORTED_MODULE_8__.debug(\n `[${this._getLogId()}] received record's receipt ${status.toString()}`\n );\n\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Ok:\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Busy:\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Unknown:\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].ReceiptNotFound:\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].RecordNotFound:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_7__.ExecutionState.Retry];\n\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Success:\n return [status, _Executable_js__WEBPACK_IMPORTED_MODULE_7__.ExecutionState.Finished];\n\n default:\n return [\n status,\n this._validateReceiptStatus\n ? _Executable_js__WEBPACK_IMPORTED_MODULE_7__.ExecutionState.Error\n : _Executable_js__WEBPACK_IMPORTED_MODULE_7__.ExecutionState.Finished,\n ];\n }\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQuery} request\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n let status = _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : proto.ResponseCodeEnum.OK\n );\n\n switch (status) {\n case _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Ok:\n // Do nothing\n break;\n\n default:\n return new _PrecheckStatusError_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]({\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult: null,\n });\n }\n\n const transactionGetRecord =\n /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ (\n response.transactionGetRecord\n );\n const record = /** @type {HashgraphProto.proto.ITransactionRecord} */ (\n transactionGetRecord.transactionRecord\n );\n const receipt =\n /** @type {HashgraphProto.proto.ITransactionReceipt} */ (\n record.receipt\n );\n const receiptStatusError =\n /** @type {HashgraphProto.proto.ResponseCodeEnum} */ (\n receipt.status\n );\n\n status = _Status_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]._fromCode(receiptStatusError);\n\n return new _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]({\n status,\n transactionId: this._getTransactionId(),\n transactionReceipt: _TransactionReceipt_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]._fromProtobuf({ receipt }),\n });\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (\n this._transactionId != null &&\n this._transactionId.accountId != null\n ) {\n this._transactionId.accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n _execute(channel, request) {\n return channel.crypto.getTxRecordByTxID(request);\n }\n\n /**\n * @override\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @returns {HashgraphProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const transactionGetRecord =\n /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ (\n response.transactionGetRecord\n );\n return /** @type {HashgraphProto.proto.IResponseHeader} */ (\n transactionGetRecord.header\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HashgraphProto.proto.IQuery} request\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const record =\n /** @type {HashgraphProto.proto.ITransactionGetRecordResponse} */ (\n response.transactionGetRecord\n );\n\n return Promise.resolve(_TransactionRecord_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]._fromProtobuf(record));\n }\n\n /**\n * @override\n * @internal\n * @param {HashgraphProto.proto.IQueryHeader} header\n * @returns {HashgraphProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n transactionGetRecord: {\n header,\n transactionID:\n this._transactionId != null\n ? this._transactionId._toProtobuf()\n : null,\n includeChildRecords: this._includeChildren,\n includeDuplicates: this._includeDuplicates,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `TransactionRecordQuery:${timestamp.toString()}`;\n }\n}\n\n_query_Query_js__WEBPACK_IMPORTED_MODULE_0__.QUERY_REGISTRY.set(\n \"transactionGetRecord\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TransactionRecordQuery._fromProtobuf\n);\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/TransactionRecordQuery.js?"); +/** + * @internal + * @abstract + */ +class Channel { + /** + * @protected + */ + constructor() { + /** + * @protected + * @type {?HashgraphProto.proto.CryptoService} + */ + this._crypto = null; + + /** + * @protected + * @type {?HashgraphProto.proto.SmartContractService} + */ + this._smartContract = null; + + /** + * @protected + * @type {?HashgraphProto.proto.FileService} + */ + this._file = null; + + /** + * @protected + * @type {?HashgraphProto.proto.ConsensusService} + */ + this._consensus = null; + + /** + * @protected + * @type {?HashgraphProto.proto.FreezeService} + */ + this._freeze = null; + + /** + * @protected + * @type {?HashgraphProto.proto.NetworkService} + */ + this._network = null; + + /** + * @protected + * @type {?HashgraphProto.proto.TokenService} + */ + this._token = null; + + /** + * @protected + * @type {?HashgraphProto.proto.ScheduleService} + */ + this._schedule = null; + + /** + * @protected + * @type {?HashgraphProto.proto.UtilService} + */ + this._util = null; + + /** + * @protected + * @type {?HashgraphProto.proto.AddressBookService} + */ + this._addressBook = null; + } + + /** + * @abstract + * @returns {void} + */ + close() { + throw new Error("not implemented"); + } + + /** + * @returns {HashgraphProto.proto.CryptoService} + */ + get crypto() { + if (this._crypto != null) { + return this._crypto; + } + + this._crypto = Channel_proto.CryptoService.create( + this._createUnaryClient("CryptoService"), + ); + + return this._crypto; + } + + /** + * @returns {HashgraphProto.proto.SmartContractService} + */ + get smartContract() { + if (this._smartContract != null) { + return this._smartContract; + } + + this._smartContract = Channel_proto.SmartContractService.create( + this._createUnaryClient("SmartContractService"), + ); + + return this._smartContract; + } + + /** + * @returns {HashgraphProto.proto.FileService} + */ + get file() { + if (this._file != null) { + return this._file; + } + + this._file = Channel_proto.FileService.create( + this._createUnaryClient("FileService"), + ); + + return this._file; + } + + /** + * @returns {HashgraphProto.proto.ConsensusService} + */ + get consensus() { + if (this._consensus != null) { + return this._consensus; + } + + this._consensus = Channel_proto.ConsensusService.create( + this._createUnaryClient("ConsensusService"), + ); + + return this._consensus; + } + + /** + * @returns {HashgraphProto.proto.FreezeService} + */ + get freeze() { + if (this._freeze != null) { + return this._freeze; + } + + this._freeze = Channel_proto.FreezeService.create( + this._createUnaryClient("FreezeService"), + ); + + return this._freeze; + } + + /** + * @returns {HashgraphProto.proto.NetworkService} + */ + get network() { + if (this._network != null) { + return this._network; + } + + this._network = Channel_proto.NetworkService.create( + this._createUnaryClient("NetworkService"), + ); + + return this._network; + } + + /** + * @returns {HashgraphProto.proto.TokenService} + */ + get token() { + if (this._token != null) { + return this._token; + } + + this._token = Channel_proto.TokenService.create( + this._createUnaryClient("TokenService"), + ); + + return this._token; + } + + /** + * @returns {HashgraphProto.proto.ScheduleService} + */ + get schedule() { + if (this._schedule != null) { + return this._schedule; + } + + this._schedule = Channel_proto.ScheduleService.create( + this._createUnaryClient("ScheduleService"), + ); + + return this._schedule; + } + + /** + * @returns {HashgraphProto.proto.UtilService} + */ + get util() { + if (this._util != null) { + return this._util; + } + + this._util = Channel_proto.UtilService.create( + this._createUnaryClient("UtilService"), + ); + + return this._util; + } + + /** + * @returns {HashgraphProto.proto.AddressBookService} + */ + get addressBook() { + if (this._addressBook != null) { + return this._addressBook; + } + + this._addressBook = Channel_proto.AddressBookService.create( + this._createUnaryClient("AddressBookService"), + ); + + return this._addressBook; + } + + /** + * @abstract + * @protected + * @param {string} serviceName + * @returns {import("protobufjs").RPCImpl} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _createUnaryClient(serviceName) { + throw new Error("not implemented"); + } +} + +// grpc-web+proto is a series of data or trailer frames + +// a frame is identified by a single byte (0 = data or 1 = trailer) followed by 4 bytes for the +// length of the frame, followed by the frame data + +/** + * @param {Uint8Array} data + * @returns {ArrayBuffer} + */ +function encodeRequest(data) { + // for our requests, we want to transfer a single data frame -/***/ }), + const frame = new ArrayBuffer(data.byteLength + 5); -/***/ "./node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + // the frame type (data) is zero and can be left default-initialized -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ TransactionResponse; }\n/* harmony export */ });\n/* harmony import */ var _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ReceiptStatusError.js */ \"./node_modules/@hashgraph/sdk/src/ReceiptStatusError.js\");\n/* harmony import */ var _Status_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Status.js */ \"./node_modules/@hashgraph/sdk/src/Status.js\");\n/* harmony import */ var _TransactionReceiptQuery_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TransactionReceiptQuery.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionReceiptQuery.js\");\n/* harmony import */ var _TransactionRecordQuery_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TransactionRecordQuery.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionRecordQuery.js\");\n/* harmony import */ var _account_AccountId_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../account/AccountId.js */ \"./node_modules/@hashgraph/sdk/src/account/AccountId.js\");\n/* harmony import */ var _TransactionId_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TransactionId.js */ \"./node_modules/@hashgraph/sdk/src/transaction/TransactionId.js\");\n/* harmony import */ var _encoding_hex_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../encoding/hex.js */ \"./node_modules/@hashgraph/sdk/src/encoding/hex.browser.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n\n\n\n\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./TransactionReceipt.js\").default} TransactionReceipt\n * @typedef {import(\"./TransactionRecord.js\").default} TransactionRecord\n * @typedef {import(\"../Signer.js\").Signer} Signer\n */\n\n/**\n * @typedef {object} TransactionResponseJSON\n * @property {string} nodeId\n * @property {string} transactionHash\n * @property {string} transactionId\n */\n\nclass TransactionResponse {\n /**\n * @internal\n * @param {object} props\n * @param {AccountId} props.nodeId\n * @param {Uint8Array} props.transactionHash\n * @param {TransactionId} props.transactionId\n */\n constructor(props) {\n /** @readonly */\n this.nodeId = props.nodeId;\n\n /** @readonly */\n this.transactionHash = props.transactionHash;\n\n /** @readonly */\n this.transactionId = props.transactionId;\n\n Object.freeze(this);\n }\n\n /**\n * @param {TransactionResponseJSON} json\n * @returns {TransactionResponse}\n */\n static fromJSON(json) {\n return new TransactionResponse({\n nodeId: _account_AccountId_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].fromString(json.nodeId),\n transactionHash: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_6__.decode(json.transactionHash),\n transactionId: _TransactionId_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].fromString(json.transactionId),\n });\n }\n\n /**\n * @param {Client} client\n * @returns {Promise}\n */\n async getReceipt(client) {\n const receipt = await this.getReceiptQuery().execute(client);\n\n if (receipt.status !== _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Success) {\n throw new _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n transactionReceipt: receipt,\n status: receipt.status,\n transactionId: this.transactionId,\n });\n }\n\n return receipt;\n }\n\n /**\n * @param {Client} client\n * @returns {Promise}\n */\n async getRecord(client) {\n await this.getReceipt(client);\n\n return this.getRecordQuery().execute(client);\n }\n\n /**\n * @param {Signer} signer\n * @returns {Promise}\n */\n async getReceiptWithSigner(signer) {\n const receipt = await this.getReceiptQuery().executeWithSigner(signer);\n\n if (receipt.status !== _Status_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Success) {\n throw new _ReceiptStatusError_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n transactionReceipt: receipt,\n status: receipt.status,\n transactionId: this.transactionId,\n });\n }\n\n return receipt;\n }\n\n /**\n * @param {Signer} signer\n * @returns {Promise}\n */\n async getRecordWithSigner(signer) {\n await this.getReceiptWithSigner(signer);\n\n return this.getRecordQuery().executeWithSigner(signer);\n }\n\n /**\n * @returns {TransactionReceiptQuery}\n */\n getReceiptQuery() {\n return new _TransactionReceiptQuery_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]()\n .setTransactionId(this.transactionId)\n .setNodeAccountIds([this.nodeId]);\n }\n\n /**\n * @returns {TransactionRecordQuery}\n */\n getRecordQuery() {\n return new _TransactionRecordQuery_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]()\n .setTransactionId(this.transactionId)\n .setNodeAccountIds([this.nodeId]);\n }\n\n /**\n * @returns {TransactionResponseJSON}\n */\n toJSON() {\n return {\n nodeId: this.nodeId.toString(),\n transactionHash: _encoding_hex_js__WEBPACK_IMPORTED_MODULE_6__.encode(this.transactionHash),\n transactionId: this.transactionId.toString(),\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js?"); + // the length of the frame data + new DataView(frame, 1, 4).setUint32(0, data.length); -/***/ }), + // copy in the frame data + new Uint8Array(frame, 5).set(data); -/***/ "./node_modules/@hashgraph/sdk/src/util.js": -/*!*************************************************!*\ - !*** ./node_modules/@hashgraph/sdk/src/util.js ***! - \*************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + return frame; +} -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FUNCTION_CONVERT_TO_BIGNUMBER_ERROR\": function() { return /* binding */ FUNCTION_CONVERT_TO_BIGNUMBER_ERROR; },\n/* harmony export */ \"FUNCTION_CONVERT_TO_NUMBER_ERROR\": function() { return /* binding */ FUNCTION_CONVERT_TO_NUMBER_ERROR; },\n/* harmony export */ \"FUNCTION_CONVERT_TO_NUMBER_PARSE_ERROR\": function() { return /* binding */ FUNCTION_CONVERT_TO_NUMBER_PARSE_ERROR; },\n/* harmony export */ \"REQUIRE_ARRAY_ERROR\": function() { return /* binding */ REQUIRE_ARRAY_ERROR; },\n/* harmony export */ \"REQUIRE_BIGNUMBER_ERROR\": function() { return /* binding */ REQUIRE_BIGNUMBER_ERROR; },\n/* harmony export */ \"REQUIRE_LONG_ERROR\": function() { return /* binding */ REQUIRE_LONG_ERROR; },\n/* harmony export */ \"REQUIRE_NON_NULL_ERROR\": function() { return /* binding */ REQUIRE_NON_NULL_ERROR; },\n/* harmony export */ \"REQUIRE_NUMBER_ERROR\": function() { return /* binding */ REQUIRE_NUMBER_ERROR; },\n/* harmony export */ \"REQUIRE_STRING_ERROR\": function() { return /* binding */ REQUIRE_STRING_ERROR; },\n/* harmony export */ \"REQUIRE_STRING_OR_UINT8ARRAY_ERROR\": function() { return /* binding */ REQUIRE_STRING_OR_UINT8ARRAY_ERROR; },\n/* harmony export */ \"REQUIRE_TYPE_ERROR\": function() { return /* binding */ REQUIRE_TYPE_ERROR; },\n/* harmony export */ \"REQUIRE_UINT8ARRAY_ERROR\": function() { return /* binding */ REQUIRE_UINT8ARRAY_ERROR; },\n/* harmony export */ \"arrayEqual\": function() { return /* binding */ arrayEqual; },\n/* harmony export */ \"compare\": function() { return /* binding */ compare; },\n/* harmony export */ \"convertToBigNumber\": function() { return /* binding */ convertToBigNumber; },\n/* harmony export */ \"convertToBigNumberArray\": function() { return /* binding */ convertToBigNumberArray; },\n/* harmony export */ \"convertToNumber\": function() { return /* binding */ convertToNumber; },\n/* harmony export */ \"isBigNumber\": function() { return /* binding */ isBigNumber; },\n/* harmony export */ \"isLong\": function() { return /* binding */ isLong; },\n/* harmony export */ \"isNonNull\": function() { return /* binding */ isNonNull; },\n/* harmony export */ \"isNumber\": function() { return /* binding */ isNumber; },\n/* harmony export */ \"isString\": function() { return /* binding */ isString; },\n/* harmony export */ \"isStringOrUint8Array\": function() { return /* binding */ isStringOrUint8Array; },\n/* harmony export */ \"isType\": function() { return /* binding */ isType; },\n/* harmony export */ \"isUint8Array\": function() { return /* binding */ isUint8Array; },\n/* harmony export */ \"requireBigNumber\": function() { return /* binding */ requireBigNumber; },\n/* harmony export */ \"requireLong\": function() { return /* binding */ requireLong; },\n/* harmony export */ \"requireNonNull\": function() { return /* binding */ requireNonNull; },\n/* harmony export */ \"requireNotNegative\": function() { return /* binding */ requireNotNegative; },\n/* harmony export */ \"requireNumber\": function() { return /* binding */ requireNumber; },\n/* harmony export */ \"requireString\": function() { return /* binding */ requireString; },\n/* harmony export */ \"requireStringOrUint8Array\": function() { return /* binding */ requireStringOrUint8Array; },\n/* harmony export */ \"requireType\": function() { return /* binding */ requireType; },\n/* harmony export */ \"requireUint8Array\": function() { return /* binding */ requireUint8Array; },\n/* harmony export */ \"safeView\": function() { return /* binding */ safeView; },\n/* harmony export */ \"shuffle\": function() { return /* binding */ shuffle; }\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ \"./node_modules/bignumber.js/bignumber.mjs\");\n/* harmony import */ var long__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n/*-\n * ‌\n * Hedera JavaScript SDK\n * ​\n * Copyright (C) 2020 - 2022 Hedera Hashgraph, LLC\n * ​\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ‍\n */\n\n\n\n\n/**\n * @typedef {import(\"./Hbar.js\").default} Hbar\n */\n\n/**\n * Utility Error Messages\n */\nconst REQUIRE_NON_NULL_ERROR = \"This value cannot be null | undefined.\";\nconst REQUIRE_STRING_ERROR = \"This value must be a string.\";\nconst REQUIRE_UINT8ARRAY_ERROR = \"This value must be a Uint8Array.\";\nconst REQUIRE_STRING_OR_UINT8ARRAY_ERROR =\n \"This value must be a string or Uint8Array.\";\nconst REQUIRE_NUMBER_ERROR = \"This value must be a Number.\";\nconst REQUIRE_BIGNUMBER_ERROR = \"This value must be a BigNumber.\";\nconst REQUIRE_ARRAY_ERROR = \"The provided variable must be an Array.\";\nconst REQUIRE_LONG_ERROR = \"This value must be a Long.\";\n\nconst REQUIRE_TYPE_ERROR =\n \"The provided variables are not matching types.\";\n\nconst FUNCTION_CONVERT_TO_BIGNUMBER_ERROR =\n \"This value must be a String, Number, or BigNumber to be converted.\";\nconst FUNCTION_CONVERT_TO_NUMBER_ERROR =\n \"This value must be a String, Number, or BigNumber to be converted.\";\nconst FUNCTION_CONVERT_TO_NUMBER_PARSE_ERROR =\n \"Unable to parse given variable. Returns NaN.\";\n\n//Soft Checks\n\n/**\n * Takes any param and returns false if null or undefined.\n *\n * @param {any | null | undefined} variable\n * @returns {boolean}\n */\nfunction isNonNull(variable) {\n return variable != null;\n}\n\n/**\n * Takes any param and returns true if param variable and type are the same.\n *\n * @param {any | null | undefined} variable\n * @param {any | null | undefined} type\n * @returns {boolean}\n */\nfunction isType(variable, type) {\n return typeof variable == typeof type;\n}\n\n/**\n * Takes any param and returns true if param is not null and of type Uint8Array.\n *\n * @param {any | null | undefined} variable\n * @returns {boolean}\n */\nfunction isUint8Array(variable) {\n return isNonNull(variable) && variable instanceof Uint8Array;\n}\n\n/**\n * Takes any param and returns true if param is not null and of type Number.\n *\n * @param {any | null | undefined} variable\n * @returns {boolean}\n */\nfunction isNumber(variable) {\n return (\n isNonNull(variable) &&\n (typeof variable == \"number\" || variable instanceof Number)\n );\n}\n\n/**\n * Takes any param and returns true if param is not null and of type BigNumber.\n *\n * @param {any | null | undefined} variable\n * @returns {boolean}\n */\nfunction isBigNumber(variable) {\n return isNonNull(variable) && variable instanceof bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"];\n}\n\n/**\n * Takes any param and returns true if param is not null and of type BigNumber.\n *\n * @param {any | null | undefined} variable\n * @returns {boolean}\n */\nfunction isLong(variable) {\n return isNonNull(variable) && variable instanceof long__WEBPACK_IMPORTED_MODULE_1__;\n}\n\n/**\n * Takes any param and returns true if param is not null and of type string.\n *\n * @param {any | null | undefined} variable\n * @returns {boolean}\n */\nfunction isString(variable) {\n return isNonNull(variable) && typeof variable == \"string\";\n}\n\n/**\n * Takes any param and returns true if param is not null and type string or Uint8Array.\n *\n * @param {any | null | undefined} variable\n * @returns {boolean}\n */\nfunction isStringOrUint8Array(variable) {\n return (\n isNonNull(variable) && (isString(variable) || isUint8Array(variable))\n );\n}\n\n/**\n * Takes any param and returns false if null or undefined.\n *\n * @template {Long | Hbar} T\n * @param {T} variable\n * @returns {T}\n */\nfunction requireNotNegative(variable) {\n if (variable.isNegative()) {\n throw new Error(\"negative value not allowed\");\n }\n\n return variable;\n}\n\n/**\n * Takes any param and throws custom error if null or undefined.\n *\n * @param {any} variable\n * @returns {object}\n */\nfunction requireNonNull(variable) {\n if (!isNonNull(variable)) {\n throw new Error(REQUIRE_NON_NULL_ERROR);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return variable;\n }\n}\n\n/**\n * Takes any param and throws custom error if params are not same type.\n *\n * @param {any | null | undefined} variable\n * @param {any | null | undefined} type\n * @returns {object}\n */\nfunction requireType(variable, type) {\n if (!isType(variable, type)) {\n throw new Error(REQUIRE_TYPE_ERROR);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return variable;\n }\n}\n\n/**\n * Takes any param and throws custom error if non BigNumber.\n *\n * @param {any | null | undefined} variable\n * @returns {BigNumber}\n */\nfunction requireBigNumber(variable) {\n if (!isBigNumber(requireNonNull(variable))) {\n throw new Error(REQUIRE_BIGNUMBER_ERROR);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return /** @type {BigNumber} */ (variable);\n }\n}\n\n/**\n * Takes any param and throws custom error if non BigNumber.\n *\n * @param {any | null | undefined} variable\n * @returns {Long}\n */\nfunction requireLong(variable) {\n if (!isLong(requireNonNull(variable))) {\n throw new Error(REQUIRE_LONG_ERROR);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return /** @type {Long} */ (variable);\n }\n}\n\n/**\n * Takes any param and throws custom error if non string.\n *\n * @param {any | null | undefined} variable\n * @returns {string}\n */\nfunction requireString(variable) {\n if (!isString(requireNonNull(variable))) {\n throw new Error(REQUIRE_STRING_ERROR);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return /** @type {string} */ (variable);\n }\n}\n\n/**\n * Takes any param and throws custom error if non Uint8Array.\n *\n * @param {any | null | undefined} variable\n * @returns {Uint8Array}\n */\nfunction requireUint8Array(variable) {\n if (!isUint8Array(requireNonNull(variable))) {\n throw new Error(REQUIRE_UINT8ARRAY_ERROR);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return /** @type {Uint8Array} */ (variable);\n }\n}\n\n/**\n * Takes any param and throws custom error if non Uint8Array.\n *\n * @param {any | null | undefined} variable\n * @returns {number}\n */\nfunction requireNumber(variable) {\n if (!isNumber(requireNonNull(variable))) {\n throw new Error(REQUIRE_NUMBER_ERROR);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return /** @type {number} */ (variable);\n }\n}\n\n/**\n * Takes any param and throws custom error if null or undefined and not a string or Uint8Array.\n *\n * @param {any | null | undefined} variable\n * @returns {string | Uint8Array}\n */\nfunction requireStringOrUint8Array(variable) {\n if (isStringOrUint8Array(requireNonNull(variable))) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return /** @type {string | Uint8Array} */ (variable);\n } else {\n throw new Error(REQUIRE_STRING_OR_UINT8ARRAY_ERROR);\n }\n}\n\n//Conversions\n\n/**\n * Converts number or string to BigNumber.\n *\n * @param {any | null | undefined} variable\n * @returns {BigNumber}\n */\nfunction convertToBigNumber(variable) {\n requireNonNull(variable);\n if (\n isBigNumber(variable) ||\n isString(variable) ||\n isNumber(variable) ||\n isLong(variable)\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return new bignumber_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](variable);\n }\n throw new Error(FUNCTION_CONVERT_TO_BIGNUMBER_ERROR);\n}\n\n/**\n * Converts Array of Numbers or Strings to Array of BigNumbers.\n *\n * @param {any | null | undefined} variable\n * @returns {Array}\n */\nfunction convertToBigNumberArray(variable) {\n if (variable instanceof Array) {\n return /** @type {Array} */ (\n variable.map(convertToBigNumber)\n );\n } else {\n throw new Error(REQUIRE_ARRAY_ERROR);\n }\n}\n\n/**\n * @param {*} variable\n * @returns {number}\n */\nfunction convertToNumber(variable) {\n requireNonNull(variable);\n if (\n isBigNumber(variable) ||\n isString(variable) ||\n isNumber(variable) ||\n isLong(variable)\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const num = parseInt(variable);\n if (isNaN(num)) {\n throw new Error(FUNCTION_CONVERT_TO_NUMBER_PARSE_ERROR);\n } else {\n return num;\n }\n } else {\n throw new Error(FUNCTION_CONVERT_TO_NUMBER_ERROR);\n }\n}\n\n/**\n * Creates a DataView on top of an Uint8Array that could be or not be pooled, ensuring that we don't get out of bounds.\n *\n * @param {Uint8Array} arr\n * @param {number | undefined} offset\n * @param {number | undefined} length\n * @returns {DataView}\n */\nfunction safeView(arr, offset = 0, length = arr.byteLength) {\n if (!(Number.isInteger(offset) && offset >= 0))\n throw new Error(\"Invalid offset!\");\n if (!(Number.isInteger(length) && length >= 0))\n throw new Error(\"Invalid length!\");\n return new DataView(\n arr.buffer,\n arr.byteOffset + offset,\n Math.min(length, arr.byteLength - offset)\n );\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {Set=} ignore\n * @returns {boolean}\n */\nfunction compare(a, b, ignore = new Set()) {\n if (typeof a === \"object\" && typeof b === \"object\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const aKeys = Object.keys(a);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const bKeys = Object.keys(b);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n if (aKeys[i] !== bKeys[i]) {\n return false;\n }\n\n if (ignore.has(aKeys[i])) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (!compare(a[aKeys[i]], b[bKeys[i]], ignore)) {\n return false;\n }\n }\n\n return true;\n } else if (typeof a === \"number\" && typeof b === \"number\") {\n return a === b;\n } else if (typeof a === \"string\" && typeof b === \"string\") {\n return a === b;\n } else if (typeof a === \"boolean\" && typeof b === \"boolean\") {\n return a === b;\n } else {\n return false;\n }\n}\n\n/**\n * https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array\n *\n * @template T\n * @param {Array} array\n */\nfunction shuffle(array) {\n var currentIndex = array.length,\n temporaryValue,\n randomIndex;\n\n // While there remain elements to shuffle...\n while (0 !== currentIndex) {\n // Pick a remaining element...\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n\n // And swap it with the current element.\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n}\n\n/**\n * @param {Uint8Array} array1\n * @param {Uint8Array} array2\n * @returns {boolean}\n */\nfunction arrayEqual(array1, array2) {\n if (array1 === array2) {\n return true;\n }\n\n if (array1.byteLength !== array2.byteLength) {\n return false;\n }\n\n const view1 = new DataView(\n array1.buffer,\n array1.byteOffset,\n array1.byteLength\n );\n const view2 = new DataView(\n array2.buffer,\n array2.byteOffset,\n array2.byteLength\n );\n\n let i = array1.byteLength;\n\n while (i--) {\n if (view1.getUint8(i) !== view2.getUint8(i)) {\n return false;\n }\n }\n\n return true;\n}\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/@hashgraph/sdk/src/util.js?"); +/** + * @param {ArrayBuffer} data + * @param {number} byteOffset + * @param {number} byteLength + * @returns {Uint8Array} + */ +function decodeUnaryResponse( + data, + byteOffset = 0, + byteLength = data.byteLength, +) { + const dataView = new DataView(data, byteOffset, byteLength); + let dataOffset = 0; + + /** @type {?Uint8Array} */ + let unaryResponse = null; + + // 0 = successful + let status = 0; + + while (dataOffset < dataView.byteLength) { + const frameByte = dataView.getUint8(dataOffset + 0); + const frameType = frameByte >> 7; + const frameByteLength = dataView.getUint32(dataOffset + 1); + const frameOffset = dataOffset + 5; // offset from the start of the dataView + if (frameOffset + frameByteLength > dataView.byteLength) { + throw new Error("(BUG) unexpected frame length past the boundary"); + } + const frameData = new Uint8Array( + data, + dataView.byteOffset + frameOffset, + frameByteLength, + ); + + if (frameType === 0) { + if (unaryResponse != null) { + throw new Error( + "(BUG) unexpectedly received more than one data frame", + ); + } + + unaryResponse = frameData; + } else if (frameType === 1) { + const trailer = encoding_utf8_browser_decode(frameData); + const [trailerName, trailerValue] = trailer.split(":"); + + if (trailerName === "grpc-status") { + status = parseInt(trailerValue); + } else { + throw new Error(`(BUG) unhandled trailer, ${trailer}`); + } + } else { + throw new Error(`(BUG) unexpected frame type: ${frameType}`); + } + + dataOffset += frameByteLength + 5; + } + + if (status !== 0) { + throw new Error(`(BUG) unhandled grpc-status: ${status}`); + } + + if (unaryResponse == null) { + throw new Error("(BUG) unexpectedly received no response"); + } + + return unaryResponse; +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/channel/WebChannel.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), -/***/ "./node_modules/bignumber.js/bignumber.mjs": -/*!*************************************************!*\ - !*** ./node_modules/bignumber.js/bignumber.mjs ***! - \*************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigNumber\": function() { return /* binding */ BigNumber; }\n/* harmony export */ });\n/*\r\n * bignumber.js v9.1.1\r\n * A JavaScript library for arbitrary-precision arithmetic.\r\n * https://github.com/MikeMcl/bignumber.js\r\n * Copyright (c) 2022 Michael Mclaughlin \r\n * MIT Licensed.\r\n *\r\n * BigNumber.prototype methods | BigNumber methods\r\n * |\r\n * absoluteValue abs | clone\r\n * comparedTo | config set\r\n * decimalPlaces dp | DECIMAL_PLACES\r\n * dividedBy div | ROUNDING_MODE\r\n * dividedToIntegerBy idiv | EXPONENTIAL_AT\r\n * exponentiatedBy pow | RANGE\r\n * integerValue | CRYPTO\r\n * isEqualTo eq | MODULO_MODE\r\n * isFinite | POW_PRECISION\r\n * isGreaterThan gt | FORMAT\r\n * isGreaterThanOrEqualTo gte | ALPHABET\r\n * isInteger | isBigNumber\r\n * isLessThan lt | maximum max\r\n * isLessThanOrEqualTo lte | minimum min\r\n * isNaN | random\r\n * isNegative | sum\r\n * isPositive |\r\n * isZero |\r\n * minus |\r\n * modulo mod |\r\n * multipliedBy times |\r\n * negated |\r\n * plus |\r\n * precision sd |\r\n * shiftedBy |\r\n * squareRoot sqrt |\r\n * toExponential |\r\n * toFixed |\r\n * toFormat |\r\n * toFraction |\r\n * toJSON |\r\n * toNumber |\r\n * toPrecision |\r\n * toString |\r\n * valueOf |\r\n *\r\n */\r\n\r\n\r\nvar\r\n isNumeric = /^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i,\r\n mathceil = Math.ceil,\r\n mathfloor = Math.floor,\r\n\r\n bignumberError = '[BigNumber Error] ',\r\n tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ',\r\n\r\n BASE = 1e14,\r\n LOG_BASE = 14,\r\n MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1\r\n // MAX_INT32 = 0x7fffffff, // 2^31 - 1\r\n POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],\r\n SQRT_BASE = 1e7,\r\n\r\n // EDITABLE\r\n // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and\r\n // the arguments to toExponential, toFixed, toFormat, and toPrecision.\r\n MAX = 1E9; // 0 to MAX_INT32\r\n\r\n\r\n/*\r\n * Create and return a BigNumber constructor.\r\n */\r\nfunction clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz',\r\n alphabetHasNormalDecimalDigits = true;\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10 && alphabetHasNormalDecimalDigits) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if less than two characters,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) {\r\n alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789';\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10 && alphabetHasNormalDecimalDigits) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n P[Symbol.toStringTag] = 'BigNumber';\r\n\r\n // Node.js v10.12.0+\r\n P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n}\r\n\r\n\r\n// PRIVATE HELPER FUNCTIONS\r\n\r\n// These functions don't need access to variables,\r\n// e.g. DECIMAL_PLACES, in the scope of the `clone` function above.\r\n\r\n\r\nfunction bitFloor(n) {\r\n var i = n | 0;\r\n return n > 0 || n === i ? i : i - 1;\r\n}\r\n\r\n\r\n// Return a coefficient array as a string of base 10 digits.\r\nfunction coeffToString(a) {\r\n var s, z,\r\n i = 1,\r\n j = a.length,\r\n r = a[0] + '';\r\n\r\n for (; i < j;) {\r\n s = a[i++] + '';\r\n z = LOG_BASE - s.length;\r\n for (; z--; s = '0' + s);\r\n r += s;\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (j = r.length; r.charCodeAt(--j) === 48;);\r\n\r\n return r.slice(0, j + 1 || 1);\r\n}\r\n\r\n\r\n// Compare the value of BigNumbers x and y.\r\nfunction compare(x, y) {\r\n var a, b,\r\n xc = x.c,\r\n yc = y.c,\r\n i = x.s,\r\n j = y.s,\r\n k = x.e,\r\n l = y.e;\r\n\r\n // Either NaN?\r\n if (!i || !j) return null;\r\n\r\n a = xc && !xc[0];\r\n b = yc && !yc[0];\r\n\r\n // Either zero?\r\n if (a || b) return a ? b ? 0 : -j : i;\r\n\r\n // Signs differ?\r\n if (i != j) return i;\r\n\r\n a = i < 0;\r\n b = k == l;\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;\r\n\r\n // Compare exponents.\r\n if (!b) return k > l ^ a ? 1 : -1;\r\n\r\n j = (k = xc.length) < (l = yc.length) ? k : l;\r\n\r\n // Compare digit by digit.\r\n for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;\r\n\r\n // Compare lengths.\r\n return k == l ? 0 : k > l ^ a ? 1 : -1;\r\n}\r\n\r\n\r\n/*\r\n * Check that n is a primitive number, an integer, and in range, otherwise throw.\r\n */\r\nfunction intCheck(n, min, max, name) {\r\n if (n < min || n > max || n !== mathfloor(n)) {\r\n throw Error\r\n (bignumberError + (name || 'Argument') + (typeof n == 'number'\r\n ? n < min || n > max ? ' out of range: ' : ' not an integer: '\r\n : ' not a primitive number: ') + String(n));\r\n }\r\n}\r\n\r\n\r\n// Assumes finite n.\r\nfunction isOdd(n) {\r\n var k = n.c.length - 1;\r\n return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;\r\n}\r\n\r\n\r\nfunction toExponential(str, e) {\r\n return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) +\r\n (e < 0 ? 'e' : 'e+') + e;\r\n}\r\n\r\n\r\nfunction toFixedPoint(str, e, z) {\r\n var len, zs;\r\n\r\n // Negative exponent?\r\n if (e < 0) {\r\n\r\n // Prepend zeros.\r\n for (zs = z + '.'; ++e; zs += z);\r\n str = zs + str;\r\n\r\n // Positive exponent\r\n } else {\r\n len = str.length;\r\n\r\n // Append zeros.\r\n if (++e > len) {\r\n for (zs = z, e -= len; --e; zs += z);\r\n str += zs;\r\n } else if (e < len) {\r\n str = str.slice(0, e) + '.' + str.slice(e);\r\n }\r\n }\r\n\r\n return str;\r\n}\r\n\r\n\r\n// EXPORT\r\n\r\n\r\nvar BigNumber = clone();\r\n\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (BigNumber);\r\n\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/bignumber.js/bignumber.mjs?"); -/***/ }), -/***/ "./node_modules/browserify-aes/modes/list.json": -/*!*****************************************************!*\ - !*** ./node_modules/browserify-aes/modes/list.json ***! - \*****************************************************/ -/***/ (function(module) { -"use strict"; -eval("module.exports = JSON.parse('{\"aes-128-ecb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-192-ecb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-256-ecb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-128-cbc\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-192-cbc\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-256-cbc\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes128\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes192\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes256\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-128-cfb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-192-cfb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-256-cfb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-128-cfb8\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-192-cfb8\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-256-cfb8\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-128-cfb1\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-192-cfb1\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-256-cfb1\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-128-ofb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-192-ofb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-256-ofb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-128-ctr\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-192-ctr\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-256-ctr\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-128-gcm\":{\"cipher\":\"AES\",\"key\":128,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-192-gcm\":{\"cipher\":\"AES\",\"key\":192,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-256-gcm\":{\"cipher\":\"AES\",\"key\":256,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"}}');\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-aes/modes/list.json?"); -/***/ }), +class WebChannel extends Channel { + /** + * @param {string} address + */ + constructor(address) { + super(); + + /** + * @type {string} + * @private + */ + this._address = address; + } + + /** + * @override + * @returns {void} + */ + close() { + // do nothing + } + + /** + * @override + * @protected + * @param {string} serviceName + * @returns {import("protobufjs").RPCImpl} + */ + _createUnaryClient(serviceName) { + // eslint-disable-next-line @typescript-eslint/no-misused-promises + return async (method, requestData, callback) => { + try { + const response = await fetch( + `${this._address}/proto.${serviceName}/${method.name}`, + { + method: "POST", + headers: { + "content-type": "application/grpc-web+proto", + "x-user-agent": "hedera-sdk-js/v2", + "x-grpc-web": "1", + }, + body: encodeRequest(requestData), + }, + ); + + if (!response.ok) { + const error = new HttpError( + HttpStatus._fromValue(response.status), + ); + callback(error, null); + } + + // Check headers for gRPC errors + const grpcStatus = response.headers.get("grpc-status"); + const grpcMessage = response.headers.get("grpc-message"); + + if (grpcStatus != null && grpcMessage != null) { + const error = new GrpcServiceError( + GrpcStatus._fromValue(parseInt(grpcStatus)), + ); + error.message = grpcMessage; + callback(error, null); + } + + const responseBuffer = await response.arrayBuffer(); + const unaryResponse = decodeUnaryResponse(responseBuffer); + + callback(null, unaryResponse); + } catch (error) { + const err = new GrpcServiceError( + // retry on grpc web errors + GrpcStatus._fromValue(18), + ); + callback(err, null); + } + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/constants/ClientConstants.js + + +// MAINNET node proxies are the same for both 'WebClient' and 'NativeClient' +const MAINNET = { + "https://grpc-web.myhbarwallet.com:443": new AccountId_AccountId(3), + "https://node00.swirldslabs.com:443": new AccountId_AccountId(3), + "https://node01-00-grpc.swirlds.com:443": new AccountId_AccountId(4), + "https://node02.swirldslabs.com:443": new AccountId_AccountId(5), + "https://node03.swirldslabs.com:443": new AccountId_AccountId(6), + "https://node04.swirldslabs.com:443": new AccountId_AccountId(7), + "https://node05.swirldslabs.com:443": new AccountId_AccountId(8), + "https://node06.swirldslabs.com:443": new AccountId_AccountId(9), + "https://node07.swirldslabs.com:443": new AccountId_AccountId(10), + "https://node08.swirldslabs.com:443": new AccountId_AccountId(11), + "https://node09.swirldslabs.com:443": new AccountId_AccountId(12), + "https://node10.swirldslabs.com:443": new AccountId_AccountId(13), + "https://node11.swirldslabs.com:443": new AccountId_AccountId(14), + "https://node12.swirldslabs.com:443": new AccountId_AccountId(15), + "https://node13.swirldslabs.com:443": new AccountId_AccountId(16), + "https://node14.swirldslabs.com:443": new AccountId_AccountId(17), + "https://node15.swirldslabs.com:443": new AccountId_AccountId(18), + "https://node16.swirldslabs.com:443": new AccountId_AccountId(19), + "https://node17.swirldslabs.com:443": new AccountId_AccountId(20), + "https://node18.swirldslabs.com:443": new AccountId_AccountId(21), + "https://node19.swirldslabs.com:443": new AccountId_AccountId(22), + "https://node20.swirldslabs.com:443": new AccountId_AccountId(23), + "https://node21.swirldslabs.com:443": new AccountId_AccountId(24), + "https://node22.swirldslabs.com:443": new AccountId_AccountId(25), + "https://node23.swirldslabs.com:443": new AccountId_AccountId(26), + "https://node24.swirldslabs.com:443": new AccountId_AccountId(27), + "https://node25.swirldslabs.com:443": new AccountId_AccountId(28), + "https://node26.swirldslabs.com:443": new AccountId_AccountId(29), + "https://node27.swirldslabs.com:443": new AccountId_AccountId(30), + "https://node28.swirldslabs.com:443": new AccountId_AccountId(31), +}; + +const WEB_TESTNET = { + "https://testnet-node00-00-grpc.hedera.com:443": new AccountId_AccountId(3), + "https://testnet-node01-00-grpc.hedera.com:443": new AccountId_AccountId(4), + "https://testnet-node02-00-grpc.hedera.com:443": new AccountId_AccountId(5), + "https://testnet-node03-00-grpc.hedera.com:443": new AccountId_AccountId(6), + "https://testnet-node04-00-grpc.hedera.com:443": new AccountId_AccountId(7), + "https://testnet-node05-00-grpc.hedera.com:443": new AccountId_AccountId(8), + "https://testnet-node06-00-grpc.hedera.com:443": new AccountId_AccountId(9), +}; + +const WEB_PREVIEWNET = { + "https://previewnet-node00-00-grpc.hedera.com:443": new AccountId_AccountId(3), + "https://previewnet-node01-00-grpc.hedera.com:443": new AccountId_AccountId(4), + "https://previewnet-node02-00-grpc.hedera.com:443": new AccountId_AccountId(5), + "https://previewnet-node03-00-grpc.hedera.com:443": new AccountId_AccountId(6), + "https://previewnet-node04-00-grpc.hedera.com:443": new AccountId_AccountId(7), + "https://previewnet-node05-00-grpc.hedera.com:443": new AccountId_AccountId(8), + "https://previewnet-node06-00-grpc.hedera.com:443": new AccountId_AccountId(9), +}; + +const NATIVE_TESTNET = { + "https://grpc-web.testnet.myhbarwallet.com:443": new AccountId_AccountId(3), +}; + +const NATIVE_PREVIEWNET = { + "https://grpc-web.previewnet.myhbarwallet.com:443": new AccountId_AccountId(3), +}; + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/client/WebClient.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ "./node_modules/browserify-sign/browser/algorithms.json": -/*!**************************************************************!*\ - !*** ./node_modules/browserify-sign/browser/algorithms.json ***! - \**************************************************************/ -/***/ (function(module) { -"use strict"; -eval("module.exports = JSON.parse('{\"sha224WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"RSA-SHA224\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"sha256WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"RSA-SHA256\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"sha384WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"RSA-SHA384\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"sha512WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA512\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA1\":{\"sign\":\"rsa\",\"hash\":\"sha1\",\"id\":\"3021300906052b0e03021a05000414\"},\"ecdsa-with-SHA1\":{\"sign\":\"ecdsa\",\"hash\":\"sha1\",\"id\":\"\"},\"sha256\":{\"sign\":\"ecdsa\",\"hash\":\"sha256\",\"id\":\"\"},\"sha224\":{\"sign\":\"ecdsa\",\"hash\":\"sha224\",\"id\":\"\"},\"sha384\":{\"sign\":\"ecdsa\",\"hash\":\"sha384\",\"id\":\"\"},\"sha512\":{\"sign\":\"ecdsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-SHA1\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-WITH-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-WITH-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-WITH-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-WITH-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-RIPEMD160\":{\"sign\":\"dsa\",\"hash\":\"rmd160\",\"id\":\"\"},\"ripemd160WithRSA\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"RSA-RIPEMD160\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"md5WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"},\"RSA-MD5\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"}}');\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-sign/browser/algorithms.json?"); -/***/ }), +// eslint-disable-next-line @typescript-eslint/no-unused-vars -/***/ "./node_modules/browserify-sign/browser/curves.json": -/*!**********************************************************!*\ - !*** ./node_modules/browserify-sign/browser/curves.json ***! - \**********************************************************/ -/***/ (function(module) { -"use strict"; -eval("module.exports = JSON.parse('{\"1.3.132.0.10\":\"secp256k1\",\"1.3.132.0.33\":\"p224\",\"1.2.840.10045.3.1.1\":\"p192\",\"1.2.840.10045.3.1.7\":\"p256\",\"1.3.132.0.34\":\"p384\",\"1.3.132.0.35\":\"p521\"}');\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/browserify-sign/browser/curves.json?"); -/***/ }), -/***/ "./node_modules/diffie-hellman/lib/primes.json": -/*!*****************************************************!*\ - !*** ./node_modules/diffie-hellman/lib/primes.json ***! - \*****************************************************/ -/***/ (function(module) { +/** + * @typedef {import("./Client.js").ClientConfiguration} ClientConfiguration + */ -"use strict"; -eval("module.exports = JSON.parse('{\"modp1\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"},\"modp2\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"},\"modp5\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"},\"modp14\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"},\"modp15\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"},\"modp16\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"},\"modp17\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"},\"modp18\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"}}');\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/diffie-hellman/lib/primes.json?"); +const WebClient_Network = { + /** + * @param {string} name + * @returns {{[key: string]: (string | AccountId)}} + */ + fromName(name) { + switch (name) { + case "mainnet": + return WebClient_Network.MAINNET; + + case "testnet": + return WebClient_Network.TESTNET; + + case "previewnet": + return WebClient_Network.PREVIEWNET; + + default: + throw new Error(`unknown network name: ${name}`); + } + }, + + MAINNET: MAINNET, + TESTNET: WEB_TESTNET, + PREVIEWNET: WEB_PREVIEWNET, +}; + +/** + * @augments {Client} + */ +class WebClient extends Client { + /** + * @param {ClientConfiguration} [props] + */ + constructor(props) { + super(props); + if (props != null) { + if (typeof props.network === "string") { + switch (props.network) { + case "mainnet": + this.setNetwork(WebClient_Network.MAINNET); + this.setLedgerId(LedgerId.MAINNET); + break; + + case "testnet": + this.setNetwork(WebClient_Network.TESTNET); + this.setLedgerId(LedgerId.TESTNET); + break; + + case "previewnet": + this.setNetwork(WebClient_Network.PREVIEWNET); + this.setLedgerId(LedgerId.PREVIEWNET); + break; + + default: + throw new Error( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + `unknown network: ${props.network}`, + ); + } + } else if (props.network != null) { + this.setNetwork(props.network); + } + } + } + + /** + * @param {string | ClientConfiguration} data + * @returns {WebClient} + */ + static fromConfig(data) { + return new WebClient( + typeof data === "string" + ? /** @type {ClientConfiguration | undefined} */ ( + JSON.parse(data) + ) + : data, + ); + } + + /** + * Construct a client for a specific network. + * + * It is the responsibility of the caller to ensure that all nodes in the map are part of the + * same Hedera network. Failure to do so will result in undefined behavior. + * + * The client will load balance all requests to Hedera using a simple round-robin scheme to + * chose nodes to send transactions to. For one transaction, at most 1/3 of the nodes will be + * tried. + * + * @param {{[key: string]: (string | AccountId)} | string} network + * @returns {WebClient} + */ + static forNetwork(network) { + return new WebClient({ network, scheduleNetworkUpdate: false }); + } + + /** + * @param {string} network + * @returns {WebClient} + */ + static forName(network) { + return new WebClient({ network, scheduleNetworkUpdate: false }); + } + + /** + * Construct a Hedera client pre-configured for Mainnet access. + * + * @returns {WebClient} + */ + static forMainnet() { + return new WebClient({ + network: "mainnet", + scheduleNetworkUpdate: false, + }); + } + + /** + * Construct a Hedera client pre-configured for Testnet access. + * + * @returns {WebClient} + */ + static forTestnet() { + return new WebClient({ + network: "testnet", + scheduleNetworkUpdate: false, + }); + } + + /** + * Construct a Hedera client pre-configured for Previewnet access. + * + * @returns {WebClient} + */ + static forPreviewnet() { + return new WebClient({ + network: "previewnet", + scheduleNetworkUpdate: false, + }); + } + + /** + * @param {{[key: string]: (string | AccountId)} | string} network + * @returns {void} + */ + setNetwork(network) { + if (typeof network === "string") { + switch (network) { + case "previewnet": + this._network.setNetwork(WebClient_Network.PREVIEWNET); + break; + case "testnet": + this._network.setNetwork(WebClient_Network.TESTNET); + break; + case "mainnet": + this._network.setNetwork(WebClient_Network.MAINNET); + } + } else { + this._network.setNetwork(network); + } + } + + /** + * @param {string[] | string} mirrorNetwork + * @returns {this} + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + setMirrorNetwork(mirrorNetwork) { + if (typeof mirrorNetwork === "string") { + this._mirrorNetwork.setNetwork([]); + } else { + this._mirrorNetwork.setNetwork(mirrorNetwork); + } + + return this; + } + + /** + * @override + * @returns {(address: string) => WebChannel} + */ + _createNetworkChannel() { + return (address) => new WebChannel(address); + } + + /** + * @override + * @returns {(address: string) => *} + */ + _createMirrorNetworkChannel() { + return () => { + throw new Error("mirror support is not supported in browsers"); + }; + } +} + +;// CONCATENATED MODULE: ./node_modules/@hashgraph/sdk/src/browser.js +/*- + * ‌ + * Hedera JavaScript SDK + * ​ + * Copyright (C) 2020 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ -/***/ }), +/** + * The entry point for Browser applications + */ -/***/ "./node_modules/elliptic/package.json": -/*!********************************************!*\ - !*** ./node_modules/elliptic/package.json ***! - \********************************************/ -/***/ (function(module) { -"use strict"; -eval("module.exports = JSON.parse('{\"name\":\"elliptic\",\"version\":\"6.5.4\",\"description\":\"EC cryptography\",\"main\":\"lib/elliptic.js\",\"files\":[\"lib\"],\"scripts\":{\"lint\":\"eslint lib test\",\"lint:fix\":\"npm run lint -- --fix\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"test\":\"npm run lint && npm run unit\",\"version\":\"grunt dist && git add dist/\"},\"repository\":{\"type\":\"git\",\"url\":\"git@github.com:indutny/elliptic\"},\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"author\":\"Fedor Indutny \",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"homepage\":\"https://github.com/indutny/elliptic\",\"devDependencies\":{\"brfs\":\"^2.0.2\",\"coveralls\":\"^3.1.0\",\"eslint\":\"^7.6.0\",\"grunt\":\"^1.2.1\",\"grunt-browserify\":\"^5.3.0\",\"grunt-cli\":\"^1.3.2\",\"grunt-contrib-connect\":\"^3.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^5.0.0\",\"grunt-mocha-istanbul\":\"^5.0.2\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^8.0.1\"},\"dependencies\":{\"bn.js\":\"^4.11.9\",\"brorand\":\"^1.1.0\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.1\",\"inherits\":\"^2.0.4\",\"minimalistic-assert\":\"^1.0.1\",\"minimalistic-crypto-utils\":\"^1.0.1\"}}');\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/elliptic/package.json?"); -/***/ }), -/***/ "./node_modules/parse-asn1/aesid.json": -/*!********************************************!*\ - !*** ./node_modules/parse-asn1/aesid.json ***! - \********************************************/ -/***/ (function(module) { -"use strict"; -eval("module.exports = JSON.parse('{\"2.16.840.1.101.3.4.1.1\":\"aes-128-ecb\",\"2.16.840.1.101.3.4.1.2\":\"aes-128-cbc\",\"2.16.840.1.101.3.4.1.3\":\"aes-128-ofb\",\"2.16.840.1.101.3.4.1.4\":\"aes-128-cfb\",\"2.16.840.1.101.3.4.1.21\":\"aes-192-ecb\",\"2.16.840.1.101.3.4.1.22\":\"aes-192-cbc\",\"2.16.840.1.101.3.4.1.23\":\"aes-192-ofb\",\"2.16.840.1.101.3.4.1.24\":\"aes-192-cfb\",\"2.16.840.1.101.3.4.1.41\":\"aes-256-ecb\",\"2.16.840.1.101.3.4.1.42\":\"aes-256-cbc\",\"2.16.840.1.101.3.4.1.43\":\"aes-256-ofb\",\"2.16.840.1.101.3.4.1.44\":\"aes-256-cfb\"}');\n\n//# sourceURL=webpack://@bladelabs/blade-sdk.js/./node_modules/parse-asn1/aesid.json?"); +;// CONCATENATED MODULE: ./src/models/Common.ts +var Common_SdkEnvironment; +(function (SdkEnvironment) { + SdkEnvironment["Prod"] = "Prod"; + SdkEnvironment["Dev"] = "Dev"; +})(Common_SdkEnvironment || (Common_SdkEnvironment = {})); +var Environment; +(function (Environment) { + Environment["browser"] = "browser"; + Environment["node"] = "node"; +})(Environment || (Environment = {})); +var EncryptedType; +(function (EncryptedType) { + EncryptedType["tvte"] = "tvte"; + EncryptedType["vte"] = "vte"; +})(EncryptedType || (EncryptedType = {})); +var AccountStatus; +(function (AccountStatus) { + AccountStatus["PENDING"] = "PENDING"; + AccountStatus["SUCCESS"] = "SUCCESS"; + AccountStatus["RETRY"] = "RETRY"; + AccountStatus["FAILED"] = "FAILED"; +})(AccountStatus || (AccountStatus = {})); + +;// CONCATENATED MODULE: ./src/models/Networks.ts +var Networks_a; +var Networks_Network; +(function (Network) { + Network["Mainnet"] = "Mainnet"; + Network["Testnet"] = "Testnet"; +})(Networks_Network || (Networks_Network = {})); +var Networks_NetworkMirrorNodes = (Networks_a = {}, + Networks_a[Networks_Network.Mainnet] = "https://mainnet-public.mirrornode.hedera.com", + Networks_a[Networks_Network.Testnet] = "https://testnet.mirrornode.hedera.com", + Networks_a); + +;// CONCATENATED MODULE: ./src/config.ts +// Autogenerated file. Please check utils/fixConfig.js +/* harmony default export */ var config = ({ + sdkVersion: "BladeSDK.js@0.6.3", + numberVersion: "0.6.3", +}); + +;// CONCATENATED MODULE: ./src/helpers/StringHelpers.ts +var StringHelpers = /** @class */ (function () { + function StringHelpers() { + } + StringHelpers.stringToNetwork = function (str) { + return str[0].toUpperCase() + str.slice(1).toLowerCase(); + }; + return StringHelpers; +}()); +/* harmony default export */ var helpers_StringHelpers = (StringHelpers); + +;// CONCATENATED MODULE: ./src/helpers/ArrayHelpers.ts +var __values = (undefined && undefined.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (undefined && undefined.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +var ArrayHelpers_flatArray = function (array) { + var e_1, _a; + var result = []; + if (array && Array.isArray(array)) { + try { + for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) { + var value = array_1_1.value; + if (Array.isArray(value)) { + result.push.apply(result, __spreadArray([], __read(value), false)); + } + else { + result.push(value); + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1); + } + finally { if (e_1) throw e_1.error; } + } + } + return result; +}; + +;// CONCATENATED MODULE: ./src/helpers/SecurityHelper.ts +var SecurityHelper_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var SecurityHelper_read = (undefined && undefined.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var SecurityHelper_spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +var SecurityHelper_crypto = __webpack_require__(5835); + +var CIPHER_IV_LENGTH = 12; +var CIPHER_KEY_LENGTH = 32; +var MAGIC_IV_INDEX = 3; +var encrypt = function (data, token, env) { return SecurityHelper_awaiter(void 0, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(env === "browser")) return [3 /*break*/, 2]; + return [4 /*yield*/, encryptBrowser(data, token)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: return [4 /*yield*/, encryptNode(data, token)]; + case 3: return [2 /*return*/, _a.sent()]; + } + }); +}); }; +var encryptBrowser = function (data, token) { return SecurityHelper_awaiter(void 0, void 0, void 0, function () { + var encoder, ivStr, iv, tokenIdx, tokenArr, rawKey, i, key, encoded, cipher; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + encoder = new TextEncoder(); + ivStr = generateRandomString(CIPHER_IV_LENGTH); + iv = encoder.encode(ivStr); + tokenIdx = iv[MAGIC_IV_INDEX]; + tokenArr = encoder.encode(token); + rawKey = new Uint8Array(CIPHER_KEY_LENGTH); + for (i = 0; i < CIPHER_KEY_LENGTH; i++) { + rawKey[i] = tokenArr[(i + tokenIdx) % tokenArr.length]; + } + return [4 /*yield*/, window.crypto.subtle.importKey("raw", rawKey, { + name: "AES-GCM", + }, false, ["encrypt", "decrypt"])]; + case 1: + key = _a.sent(); + encoded = encoder.encode(data); + return [4 /*yield*/, window.crypto.subtle.encrypt({ + name: 'AES-GCM', + iv: iv, + }, key, encoded)]; + case 2: + cipher = _a.sent(); + return [2 /*return*/, btoa(ivStr + String.fromCharCode.apply(null, SecurityHelper_spreadArray([], SecurityHelper_read(new Uint8Array(cipher)), false)))]; + } + }); +}); }; +var encryptNode = function (data, token) { return SecurityHelper_awaiter(void 0, void 0, void 0, function () { + var ivStr, iv, tokenIdx, tokenBuffer, rawKey, i, cipher, nonceCiphertextTag; + return __generator(this, function (_a) { + ivStr = generateRandomString(CIPHER_IV_LENGTH); + iv = node_modules_buffer.Buffer.from(ivStr, 'utf8'); + tokenIdx = iv[MAGIC_IV_INDEX]; + tokenBuffer = node_modules_buffer.Buffer.from(token, 'utf8'); + rawKey = node_modules_buffer.Buffer.alloc(CIPHER_KEY_LENGTH); + for (i = 0; i < CIPHER_KEY_LENGTH; i++) { + rawKey[i] = tokenBuffer[(i + tokenIdx) % tokenBuffer.length]; + } + cipher = SecurityHelper_crypto.createCipheriv('aes-256-gcm', rawKey, iv); + nonceCiphertextTag = node_modules_buffer.Buffer.concat([ + iv, + cipher.update(data), + cipher.final(), + cipher.getAuthTag() // Fix: Get tag with cipher.getAuthTag() and concatenate: nonce|ciphertext|tag + ]); + return [2 /*return*/, nonceCiphertextTag.toString('base64')]; + }); +}); }; +var decrypt = function (cipherStr, token) { return SecurityHelper_awaiter(void 0, void 0, void 0, function () { + var encoder, decoder, cipher, ivStr, cipherDataStr, iv, tokenIdx, tokenArr, rawKey, i, key, buffer, bufferView, i, deciphered; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + encoder = new TextEncoder(); + decoder = new TextDecoder(); + cipher = atob(cipherStr); + ivStr = cipher.substring(0, CIPHER_IV_LENGTH); + cipherDataStr = cipher.substring(CIPHER_IV_LENGTH); + iv = encoder.encode(ivStr); + tokenIdx = iv[MAGIC_IV_INDEX]; + tokenArr = encoder.encode(token); + rawKey = new Uint8Array(CIPHER_KEY_LENGTH); + for (i = 0; i < CIPHER_KEY_LENGTH; i++) { + rawKey[i] = tokenArr[(i + tokenIdx) % tokenArr.length]; + } + return [4 /*yield*/, window.crypto.subtle.importKey("raw", rawKey, { + name: "AES-GCM", + }, false, ["encrypt", "decrypt"])]; + case 1: + key = _a.sent(); + buffer = new ArrayBuffer(cipherDataStr.length); + bufferView = new Uint8Array(buffer); + for (i = 0; i < cipherDataStr.length; i++) { + bufferView[i] = cipherDataStr.charCodeAt(i); + } + return [4 /*yield*/, window.crypto.subtle.decrypt({ + name: 'AES-GCM', + iv: iv, + }, key, buffer)]; + case 2: + deciphered = _a.sent(); + return [2 /*return*/, decoder.decode(deciphered)]; + } + }); +}); }; +var generateRandomString = function (length) { + var result = ""; + var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + for (var i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * characters.length)); + } + return result; +}; + +;// CONCATENATED MODULE: ./src/ApiService.ts +var __assign = (undefined && undefined.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var ApiService_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var ApiService_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var ApiService_read = (undefined && undefined.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var ApiService_spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; + + + + + + + +var sdkVersion = ""; +var visitorId = ""; +var apiKey = ""; +var environment = Common_SdkEnvironment.Prod; +var initApiService = function (version, visitor, token, sdkEnvironment) { + sdkVersion = version; + visitorId = visitor; + environment = sdkEnvironment; + apiKey = token; +}; +var getEncryptedHeader = function (env, type) { + if (env === void 0) { env = Environment.browser; } + if (type === void 0) { type = EncryptedType.tvte; } + return ApiService_awaiter(void 0, void 0, void 0, function () { + var value, _a, platform, version, _b, _c; + return ApiService_generator(this, function (_d) { + switch (_d.label) { + case 0: + value = ""; + _a = ApiService_read(sdkVersion.split("@"), 2), platform = _a[0], version = _a[1]; + if (!(type === 'tvte')) return [3 /*break*/, 2]; + value = "".concat(version, "@").concat(Date.now()); + _c = (_b = "".concat(platform, "@")).concat; + return [4 /*yield*/, encrypt(value, apiKey, env)]; + case 1: return [2 /*return*/, _c.apply(_b, [_d.sent()])]; + case 2: + if (!(type === 'vte')) return [3 /*break*/, 4]; + value = "".concat(visitorId, "@").concat(Date.now()); + return [4 /*yield*/, encrypt(value, apiKey, env)]; + case 3: return [2 /*return*/, _d.sent()]; + case 4: return [2 /*return*/]; + } + }); + }); +}; +var getApiUrl = function () { + return environment === SdkEnvironment.Prod + ? "https://rest.prod.bladewallet.io/openapi/v7" + : "https://api.bld-dev.bladewallet.io/openapi/v7"; +}; +var fetchWithRetry = function (url, options, maxAttempts) { + if (maxAttempts === void 0) { maxAttempts = 3; } + return ApiService_awaiter(void 0, void 0, void 0, function () { + return ApiService_generator(this, function (_a) { + return [2 /*return*/, new Promise(function (resolve, reject) { + var attemptCounter = 0; + var interval = 5000; + // tslint:disable-next-line:no-shadowed-variable + var makeRequest = function (url, options) { + attemptCounter += 1; + fetch(url, options) + .then(function (res) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var rawData; + return ApiService_generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!!res.ok) return [3 /*break*/, 4]; + if (!((res.status === 408 || res.status === 429) && attemptCounter < maxAttempts)) return [3 /*break*/, 1]; + /* istanbul ignore next */ + setTimeout(function () { + makeRequest(url, options); + }, interval * attemptCounter); + return [3 /*break*/, 3]; + case 1: return [4 /*yield*/, res.text()]; + case 2: + rawData = _a.sent(); + try { + reject(__assign({ url: res.url }, JSON.parse(rawData))); + } + catch (e) { + reject({ + url: res.url, + error: rawData + }); + } + _a.label = 3; + case 3: return [3 /*break*/, 5]; + case 4: + resolve(res); + _a.label = 5; + case 5: return [2 /*return*/]; + } + }); + }); }) + .catch(function (e) { + reject({ + url: url, + error: e.message + }); + }); + }; + makeRequest(url, options); + })]; + }); + }); +}; +var statusCheck = function (res) { return ApiService_awaiter(void 0, void 0, void 0, function () { + return ApiService_generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!!res.ok) return [3 /*break*/, 2]; + return [4 /*yield*/, res.json()]; + case 1: throw _a.sent(); + case 2: return [2 /*return*/, res]; + } + }); +}); }; +var GET = function (network, route) { + return fetchWithRetry("".concat(NetworkMirrorNodes[network], "/").concat(route), {}) + .then(statusCheck) + .then(function (x) { return x.json(); }); +}; +var createAccount = function (network, params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, headers, _a, options; + var _b; + return ApiService_generator(this, function (_c) { + switch (_c.label) { + case 0: + url = "".concat(getApiUrl(), "/accounts"); + _b = { + "X-NETWORK": network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _a = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + headers = (_b[_a] = _c.sent(), + _b["Content-Type"] = "application/json", + _b); + if (params.deviceId) { + headers["X-DID-API"] = params.deviceId; + } + options = { + method: "POST", + headers: new Headers(headers), + body: JSON.stringify({ + publicKey: params.publicKey + }) + }; + return [2 /*return*/, fetchWithRetry(url, options) + .then(statusCheck) + .then(function (x) { return x.json(); })]; + } + }); +}); }; +var checkAccountCreationStatus = function (transactionId, network, params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, options, _a, _b; + var _c, _d; + return ApiService_generator(this, function (_e) { + switch (_e.label) { + case 0: + url = "".concat(getApiUrl(), "/accounts/status?transactionId=").concat(transactionId); + _c = { + method: "GET" + }; + _a = Headers.bind; + _d = { + "X-NETWORK": network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _b = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(), + _d["Content-Type"] = "application/json", + _d)]))(), + _c); + return [2 /*return*/, fetch(url, options) + .then(statusCheck) + .then(function (x) { return x.json(); })]; + } + }); +}); }; +var getPendingAccountData = function (transactionId, network, params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, options, _a, _b; + var _c, _d; + return ApiService_generator(this, function (_e) { + switch (_e.label) { + case 0: + url = "".concat(getApiUrl(), "/accounts/details?transactionId=").concat(transactionId); + _c = { + method: "GET" + }; + _a = Headers.bind; + _d = { + "X-NETWORK": network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _b = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(), + _d["Content-Type"] = "application/json", + _d)]))(), + _c); + return [2 /*return*/, fetch(url, options) + .then(statusCheck) + .then(function (x) { return x.json(); })]; + } + }); +}); }; +var confirmAccountUpdate = function (params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, options, _a, _b; + var _c, _d; + return ApiService_generator(this, function (_e) { + switch (_e.label) { + case 0: + url = "".concat(getApiUrl(), "/accounts/confirm"); + _c = { + method: "PATCH" + }; + _a = Headers.bind; + _d = { + "X-NETWORK": params.network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _b = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(), + _d["Content-Type"] = "application/json", + _d)]))(), + _c.body = JSON.stringify({ + id: params.accountId + }), + _c); + return [2 /*return*/, fetchWithRetry(url, options) + .then(statusCheck)]; + } + }); +}); }; +var requestTokenInfo = function (network, tokenId) { return ApiService_awaiter(void 0, void 0, void 0, function () { + return ApiService_generator(this, function (_a) { + return [2 /*return*/, GET(network, "api/v1/tokens/".concat(tokenId))]; + }); +}); }; +var transferTokens = function (network, params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, options, _a, _b; + var _c, _d; + return ApiService_generator(this, function (_e) { + switch (_e.label) { + case 0: + url = "".concat(getApiUrl(), "/tokens/transfers"); + _c = { + method: "POST" + }; + _a = Headers.bind; + _d = { + "X-NETWORK": network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _b = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(), + _d["Content-Type"] = "application/json", + _d)]))(), + _c.body = JSON.stringify({ + receiverAccountId: params.receiverAccountId, + senderAccountId: params.senderAccountId, + amount: params.amount, + decimals: params.decimals, + memo: params.memo + }), + _c); + return [2 /*return*/, fetch(url, options) + .then(statusCheck) + .then(function (x) { return x.json(); })]; + } + }); +}); }; +var signContractCallTx = function (network, params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, options, _a, _b; + var _c, _d; + return ApiService_generator(this, function (_e) { + switch (_e.label) { + case 0: + url = "".concat(getApiUrl(), "/smart/contract/sign"); + _c = { + method: "POST" + }; + _a = Headers.bind; + _d = { + "X-NETWORK": network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _b = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(), + _d["Content-Type"] = "application/json", + _d)]))(), + _c.body = JSON.stringify({ + functionParametersHash: Buffer.from(params.contractFunctionParameters).toString("base64"), + contractId: params.contractId, + functionName: params.functionName, + gas: params.gas + }), + _c); + return [2 /*return*/, fetch(url, options) + .then(statusCheck) + .then(function (x) { return x.json(); })]; + } + }); +}); }; +var apiCallContractQuery = function (network, params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, options, _a, _b; + var _c, _d; + return ApiService_generator(this, function (_e) { + switch (_e.label) { + case 0: + url = "".concat(getApiUrl(), "/smart/contract/call"); + _c = { + method: "POST" + }; + _a = Headers.bind; + _d = { + "X-NETWORK": network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _b = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(), + _d["Content-Type"] = "application/json", + _d)]))(), + _c.body = JSON.stringify({ + functionParametersHash: Buffer.from(params.contractFunctionParameters).toString("base64"), + contractId: params.contractId, + functionName: params.functionName, + gas: params.gas + }), + _c); + return [2 /*return*/, fetch(url, options) + .then(statusCheck) + .then(function (x) { return x.json(); })]; + } + }); +}); }; +var getC14token = function (params) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var url, options, _a, _b; + var _c, _d; + return ApiService_generator(this, function (_e) { + switch (_e.label) { + case 0: + url = "".concat(getApiUrl(), "/c14/data"); + _c = { + method: "GET" + }; + _a = Headers.bind; + _d = { + "X-NETWORK": params.network.toUpperCase(), + "X-VISITOR-ID": params.visitorId, + "X-DAPP-CODE": params.dAppCode + }; + _b = "X-SDK-TVTE-API"; + return [4 /*yield*/, getEncryptedHeader()]; + case 1: + options = (_c.headers = new (_a.apply(Headers, [void 0, (_d[_b] = _e.sent(), + _d["Content-Type"] = "application/json", + _d)]))(), + _c); + return [2 /*return*/, fetch(url, options) + .then(statusCheck) + .then(function (x) { return x.json(); })]; + } + }); +}); }; +var getAccountsFromPublicKey = function (network, publicKey) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var formatted; + return ApiService_generator(this, function (_a) { + formatted = publicKey.toStringRaw(); + return [2 /*return*/, GET(network, "api/v1/accounts?account.publickey=".concat(formatted)) + .then(function (x) { return x.accounts.map(function (acc) { return acc.account; }); }) + .catch(function () { + return []; + })]; + }); +}); }; +var accountInfo = function (network, accountId) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var info; + return ApiService_generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, GET(network, "api/v1/accounts/".concat(accountId))]; + case 1: + info = _a.sent(); + return [2 /*return*/, { + evmAddress: info.evm_address ? info.evm_address : "0x".concat(AccountId.fromString(accountId).toSolidityAddress()), + publicKey: info.key.key + }]; + } + }); +}); }; +var getTransactionsFrom = function (network, accountId, transactionType, nextPage, transactionsLimit) { + if (transactionType === void 0) { transactionType = ""; } + if (nextPage === void 0) { nextPage = null; } + if (transactionsLimit === void 0) { transactionsLimit = "10"; } + return ApiService_awaiter(void 0, void 0, void 0, function () { + var limit, info, result, pageLimit, _loop_1, state_1; + var _a, _b; + return ApiService_generator(this, function (_c) { + switch (_c.label) { + case 0: + limit = parseInt(transactionsLimit, 10); + result = []; + pageLimit = limit >= 100 ? 100 : 25; + _loop_1 = function () { + var groupedTransactions, transactions; + return ApiService_generator(this, function (_d) { + switch (_d.label) { + case 0: + if (!nextPage) return [3 /*break*/, 2]; + return [4 /*yield*/, GET(network, nextPage)]; + case 1: + info = _d.sent(); + return [3 /*break*/, 4]; + case 2: return [4 /*yield*/, GET(network, "api/v1/transactions/?account.id=".concat(accountId, "&limit=").concat(pageLimit))]; + case 3: + info = _d.sent(); + _d.label = 4; + case 4: + nextPage = (_b = (_a = info.links.next) === null || _a === void 0 ? void 0 : _a.substring(1)) !== null && _b !== void 0 ? _b : null; + groupedTransactions = {}; + return [4 /*yield*/, Promise.all(info.transactions.map(function (t) { return ApiService_awaiter(void 0, void 0, void 0, function () { + var _a, _b; + return ApiService_generator(this, function (_c) { + switch (_c.label) { + case 0: + _a = groupedTransactions; + _b = t.transaction_id; + return [4 /*yield*/, getTransaction(network, t.transaction_id, accountId)]; + case 1: + _a[_b] = _c.sent(); + return [2 /*return*/]; + } + }); + }); }))]; + case 5: + _d.sent(); + transactions = flatArray(Object.values(groupedTransactions)) + .sort(function (a, b) { return new Date(b.time).valueOf() - new Date(a.time).valueOf(); }); + transactions = filterAndFormatTransactions(transactions, transactionType, accountId); + result.push.apply(result, ApiService_spreadArray([], ApiService_read(transactions), false)); + if (result.length >= limit) { + nextPage = "api/v1/transactions?account.id=".concat(accountId, "×tamp=lt:").concat(result[limit - 1].consensusTimestamp, "&limit=").concat(pageLimit); + } + if (!nextPage) { + return [2 /*return*/, "break"]; + } + return [2 /*return*/]; + } + }); + }; + _c.label = 1; + case 1: + if (!(result.length < limit)) return [3 /*break*/, 3]; + return [5 /*yield**/, _loop_1()]; + case 2: + state_1 = _c.sent(); + if (state_1 === "break") + return [3 /*break*/, 3]; + return [3 /*break*/, 1]; + case 3: return [2 /*return*/, { + nextPage: nextPage, + transactions: result.slice(0, limit) + }]; + } + }); + }); +}; +var getTransaction = function (network, transactionId, accountId) { + return GET(network, "api/v1/transactions/".concat(transactionId)) + .then(function (x) { return x.transactions.map(function (t) { + return { + time: new Date(parseFloat(t.consensus_timestamp) * 1000), + transfers: (ApiService_spreadArray(ApiService_spreadArray([], ApiService_read((t.token_transfers || [])), false), ApiService_read((t.transfers || [])), false)) + .map(function (tt) { + tt.amount = !tt.token_id ? tt.amount / Math.pow(10, 8) : tt.amount; + return tt; + }), + nftTransfers: t.nft_transfers || null, + memo: __webpack_require__.g.atob(t.memo_base64), + transactionId: t.transaction_id, + fee: t.charged_tx_fee, + type: t.name, + consensusTimestamp: t.consensus_timestamp + }; + }); }) + .catch(function () { + return []; + }); +}; + +// EXTERNAL MODULE: ./node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js +var bn_js_lib_bn = __webpack_require__(3737); +var bn_js_lib_bn_default = /*#__PURE__*/__webpack_require__.n(bn_js_lib_bn); +// EXTERNAL MODULE: ./node_modules/hash.js/lib/hash.js +var lib_hash = __webpack_require__(3715); +var hash_default = /*#__PURE__*/__webpack_require__.n(lib_hash); +;// CONCATENATED MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js + + + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; + +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function createCommonjsModule(fn, basedir, module) { + return module = { + path: basedir, + exports: {}, + require: function (path, base) { + return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); + } + }, fn(module, module.exports), module.exports; +} + +function getDefaultExportFromNamespaceIfPresent (n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n; +} + +function getDefaultExportFromNamespaceIfNotNamed (n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n; +} + +function getAugmentedNamespace(n) { + if (n.__esModule) return n; + var a = Object.defineProperty({}, '__esModule', {value: true}); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function () { + return n[k]; + } + }); + }); + return a; +} + +function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); +} + +var minimalisticAssert = assert; + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); +}; + +var utils_1 = createCommonjsModule(function (module, exports) { +'use strict'; + +var utils = exports; + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg !== 'string') { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + return res; + } + if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } else { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } + return res; +} +utils.toArray = toArray; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +utils.encode = function encode(arr, enc) { + if (enc === 'hex') + return toHex(arr); + else + return arr; +}; +}); + +var utils_1$1 = createCommonjsModule(function (module, exports) { +'use strict'; + +var utils = exports; + + + + +utils.assert = minimalisticAssert; +utils.toArray = utils_1.toArray; +utils.zero2 = utils_1.zero2; +utils.toHex = utils_1.toHex; +utils.encode = utils_1.encode; + +// Represent num in a w-NAF form +function getNAF(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + naf.fill(0); + + var ws = 1 << (w + 1); + var k = num.clone(); + + for (var i = 0; i < naf.length; i++) { + var z; + var mod = k.andln(ws - 1); + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + + naf[i] = z; + k.iushrn(1); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [], + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; + +function cachedProperty(obj, name, computer) { + var key = '_' + name; + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : + this[key] = computer.call(this); + }; +} +utils.cachedProperty = cachedProperty; + +function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : + bytes; +} +utils.parseBytes = parseBytes; + +function intFromLE(bytes) { + return new (bn_js_lib_bn_default())(bytes, 'hex', 'le'); +} +utils.intFromLE = intFromLE; +}); + +'use strict'; + + + +var getNAF = utils_1$1.getNAF; +var getJSF = utils_1$1.getJSF; +var assert$1 = utils_1$1.assert; + +function BaseCurve(type, conf) { + this.type = type; + this.p = new (bn_js_lib_bn_default())(conf.p, 16); + + // Use Montgomery, when there is no fast reduction for the prime + this.red = conf.prime ? bn_js_lib_bn_default().red(conf.prime) : bn_js_lib_bn_default().mont(this.p); + + // Useful for many curves + this.zero = new (bn_js_lib_bn_default())(0).toRed(this.red); + this.one = new (bn_js_lib_bn_default())(1).toRed(this.red); + this.two = new (bn_js_lib_bn_default())(2).toRed(this.red); + + // Curve configuration, optional + this.n = conf.n && new (bn_js_lib_bn_default())(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + + // Temporary arrays + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); + + this._bitLength = this.n ? this.n.bitLength() : 0; + + // Generalized Greg Maxwell's trick + var adjustCount = this.n && this.p.div(this.n); + if (!adjustCount || adjustCount.cmpn(100) > 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} +var base = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + assert$1(p.precomputed); + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1, this._bitLength); + var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; + + // Translate into more windowed form + var repr = []; + var j; + var nafW; + for (j = 0; j < naf.length; j += doubles.step) { + nafW = 0; + for (var l = j + doubles.step - 1; l >= j; l--) + nafW = (nafW << 1) + naf[l]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (j = 0; j < repr.length; j++) { + nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w, this._bitLength); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var l = 0; i >= 0 && naf[i] === 0; i--) + l++; + if (i >= 0) + l++; + acc = acc.dblp(l); + + if (i < 0) + break; + var z = naf[i]; + assert$1(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len, + jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + var i; + var j; + var p; + for (i = 0; i < len; i++) { + p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); + naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b], /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3, /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (j = 0; j < len; j++) { + var z = tmp[j]; + p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (i = 0; i < len; i++) + wnd[i] = null; + + if (jacobianResult) + return acc; + else + return acc.toP(); +}; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} +BaseCurve.BasePoint = BasePoint; + +BasePoint.prototype.eq = function eq(/*other*/) { + throw new Error('Not implemented'); +}; + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + bytes = utils_1$1.toArray(bytes, enc); + + var len = this.p.byteLength(); + + // uncompressed, hybrid-odd, hybrid-even + if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && + bytes.length - 1 === 2 * len) { + if (bytes[0] === 0x06) + assert$1(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 0x07) + assert$1(bytes[bytes.length - 1] % 2 === 1); + + var res = this.point(bytes.slice(1, 1 + len), + bytes.slice(1 + len, 1 + 2 * len)); + + return res; + } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && + bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); + } + throw new Error('Unknown point format'); +}; + +BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); +}; + +BasePoint.prototype._encode = function _encode(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray('be', len); + + if (compact) + return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); + + return [ 0x04 ].concat(x, this.getY().toArray('be', len)); +}; + +BasePoint.prototype.encode = function encode(enc, compact) { + return utils_1$1.encode(this._encode(compact), enc); +}; + +BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null, + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) + return false; + + var doubles = this.precomputed.doubles; + if (!doubles) + return false; + + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles, + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res, + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; + +var inherits_browser = createCommonjsModule(function (module) { +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; +} +}); + +'use strict'; + + + + + + +var assert$2 = utils_1$1.assert; + +function ShortCurve(conf) { + base.call(this, 'short', conf); + + this.a = new (bn_js_lib_bn_default())(conf.a, 16).toRed(this.red); + this.b = new (bn_js_lib_bn_default())(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; + + // If the curve is endomorphic, precalculate beta and lambda + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +inherits_browser(ShortCurve, base); +var short_1 = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + + // Compute beta and lambda, that lambda * P = (beta * Px; Py) + var beta; + var lambda; + if (conf.beta) { + beta = new (bn_js_lib_bn_default())(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + // Choose the smallest beta + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new (bn_js_lib_bn_default())(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert$2(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + + // Get basis vectors, used for balanced length-two representation + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new (bn_js_lib_bn_default())(vec.a, 16), + b: new (bn_js_lib_bn_default())(vec.b, 16), + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis, + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : bn_js_lib_bn_default().mont(num); + var tinv = new (bn_js_lib_bn_default())(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + + var s = new (bn_js_lib_bn_default())(3).toRed(red).redNeg().redSqrt().redMul(tinv); + + var l1 = ntinv.redAdd(s).fromRed(); + var l2 = ntinv.redSub(s).fromRed(); + return [ l1, l2 ]; +}; + +ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + + // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + var u = lambda; + var v = this.n.clone(); + var x1 = new (bn_js_lib_bn_default())(1); + var y1 = new (bn_js_lib_bn_default())(0); + var x2 = new (bn_js_lib_bn_default())(0); + var y2 = new (bn_js_lib_bn_default())(1); + + // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + var a0; + var b0; + // First vector + var a1; + var b1; + // Second vector + var a2; + var b2; + + var prevR; + var i = 0; + var r; + var x; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + r = v.sub(q.mul(u)); + x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + prevR = r; + + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r.neg(); + b2 = x; + + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + + // Normalize signs + if (a1.negative) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.negative) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 }, + ]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + + // Calculate answer + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1: k1, k2: k2 }; +}; + +ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new (bn_js_lib_bn_default())(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) + return true; + + var x = point.x; + var y = point.y; + + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = + function _endoWnafMulAdd(points, coeffs, jacobianResult) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + var p = points[i]; + var beta = p._getBeta(); + + if (split.k1.negative) { + split.k1.ineg(); + p = p.neg(true); + } + if (split.k2.negative) { + split.k2.ineg(); + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); + + // Clean-up references to points and coefficients + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; + }; + +function Point(curve, x, y, isRed) { + base.BasePoint.call(this, curve, 'affine'); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new (bn_js_lib_bn_default())(x, 16); + this.y = new (bn_js_lib_bn_default())(y, 16); + // Force redgomery representation when loading from JSON + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +inherits_browser(Point, base.BasePoint); + +ShortCurve.prototype.point = function point(x, y, isRed) { + return new Point(this, x, y, isRed); +}; + +ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); +}; + +Point.prototype._getBeta = function _getBeta() { + if (!this.curve.endo) + return; + + var pre = this.precomputed; + if (pre && pre.beta) + return pre.beta; + + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (pre) { + var curve = this.curve; + var endoMul = function(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + }; + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul), + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul), + }, + }; + } + return beta; +}; + +Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) + return [ this.x, this.y ]; + + return [ this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1), + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1), + }, + } ]; +}; + +Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === 'string') + obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) + return res; + + function obj2point(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [ res ].concat(pre.doubles.points.map(obj2point)), + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [ res ].concat(pre.naf.points.map(obj2point)), + }, + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) + return p; + + // P + O = P + if (p.inf) + return this; + + // P + P = 2P + if (this.eq(p)) + return this.dbl(); + + // P + (-P) = O + if (this.neg().eq(p)) + return this.curve.point(null, null); + + // P + Q = O + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + + // 2P = O + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + + var a = this.curve.a; + + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new (bn_js_lib_bn_default())(k, 16); + if (this.isInfinity()) + return this; + else if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else if (this.curve.endo) + return this.curve._endoWnafMulAdd([ this ], [ k ]); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs, true); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2, true); +}; + +Point.prototype.eq = function eq(p) { + return this === p || + this.inf === p.inf && + (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); +}; + +Point.prototype.neg = function neg(_precompute) { + if (this.inf) + return this; + + var res = this.curve.point(this.x, this.y.redNeg()); + if (_precompute && this.precomputed) { + var pre = this.precomputed; + var negate = function(p) { + return p.neg(); + }; + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate), + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate), + }, + }; + } + return res; +}; + +Point.prototype.toJ = function toJ() { + if (this.inf) + return this.curve.jpoint(null, null, null); + + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; +}; + +function JPoint(curve, x, y, z) { + base.BasePoint.call(this, curve, 'jacobian'); + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new (bn_js_lib_bn_default())(0); + } else { + this.x = new (bn_js_lib_bn_default())(x, 16); + this.y = new (bn_js_lib_bn_default())(y, 16); + this.z = new (bn_js_lib_bn_default())(z, 16); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + + this.zOne = this.z === this.curve.one; +} +inherits_browser(JPoint, base.BasePoint); + +ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); +}; + +JPoint.prototype.toP = function toP() { + if (this.isInfinity()) + return this.curve.point(null, null); + + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + + return this.curve.point(ax, ay); +}; + +JPoint.prototype.neg = function neg() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; + +JPoint.prototype.add = function add(p) { + // O + P = P + if (this.isInfinity()) + return p; + + // P + O = P + if (p.isInfinity()) + return this; + + // 12M + 4S + 7A + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) + return p.toJ(); + + // P + O = P + if (p.isInfinity()) + return this; + + // 8M + 3S + 7A + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + + var i; + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + for (i = 0; i < pow; i++) + r = r.dbl(); + return r; + } + + // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + var a = this.curve.a; + var tinv = this.curve.tinv; + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + // Reuse results + var jyd = jy.redAdd(jy); + for (i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) + jz4 = jz4.redMul(jyd4); + + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 14A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // T = M ^ 2 - 2*S + var t = m.redSqr().redISub(s).redISub(s); + + // 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2*Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-dbl-2009-l + // 2M + 5S + 13A + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = B^2 + var c = b.redSqr(); + // D = 2 * ((X1 + B)^2 - A - C) + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + // E = 3 * A + var e = a.redAdd(a).redIAdd(a); + // F = E^2 + var f = e.redSqr(); + + // 8 * C + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + + // X3 = F - 2 * D + nx = f.redISub(d).redISub(d); + // Y3 = E * (D - X3) - 8 * C + ny = e.redMul(d.redISub(nx)).redISub(c8); + // Z3 = 2 * Y1 * Z1 + nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 15A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + // T = M^2 - 2 * S + var t = m.redSqr().redISub(s).redISub(s); + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2 * Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + + // delta = Z1^2 + var delta = this.z.redSqr(); + // gamma = Y1^2 + var gamma = this.y.redSqr(); + // beta = X1 * gamma + var beta = this.x.redMul(gamma); + // alpha = 3 * (X1 - delta) * (X1 + delta) + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + // X3 = alpha^2 - 8 * beta + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + // Z3 = (Y1 + Z1)^2 - gamma - delta + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; + + // 4M + 6S + 10A + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // ZZ = Z1^2 + var zz = this.z.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // M = 3 * XX + a * ZZ2; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // MM = M^2 + var mm = m.redSqr(); + // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); + // EE = E^2 + var ee = e.redSqr(); + // T = 16*YYYY + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + // U = (M + E)^2 - MM - EE - T + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + // X3 = 4 * (X1 * EE - 4 * YY * U) + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + // Z3 = (Z1 + E)^2 - ZZ - EE + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new (bn_js_lib_bn_default())(k, kbase); + + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') + return this.eq(p.toJ()); + + if (this === p) + return true; + + // x1 * z2^2 == x2 * z1^2 + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + + // y1 * z2^3 == y2 * z1^3 + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.eqXToP = function eqXToP(x) { + var zs = this.z.redSqr(); + var rx = x.toRed(this.curve.red).redMul(zs); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(zs); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +var curve_1 = createCommonjsModule(function (module, exports) { +'use strict'; + +var curve = exports; + +curve.base = base; +curve.short = short_1; +curve.mont = /*RicMoo:ethers:require(./mont)*/(null); +curve.edwards = /*RicMoo:ethers:require(./edwards)*/(null); +}); + +var curves_1 = createCommonjsModule(function (module, exports) { +'use strict'; + +var curves = exports; + + + + + +var assert = utils_1$1.assert; + +function PresetCurve(options) { + if (options.type === 'short') + this.curve = new curve_1.short(options); + else if (options.type === 'edwards') + this.curve = new curve_1.edwards(options); + else + this.curve = new curve_1.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); +} +curves.PresetCurve = PresetCurve; + +function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve, + }); + return curve; + }, + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: (hash_default()).sha256, + gRed: false, + g: [ + '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', + '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811', + ], +}); + +defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: (hash_default()).sha256, + gRed: false, + g: [ + 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', + 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34', + ], +}); + +defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: (hash_default()).sha256, + gRed: false, + g: [ + '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5', + ], +}); + +defineCurve('p384', { + type: 'short', + prime: null, + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 ffffffff', + a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 fffffffc', + b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', + n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', + hash: (hash_default()).sha384, + gRed: false, + g: [ + 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + + '5502f25d bf55296c 3a545e38 72760ab7', + '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f', + ], +}); + +defineCurve('p521', { + type: 'short', + prime: null, + p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff', + a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff fffffffc', + b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', + n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', + hash: (hash_default()).sha512, + gRed: false, + g: [ + '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', + '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + + '3fad0761 353c7086 a272c240 88be9476 9fd16650', + ], +}); + +defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '1', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: (hash_default()).sha256, + gRed: false, + g: [ + '9', + ], +}); + +defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: (hash_default()).sha256, + gRed: false, + g: [ + '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', + + // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658', + ], +}); + +var pre; +try { + pre = /*RicMoo:ethers:require(./precomputed/secp256k1)*/(null).crash(); +} catch (e) { + pre = undefined; +} + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: (hash_default()).sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3', + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15', + }, + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + pre, + ], +}); +}); + +'use strict'; + + + + + +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; + + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + + this._reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + + var entropy = utils_1.toArray(options.entropy, options.entropyEnc || 'hex'); + var nonce = utils_1.toArray(options.nonce, options.nonceEnc || 'hex'); + var pers = utils_1.toArray(options.pers, options.persEnc || 'hex'); + minimalisticAssert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + this._init(entropy, nonce, pers); +} +var hmacDrbg = HmacDRBG; + +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + this._reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +HmacDRBG.prototype._hmac = function hmac() { + return new (hash_default()).hmac(this.hash, this.K); +}; + +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac() + .update(this.V) + .update([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils_1.toArray(entropy, entropyEnc); + add = utils_1.toArray(add, addEnc); + + minimalisticAssert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._update(entropy.concat(add || [])); + this._reseed = 1; +}; + +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this._reseed > this.reseedInterval) + throw new Error('Reseed is required'); + + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } + + // Optional additional data + if (add) { + add = utils_1.toArray(add, addEnc || 'hex'); + this._update(add); + } + + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + this._update(add); + this._reseed++; + return utils_1.encode(res, enc); +}; + +'use strict'; + + + +var assert$3 = utils_1$1.assert; + +function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; + + // KeyPair(ec, { priv: ..., pub: ... }) + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); +} +var key = KeyPair; + +KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + + return new KeyPair(ec, { + pub: pub, + pubEnc: enc, + }); +}; + +KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + + return new KeyPair(ec, { + priv: priv, + privEnc: enc, + }); +}; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + + if (pub.isInfinity()) + return { result: false, reason: 'Invalid public key' }; + if (!pub.validate()) + return { result: false, reason: 'Public key is not a point' }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: 'Public key * N != O' }; + + return { result: true, reason: null }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + + if (!enc) + return this.pub; + + return this.pub.encode(enc, compact); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') + return this.priv.toString(16, 2); + else + return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { + this.priv = new (bn_js_lib_bn_default())(key, enc || 16); + + // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + this.priv = this.priv.umod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + // Montgomery points only have an `x` coordinate. + // Weierstrass/Edwards points on the other hand have both `x` and + // `y` coordinates. + if (this.ec.curve.type === 'mont') { + assert$3(key.x, 'Need x coordinate'); + } else if (this.ec.curve.type === 'short' || + this.ec.curve.type === 'edwards') { + assert$3(key.x && key.y, 'Need both x and y coordinate'); + } + this.pub = this.ec.curve.point(key.x, key.y); + return; + } + this.pub = this.ec.curve.decodePoint(key, enc); +}; + +// ECDH +KeyPair.prototype.derive = function derive(pub) { + if(!pub.validate()) { + assert$3(pub.validate(), 'public point not validated'); + } + return pub.mul(this.priv).getX(); +}; + +// ECDSA +KeyPair.prototype.sign = function sign(msg, enc, options) { + return this.ec.sign(msg, this, enc, options); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; + +'use strict'; + + + + +var assert$4 = utils_1$1.assert; + +function Signature(options, enc) { + if (options instanceof Signature) + return options; + + if (this._importDER(options, enc)) + return; + + assert$4(options.r && options.s, 'Signature without r or s'); + this.r = new (bn_js_lib_bn_default())(options.r, 16); + this.s = new (bn_js_lib_bn_default())(options.s, 16); + if (options.recoveryParam === undefined) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; +} +var signature = Signature; + +function Position() { + this.place = 0; +} + +function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 0x80)) { + return initial; + } + var octetLen = initial & 0xf; + + // Indefinite length or overflow + if (octetLen === 0 || octetLen > 4) { + return false; + } + + var val = 0; + for (var i = 0, off = p.place; i < octetLen; i++, off++) { + val <<= 8; + val |= buf[off]; + val >>>= 0; + } + + // Leading zeroes + if (val <= 0x7f) { + return false; + } + + p.place = off; + return val; +} + +function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); +} + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils_1$1.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 0x30) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if ((len + p.place) !== data.length) { + return false; + } + if (data[p.place++] !== 0x02) { + return false; + } + var rlen = getLength(data, p); + if (rlen === false) { + return false; + } + var r = data.slice(p.place, rlen + p.place); + p.place += rlen; + if (data[p.place++] !== 0x02) { + return false; + } + var slen = getLength(data, p); + if (slen === false) { + return false; + } + if (data.length !== slen + p.place) { + return false; + } + var s = data.slice(p.place, slen + p.place); + if (r[0] === 0) { + if (r[1] & 0x80) { + r = r.slice(1); + } else { + // Leading zeroes + return false; + } + } + if (s[0] === 0) { + if (s[1] & 0x80) { + s = s.slice(1); + } else { + // Leading zeroes + return false; + } + } + + this.r = new (bn_js_lib_bn_default())(r); + this.s = new (bn_js_lib_bn_default())(s); + this.recoveryParam = null; + + return true; +}; + +function constructLength(arr, len) { + if (len < 0x80) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 0x80); + while (--octets) { + arr.push((len >>> (octets << 3)) & 0xff); + } + arr.push(len); +} + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + r = rmPadding(r); + s = rmPadding(s); + + while (!s[0] && !(s[1] & 0x80)) { + s = s.slice(1); + } + var arr = [ 0x02 ]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(0x02); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [ 0x30 ]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils_1$1.encode(res, enc); +}; + +'use strict'; + + + + + +var rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); }); +var assert$5 = utils_1$1.assert; + + + + +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert$5(Object.prototype.hasOwnProperty.call(curves_1, options), + 'Unknown curve ' + options); + + options = curves_1[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + if (options instanceof curves_1.PresetCurve) + options = { curve: options }; + + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.ushrn(1); + this.g = this.curve.g; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +var elliptic_ec = EC; + +EC.prototype.keyPair = function keyPair(options) { + return new key(this, options); +}; + +EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return key.fromPrivate(this, priv, enc); +}; + +EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return key.fromPublic(this, pub, enc); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + + // Instantiate Hmac_DRBG + var drbg = new hmacDrbg({ + hash: this.hash, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + entropy: options.entropy || rand(this.hash.hmacStrength), + entropyEnc: options.entropy && options.entropyEnc || 'utf8', + nonce: this.n.toArray(), + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new (bn_js_lib_bn_default())(2)); + for (;;) { + var priv = new (bn_js_lib_bn_default())(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + + priv.iaddn(1); + return this.keyFromPrivate(priv); + } +}; + +EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) + msg = msg.ushrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; +}; + +EC.prototype.sign = function sign(msg, key, enc, options) { + if (typeof enc === 'object') { + options = enc; + enc = null; + } + if (!options) + options = {}; + + key = this.keyFromPrivate(key, enc); + msg = this._truncateToN(new (bn_js_lib_bn_default())(msg, 16)); + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray('be', bytes); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray('be', bytes); + + // Instantiate Hmac_DRBG + var drbg = new hmacDrbg({ + hash: this.hash, + entropy: bkey, + nonce: nonce, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new (bn_js_lib_bn_default())(1)); + + for (var iter = 0; ; iter++) { + var k = options.k ? + options.k(iter) : + new (bn_js_lib_bn_default())(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + + var kpX = kp.getX(); + var r = kpX.umod(this.n); + if (r.cmpn(0) === 0) + continue; + + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); + s = s.umod(this.n); + if (s.cmpn(0) === 0) + continue; + + var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | + (kpX.cmp(r) !== 0 ? 2 : 0); + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + + return new signature({ r: r, s: s, recoveryParam: recoveryParam }); + } +}; + +EC.prototype.verify = function verify(msg, signature$1, key, enc) { + msg = this._truncateToN(new (bn_js_lib_bn_default())(msg, 16)); + key = this.keyFromPublic(key, enc); + signature$1 = new signature(signature$1, 'hex'); + + // Perform primitive values validation + var r = signature$1.r; + var s = signature$1.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) + return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) + return false; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r).umod(this.n); + var p; + + if (!this.curve._maxwellTrick) { + p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().umod(this.n).cmp(r) === 0; + } + + // NOTE: Greg Maxwell's trick, inspired by: + // https://git.io/vad3K + + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + // Compare `p.x` of Jacobian point with `r`, + // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the + // inverse of `p.z^2` + return p.eqXToP(r); +}; + +EC.prototype.recoverPubKey = function(msg, signature$1, j, enc) { + assert$5((3 & j) === j, 'The recovery param is more than two bits'); + signature$1 = new signature(signature$1, enc); + + var n = this.n; + var e = new (bn_js_lib_bn_default())(msg); + var r = signature$1.r; + var s = signature$1.s; + + // A set LSB signifies that the y-coordinate is odd + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) + throw new Error('Unable to find sencond key candinate'); + + // 1.1. Let x = r + jn. + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + + var rInv = signature$1.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + + // 1.6.1 Compute Q = r^-1 (sR - eG) + // Q = r^-1 (sR + -eG) + return this.g.mulAdd(s1, r, s2); +}; + +EC.prototype.getKeyRecoveryParam = function(e, signature$1, Q, enc) { + signature$1 = new signature(signature$1, enc); + if (signature$1.recoveryParam !== null) + return signature$1.recoveryParam; + + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature$1, i); + } catch (e) { + continue; + } + + if (Qprime.eq(Q)) + return i; + } + throw new Error('Unable to find valid recovery factor'); +}; + +var elliptic_1 = createCommonjsModule(function (module, exports) { +'use strict'; + +var elliptic = exports; + +elliptic.version = /*RicMoo:ethers*/{ version: "6.5.4" }.version; +elliptic.utils = utils_1$1; +elliptic.rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); }); +elliptic.curve = curve_1; +elliptic.curves = curves_1; + +// Protocols +elliptic.ec = elliptic_ec; +elliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null); +}); + +var EC$1 = elliptic_1.ec; + + +//# sourceMappingURL=elliptic.js.map + +;// CONCATENATED MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/_version.js +const signing_key_lib_esm_version_version = "signing-key/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/index.js + + + + + + +const signing_key_lib_esm_logger = new lib_esm_Logger(signing_key_lib_esm_version_version); +let _curve = null; +function getCurve() { + if (!_curve) { + _curve = new EC$1("secp256k1"); + } + return _curve; +} +class SigningKey { + constructor(privateKey) { + lib_esm_defineReadOnly(this, "curve", "secp256k1"); + lib_esm_defineReadOnly(this, "privateKey", lib_esm_hexlify(privateKey)); + if (lib_esm_hexDataLength(this.privateKey) !== 32) { + signing_key_lib_esm_logger.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + } + const keyPair = getCurve().keyFromPrivate(lib_esm_arrayify(this.privateKey)); + lib_esm_defineReadOnly(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); + lib_esm_defineReadOnly(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); + lib_esm_defineReadOnly(this, "_isSigningKey", true); + } + _addPoint(other) { + const p0 = getCurve().keyFromPublic(lib_esm_arrayify(this.publicKey)); + const p1 = getCurve().keyFromPublic(lib_esm_arrayify(other)); + return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex"); + } + signDigest(digest) { + const keyPair = getCurve().keyFromPrivate(lib_esm_arrayify(this.privateKey)); + const digestBytes = lib_esm_arrayify(digest); + if (digestBytes.length !== 32) { + signing_key_lib_esm_logger.throwArgumentError("bad digest length", "digest", digest); + } + const signature = keyPair.sign(digestBytes, { canonical: true }); + return lib_esm_splitSignature({ + recoveryParam: signature.recoveryParam, + r: lib_esm_hexZeroPad("0x" + signature.r.toString(16), 32), + s: lib_esm_hexZeroPad("0x" + signature.s.toString(16), 32), + }); + } + computeSharedSecret(otherKey) { + const keyPair = getCurve().keyFromPrivate(lib_esm_arrayify(this.privateKey)); + const otherKeyPair = getCurve().keyFromPublic(lib_esm_arrayify(computePublicKey(otherKey))); + return lib_esm_hexZeroPad("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32); + } + static isSigningKey(value) { + return !!(value && value._isSigningKey); + } +} +function lib_esm_recoverPublicKey(digest, signature) { + const sig = splitSignature(signature); + const rs = { r: arrayify(sig.r), s: arrayify(sig.s) }; + return "0x" + getCurve().recoverPubKey(arrayify(digest), rs, sig.recoveryParam).encode("hex", false); +} +function computePublicKey(key, compressed) { + const bytes = lib_esm_arrayify(key); + if (bytes.length === 32) { + const signingKey = new SigningKey(bytes); + if (compressed) { + return "0x" + getCurve().keyFromPrivate(bytes).getPublic(true, "hex"); + } + return signingKey.publicKey; + } + else if (bytes.length === 33) { + if (compressed) { + return lib_esm_hexlify(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(false, "hex"); + } + else if (bytes.length === 65) { + if (!compressed) { + return lib_esm_hexlify(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(true, "hex"); + } + return signing_key_lib_esm_logger.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/transactions/lib.esm/_version.js +const transactions_lib_esm_version_version = "transactions/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/transactions/lib.esm/index.js + + + + + + + + + + + +const transactions_lib_esm_logger = new lib_esm_Logger(transactions_lib_esm_version_version); +var TransactionTypes; +(function (TransactionTypes) { + TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy"; + TransactionTypes[TransactionTypes["eip2930"] = 1] = "eip2930"; + TransactionTypes[TransactionTypes["eip1559"] = 2] = "eip1559"; +})(TransactionTypes || (TransactionTypes = {})); +; +/////////////////////////////// +function handleAddress(value) { + if (value === "0x") { + return null; + } + return getAddress(value); +} +function handleNumber(value) { + if (value === "0x") { + return Zero; + } + return BigNumber.from(value); +} +// Legacy Transaction Fields +const transactionFields = [ + { name: "nonce", maxLength: 32, numeric: true }, + { name: "gasPrice", maxLength: 32, numeric: true }, + { name: "gasLimit", maxLength: 32, numeric: true }, + { name: "to", length: 20 }, + { name: "value", maxLength: 32, numeric: true }, + { name: "data" }, +]; +const allowedTransactionKeys = { + chainId: true, data: true, gasLimit: true, gasPrice: true, nonce: true, to: true, type: true, value: true +}; +function computeAddress(key) { + const publicKey = computePublicKey(key); + return lib_esm_getAddress(lib_esm_hexDataSlice(lib_esm_keccak256(lib_esm_hexDataSlice(publicKey, 1)), 12)); +} +function lib_esm_recoverAddress(digest, signature) { + return computeAddress(recoverPublicKey(arrayify(digest), signature)); +} +function formatNumber(value, name) { + const result = lib_esm_stripZeros(lib_esm_bignumber_BigNumber.from(value).toHexString()); + if (result.length > 32) { + transactions_lib_esm_logger.throwArgumentError("invalid length for " + name, ("transaction:" + name), value); + } + return result; +} +function accessSetify(addr, storageKeys) { + return { + address: lib_esm_getAddress(addr), + storageKeys: (storageKeys || []).map((storageKey, index) => { + if (lib_esm_hexDataLength(storageKey) !== 32) { + transactions_lib_esm_logger.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey); + } + return storageKey.toLowerCase(); + }) + }; +} +function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + if (set.length > 2) { + transactions_lib_esm_logger.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set); + } + return accessSetify(set[0], set[1]); + } + return accessSetify(set.address, set.storageKeys); + }); + } + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; +} +function formatAccessList(value) { + return accessListify(value).map((set) => [set.address, set.storageKeys]); +} +function _serializeEip1559(transaction, signature) { + // If there is an explicit gasPrice, make sure it matches the + // EIP-1559 fees; otherwise they may not understand what they + // think they are setting in terms of fee. + if (transaction.gasPrice != null) { + const gasPrice = lib_esm_bignumber_BigNumber.from(transaction.gasPrice); + const maxFeePerGas = lib_esm_bignumber_BigNumber.from(transaction.maxFeePerGas || 0); + if (!gasPrice.eq(maxFeePerGas)) { + transactions_lib_esm_logger.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + gasPrice, maxFeePerGas + }); + } + } + const fields = [ + formatNumber(transaction.chainId || 0, "chainId"), + formatNumber(transaction.nonce || 0, "nonce"), + formatNumber(transaction.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(transaction.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(transaction.gasLimit || 0, "gasLimit"), + ((transaction.to != null) ? lib_esm_getAddress(transaction.to) : "0x"), + formatNumber(transaction.value || 0, "value"), + (transaction.data || "0x"), + (formatAccessList(transaction.accessList || [])) + ]; + if (signature) { + const sig = lib_esm_splitSignature(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push(lib_esm_stripZeros(sig.r)); + fields.push(lib_esm_stripZeros(sig.s)); + } + return hexConcat(["0x02", lib_esm_encode(fields)]); +} +function _serializeEip2930(transaction, signature) { + const fields = [ + formatNumber(transaction.chainId || 0, "chainId"), + formatNumber(transaction.nonce || 0, "nonce"), + formatNumber(transaction.gasPrice || 0, "gasPrice"), + formatNumber(transaction.gasLimit || 0, "gasLimit"), + ((transaction.to != null) ? lib_esm_getAddress(transaction.to) : "0x"), + formatNumber(transaction.value || 0, "value"), + (transaction.data || "0x"), + (formatAccessList(transaction.accessList || [])) + ]; + if (signature) { + const sig = lib_esm_splitSignature(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push(lib_esm_stripZeros(sig.r)); + fields.push(lib_esm_stripZeros(sig.s)); + } + return hexConcat(["0x01", lib_esm_encode(fields)]); +} +// Legacy Transactions and EIP-155 +function _serialize(transaction, signature) { + checkProperties(transaction, allowedTransactionKeys); + const raw = []; + transactionFields.forEach(function (fieldInfo) { + let value = transaction[fieldInfo.name] || ([]); + const options = {}; + if (fieldInfo.numeric) { + options.hexPad = "left"; + } + value = lib_esm_arrayify(lib_esm_hexlify(value, options)); + // Fixed-width field + if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { + transactions_lib_esm_logger.throwArgumentError("invalid length for " + fieldInfo.name, ("transaction:" + fieldInfo.name), value); + } + // Variable-width (with a maximum) + if (fieldInfo.maxLength) { + value = lib_esm_stripZeros(value); + if (value.length > fieldInfo.maxLength) { + transactions_lib_esm_logger.throwArgumentError("invalid length for " + fieldInfo.name, ("transaction:" + fieldInfo.name), value); + } + } + raw.push(lib_esm_hexlify(value)); + }); + let chainId = 0; + if (transaction.chainId != null) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = transaction.chainId; + if (typeof (chainId) !== "number") { + transactions_lib_esm_logger.throwArgumentError("invalid transaction.chainId", "transaction", transaction); + } + } + else if (signature && !isBytesLike(signature) && signature.v > 28) { + // No chainId provided, but the signature is signing with EIP-155; derive chainId + chainId = Math.floor((signature.v - 35) / 2); + } + // We have an EIP-155 transaction (chainId was specified and non-zero) + if (chainId !== 0) { + raw.push(lib_esm_hexlify(chainId)); // @TODO: hexValue? + raw.push("0x"); + raw.push("0x"); + } + // Requesting an unsigned transaction + if (!signature) { + return lib_esm_encode(raw); + } + // The splitSignature will ensure the transaction has a recoveryParam in the + // case that the signTransaction function only adds a v. + const sig = lib_esm_splitSignature(signature); + // We pushed a chainId and null r, s on for hashing only; remove those + let v = 27 + sig.recoveryParam; + if (chainId !== 0) { + raw.pop(); + raw.pop(); + raw.pop(); + v += chainId * 2 + 8; + // If an EIP-155 v (directly or indirectly; maybe _vs) was provided, check it! + if (sig.v > 28 && sig.v !== v) { + transactions_lib_esm_logger.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature); + } + } + else if (sig.v !== v) { + transactions_lib_esm_logger.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature); + } + raw.push(lib_esm_hexlify(v)); + raw.push(lib_esm_stripZeros(lib_esm_arrayify(sig.r))); + raw.push(lib_esm_stripZeros(lib_esm_arrayify(sig.s))); + return lib_esm_encode(raw); +} +function serialize(transaction, signature) { + // Legacy and EIP-155 Transactions + if (transaction.type == null || transaction.type === 0) { + if (transaction.accessList != null) { + transactions_lib_esm_logger.throwArgumentError("untyped transactions do not support accessList; include type: 1", "transaction", transaction); + } + return _serialize(transaction, signature); + } + // Typed Transactions (EIP-2718) + switch (transaction.type) { + case 1: + return _serializeEip2930(transaction, signature); + case 2: + return _serializeEip1559(transaction, signature); + default: + break; + } + return transactions_lib_esm_logger.throwError(`unsupported transaction type: ${transaction.type}`, lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "serializeTransaction", + transactionType: transaction.type + }); +} +function _parseEipSignature(tx, fields, serialize) { + try { + const recid = handleNumber(fields[0]).toNumber(); + if (recid !== 0 && recid !== 1) { + throw new Error("bad recid"); + } + tx.v = recid; + } + catch (error) { + transactions_lib_esm_logger.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); + } + tx.r = hexZeroPad(fields[1], 32); + tx.s = hexZeroPad(fields[2], 32); + try { + const digest = keccak256(serialize(tx)); + tx.from = lib_esm_recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v }); + } + catch (error) { } +} +function _parseEip1559(payload) { + const transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 9 && transaction.length !== 12) { + transactions_lib_esm_logger.throwArgumentError("invalid component count for transaction type: 2", "payload", hexlify(payload)); + } + const maxPriorityFeePerGas = handleNumber(transaction[2]); + const maxFeePerGas = handleNumber(transaction[3]); + const tx = { + type: 2, + chainId: handleNumber(transaction[0]).toNumber(), + nonce: handleNumber(transaction[1]).toNumber(), + maxPriorityFeePerGas: maxPriorityFeePerGas, + maxFeePerGas: maxFeePerGas, + gasPrice: null, + gasLimit: handleNumber(transaction[4]), + to: handleAddress(transaction[5]), + value: handleNumber(transaction[6]), + data: transaction[7], + accessList: accessListify(transaction[8]), + }; + // Unsigned EIP-1559 Transaction + if (transaction.length === 9) { + return tx; + } + tx.hash = keccak256(payload); + _parseEipSignature(tx, transaction.slice(9), _serializeEip1559); + return tx; +} +function _parseEip2930(payload) { + const transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 8 && transaction.length !== 11) { + transactions_lib_esm_logger.throwArgumentError("invalid component count for transaction type: 1", "payload", hexlify(payload)); + } + const tx = { + type: 1, + chainId: handleNumber(transaction[0]).toNumber(), + nonce: handleNumber(transaction[1]).toNumber(), + gasPrice: handleNumber(transaction[2]), + gasLimit: handleNumber(transaction[3]), + to: handleAddress(transaction[4]), + value: handleNumber(transaction[5]), + data: transaction[6], + accessList: accessListify(transaction[7]) + }; + // Unsigned EIP-2930 Transaction + if (transaction.length === 8) { + return tx; + } + tx.hash = keccak256(payload); + _parseEipSignature(tx, transaction.slice(8), _serializeEip2930); + return tx; +} +// Legacy Transactions and EIP-155 +function _parse(rawTransaction) { + const transaction = RLP.decode(rawTransaction); + if (transaction.length !== 9 && transaction.length !== 6) { + transactions_lib_esm_logger.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); + } + const tx = { + nonce: handleNumber(transaction[0]).toNumber(), + gasPrice: handleNumber(transaction[1]), + gasLimit: handleNumber(transaction[2]), + to: handleAddress(transaction[3]), + value: handleNumber(transaction[4]), + data: transaction[5], + chainId: 0 + }; + // Legacy unsigned transaction + if (transaction.length === 6) { + return tx; + } + try { + tx.v = BigNumber.from(transaction[6]).toNumber(); + } + catch (error) { + // @TODO: What makes snese to do? The v is too big + return tx; + } + tx.r = hexZeroPad(transaction[7], 32); + tx.s = hexZeroPad(transaction[8], 32); + if (BigNumber.from(tx.r).isZero() && BigNumber.from(tx.s).isZero()) { + // EIP-155 unsigned transaction + tx.chainId = tx.v; + tx.v = 0; + } + else { + // Signed Transaction + tx.chainId = Math.floor((tx.v - 35) / 2); + if (tx.chainId < 0) { + tx.chainId = 0; + } + let recoveryParam = tx.v - 27; + const raw = transaction.slice(0, 6); + if (tx.chainId !== 0) { + raw.push(hexlify(tx.chainId)); + raw.push("0x"); + raw.push("0x"); + recoveryParam -= tx.chainId * 2 + 8; + } + const digest = keccak256(RLP.encode(raw)); + try { + tx.from = lib_esm_recoverAddress(digest, { r: hexlify(tx.r), s: hexlify(tx.s), recoveryParam: recoveryParam }); + } + catch (error) { } + tx.hash = keccak256(rawTransaction); + } + tx.type = null; + return tx; +} +function lib_esm_parse(rawTransaction) { + const payload = arrayify(rawTransaction); + // Legacy and EIP-155 Transactions + if (payload[0] > 0x7f) { + return _parse(payload); + } + // Typed Transaction (EIP-2718) + switch (payload[0]) { + case 1: + return _parseEip2930(payload); + case 2: + return _parseEip1559(payload); + default: + break; + } + return transactions_lib_esm_logger.throwError(`unsupported transaction type: ${payload[0]}`, Logger.errors.UNSUPPORTED_OPERATION, { + operation: "parseTransaction", + transactionType: payload[0] + }); +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +const abstract_provider_lib_esm_version_version = "abstract-provider/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-provider/lib.esm/index.js + +var lib_esm_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + +const abstract_provider_lib_esm_logger = new lib_esm_Logger(abstract_provider_lib_esm_version_version); +; +; +//export type CallTransactionable = { +// call(transaction: TransactionRequest): Promise; +//}; +class ForkEvent extends (/* unused pure expression or super */ null && (Description)) { + static isForkEvent(value) { + return !!(value && value._isForkEvent); + } +} +class BlockForkEvent extends (/* unused pure expression or super */ null && (ForkEvent)) { + constructor(blockHash, expiry) { + if (!isHexString(blockHash, 32)) { + abstract_provider_lib_esm_logger.throwArgumentError("invalid blockHash", "blockHash", blockHash); + } + super({ + _isForkEvent: true, + _isBlockForkEvent: true, + expiry: (expiry || 0), + blockHash: blockHash + }); + } +} +class TransactionForkEvent extends (/* unused pure expression or super */ null && (ForkEvent)) { + constructor(hash, expiry) { + if (!isHexString(hash, 32)) { + abstract_provider_lib_esm_logger.throwArgumentError("invalid transaction hash", "hash", hash); + } + super({ + _isForkEvent: true, + _isTransactionForkEvent: true, + expiry: (expiry || 0), + hash: hash + }); + } +} +class TransactionOrderForkEvent extends (/* unused pure expression or super */ null && (ForkEvent)) { + constructor(beforeHash, afterHash, expiry) { + if (!isHexString(beforeHash, 32)) { + abstract_provider_lib_esm_logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash); + } + if (!isHexString(afterHash, 32)) { + abstract_provider_lib_esm_logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash); + } + super({ + _isForkEvent: true, + _isTransactionOrderForkEvent: true, + expiry: (expiry || 0), + beforeHash: beforeHash, + afterHash: afterHash + }); + } +} +/////////////////////////////// +// Exported Abstracts +class lib_esm_Provider { + constructor() { + abstract_provider_lib_esm_logger.checkAbstract(new.target, lib_esm_Provider); + lib_esm_defineReadOnly(this, "_isProvider", true); + } + getFeeData() { + return lib_esm_awaiter(this, void 0, void 0, function* () { + const { block, gasPrice } = yield resolveProperties({ + block: this.getBlock("latest"), + gasPrice: this.getGasPrice().catch((error) => { + // @TODO: Why is this now failing on Calaveras? + //console.log(error); + return null; + }) + }); + let lastBaseFeePerGas = null, maxFeePerGas = null, maxPriorityFeePerGas = null; + if (block && block.baseFeePerGas) { + // We may want to compute this more accurately in the future, + // using the formula "check if the base fee is correct". + // See: https://eips.ethereum.org/EIPS/eip-1559 + lastBaseFeePerGas = block.baseFeePerGas; + maxPriorityFeePerGas = lib_esm_bignumber_BigNumber.from("1500000000"); + maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); + } + return { lastBaseFeePerGas, maxFeePerGas, maxPriorityFeePerGas, gasPrice }; + }); + } + // Alias for "on" + addListener(eventName, listener) { + return this.on(eventName, listener); + } + // Alias for "off" + removeListener(eventName, listener) { + return this.off(eventName, listener); + } + static isProvider(value) { + return !!(value && value._isProvider); + } +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +const abstract_signer_lib_esm_version_version = "abstract-signer/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-signer/lib.esm/index.js + +var abstract_signer_lib_esm_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + +const abstract_signer_lib_esm_logger = new lib_esm_Logger(abstract_signer_lib_esm_version_version); +const lib_esm_allowedTransactionKeys = [ + "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" +]; +const forwardErrors = [ + lib_esm_Logger.errors.INSUFFICIENT_FUNDS, + lib_esm_Logger.errors.NONCE_EXPIRED, + lib_esm_Logger.errors.REPLACEMENT_UNDERPRICED, +]; +; +; +class lib_esm_Signer { + /////////////////// + // Sub-classes MUST call super + constructor() { + abstract_signer_lib_esm_logger.checkAbstract(new.target, lib_esm_Signer); + lib_esm_defineReadOnly(this, "_isSigner", true); + } + /////////////////// + // Sub-classes MAY override these + getBalance(blockTag) { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("getBalance"); + return yield this.provider.getBalance(this.getAddress(), blockTag); + }); + } + getTransactionCount(blockTag) { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("getTransactionCount"); + return yield this.provider.getTransactionCount(this.getAddress(), blockTag); + }); + } + // Populates "from" if unspecified, and estimates the gas for the transaction + estimateGas(transaction) { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("estimateGas"); + const tx = yield resolveProperties(this.checkTransaction(transaction)); + return yield this.provider.estimateGas(tx); + }); + } + // Populates "from" if unspecified, and calls with the transaction + call(transaction, blockTag) { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("call"); + const tx = yield resolveProperties(this.checkTransaction(transaction)); + return yield this.provider.call(tx, blockTag); + }); + } + // Populates all fields in a transaction, signs it and sends it to the network + sendTransaction(transaction) { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("sendTransaction"); + const tx = yield this.populateTransaction(transaction); + const signedTx = yield this.signTransaction(tx); + return yield this.provider.sendTransaction(signedTx); + }); + } + getChainId() { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("getChainId"); + const network = yield this.provider.getNetwork(); + return network.chainId; + }); + } + getGasPrice() { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("getGasPrice"); + return yield this.provider.getGasPrice(); + }); + } + getFeeData() { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("getFeeData"); + return yield this.provider.getFeeData(); + }); + } + resolveName(name) { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + this._checkProvider("resolveName"); + return yield this.provider.resolveName(name); + }); + } + // Checks a transaction does not contain invalid keys and if + // no "from" is provided, populates it. + // - does NOT require a provider + // - adds "from" is not present + // - returns a COPY (safe to mutate the result) + // By default called from: (overriding these prevents it) + // - call + // - estimateGas + // - populateTransaction (and therefor sendTransaction) + checkTransaction(transaction) { + for (const key in transaction) { + if (lib_esm_allowedTransactionKeys.indexOf(key) === -1) { + abstract_signer_lib_esm_logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); + } + } + const tx = shallowCopy(transaction); + if (tx.from == null) { + tx.from = this.getAddress(); + } + else { + // Make sure any provided address matches this signer + tx.from = Promise.all([ + Promise.resolve(tx.from), + this.getAddress() + ]).then((result) => { + if (result[0].toLowerCase() !== result[1].toLowerCase()) { + abstract_signer_lib_esm_logger.throwArgumentError("from address mismatch", "transaction", transaction); + } + return result[0]; + }); + } + return tx; + } + // Populates ALL keys for a transaction and checks that "from" matches + // this Signer. Should be used by sendTransaction but NOT by signTransaction. + // By default called from: (overriding these prevents it) + // - sendTransaction + // + // Notes: + // - We allow gasPrice for EIP-1559 as long as it matches maxFeePerGas + populateTransaction(transaction) { + return abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + const tx = yield resolveProperties(this.checkTransaction(transaction)); + if (tx.to != null) { + tx.to = Promise.resolve(tx.to).then((to) => abstract_signer_lib_esm_awaiter(this, void 0, void 0, function* () { + if (to == null) { + return null; + } + const address = yield this.resolveName(to); + if (address == null) { + abstract_signer_lib_esm_logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return address; + })); + // Prevent this error from causing an UnhandledPromiseException + tx.to.catch((error) => { }); + } + // Do not allow mixing pre-eip-1559 and eip-1559 properties + const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null); + if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { + abstract_signer_lib_esm_logger.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); + } + else if ((tx.type === 0 || tx.type === 1) && hasEip1559) { + abstract_signer_lib_esm_logger.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); + } + if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) { + // Fully-formed EIP-1559 transaction (skip getFeeData) + tx.type = 2; + } + else if (tx.type === 0 || tx.type === 1) { + // Explicit Legacy or EIP-2930 transaction + // Populate missing gasPrice + if (tx.gasPrice == null) { + tx.gasPrice = this.getGasPrice(); + } + } + else { + // We need to get fee data to determine things + const feeData = yield this.getFeeData(); + if (tx.type == null) { + // We need to auto-detect the intended type of this transaction... + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + // Upgrade transaction from null to eip-1559 + tx.type = 2; + if (tx.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + const gasPrice = tx.gasPrice; + delete tx.gasPrice; + tx.maxFeePerGas = gasPrice; + tx.maxPriorityFeePerGas = gasPrice; + } + else { + // Populate missing fee data + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + // ...but they are trying to use EIP-1559 properties + if (hasEip1559) { + abstract_signer_lib_esm_logger.throwError("network does not support EIP-1559", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "populateTransaction" + }); + } + // Populate missing fee data + if (tx.gasPrice == null) { + tx.gasPrice = feeData.gasPrice; + } + // Explicitly set untyped transaction to legacy + tx.type = 0; + } + else { + // getFeeData has failed us. + abstract_signer_lib_esm_logger.throwError("failed to get consistent fee data", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signer.getFeeData" + }); + } + } + else if (tx.type === 2) { + // Explicitly using EIP-1559 + // Populate missing fee data + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + if (tx.nonce == null) { + tx.nonce = this.getTransactionCount("pending"); + } + if (tx.gasLimit == null) { + tx.gasLimit = this.estimateGas(tx).catch((error) => { + if (forwardErrors.indexOf(error.code) >= 0) { + throw error; + } + return abstract_signer_lib_esm_logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", lib_esm_Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error: error, + tx: tx + }); + }); + } + if (tx.chainId == null) { + tx.chainId = this.getChainId(); + } + else { + tx.chainId = Promise.all([ + Promise.resolve(tx.chainId), + this.getChainId() + ]).then((results) => { + if (results[1] !== 0 && results[0] !== results[1]) { + abstract_signer_lib_esm_logger.throwArgumentError("chainId address mismatch", "transaction", transaction); + } + return results[0]; + }); + } + return yield resolveProperties(tx); + }); + } + /////////////////// + // Sub-classes SHOULD leave these alone + _checkProvider(operation) { + if (!this.provider) { + abstract_signer_lib_esm_logger.throwError("missing provider", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: (operation || "_checkProvider") + }); + } + } + static isSigner(value) { + return !!(value && value._isSigner); + } +} +class VoidSigner extends (/* unused pure expression or super */ null && (lib_esm_Signer)) { + constructor(address, provider) { + super(); + defineReadOnly(this, "address", address); + defineReadOnly(this, "provider", provider || null); + } + getAddress() { + return Promise.resolve(this.address); + } + _fail(message, operation) { + return Promise.resolve().then(() => { + abstract_signer_lib_esm_logger.throwError(message, Logger.errors.UNSUPPORTED_OPERATION, { operation: operation }); + }); + } + signMessage(message) { + return this._fail("VoidSigner cannot sign messages", "signMessage"); + } + signTransaction(transaction) { + return this._fail("VoidSigner cannot sign transactions", "signTransaction"); + } + _signTypedData(domain, types, value) { + return this._fail("VoidSigner cannot sign typed data", "signTypedData"); + } + connect(provider) { + return new VoidSigner(this.address, provider); + } +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hash/lib.esm/message.js + + + +const messagePrefix = "\x19Ethereum Signed Message:\n"; +function message_hashMessage(message) { + if (typeof (message) === "string") { + message = toUtf8Bytes(message); + } + return lib_esm_keccak256(lib_esm_concat([ + toUtf8Bytes(messagePrefix), + toUtf8Bytes(String(message.length)), + message + ])); +} +//# sourceMappingURL=message.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hash/lib.esm/_version.js +const hash_lib_esm_version_version = "hash/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hash/lib.esm/id.js + + +function id(text) { + return lib_esm_keccak256(toUtf8Bytes(text)); +} +//# sourceMappingURL=id.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hash/lib.esm/typed-data.js +var typed_data_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + +const typed_data_logger = new lib_esm_Logger(hash_lib_esm_version_version); + +const padding = new Uint8Array(32); +padding.fill(0); +const typed_data_NegativeOne = lib_esm_bignumber_BigNumber.from(-1); +const typed_data_Zero = lib_esm_bignumber_BigNumber.from(0); +const typed_data_One = lib_esm_bignumber_BigNumber.from(1); +const typed_data_MaxUint256 = lib_esm_bignumber_BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +function hexPadRight(value) { + const bytes = lib_esm_arrayify(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return hexConcat([bytes, padding.slice(padOffset)]); + } + return lib_esm_hexlify(bytes); +} +const hexTrue = lib_esm_hexZeroPad(typed_data_One.toHexString(), 32); +const hexFalse = lib_esm_hexZeroPad(typed_data_Zero.toHexString(), 32); +const domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; +const domainFieldNames = [ + "name", "version", "chainId", "verifyingContract", "salt" +]; +function checkString(key) { + return function (value) { + if (typeof (value) !== "string") { + typed_data_logger.throwArgumentError(`invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + } + return value; + }; +} +const domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function (value) { + try { + return lib_esm_bignumber_BigNumber.from(value).toString(); + } + catch (error) { } + return typed_data_logger.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value); + }, + verifyingContract: function (value) { + try { + return lib_esm_getAddress(value).toLowerCase(); + } + catch (error) { } + return typed_data_logger.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function (value) { + try { + const bytes = lib_esm_arrayify(value); + if (bytes.length !== 32) { + throw new Error("bad length"); + } + return lib_esm_hexlify(bytes); + } + catch (error) { } + return typed_data_logger.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value); + } +}; +function getBaseEncoder(type) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d*)$/); + if (match) { + const signed = (match[1] === ""); + const width = parseInt(match[2] || "256"); + if (width % 8 !== 0 || width > 256 || (match[2] && match[2] !== String(width))) { + typed_data_logger.throwArgumentError("invalid numeric width", "type", type); + } + const boundsUpper = typed_data_MaxUint256.mask(signed ? (width - 1) : width); + const boundsLower = signed ? boundsUpper.add(typed_data_One).mul(typed_data_NegativeOne) : typed_data_Zero; + return function (value) { + const v = lib_esm_bignumber_BigNumber.from(value); + if (v.lt(boundsLower) || v.gt(boundsUpper)) { + typed_data_logger.throwArgumentError(`value out-of-bounds for ${type}`, "value", value); + } + return lib_esm_hexZeroPad(v.toTwos(256).toHexString(), 32); + }; + } + } + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + if (width === 0 || width > 32 || match[1] !== String(width)) { + typed_data_logger.throwArgumentError("invalid bytes width", "type", type); + } + return function (value) { + const bytes = lib_esm_arrayify(value); + if (bytes.length !== width) { + typed_data_logger.throwArgumentError(`invalid length for ${type}`, "value", value); + } + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": return function (value) { + return lib_esm_hexZeroPad(lib_esm_getAddress(value), 32); + }; + case "bool": return function (value) { + return ((!value) ? hexFalse : hexTrue); + }; + case "bytes": return function (value) { + return lib_esm_keccak256(value); + }; + case "string": return function (value) { + return id(value); + }; + } + return null; +} +function encodeType(name, fields) { + return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; +} +class TypedDataEncoder { + constructor(types) { + lib_esm_defineReadOnly(this, "types", Object.freeze(deepCopy(types))); + lib_esm_defineReadOnly(this, "_encoderCache", {}); + lib_esm_defineReadOnly(this, "_types", {}); + // Link struct types to their direct child structs + const links = {}; + // Link structs to structs which contain them as a child + const parents = {}; + // Link all subtypes within a given struct + const subtypes = {}; + Object.keys(types).forEach((type) => { + links[type] = {}; + parents[type] = []; + subtypes[type] = {}; + }); + for (const name in types) { + const uniqueNames = {}; + types[name].forEach((field) => { + // Check each field has a unique name + if (uniqueNames[field.name]) { + typed_data_logger.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); + } + uniqueNames[field.name] = true; + // Get the base type (drop any array specifiers) + const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; + if (baseType === name) { + typed_data_logger.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types); + } + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + return; + } + if (!parents[baseType]) { + typed_data_logger.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types); + } + // Add linkage + parents[baseType].push(name); + links[name][baseType] = true; + }); + } + // Deduce the primary type + const primaryTypes = Object.keys(parents).filter((n) => (parents[n].length === 0)); + if (primaryTypes.length === 0) { + typed_data_logger.throwArgumentError("missing primary type", "types", types); + } + else if (primaryTypes.length > 1) { + typed_data_logger.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types); + } + lib_esm_defineReadOnly(this, "primaryType", primaryTypes[0]); + // Check for circular type references + function checkCircular(type, found) { + if (found[type]) { + typed_data_logger.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types); + } + found[type] = true; + Object.keys(links[type]).forEach((child) => { + if (!parents[child]) { + return; + } + // Recursively check children + checkCircular(child, found); + // Mark all ancestors as having this decendant + Object.keys(found).forEach((subtype) => { + subtypes[subtype][child] = true; + }); + }); + delete found[type]; + } + checkCircular(this.primaryType, {}); + // Compute each fully describe type + for (const name in subtypes) { + const st = Object.keys(subtypes[name]); + st.sort(); + this._types[name] = encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(""); + } + } + getEncoder(type) { + let encoder = this._encoderCache[type]; + if (!encoder) { + encoder = this._encoderCache[type] = this._getEncoder(type); + } + return encoder; + } + _getEncoder(type) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + // Array + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + const subtype = match[1]; + const subEncoder = this.getEncoder(subtype); + const length = parseInt(match[3]); + return (value) => { + if (length >= 0 && value.length !== length) { + typed_data_logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + let result = value.map(subEncoder); + if (this._types[subtype]) { + result = result.map(lib_esm_keccak256); + } + return lib_esm_keccak256(hexConcat(result)); + }; + } + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = id(this._types[type]); + return (value) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (this._types[type]) { + return lib_esm_keccak256(result); + } + return result; + }); + values.unshift(encodedType); + return hexConcat(values); + }; + } + return typed_data_logger.throwArgumentError(`unknown type: ${type}`, "type", type); + } + encodeType(name) { + const result = this._types[name]; + if (!result) { + typed_data_logger.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name); + } + return result; + } + encodeData(type, value) { + return this.getEncoder(type)(value); + } + hashStruct(name, value) { + return lib_esm_keccak256(this.encodeData(name, value)); + } + encode(value) { + return this.encodeData(this.primaryType, value); + } + hash(value) { + return this.hashStruct(this.primaryType, value); + } + _visit(type, value, callback) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + // Array + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + const subtype = match[1]; + const length = parseInt(match[3]); + if (length >= 0 && value.length !== length) { + typed_data_logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + return value.map((v) => this._visit(subtype, v, callback)); + } + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, {}); + } + return typed_data_logger.throwArgumentError(`unknown type: ${type}`, "type", type); + } + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + static from(types) { + return new TypedDataEncoder(types); + } + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + const type = domainFieldTypes[name]; + if (!type) { + typed_data_logger.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + } + domainFields.push({ name, type }); + } + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + static encode(domain, types, value) { + return hexConcat([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + static hash(domain, types, value) { + return lib_esm_keccak256(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + static resolveNames(domain, types, value, resolveName) { + return typed_data_awaiter(this, void 0, void 0, function* () { + // Make a copy to isolate it from the object passed in + domain = shallowCopy(domain); + // Look up all ENS names + const ensCache = {}; + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !lib_esm_isHexString(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + // Get a list of all the addresses + encoder.visit(value, (type, value) => { + if (type === "address" && !lib_esm_isHexString(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + // Lookup each name + for (const name in ensCache) { + ensCache[name] = yield resolveName(name); + } + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + // Replace all ENS names with their address + value = encoder.visit(value, (type, value) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + return { domain, value }; + }); + } + static getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + // Derive the EIP712Domain Struct reference type + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value = domain[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + const typesWithDomain = shallowCopy(types); + if (typesWithDomain.EIP712Domain) { + typed_data_logger.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + } + else { + typesWithDomain.EIP712Domain = domainTypes; + } + // Validate the data structures and types + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return lib_esm_hexlify(lib_esm_arrayify(value)); + } + // uint or int + if (type.match(/^u?int/)) { + return lib_esm_bignumber_BigNumber.from(value).toString(); + } + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + if (typeof (value) !== "string") { + typed_data_logger.throwArgumentError(`invalid string`, "value", value); + } + return value; + } + return typed_data_logger.throwArgumentError("unsupported type", "type", type); + }) + }; + } +} +//# sourceMappingURL=typed-data.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/node_modules/@ethersproject/basex/lib.esm/index.js +/** + * var basex = require("base-x"); + * + * This implementation is heavily based on base-x. The main reason to + * deviate was to prevent the dependency of Buffer. + * + * Contributors: + * + * base-x encoding + * Forked from https://github.com/cryptocoinjs/bs58 + * Originally written by Mike Hearn for BitcoinJ + * Copyright (c) 2011 Google Inc + * Ported to JavaScript by Stefan Thomas + * Merged Buffer refactorings from base58-native by Stephen Pair + * Copyright (c) 2013 BitPay Inc + * + * The MIT License (MIT) + * + * Copyright base-x contributors (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ -/***/ }) -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ id: moduleId, -/******/ loaded: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/amd options */ -/******/ !function() { -/******/ __webpack_require__.amdO = {}; -/******/ }(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/create fake namespace object */ -/******/ !function() { -/******/ var getProto = Object.getPrototypeOf ? function(obj) { return Object.getPrototypeOf(obj); } : function(obj) { return obj.__proto__; }; -/******/ var leafPrototypes; -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 16: return value when it's Promise-like -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = this(value); -/******/ if(mode & 8) return value; -/******/ if(typeof value === 'object' && value) { -/******/ if((mode & 4) && value.__esModule) return value; -/******/ if((mode & 16) && typeof value.then === 'function') return value; -/******/ } -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ var def = {}; -/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; -/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { -/******/ Object.getOwnPropertyNames(current).forEach(function(key) { def[key] = function() { return value[key]; }; }); -/******/ } -/******/ def['default'] = function() { return value; }; -/******/ __webpack_require__.d(ns, def); -/******/ return ns; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/global */ -/******/ !function() { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/node module decorator */ -/******/ !function() { -/******/ __webpack_require__.nmd = function(module) { -/******/ module.paths = []; -/******/ if (!module.children) module.children = []; -/******/ return module; -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module can't be inlined because the eval devtool is used. -/******/ var __webpack_exports__ = __webpack_require__("./src/unity.ts"); -/******/ JSUnityWrapper = __webpack_exports__; -/******/ +class BaseX { + constructor(alphabet) { + lib_esm_defineReadOnly(this, "alphabet", alphabet); + lib_esm_defineReadOnly(this, "base", alphabet.length); + lib_esm_defineReadOnly(this, "_alphabetMap", {}); + lib_esm_defineReadOnly(this, "_leader", alphabet.charAt(0)); + // pre-compute lookup table + for (let i = 0; i < alphabet.length; i++) { + this._alphabetMap[alphabet.charAt(i)] = i; + } + } + encode(value) { + let source = lib_esm_arrayify(value); + if (source.length === 0) { + return ""; + } + let digits = [0]; + for (let i = 0; i < source.length; ++i) { + let carry = source[i]; + for (let j = 0; j < digits.length; ++j) { + carry += digits[j] << 8; + digits[j] = carry % this.base; + carry = (carry / this.base) | 0; + } + while (carry > 0) { + digits.push(carry % this.base); + carry = (carry / this.base) | 0; + } + } + let string = ""; + // deal with leading zeros + for (let k = 0; source[k] === 0 && k < source.length - 1; ++k) { + string += this._leader; + } + // convert digits to a string + for (let q = digits.length - 1; q >= 0; --q) { + string += this.alphabet[digits[q]]; + } + return string; + } + decode(value) { + if (typeof (value) !== "string") { + throw new TypeError("Expected String"); + } + let bytes = []; + if (value.length === 0) { + return new Uint8Array(bytes); + } + bytes.push(0); + for (let i = 0; i < value.length; i++) { + let byte = this._alphabetMap[value[i]]; + if (byte === undefined) { + throw new Error("Non-base" + this.base + " character"); + } + let carry = byte; + for (let j = 0; j < bytes.length; ++j) { + carry += bytes[j] * this.base; + bytes[j] = carry & 0xff; + carry >>= 8; + } + while (carry > 0) { + bytes.push(carry & 0xff); + carry >>= 8; + } + } + // deal with leading zeros + for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) { + bytes.push(0); + } + return lib_esm_arrayify(new Uint8Array(bytes.reverse())); + } +} +const Base32 = new BaseX("abcdefghijklmnopqrstuvwxyz234567"); +const Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); + +//console.log(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj")) +//console.log(Base58.encode(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj"))) +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/sha2/lib.esm/types.js +var SupportedAlgorithm; +(function (SupportedAlgorithm) { + SupportedAlgorithm["sha256"] = "sha256"; + SupportedAlgorithm["sha512"] = "sha512"; +})(SupportedAlgorithm || (SupportedAlgorithm = {})); +; +//# sourceMappingURL=types.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/sha2/lib.esm/_version.js +const sha2_lib_esm_version_version = "sha2/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/sha2/lib.esm/sha2.js + + +//const _ripemd160 = _hash.ripemd160; + + + + +const sha2_logger = new lib_esm_Logger(sha2_lib_esm_version_version); +function ripemd160(data) { + return "0x" + (hash_default().ripemd160().update(lib_esm_arrayify(data)).digest("hex")); +} +function sha256(data) { + return "0x" + (hash_default().sha256().update(lib_esm_arrayify(data)).digest("hex")); +} +function sha512(data) { + return "0x" + (hash.sha512().update(arrayify(data)).digest("hex")); +} +function computeHmac(algorithm, key, data) { + if (!SupportedAlgorithm[algorithm]) { + sha2_logger.throwError("unsupported algorithm " + algorithm, lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "hmac", + algorithm: algorithm + }); + } + return "0x" + hash_default().hmac((hash_default())[algorithm], lib_esm_arrayify(key)).update(lib_esm_arrayify(data)).digest("hex"); +} +//# sourceMappingURL=sha2.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js + + + +function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { + password = lib_esm_arrayify(password); + salt = lib_esm_arrayify(salt); + let hLen; + let l = 1; + const DK = new Uint8Array(keylen); + const block1 = new Uint8Array(salt.length + 4); + block1.set(salt); + //salt.copy(block1, 0, 0, salt.length) + let r; + let T; + for (let i = 1; i <= l; i++) { + //block1.writeUInt32BE(i, salt.length) + block1[salt.length] = (i >> 24) & 0xff; + block1[salt.length + 1] = (i >> 16) & 0xff; + block1[salt.length + 2] = (i >> 8) & 0xff; + block1[salt.length + 3] = i & 0xff; + //let U = createHmac(password).update(block1).digest(); + let U = lib_esm_arrayify(computeHmac(hashAlgorithm, password, block1)); + if (!hLen) { + hLen = U.length; + T = new Uint8Array(hLen); + l = Math.ceil(keylen / hLen); + r = keylen - (l - 1) * hLen; + } + //U.copy(T, 0, 0, hLen) + T.set(U); + for (let j = 1; j < iterations; j++) { + //U = createHmac(password).update(U).digest(); + U = lib_esm_arrayify(computeHmac(hashAlgorithm, password, U)); + for (let k = 0; k < hLen; k++) + T[k] ^= U[k]; + } + const destPos = (i - 1) * hLen; + const len = (i === l ? r : hLen); + //T.copy(DK, destPos, 0, len) + DK.set(lib_esm_arrayify(T).slice(0, len), destPos); + } + return lib_esm_hexlify(DK); +} +//# sourceMappingURL=pbkdf2.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/node_modules/@ethersproject/wordlists/lib.esm/_version.js +const wordlists_lib_esm_version_version = "wordlists/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/node_modules/@ethersproject/wordlists/lib.esm/wordlist.js + +// This gets overridden by rollup +const exportWordlist = false; + + + + +const wordlist_logger = new lib_esm_Logger(wordlists_lib_esm_version_version); +class Wordlist { + constructor(locale) { + wordlist_logger.checkAbstract(new.target, Wordlist); + lib_esm_defineReadOnly(this, "locale", locale); + } + // Subclasses may override this + split(mnemonic) { + return mnemonic.toLowerCase().split(/ +/g); + } + // Subclasses may override this + join(words) { + return words.join(" "); + } + static check(wordlist) { + const words = []; + for (let i = 0; i < 2048; i++) { + const word = wordlist.getWord(i); + /* istanbul ignore if */ + if (i !== wordlist.getWordIndex(word)) { + return "0x"; + } + words.push(word); + } + return id(words.join("\n") + "\n"); + } + static register(lang, name) { + if (!name) { + name = lang.locale; + } + /* istanbul ignore if */ + if (exportWordlist) { + try { + const anyGlobal = window; + if (anyGlobal._ethers && anyGlobal._ethers.wordlists) { + if (!anyGlobal._ethers.wordlists[name]) { + lib_esm_defineReadOnly(anyGlobal._ethers.wordlists, name, lang); + } + } + } + catch (error) { } + } + } +} +//# sourceMappingURL=wordlist.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/node_modules/@ethersproject/wordlists/lib.esm/lang-en.js + + +const words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; +let wordlist = null; +function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + // Verify the computed list matches the official list + /* istanbul ignore if */ + if (Wordlist.check(lang) !== "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } +} +class LangEn extends Wordlist { + constructor() { + super("en"); + } + getWord(index) { + loadWords(this); + return wordlist[index]; + } + getWordIndex(word) { + loadWords(this); + return wordlist.indexOf(word); + } +} +const langEn = new LangEn(); +Wordlist.register(langEn); + +//# sourceMappingURL=lang-en.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/node_modules/@ethersproject/wordlists/lib.esm/wordlists.js + + +const wordlists = { + en: langEn +}; +//# sourceMappingURL=wordlists.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/lib.esm/_version.js +const hdnode_lib_esm_version_version = "hdnode/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/lib.esm/index.js + + + + + + + + + + + + + +const hdnode_lib_esm_logger = new lib_esm_Logger(hdnode_lib_esm_version_version); +const lib_esm_N = lib_esm_bignumber_BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +// "Bitcoin seed" +const MasterSecret = toUtf8Bytes("Bitcoin seed"); +const HardenedBit = 0x80000000; +// Returns a byte with the MSB bits set +function getUpperMask(bits) { + return ((1 << bits) - 1) << (8 - bits); +} +// Returns a byte with the LSB bits set +function getLowerMask(bits) { + return (1 << bits) - 1; +} +function bytes32(value) { + return lib_esm_hexZeroPad(lib_esm_hexlify(value), 32); +} +function base58check(data) { + return Base58.encode(lib_esm_concat([data, lib_esm_hexDataSlice(sha256(sha256(data)), 0, 4)])); +} +function getWordlist(wordlist) { + if (wordlist == null) { + return wordlists.en; + } + if (typeof (wordlist) === "string") { + const words = wordlists[wordlist]; + if (words == null) { + hdnode_lib_esm_logger.throwArgumentError("unknown locale", "wordlist", wordlist); + } + return words; + } + return wordlist; +} +const lib_esm_constructorGuard = {}; +const defaultPath = "m/44'/60'/0'/0/0"; +; +class HDNode { + /** + * This constructor should not be called directly. + * + * Please use: + * - fromMnemonic + * - fromSeed + */ + constructor(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath) { + /* istanbul ignore if */ + if (constructorGuard !== lib_esm_constructorGuard) { + throw new Error("HDNode constructor cannot be called directly"); + } + if (privateKey) { + const signingKey = new SigningKey(privateKey); + lib_esm_defineReadOnly(this, "privateKey", signingKey.privateKey); + lib_esm_defineReadOnly(this, "publicKey", signingKey.compressedPublicKey); + } + else { + lib_esm_defineReadOnly(this, "privateKey", null); + lib_esm_defineReadOnly(this, "publicKey", lib_esm_hexlify(publicKey)); + } + lib_esm_defineReadOnly(this, "parentFingerprint", parentFingerprint); + lib_esm_defineReadOnly(this, "fingerprint", lib_esm_hexDataSlice(ripemd160(sha256(this.publicKey)), 0, 4)); + lib_esm_defineReadOnly(this, "address", computeAddress(this.publicKey)); + lib_esm_defineReadOnly(this, "chainCode", chainCode); + lib_esm_defineReadOnly(this, "index", index); + lib_esm_defineReadOnly(this, "depth", depth); + if (mnemonicOrPath == null) { + // From a source that does not preserve the path (e.g. extended keys) + lib_esm_defineReadOnly(this, "mnemonic", null); + lib_esm_defineReadOnly(this, "path", null); + } + else if (typeof (mnemonicOrPath) === "string") { + // From a source that does not preserve the mnemonic (e.g. neutered) + lib_esm_defineReadOnly(this, "mnemonic", null); + lib_esm_defineReadOnly(this, "path", mnemonicOrPath); + } + else { + // From a fully qualified source + lib_esm_defineReadOnly(this, "mnemonic", mnemonicOrPath); + lib_esm_defineReadOnly(this, "path", mnemonicOrPath.path); + } + } + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + if (this.depth >= 256) { + throw new Error("Depth too large!"); + } + return base58check(lib_esm_concat([ + ((this.privateKey != null) ? "0x0488ADE4" : "0x0488B21E"), + lib_esm_hexlify(this.depth), + this.parentFingerprint, + lib_esm_hexZeroPad(lib_esm_hexlify(this.index), 4), + this.chainCode, + ((this.privateKey != null) ? lib_esm_concat(["0x00", this.privateKey]) : this.publicKey), + ])); + } + neuter() { + return new HDNode(lib_esm_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path); + } + _derive(index) { + if (index > 0xffffffff) { + throw new Error("invalid index - " + String(index)); + } + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + } + const data = new Uint8Array(37); + if (index & HardenedBit) { + if (!this.privateKey) { + throw new Error("cannot derive child of neutered node"); + } + // Data = 0x00 || ser_256(k_par) + data.set(lib_esm_arrayify(this.privateKey), 1); + // Hardened path + if (path) { + path += "'"; + } + } + else { + // Data = ser_p(point(k_par)) + data.set(lib_esm_arrayify(this.publicKey)); + } + // Data += ser_32(i) + for (let i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); + } + const I = lib_esm_arrayify(computeHmac(SupportedAlgorithm.sha512, this.chainCode, data)); + const IL = I.slice(0, 32); + const IR = I.slice(32); + // The private key + let ki = null; + // The public key + let Ki = null; + if (this.privateKey) { + ki = bytes32(lib_esm_bignumber_BigNumber.from(IL).add(this.privateKey).mod(lib_esm_N)); + } + else { + const ek = new SigningKey(lib_esm_hexlify(IL)); + Ki = ek._addPoint(this.publicKey); + } + let mnemonicOrPath = path; + const srcMnemonic = this.mnemonic; + if (srcMnemonic) { + mnemonicOrPath = Object.freeze({ + phrase: srcMnemonic.phrase, + path: path, + locale: (srcMnemonic.locale || "en") + }); + } + return new HDNode(lib_esm_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath); + } + derivePath(path) { + const components = path.split("/"); + if (components.length === 0 || (components[0] === "m" && this.depth !== 0)) { + throw new Error("invalid path - " + path); + } + if (components[0] === "m") { + components.shift(); + } + let result = this; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + if (index >= HardenedBit) { + throw new Error("invalid path index - " + component); + } + result = result._derive(HardenedBit + index); + } + else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + if (index >= HardenedBit) { + throw new Error("invalid path index - " + component); + } + result = result._derive(index); + } + else { + throw new Error("invalid path component - " + component); + } + } + return result; + } + static _fromSeed(seed, mnemonic) { + const seedArray = lib_esm_arrayify(seed); + if (seedArray.length < 16 || seedArray.length > 64) { + throw new Error("invalid seed"); + } + const I = lib_esm_arrayify(computeHmac(SupportedAlgorithm.sha512, MasterSecret, seedArray)); + return new HDNode(lib_esm_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic); + } + static fromMnemonic(mnemonic, password, wordlist) { + // If a locale name was passed in, find the associated wordlist + wordlist = getWordlist(wordlist); + // Normalize the case and spacing in the mnemonic (throws if the mnemonic is invalid) + mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist); + return HDNode._fromSeed(mnemonicToSeed(mnemonic, password), { + phrase: mnemonic, + path: "m", + locale: wordlist.locale + }); + } + static fromSeed(seed) { + return HDNode._fromSeed(seed, null); + } + static fromExtendedKey(extendedKey) { + const bytes = Base58.decode(extendedKey); + if (bytes.length !== 82 || base58check(bytes.slice(0, 78)) !== extendedKey) { + hdnode_lib_esm_logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + } + const depth = bytes[4]; + const parentFingerprint = lib_esm_hexlify(bytes.slice(5, 9)); + const index = parseInt(lib_esm_hexlify(bytes.slice(9, 13)).substring(2), 16); + const chainCode = lib_esm_hexlify(bytes.slice(13, 45)); + const key = bytes.slice(45, 78); + switch (lib_esm_hexlify(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": + case "0x043587cf": + return new HDNode(lib_esm_constructorGuard, null, lib_esm_hexlify(key), parentFingerprint, chainCode, index, depth, null); + // Private Key + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNode(lib_esm_constructorGuard, lib_esm_hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null); + } + return hdnode_lib_esm_logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + } +} +function mnemonicToSeed(mnemonic, password) { + if (!password) { + password = ""; + } + const salt = toUtf8Bytes("mnemonic" + password, UnicodeNormalizationForm.NFKD); + return pbkdf2(toUtf8Bytes(mnemonic, UnicodeNormalizationForm.NFKD), salt, 2048, 64, "sha512"); +} +function mnemonicToEntropy(mnemonic, wordlist) { + wordlist = getWordlist(wordlist); + hdnode_lib_esm_logger.checkNormalize(); + const words = wordlist.split(mnemonic); + if ((words.length % 3) !== 0) { + throw new Error("invalid mnemonic"); + } + const entropy = lib_esm_arrayify(new Uint8Array(Math.ceil(11 * words.length / 8))); + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + if (index === -1) { + throw new Error("invalid mnemonic"); + } + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= (1 << (7 - (offset % 8))); + } + offset++; + } + } + const entropyBits = 32 * words.length / 3; + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + const checksum = lib_esm_arrayify(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { + throw new Error("invalid checksum"); + } + return lib_esm_hexlify(entropy.slice(0, entropyBits / 8)); +} +function entropyToMnemonic(entropy, wordlist) { + wordlist = getWordlist(wordlist); + entropy = lib_esm_arrayify(entropy); + if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) { + throw new Error("invalid entropy"); + } + const indices = [0]; + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + // This byte will complete an 11-bit index + } + else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = lib_esm_arrayify(sha256(entropy))[0] & getUpperMask(checksumBits); + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); + return wordlist.join(indices.map((index) => wordlist.getWord(index))); +} +function isValidMnemonic(mnemonic, wordlist) { + try { + mnemonicToEntropy(mnemonic, wordlist); + return true; + } + catch (error) { } + return false; +} +function getAccountPath(index) { + if (typeof (index) !== "number" || index < 0 || index >= HardenedBit || index % 1) { + hdnode_lib_esm_logger.throwArgumentError("invalid account index", "index", index); + } + return `m/44'/60'/${index}'/0/0`; +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/wallet/node_modules/@ethersproject/random/lib.esm/_version.js +const random_lib_esm_version_version = "random/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/wallet/node_modules/@ethersproject/random/lib.esm/random.js + + + + +const random_logger = new lib_esm_Logger(random_lib_esm_version_version); +// Debugging line for testing browser lib in node +//const window = { crypto: { getRandomValues: () => { } } }; +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof __webpack_require__.g !== 'undefined') { + return __webpack_require__.g; + } + throw new Error('unable to locate global object'); +} +; +const anyGlobal = getGlobal(); +let random_crypto = anyGlobal.crypto || anyGlobal.msCrypto; +if (!random_crypto || !random_crypto.getRandomValues) { + random_logger.warn("WARNING: Missing strong random number source"); + random_crypto = { + getRandomValues: function (buffer) { + return random_logger.throwError("no secure random source avaialble", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "crypto.getRandomValues" + }); + } + }; +} +function randomBytes(length) { + if (length <= 0 || length > 1024 || (length % 1) || length != length) { + random_logger.throwArgumentError("invalid length", "length", length); + } + const result = new Uint8Array(length); + random_crypto.getRandomValues(result); + return lib_esm_arrayify(result); +} +; +//# sourceMappingURL=random.js.map +// EXTERNAL MODULE: ./node_modules/aes-js/index.js +var aes_js = __webpack_require__(8826); +var aes_js_default = /*#__PURE__*/__webpack_require__.n(aes_js); +// EXTERNAL MODULE: ./node_modules/scrypt-js/scrypt.js +var scrypt = __webpack_require__(7635); +var scrypt_default = /*#__PURE__*/__webpack_require__.n(scrypt); +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js + + + +function pbkdf2_pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { + password = lib_esm_arrayify(password); + salt = lib_esm_arrayify(salt); + let hLen; + let l = 1; + const DK = new Uint8Array(keylen); + const block1 = new Uint8Array(salt.length + 4); + block1.set(salt); + //salt.copy(block1, 0, 0, salt.length) + let r; + let T; + for (let i = 1; i <= l; i++) { + //block1.writeUInt32BE(i, salt.length) + block1[salt.length] = (i >> 24) & 0xff; + block1[salt.length + 1] = (i >> 16) & 0xff; + block1[salt.length + 2] = (i >> 8) & 0xff; + block1[salt.length + 3] = i & 0xff; + //let U = createHmac(password).update(block1).digest(); + let U = lib_esm_arrayify(computeHmac(hashAlgorithm, password, block1)); + if (!hLen) { + hLen = U.length; + T = new Uint8Array(hLen); + l = Math.ceil(keylen / hLen); + r = keylen - (l - 1) * hLen; + } + //U.copy(T, 0, 0, hLen) + T.set(U); + for (let j = 1; j < iterations; j++) { + //U = createHmac(password).update(U).digest(); + U = lib_esm_arrayify(computeHmac(hashAlgorithm, password, U)); + for (let k = 0; k < hLen; k++) + T[k] ^= U[k]; + } + const destPos = (i - 1) * hLen; + const len = (i === l ? r : hLen); + //T.copy(DK, destPos, 0, len) + DK.set(lib_esm_arrayify(T).slice(0, len), destPos); + } + return lib_esm_hexlify(DK); +} +//# sourceMappingURL=pbkdf2.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/node_modules/@ethersproject/random/lib.esm/_version.js +const _ethersproject_random_lib_esm_version_version = "random/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/node_modules/@ethersproject/random/lib.esm/random.js + + + + +const lib_esm_random_logger = new lib_esm_Logger(_ethersproject_random_lib_esm_version_version); +// Debugging line for testing browser lib in node +//const window = { crypto: { getRandomValues: () => { } } }; +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis +function random_getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof __webpack_require__.g !== 'undefined') { + return __webpack_require__.g; + } + throw new Error('unable to locate global object'); +} +; +const random_anyGlobal = random_getGlobal(); +let lib_esm_random_crypto = random_anyGlobal.crypto || random_anyGlobal.msCrypto; +if (!lib_esm_random_crypto || !lib_esm_random_crypto.getRandomValues) { + lib_esm_random_logger.warn("WARNING: Missing strong random number source"); + lib_esm_random_crypto = { + getRandomValues: function (buffer) { + return lib_esm_random_logger.throwError("no secure random source avaialble", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "crypto.getRandomValues" + }); + } + }; +} +function random_randomBytes(length) { + if (length <= 0 || length > 1024 || (length % 1) || length != length) { + lib_esm_random_logger.throwArgumentError("invalid length", "length", length); + } + const result = new Uint8Array(length); + lib_esm_random_crypto.getRandomValues(result); + return lib_esm_arrayify(result); +} +; +//# sourceMappingURL=random.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/utils.js + + + +function looseArrayify(hexString) { + if (typeof (hexString) === 'string' && hexString.substring(0, 2) !== '0x') { + hexString = '0x' + hexString; + } + return lib_esm_arrayify(hexString); +} +function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = '0' + value; + } + return value; +} +function getPassword(password) { + if (typeof (password) === 'string') { + return toUtf8Bytes(password, UnicodeNormalizationForm.NFKC); + } + return lib_esm_arrayify(password); +} +function searchPath(object, path) { + let currentChild = object; + const comps = path.toLowerCase().split('/'); + for (let i = 0; i < comps.length; i++) { + // Search for a child object with a case-insensitive matching key + let matchingChild = null; + for (const key in currentChild) { + if (key.toLowerCase() === comps[i]) { + matchingChild = currentChild[key]; + break; + } + } + // Didn't find one. :'( + if (matchingChild === null) { + return null; + } + // Now check this child... + currentChild = matchingChild; + } + return currentChild; +} +// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) +function uuidV4(randomBytes) { + const bytes = lib_esm_arrayify(randomBytes); + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + const value = lib_esm_hexlify(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +//# sourceMappingURL=utils.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/_version.js +const json_wallets_lib_esm_version_version = "json-wallets/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/keystore.js + +var keystore_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + + + +const keystore_logger = new lib_esm_Logger(json_wallets_lib_esm_version_version); +// Exported Types +function hasMnemonic(value) { + return (value != null && value.mnemonic && value.mnemonic.phrase); +} +class KeystoreAccount extends lib_esm_Description { + isKeystoreAccount(value) { + return !!(value && value._isKeystoreAccount); + } +} +function _decrypt(data, key, ciphertext) { + const cipher = searchPath(data, "crypto/cipher"); + if (cipher === "aes-128-ctr") { + const iv = looseArrayify(searchPath(data, "crypto/cipherparams/iv")); + const counter = new (aes_js_default()).Counter(iv); + const aesCtr = new (aes_js_default()).ModeOfOperation.ctr(key, counter); + return lib_esm_arrayify(aesCtr.decrypt(ciphertext)); + } + return null; +} +function _getAccount(data, key) { + const ciphertext = looseArrayify(searchPath(data, "crypto/ciphertext")); + const computedMAC = lib_esm_hexlify(lib_esm_keccak256(lib_esm_concat([key.slice(16, 32), ciphertext]))).substring(2); + if (computedMAC !== searchPath(data, "crypto/mac").toLowerCase()) { + throw new Error("invalid password"); + } + const privateKey = _decrypt(data, key.slice(0, 16), ciphertext); + if (!privateKey) { + keystore_logger.throwError("unsupported cipher", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "decrypt" + }); + } + const mnemonicKey = key.slice(32, 64); + const address = computeAddress(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (check.substring(0, 2) !== "0x") { + check = "0x" + check; + } + if (lib_esm_getAddress(check) !== address) { + throw new Error("address mismatch"); + } + } + const account = { + _isKeystoreAccount: true, + address: address, + privateKey: lib_esm_hexlify(privateKey) + }; + // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + if (searchPath(data, "x-ethers/version") === "0.1") { + const mnemonicCiphertext = looseArrayify(searchPath(data, "x-ethers/mnemonicCiphertext")); + const mnemonicIv = looseArrayify(searchPath(data, "x-ethers/mnemonicCounter")); + const mnemonicCounter = new (aes_js_default()).Counter(mnemonicIv); + const mnemonicAesCtr = new (aes_js_default()).ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + const path = searchPath(data, "x-ethers/path") || defaultPath; + const locale = searchPath(data, "x-ethers/locale") || "en"; + const entropy = lib_esm_arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext)); + try { + const mnemonic = entropyToMnemonic(entropy, locale); + const node = HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + account.mnemonic = node.mnemonic; + } + catch (error) { + // If we don't have the locale wordlist installed to + // read this mnemonic, just bail and don't set the + // mnemonic + if (error.code !== lib_esm_Logger.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { + throw error; + } + } + } + return new KeystoreAccount(account); +} +function pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) { + return lib_esm_arrayify(pbkdf2_pbkdf2(passwordBytes, salt, count, dkLen, prfFunc)); +} +function keystore_pbkdf2(passwordBytes, salt, count, dkLen, prfFunc) { + return Promise.resolve(pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc)); +} +function _computeKdfKey(data, password, pbkdf2Func, scryptFunc, progressCallback) { + const passwordBytes = getPassword(password); + const kdf = searchPath(data, "crypto/kdf"); + if (kdf && typeof (kdf) === "string") { + const throwError = function (name, value) { + return keystore_logger.throwArgumentError("invalid key-derivation function parameters", name, value); + }; + if (kdf.toLowerCase() === "scrypt") { + const salt = looseArrayify(searchPath(data, "crypto/kdfparams/salt")); + const N = parseInt(searchPath(data, "crypto/kdfparams/n")); + const r = parseInt(searchPath(data, "crypto/kdfparams/r")); + const p = parseInt(searchPath(data, "crypto/kdfparams/p")); + // Check for all required parameters + if (!N || !r || !p) { + throwError("kdf", kdf); + } + // Make sure N is a power of 2 + if ((N & (N - 1)) !== 0) { + throwError("N", N); + } + const dkLen = parseInt(searchPath(data, "crypto/kdfparams/dklen")); + if (dkLen !== 32) { + throwError("dklen", dkLen); + } + return scryptFunc(passwordBytes, salt, N, r, p, 64, progressCallback); + } + else if (kdf.toLowerCase() === "pbkdf2") { + const salt = looseArrayify(searchPath(data, "crypto/kdfparams/salt")); + let prfFunc = null; + const prf = searchPath(data, "crypto/kdfparams/prf"); + if (prf === "hmac-sha256") { + prfFunc = "sha256"; + } + else if (prf === "hmac-sha512") { + prfFunc = "sha512"; + } + else { + throwError("prf", prf); + } + const count = parseInt(searchPath(data, "crypto/kdfparams/c")); + const dkLen = parseInt(searchPath(data, "crypto/kdfparams/dklen")); + if (dkLen !== 32) { + throwError("dklen", dkLen); + } + return pbkdf2Func(passwordBytes, salt, count, dkLen, prfFunc); + } + } + return keystore_logger.throwArgumentError("unsupported key-derivation function", "kdf", kdf); +} +function decryptSync(json, password) { + const data = JSON.parse(json); + const key = _computeKdfKey(data, password, pbkdf2Sync, (scrypt_default()).syncScrypt); + return _getAccount(data, key); +} +function keystore_decrypt(json, password, progressCallback) { + return keystore_awaiter(this, void 0, void 0, function* () { + const data = JSON.parse(json); + const key = yield _computeKdfKey(data, password, keystore_pbkdf2, (scrypt_default()).scrypt, progressCallback); + return _getAccount(data, key); + }); +} +function keystore_encrypt(account, password, options, progressCallback) { + try { + // Check the address matches the private key + if (lib_esm_getAddress(account.address) !== computeAddress(account.privateKey)) { + throw new Error("address/privateKey mismatch"); + } + // Check the mnemonic (if any) matches the private key + if (hasMnemonic(account)) { + const mnemonic = account.mnemonic; + const node = HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || defaultPath); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + } + } + catch (e) { + return Promise.reject(e); + } + // The options are optional, so adjust the call as needed + if (typeof (options) === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (!options) { + options = {}; + } + const privateKey = lib_esm_arrayify(account.privateKey); + const passwordBytes = getPassword(password); + let entropy = null; + let path = null; + let locale = null; + if (hasMnemonic(account)) { + const srcMnemonic = account.mnemonic; + entropy = lib_esm_arrayify(mnemonicToEntropy(srcMnemonic.phrase, srcMnemonic.locale || "en")); + path = srcMnemonic.path || defaultPath; + locale = srcMnemonic.locale || "en"; + } + let client = options.client; + if (!client) { + client = "ethers.js"; + } + // Check/generate the salt + let salt = null; + if (options.salt) { + salt = lib_esm_arrayify(options.salt); + } + else { + salt = random_randomBytes(32); + ; + } + // Override initialization vector + let iv = null; + if (options.iv) { + iv = lib_esm_arrayify(options.iv); + if (iv.length !== 16) { + throw new Error("invalid iv"); + } + } + else { + iv = random_randomBytes(16); + } + // Override the uuid + let uuidRandom = null; + if (options.uuid) { + uuidRandom = lib_esm_arrayify(options.uuid); + if (uuidRandom.length !== 16) { + throw new Error("invalid uuid"); + } + } + else { + uuidRandom = random_randomBytes(16); + } + // Override the scrypt password-based key derivation function parameters + let N = (1 << 17), r = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { + N = options.scrypt.N; + } + if (options.scrypt.r) { + r = options.scrypt.r; + } + if (options.scrypt.p) { + p = options.scrypt.p; + } + } + // We take 64 bytes: + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + return scrypt_default().scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then((key) => { + key = lib_esm_arrayify(key); + // This will be used to encrypt the wallet (as per Web3 secret storage) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + // This will be used to encrypt the mnemonic phrase (if any) + const mnemonicKey = key.slice(32, 64); + // Encrypt the private key + const counter = new (aes_js_default()).Counter(iv); + const aesCtr = new (aes_js_default()).ModeOfOperation.ctr(derivedKey, counter); + const ciphertext = lib_esm_arrayify(aesCtr.encrypt(privateKey)); + // Compute the message authentication code, used to check the password + const mac = lib_esm_keccak256(lib_esm_concat([macPrefix, ciphertext])); + // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + const data = { + address: account.address.substring(2).toLowerCase(), + id: uuidV4(uuidRandom), + version: 3, + crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: lib_esm_hexlify(iv).substring(2), + }, + ciphertext: lib_esm_hexlify(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: lib_esm_hexlify(salt).substring(2), + n: N, + dklen: 32, + p: p, + r: r + }, + mac: mac.substring(2) + } + }; + // If we have a mnemonic, encrypt it into the JSON wallet + if (entropy) { + const mnemonicIv = random_randomBytes(16); + const mnemonicCounter = new (aes_js_default()).Counter(mnemonicIv); + const mnemonicAesCtr = new (aes_js_default()).ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + const mnemonicCiphertext = lib_esm_arrayify(mnemonicAesCtr.encrypt(entropy)); + const now = new Date(); + const timestamp = (now.getUTCFullYear() + "-" + + zpad(now.getUTCMonth() + 1, 2) + "-" + + zpad(now.getUTCDate(), 2) + "T" + + zpad(now.getUTCHours(), 2) + "-" + + zpad(now.getUTCMinutes(), 2) + "-" + + zpad(now.getUTCSeconds(), 2) + ".0Z"); + data["x-ethers"] = { + client: client, + gethFilename: ("UTC--" + timestamp + "--" + data.address), + mnemonicCounter: lib_esm_hexlify(mnemonicIv).substring(2), + mnemonicCiphertext: lib_esm_hexlify(mnemonicCiphertext).substring(2), + path: path, + locale: locale, + version: "0.1" + }; + } + return JSON.stringify(data); + }); +} +//# sourceMappingURL=keystore.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/crowdsale.js + + + + + + + + + + +const crowdsale_logger = new lib_esm_Logger(json_wallets_lib_esm_version_version); + +class CrowdsaleAccount extends lib_esm_Description { + isCrowdsaleAccount(value) { + return !!(value && value._isCrowdsaleAccount); + } +} +// See: https://github.com/ethereum/pyethsaletool +function crowdsale_decrypt(json, password) { + const data = JSON.parse(json); + password = getPassword(password); + // Ethereum Address + const ethaddr = lib_esm_getAddress(searchPath(data, "ethaddr")); + // Encrypted Seed + const encseed = looseArrayify(searchPath(data, "encseed")); + if (!encseed || (encseed.length % 16) !== 0) { + crowdsale_logger.throwArgumentError("invalid encseed", "json", json); + } + const key = lib_esm_arrayify(pbkdf2_pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16); + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + // Decrypt the seed + const aesCbc = new (aes_js_default()).ModeOfOperation.cbc(key, iv); + const seed = aes_js_default().padding.pkcs7.strip(lib_esm_arrayify(aesCbc.decrypt(encryptedSeed))); + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + const seedHexBytes = toUtf8Bytes(seedHex); + const privateKey = lib_esm_keccak256(seedHexBytes); + return new CrowdsaleAccount({ + _isCrowdsaleAccount: true, + address: ethaddr, + privateKey: privateKey + }); +} +//# sourceMappingURL=crowdsale.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/inspect.js + + +function isCrowdsaleWallet(json) { + let data = null; + try { + data = JSON.parse(json); + } + catch (error) { + return false; + } + return (data.encseed && data.ethaddr); +} +function isKeystoreWallet(json) { + let data = null; + try { + data = JSON.parse(json); + } + catch (error) { + return false; + } + if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) { + return false; + } + // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff + return true; +} +//export function isJsonWallet(json: string): boolean { +// return (isSecretStorageWallet(json) || isCrowdsaleWallet(json)); +//} +function getJsonWalletAddress(json) { + if (isCrowdsaleWallet(json)) { + try { + return getAddress(JSON.parse(json).ethaddr); + } + catch (error) { + return null; + } + } + if (isKeystoreWallet(json)) { + try { + return getAddress(JSON.parse(json).address); + } + catch (error) { + return null; + } + } + return null; +} +//# sourceMappingURL=inspect.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/index.js + + + + +function decryptJsonWallet(json, password, progressCallback) { + if (isCrowdsaleWallet(json)) { + if (progressCallback) { + progressCallback(0); + } + const account = crowdsale_decrypt(json, password); + if (progressCallback) { + progressCallback(1); + } + return Promise.resolve(account); + } + if (isKeystoreWallet(json)) { + return keystore_decrypt(json, password, progressCallback); + } + return Promise.reject(new Error("invalid JSON wallet")); +} +function decryptJsonWalletSync(json, password) { + if (isCrowdsaleWallet(json)) { + return crowdsale_decrypt(json, password); + } + if (isKeystoreWallet(json)) { + return decryptSync(json, password); + } + throw new Error("invalid JSON wallet"); +} + +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/wallet/lib.esm/_version.js +const wallet_lib_esm_version_version = "wallet/5.7.0"; +//# sourceMappingURL=_version.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/wallet/lib.esm/index.js + +var wallet_lib_esm_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + + + + +const wallet_lib_esm_logger = new lib_esm_Logger(wallet_lib_esm_version_version); +function isAccount(value) { + return (value != null && lib_esm_isHexString(value.privateKey, 32) && value.address != null); +} +function lib_esm_hasMnemonic(value) { + const mnemonic = value.mnemonic; + return (mnemonic && mnemonic.phrase); +} +class lib_esm_Wallet extends lib_esm_Signer { + constructor(privateKey, provider) { + super(); + if (isAccount(privateKey)) { + const signingKey = new SigningKey(privateKey.privateKey); + lib_esm_defineReadOnly(this, "_signingKey", () => signingKey); + lib_esm_defineReadOnly(this, "address", computeAddress(this.publicKey)); + if (this.address !== lib_esm_getAddress(privateKey.address)) { + wallet_lib_esm_logger.throwArgumentError("privateKey/address mismatch", "privateKey", "[REDACTED]"); + } + if (lib_esm_hasMnemonic(privateKey)) { + const srcMnemonic = privateKey.mnemonic; + lib_esm_defineReadOnly(this, "_mnemonic", () => ({ + phrase: srcMnemonic.phrase, + path: srcMnemonic.path || defaultPath, + locale: srcMnemonic.locale || "en" + })); + const mnemonic = this.mnemonic; + const node = HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path); + if (computeAddress(node.privateKey) !== this.address) { + wallet_lib_esm_logger.throwArgumentError("mnemonic/address mismatch", "privateKey", "[REDACTED]"); + } + } + else { + lib_esm_defineReadOnly(this, "_mnemonic", () => null); + } + } + else { + if (SigningKey.isSigningKey(privateKey)) { + /* istanbul ignore if */ + if (privateKey.curve !== "secp256k1") { + wallet_lib_esm_logger.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]"); + } + lib_esm_defineReadOnly(this, "_signingKey", () => privateKey); + } + else { + // A lot of common tools do not prefix private keys with a 0x (see: #1166) + if (typeof (privateKey) === "string") { + if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { + privateKey = "0x" + privateKey; + } + } + const signingKey = new SigningKey(privateKey); + lib_esm_defineReadOnly(this, "_signingKey", () => signingKey); + } + lib_esm_defineReadOnly(this, "_mnemonic", () => null); + lib_esm_defineReadOnly(this, "address", computeAddress(this.publicKey)); + } + /* istanbul ignore if */ + if (provider && !lib_esm_Provider.isProvider(provider)) { + wallet_lib_esm_logger.throwArgumentError("invalid provider", "provider", provider); + } + lib_esm_defineReadOnly(this, "provider", provider || null); + } + get mnemonic() { return this._mnemonic(); } + get privateKey() { return this._signingKey().privateKey; } + get publicKey() { return this._signingKey().publicKey; } + getAddress() { + return Promise.resolve(this.address); + } + connect(provider) { + return new lib_esm_Wallet(this, provider); + } + signTransaction(transaction) { + return resolveProperties(transaction).then((tx) => { + if (tx.from != null) { + if (lib_esm_getAddress(tx.from) !== this.address) { + wallet_lib_esm_logger.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from); + } + delete tx.from; + } + const signature = this._signingKey().signDigest(lib_esm_keccak256(serialize(tx))); + return serialize(tx, signature); + }); + } + signMessage(message) { + return wallet_lib_esm_awaiter(this, void 0, void 0, function* () { + return joinSignature(this._signingKey().signDigest(message_hashMessage(message))); + }); + } + _signTypedData(domain, types, value) { + return wallet_lib_esm_awaiter(this, void 0, void 0, function* () { + // Populate any ENS names + const populated = yield TypedDataEncoder.resolveNames(domain, types, value, (name) => { + if (this.provider == null) { + wallet_lib_esm_logger.throwError("cannot resolve ENS names without a provider", lib_esm_Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName", + value: name + }); + } + return this.provider.resolveName(name); + }); + return joinSignature(this._signingKey().signDigest(TypedDataEncoder.hash(populated.domain, types, populated.value))); + }); + } + encrypt(password, options, progressCallback) { + if (typeof (options) === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (progressCallback && typeof (progressCallback) !== "function") { + throw new Error("invalid callback"); + } + if (!options) { + options = {}; + } + return keystore_encrypt(this, password, options, progressCallback); + } + /** + * Static methods to create Wallet instances. + */ + static createRandom(options) { + let entropy = randomBytes(16); + if (!options) { + options = {}; + } + if (options.extraEntropy) { + entropy = lib_esm_arrayify(lib_esm_hexDataSlice(lib_esm_keccak256(lib_esm_concat([entropy, options.extraEntropy])), 0, 16)); + } + const mnemonic = entropyToMnemonic(entropy, options.locale); + return lib_esm_Wallet.fromMnemonic(mnemonic, options.path, options.locale); + } + static fromEncryptedJson(json, password, progressCallback) { + return decryptJsonWallet(json, password, progressCallback).then((account) => { + return new lib_esm_Wallet(account); + }); + } + static fromEncryptedJsonSync(json, password) { + return new lib_esm_Wallet(decryptJsonWalletSync(json, password)); + } + static fromMnemonic(mnemonic, path, wordlist) { + if (!path) { + path = defaultPath; + } + return new lib_esm_Wallet(HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(path)); + } +} +function verifyMessage(message, signature) { + return recoverAddress(hashMessage(message), signature); +} +function verifyTypedData(domain, types, value, signature) { + return recoverAddress(_TypedDataEncoder.hash(domain, types, value), signature); +} +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/interface.js + + + + + + + + + + + + +const interface_logger = new lib_esm_Logger(abi_lib_esm_version_version); + +class LogDescription extends lib_esm_Description { +} +class TransactionDescription extends lib_esm_Description { +} +class ErrorDescription extends lib_esm_Description { +} +class Indexed extends lib_esm_Description { + static isIndexed(value) { + return !!(value && value._isIndexed); + } +} +const BuiltinErrors = { + "0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true }, + "0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] } +}; +function wrapAccessError(property, error) { + const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`); + wrap.error = error; + return wrap; +} +/* +function checkNames(fragment: Fragment, type: "input" | "output", params: Array): void { + params.reduce((accum, param) => { + if (param.name) { + if (accum[param.name]) { + logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format("full") }`, "fragment", fragment); + } + accum[param.name] = true; + } + return accum; + }, <{ [ name: string ]: boolean }>{ }); +} +*/ +class Interface { + constructor(fragments) { + let abi = []; + if (typeof (fragments) === "string") { + abi = JSON.parse(fragments); + } + else { + abi = fragments; + } + lib_esm_defineReadOnly(this, "fragments", abi.map((fragment) => { + return Fragment.from(fragment); + }).filter((fragment) => (fragment != null))); + lib_esm_defineReadOnly(this, "_abiCoder", getStatic(new.target, "getAbiCoder")()); + lib_esm_defineReadOnly(this, "functions", {}); + lib_esm_defineReadOnly(this, "errors", {}); + lib_esm_defineReadOnly(this, "events", {}); + lib_esm_defineReadOnly(this, "structs", {}); + // Add all fragments by their signature + this.fragments.forEach((fragment) => { + let bucket = null; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + interface_logger.warn("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + lib_esm_defineReadOnly(this, "deploy", fragment); + return; + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = this.functions; + break; + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = this.events; + break; + case "error": + bucket = this.errors; + break; + default: + return; + } + let signature = fragment.format(); + if (bucket[signature]) { + interface_logger.warn("duplicate definition - " + signature); + return; + } + bucket[signature] = fragment; + }); + // If we do not have a constructor add a default + if (!this.deploy) { + lib_esm_defineReadOnly(this, "deploy", ConstructorFragment.from({ + payable: false, + type: "constructor" + })); + } + lib_esm_defineReadOnly(this, "_isInterface", true); + } + format(format) { + if (!format) { + format = FormatTypes.full; + } + if (format === FormatTypes.sighash) { + interface_logger.throwArgumentError("interface does not support formatting sighash", "format", format); + } + const abi = this.fragments.map((fragment) => fragment.format(format)); + // We need to re-bundle the JSON fragments a bit + if (format === FormatTypes.json) { + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + return abi; + } + // Sub-classes can override these to handle other blockchains + static getAbiCoder() { + return defaultAbiCoder; + } + static getAddress(address) { + return lib_esm_getAddress(address); + } + static getSighash(fragment) { + return lib_esm_hexDataSlice(id(fragment.format()), 0, 4); + } + static getEventTopic(eventFragment) { + return id(eventFragment.format()); + } + // Find a function definition by any means necessary (unless it is ambiguous) + getFunction(nameOrSignatureOrSighash) { + if (lib_esm_isHexString(nameOrSignatureOrSighash)) { + for (const name in this.functions) { + if (nameOrSignatureOrSighash === this.getSighash(name)) { + return this.functions[name]; + } + } + interface_logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + } + // It is a bare name, look up the function (will return null if ambiguous) + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + const name = nameOrSignatureOrSighash.trim(); + const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name)); + if (matching.length === 0) { + interface_logger.throwArgumentError("no matching function", "name", name); + } + else if (matching.length > 1) { + interface_logger.throwArgumentError("multiple matching functions", "name", name); + } + return this.functions[matching[0]]; + } + // Normalize the signature and lookup the function + const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + interface_logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + } + return result; + } + // Find an event definition by any means necessary (unless it is ambiguous) + getEvent(nameOrSignatureOrTopic) { + if (lib_esm_isHexString(nameOrSignatureOrTopic)) { + const topichash = nameOrSignatureOrTopic.toLowerCase(); + for (const name in this.events) { + if (topichash === this.getEventTopic(name)) { + return this.events[name]; + } + } + interface_logger.throwArgumentError("no matching event", "topichash", topichash); + } + // It is a bare name, look up the function (will return null if ambiguous) + if (nameOrSignatureOrTopic.indexOf("(") === -1) { + const name = nameOrSignatureOrTopic.trim(); + const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name)); + if (matching.length === 0) { + interface_logger.throwArgumentError("no matching event", "name", name); + } + else if (matching.length > 1) { + interface_logger.throwArgumentError("multiple matching events", "name", name); + } + return this.events[matching[0]]; + } + // Normalize the signature and lookup the function + const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()]; + if (!result) { + interface_logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + } + return result; + } + // Find a function definition by any means necessary (unless it is ambiguous) + getError(nameOrSignatureOrSighash) { + if (lib_esm_isHexString(nameOrSignatureOrSighash)) { + const getSighash = getStatic(this.constructor, "getSighash"); + for (const name in this.errors) { + const error = this.errors[name]; + if (nameOrSignatureOrSighash === getSighash(error)) { + return this.errors[name]; + } + } + interface_logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + } + // It is a bare name, look up the function (will return null if ambiguous) + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + const name = nameOrSignatureOrSighash.trim(); + const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name)); + if (matching.length === 0) { + interface_logger.throwArgumentError("no matching error", "name", name); + } + else if (matching.length > 1) { + interface_logger.throwArgumentError("multiple matching errors", "name", name); + } + return this.errors[matching[0]]; + } + // Normalize the signature and lookup the function + const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + interface_logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + } + return result; + } + // Get the sighash (the bytes4 selector) used by Solidity to identify a function + getSighash(fragment) { + if (typeof (fragment) === "string") { + try { + fragment = this.getFunction(fragment); + } + catch (error) { + try { + fragment = this.getError(fragment); + } + catch (_) { + throw error; + } + } + } + return getStatic(this.constructor, "getSighash")(fragment); + } + // Get the topic (the bytes32 hash) used by Solidity to identify an event + getEventTopic(eventFragment) { + if (typeof (eventFragment) === "string") { + eventFragment = this.getEvent(eventFragment); + } + return getStatic(this.constructor, "getEventTopic")(eventFragment); + } + _decodeParams(params, data) { + return this._abiCoder.decode(params, data); + } + _encodeParams(params, values) { + return this._abiCoder.encode(params, values); + } + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + decodeErrorResult(fragment, data) { + if (typeof (fragment) === "string") { + fragment = this.getError(fragment); + } + const bytes = lib_esm_arrayify(data); + if (lib_esm_hexlify(bytes.slice(0, 4)) !== this.getSighash(fragment)) { + interface_logger.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", lib_esm_hexlify(bytes)); + } + return this._decodeParams(fragment.inputs, bytes.slice(4)); + } + encodeErrorResult(fragment, values) { + if (typeof (fragment) === "string") { + fragment = this.getError(fragment); + } + return lib_esm_hexlify(lib_esm_concat([ + this.getSighash(fragment), + this._encodeParams(fragment.inputs, values || []) + ])); + } + // Decode the data for a function call (e.g. tx.data) + decodeFunctionData(functionFragment, data) { + if (typeof (functionFragment) === "string") { + functionFragment = this.getFunction(functionFragment); + } + const bytes = lib_esm_arrayify(data); + if (lib_esm_hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { + interface_logger.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", lib_esm_hexlify(bytes)); + } + return this._decodeParams(functionFragment.inputs, bytes.slice(4)); + } + // Encode the data for a function call (e.g. tx.data) + encodeFunctionData(functionFragment, values) { + if (typeof (functionFragment) === "string") { + functionFragment = this.getFunction(functionFragment); + } + return lib_esm_hexlify(lib_esm_concat([ + this.getSighash(functionFragment), + this._encodeParams(functionFragment.inputs, values || []) + ])); + } + // Decode the result from a function call (e.g. from eth_call) + decodeFunctionResult(functionFragment, data) { + if (typeof (functionFragment) === "string") { + functionFragment = this.getFunction(functionFragment); + } + let bytes = lib_esm_arrayify(data); + let reason = null; + let message = ""; + let errorArgs = null; + let errorName = null; + let errorSignature = null; + switch (bytes.length % this._abiCoder._getWordSize()) { + case 0: + try { + return this._abiCoder.decode(functionFragment.outputs, bytes); + } + catch (error) { } + break; + case 4: { + const selector = lib_esm_hexlify(bytes.slice(0, 4)); + const builtin = BuiltinErrors[selector]; + if (builtin) { + errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4)); + errorName = builtin.name; + errorSignature = builtin.signature; + if (builtin.reason) { + reason = errorArgs[0]; + } + if (errorName === "Error") { + message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`; + } + else if (errorName === "Panic") { + message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`; + } + } + else { + try { + const error = this.getError(selector); + errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4)); + errorName = error.name; + errorSignature = error.format(); + } + catch (error) { } + } + break; + } + } + return interface_logger.throwError("call revert exception" + message, lib_esm_Logger.errors.CALL_EXCEPTION, { + method: functionFragment.format(), + data: lib_esm_hexlify(data), errorArgs, errorName, errorSignature, reason + }); + } + // Encode the result for a function call (e.g. for eth_call) + encodeFunctionResult(functionFragment, values) { + if (typeof (functionFragment) === "string") { + functionFragment = this.getFunction(functionFragment); + } + return lib_esm_hexlify(this._abiCoder.encode(functionFragment.outputs, values || [])); + } + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(eventFragment, values) { + if (typeof (eventFragment) === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (values.length > eventFragment.inputs.length) { + interface_logger.throwError("too many arguments for " + eventFragment.format(), lib_esm_Logger.errors.UNEXPECTED_ARGUMENT, { + argument: "values", + value: values + }); + } + let topics = []; + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + const encodeTopic = (param, value) => { + if (param.type === "string") { + return id(value); + } + else if (param.type === "bytes") { + return lib_esm_keccak256(lib_esm_hexlify(value)); + } + if (param.type === "bool" && typeof (value) === "boolean") { + value = (value ? "0x01" : "0x00"); + } + if (param.type.match(/^u?int/)) { + value = lib_esm_bignumber_BigNumber.from(value).toHexString(); + } + // Check addresses are valid + if (param.type === "address") { + this._abiCoder.encode(["address"], [value]); + } + return lib_esm_hexZeroPad(lib_esm_hexlify(value), 32); + }; + values.forEach((value, index) => { + let param = eventFragment.inputs[index]; + if (!param.indexed) { + if (value != null) { + interface_logger.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + } + return; + } + if (value == null) { + topics.push(null); + } + else if (param.baseType === "array" || param.baseType === "tuple") { + interface_logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } + else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } + else { + topics.push(encodeTopic(param, value)); + } + }); + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(eventFragment, values) { + if (typeof (eventFragment) === "string") { + eventFragment = this.getEvent(eventFragment); + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + if (values.length !== eventFragment.inputs.length) { + interface_logger.throwArgumentError("event arguments/values mismatch", "values", values); + } + eventFragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)); + } + else if (param.type === "bytes") { + topics.push(lib_esm_keccak256(value)); + } + else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } + else { + topics.push(this._abiCoder.encode([param.type], [value])); + } + } + else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this._abiCoder.encode(dataTypes, dataValues), + topics: topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(eventFragment, data, topics) { + if (typeof (eventFragment) === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (topics != null && !eventFragment.anonymous) { + let topicHash = this.getEventTopic(eventFragment); + if (!lib_esm_isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { + interface_logger.throwError("fragment/topic mismatch", lib_esm_Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); + } + topics = topics.slice(1); + } + let indexed = []; + let nonIndexed = []; + let dynamic = []; + eventFragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name })); + dynamic.push(true); + } + else { + indexed.push(param); + dynamic.push(false); + } + } + else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + let resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, lib_esm_concat(topics)) : null; + let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true); + let result = []; + let nonIndexedIndex = 0, indexedIndex = 0; + eventFragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (resultIndexed == null) { + result[index] = new Indexed({ _isIndexed: true, hash: null }); + } + else if (dynamic[index]) { + result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] }); + } + else { + try { + result[index] = resultIndexed[indexedIndex++]; + } + catch (error) { + result[index] = error; + } + } + } + else { + try { + result[index] = resultNonIndexed[nonIndexedIndex++]; + } + catch (error) { + result[index] = error; + } + } + // Add the keyword argument if named and safe + if (param.name && result[param.name] == null) { + const value = result[index]; + // Make error named values throw on access + if (value instanceof Error) { + Object.defineProperty(result, param.name, { + enumerable: true, + get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); } + }); + } + else { + result[param.name] = value; + } + } + }); + // Make all error indexed values throw on access + for (let i = 0; i < result.length; i++) { + const value = result[i]; + if (value instanceof Error) { + Object.defineProperty(result, i, { + enumerable: true, + get: () => { throw wrapAccessError(`index ${i}`, value); } + }); + } + } + return Object.freeze(result); + } + // Given a transaction, find the matching function fragment (if any) and + // determine all its properties and call parameters + parseTransaction(tx) { + let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase()); + if (!fragment) { + return null; + } + return new TransactionDescription({ + args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)), + functionFragment: fragment, + name: fragment.name, + signature: fragment.format(), + sighash: this.getSighash(fragment), + value: lib_esm_bignumber_BigNumber.from(tx.value || "0"), + }); + } + // @TODO + //parseCallResult(data: BytesLike): ?? + // Given an event log, find the matching event fragment (if any) and + // determine all its properties and values + parseLog(log) { + let fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + return new LogDescription({ + eventFragment: fragment, + name: fragment.name, + signature: fragment.format(), + topic: this.getEventTopic(fragment), + args: this.decodeEventLog(fragment, log.data, log.topics) + }); + } + parseError(data) { + const hexData = lib_esm_hexlify(data); + let fragment = this.getError(hexData.substring(0, 10).toLowerCase()); + if (!fragment) { + return null; + } + return new ErrorDescription({ + args: this._abiCoder.decode(fragment.inputs, "0x" + hexData.substring(10)), + errorFragment: fragment, + name: fragment.name, + signature: fragment.format(), + sighash: this.getSighash(fragment), + }); + } + /* + static from(value: Array | string | Interface) { + if (Interface.isInterface(value)) { + return value; + } + if (typeof(value) === "string") { + return new Interface(JSON.parse(value)); + } + return new Interface(value); + } + */ + static isInterface(value) { + return !!(value && value._isInterface); + } +} +//# sourceMappingURL=interface.js.map +;// CONCATENATED MODULE: ./src/ParametersBuilder.ts + +/** + * ParametersBuilder is a helper class to build contract function parameters + * @class + * Used in {@link BladeSDK#contractCallFunction}, {@link BladeSDK#contractCallQueryFunction} and {@link BladeSDK#getParamsSignature} + * + * @example + * const params = new ParametersBuilder() + * .addAddress("0.0.123") + * .addUInt8(42) + * .addBytes32([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F]) + * .addString("Hello World") + * .addTuple(new ParametersBuilder().addAddress("0.0.456").addUInt8(42)) + * ; + * + */ +var ParametersBuilder = /** @class */ (function () { + function ParametersBuilder() { + this.params = []; + } + ParametersBuilder.prototype.addAddress = function (value) { + this.params.push({ type: "address", value: [value.toString()] }); + return this; + }; + ParametersBuilder.prototype.addAddressArray = function (value) { + this.params.push({ type: "address[]", value: value.map(function (v) { return v.toString(); }) }); + return this; + }; + ParametersBuilder.prototype.addBytes32 = function (value) { + if (!(value instanceof Uint8Array)) { + value = Uint8Array.from(value); + } + if (value.length !== 32) { + throw new Error("Bytes32 must be 32 bytes long"); + } + var encodedValue = node_modules_buffer.Buffer.from("[".concat(value.toString(), "]")).toString('base64'); + this.params.push({ type: "bytes32", value: [encodedValue] }); + return this; + }; + ParametersBuilder.prototype.addUInt8 = function (value) { + this.params.push({ type: "uint8", value: [value.toString()] }); + return this; + }; + ParametersBuilder.prototype.addUInt64 = function (value) { + this.params.push({ type: "uint64", value: [value.toString()] }); + return this; + }; + ParametersBuilder.prototype.addUInt64Array = function (value) { + this.params.push({ type: "uint64[]", value: value.map(function (v) { return v.toString(); }) }); + return this; + }; + ParametersBuilder.prototype.addInt64 = function (value) { + this.params.push({ type: "int64", value: [value.toString()] }); + return this; + }; + ParametersBuilder.prototype.addUInt256 = function (value) { + this.params.push({ type: "uint256", value: [value.toString()] }); + return this; + }; + ParametersBuilder.prototype.addUInt256Array = function (value) { + this.params.push({ type: "uint256[]", value: value.map(function (v) { return v.toString(); }) }); + return this; + }; + ParametersBuilder.prototype.addTuple = function (value) { + this.params.push({ type: "tuple", value: [value.encode()] }); + return this; + }; + ParametersBuilder.prototype.addTupleArray = function (value) { + this.params.push({ type: "tuple[]", value: value.map(function (val) { return val.encode(); }) }); + return this; + }; + ParametersBuilder.prototype.addString = function (value) { + this.params.push({ type: "string", value: [value] }); + return this; + }; + ParametersBuilder.prototype.addStringArray = function (value) { + this.params.push({ type: "string[]", value: value }); + return this; + }; + /** + * Encodes the parameters to a base64 string, compatible with the methods of the BladeSDK + * Calling this method is optional, as the BladeSDK will automatically encode the parameters if needed + */ + ParametersBuilder.prototype.encode = function () { + return node_modules_buffer.Buffer.from(JSON.stringify(this.params)).toString("base64"); + }; + return ParametersBuilder; +}()); + + +;// CONCATENATED MODULE: ./src/helpers/ContractHelpers.ts +var ContractHelpers_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var ContractHelpers_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; + + + + +var getContractFunctionBytecode = function (functionName, paramsEncoded) { return ContractHelpers_awaiter(void 0, void 0, void 0, function () { + var _a, types, values, functionSignature, functionIdentifier, abiCoder, encodedBytes; + return ContractHelpers_generator(this, function (_b) { + switch (_b.label) { + case 0: return [4 /*yield*/, parseContractFunctionParams(paramsEncoded)]; + case 1: + _a = _b.sent(), types = _a.types, values = _a.values; + functionSignature = "".concat(functionName, "(").concat(types.join(","), ")"); + functionIdentifier = new Interface([ + FunctionFragment.from(functionSignature) + ]).getSighash(functionName); + abiCoder = new AbiCoder(); + encodedBytes = abiCoder.encode(types, values); + return [2 /*return*/, node_modules_buffer.Buffer.concat([ + lib_esm_arrayify(functionIdentifier), + lib_esm_arrayify(encodedBytes) + ])]; + } + }); +}); }; +var parseContractFunctionParams = function (paramsEncoded) { return ContractHelpers_awaiter(void 0, void 0, void 0, function () { + var types, values, paramsData, i, param, _a, _b, _c, result, i_1, _d, _e, result, result, i_2, _f, _g, tupleTypes, i_3; + return ContractHelpers_generator(this, function (_h) { + switch (_h.label) { + case 0: + types = []; + values = []; + if (paramsEncoded instanceof ParametersBuilder) { + paramsEncoded = paramsEncoded.encode(); + } + paramsData = JSON.parse(node_modules_buffer.Buffer.from(paramsEncoded, "base64").toString()); + i = 0; + _h.label = 1; + case 1: + if (!(i < paramsData.length)) return [3 /*break*/, 23]; + param = paramsData[i]; + _a = param === null || param === void 0 ? void 0 : param.type; + switch (_a) { + case "address": return [3 /*break*/, 2]; + case "address[]": return [3 /*break*/, 4]; + case "bytes32": return [3 /*break*/, 9]; + case "uint8": return [3 /*break*/, 10]; + case "int64": return [3 /*break*/, 10]; + case "uint64": return [3 /*break*/, 10]; + case "uint256": return [3 /*break*/, 10]; + case "uint64[]": return [3 /*break*/, 11]; + case "uint256[]": return [3 /*break*/, 11]; + case "tuple": return [3 /*break*/, 12]; + case "tuple[]": return [3 /*break*/, 14]; + case "string": return [3 /*break*/, 19]; + case "string[]": return [3 /*break*/, 20]; + } + return [3 /*break*/, 21]; + case 2: + // ["0.0.48619523"] + types.push(param.type); + _c = (_b = values).push; + return [4 /*yield*/, valueToSolidity(param.value[0])]; + case 3: + _c.apply(_b, [_h.sent()]); + return [3 /*break*/, 22]; + case 4: + result = []; + i_1 = 0; + _h.label = 5; + case 5: + if (!(i_1 < param.value.length)) return [3 /*break*/, 8]; + _e = (_d = result).push; + return [4 /*yield*/, valueToSolidity(param.value[i_1])]; + case 6: + _e.apply(_d, [_h.sent()]); + _h.label = 7; + case 7: + i_1++; + return [3 /*break*/, 5]; + case 8: + types.push(param.type); + values.push(result); + return [3 /*break*/, 22]; + case 9: + { + // "WzAsMSwyLDMsNCw1LDYsNyw4LDksMTAsMTEsMTIsMTMsMTQsMTUsMTYsMTcsMTgsMTksMjAsMjEsMjIsMjMsMjQsMjUsMjYsMjcsMjgsMjksMzAsMzFd" + // base64 decode -> json parse -> data + types.push(param.type); + values.push(Uint8Array.from(JSON.parse(atob(param.value[0])))); + } + return [3 /*break*/, 22]; + case 10: + { + types.push(param.type); + values.push(param.value[0]); + } + return [3 /*break*/, 22]; + case 11: + { + types.push(param.type); + values.push(param.value); + } + return [3 /*break*/, 22]; + case 12: return [4 /*yield*/, parseContractFunctionParams(param.value[0])]; + case 13: + result = _h.sent(); + types.push("(".concat(result.types, ")")); + values.push(result.values); + return [3 /*break*/, 22]; + case 14: + result = []; + i_2 = 0; + _h.label = 15; + case 15: + if (!(i_2 < param.value.length)) return [3 /*break*/, 18]; + _g = (_f = result).push; + return [4 /*yield*/, parseContractFunctionParams(param.value[i_2])]; + case 16: + _g.apply(_f, [_h.sent()]); + _h.label = 17; + case 17: + i_2++; + return [3 /*break*/, 15]; + case 18: + tupleTypes = result[0].types.toString(); + for (i_3 = 1; i_3 < result.length; i_3++) { + if (result[i_3].types.toString() !== tupleTypes) { + throw { + name: "BladeSDK.JS", + reason: "Tuple structure in array must be the same" + }; + } + } + types.push("(".concat(result[0].types, ")[]")); + values.push(result.map(function (_a) { + var values = _a.values; + return values; + })); + return [3 /*break*/, 22]; + case 19: + { + types.push(param.type); + values.push(param.value[0]); + } + return [3 /*break*/, 22]; + case 20: + { + types.push(param.type); + values.push(param.value); + } + return [3 /*break*/, 22]; + case 21: + { + throw { + name: "BladeSDK.JS", + reason: "Type \"".concat(param === null || param === void 0 ? void 0 : param.type, "\" not implemented on JS") + }; + } + _h.label = 22; + case 22: + i++; + return [3 /*break*/, 1]; + case 23: return [2 /*return*/, { types: types, values: values }]; + } + }); +}); }; +var valueToSolidity = function (value) { return ContractHelpers_awaiter(void 0, void 0, void 0, function () { + return ContractHelpers_generator(this, function (_a) { + // if input.length >=32 - return as EVM address + // else convert input to solidity + if (value.length >= 32) { + return [2 /*return*/, value]; + } + else { + return [2 /*return*/, "0x".concat(AccountId_AccountId.fromString(value).toSolidityAddress())]; + } + return [2 /*return*/]; + }); +}); }; +var parseContractQueryResponse = function (contractFunctionResult, resultTypes) { return ContractHelpers_awaiter(void 0, void 0, void 0, function () { + var result, availableTypes; + return ContractHelpers_generator(this, function (_a) { + result = []; + availableTypes = ["bytes32", "address", "string", "bool", "int32", "uint32", "int40", "uint40", "int48", "uint48", "int56", "uint56", "int64", "uint64", "int72", "uint72", "int80", "uint80", "int88", "uint88", "int96", "uint96", "int104", "uint104", "int112", "uint112", "int120", "uint120", "int128", "uint128", "int136", "uint136", "int144", "uint144", "int152", "uint152", "int160", "uint160", "int168", "uint168", "int176", "uint176", "int184", "uint184", "int192", "uint192", "int200", "uint200", "int208", "uint208", "int216", "uint216", "int224", "uint224", "int232", "uint232", "int240", "uint240", "int248", "uint248", "int256", "uint256"]; + resultTypes.forEach(function (type, index) { + type = type.toLowerCase(); + if (!availableTypes.includes(type)) { + throw { + name: "BladeSDK.JS", + reason: "Type '".concat(type, "' unsupported. Available types: ").concat(availableTypes.join(", ")) + }; + } + var method = "get".concat(type.slice(0, 1).toUpperCase()).concat(type.slice(1)); + // @ts-ignore + var value = contractFunctionResult[method](index).toString(); + if (type === "bytes32") { + value = node_modules_buffer.Buffer.from(value).toString("hex"); + } + result.push({ type: type, value: value }); + }); + return [2 /*return*/, result]; + }); +}); }; + +;// CONCATENATED MODULE: ./src/unity.ts +var unity_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var unity_generator = (undefined && undefined.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; + + + + + + + + + + +Object.assign(globalThis, { + unityEnv: true, + Buffer: node_modules_buffer.Buffer, + TextEncoder: text_encoding.TextEncoder, + TextDecoder: text_encoding.TextDecoder, + btoa: function (str) { return node_modules_buffer.Buffer.from(str, "binary").toString("base64"); }, +}); +var BladeUnitySDK = /** @class */ (function () { + function BladeUnitySDK() { + this.apiKey = ""; + this.network = Networks_Network.Testnet; + this.dAppCode = ""; + this.visitorId = ""; + this.sdkEnvironment = Common_SdkEnvironment.Prod; + this.sdkVersion = config.sdkVersion; + } + BladeUnitySDK.prototype.init = function (apiKey, network, dAppCode, visitorId, sdkEnvironment, sdkVersion) { + if (sdkEnvironment === void 0) { sdkEnvironment = Common_SdkEnvironment.Prod; } + if (sdkVersion === void 0) { sdkVersion = config.sdkVersion; } + return unity_awaiter(this, void 0, void 0, function () { + return unity_generator(this, function (_a) { + this.apiKey = apiKey; + this.network = helpers_StringHelpers.stringToNetwork(network); + this.dAppCode = dAppCode; + this.visitorId = visitorId; + this.sdkEnvironment = sdkEnvironment; + this.sdkVersion = sdkVersion; + initApiService(sdkVersion, visitorId, apiKey, sdkEnvironment); + return [2 /*return*/, { + apiKey: this.apiKey, + dAppCode: this.dAppCode, + network: this.network, + visitorId: this.visitorId, + sdkEnvironment: this.sdkEnvironment, + sdkVersion: this.sdkVersion, + nonce: Math.round(Math.random() * 1000000000) + }]; + }); + }); + }; + BladeUnitySDK.prototype.transferHbars = function (accountId, accountPrivateKey, receiverID, amount, memo) { + return unity_awaiter(this, void 0, void 0, function () { + var client, parsedAmount, tx, _a, _b, error_1; + return unity_generator(this, function (_c) { + switch (_c.label) { + case 0: + _c.trys.push([0, 2, , 3]); + client = this.getClient(); + client.setOperator(accountId, accountPrivateKey); + parsedAmount = parseFloat(amount); + _b = (_a = node_modules_buffer.Buffer).from; + return [4 /*yield*/, (new TransferTransaction() + .addHbarTransfer(receiverID, parsedAmount) + .addHbarTransfer(accountId, -1 * parsedAmount) + .setTransactionMemo(memo) + .freezeWith(client) + .sign(src_PrivateKey_PrivateKey.fromString(accountPrivateKey)))]; + case 1: + tx = _b.apply(_a, [(_c.sent()).toBytes()]).toString('hex'); + return [2 /*return*/, this.sendMessageToNative({ + tx: tx, + network: this.network, + })]; + case 2: + error_1 = _c.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_1)]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.signTransaction = function (transactionBytes, encoding, accountPrivateKey) { + return unity_awaiter(this, void 0, void 0, function () { + var buffer, transaction, tx, _a, _b; + return unity_generator(this, function (_c) { + switch (_c.label) { + case 0: + buffer = node_modules_buffer.Buffer.from(transactionBytes, encoding); + transaction = Transaction_Transaction.fromBytes(buffer); + _b = (_a = node_modules_buffer.Buffer).from; + return [4 /*yield*/, transaction.sign(src_PrivateKey_PrivateKey.fromString(accountPrivateKey))]; + case 1: + tx = _b.apply(_a, [(_c.sent()).toBytes()]).toString("hex"); + return [2 /*return*/, this.sendMessageToNative({ + tx: tx, + network: this.network, + })]; + } + }); + }); + }; + BladeUnitySDK.prototype.getEncryptedToken = function (type) { + if (type === void 0) { type = EncryptedType.tvte; } + return unity_awaiter(this, void 0, void 0, function () { + var _a, error_2; + var _b; + return unity_generator(this, function (_c) { + switch (_c.label) { + case 0: + _c.trys.push([0, 2, , 3]); + _a = this.sendMessageToNative; + _b = {}; + return [4 /*yield*/, getEncryptedHeader(Environment.node, type)]; + case 1: return [2 /*return*/, _a.apply(this, [(_b.value = _c.sent(), + _b)])]; + case 2: + error_2 = _c.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_2)]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.transferTokens = function (tokenId, accountId, accountPrivateKey, receiverID, correctedAmount, memo) { + return unity_awaiter(this, void 0, void 0, function () { + var client, tx, _a, _b, error_3; + return unity_generator(this, function (_c) { + switch (_c.label) { + case 0: + _c.trys.push([0, 2, , 3]); + client = this.getClient(); + client.setOperator(accountId, accountPrivateKey); + _b = (_a = node_modules_buffer.Buffer).from; + return [4 /*yield*/, (new TransferTransaction() + .addTokenTransfer(tokenId, receiverID, correctedAmount) + .addTokenTransfer(tokenId, accountId, -1 * correctedAmount) + .setTransactionMemo(memo) + .freezeWith(client) + .sign(src_PrivateKey_PrivateKey.fromString(accountPrivateKey)))]; + case 1: + tx = _b.apply(_a, [(_c.sent()).toBytes()]).toString('hex'); + return [2 /*return*/, this.sendMessageToNative({ + tx: tx, + network: this.network, + })]; + case 2: + error_3 = _c.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_3)]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.getAccountInfo = function (accountId, evmAddress, publicKey) { + return unity_awaiter(this, void 0, void 0, function () { + var result; + return unity_generator(this, function (_a) { + try { + result = { + accountId: accountId, + evmAddress: (evmAddress ? evmAddress : "0x".concat(AccountId_AccountId.fromString(accountId).toSolidityAddress())), + calculatedEvmAddress: computeAddress("0x".concat(publicKey)).toLowerCase() + }; + return [2 /*return*/, this.sendMessageToNative(result)]; + } + catch (error) { + return [2 /*return*/, this.sendMessageToNative(null, error)]; + } + return [2 /*return*/]; + }); + }); + }; + BladeUnitySDK.prototype.generateKeys = function () { + return unity_awaiter(this, void 0, void 0, function () { + var privateKey, publicKey; + return unity_generator(this, function (_a) { + try { + privateKey = src_PrivateKey_PrivateKey.generateECDSA(); + publicKey = privateKey.publicKey.toStringDer(); + return [2 /*return*/, this.sendMessageToNative({ + privateKey: privateKey.toStringDer(), + publicKey: publicKey, + evmAddress: computeAddress("0x".concat(privateKey.publicKey.toStringRaw())) + })]; + } + catch (error) { + return [2 /*return*/, this.sendMessageToNative(null, error)]; + } + return [2 /*return*/]; + }); + }); + }; + BladeUnitySDK.prototype.deleteAccount = function (deleteAccountId, deletePrivateKey, transferAccountId, operatorAccountId, operatorPrivateKey) { + return unity_awaiter(this, void 0, void 0, function () { + var client, deleteAccountKey, operatorAccountKey, transaction, tx, error_4; + return unity_generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 3, , 4]); + client = this.getClient(); + deleteAccountKey = src_PrivateKey_PrivateKey.fromString(deletePrivateKey); + operatorAccountKey = src_PrivateKey_PrivateKey.fromString(operatorPrivateKey); + client.setOperator(operatorAccountId, operatorAccountKey); + return [4 /*yield*/, (new AccountDeleteTransaction() + .setAccountId(deleteAccountId) + .setTransferAccountId(transferAccountId) + .freezeWith(client) + .sign(deleteAccountKey))]; + case 1: return [4 /*yield*/, (_a.sent()).sign(operatorAccountKey)]; + case 2: + transaction = _a.sent(); + tx = node_modules_buffer.Buffer.from(transaction.toBytes()).toString('hex'); + return [2 /*return*/, this.sendMessageToNative({ + tx: tx, + network: this.network, + })]; + case 3: + error_4 = _a.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_4)]; + case 4: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.contractCallFunctionTransaction = function (contractId, functionName, paramsEncoded, accountId, accountPrivateKey, gas) { + if (gas === void 0) { gas = 100000; } + return unity_awaiter(this, void 0, void 0, function () { + var client, contractFunctionParameters, transaction, tx, error_5; + return unity_generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 3, , 4]); + client = this.getClient(); + client.setOperator(accountId, accountPrivateKey); + return [4 /*yield*/, getContractFunctionBytecode(functionName, paramsEncoded)]; + case 1: + contractFunctionParameters = _a.sent(); + return [4 /*yield*/, (new ContractExecuteTransaction() + .setContractId(contractId) + .setGas(gas) + .setFunction(functionName) + .setFunctionParameters(contractFunctionParameters) + .freezeWith(client) + .sign(src_PrivateKey_PrivateKey.fromString(accountPrivateKey)))]; + case 2: + transaction = _a.sent(); + tx = node_modules_buffer.Buffer.from(transaction.toBytes()).toString('hex'); + return [2 /*return*/, this.sendMessageToNative({ + tx: tx, + network: this.network, + })]; + case 3: + error_5 = _a.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_5)]; + case 4: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.getContractCallBytecode = function (functionName, paramsEncoded) { + return unity_awaiter(this, void 0, void 0, function () { + var contractFunctionParameters, error_6; + return unity_generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, getContractFunctionBytecode(functionName, paramsEncoded)]; + case 1: + contractFunctionParameters = _a.sent(); + return [2 /*return*/, this.sendMessageToNative({ + contractFunctionParameters: contractFunctionParameters.toString('base64') + })]; + case 2: + error_6 = _a.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_6)]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.contractCallQueryFunction = function (contractId, functionName, paramsEncoded, accountId, accountPrivateKey, gas, fee, nodeAccountId) { + if (gas === void 0) { gas = 100000; } + if (fee === void 0) { fee = 10000000; } + if (nodeAccountId === void 0) { nodeAccountId = "0.0.3"; } + return unity_awaiter(this, void 0, void 0, function () { + var stopWhisperingMsg_1, privateKey_1, contractFunctionParameters, globalSignedTx_1, sharedTimestamp, clientWhisper, queryHex, q1, error_7, error_8; + var _this = this; + return unity_generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 7, , 8]); + stopWhisperingMsg_1 = "All signs are collected. Stop whispering"; + privateKey_1 = src_PrivateKey_PrivateKey.fromString(accountPrivateKey); + return [4 /*yield*/, getContractFunctionBytecode(functionName, paramsEncoded)]; + case 1: + contractFunctionParameters = _a.sent(); + globalSignedTx_1 = []; + sharedTimestamp = Date.now(); + clientWhisper = this.getClient(); + clientWhisper.setOperatorWith(accountId, privateKey_1.publicKey, function (buf) { return unity_awaiter(_this, void 0, void 0, function () { + var signature; + return unity_generator(this, function (_a) { + signature = node_modules_buffer.Buffer.from(privateKey_1.sign(buf)); + globalSignedTx_1.push(signature.toString("hex")); + if (globalSignedTx_1.length >= 1) { + throw new Error(stopWhisperingMsg_1); + } + return [2 /*return*/, node_modules_buffer.Buffer.from("")]; + }); + }); }); + queryHex = node_modules_buffer.Buffer.from(new ContractCallQuery() + .setContractId(contractId) + .setGas(gas) + .setFunction(functionName) + .setFunctionParameters(contractFunctionParameters) + .toBytes()).toString("hex"); + return [4 /*yield*/, Query_Query.fromBytes(node_modules_buffer.Buffer.from(queryHex, "hex")) + .setNodeAccountIds([AccountId_AccountId.fromString(nodeAccountId)]) + .setQueryPayment(Hbar_Hbar.fromTinybars(fee)) + .setPaymentTransactionId(new TransactionId_TransactionId(AccountId_AccountId.fromString(accountId), Timestamp_Timestamp.fromDate(new Date(sharedTimestamp))))]; + case 2: + q1 = _a.sent(); + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4 /*yield*/, q1.execute(clientWhisper)]; + case 4: + _a.sent(); + return [3 /*break*/, 6]; + case 5: + error_7 = _a.sent(); + if (error_7.message !== stopWhisperingMsg_1) { + throw error_7; + } + return [2 /*return*/, this.sendMessageToNative({ + queryHex: queryHex, + signedBuffers: globalSignedTx_1, + sharedTimestamp: sharedTimestamp, + nodeAccountId: nodeAccountId, + publicKey: privateKey_1.publicKey.toStringDer(), + accountId: accountId, + fee: fee, + network: this.network, + })]; + case 6: return [3 /*break*/, 8]; + case 7: + error_8 = _a.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_8)]; + case 8: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.parseContractCallQueryResponse = function (contractId, gasUsed, rawResult, resultTypes) { + return unity_awaiter(this, void 0, void 0, function () { + var response, values, error_9; + return unity_generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + response = new ContractFunctionResult({ + contractNonces: [], + signerNonce: undefined, + _createResult: false, + contractId: ContractId_ContractId.fromString(contractId), + errorMessage: "", + bloom: Uint8Array.from([]), + logs: [], + createdContractIds: [], + evmAddress: null, + bytes: node_modules_buffer.Buffer.from(rawResult, "base64"), + // @ts-ignore + gasUsed: gasUsed, + // @ts-ignore + gas: gasUsed, + // @ts-ignore + amount: gasUsed, + functionParameters: Uint8Array.from([]), + senderAccountId: null, + stateChanges: [] + }); + return [4 /*yield*/, parseContractQueryResponse(response, resultTypes)]; + case 1: + values = _a.sent(); + return [2 /*return*/, this.sendMessageToNative({ + values: values, + gasUsed: parseInt(response.gasUsed.toString(), 10) + })]; + case 2: + error_9 = _a.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_9)]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.sign = function (messageString, privateKey, encoding) { + return unity_awaiter(this, void 0, void 0, function () { + var key, signed; + return unity_generator(this, function (_a) { + try { + key = src_PrivateKey_PrivateKey.fromString(privateKey); + signed = key.sign(node_modules_buffer.Buffer.from(messageString, encoding)); + return [2 /*return*/, this.sendMessageToNative({ + signedMessage: node_modules_buffer.Buffer.from(signed).toString("hex") + })]; + } + catch (error) { + return [2 /*return*/, this.sendMessageToNative(null, error)]; + } + return [2 /*return*/]; + }); + }); + }; + BladeUnitySDK.prototype.signVerify = function (messageString, signature, publicKey, encoding) { + return unity_awaiter(this, void 0, void 0, function () { + var valid; + return unity_generator(this, function (_a) { + try { + valid = src_PublicKey_PublicKey.fromString(publicKey).verify(node_modules_buffer.Buffer.from(messageString, encoding), node_modules_buffer.Buffer.from(signature, "hex")); + return [2 /*return*/, this.sendMessageToNative({ valid: valid })]; + } + catch (error) { + return [2 /*return*/, this.sendMessageToNative(null, error)]; + } + return [2 /*return*/]; + }); + }); + }; + BladeUnitySDK.prototype.hethersSign = function (messageString, privateKey, encoding) { + return unity_awaiter(this, void 0, void 0, function () { + var wallet, signedMessage, error_10; + return unity_generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + wallet = new lib_esm_Wallet(src_PrivateKey_PrivateKey.fromStringDer(privateKey).toStringRaw()); + return [4 /*yield*/, wallet.signMessage(node_modules_buffer.Buffer.from(messageString, encoding))]; + case 1: + signedMessage = _a.sent(); + return [2 /*return*/, this.sendMessageToNative({ + signedMessage: signedMessage + })]; + case 2: + error_10 = _a.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_10)]; + case 3: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.splitSignature = function (signature) { + return unity_awaiter(this, void 0, void 0, function () { + var _a, v, r, s; + return unity_generator(this, function (_b) { + try { + _a = lib_esm_splitSignature(signature), v = _a.v, r = _a.r, s = _a.s; + return [2 /*return*/, this.sendMessageToNative({ v: v, r: r, s: s })]; + } + catch (error) { + return [2 /*return*/, this.sendMessageToNative(null, error)]; + } + return [2 /*return*/]; + }); + }); + }; + BladeUnitySDK.prototype.getParamsSignature = function (paramsEncoded, privateKey) { + return unity_awaiter(this, void 0, void 0, function () { + var _a, types, values, hash, messageHashBytes, wallet, signed, _b, v, r, s, error_11; + return unity_generator(this, function (_c) { + switch (_c.label) { + case 0: + _c.trys.push([0, 3, , 4]); + return [4 /*yield*/, parseContractFunctionParams(paramsEncoded)]; + case 1: + _a = _c.sent(), types = _a.types, values = _a.values; + hash = lib_esm_keccak256(defaultAbiCoder.encode(types, values)); + messageHashBytes = lib_esm_arrayify(hash); + wallet = new lib_esm_Wallet(src_PrivateKey_PrivateKey.fromStringDer(privateKey).toStringRaw()); + return [4 /*yield*/, wallet.signMessage(messageHashBytes)]; + case 2: + signed = _c.sent(); + _b = lib_esm_splitSignature(signed), v = _b.v, r = _b.r, s = _b.s; + return [2 /*return*/, this.sendMessageToNative({ v: v, r: r, s: s })]; + case 3: + error_11 = _c.sent(); + return [2 /*return*/, this.sendMessageToNative(null, error_11)]; + case 4: return [2 /*return*/]; + } + }); + }); + }; + BladeUnitySDK.prototype.getClient = function () { + return this.network === Networks_Network.Testnet ? WebClient.forTestnet() : WebClient.forMainnet(); + }; + BladeUnitySDK.prototype.sendMessageToNative = function (data, error) { + if (error === void 0) { error = null; } + // web-view bridge response + var responseObject = { + data: data + }; + if (error) { + responseObject.error = { + name: (error === null || error === void 0 ? void 0 : error.name) || "Error", + reason: error.reason || error.message || JSON.stringify(error) + }; + } + return JSON.stringify(responseObject); + }; + return BladeUnitySDK; +}()); + +if (window) + window["bladeSdk"] = new BladeUnitySDK(); + +}(); +JSUnityWrapper = __webpack_exports__; /******/ })() ; \ No newline at end of file diff --git a/Runtime/BladeSDK.cs b/Runtime/BladeSDK.cs index 6a0d4de..efa1471 100644 --- a/Runtime/BladeSDK.cs +++ b/Runtime/BladeSDK.cs @@ -384,7 +384,7 @@ private T processResponse(string rawJson) { BladeJSError error = (BladeJSError)response.error; if (error.name != null || error.reason != null) { - Debug.Log($"processResponse() throwing BladeSDKException({error.name}, {error.reason})"); + Debug.Log($"processResponse() throwing BladeSDKException({error.name}, {error.reason})\n\n\n{rawJson}"); throw new BladeSDKException(error.name, error.reason); } diff --git a/Samples~/Sample1/SampleExample.cs b/Samples~/Sample1/SampleExample.cs index f35516f..2541153 100644 --- a/Samples~/Sample1/SampleExample.cs +++ b/Samples~/Sample1/SampleExample.cs @@ -11,7 +11,7 @@ async void Start() BladeSDK bladeSdk = new BladeSDK("Rww3x27z3Q9rrIvRQ6qGgIRppxz5e5HHPWdARyxnMXpe77WD5MW39REBXXvRZsZE", Network.Testnet, "unitysdktest", SdkEnvironment.CI); // get info - // Debug.Log(await bladeSdk.getInfo()); + Debug.Log(await bladeSdk.getInfo()); // get account info // Debug.Log(await bladeSdk.getAccountInfo("0.0.346533")); diff --git a/Tests/Runtime/BladeSDKTest.cs b/Tests/Runtime/BladeSDKTest.cs index f3a1c93..c408178 100644 --- a/Tests/Runtime/BladeSDKTest.cs +++ b/Tests/Runtime/BladeSDKTest.cs @@ -20,16 +20,16 @@ public class BladeSDKTests Network network = Network.Testnet; string dAppCode = "unitysdktest"; SdkEnvironment sdkEnvironment = SdkEnvironment.CI; - string accountId0 = "0.0.346533"; + string accountId0 = "0.0.1443"; string accountId0Private = "3030020100300706052b8104000a04220420ebccecef769bb5597d0009123a0fd96d2cdbe041c2a2da937aaf8bdc8731799b"; string accountId0Public = "302d300706052b8104000a032200029dc73991b0d9cdbb59b2cd0a97a0eaff6de801726cb39804ea9461df6be2dd30"; - string accountId1 = "0.0.346530"; + string accountId1 = "0.0.1881"; - string token0DApp = "0.0.433870"; - string token1 = "0.0.416487"; + string token0DApp = "0.0.2216053"; + string token1 = "0.0.5449"; - string contractId = "0.0.416245"; + string contractId = "0.0.4437600"; // Assert.AreEqual("", info.sdkVersion, "OMG! Hack instead of Debug.Log" ); @@ -98,7 +98,7 @@ public IEnumerator TransferHbars() { public IEnumerator TransferTokens() { BladeSDK bladeSdk = new BladeSDK(apiKey, network, dAppCode, sdkEnvironment); var task = bladeSdk.transferTokens( - token1, + token0DApp, accountId0, accountId0Private, accountId1, @@ -336,9 +336,9 @@ public IEnumerator GetParamsSignature() { } SplitSignatureData splitSignatureData = task.Result; - Assert.AreEqual(true, splitSignatureData.v == 28 - && splitSignatureData.r == "0xe5e662d0564828fd18b2b5b228ade288ad063fadca76812f7902f56cae3e678e" - && splitSignatureData.s == "0x61b7ceb82dc6695872289b697a1bca73b81c494288abda29fa022bb7b80c84b5" + Assert.AreEqual(true, splitSignatureData.v == 27 + && splitSignatureData.r == "0x0c6e8f0487709cfc1ebbc41e47ce56aee5cf5bc933a4cd6cb2695b098dbe4ee4" + && splitSignatureData.s == "0x22d0b6351670c37eb112ebd80123452237cb5c893767510a9356214189f6fe86" ); }